diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-03-09 15:17:25 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-03-09 15:17:25 +0000 |
commit | 492aa4ee7086ed94cb2f37a2bce3b52905841659 (patch) | |
tree | 825b6d0ae66246bae7a65c1f610a65b59789a6b5 /wp-includes | |
parent | 359223a4711934ea6ec20e4c7613832e1f1132b5 (diff) | |
download | wordpress-mu-492aa4ee7086ed94cb2f37a2bce3b52905841659.tar.gz wordpress-mu-492aa4ee7086ed94cb2f37a2bce3b52905841659.tar.xz wordpress-mu-492aa4ee7086ed94cb2f37a2bce3b52905841659.zip |
WP Merge to rev 5007
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@909 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes')
33 files changed, 1658 insertions, 821 deletions
diff --git a/wp-includes/bookmark-template.php b/wp-includes/bookmark-template.php index e73edd7..54b6d15 100644 --- a/wp-includes/bookmark-template.php +++ b/wp-includes/bookmark-template.php @@ -326,15 +326,13 @@ function wp_list_bookmarks($args = '') { $output = ''; - if ( is_array($class) ) - $class = trim(join(' ', $class)); - if ( $categorize ) { //Split the bookmarks into ul's for each category $cats = get_categories("type=link&category_name=$category_name&include=$category&orderby=$category_orderby&order=$category_order&hierarchical=0"); foreach ( (array) $cats as $cat ) { - $bookmarks = get_bookmarks("limit=$limit&category={$cat->cat_ID}&show_updated=$show_updated&orderby=$orderby&order=$order&hide_invisible=$hide_invisible&show_updated=$show_updated"); + $params = array_merge($r, array('category'=>$cat->cat_ID)); + $bookmarks = get_bookmarks($params); if ( empty($bookmarks) ) continue; $output .= str_replace(array('%id', '%class'), array("linkcat-$cat->cat_ID", $class), $category_before); @@ -344,7 +342,7 @@ function wp_list_bookmarks($args = '') { } } else { //output one single list using title_li for the title - $bookmarks = get_bookmarks("limit=$limit&category=$category&show_updated=$show_updated&orderby=$orderby&order=$order&hide_invisible=$hide_invisible&show_updated=$show_updated"); + $bookmarks = get_bookmarks($r); if ( !empty($bookmarks) ) { if ( !empty( $title_li ) ){ diff --git a/wp-includes/classes.php b/wp-includes/classes.php index e8563ec..8c8dcd0 100644 --- a/wp-includes/classes.php +++ b/wp-includes/classes.php @@ -58,7 +58,7 @@ class WP { // 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, '', urldecode($req_uri)); + $req_uri = str_replace($pathinfo, '', rawurldecode($req_uri)); $req_uri = trim($req_uri, '/'); $req_uri = preg_replace("|^$home_path|", '', $req_uri); $req_uri = trim($req_uri, '/'); @@ -120,14 +120,14 @@ class WP { } // If req_uri is empty or if it is a request for ourself, unset error. - if ( empty($request) || $req_uri == $self || strstr($_SERVER['PHP_SELF'], 'wp-admin/') ) { + if (empty($request) || $req_uri == $self || strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false) { if (isset($_GET['error'])) unset($_GET['error']); if (isset($error)) unset($error); - if ( isset($perma_query_vars) && strstr($_SERVER['PHP_SELF'], 'wp-admin/') ) + if (isset($perma_query_vars) && strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false) unset($perma_query_vars); $this->did_permalink = false; @@ -148,6 +148,8 @@ class WP { $this->query_vars[$wpvar] = $_GET[$wpvar]; elseif (!empty($perma_query_vars[$wpvar])) $this->query_vars[$wpvar] = $perma_query_vars[$wpvar]; + + $this->query_vars[$wpvar] = (string) $this->query_vars[$wpvar]; } foreach ($this->private_query_vars as $var) { diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index 0782f33..ea3ce15 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -239,19 +239,19 @@ function trackback_url( $display = true ) { function trackback_rdf($timezone = 0) { global $id; - if (!stristr($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator')) { - 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('--', '--', wptexturize(strip_tags(get_the_title()))).'"'."\n"; - echo ' trackback:ping="'.trackback_url(0).'"'." />\n"; - echo '</rdf:RDF>'; + if (strpos($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator') !== false) { + 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('--', '--', wptexturize(strip_tags(get_the_title()))).'"'."\n"; + echo ' trackback:ping="'.trackback_url(0).'"'." />\n"; + echo '</rdf:RDF>'; } } diff --git a/wp-includes/cron.php b/wp-includes/cron.php index 40004ca..e9a6462 100644 --- a/wp-includes/cron.php +++ b/wp-includes/cron.php @@ -83,8 +83,18 @@ function spawn_cron() { $cron_url = get_option( 'siteurl' ) . '/wp-cron.php';
$parts = parse_url( $cron_url );
-
- $argyle = @ fsockopen( $parts['host'], $_SERVER['SERVER_PORT'], $errno, $errstr, 0.01 );
+
+ if ($parts['scheme'] == 'https') {
+ // support for SSL was added in 4.3.0
+ if (version_compare(phpversion(), '4.3.0', '>=') && function_exists('openssl_open')) {
+ $argyle = @fsockopen('ssl://' . $parts['host'], $_SERVER['SERVER_PORT'], $errno, $errstr, 0.01);
+ } else {
+ return false;
+ }
+ } else {
+ $argyle = @ fsockopen( $parts['host'], $_SERVER['SERVER_PORT'], $errno, $errstr, 0.01 );
+ }
+
if ( $argyle )
fputs( $argyle,
"GET {$parts['path']}?check=" . md5(DB_PASS . '187425') . " HTTP/1.0\r\n"
diff --git a/wp-includes/feed.php b/wp-includes/feed.php index f7db8bf..687a304 100644 --- a/wp-includes/feed.php +++ b/wp-includes/feed.php @@ -165,7 +165,7 @@ function the_category_rss($type = 'rss') { function html_type_rss() { $type = get_bloginfo('html_type'); - if ( strstr( $type, 'xhtml' ) ) + if (strpos($type, 'xhtml') !== false) $type = 'xhtml'; else $type = 'html'; diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index daafba3..718a217 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -29,10 +29,9 @@ function wptexturize($text) { if (isset($curl{0}) && '<' != $curl{0} && $next) { // If it's not a tag // static strings $curl = str_replace($static_characters, $static_replacements, $curl); - // regular expressions $curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl); - } elseif ( strstr($curl, '<code') || strstr($curl, '<pre') || strstr($curl, '<kbd') || strstr($curl, '<style') || strstr($curl, '<script') ) { + } elseif (strpos($curl, '<code') !== false || strpos($curl, '<pre') !== false || strpos($curl, '<kbd') !== false || strpos($curl, '<style') !== false || strpos($curl, '<script') !== false) { $next = false; } else { $next = true; @@ -78,7 +77,7 @@ function wpautop($pee, $br = 1) { } $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); - if ( strstr( $pee, '<pre' ) ) + if (strpos($pee, '<pre') !== false) $pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '</pre>' ", $pee); $pee = preg_replace( "|\n</p>$|", '</p>', $pee ); @@ -658,7 +657,7 @@ function convert_smilies($text) { function is_email($user_email) { $chars = "/^([a-z0-9+_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,6}\$/i"; - if(strstr($user_email, '@') && strstr($user_email, '.')) { + if (strpos($user_email, '@') !== false && strpos($user_email, '.') !== false) { if (preg_match($chars, $user_email)) { return true; } else { @@ -1072,7 +1071,7 @@ function clean_url( $url, $protocols = null ) { $strip = array('%0d', '%0a'); $url = str_replace($strip, '', $url); $url = str_replace(';//', '://', $url); - $url = (!strstr($url, '://')) ? 'http://'.$url : $url; + $url = (strpos($url, '://') === false) ? 'http://'.$url : $url; $url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&$1', $url); if ( !is_array($protocols) ) $protocols = array('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet'); diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 19eaa81..d843b39 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -797,7 +797,7 @@ function add_query_arg() { $protocol = ''; } - if ( strstr($uri, '?') ) { + if (strpos($uri, '?') !== false) { $parts = explode('?', $uri, 2); if ( 1 == count($parts) ) { $base = '?'; @@ -806,7 +806,7 @@ function add_query_arg() { $base = $parts[0] . '?'; $query = $parts[1]; } - } else if ( !empty($protocol) || strstr($uri, '/') ) { + } elseif (!empty($protocol) || strpos($uri, '/') !== false) { $base = $uri . '?'; $query = ''; } else { @@ -1134,17 +1134,28 @@ function wp_upload_bits($name, $type, $bits, $overwrite = false) { $ext = ''; else $ext = ".$ext"; - while ( file_exists($upload['path'] . "/$filename") && !$overwrite ) { + while ( file_exists($upload['path'] . "/$filename") ) { if ( '' == "$number$ext" ) $filename = $filename . ++$number . $ext; else $filename = str_replace("$number$ext", ++$number . $ext, $filename); } - $new_file = $upload['path'] . "/$filename"; - if ( ! wp_mkdir_p( dirname($new_file) ) ) { - $message = sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?'), dirname($new_file)); - return array('error' => $message); + // If we are asked to over write the file then make sure + // the $name has the complete path and is writable. + if($overwrite) { + if(!is_writable($name)) { + return(array("error" => __("Can not over write file."))); + } + $new_file = $name; + $filename = basename($name); + } + else { + $new_file = $upload['path'] . "/$filename"; + if ( ! wp_mkdir_p( dirname($new_file) ) ) { + $message = sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?'), dirname($new_file)); + return array('error' => $message); + } } $ifp = @ fopen($new_file, 'wb'); @@ -1159,8 +1170,11 @@ function wp_upload_bits($name, $type, $bits, $overwrite = false) { $perms = $perms & 0000666; @ chmod($new_file, $perms); - // Compute the URL + // Compute the URL if this is a new file. $url = $upload['url'] . "/$filename"; + if($overwrite) { + $url = $name; + } return array('file' => $new_file, 'url' => $url, 'error' => false); } @@ -1289,7 +1303,7 @@ function wp_nonce_ays($action) { $adminurl = get_option('siteurl') . '/wp-admin'; if ( wp_get_referer() ) - $adminurl = wp_specialchars(wp_get_referer(), 1); + $adminurl = attribute_escape(wp_get_referer()); $title = __('WordPress Confirmation'); // Remove extra layer of slashes. @@ -1342,7 +1356,7 @@ function wp_die( $message, $title = '' ) { if ( empty($title) ) $title = __('WordPress › Error'); - if ( strstr($_SERVER['PHP_SELF'], 'wp-admin') ) + if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) $admin_dir = ''; else $admin_dir = 'wp-admin/'; diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index b0fd238..81d696c 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -60,9 +60,11 @@ function wp_meta() { function bloginfo($show='') { $info = get_bloginfo($show); - if (!strstr($show, 'url') && //don't filter URLs - !strstr($show, 'directory') && - !strstr($show, 'home')) { + + // Don't filter URL's. + if (strpos($show, 'url') === false || + strpos($show, 'directory') === false || + strpos($show, 'home') === false) { $info = apply_filters('bloginfo', $info, $show); $info = convert_chars($info); } else { @@ -72,13 +74,18 @@ function bloginfo($show='') { echo $info; } - +/** + * Note: some of these values are DEPRECATED. Meaning they could be + * taken out at any time and shouldn't be relied upon. Options + * without "// DEPRECATED" are the preferred and recommended ways + * to get the information. + */ function get_bloginfo($show='') { switch($show) { case 'url' : - case 'home' : - case 'siteurl' : + case 'home' : // DEPRECATED + case 'siteurl' : // DEPRECATED $output = get_option('home'); break; case 'wpurl' : @@ -149,8 +156,7 @@ function get_bloginfo($show='') { function wp_title($sep = '»', $display = true) { - global $wpdb; - global $m, $year, $monthnum, $day, $category_name, $wp_locale, $posts; + global $wpdb, $wp_locale, $wp_query; $cat = get_query_var('cat'); $p = get_query_var('p'); @@ -158,6 +164,10 @@ function wp_title($sep = '»', $display = true) { $category_name = get_query_var('category_name'); $author = get_query_var('author'); $author_name = get_query_var('author_name'); + $m = get_query_var('m'); + $year = get_query_var('year'); + $monthnum = get_query_var('monthnum'); + $day = get_query_var('day'); $title = ''; // If there's a category @@ -165,8 +175,7 @@ function wp_title($sep = '»', $display = true) { // category exclusion if ( !stristr($cat,'-') ) $title = apply_filters('single_cat_title', get_the_category_by_ID($cat)); - } - if ( !empty($category_name) ) { + } elseif ( !empty($category_name) ) { if ( stristr($category_name,'/') ) { $category_name = explode('/',$category_name); if ( $category_name[count($category_name)-1] ) @@ -198,14 +207,15 @@ function wp_title($sep = '»', $display = true) { if ( !empty($year) ) { $title = $year; if ( !empty($monthnum) ) - $title .= " $sep ".$wp_locale->get_month($monthnum); + $title .= " $sep " . $wp_locale->get_month($monthnum); if ( !empty($day) ) - $title .= " $sep ".zeroise($day, 2); + $title .= " $sep " . zeroise($day, 2); } // If there is a post if ( is_single() || is_page() ) { - $title = strip_tags($posts[0]->post_title); + $post = $wp_query->get_queried_object(); + $title = strip_tags($post->post_title); $title = apply_filters('single_post_title', $title); } @@ -258,7 +268,12 @@ function single_cat_title($prefix = '', $display = true ) { function single_month_title($prefix = '', $display = true ) { - global $m, $monthnum, $wp_locale, $year; + 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); @@ -336,12 +351,12 @@ function wp_get_archives($args = '') { $add_hours = intval(get_option('gmt_offset')); $add_minutes = intval(60 * (get_option('gmt_offset') - $add_hours)); + //filters + $where = apply_filters('getarchives_where', "WHERE post_type = 'post' AND post_status = 'publish'", $r ); + $join = apply_filters('getarchives_join', "", $r); + if ( 'monthly' == $type ) { - $arcresults = wp_cache_get( md5('archives' . $type . $limit), 'general'); - if ( !$arcresults ) { - $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC" . $limit); - wp_cache_set( md5('archives' . $type . $limit), $arcresults, 'general', 86400 ); - } + $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC" . $limit); if ( $arcresults ) { $afterafter = $after; foreach ( $arcresults as $arcresult ) { @@ -353,7 +368,7 @@ function wp_get_archives($args = '') { } } } elseif ('yearly' == $type) { - $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts WHERE post_type ='post' AND post_status = 'publish' GROUP BY YEAR(post_date) ORDER BY post_date DESC" . $limit); + $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date) ORDER BY post_date DESC" . $limit); if ($arcresults) { $afterafter = $after; foreach ($arcresults as $arcresult) { @@ -365,7 +380,7 @@ function wp_get_archives($args = '') { } } } elseif ( 'daily' == $type ) { - $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, count(ID) as posts FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date DESC" . $limit); + $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date DESC" . $limit); if ( $arcresults ) { $afterafter = $after; foreach ( $arcresults as $arcresult ) { @@ -379,7 +394,7 @@ function wp_get_archives($args = '') { } } elseif ( 'weekly' == $type ) { $start_of_week = get_option('start_of_week'); - $arcresults = $wpdb->get_results("SELECT DISTINCT WEEK(post_date, $start_of_week) AS `week`, YEAR(post_date) AS yr, DATE_FORMAT(post_date, '%Y-%m-%d') AS yyyymmdd, count(ID) as posts FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' GROUP BY WEEK(post_date, $start_of_week), YEAR(post_date) ORDER BY post_date DESC" . $limit); + $arcresults = $wpdb->get_results("SELECT DISTINCT WEEK(post_date, $start_of_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(post_date, $start_of_week), YEAR(post_date) ORDER BY post_date DESC" . $limit); $arc_w_last = ''; $afterafter = $after; if ( $arcresults ) { @@ -400,7 +415,7 @@ function wp_get_archives($args = '') { } } elseif ( ( 'postbypost' == $type ) || ('alpha' == $type) ) { ('alpha' == $type) ? $orderby = "post_title ASC " : $orderby = "post_date DESC "; - $arcresults = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY $orderby $limit"); + $arcresults = $wpdb->get_results("SELECT * FROM $wpdb->posts $join $where $orderby $limit"); if ( $arcresults ) { foreach ( $arcresults as $arcresult ) { if ( $arcresult->post_date != '0000-00-00 00:00:00' ) { @@ -552,9 +567,7 @@ function get_calendar($initial = true) { $daywithpost = array(); } - - - if ( strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE') || strstr(strtolower($_SERVER['HTTP_USER_AGENT']), 'camino') || strstr(strtolower($_SERVER['HTTP_USER_AGENT']), 'safari') ) + if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'camino') !== false || strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'safari') !== false) $ak_title_separator = "\n"; else $ak_title_separator = ', '; diff --git a/wp-includes/js/autosave.js b/wp-includes/js/autosave.js new file mode 100644 index 0000000..ae2c105 --- /dev/null +++ b/wp-includes/js/autosave.js @@ -0,0 +1,158 @@ +var autosaveLast = ''; +var autosavePeriodical; + +function autosave_start_timer() { + var form = $('post'); + autosaveLast = form.post_title.value+form.content.value; + // Keep autosave_interval in sync with edit_post(). + autosavePeriodical = new PeriodicalExecuter(autosave, autosaveL10n.autosaveInterval); + //Disable autosave after the form has been submitted + if(form.addEventListener) { + form.addEventListener("submit", function () { autosavePeriodical.currentlyExecuting = true; }, false); + } + if(form.attachEvent) { + form.save ? form.save.attachEvent("onclick", function () { autosavePeriodical.currentlyExecuting = true; }) : null; + form.submit ? form.submit.attachEvent("onclick", function () { autosavePeriodical.currentlyExecuting = true; }) : null; + form.publish ? form.publish.attachEvent("onclick", function () { autosavePeriodical.currentlyExecuting = true; }) : null; + form.deletepost ? form.deletepost.attachEvent("onclick", function () { autosavePeriodical.currentlyExecuting = true; }) : null; + } +} +addLoadEvent(autosave_start_timer) + +function autosave_cur_time() { + var now = new Date(); + return "" + ((now.getHours() >12) ? now.getHours() -12 : now.getHours()) + + ((now.getMinutes() < 10) ? ":0" : ":") + now.getMinutes() + + ((now.getSeconds() < 10) ? ":0" : ":") + now.getSeconds(); +} + +function autosave_update_nonce() { + var response = nonceAjax.response; + document.getElementsByName('_wpnonce')[0].value = response; +} + +function autosave_update_post_ID() { + var response = autosaveAjax.response; + var res = parseInt(response); + var message; + + if(isNaN(res)) { + message = autosaveL10n.errorText.replace(/%response%/g, response); + } else { + message = autosaveL10n.saveText.replace(/%time%/g, autosave_cur_time()); + $('post_ID').name = "post_ID"; + $('post_ID').value = res; + // We need new nonces + nonceAjax = new sack(); + nonceAjax.element = null; + nonceAjax.setVar("action", "autosave-generate-nonces"); + nonceAjax.setVar("post_ID", res); + nonceAjax.setVar("cookie", document.cookie); + nonceAjax.setVar("post_type", $('post_type').value); + nonceAjax.requestFile = autosaveL10n.requestFile; + nonceAjax.onCompletion = autosave_update_nonce; + nonceAjax.method = "POST"; + nonceAjax.runAJAX(); + $('hiddenaction').value = 'editpost'; + } + $('autosave').innerHTML = message; + autosave_enable_buttons(); +} + +function autosave_loading() { + $('autosave').innerHTML = autosaveL10n.savingText; +} + +function autosave_saved() { + var response = autosaveAjax.response; + var res = parseInt(response); + var message; + + if(isNaN(res)) { + message = autosaveL10n.errorText.replace(/%response%/g, response); + } else { + message = autosaveL10n.saveText.replace(/%time%/g, autosave_cur_time()); + } + $('autosave').innerHTML = message; + autosave_enable_buttons(); +} + +function autosave_disable_buttons() { + var form = $('post'); + form.save ? form.save.disabled = 'disabled' : null; + form.submit ? form.submit.disabled = 'disabled' : null; + form.publish ? form.publish.disabled = 'disabled' : null; + form.deletepost ? form.deletepost.disabled = 'disabled' : null; + setTimeout('autosave_enable_buttons();', 1000); // Re-enable 1 sec later. Just gives autosave a head start to avoid collisions. +} + +function autosave_enable_buttons() { + var form = $('post'); + form.save ? form.save.disabled = '' : null; + form.submit ? form.submit.disabled = '' : null; + form.publish ? form.publish.disabled = '' : null; + form.deletepost ? form.deletepost.disabled = '' : null; +} + +function autosave() { + var form = $('post'); + var rich = ((typeof tinyMCE != "undefined") && tinyMCE.getInstanceById('content')) ? true : false; + + autosaveAjax = new sack(); + + /* Gotta do this up here so we can check the length when tinyMCE is in use */ + if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 || rich == false ) { + autosaveAjax.setVar("content", form.content.value); + } else { + // Don't run while the TinyMCE spellcheck is on. + if(tinyMCE.selectedInstance.spellcheckerOn) return; + tinyMCE.wpTriggerSave(); + autosaveAjax.setVar("content", form.content.value); + } + + if(form.post_title.value.length==0 || form.content.value.length==0 || form.post_title.value+form.content.value == autosaveLast) + return; + + autosave_disable_buttons(); + + autosaveLast = form.post_title.value+form.content.value; + + cats = document.getElementsByName("post_category[]"); + goodcats = ([]); + for(i=0;i<cats.length;i++) { + if(cats[i].checked) + goodcats.push(cats[i].value); + } + catslist = goodcats.join(","); + + autosaveAjax.setVar("action", "autosave"); + autosaveAjax.setVar("cookie", document.cookie); + autosaveAjax.setVar("catslist", catslist); + autosaveAjax.setVar("post_ID", $("post_ID").value); + autosaveAjax.setVar("post_title", form.post_title.value); + autosaveAjax.setVar("post_type", form.post_type.value); + if ( form.comment_status.checked ) + autosaveAjax.setVar("comment_status", 'open'); + if ( form.ping_status.checked ) + autosaveAjax.setVar("ping_status", 'open'); + if(form.excerpt) + autosaveAjax.setVar("excerpt", form.excerpt.value); + + if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 || rich == false ) { + autosaveAjax.setVar("content", form.content.value); + } else { + tinyMCE.wpTriggerSave(); + autosaveAjax.setVar("content", form.content.value); + } + + autosaveAjax.requestFile = autosaveL10n.requestFile; + autosaveAjax.method = "POST"; + autosaveAjax.element = null; + autosaveAjax.onLoading = autosave_loading; + autosaveAjax.onInteractive = autosave_loading; + if(parseInt($("post_ID").value) < 1) + autosaveAjax.onCompletion = autosave_update_post_ID; + else + autosaveAjax.onCompletion = autosave_saved; + autosaveAjax.runAJAX(); +} diff --git a/wp-includes/js/jquery/jquery.form.js b/wp-includes/js/jquery/jquery.form.js new file mode 100644 index 0000000..7a29393 --- /dev/null +++ b/wp-includes/js/jquery/jquery.form.js @@ -0,0 +1,644 @@ +/*
+ * jQuery form plugin
+ * @requires jQuery v1.0.3
+ *
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ *
+ * Revision: $Id$
+ * Version: 0.9
+ */
+
+/**
+ * ajaxSubmit() provides a mechanism for submitting an HTML form using AJAX.
+ *
+ * ajaxSubmit accepts a single argument which can be either a success callback function
+ * or an options Object. If a function is provided it will be invoked upon successful
+ * completion of the submit and will be passed the response from the server.
+ * If an options Object is provided, the following attributes are supported:
+ *
+ * target: Identifies the element(s) in the page to be updated with the server response.
+ * This value may be specified as a jQuery selection string, a jQuery object,
+ * or a DOM element.
+ * default value: null
+ *
+ * url: URL to which the form data will be submitted.
+ * default value: value of form's 'action' attribute
+ *
+ * method: @deprecated use 'type'
+ * type: The method in which the form data should be submitted, 'GET' or 'POST'.
+ * default value: value of form's 'method' attribute (or 'GET' if none found)
+ *
+ * before: @deprecated use 'beforeSubmit'
+ * beforeSubmit: Callback method to be invoked before the form is submitted.
+ * default value: null
+ *
+ * after: @deprecated use 'success'
+ * success: Callback method to be invoked after the form has been successfully submitted
+ * and the response has been returned from the server
+ * default value: null
+ *
+ * dataType: Expected dataType of the response. One of: null, 'xml', 'script', or 'json'
+ * default value: null
+ *
+ * semantic: Boolean flag indicating whether data must be submitted in semantic order (slower).
+ * default value: false
+ *
+ * resetForm: Boolean flag indicating whether the form should be reset if the submit is successful
+ *
+ * clearForm: Boolean flag indicating whether the form should be cleared if the submit is successful
+ *
+ *
+ * The 'beforeSubmit' callback can be provided as a hook for running pre-submit logic or for
+ * validating the form data. If the 'beforeSubmit' callback returns false then the form will
+ * not be submitted. The 'beforeSubmit' callback is invoked with three arguments: the form data
+ * in array format, the jQuery object, and the options object passed into ajaxSubmit.
+ * The form data array takes the following form:
+ *
+ * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
+ *
+ * If a 'success' callback method is provided it is invoked after the response has been returned
+ * from the server. It is passed the responseText or responseXML value (depending on dataType).
+ * See jQuery.ajax for further details.
+ *
+ *
+ * The dataType option provides a means for specifying how the server response should be handled.
+ * This maps directly to the jQuery.httpData method. The following values are supported:
+ *
+ * 'xml': if dataType == 'xml' the server response is treated as XML and the 'after'
+ * callback method, if specified, will be passed the responseXML value
+ * 'json': if dataType == 'json' the server response will be evaluted and passed to
+ * the 'after' callback, if specified
+ * 'script': if dataType == 'script' the server response is evaluated in the global context
+ *
+ *
+ * Note that it does not make sense to use both the 'target' and 'dataType' options. If both
+ * are provided the target will be ignored.
+ *
+ * The semantic argument can be used to force form serialization in semantic order.
+ * This is normally true anyway, unless the form contains input elements of type='image'.
+ * If your form must be submitted with name/value pairs in semantic order and your form
+ * contains an input of type='image" then pass true for this arg, otherwise pass false
+ * (or nothing) to avoid the overhead for this logic.
+ *
+ *
+ * When used on its own, ajaxSubmit() is typically bound to a form's submit event like this:
+ *
+ * $("#form-id").submit(function() {
+ * $(this).ajaxSubmit(options);
+ * return false; // cancel conventional submit
+ * });
+ *
+ * When using ajaxForm(), however, this is done for you.
+ *
+ * @example
+ * $('#myForm').ajaxSubmit(function(data) {
+ * alert('Form submit succeeded! Server returned: ' + data);
+ * });
+ * @desc Submit form and alert server response
+ *
+ *
+ * @example
+ * var options = {
+ * target: '#myTargetDiv'
+ * };
+ * $('#myForm').ajaxSubmit(options);
+ * @desc Submit form and update page element with server response
+ *
+ *
+ * @example
+ * var options = {
+ * success: function(responseText) {
+ * alert(responseText);
+ * }
+ * };
+ * $('#myForm').ajaxSubmit(options);
+ * @desc Submit form and alert the server response
+ *
+ *
+ * @example
+ * var options = {
+ * beforeSubmit: function(formArray, jqForm) {
+ * if (formArray.length == 0) {
+ * alert('Please enter data.');
+ * return false;
+ * }
+ * }
+ * };
+ * $('#myForm').ajaxSubmit(options);
+ * @desc Pre-submit validation which aborts the submit operation if form data is empty
+ *
+ *
+ * @example
+ * var options = {
+ * url: myJsonUrl.php,
+ * dataType: 'json',
+ * success: function(data) {
+ * // 'data' is an object representing the the evaluated json data
+ * }
+ * };
+ * $('#myForm').ajaxSubmit(options);
+ * @desc json data returned and evaluated
+ *
+ *
+ * @example
+ * var options = {
+ * url: myXmlUrl.php,
+ * dataType: 'xml',
+ * success: function(responseXML) {
+ * // responseXML is XML document object
+ * var data = $('myElement', responseXML).text();
+ * }
+ * };
+ * $('#myForm').ajaxSubmit(options);
+ * @desc XML data returned from server
+ *
+ *
+ * @example
+ * var options = {
+ * resetForm: true
+ * };
+ * $('#myForm').ajaxSubmit(options);
+ * @desc submit form and reset it if successful
+ *
+ * @example
+ * $('#myForm).submit(function() {
+ * $(this).ajaxSubmit();
+ * return false;
+ * });
+ * @desc Bind form's submit event to use ajaxSubmit
+ *
+ *
+ * @name ajaxSubmit
+ * @type jQuery
+ * @param options object literal containing options which control the form submission process
+ * @cat Plugins/Form
+ * @return jQuery
+ * @see formToArray
+ * @see ajaxForm
+ * @see $.ajax
+ * @author jQuery Community
+ */
+jQuery.fn.ajaxSubmit = function(options) {
+ if (typeof options == 'function')
+ options = { success: options };
+
+ options = jQuery.extend({
+ url: this.attr('action') || '',
+ method: this.attr('method') || 'GET'
+ }, options || {});
+
+ // remap deprecated options (temporarily)
+ options.success = options.success || options.after;
+ options.beforeSubmit = options.beforeSubmit || options.before;
+ options.type = options.type || options.method;
+
+ var a = this.formToArray(options.semantic);
+
+ // give pre-submit callback an opportunity to abort the submit
+ if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) return this;
+
+ var q = jQuery.param(a);
+
+ if (options.type.toUpperCase() == 'GET') {
+ // if url already has a '?' then append args after '&'
+ options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
+ options.data = null; // data is null for 'get'
+ }
+ else
+ options.data = q; // data is the query string for 'post'
+
+ var $form = this, callbacks = [];
+ if (options.resetForm) callbacks.push(function() { $form.resetForm(); });
+ if (options.clearForm) callbacks.push(function() { $form.clearForm(); });
+
+ // perform a load on the target only if dataType is not provided
+ if (!options.dataType && options.target) {
+ var oldSuccess = options.success || function(){};
+ callbacks.push(function(data, status) {
+ jQuery(options.target).attr("innerHTML", data).evalScripts().each(oldSuccess, [data, status]);
+ });
+ }
+ else if (options.success)
+ callbacks.push(options.success);
+
+ options.success = function(data, status) {
+ for (var i=0, max=callbacks.length; i < max; i++)
+ callbacks[i](data, status);
+ };
+
+ jQuery.ajax(options);
+ return this;
+};
+
+/**
+ * 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.
+ *
+ * Note that for accurate x/y coordinates of image submit elements in all browsers
+ * you need to also use the "dimensions" plugin (this method will auto-detect its presence).
+ *
+ * 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. See ajaxSubmit for a full description of the options argument.
+ *
+ *
+ * @example
+ * var options = {
+ * target: '#myTargetDiv'
+ * };
+ * $('#myForm').ajaxSForm(options);
+ * @desc Bind form's submit event so that 'myTargetDiv' is updated with the server response
+ * when the form is submitted.
+ *
+ *
+ * @example
+ * var options = {
+ * success: function(responseText) {
+ * alert(responseText);
+ * }
+ * };
+ * $('#myForm').ajaxSubmit(options);
+ * @desc Bind form's submit event so that server response is alerted after the form is submitted.
+ *
+ *
+ * @example
+ * var options = {
+ * beforeSubmit: function(formArray, jqForm) {
+ * if (formArray.length == 0) {
+ * alert('Please enter data.');
+ * return false;
+ * }
+ * }
+ * };
+ * $('#myForm').ajaxSubmit(options);
+ * @desc Bind form's submit event so that pre-submit callback is invoked before the form
+ * is submitted.
+ *
+ *
+ * @name ajaxForm
+ * @param options object literal containing options which control the form submission process
+ * @return jQuery
+ * @cat Plugins/Form
+ * @type jQuery
+ * @see ajaxSubmit
+ * @author jQuery Community
+ */
+jQuery.fn.ajaxForm = function(options) {
+ return this.each(function() {
+ jQuery("input:submit,input:image,button:submit", this).click(function(ev) {
+ var $form = this.form;
+ $form.clk = this;
+ if (this.type == 'image') {
+ if (ev.offsetX != undefined) {
+ $form.clk_x = ev.offsetX;
+ $form.clk_y = ev.offsetY;
+ } else if (typeof jQuery.fn.offset == 'function') { // try to use dimensions plugin
+ var offset = jQuery(this).offset();
+ $form.clk_x = ev.pageX - offset.left;
+ $form.clk_y = ev.pageY - offset.top;
+ } else {
+ $form.clk_x = ev.pageX - this.offsetLeft;
+ $form.clk_y = ev.pageY - this.offsetTop;
+ }
+ }
+ // clear form vars
+ setTimeout(function() {
+ $form.clk = $form.clk_x = $form.clk_y = null;
+ }, 10);
+ })
+ }).submit(function(e) {
+ jQuery(this).ajaxSubmit(options);
+ return false;
+ });
+};
+
+
+/**
+ * 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.
+ *
+ * The semantic argument can be used to force form serialization in semantic order.
+ * This is normally true anyway, unless the form contains input elements of type='image'.
+ * If your form must be submitted with name/value pairs in semantic order and your form
+ * contains an input of type='image" then pass true for this arg, otherwise pass false
+ * (or nothing) to avoid the overhead for this logic.
+ *
+ * @example var data = $("#myForm").formToArray();
+ * $.post( "myscript.cgi", data );
+ * @desc Collect all the data from a form and submit it to the server.
+ *
+ * @name formToArray
+ * @param semantic true if serialization must maintain strict semantic ordering of elements (slower)
+ * @type Array<Object>
+ * @cat Plugins/Form
+ * @see ajaxForm
+ * @see ajaxSubmit
+ * @author jQuery Community
+ */
+jQuery.fn.formToArray = function(semantic) {
+ var a = [];
+ if (this.length == 0) return a;
+
+ var form = this[0];
+ var els = semantic ? form.getElementsByTagName('*') : form.elements;
+ if (!els) return a;
+ for(var i=0, max=els.length; i < max; i++) {
+ var el = els[i];
+ var n = el.name;
+ if (!n) continue;
+
+ if (semantic && form.clk && el.type == "image") {
+ // handle image inputs on the fly when semantic == true
+ if(!el.disabled && form.clk == el)
+ a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
+ continue;
+ }
+ var v = jQuery.fieldValue(el, true);
+ if (v === null) continue;
+ if (v.constructor == Array) {
+ for(var j=0, jmax=v.length; j < jmax; j++)
+ a.push({name: n, value: v[j]});
+ }
+ else
+ a.push({name: n, value: v});
+ }
+
+ if (!semantic && form.clk) {
+ // input type=='image' are not found in elements array! handle them here
+ var inputs = form.getElementsByTagName("input");
+ for(var i=0, max=inputs.length; i < max; i++) {
+ var input = inputs[i];
+ var n = input.name;
+ if(n && !input.disabled && input.type == "image" && form.clk == input)
+ 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&name2=value2
+ *
+ * The semantic argument can be used to force form serialization in semantic order.
+ * If your form must be submitted with name/value pairs in semantic order then pass
+ * true for this arg, otherwise pass false (or nothing) to avoid the overhead for
+ * this logic (which can be significant for very large forms).
+ *
+ * @example var data = $("#myForm").formSerialize();
+ * $.ajax('POST', "myscript.cgi", data);
+ * @desc Collect all the data from a form into a single string
+ *
+ * @name formSerialize
+ * @param semantic true if serialization must maintain strict semantic ordering of elements (slower)
+ * @type String
+ * @cat Plugins/Form
+ * @see formToArray
+ * @author jQuery Community
+ */
+jQuery.fn.formSerialize = function(semantic) {
+ //hand off to jQuery.param for proper encoding
+ return jQuery.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&name2=value2
+ *
+ * The successful argument controls whether or not serialization is limited to
+ * 'successful' controls (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
+ * The default value of the successful argument is true.
+ *
+ * @example var data = $("input").formSerialize();
+ * @desc Collect the data from all successful input elements into a query string
+ *
+ * @example var data = $(":radio").formSerialize();
+ * @desc Collect the data from all successful radio input elements into a query string
+ *
+ * @example var data = $("#myForm :checkbox").formSerialize();
+ * @desc Collect the data from all successful checkbox input elements in myForm into a query string
+ *
+ * @example var data = $("#myForm :checkbox").formSerialize(false);
+ * @desc Collect the data from all checkbox elements in myForm (even the unchecked ones) into a query string
+ *
+ * @example var data = $(":input").formSerialize();
+ * @desc Collect the data from all successful input, select, textarea and button elements into a query string
+ *
+ * @name fieldSerialize
+ * @param successful true if only successful controls should be serialized (default is true)
+ * @type String
+ * @cat Plugins/Form
+ */
+jQuery.fn.fieldSerialize = function(successful) {
+ var a = [];
+ this.each(function() {
+ var n = this.name;
+ if (!n) return;
+ var v = jQuery.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 jQuery.param(a);
+};
+
+
+/**
+ * Returns the value of the field element in the jQuery object. If there is more than one field element
+ * in the jQuery object the value of the first successful one is returned.
+ *
+ * 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 then
+ * the value of the first field element in the jQuery object is returned.
+ *
+ * Note: If no valid value can be determined the return value will be undifined.
+ *
+ * Note: The fieldValue returned for a select-multiple element or for a checkbox input will
+ * always be an array if it is not undefined.
+ *
+ *
+ * @example var data = $("#myPasswordElement").formValue();
+ * @desc Gets the current value of the myPasswordElement element
+ *
+ * @example var data = $("#myForm :input").formValue();
+ * @desc Get the value of the first successful control in the jQuery object.
+ *
+ * @example var data = $("#myForm :checkbox").formValue();
+ * @desc Get the array of values for the first set of successful checkbox controls in the jQuery object.
+ *
+ * @example var data = $("#mySingleSelect").formValue();
+ * @desc Get the value of the select control
+ *
+ * @example var data = $("#myMultiSelect").formValue();
+ * @desc Get the array of selected values for the select-multiple control
+ *
+ * @name fieldValue
+ * @param Boolean successful true if value returned must be for a successful controls (default is true)
+ * @type String or Array<String>
+ * @cat Plugins/Form
+ */
+jQuery.fn.fieldValue = function(successful) {
+ var cbVal, cbName;
+
+ // loop until we find a value
+ for (var i=0, max=this.length; i < max; i++) {
+ var el = this[i];
+ var v = jQuery.fieldValue(el, successful);
+ if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length))
+ continue;
+
+ // for checkboxes, consider multiple elements, for everything else just return first valid value
+ if (el.type != 'checkbox') return v;
+
+ cbName = cbName || el.name;
+ if (cbName != el.name) // return if we hit a checkbox with a different name
+ return cbVal;
+ cbVal = cbVal || [];
+ cbVal.push(v);
+ }
+ return cbVal;
+};
+
+/**
+ * Returns the value of the field element.
+ *
+ * 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 the given element is not
+ * successful and the successful arg is not false then the returned value will be null.
+ *
+ * Note: The fieldValue returned for a select-multiple element will always be an array.
+ *
+ * @example var data = jQuery.fieldValue($("#myPasswordElement")[0]);
+ * @desc Gets the current value of the myPasswordElement element
+ *
+ * @name fieldValue
+ * @param Element el The DOM element for which the value will be returned
+ * @param Boolean successful true if value returned must be for a successful controls (default is true)
+ * @type String or Array<String>
+ * @cat Plugins/Form
+ */
+jQuery.fieldValue = function(el, successful) {
+ var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
+ if (typeof successful == 'undefined') successful = true;
+
+ if (successful && ( !n || el.disabled || t == 'reset' ||
+ (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) {
+ // extra pain for IE...
+ var v = jQuery.browser.msie && !(op.attributes['value'].specified) ? op.text : op.value;
+ if (one) return v;
+ a.push(v);
+ }
+ }
+ return a;
+ }
+ return el.value;
+};
+
+
+/**
+ * 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
+ *
+ * @example $('form').clearForm();
+ * @desc Clears all forms on the page.
+ *
+ * @name clearForm
+ * @type jQuery
+ * @cat Plugins/Form
+ * @see resetForm
+ */
+jQuery.fn.clearForm = function() {
+ return this.each(function() {
+ jQuery('input,select,textarea', this).clearFields();
+ });
+};
+
+/**
+ * Clears the selected form elements. Takes the following actions on the matched elements:
+ * - 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
+ *
+ * @example $('.myInputs').clearFields();
+ * @desc Clears all inputs with class myInputs
+ *
+ * @name clearFields
+ * @type jQuery
+ * @cat Plugins/Form
+ * @see clearForm
+ */
+jQuery.fn.clearFields = jQuery.fn.clearInputs = function() {
+ return this.each(function() {
+ var t = this.type, tag = this.tagName.toLowerCase();
+ if (t == 'text' || t == 'password' || tag == 'textarea')
+ this.value = '';
+ else if (t == 'checkbox' || t == 'radio')
+ this.checked = false;
+ else if (tag == 'select')
+ this.selectedIndex = -1;
+ });
+};
+
+
+/**
+ * Resets the form data. Causes all form elements to be reset to their original value.
+ *
+ * @example $('form').resetForm();
+ * @desc Resets all forms on the page.
+ *
+ * @name resetForm
+ * @type jQuery
+ * @cat Plugins/Form
+ * @see clearForm
+ */
+jQuery.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();
+ });
+};
diff --git a/wp-includes/js/jquery/jquery.js b/wp-includes/js/jquery/jquery.js index 31650a1..c684bda 100644 --- a/wp-includes/js/jquery/jquery.js +++ b/wp-includes/js/jquery/jquery.js @@ -1,2 +1 @@ -eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('k(1v 1t.6=="Q"){1t.Q=1t.Q;u 6=l(a,c){k(1t==7)q 1p 6(a,c);a=a||12;k(6.1k(a))q 1p 6(12)[6.C.28?"28":"2E"](a);k(1v a=="22"){u m=/^[^<]*(<(.|\\n)+>)[^>]*$/.2B(a);k(m)a=6.3W([m[1]]);H q 1p 6(c).2o(a)}q 7.4M(a.1g==2A&&a||(a.3e||a.G&&a!=1t&&!a.1V&&a[0]!=Q&&a[0].1V)&&6.3H(a)||[a])};k(1v $!="Q")6.2O$=$;u $=6;6.C=6.8o={3e:"1.1.1",8p:l(){q 7.G},G:0,2a:l(1R){q 1R==Q?6.3H(7):7[1R]},2q:l(a){u J=6(7);J.6j=7;q J.4M(a)},4M:l(a){7.G=0;[].1h.14(7,a);q 7},I:l(C,1y){q 6.I(7,C,1y)},2b:l(19){u 4I=-1;7.I(l(i){k(7==19)4I=i});q 4I},1E:l(20,N,v){u 19=20;k(20.1g==3p)k(N==Q)q 7.G&&6[v||"1E"](7[0],20)||Q;H{19={};19[20]=N}q 7.I(l(2b){O(u F 1B 19)6.1E(v?7.1q:7,F,6.F(7,19[F],v,2b,F))})},1f:l(20,N){q 7.1E(20,N,"2V")},2L:l(e){k(1v e=="22")q 7.3n().3t(12.8r(e));u t="";6.I(e||7,l(){6.I(7.38,l(){k(7.1V!=8)t+=7.1V!=1?7.60:6.C.2L([7])})});q t},2D:l(){u a=6.3W(1x);q 7.I(l(){u b=a[0].3V(T);7.V.2T(b,7);1Z(b.17)b=b.17;b.4i(7)})},3t:l(){q 7.35(1x,T,1,l(a){7.4i(a)})},5n:l(){q 7.35(1x,T,-1,l(a){7.2T(a,7.17)})},5h:l(){q 7.35(1x,Y,1,l(a){7.V.2T(a,7)})},5i:l(){q 7.35(1x,Y,-1,l(a){7.V.2T(a,7.2f)})},4E:l(){q 7.6j||6([])},2o:l(t){q 7.2q(6.2X(7,l(a){q 6.2o(t,a)}))},4w:l(4C){q 7.2q(6.2X(7,l(a){q a.3V(4C!=Q?4C:T)}))},1w:l(t){q 7.2q(6.1k(t)&&6.2k(7,l(2G,2b){q t.14(2G,[2b])})||6.3v(t,7))},2c:l(t){q 7.2q(t.1g==3p&&6.3v(t,7,T)||6.2k(7,l(a){k(t.1g==2A||t.3e)q 6.3g(t,a)<0;H q a!=t}))},1J:l(t){q 7.2q(6.2i(7.2a(),t.1g==3p?6(t).2a():t.G!=Q&&!t.1u?t:[t]))},46:l(1n){q 1n?6.1w(1n,7).r.G>0:Y},18:l(18){q 18==Q?(7.G?7[0].N:1c):7.1E("N",18)},4Q:l(18){q 18==Q?(7.G?7[0].2H:1c):7.3n().3t(18)},35:l(1y,1N,3F,C){u 4w=7.G>1;u a=6.3W(1y);k(3F<0)a.8s();q 7.I(l(){u 19=7;k(1N&&6.1u(7,"1N")&&6.1u(a[0],"3U"))19=7.5E("1T")[0]||7.4i(12.6e("1T"));6.I(a,l(){C.14(19,[4w?7.3V(T):7])})})}};6.1A=6.C.1A=l(){u 1P=1x[0],a=1;k(1x.G==1){1P=7;a=0}u F;1Z(F=1x[a++])O(u i 1B F)1P[i]=F[i];q 1P};6.1A({8v:l(){k(6.2O$)$=6.2O$;q 6},1k:l(C){q!!C&&1v C!="22"&&1v C[0]=="Q"&&/l/i.1s(C+"")},1u:l(B,W){q B.1u&&B.1u.3u()==W.3u()},I:l(19,C,1y){k(19.G==Q)O(u i 1B 19)C.14(19[i],1y||[i,19[i]]);H O(u i=0,6l=19.G;i<6l;i++)k(C.14(19[i],1y||[i,19[i]])===Y)4q;q 19},F:l(B,N,v,2b,F){k(6.1k(N))q N.3s(B,[2b]);u 6m=/z-?2b|7C-?7D|1b|64|8x-?26/i;k(N.1g==3N&&v=="2V"&&!6m.1s(F))q N+"49";q N},16:{1J:l(B,c){6.I(c.3o(/\\s+/),l(i,M){k(!6.16.2P(B.16,M))B.16+=(B.16?" ":"")+M})},2g:l(B,c){B.16=c?6.2k(B.16.3o(/\\s+/),l(M){q!6.16.2P(c,M)}).55(" "):""},2P:l(t,c){t=t.16||t;q t&&1p 4V("(^|\\\\s)"+c+"(\\\\s|$)").1s(t)}},44:l(e,o,f){O(u i 1B o){e.1q["1H"+i]=e.1q[i];e.1q[i]=o[i]}f.14(e,[]);O(u i 1B o)e.1q[i]=e.1q["1H"+i]},1f:l(e,p){k(p=="26"||p=="40"){u 1H={},41,3f,d=["7x","8z","8A","8B"];6.I(d,l(){1H["8C"+7]=0;1H["8E"+7+"8F"]=0});6.44(e,1H,l(){k(6.1f(e,"1e")!="1Y"){41=e.6E;3f=e.6v}H{e=6(e.3V(T)).2o(":4h").5j("2S").4E().1f({4g:"1C",3Z:"6q",1e:"2t",7v:"0",6r:"0"}).5f(e.V)[0];u 3c=6.1f(e.V,"3Z");k(3c==""||3c=="43")e.V.1q.3Z="6s";41=e.6t;3f=e.6u;k(3c==""||3c=="43")e.V.1q.3Z="43";e.V.39(e)}});q p=="26"?41:3f}q 6.2V(e,p)},2V:l(B,F,6k){u J;k(F=="1b"&&6.U.1m)q 6.1E(B.1q,"1b");k(F=="4L"||F=="2u")F=6.U.1m?"3l":"2u";k(!6k&&B.1q[F])J=B.1q[F];H k(12.3X&&12.3X.45){k(F=="2u"||F=="3l")F="4L";F=F.1U(/([A-Z])/g,"-$1").4P();u M=12.3X.45(B,1c);k(M)J=M.53(F);H k(F=="1e")J="1Y";H 6.44(B,{1e:"2t"},l(){u c=12.3X.45(7,"");J=c&&c.53(F)||""})}H k(B.4Z){u 54=F.1U(/\\-(\\w)/g,l(m,c){q c.3u()});J=B.4Z[F]||B.4Z[54]}q J},3W:l(a){u r=[];6.I(a,l(i,1L){k(!1L)q;k(1L.1g==3N)1L=1L.8m();k(1v 1L=="22"){u s=6.2Z(1L),1W=12.6e("1W"),2e=[];u 2D=!s.15("<1l")&&[1,"<3T>","</3T>"]||(!s.15("<6y")||!s.15("<1T")||!s.15("<6A"))&&[1,"<1N>","</1N>"]||!s.15("<3U")&&[2,"<1N><1T>","</1T></1N>"]||(!s.15("<6B")||!s.15("<6D"))&&[3,"<1N><1T><3U>","</3U></1T></1N>"]||[0,"",""];1W.2H=2D[1]+s+2D[2];1Z(2D[0]--)1W=1W.17;k(6.U.1m){k(!s.15("<1N")&&s.15("<1T")<0)2e=1W.17&&1W.17.38;H k(2D[1]=="<1N>"&&s.15("<1T")<0)2e=1W.38;O(u n=2e.G-1;n>=0;--n)k(6.1u(2e[n],"1T")&&!2e[n].38.G)2e[n].V.39(2e[n])}1L=1W.38}k(1L.G===0)q;k(1L[0]==Q)r.1h(1L);H r=6.2i(r,1L)});q r},1E:l(B,W,N){u 2m={"O":"6G","6H":"16","4L":6.U.1m?"3l":"2u",2u:6.U.1m?"3l":"2u",2H:"2H",16:"16",N:"N",2R:"2R",2S:"2S",6K:"6L",2Q:"2Q"};k(W=="1b"&&6.U.1m&&N!=Q){B.64=1;q B.1w=B.1w.1U(/4K\\([^\\)]*\\)/6M,"")+(N==1?"":"4K(1b="+N*57+")")}H k(W=="1b"&&6.U.1m)q B.1w?4f(B.1w.6N(/4K\\(1b=(.*)\\)/)[1])/57:1;k(W=="1b"&&6.U.36&&N==1)N=0.7X;k(2m[W]){k(N!=Q)B[2m[W]]=N;q B[2m[W]]}H k(N==Q&&6.U.1m&&6.1u(B,"5S")&&(W=="6Q"||W=="7V"))q B.6S(W).60;H k(B.6T){k(N!=Q)B.7R(W,N);q B.3D(W)}H{W=W.1U(/-([a-z])/6W,l(z,b){q b.3u()});k(N!=Q)B[W]=N;q B[W]}},2Z:l(t){q t.1U(/^\\s+|\\s+$/g,"")},3H:l(a){u r=[];k(a.1g!=2A)O(u i=0,2w=a.G;i<2w;i++)r.1h(a[i]);H r=a.3J(0);q r},3g:l(b,a){O(u i=0,2w=a.G;i<2w;i++)k(a[i]==b)q i;q-1},2i:l(2v,3P){u r=[].3J.3s(2v,0);O(u i=0,63=3P.G;i<63;i++)k(6.3g(3P[i],r)==-1)2v.1h(3P[i]);q 2v},2k:l(1Q,C,48){k(1v C=="22")C=1p 4D("a","i","q "+C);u 1d=[];O(u i=0,2G=1Q.G;i<2G;i++)k(!48&&C(1Q[i],i)||48&&!C(1Q[i],i))1d.1h(1Q[i]);q 1d},2X:l(1Q,C){k(1v C=="22")C=1p 4D("a","q "+C);u 1d=[],r=[];O(u i=0,2G=1Q.G;i<2G;i++){u 18=C(1Q[i],i);k(18!==1c&&18!=Q){k(18.1g!=2A)18=[18];1d=1d.70(18)}}u r=1d.G?[1d[0]]:[];5d:O(u i=1,5N=1d.G;i<5N;i++){O(u j=0;j<i;j++)k(1d[i]==r[j])5z 5d;r.1h(1d[i])}q r}});1p l(){u b=7H.72.4P();6.U={2C:/5I/.1s(b),37:/37/.1s(b),1m:/1m/.1s(b)&&!/37/.1s(b),36:/36/.1s(b)&&!/(74|5I)/.1s(b)};6.75=!6.U.1m||12.76=="7B"};6.I({5p:"a.V",4s:"6.4s(a)",78:"6.25(a,2,\'2f\')",7z:"6.25(a,2,\'5o\')",79:"6.2F(a.V.17,a)",7b:"6.2F(a.17)"},l(i,n){6.C[i]=l(a){u J=6.2X(7,n);k(a&&1v a=="22")J=6.3v(a,J);q 7.2q(J)}});6.I({5f:"3t",7d:"5n",2T:"5h",7f:"5i"},l(i,n){6.C[i]=l(){u a=1x;q 7.I(l(){O(u j=0,2w=a.G;j<2w;j++)6(a[j])[n](7)})}});6.I({5j:l(20){6.1E(7,20,"");7.7h(20)},7i:l(c){6.16.1J(7,c)},7j:l(c){6.16.2g(7,c)},7l:l(c){6.16[6.16.2P(7,c)?"2g":"1J"](7,c)},2g:l(a){k(!a||6.1w(a,[7]).r.G)7.V.39(7)},3n:l(){1Z(7.17)7.39(7.17)}},l(i,n){6.C[i]=l(){q 7.I(n,1x)}});6.I(["5m","5l","5e","5r"],l(i,n){6.C[n]=l(1R,C){q 7.1w(":"+n+"("+1R+")",C)}});6.I(["26","40"],l(i,n){6.C[n]=l(h){q h==Q?(7.G?6.1f(7[0],n):1c):7.1f(n,h.1g==3p?h:h+"49")}});6.1A({1n:{"":"m[2]==\'*\'||6.1u(a,m[2])","#":"a.3D(\'3Y\')==m[2]",":":{5l:"i<m[3]-0",5e:"i>m[3]-0",25:"m[3]-0==i",5m:"m[3]-0==i",2v:"i==0",2W:"i==r.G-1",5M:"i%2==0",5O:"i%2","25-3k":"6.25(a.V.17,m[3],\'2f\',a)==a","2v-3k":"6.25(a.V.17,1,\'2f\')==a","2W-3k":"6.25(a.V.7n,1,\'5o\')==a","7o-3k":"6.2F(a.V.17).G==1",5p:"a.17",3n:"!a.17",5r:"6.C.2L.14([a]).15(m[3])>=0",3a:\'a.v!="1C"&&6.1f(a,"1e")!="1Y"&&6.1f(a,"4g")!="1C"\',1C:\'a.v=="1C"||6.1f(a,"1e")=="1Y"||6.1f(a,"4g")=="1C"\',7q:"!a.2R",2R:"a.2R",2S:"a.2S",2Q:"a.2Q||6.1E(a,\'2Q\')",2L:"a.v==\'2L\'",4h:"a.v==\'4h\'",59:"a.v==\'59\'",42:"a.v==\'42\'",58:"a.v==\'58\'",4O:"a.v==\'4O\'",5v:"a.v==\'5v\'",5w:"a.v==\'5w\'",3h:\'a.v=="3h"||6.1u(a,"3h")\',5x:"/5x|3T|7s|3h/i.1s(a.1u)"},".":"6.16.2P(a,m[2])","@":{"=":"z==m[4]","!=":"z!=m[4]","^=":"z&&!z.15(m[4])","$=":"z&&z.2Y(z.G - m[4].G,m[4].G)==m[4]","*=":"z&&z.15(m[4])>=0","":"z",4U:l(m){q["",m[1],m[3],m[2],m[5]]},5J:"z=a[m[3]]||6.1E(a,m[3]);"},"[":"6.2o(m[2],a).G"},5G:[/^\\[ *(@)([a-2l-3y-]*) *([!*$^=]*) *(\'?"?)(.*?)\\4 *\\]/i,/^(\\[)\\s*(.*?(\\[.*?\\])?[^[]*?)\\s*\\]/,/^(:)([a-2l-3y-]*)\\("?\'?(.*?(\\(.*?\\))?[^(]*?)"?\'?\\)/i,/^([:.#]*)([a-2l-3y*-]*)/i],1O:[/^(\\/?\\.\\.)/,"a.V",/^(>|\\/)/,"6.2F(a.17)",/^(\\+)/,"6.25(a,2,\'2f\')",/^(~)/,l(a){u s=6.2F(a.V.17);q s.3J(0,6.3g(a,s))}],3v:l(1n,1Q,2c){u 1H,M=[];1Z(1n&&1n!=1H){1H=1n;u f=6.1w(1n,1Q,2c);1n=f.t.1U(/^\\s*,\\s*/,"");M=2c?1Q=f.r:6.2i(M,f.r)}q M},2o:l(t,1r){k(1v t!="22")q[t];k(1r&&!1r.1V)1r=1c;1r=1r||12;k(!t.15("//")){1r=1r.4y;t=t.2Y(2,t.G)}H k(!t.15("/")){1r=1r.4y;t=t.2Y(1,t.G);k(t.15("/")>=1)t=t.2Y(t.15("/"),t.G)}u J=[1r],29=[],2W=1c;1Z(t&&2W!=t){u r=[];2W=t;t=6.2Z(t).1U(/^\\/\\//i,"");u 3x=Y;u 1G=/^[\\/>]\\s*([a-2l-9*-]+)/i;u m=1G.2B(t);k(m){6.I(J,l(){O(u c=7.17;c;c=c.2f)k(c.1V==1&&(6.1u(c,m[1])||m[1]=="*"))r.1h(c)});J=r;t=t.1U(1G,"");k(t.15(" ")==0)5z;3x=T}H{O(u i=0;i<6.1O.G;i+=2){u 1G=6.1O[i];u m=1G.2B(t);k(m){r=J=6.2X(J,6.1k(6.1O[i+1])?6.1O[i+1]:l(a){q 3B(6.1O[i+1])});t=6.2Z(t.1U(1G,""));3x=T;4q}}}k(t&&!3x){k(!t.15(",")){k(J[0]==1r)J.4m();6.2i(29,J);r=J=[1r];t=" "+t.2Y(1,t.G)}H{u 34=/^([a-2l-3y-]+)(#)([a-2l-9\\\\*2O-]*)/i;u m=34.2B(t);k(m){m=[0,m[2],m[3],m[1]]}H{34=/^([#.]?)([a-2l-9\\\\*2O-]*)/i;m=34.2B(t)}k(m[1]=="#"&&J[J.G-1].4R){u 3z=J[J.G-1].4R(m[2]);J=r=3z&&(!m[3]||6.1u(3z,m[3]))?[3z]:[]}H{k(m[1]==".")u 4k=1p 4V("(^|\\\\s)"+m[2]+"(\\\\s|$)");6.I(J,l(){u 3C=m[1]!=""||m[0]==""?"*":m[2];k(6.1u(7,"7w")&&3C=="*")3C="2U";6.2i(r,m[1]!=""&&J.G!=1?6.4r(7,[],m[1],m[2],4k):7.5E(3C))});k(m[1]=="."&&J.G==1)r=6.2k(r,l(e){q 4k.1s(e.16)});k(m[1]=="#"&&J.G==1){u 5F=r;r=[];6.I(5F,l(){k(7.3D("3Y")==m[2]){r=[7];q Y}})}J=r}t=t.1U(34,"")}}k(t){u 18=6.1w(t,r);J=r=18.r;t=6.2Z(18.t)}}k(J&&J[0]==1r)J.4m();6.2i(29,J);q 29},1w:l(t,r,2c){1Z(t&&/^[a-z[({<*:.#]/i.1s(t)){u p=6.5G,m;6.I(p,l(i,1G){m=1G.2B(t);k(m){t=t.7y(m[0].G);k(6.1n[m[1]].4U)m=6.1n[m[1]].4U(m);q Y}});k(m[1]==":"&&m[2]=="2c")r=6.1w(m[3],r,T).r;H k(m[1]=="."){u 1G=1p 4V("(^|\\\\s)"+m[2]+"(\\\\s|$)");r=6.2k(r,l(e){q 1G.1s(e.16||"")},2c)}H{u f=6.1n[m[1]];k(1v f!="22")f=6.1n[m[1]][m[2]];3B("f = l(a,i){"+(6.1n[m[1]].5J||"")+"q "+f+"}");r=6.2k(r,f,2c)}}q{r:r,t:t}},4r:l(o,r,1O,W,1G){O(u s=o.17;s;s=s.2f)k(s.1V==1){u 1J=T;k(1O==".")1J=s.16&&1G.1s(s.16);H k(1O=="#")1J=s.3D("3Y")==W;k(1J)r.1h(s);k(1O=="#"&&r.G)4q;k(s.17)6.4r(s,r,1O,W,1G)}q r},4s:l(B){u 4N=[];u M=B.V;1Z(M&&M!=12){4N.1h(M);M=M.V}q 4N},25:l(M,1d,3F,B){1d=1d||1;u 1R=0;O(;M;M=M[3F]){k(M.1V==1)1R++;k(1R==1d||1d=="5M"&&1R%2==0&&1R>1&&M==B||1d=="5O"&&1R%2==1&&M==B)q M}},2F:l(n,B){u r=[];O(;n;n=n.2f){k(n.1V==1&&(!B||n!=B))r.1h(n)}q r}});6.E={1J:l(S,v,1j,D){k(6.U.1m&&S.4c!=Q)S=1t;k(D)1j.D=D;k(!1j.2n)1j.2n=7.2n++;k(!S.1I)S.1I={};u 32=S.1I[v];k(!32){32=S.1I[v]={};k(S["3I"+v])32[0]=S["3I"+v]}32[1j.2n]=1j;S["3I"+v]=7.5T;k(!7.1i[v])7.1i[v]=[];7.1i[v].1h(S)},2n:1,1i:{},2g:l(S,v,1j){k(S.1I)k(v&&v.v)4u S.1I[v.v][v.1j.2n];H k(v&&S.1I[v])k(1j)4u S.1I[v][1j.2n];H O(u i 1B S.1I[v])4u S.1I[v][i];H O(u j 1B S.1I)7.2g(S,j)},1M:l(v,D,S){D=6.3H(D||[]);k(!S)6.I(7.1i[v]||[],l(){6.E.1M(v,D,7)});H{u 1j=S["3I"+v],18,C=6.1k(S[v]);k(1j){D.5U(7.2m({v:v,1P:S}));k((18=1j.14(S,D))!==Y)7.4v=T}k(C&&18!==Y)S[v]();7.4v=Y}},5T:l(E){k(1v 6=="Q"||6.E.4v)q;E=6.E.2m(E||1t.E||{});u 3M;u c=7.1I[E.v];u 1y=[].3J.3s(1x,1);1y.5U(E);O(u j 1B c){1y[0].1j=c[j];1y[0].D=c[j].D;k(c[j].14(7,1y)===Y){E.2h();E.2z();3M=Y}}k(6.U.1m)E.1P=E.2h=E.2z=E.1j=E.D=1c;q 3M},2m:l(E){k(!E.1P&&E.5V)E.1P=E.5V;k(E.5W==Q&&E.5Y!=Q){u e=12.4y,b=12.7K;E.5W=E.5Y+(e.5Z||b.5Z);E.7M=E.7N+(e.61||b.61)}k(6.U.2C&&E.1P.1V==3){u 33=E;E=6.1A({},33);E.1P=33.1P.V;E.2h=l(){q 33.2h()};E.2z=l(){q 33.2z()}}k(!E.2h)E.2h=l(){7.3M=Y};k(!E.2z)E.2z=l(){7.7Q=T};q E}};6.C.1A({3R:l(v,D,C){q 7.I(l(){6.E.1J(7,v,C||D,D)})},6n:l(v,D,C){q 7.I(l(){6.E.1J(7,v,l(E){6(7).62(E);q(C||D).14(7,1x)},D)})},62:l(v,C){q 7.I(l(){6.E.2g(7,v,C)})},1M:l(v,D){q 7.I(l(){6.E.1M(v,D,7)})},3r:l(){u a=1x;q 7.69(l(e){7.4F=7.4F==0?1:0;e.2h();q a[7.4F].14(7,[e])||Y})},7T:l(f,g){l 4e(e){u p=(e.v=="3S"?e.7U:e.7Y)||e.7Z;1Z(p&&p!=7)2s{p=p.V}2y(e){p=7};k(p==7)q Y;q(e.v=="3S"?f:g).14(7,[e])}q 7.3S(4e).6b(4e)},28:l(f){k(6.3O)f.14(12,[6]);H{6.3b.1h(l(){q f.14(7,[6])})}q 7}});6.1A({3O:Y,3b:[],28:l(){k(!6.3O){6.3O=T;k(6.3b){6.I(6.3b,l(){7.14(12)});6.3b=1c}k(6.U.36||6.U.37)12.81("6g",6.28,Y)}}});1p l(){6.I(("82,83,2E,84,85,4Y,69,86,"+"87,88,89,3S,6b,8b,3T,"+"4O,8d,8f,8g,2M").3o(","),l(i,o){6.C[o]=l(f){q f?7.3R(o,f):7.1M(o)}});k(6.U.36||6.U.37)12.8h("6g",6.28,Y);H k(6.U.1m){12.8i("<8j"+"8l 3Y=6a 8q=T "+"4B=//:><\\/2d>");u 2d=12.4R("6a");k(2d)2d.2p=l(){k(7.3A!="1X")q;7.V.39(7);6.28()};2d=1c}H k(6.U.2C)6.4W=4c(l(){k(12.3A=="8t"||12.3A=="1X"){5u(6.4W);6.4W=1c;6.28()}},10);6.E.1J(1t,"2E",6.28)};k(6.U.1m)6(1t).6n("4Y",l(){u 1i=6.E.1i;O(u v 1B 1i){u 4X=1i[v],i=4X.G;k(i&&v!=\'4Y\')6p 6.E.2g(4X[i-1],v);1Z(--i)}});6.C.1A({1K:l(P,K){u 1C=7.1w(":1C");P?1C.23({26:"1K",40:"1K",1b:"1K"},P,K):1C.I(l(){7.1q.1e=7.2N?7.2N:"";k(6.1f(7,"1e")=="1Y")7.1q.1e="2t"});q 7},1D:l(P,K){u 3a=7.1w(":3a");P?3a.23({26:"1D",40:"1D",1b:"1D"},P,K):3a.I(l(){7.2N=7.2N||6.1f(7,"1e");k(7.2N=="1Y")7.2N="2t";7.1q.1e="1Y"});q 7},52:6.C.3r,3r:l(C,4S){u 1y=1x;q 6.1k(C)&&6.1k(4S)?7.52(C,4S):7.I(l(){6(7)[6(7).46(":1C")?"1K":"1D"].14(6(7),1y)})},6x:l(P,K){q 7.23({26:"1K"},P,K)},6z:l(P,K){q 7.23({26:"1D"},P,K)},6C:l(P,K){q 7.I(l(){u 56=6(7).46(":1C")?"1K":"1D";6(7).23({26:56},P,K)})},6F:l(P,K){q 7.23({1b:"1K"},P,K)},6I:l(P,K){q 7.23({1b:"1D"},P,K)},6J:l(P,3q,K){q 7.23({1b:3q},P,K)},23:l(F,P,1o,K){q 7.1F(l(){7.2r=6.1A({},F);u 1l=6.P(P,1o,K);O(u p 1B F){u e=1p 6.30(7,1l,p);k(F[p].1g==3N)e.2x(e.M(),F[p]);H e[F[p]](F)}})},1F:l(v,C){k(!C){C=v;v="30"}q 7.I(l(){k(!7.1F)7.1F={};k(!7.1F[v])7.1F[v]=[];7.1F[v].1h(C);k(7.1F[v].G==1)C.14(7)})}});6.1A({P:l(P,1o,C){u 1l=P&&P.1g==6O?P:{1X:C||!C&&1o||6.1k(P)&&P,24:P,1o:C&&1o||1o&&1o.1g!=4D&&1o};1l.24=(1l.24&&1l.24.1g==3N?1l.24:{6U:6X,6Y:51}[1l.24])||6Z;1l.1H=1l.1X;1l.1X=l(){6.5X(7,"30");k(6.1k(1l.1H))1l.1H.14(7)};q 1l},1o:{},1F:{},5X:l(B,v){v=v||"30";k(B.1F&&B.1F[v]){B.1F[v].4m();u f=B.1F[v][0];k(f)f.14(B)}},30:l(B,1a,F){u z=7;u y=B.1q;u 4j=6.1f(B,"1e");y.1e="2t";y.5y="1C";z.a=l(){k(1a.3j)1a.3j.14(B,[z.2j]);k(F=="1b")6.1E(y,"1b",z.2j);H k(5g(z.2j))y[F]=5g(z.2j)+"49"};z.5k=l(){q 4f(6.1f(B,F))};z.M=l(){u r=4f(6.2V(B,F));q r&&r>-7g?r:z.5k()};z.2x=l(4d,3q){z.4o=(1p 5s()).5t();z.2j=4d;z.a();z.47=4c(l(){z.3j(4d,3q)},13)};z.1K=l(){k(!B.1z)B.1z={};B.1z[F]=7.M();1a.1K=T;z.2x(0,B.1z[F]);k(F!="1b")y[F]="5q"};z.1D=l(){k(!B.1z)B.1z={};B.1z[F]=7.M();1a.1D=T;z.2x(B.1z[F],0)};z.3r=l(){k(!B.1z)B.1z={};B.1z[F]=7.M();k(4j=="1Y"){1a.1K=T;k(F!="1b")y[F]="5q";z.2x(0,B.1z[F])}H{1a.1D=T;z.2x(B.1z[F],0)}};z.3j=l(31,3G){u t=(1p 5s()).5t();k(t>1a.24+z.4o){5u(z.47);z.47=1c;z.2j=3G;z.a();k(B.2r)B.2r[F]=T;u 29=T;O(u i 1B B.2r)k(B.2r[i]!==T)29=Y;k(29){y.5y="";y.1e=4j;k(6.1f(B,"1e")=="1Y")y.1e="2t";k(1a.1D)y.1e="1Y";k(1a.1D||1a.1K)O(u p 1B B.2r)k(p=="1b")6.1E(y,p,B.1z[p]);H y[p]=""}k(29&&6.1k(1a.1X))1a.1X.14(B)}H{u n=t-7.4o;u p=n/1a.24;z.2j=1a.1o&&6.1o[1a.1o]?6.1o[1a.1o](p,n,31,(3G-31),1a.24):((-5L.7E(p*5L.7F)/2)+0.5)*(3G-31)+31;z.a()}}}});6.C.1A({7G:l(R,21,K){7.2E(R,21,K,1)},2E:l(R,21,K,1S){k(6.1k(R))q 7.3R("2E",R);K=K||l(){};u v="65";k(21)k(6.1k(21)){K=21;21=1c}H{21=6.2U(21);v="6f"}u 4x=7;6.3d({R:R,v:v,D:21,1S:1S,1X:l(2J,11){k(11=="2K"||!1S&&11=="5H")4x.1E("2H",2J.3L).4T().I(K,[2J.3L,11,2J]);H K.14(4x,[2J.3L,11,2J])}});q 7},7L:l(){q 6.2U(7)},4T:l(){q 7.2o("2d").I(l(){k(7.4B)6.6c(7.4B);H 6.4H(7.2L||7.7P||7.2H||"")}).4E()}});k(!1t.3w)3w=l(){q 1p 7S("7W.80")};6.I("68,5R,5Q,6h,5P,5C".3o(","),l(i,o){6.C[o]=l(f){q 7.3R(o,f)}});6.1A({2a:l(R,D,K,v,1S){k(6.1k(D)){K=D;D=1c}q 6.3d({R:R,D:D,2K:K,4t:v,1S:1S})},8a:l(R,D,K,v){q 6.2a(R,D,K,v,1)},6c:l(R,K){q 6.2a(R,1c,K,"2d")},8c:l(R,D,K){q 6.2a(R,D,K,"67")},8e:l(R,D,K,v){k(6.1k(D)){K=D;D={}}q 6.3d({v:"6f",R:R,D:D,2K:K,4t:v})},8k:l(27){6.3K.27=27},8n:l(6o){6.1A(6.3K,6o)},3K:{1i:T,v:"65",27:0,5a:"8u/x-8w-5S-8D",50:T,4G:T,D:1c},3m:{},3d:l(s){s=6.1A({},6.3K,s);k(s.D){k(s.50&&1v s.D!="22")s.D=6.2U(s.D);k(s.v.4P()=="2a")s.R+=((s.R.15("?")>-1)?"&":"?")+s.D}k(s.1i&&!6.4a++)6.E.1M("68");u 4z=Y;u L=1p 3w();L.6P(s.v,s.R,s.4G);k(s.D)L.3i("6R-6V",s.5a);k(s.1S)L.3i("71-4A-73",6.3m[s.R]||"77, 7a 7c 7e 4b:4b:4b 7k");L.3i("X-7m-7p","3w");k(L.7r)L.3i("7t","7u");k(s.5A)s.5A(L);k(s.1i)6.E.1M("5C",[L,s]);u 2p=l(4n){k(L&&(L.3A==4||4n=="27")){4z=T;u 11;2s{11=6.6i(L)&&4n!="27"?s.1S&&6.6d(L,s.R)?"5H":"2K":"2M";k(11!="2M"){u 3E;2s{3E=L.4l("66-4A")}2y(e){}k(s.1S&&3E)6.3m[s.R]=3E;u D=6.5D(L,s.4t);k(s.2K)s.2K(D,11);k(s.1i)6.E.1M("5P",[L,s])}H 6.3Q(s,L,11)}2y(e){11="2M";6.3Q(s,L,11,e)}k(s.1i)6.E.1M("5Q",[L,s]);k(s.1i&&!--6.4a)6.E.1M("5R");k(s.1X)s.1X(L,11);L.2p=l(){};L=1c}};L.2p=2p;k(s.27>0)5c(l(){k(L){L.7J();k(!4z)2p("27")}},s.27);u 4J=L;2s{4J.7O(s.D)}2y(e){6.3Q(s,L,1c,e)}k(!s.4G)2p();q 4J},3Q:l(s,L,11,e){k(s.2M)s.2M(L,11,e);k(s.1i)6.E.1M("6h",[L,s,e])},4a:0,6i:l(r){2s{q!r.11&&8y.8G=="42:"||(r.11>=51&&r.11<6w)||r.11==5b||6.U.2C&&r.11==Q}2y(e){}q Y},6d:l(L,R){2s{u 5K=L.4l("66-4A");q L.11==5b||5K==6.3m[R]||6.U.2C&&L.11==Q}2y(e){}q Y},5D:l(r,v){u 4p=r.4l("7A-v");u D=!v&&4p&&4p.15("L")>=0;D=v=="L"||D?r.7I:r.3L;k(v=="2d")6.4H(D);k(v=="67")3B("D = "+D);k(v=="4Q")6("<1W>").4Q(D).4T();q D},2U:l(a){u s=[];k(a.1g==2A||a.3e)6.I(a,l(){s.1h(2I(7.W)+"="+2I(7.N))});H O(u j 1B a)k(a[j]&&a[j].1g==2A)6.I(a[j],l(){s.1h(2I(j)+"="+2I(7))});H s.1h(2I(j)+"="+2I(a[j]));q s.55("&")},4H:l(D){k(1t.5B)1t.5B(D);H k(6.U.2C)1t.5c(D,0);H 3B.3s(1t,D)}})}',62,539,'||||||jQuery|this|||||||||||||if|function|||||return||||var|type||||||elem|fn|data|event|prop|length|else|each|ret|callback|xml|cur|value|for|speed|undefined|url|element|true|browser|parentNode|name||false|||status|document||apply|indexOf|className|firstChild|val|obj|options|opacity|null|result|display|css|constructor|push|global|handler|isFunction|opt|msie|expr|easing|new|style|context|test|window|nodeName|typeof|filter|arguments|args|orig|extend|in|hidden|hide|attr|queue|re|old|events|add|show|arg|trigger|table|token|target|elems|num|ifModified|tbody|replace|nodeType|div|complete|none|while|key|params|string|animate|duration|nth|height|timeout|ready|done|get|index|not|script|tb|nextSibling|remove|preventDefault|merge|now|grep|z0|fix|guid|find|onreadystatechange|pushStack|curAnim|try|block|cssFloat|first|al|custom|catch|stopPropagation|Array|exec|safari|wrap|load|sibling|el|innerHTML|encodeURIComponent|res|success|text|error|oldblock|_|has|selected|disabled|checked|insertBefore|param|curCSS|last|map|substr|trim|fx|firstNum|handlers|originalEvent|re2|domManip|mozilla|opera|childNodes|removeChild|visible|readyList|parPos|ajax|jquery|oWidth|inArray|button|setRequestHeader|step|child|styleFloat|lastModified|empty|split|String|to|toggle|call|append|toUpperCase|multiFilter|XMLHttpRequest|foundToken|9_|oid|readyState|eval|tag|getAttribute|modRes|dir|lastNum|makeArray|on|slice|ajaxSettings|responseText|returnValue|Number|isReady|second|handleError|bind|mouseover|select|tr|cloneNode|clean|defaultView|id|position|width|oHeight|file|static|swap|getComputedStyle|is|timer|inv|px|active|00|setInterval|from|handleHover|parseFloat|visibility|radio|appendChild|oldDisplay|rec|getResponseHeader|shift|isTimeout|startTime|ct|break|getAll|parents|dataType|delete|triggered|clone|self|documentElement|requestDone|Modified|src|deep|Function|end|lastToggle|async|globalEval|pos|xml2|alpha|float|setArray|matched|submit|toLowerCase|html|getElementById|fn2|evalScripts|_resort|RegExp|safariTimer|els|unload|currentStyle|processData|200|_toggle|getPropertyValue|newProp|join|state|100|password|checkbox|contentType|304|setTimeout|check|gt|appendTo|parseInt|before|after|removeAttr|max|lt|eq|prepend|previousSibling|parent|1px|contains|Date|getTime|clearInterval|image|reset|input|overflow|continue|beforeSend|execScript|ajaxSend|httpData|getElementsByTagName|tmp|parse|notmodified|webkit|_prefix|xmlRes|Math|even|rl|odd|ajaxSuccess|ajaxComplete|ajaxStop|form|handle|unshift|srcElement|pageX|dequeue|clientX|scrollLeft|nodeValue|scrollTop|unbind|sl|zoom|GET|Last|json|ajaxStart|click|__ie_init|mouseout|getScript|httpNotModified|createElement|POST|DOMContentLoaded|ajaxError|httpSuccess|prevObject|force|ol|exclude|one|settings|do|absolute|left|relative|clientHeight|clientWidth|offsetWidth|300|slideDown|thead|slideUp|tfoot|td|slideToggle|th|offsetHeight|fadeIn|htmlFor|class|fadeOut|fadeTo|readonly|readOnly|gi|match|Object|open|action|Content|getAttributeNode|tagName|slow|Type|ig|600|fast|400|concat|If|userAgent|Since|compatible|boxModel|compatMode|Thu|next|siblings|01|children|Jan|prependTo|1970|insertAfter|10000|removeAttribute|addClass|removeClass|GMT|toggleClass|Requested|lastChild|only|With|enabled|overrideMimeType|textarea|Connection|close|right|object|Top|substring|prev|content|CSS1Compat|font|weight|cos|PI|loadIfModified|navigator|responseXML|abort|body|serialize|pageY|clientY|send|textContent|cancelBubble|setAttribute|ActiveXObject|hover|fromElement|method|Microsoft|9999|toElement|relatedTarget|XMLHTTP|removeEventListener|blur|focus|resize|scroll|dblclick|mousedown|mouseup|mousemove|getIfModified|change|getJSON|keydown|post|keypress|keyup|addEventListener|write|scr|ajaxTimeout|ipt|toString|ajaxSetup|prototype|size|defer|createTextNode|reverse|loaded|application|noConflict|www|line|location|Bottom|Right|Left|padding|urlencoded|border|Width|protocol'.split('|'),0,{})); jQuery.noConflict(); - +eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('7(1C 1w.6=="T"){1w.T=1w.T;B 6=u(a,c){7(1w==q)v 1p 6(a,c);a=a||17;7(6.1t(a))v 1p 6(17)[6.E.27?"27":"2O"](a);7(1C a=="23"){B m=/^[^<]*(<(.|\\s)+>)[^>]*$/.2Q(a);7(m)a=6.3k([m[1]]);J v 1p 6(c).2o(a)}v q.6r(a.1l==2y&&a||(a.3Y||a.I&&a!=1w&&!a.24&&a[0]!=T&&a[0].24)&&6.3M(a)||[a])};7(1C $!="T")6.2S$=$;B $=6;6.E=6.8p={3Y:"1.1.2",8q:u(){v q.I},I:0,2b:u(1T){v 1T==T?6.3M(q):q[1T]},2r:u(a){B L=6(a);L.6p=q;v L},6r:u(a){q.I=0;[].1g.14(q,a);v q},K:u(E,1E){v 6.K(q,E,1E)},2h:u(1c){B 4c=-1;q.K(u(i){7(q==1c)4c=i});v 4c},1I:u(1Y,O,C){B 1c=1Y;7(1Y.1l==3t)7(O==T)v q.I&&6[C||"1I"](q[0],1Y)||T;J{1c={};1c[1Y]=O}v q.K(u(2h){P(B H 1x 1c)6.1I(C?q.1q:q,H,6.H(q,1c[H],C,2h,H))})},1m:u(1Y,O){v q.1I(1Y,O,"30")},2L:u(e){7(1C e=="23")v q.3u().3r(17.8t(e));B t="";6.K(e||q,u(){6.K(q.2I,u(){7(q.24!=8)t+=q.24!=1?q.60:6.E.2L([q])})});v t},2K:u(){B a=6.3k(1A);v q.K(u(){B b=a[0].3l(U);q.11.2X(b,q);22(b.1b)b=b.1b;b.4C(q)})},3r:u(){v q.3j(1A,U,1,u(a){q.4C(a)})},5i:u(){v q.3j(1A,U,-1,u(a){q.2X(a,q.1b)})},5j:u(){v q.3j(1A,12,1,u(a){q.11.2X(a,q)})},5t:u(){v q.3j(1A,12,-1,u(a){q.11.2X(a,q.2e)})},4g:u(){v q.6p||6([])},2o:u(t){v q.2r(6.31(q,u(a){v 6.2o(t,a)}),t)},4Y:u(4N){v q.2r(6.31(q,u(a){B a=a.3l(4N!=T?4N:U);a.$1H=16;v a}))},1D:u(t){v q.2r(6.1t(t)&&6.2q(q,u(2z,2h){v t.14(2z,[2h])})||6.3z(t,q))},2g:u(t){v q.2r(t.1l==3t&&6.3z(t,q,U)||6.2q(q,u(a){v(t.1l==2y||t.3Y)?6.3y(a,t)<0:a!=t}))},1M:u(t){v q.2r(6.2k(q.2b(),t.1l==3t?6(t).2b():t.I!=T&&(!t.1f||t.1f=="8v")?t:[t]))},4l:u(1s){v 1s?6.1D(1s,q).r.I>0:12},1a:u(1a){v 1a==T?(q.I?q[0].O:16):q.1I("O",1a)},4U:u(1a){v 1a==T?(q.I?q[0].2t:16):q.3u().3r(1a)},3j:u(1E,1P,3Z,E){B 4Y=q.I>1;B a=6.3k(1E);7(3Z<0)a.8w();v q.K(u(){B 1c=q;7(1P&&6.1f(q,"1P")&&6.1f(a[0],"3m"))1c=q.5J("20")[0]||q.4C(17.6n("20"));6.K(a,u(){E.14(1c,[4Y?q.3l(U):q])})})}};6.1z=6.E.1z=u(){B 1O=1A[0],a=1;7(1A.I==1){1O=q;a=0}B H;22(H=1A[a++])P(B i 1x H)1O[i]=H[i];v 1O};6.1z({8x:u(){7(6.2S$)$=6.2S$;v 6},1t:u(E){v!!E&&1C E!="23"&&!E.1f&&1C E[0]=="T"&&/u/i.1n(E+"")},4B:u(D){v D.66&&D.5I&&!D.5I.64},1f:u(D,Y){v D.1f&&D.1f.3K()==Y.3K()},K:u(1c,E,1E){7(1c.I==T)P(B i 1x 1c)E.14(1c[i],1E||[i,1c[i]]);J P(B i=0,6q=1c.I;i<6q;i++)7(E.14(1c[i],1E||[i,1c[i]])===12)3O;v 1c},H:u(D,O,C,2h,H){7(6.1t(O))O=O.3n(D,[2h]);B 6s=/z-?2h|7P-?8A|1d|58|8B-?28/i;v O&&O.1l==3Q&&C=="30"&&!6s.1n(H)?O+"4S":O},19:{1M:u(D,c){6.K(c.3o(/\\s+/),u(i,Q){7(!6.19.2V(D.19,Q))D.19+=(D.19?" ":"")+Q})},2f:u(D,c){D.19=c?6.2q(D.19.3o(/\\s+/),u(Q){v!6.19.2V(c,Q)}).6t(" "):""},2V:u(t,c){t=t.19||t;c=c.1R(/([\\.\\\\\\+\\*\\?\\[\\^\\]\\$\\(\\)\\{\\}\\=\\!\\<\\>\\|\\:])/g,"\\\\$1");v t&&1p 4v("(^|\\\\s)"+c+"(\\\\s|$)").1n(t)}},4d:u(e,o,f){P(B i 1x o){e.1q["1N"+i]=e.1q[i];e.1q[i]=o[i]}f.14(e,[]);P(B i 1x o)e.1q[i]=e.1q["1N"+i]},1m:u(e,p){7(p=="28"||p=="3V"){B 1N={},46,3P,d=["7d","8C","8D","8E"];6.K(d,u(){1N["8F"+q]=0;1N["8G"+q+"8H"]=0});6.4d(e,1N,u(){7(6.1m(e,"1h")!="1Z"){46=e.8I;3P=e.8J}J{e=6(e.3l(U)).2o(":4j").5l("2Z").4g().1m({4n:"1G",45:"8K",1h:"2D",7I:"0",8M:"0"}).5z(e.11)[0];B 3d=6.1m(e.11,"45");7(3d==""||3d=="4b")e.11.1q.45="6x";46=e.6y;3P=e.6z;7(3d==""||3d=="4b")e.11.1q.45="4b";e.11.33(e)}});v p=="28"?46:3P}v 6.30(e,p)},30:u(D,H,53){B L;7(H=="1d"&&6.W.1j)v 6.1I(D.1q,"1d");7(H=="4h"||H=="2v")H=6.W.1j?"3T":"2v";7(!53&&D.1q[H])L=D.1q[H];J 7(17.44&&17.44.4W){7(H=="2v"||H=="3T")H="4h";H=H.1R(/([A-Z])/g,"-$1").4m();B Q=17.44.4W(D,16);7(Q)L=Q.55(H);J 7(H=="1h")L="1Z";J 6.4d(D,{1h:"2D"},u(){B c=17.44.4W(q,"");L=c&&c.55(H)||""})}J 7(D.51){B 56=H.1R(/\\-(\\w)/g,u(m,c){v c.3K()});L=D.51[H]||D.51[56]}v L},3k:u(a){B r=[];6.K(a,u(i,1r){7(!1r)v;7(1r.1l==3Q)1r=1r.6C();7(1C 1r=="23"){B s=6.35(1r),1V=17.6n("1V"),2i=[];B 2K=!s.18("<1u")&&[1,"<42>","</42>"]||(!s.18("<6D")||!s.18("<20")||!s.18("<6E"))&&[1,"<1P>","</1P>"]||!s.18("<3m")&&[2,"<1P><20>","</20></1P>"]||(!s.18("<6F")||!s.18("<6G"))&&[3,"<1P><20><3m>","</3m></20></1P>"]||[0,"",""];1V.2t=2K[1]+s+2K[2];22(2K[0]--)1V=1V.1b;7(6.W.1j){7(!s.18("<1P")&&s.18("<20")<0)2i=1V.1b&&1V.1b.2I;J 7(2K[1]=="<1P>"&&s.18("<20")<0)2i=1V.2I;P(B n=2i.I-1;n>=0;--n)7(6.1f(2i[n],"20")&&!2i[n].2I.I)2i[n].11.33(2i[n])}1r=[];P(B i=0,l=1V.2I.I;i<l;i++)1r.1g(1V.2I[i])}7(1r.I===0&&!6.1f(1r,"3w"))v;7(1r[0]==T||6.1f(1r,"3w"))r.1g(1r);J r=6.2k(r,1r)});v r},1I:u(D,Y,O){B 2j=6.4B(D)?{}:{"P":"6J","6L":"19","4h":6.W.1j?"3T":"2v",2v:6.W.1j?"3T":"2v",2t:"2t",19:"19",O:"O",2W:"2W",2Z:"2Z",89:"6N",2Y:"2Y"};7(Y=="1d"&&6.W.1j&&O!=T){D.58=1;v D.1D=D.1D.1R(/4i\\([^\\)]*\\)/6O,"")+(O==1?"":"4i(1d="+O*6g+")")}J 7(Y=="1d"&&6.W.1j)v D.1D?4T(D.1D.6P(/4i\\(1d=(.*)\\)/)[1])/6g:1;7(Y=="1d"&&6.W.3h&&O==1)O=0.6R;7(2j[Y]){7(O!=T)D[2j[Y]]=O;v D[2j[Y]]}J 7(O==T&&6.W.1j&&6.1f(D,"3w")&&(Y=="81"||Y=="80"))v D.6T(Y).60;J 7(D.66){7(O!=T)D.6V(Y,O);7(6.W.1j&&/5E|3e/.1n(Y)&&!6.4B(D))v D.36(Y,2);v D.36(Y)}J{Y=Y.1R(/-([a-z])/6W,u(z,b){v b.3K()});7(O!=T)D[Y]=O;v D[Y]}},35:u(t){v t.1R(/^\\s+|\\s+$/g,"")},3M:u(a){B r=[];7(a.1l!=2y)P(B i=0,2R=a.I;i<2R;i++)r.1g(a[i]);J r=a.3N(0);v r},3y:u(b,a){P(B i=0,2R=a.I;i<2R;i++)7(a[i]==b)v i;v-1},2k:u(2u,3H){B r=[].3N.3n(2u,0);P(B i=0,5b=3H.I;i<5b;i++)7(6.3y(3H[i],r)==-1)2u.1g(3H[i]);v 2u},2q:u(1U,E,4k){7(1C E=="23")E=1p 4w("a","i","v "+E);B 1i=[];P(B i=0,2z=1U.I;i<2z;i++)7(!4k&&E(1U[i],i)||4k&&!E(1U[i],i))1i.1g(1U[i]);v 1i},31:u(1U,E){7(1C E=="23")E=1p 4w("a","v "+E);B 1i=[],r=[];P(B i=0,2z=1U.I;i<2z;i++){B 1a=E(1U[i],i);7(1a!==16&&1a!=T){7(1a.1l!=2y)1a=[1a];1i=1i.6Z(1a)}}B r=1i.I?[1i[0]]:[];5f:P(B i=1,5e=1i.I;i<5e;i++){P(B j=0;j<i;j++)7(1i[i]==r[j])5F 5f;r.1g(1i[i])}v r}});1p u(){B b=7L.71.4m();6.W={2N:/5D/.1n(b),3f:/3f/.1n(b),1j:/1j/.1n(b)&&!/3f/.1n(b),3h:/3h/.1n(b)&&!/(72|5D)/.1n(b)};6.7H=!6.W.1j||17.74=="75"};6.K({5u:"a.11",4z:"6.4z(a)",76:"6.2a(a,2,\'2e\')",7D:"6.2a(a,2,\'5s\')",78:"6.2B(a.11.1b,a)",79:"6.2B(a.1b)"},u(i,n){6.E[i]=u(a){B L=6.31(q,n);7(a&&1C a=="23")L=6.3z(a,L);v q.2r(L)}});6.K({5z:"3r",7b:"5i",2X:"5j",7e:"5t"},u(i,n){6.E[i]=u(){B a=1A;v q.K(u(){P(B j=0,2R=a.I;j<2R;j++)6(a[j])[n](q)})}});6.K({5l:u(1Y){6.1I(q,1Y,"");q.7g(1Y)},7h:u(c){6.19.1M(q,c)},7i:u(c){6.19.2f(q,c)},7k:u(c){6.19[6.19.2V(q,c)?"2f":"1M"](q,c)},2f:u(a){7(!a||6.1D(a,[q]).r.I)q.11.33(q)},3u:u(){22(q.1b)q.33(q.1b)}},u(i,n){6.E[i]=u(){v q.K(n,1A)}});6.K(["5q","5n","5p","5v"],u(i,n){6.E[n]=u(1T,E){v q.1D(":"+n+"("+1T+")",E)}});6.K(["28","3V"],u(i,n){6.E[n]=u(h){v h==T?(q.I?6.1m(q[0],n):16):q.1m(n,h.1l==3t?h:h+"4S")}});6.1z({1s:{"":"m[2]==\'*\'||6.1f(a,m[2])","#":"a.36(\'2J\')==m[2]",":":{5n:"i<m[3]-0",5p:"i>m[3]-0",2a:"m[3]-0==i",5q:"m[3]-0==i",2u:"i==0",2T:"i==r.I-1",5R:"i%2==0",5S:"i%2","2a-3s":"6.2a(a.11.1b,m[3],\'2e\',a)==a","2u-3s":"6.2a(a.11.1b,1,\'2e\')==a","2T-3s":"6.2a(a.11.7n,1,\'5s\')==a","7p-3s":"6.2B(a.11.1b).I==1",5u:"a.1b",3u:"!a.1b",5v:"6.E.2L.14([a]).18(m[3])>=0",3i:\'a.C!="1G"&&6.1m(a,"1h")!="1Z"&&6.1m(a,"4n")!="1G"\',1G:\'a.C=="1G"||6.1m(a,"1h")=="1Z"||6.1m(a,"4n")=="1G"\',7v:"!a.2W",2W:"a.2W",2Z:"a.2Z",2Y:"a.2Y||6.1I(a,\'2Y\')",2L:"a.C==\'2L\'",4j:"a.C==\'4j\'",5x:"a.C==\'5x\'",4G:"a.C==\'4G\'",5y:"a.C==\'5y\'",4R:"a.C==\'4R\'",5A:"a.C==\'5A\'",5B:"a.C==\'5B\'",3x:\'a.C=="3x"||6.1f(a,"3x")\',5C:"/5C|42|7A|3x/i.1n(a.1f)"},".":"6.19.2V(a,m[2])","@":{"=":"z==m[4]","!=":"z!=m[4]","^=":"z&&!z.18(m[4])","$=":"z&&z.2U(z.I - m[4].I,m[4].I)==m[4]","*=":"z&&z.18(m[4])>=0","":"z",4u:u(m){v["",m[1],m[3],m[2],m[5]]},5P:"z=a[m[3]];7(!z||/5E|3e/.1n(m[3]))z=6.1I(a,m[3]);"},"[":"6.2o(m[2],a).I"},5M:[/^\\[ *(@)([a-2m-3C-]*) *([!*$^=]*) *(\'?"?)(.*?)\\4 *\\]/i,/^(\\[)\\s*(.*?(\\[.*?\\])?[^[]*?)\\s*\\]/,/^(:)([a-2m-3C-]*)\\("?\'?(.*?(\\(.*?\\))?[^(]*?)"?\'?\\)/i,/^([:.#]*)([a-2m-3C*-]*)/i],1Q:[/^(\\/?\\.\\.)/,"a.11",/^(>|\\/)/,"6.2B(a.1b)",/^(\\+)/,"6.2a(a,2,\'2e\')",/^(~)/,u(a){B s=6.2B(a.11.1b);v s.3N(6.3y(a,s)+1)}],3z:u(1s,1U,2g){B 1N,Q=[];22(1s&&1s!=1N){1N=1s;B f=6.1D(1s,1U,2g);1s=f.t.1R(/^\\s*,\\s*/,"");Q=2g?1U=f.r:6.2k(Q,f.r)}v Q},2o:u(t,1B){7(1C t!="23")v[t];7(1B&&!1B.24)1B=16;1B=1B||17;7(!t.18("//")){1B=1B.4H;t=t.2U(2,t.I)}J 7(!t.18("/")){1B=1B.4H;t=t.2U(1,t.I);7(t.18("/")>=1)t=t.2U(t.18("/"),t.I)}B L=[1B],2c=[],2T=16;22(t&&2T!=t){B r=[];2T=t;t=6.35(t).1R(/^\\/\\//i,"");B 3B=12;B 1J=/^[\\/>]\\s*([a-2m-9*-]+)/i;B m=1J.2Q(t);7(m){6.K(L,u(){P(B c=q.1b;c;c=c.2e)7(c.24==1&&(6.1f(c,m[1])||m[1]=="*"))r.1g(c)});L=r;t=t.1R(1J,"");7(t.18(" ")==0)5F;3B=U}J{P(B i=0;i<6.1Q.I;i+=2){B 1J=6.1Q[i];B m=1J.2Q(t);7(m){r=L=6.31(L,6.1t(6.1Q[i+1])?6.1Q[i+1]:u(a){v 40(6.1Q[i+1])});t=6.35(t.1R(1J,""));3B=U;3O}}}7(t&&!3B){7(!t.18(",")){7(L[0]==1B)L.4L();6.2k(2c,L);r=L=[1B];t=" "+t.2U(1,t.I)}J{B 34=/^([a-2m-3C-]+)(#)([a-2m-9\\\\*2S-]*)/i;B m=34.2Q(t);7(m){m=[0,m[2],m[3],m[1]]}J{34=/^([#.]?)([a-2m-9\\\\*2S-]*)/i;m=34.2Q(t)}7(m[1]=="#"&&L[L.I-1].4X){B 2l=L[L.I-1].4X(m[2]);7(6.W.1j&&2l&&2l.2J!=m[2])2l=6(\'[@2J="\'+m[2]+\'"]\',L[L.I-1])[0];L=r=2l&&(!m[3]||6.1f(2l,m[3]))?[2l]:[]}J{7(m[1]==".")B 4r=1p 4v("(^|\\\\s)"+m[2]+"(\\\\s|$)");6.K(L,u(){B 3E=m[1]!=""||m[0]==""?"*":m[2];7(6.1f(q,"7J")&&3E=="*")3E="3g";6.2k(r,m[1]!=""&&L.I!=1?6.4x(q,[],m[1],m[2],4r):q.5J(3E))});7(m[1]=="."&&L.I==1)r=6.2q(r,u(e){v 4r.1n(e.19)});7(m[1]=="#"&&L.I==1){B 5K=r;r=[];6.K(5K,u(){7(q.36("2J")==m[2]){r=[q];v 12}})}L=r}t=t.1R(34,"")}}7(t){B 1a=6.1D(t,r);L=r=1a.r;t=6.35(1a.t)}}7(L&&L[0]==1B)L.4L();6.2k(2c,L);v 2c},1D:u(t,r,2g){22(t&&/^[a-z[({<*:.#]/i.1n(t)){B p=6.5M,m;6.K(p,u(i,1J){m=1J.2Q(t);7(m){t=t.7M(m[0].I);7(6.1s[m[1]].4u)m=6.1s[m[1]].4u(m);v 12}});7(m[1]==":"&&m[2]=="2g")r=6.1D(m[3],r,U).r;J 7(m[1]=="."){B 1J=1p 4v("(^|\\\\s)"+m[2]+"(\\\\s|$)");r=6.2q(r,u(e){v 1J.1n(e.19||"")},2g)}J{B f=6.1s[m[1]];7(1C f!="23")f=6.1s[m[1]][m[2]];40("f = u(a,i){"+(6.1s[m[1]].5P||"")+"v "+f+"}");r=6.2q(r,f,2g)}}v{r:r,t:t}},4x:u(o,r,1Q,Y,1J){P(B s=o.1b;s;s=s.2e)7(s.24==1){B 1M=U;7(1Q==".")1M=s.19&&1J.1n(s.19);J 7(1Q=="#")1M=s.36("2J")==Y;7(1M)r.1g(s);7(1Q=="#"&&r.I)3O;7(s.1b)6.4x(s,r,1Q,Y,1J)}v r},4z:u(D){B 4A=[];B Q=D.11;22(Q&&Q!=17){4A.1g(Q);Q=Q.11}v 4A},2a:u(Q,1i,3Z,D){1i=1i||1;B 1T=0;P(;Q;Q=Q[3Z]){7(Q.24==1)1T++;7(1T==1i||1i=="5R"&&1T%2==0&&1T>1&&Q==D||1i=="5S"&&1T%2==1&&Q==D)v Q}},2B:u(n,D){B r=[];P(;n;n=n.2e){7(n.24==1&&(!D||n!=D))r.1g(n)}v r}});6.G={1M:u(S,C,1o,F){7(6.W.1j&&S.3L!=T)S=1w;7(F)1o.F=F;7(!1o.2A)1o.2A=q.2A++;7(!S.$1H)S.$1H={};B 38=S.$1H[C];7(!38){38=S.$1H[C]={};7(S["39"+C])38[0]=S["39"+C]}38[1o.2A]=1o;S["39"+C]=q.5Y;7(!q.1k[C])q.1k[C]=[];q.1k[C].1g(S)},2A:1,1k:{},2f:u(S,C,1o){7(S.$1H){B i,j,k;7(C&&C.C){1o=C.1o;C=C.C}7(C&&S.$1H[C])7(1o)5U S.$1H[C][1o.2A];J P(i 1x S.$1H[C])5U S.$1H[C][i];J P(j 1x S.$1H)q.2f(S,j);P(k 1x S.$1H[C])7(k){k=U;3O}7(!k)S["39"+C]=16}},1S:u(C,F,S){F=6.3M(F||[]);7(!S)6.K(q.1k[C]||[],u(){6.G.1S(C,F,q)});J{B 1o=S["39"+C],1a,E=6.1t(S[C]);7(1o){F.61(q.2j({C:C,1O:S}));7((1a=1o.14(S,F))!==12)q.4F=U}7(E&&1a!==12)S[C]();q.4F=12}},5Y:u(G){7(1C 6=="T"||6.G.4F)v;G=6.G.2j(G||1w.G||{});B 3R;B c=q.$1H[G.C];B 1E=[].3N.3n(1A,1);1E.61(G);P(B j 1x c){1E[0].1o=c[j];1E[0].F=c[j].F;7(c[j].14(q,1E)===12){G.2n();G.2H();3R=12}}7(6.W.1j)G.1O=G.2n=G.2H=G.1o=G.F=16;v 3R},2j:u(G){7(!G.1O&&G.63)G.1O=G.63;7(G.65==T&&G.67!=T){B e=17.4H,b=17.64;G.65=G.67+(e.68||b.68);G.7Y=G.7Z+(e.6c||b.6c)}7(6.W.2N&&G.1O.24==3){B 3a=G;G=6.1z({},3a);G.1O=3a.1O.11;G.2n=u(){v 3a.2n()};G.2H=u(){v 3a.2H()}}7(!G.2n)G.2n=u(){q.3R=12};7(!G.2H)G.2H=u(){q.82=U};v G}};6.E.1z({3U:u(C,F,E){v q.K(u(){6.G.1M(q,C,E||F,F)})},6u:u(C,F,E){v q.K(u(){6.G.1M(q,C,u(G){6(q).6f(G);v(E||F).14(q,1A)},F)})},6f:u(C,E){v q.K(u(){6.G.2f(q,C,E)})},1S:u(C,F){v q.K(u(){6.G.1S(C,F,q)})},3X:u(){B a=1A;v q.6j(u(e){q.4M=q.4M==0?1:0;e.2n();v a[q.4M].14(q,[e])||12})},83:u(f,g){u 4O(e){B p=(e.C=="41"?e.84:e.85)||e.86;22(p&&p!=q)2G{p=p.11}2w(e){p=q};7(p==q)v 12;v(e.C=="41"?f:g).14(q,[e])}v q.41(4O).6k(4O)},27:u(f){7(6.3W)f.14(17,[6]);J{6.3c.1g(u(){v f.14(q,[6])})}v q}});6.1z({3W:12,3c:[],27:u(){7(!6.3W){6.3W=U;7(6.3c){6.K(6.3c,u(){q.14(17)});6.3c=16}7(6.W.3h||6.W.3f)17.87("6o",6.27,12)}}});1p u(){6.K(("88,8a,2O,8b,8d,52,6j,8e,"+"8f,8g,8h,41,6k,8j,42,"+"4R,8k,8l,8m,2C").3o(","),u(i,o){6.E[o]=u(f){v f?q.3U(o,f):q.1S(o)}});7(6.W.3h||6.W.3f)17.8n("6o",6.27,12);J 7(6.W.1j){17.8o("<8r"+"8s 2J=62 8u=U "+"3e=//:><\\/2d>");B 2d=17.4X("62");7(2d)2d.37=u(){7(q.3D!="1X")v;q.11.33(q);6.27()};2d=16}J 7(6.W.2N)6.50=3L(u(){7(17.3D=="8y"||17.3D=="1X"){4p(6.50);6.50=16;6.27()}},10);6.G.1M(1w,"2O",6.27)};7(6.W.1j)6(1w).6u("52",u(){B 1k=6.G.1k;P(B C 1x 1k){B 4Z=1k[C],i=4Z.I;7(i&&C!=\'52\')6w 6.G.2f(4Z[i-1],C);22(--i)}});6.E.1z({6A:u(V,21,M){q.2O(V,21,M,1)},2O:u(V,21,M,1W){7(6.1t(V))v q.3U("2O",V);M=M||u(){};B C="5d";7(21)7(6.1t(21)){M=21;21=16}J{21=6.3g(21);C="5V"}B 4e=q;6.3v({V:V,C:C,F:21,1W:1W,1X:u(2P,15){7(15=="2M"||!1W&&15=="5L")4e.1I("2t",2P.3G).4V().K(M,[2P.3G,15,2P]);J M.14(4e,[2P.3G,15,2P])}});v q},6B:u(){v 6.3g(q)},4V:u(){v q.2o("2d").K(u(){7(q.3e)6.59(q.3e);J 6.4a(q.2L||q.6H||q.2t||"")}).4g()}});7(!1w.3p)3p=u(){v 1p 6I("6K.6M")};6.K("5m,5Q,5O,5W,5N,5H".3o(","),u(i,o){6.E[o]=u(f){v q.3U(o,f)}});6.1z({2b:u(V,F,M,C,1W){7(6.1t(F)){M=F;F=16}v 6.3v({V:V,F:F,2M:M,4t:C,1W:1W})},6Q:u(V,F,M,C){v 6.2b(V,F,M,C,1)},59:u(V,M){v 6.2b(V,16,M,"2d")},6S:u(V,F,M){v 6.2b(V,F,M,"6m")},6U:u(V,F,M,C){7(6.1t(F)){M=F;F={}}v 6.3v({C:"5V",V:V,F:F,2M:M,4t:C})},6X:u(29){6.3q.29=29},6Y:u(5c){6.1z(6.3q,5c)},3q:{1k:U,C:"5d",29:0,5r:"70/x-73-3w-77",5h:U,48:U,F:16},3S:{},3v:u(s){s=6.1z({},6.3q,s);7(s.F){7(s.5h&&1C s.F!="23")s.F=6.3g(s.F);7(s.C.4m()=="2b"){s.V+=((s.V.18("?")>-1)?"&":"?")+s.F;s.F=16}}7(s.1k&&!6.4E++)6.G.1S("5m");B 4y=12;B N=1p 3p();N.7j(s.C,s.V,s.48);7(s.F)N.3A("7l-7m",s.5r);7(s.1W)N.3A("7o-4K-7q",6.3S[s.V]||"7s, 7t 7w 7x 4o:4o:4o 7z");N.3A("X-7B-7C","3p");7(N.7E)N.3A("7F","7G");7(s.5G)s.5G(N);7(s.1k)6.G.1S("5H",[N,s]);B 37=u(4s){7(N&&(N.3D==4||4s=="29")){4y=U;7(3I){4p(3I);3I=16}B 15;2G{15=6.5Z(N)&&4s!="29"?s.1W&&6.69(N,s.V)?"5L":"2M":"2C";7(15!="2C"){B 3F;2G{3F=N.4P("6b-4K")}2w(e){}7(s.1W&&3F)6.3S[s.V]=3F;B F=6.6i(N,s.4t);7(s.2M)s.2M(F,15);7(s.1k)6.G.1S("5N",[N,s])}J 6.3J(s,N,15)}2w(e){15="2C";6.3J(s,N,15,e)}7(s.1k)6.G.1S("5O",[N,s]);7(s.1k&&!--6.4E)6.G.1S("5Q");7(s.1X)s.1X(N,15);7(s.48)N=16}};B 3I=3L(37,13);7(s.29>0)57(u(){7(N){N.7N();7(!4y)37("29")}},s.29);2G{N.7Q(s.F)}2w(e){6.3J(s,N,16,e)}7(!s.48)37();v N},3J:u(s,N,15,e){7(s.2C)s.2C(N,15,e);7(s.1k)6.G.1S("5W",[N,s,e])},4E:0,5Z:u(r){2G{v!r.15&&7V.7W=="4G:"||(r.15>=5X&&r.15<7X)||r.15==6d||6.W.2N&&r.15==T}2w(e){}v 12},69:u(N,V){2G{B 6e=N.4P("6b-4K");v N.15==6d||6e==6.3S[V]||6.W.2N&&N.15==T}2w(e){}v 12},6i:u(r,C){B 4Q=r.4P("8c-C");B F=!C&&4Q&&4Q.18("N")>=0;F=C=="N"||F?r.8i:r.3G;7(C=="2d")6.4a(F);7(C=="6m")40("F = "+F);7(C=="4U")6("<1V>").4U(F).4V();v F},3g:u(a){B s=[];7(a.1l==2y||a.3Y)6.K(a,u(){s.1g(2x(q.Y)+"="+2x(q.O))});J P(B j 1x a)7(a[j]&&a[j].1l==2y)6.K(a[j],u(){s.1g(2x(j)+"="+2x(q))});J s.1g(2x(j)+"="+2x(a[j]));v s.6t("&")},4a:u(F){7(1w.54)1w.54(F);J 7(6.W.2N)1w.57(F,0);J 40.3n(1w,F)}});6.E.1z({1L:u(R,M){B 1G=q.1D(":1G");R?1G.26({28:"1L",3V:"1L",1d:"1L"},R,M):1G.K(u(){q.1q.1h=q.2E?q.2E:"";7(6.1m(q,"1h")=="1Z")q.1q.1h="2D"});v q},1K:u(R,M){B 3i=q.1D(":3i");R?3i.26({28:"1K",3V:"1K",1d:"1K"},R,M):3i.K(u(){q.2E=q.2E||6.1m(q,"1h");7(q.2E=="1Z")q.2E="2D";q.1q.1h="1Z"});v q},5g:6.E.3X,3X:u(E,4I){B 1E=1A;v 6.1t(E)&&6.1t(4I)?q.5g(E,4I):q.K(u(){6(q)[6(q).4l(":1G")?"1L":"1K"].14(6(q),1E)})},7a:u(R,M){v q.26({28:"1L"},R,M)},7c:u(R,M){v q.26({28:"1K"},R,M)},7f:u(R,M){v q.K(u(){B 5k=6(q).4l(":1G")?"1L":"1K";6(q).26({28:5k},R,M)})},7r:u(R,M){v q.26({1d:"1L"},R,M)},7u:u(R,M){v q.26({1d:"1K"},R,M)},7y:u(R,43,M){v q.26({1d:43},R,M)},26:u(H,R,1v,M){v q.1F(u(){q.2F=6.1z({},H);B 1u=6.R(R,1v,M);P(B p 1x H){B e=1p 6.3b(q,1u,p);7(H[p].1l==3Q)e.2s(e.Q(),H[p]);J e[H[p]](H)}})},1F:u(C,E){7(!E){E=C;C="3b"}v q.K(u(){7(!q.1F)q.1F={};7(!q.1F[C])q.1F[C]=[];q.1F[C].1g(E);7(q.1F[C].I==1)E.14(q)})}});6.1z({R:u(R,1v,E){B 1u=R&&R.1l==7K?R:{1X:E||!E&&1v||6.1t(R)&&R,25:R,1v:E&&1v||1v&&1v.1l!=4w&&1v};1u.25=(1u.25&&1u.25.1l==3Q?1u.25:{7R:7S,7T:5X}[1u.25])||7U;1u.1N=1u.1X;1u.1X=u(){6.6a(q,"3b");7(6.1t(1u.1N))1u.1N.14(q)};v 1u},1v:{},1F:{},6a:u(D,C){C=C||"3b";7(D.1F&&D.1F[C]){D.1F[C].4L();B f=D.1F[C][0];7(f)f.14(D)}},3b:u(D,1e,H){B z=q;B y=D.1q;B 4D=6.1m(D,"1h");y.5T="1G";z.a=u(){7(1e.49)1e.49.14(D,[z.2p]);7(H=="1d")6.1I(y,"1d",z.2p);J 7(6l(z.2p))y[H]=6l(z.2p)+"4S";y.1h="2D"};z.6v=u(){v 4T(6.1m(D,H))};z.Q=u(){B r=4T(6.30(D,H));v r&&r>-8z?r:z.6v()};z.2s=u(4f,43){z.4J=(1p 5o()).5w();z.2p=4f;z.a();z.4q=3L(u(){z.49(4f,43)},13)};z.1L=u(){7(!D.1y)D.1y={};D.1y[H]=q.Q();1e.1L=U;z.2s(0,D.1y[H]);7(H!="1d")y[H]="5a"};z.1K=u(){7(!D.1y)D.1y={};D.1y[H]=q.Q();1e.1K=U;z.2s(D.1y[H],0)};z.3X=u(){7(!D.1y)D.1y={};D.1y[H]=q.Q();7(4D=="1Z"){1e.1L=U;7(H!="1d")y[H]="5a";z.2s(0,D.1y[H])}J{1e.1K=U;z.2s(D.1y[H],0)}};z.49=u(32,47){B t=(1p 5o()).5w();7(t>1e.25+z.4J){4p(z.4q);z.4q=16;z.2p=47;z.a();7(D.2F)D.2F[H]=U;B 2c=U;P(B i 1x D.2F)7(D.2F[i]!==U)2c=12;7(2c){y.5T="";y.1h=4D;7(6.1m(D,"1h")=="1Z")y.1h="2D";7(1e.1K)y.1h="1Z";7(1e.1K||1e.1L)P(B p 1x D.2F)7(p=="1d")6.1I(y,p,D.1y[p]);J y[p]=""}7(2c&&6.1t(1e.1X))1e.1X.14(D)}J{B n=t-q.4J;B p=n/1e.25;z.2p=1e.1v&&6.1v[1e.1v]?6.1v[1e.1v](p,n,32,(47-32),1e.25):((-6h.7O(p*6h.8L)/2)+0.5)*(47-32)+32;z.a()}}}})}',62,545,'||||||jQuery|if|||||||||||||||||||this||||function|return||||||var|type|elem|fn|data|event|prop|length|else|each|ret|callback|xml|value|for|cur|speed|element|undefined|true|url|browser||name|||parentNode|false||apply|status|null|document|indexOf|className|val|firstChild|obj|opacity|options|nodeName|push|display|result|msie|global|constructor|css|test|handler|new|style|arg|expr|isFunction|opt|easing|window|in|orig|extend|arguments|context|typeof|filter|args|queue|hidden|events|attr|re|hide|show|add|old|target|table|token|replace|trigger|num|elems|div|ifModified|complete|key|none|tbody|params|while|string|nodeType|duration|animate|ready|height|timeout|nth|get|done|script|nextSibling|remove|not|index|tb|fix|merge|oid|z0|preventDefault|find|now|grep|pushStack|custom|innerHTML|first|cssFloat|catch|encodeURIComponent|Array|el|guid|sibling|error|block|oldblock|curAnim|try|stopPropagation|childNodes|id|wrap|text|success|safari|load|res|exec|al|_|last|substr|has|disabled|insertBefore|selected|checked|curCSS|map|firstNum|removeChild|re2|trim|getAttribute|onreadystatechange|handlers|on|originalEvent|fx|readyList|parPos|src|opera|param|mozilla|visible|domManip|clean|cloneNode|tr|call|split|XMLHttpRequest|ajaxSettings|append|child|String|empty|ajax|form|button|inArray|multiFilter|setRequestHeader|foundToken|9_|readyState|tag|modRes|responseText|second|ival|handleError|toUpperCase|setInterval|makeArray|slice|break|oWidth|Number|returnValue|lastModified|styleFloat|bind|width|isReady|toggle|jquery|dir|eval|mouseover|select|to|defaultView|position|oHeight|lastNum|async|step|globalEval|static|pos|swap|self|from|end|float|alpha|radio|inv|is|toLowerCase|visibility|00|clearInterval|timer|rec|isTimeout|dataType|_resort|RegExp|Function|getAll|requestDone|parents|matched|isXMLDoc|appendChild|oldDisplay|active|triggered|file|documentElement|fn2|startTime|Modified|shift|lastToggle|deep|handleHover|getResponseHeader|ct|submit|px|parseFloat|html|evalScripts|getComputedStyle|getElementById|clone|els|safariTimer|currentStyle|unload|force|execScript|getPropertyValue|newProp|setTimeout|zoom|getScript|1px|sl|settings|GET|rl|check|_toggle|processData|prepend|before|state|removeAttr|ajaxStart|lt|Date|gt|eq|contentType|previousSibling|after|parent|contains|getTime|checkbox|password|appendTo|image|reset|input|webkit|href|continue|beforeSend|ajaxSend|ownerDocument|getElementsByTagName|tmp|notmodified|parse|ajaxSuccess|ajaxComplete|_prefix|ajaxStop|even|odd|overflow|delete|POST|ajaxError|200|handle|httpSuccess|nodeValue|unshift|__ie_init|srcElement|body|pageX|tagName|clientX|scrollLeft|httpNotModified|dequeue|Last|scrollTop|304|xmlRes|unbind|100|Math|httpData|click|mouseout|parseInt|json|createElement|DOMContentLoaded|prevObject|ol|setArray|exclude|join|one|max|do|relative|clientHeight|clientWidth|loadIfModified|serialize|toString|thead|tfoot|td|th|textContent|ActiveXObject|htmlFor|Microsoft|class|XMLHTTP|readOnly|gi|match|getIfModified|9999|getJSON|getAttributeNode|post|setAttribute|ig|ajaxTimeout|ajaxSetup|concat|application|userAgent|compatible|www|compatMode|CSS1Compat|next|urlencoded|siblings|children|slideDown|prependTo|slideUp|Top|insertAfter|slideToggle|removeAttribute|addClass|removeClass|open|toggleClass|Content|Type|lastChild|If|only|Since|fadeIn|Thu|01|fadeOut|enabled|Jan|1970|fadeTo|GMT|textarea|Requested|With|prev|overrideMimeType|Connection|close|boxModel|right|object|Object|navigator|substring|abort|cos|font|send|slow|600|fast|400|location|protocol|300|pageY|clientY|method|action|cancelBubble|hover|fromElement|toElement|relatedTarget|removeEventListener|blur|readonly|focus|resize|content|scroll|dblclick|mousedown|mouseup|mousemove|responseXML|change|keydown|keypress|keyup|addEventListener|write|prototype|size|scr|ipt|createTextNode|defer|FORM|reverse|noConflict|loaded|10000|weight|line|Bottom|Right|Left|padding|border|Width|offsetHeight|offsetWidth|absolute|PI|left'.split('|'),0,{}));jQuery.noConflict(); diff --git a/wp-includes/js/list-manipulation.js b/wp-includes/js/list-manipulation.js new file mode 100644 index 0000000..e522709 --- /dev/null +++ b/wp-includes/js/list-manipulation.js @@ -0,0 +1,295 @@ +addLoadEvent( function() { + if ( 'undefined' != typeof listManL10n ) + Object.extend(listMan.prototype, listManL10n); + theList = new listMan(); +} ); + +function deleteSomething( what, id, message, obj ) { + if ( !obj ) + obj=theList; + if ( !message ) + message = obj.delText.replace(/%thing%/g, what); + if( confirm(message) ) + return obj.ajaxDelete( what, id ); + else return false; +} + +function dimSomething( what, id, dimClass, obj ) { + if ( !obj ) + obj = theList; + return obj.ajaxDimmer(what,id,dimClass); +} + +var listMan = Class.create(); +Object.extend(listMan.prototype, { + ajaxRespEl: 'ajax-response', + ajaxHandler: false, + inputData: '', + clearInputs: [], + showLink: true, + topAdder: false, + alt: 'alternate', + altOffset: 0, + addComplete: null, + delComplete: null, + dimComplete: null, + dataStore: null, + formStore: null, + + jumpText: '', // We get these from listManL10n + delText: '', + + initialize: function(theListId) { + this.theList = $(theListId ? theListId : 'the-list'); + if ( !this.theList ) + return false; + Element.cleanWhitespace(this.theList); + }, + + // sends add-what and fields contained in where + // recieves html with top element having an id like what-# + ajaxAdder: function( what, where, update ) { // Do NOT wrap TR in TABLE TBODY + var ajaxAdd = new WPAjax( this.ajaxHandler, this.ajaxRespEl ); + if ( ajaxAdd.notInitialized() ) + return true; + var action = ( update ? 'update-' : 'add-' ) + what; + ajaxAdd.options.parameters = $H(ajaxAdd.options.parameters).merge({action: action}).merge(this.inputData.toQueryParams()).merge(this.grabInputs( where, ajaxAdd ).toQueryParams()); + + var tempObj=this; + ajaxAdd.addOnComplete( function(transport) { + var newItems = $A(transport.responseXML.getElementsByTagName(what)); + if ( newItems ) { + var showLinkMessage = ''; + var m = ''; + newItems.each( function(i) { + var id = i.getAttribute('id'); + var exists = $(what+'-'+id); + if ( exists ) + tempObj.replaceListItem( exists, getNodeValue(i,'response_data'), update ); + else + tempObj.addListItem( getNodeValue(i, 'response_data') ); + m = getNodeValue(i, 'show-link'); + showLinkMessage += showLinkMessage ? "<br />\n" : ''; + if ( m ) + showLinkMessage += m; + else + showLinkMessage += "<a href='#" + what + '-' + id + "'>" + tempObj.jumpText + "</a>"; + }); + if ( tempObj.showLink && showLinkMessage ) + Element.update(ajaxAdd.myResponseElement,"<div id='jumplink' class='updated fade'><p>" + showLinkMessage + "</p></div>"); + } + if ( tempObj.addComplete && typeof tempObj.addComplete == 'function' ) + tempObj.addComplete( what, where, update, transport ); + tempObj.recolorList(); + ajaxAdd.restoreInputs = null; + }); + if ( !update ) + ajaxAdd.addOnWPError( function(transport) { tempObj.restoreForm(ajaxAdd.restoreInputs); }); + ajaxAdd.request(ajaxAdd.url); + if ( !update ) + this.clear(); + return false; + }, + + // sends update-what and fields contained in where + // recieves html with top element having an id like what-# + ajaxUpdater: function( what, where ) { return this.ajaxAdder( what, where, true ); }, + + // sends delete-what and id# + ajaxDelete: function( what, id ) { + var ajaxDel = new WPAjax( this.ajaxHandler, this.ajaxRespEl ); + if( ajaxDel.notInitialized() ) + return true; + var tempObj = this; + var action = 'delete-' + what; + var actionId = action + '&id=' + id; + var idName = what.replace('-as-spam','') + '-' + id; + ajaxDel.addOnComplete( function(transport) { + Element.update(ajaxDel.myResponseElement,''); + tempObj.destore(actionId); + if( tempObj.delComplete && typeof tempObj.delComplete == 'function' ) + tempObj.delComplete( what, id, transport ); + }); + ajaxDel.addOnWPError( function(transport) { tempObj.restore(actionId, true); }); + ajaxDel.options.parameters = $H(ajaxDel.options.parameters).merge({action: action, id: id}).merge(this.inputData.toQueryParams()); + ajaxDel.request(ajaxDel.url); + this.store(actionId, idName); + tempObj.removeListItem( idName ); + return false; + }, + + // Toggles class nomes + // sends dim-what and id# + ajaxDimmer: function( what, id, dimClass ) { + ajaxDim = new WPAjax( this.ajaxHandler, this.ajaxRespEl ); + if ( ajaxDim.notInitialized() ) + return true; + var tempObj = this; + var action = 'dim-' + what; + var actionId = action + '&id=' + id; + var idName = what + '-' + id; + ajaxDim.addOnComplete( function(transport) { + Element.update(ajaxDim.myResponseElement,''); + tempObj.destore(actionId); + if ( tempObj.dimComplete && typeof tempObj.dimComplete == 'function' ) + tempObj.dimComplete( what, id, dimClass, transport ); + }); + ajaxDim.addOnWPError( function(transport) { tempObj.restore(actionId, true); }); + ajaxDim.options.parameters = $H(ajaxDim.options.parameters).merge({action: action, id: id}).merge(this.inputData.toQueryParams()); + ajaxDim.request(ajaxDim.url); + this.store(actionId, idName); + this.dimItem( idName, dimClass ); + return false; + }, + + addListItem: function( h ) { + new Insertion[this.topAdder ? 'Top' : 'Bottom'](this.theList,h); + Element.cleanWhitespace(this.theList); + var id = this.topAdder ? this.theList.firstChild.id : this.theList.lastChild.id; + if ( this.alt ) + if ( ( this.theList.childNodes.length + this.altOffset ) % 2 ) + Element.addClassName($(id),this.alt); + Fat.fade_element(id); + }, + + // only hides the element sa it can be put back again if necessary + removeListItem: function( id, noFade ) { + id = $(id); + if ( !noFade ) { + Fat.fade_element(id.id,null,700,'#FF3333'); + var tempObj = this; + var func = function() { id.hide(); tempObj.recolorList(); } + setTimeout(func, 705); + } else { + id.hide(); + this.recolorList(); + } + }, + + replaceListItem: function( id, h, update ) { + id = $(id); + if ( !update ) { + Element.remove(id); + this.addListItem( h ); + return; + } + id.replace(h); + Fat.fade_element(id.id); + }, + + // toggles class + dimItem: function( id, dimClass, noFade ) { + id = $(id); + if ( Element.hasClassName(id,dimClass) ) { + if ( !noFade ) + Fat.fade_element(id.id,null,700,null); + Element.removeClassName(id,dimClass); + } else { + if ( !noFade ) + Fat.fade_element(id.id,null,700,'#FF3333'); + Element.addClassName(id,dimClass); + } + }, + + // store an element in case we need it later + store: function(action, id) { + if ( !this.dataStore ) + this.dataStore = $H(); + this.dataStore[action] = $(id).cloneNode(true); + }, + + // delete from store + destore: function(action) { delete(this.dataStore[action]); }, + + // restore element from store into existing (possibly hidden) element of same id + restore: function(action, error) { + var id = this.dataStore[action].id; + this.theList.replaceChild(this.dataStore[action], $(id)); + delete(this.dataStore[action]); + if ( error ) { + func = function() { Element.setStyle($(id),{backgroundColor:'#FF3333'}); } + func(); setTimeout(func, 705); // Hit it twice in case it's still fading. + } + }, + + // Like Form.serialize, but excludes action and sets up clearInputs + grabInputs: function( where, ajaxObj ) { + if ( ajaxObj ) + ajaxObj.restoreInputs = []; + var elements = Form.getElements($(where)); + var queryComponents = new Array(); + for (var i = 0; i < elements.length; i++) { + if ( 'action' == elements[i].name ) + continue; + if ( 'hidden' != elements[i].type && 'submit' != elements[i].type && 'button' != elements[i].type ) { + this.clearInputs.push(elements[i]); + if ( ajaxObj ) + ajaxObj.restoreInputs.push([elements[i], elements[i].value]); + } + var queryComponent = Form.Element.serialize(elements[i]); + if (queryComponent) { + queryComponents.push(queryComponent); + } + } + return queryComponents.join('&'); + }, + + // form.reset() can only do whole forms. This can do subsections. + clear: function() { + this.clearInputs.each( function(i) { + i = $(i); + if ( 'textarea' == i.tagName.toLowerCase() ) + i.value = ''; + else + switch ( i.type.toLowerCase() ) { + case 'password': case 'text': + i.value = ''; + break; + case 'checkbox': case 'radio': + i.checked = false; + break; + case 'select': case 'select-one': + i.selectedIndex = null; + break; + case 'select-multiple': + for (var o = 0; o < i.length; o++) i.options[o].selected = false; + break; + } + }); + this.clearInputs = []; + }, + + restoreForm: function(elements) { + elements.each( function(i) { + i[0].value = i[1]; + }); + }, + + recolorList: function() { + if ( !this.alt ) + return; + var alt = this.alt; + var offset = this.altOffset; + var listItems = $A(this.theList.childNodes).findAll( function(i) { return Element.visible(i) } ); + listItems.each( function(i,n) { + if ( ( n + offset ) % 2 ) + Element.removeClassName(i,alt); + else + Element.addClassName(i,alt); + }); + } +}); + +//No submit unless code returns true. +function killSubmit ( code, e ) { + e = e ? e : window.event; + if ( !e ) return; + var t = e.target ? e.target : e.srcElement; + if ( ( 'text' == t.type && e.keyCode == 13 ) || ( 'submit' == t.type && 'click' == e.type ) ) { + if ( ( 'string' == typeof code && !eval(code) ) || ( 'function' == typeof code && !code() ) ) { + e.returnValue = false; e.cancelBubble = true; return false; + } + } +} +//Generic but lame JS closure +function encloseFunc(f){var a=arguments[1];return function(){return f(a);}} diff --git a/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyGoogleSpell.class.php b/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyGoogleSpell.class.php index 971da10..cf3d800 100755 --- a/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyGoogleSpell.class.php +++ b/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyGoogleSpell.class.php @@ -1,12 +1,10 @@ <?php
-/* *
+/* *
* Tiny Spelling Interface for TinyMCE Spell Checking.
*
* Copyright © 2006 Moxiecode Systems AB
*/
-require_once("HttpClient.class.php");
-
class TinyGoogleSpell {
var $lang;
@@ -22,11 +20,21 @@ class TinyGoogleSpell { $matches = $this->_getMatches($wordstr);
for ($i=0; $i<count($matches); $i++)
- $words[] = substr($wordstr, $matches[$i][1], $matches[$i][2]);
+ $words[] = $this->unhtmlentities(mb_substr($wordstr, $matches[$i][1], $matches[$i][2], "UTF-8"));
return $words;
}
+ function unhtmlentities($string) {
+ $string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string);
+ $string = preg_replace('~&#([0-9]+);~e', 'chr(\\1)', $string);
+
+ $trans_tbl = get_html_translation_table(HTML_ENTITIES);
+ $trans_tbl = array_flip($trans_tbl);
+
+ return strtr($string, $trans_tbl);
+ }
+
// Returns array with suggestions or false if failed.
function getSuggestion($word) {
$sug = array();
@@ -34,37 +42,78 @@ class TinyGoogleSpell { $matches = $this->_getMatches($word);
if (count($matches) > 0)
- $sug = explode("\t", $matches[0][4]);
+ $sug = explode("\t", utf8_encode($this->unhtmlentities($matches[0][4])));
return $sug;
}
- function _getMatches($word_list) {
- $xml = "";
+ function _xmlChars($string) {
+ $trans = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES);
+
+ foreach ($trans as $k => $v)
+ $trans[$k] = "&#".ord($k).";";
- // Setup HTTP Client
- $client = new HttpClient('www.google.com');
- $client->setUserAgent('Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR');
- $client->setHandleRedirects(false);
- $client->setDebug(false);
+ return strtr($string, $trans);
+ }
+
+ function _getMatches($word_list) {
+ $server = "www.google.com";
+ $port = 443;
+ $path = "/tbproxy/spell?lang=" . $this->lang . "&hl=en";
+ $host = "www.google.com";
+ $url = "https://" . $server;
// Setup XML request
- $xml .= '<?xml version="1.0" encoding="utf-8" ?>';
- $xml .= '<spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="1" ignoreallcaps="1">';
- $xml .= '<text>' . htmlentities($word_list) . '</text></spellrequest>';
-
- // Execute HTTP Post to Google
- if (!$client->post('/tbproxy/spell?lang=' . $this->lang, $xml)) {
- $this->errorMsg[] = 'An error occurred: ' . $client->getError();
- return array();
+ $xml = '<?xml version="1.0" encoding="utf-8" ?><spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="1" ignoreallcaps="1"><text>' . $word_list . '</text></spellrequest>';
+
+ $header = "POST ".$path." HTTP/1.0 \r\n";
+ $header .= "MIME-Version: 1.0 \r\n";
+ $header .= "Content-type: application/PTI26 \r\n";
+ $header .= "Content-length: ".strlen($xml)." \r\n";
+ $header .= "Content-transfer-encoding: text \r\n";
+ $header .= "Request-number: 1 \r\n";
+ $header .= "Document-type: Request \r\n";
+ $header .= "Interface-Version: Test 1.4 \r\n";
+ $header .= "Connection: close \r\n\r\n";
+ $header .= $xml;
+ //$this->_debugData($xml);
+
+ // Use raw sockets
+ $fp = fsockopen("ssl://" . $server, $port, $errno, $errstr, 30);
+ if ($fp) {
+ // Send request
+ fwrite($fp, $header);
+
+ // Read response
+ $xml = "";
+ while (!feof($fp))
+ $xml .= fgets($fp, 128);
+
+ fclose($fp);
+ } else {
+ // Use curl
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_URL,$url);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header);
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
+ $xml = curl_exec($ch);
+ curl_close($ch);
}
+ //$this->_debugData($xml);
+
// Grab and parse content
- $xml = $client->getContent();
preg_match_all('/<c o="([^"]*)" l="([^"]*)" s="([^"]*)">([^<]*)<\/c>/', $xml, $matches, PREG_SET_ORDER);
return $matches;
}
+
+ function _debugData($data) {
+ $fh = @fopen("debug.log", 'a+');
+ @fwrite($fh, $data);
+ @fclose($fh);
+ }
}
// Setup classname, should be the same as the name of the spellchecker class
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspellShell.class.php b/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspellShell.class.php index 81e3f15..5723d2f 100755 --- a/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspellShell.class.php +++ b/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspellShell.class.php @@ -6,6 +6,7 @@ *
*/
+
class TinyPspellShell {
var $lang;
var $mode;
@@ -27,7 +28,11 @@ class TinyPspellShell { $this->errorMsg = array();
$this->tmpfile = tempnam($config['tinypspellshell.tmp'], "tinyspell");
- $this->cmd = "cat ". $this->tmpfile ." | " . $config['tinypspellshell.aspell'] . " -a --lang=". $this->lang;
+
+ if(preg_match("#win#i",php_uname()))
+ $this->cmd = $config['tinypspellshell.aspell'] . " -a --lang=". $this->lang." --encoding=utf-8 -H < $this->tmpfile 2>&1";
+ else
+ $this->cmd = "cat ". $this->tmpfile ." | " . $config['tinypspellshell.aspell'] . " -a --encoding=utf-8 -H --lang=". $this->lang;
}
// Returns array with bad words or false if failed.
@@ -36,7 +41,6 @@ class TinyPspellShell { fwrite($fh, "!\n");
foreach($wordArray as $key => $value)
fwrite($fh, "^" . $value . "\n");
-
fclose($fh);
} else {
$this->errorMsg[] = "PSpell not found.";
@@ -44,7 +48,8 @@ class TinyPspellShell { }
$data = shell_exec($this->cmd);
- @unlink($this->tmpfile);
+ @unlink($this->tmpfile);
+
$returnData = array();
$dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY);
@@ -66,15 +71,22 @@ class TinyPspellShell { // Returns array with suggestions or false if failed.
function getSuggestion($word) {
+ if (function_exists("mb_convert_encoding"))
+ $word = mb_convert_encoding($word, "ISO-8859-1", mb_detect_encoding($word, "UTF-8"));
+ else
+ $word = utf8_encode($word);
+
if ($fh = fopen($this->tmpfile, "w")) {
fwrite($fh, "!\n");
fwrite($fh, "^$word\n");
fclose($fh);
} else
- wp_die("Error opening tmp file.");
+ die("Error opening tmp file.");
$data = shell_exec($this->cmd);
- @unlink($this->tmpfile);
+
+ @unlink($this->tmpfile);
+
$returnData = array();
$dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY);
@@ -94,6 +106,13 @@ class TinyPspellShell { }
return $returnData;
}
+
+ function _debugData($data) {
+ $fh = @fopen("debug.log", 'a+');
+ @fwrite($fh, $data);
+ @fclose($fh);
+ }
+
}
// Setup classname, should be the same as the name of the spellchecker class
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/config.php b/wp-includes/js/tinymce/plugins/spellchecker/config.php index 2bfc9ec..f008d11 100755 --- a/wp-includes/js/tinymce/plugins/spellchecker/config.php +++ b/wp-includes/js/tinymce/plugins/spellchecker/config.php @@ -1,13 +1,14 @@ <?php
$spellCheckerConfig = array();
+ // Spellchecker class use
+ // require_once("classes/TinyPspellShell.class.php"); // Command line pspell
+ require_once("classes/TinyGoogleSpell.class.php"); // Google web service
+ // require_once("classes/TinyPspell.class.php"); // Internal PHP version
+
// General settings
$spellCheckerConfig['enabled'] = true;
- // Pspell shell specific settings
- $spellCheckerConfig['tinypspellshell.aspell'] = '/usr/bin/aspell';
- $spellCheckerConfig['tinypspellshell.tmp'] = '/tmp/tinyspell/0';
-
// Default settings
$spellCheckerConfig['default.language'] = 'en';
$spellCheckerConfig['default.mode'] = PSPELL_FAST;
@@ -17,13 +18,7 @@ $spellCheckerConfig['default.jargon'] = "";
$spellCheckerConfig['default.encoding'] = "";
- // Spellchecker class use
- if ( function_exists('pspell_new') )
- require_once("classes/TinyPspell.class.php"); // Internal PHP version
-
- elseif ( file_exists($spellCheckerConfig['tinypspellshell.aspell']) )
- require_once("classes/TinyPspellShell.class.php"); // Command line pspell
-
- else
- require_once("classes/TinyGoogleSpell.class.php"); // Google web service
+ // Pspell shell specific settings
+ $spellCheckerConfig['tinypspellshell.aspell'] = '/usr/bin/aspell';
+ $spellCheckerConfig['tinypspellshell.tmp'] = '/tmp';
?>
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/css/content.css b/wp-includes/js/tinymce/plugins/spellchecker/css/content.css index fb82733..c56a453 100755 --- a/wp-includes/js/tinymce/plugins/spellchecker/css/content.css +++ b/wp-includes/js/tinymce/plugins/spellchecker/css/content.css @@ -1,5 +1,4 @@ .mceItemHiddenSpellWord {
background: url('../images/wline.gif') repeat-x bottom left;
- bo2rder-bottom: 1px dashed red;
cursor: default;
}
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/css/spellchecker.css b/wp-includes/js/tinymce/plugins/spellchecker/css/spellchecker.css index aa4a8ea..f2c6ac7 100755 --- a/wp-includes/js/tinymce/plugins/spellchecker/css/spellchecker.css +++ b/wp-includes/js/tinymce/plugins/spellchecker/css/spellchecker.css @@ -31,4 +31,5 @@ font-family: Arial, Verdana, Tahoma, Helvetica;
font-weight: bold;
font-size: 11px;
+ background-color: #FFF;
}
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/editor_plugin.js b/wp-includes/js/tinymce/plugins/spellchecker/editor_plugin.js index ab3fc6b..7760175 100755 --- a/wp-includes/js/tinymce/plugins/spellchecker/editor_plugin.js +++ b/wp-includes/js/tinymce/plugins/spellchecker/editor_plugin.js @@ -1,573 +1 @@ -/**
- * $RCSfile: editor_plugin_src.js,v $
- * $Revision: 1.4 $
- * $Date: 2006/03/24 17:24:50 $
- *
- * @author Moxiecode
- * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
- */
-
-tinyMCE.importPluginLanguagePack('spellchecker', 'en,sv,nn,nb');
-
-// Plucin static class
-var TinyMCE_SpellCheckerPlugin = {
- _contextMenu : new TinyMCE_Menu(),
- _menu : new TinyMCE_Menu(),
- _counter : 0,
-
- getInfo : function() {
- return {
- longname : 'Spellchecker',
- author : 'Moxiecode Systems AB',
- authorurl : 'http://tinymce.moxiecode.com',
- infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_spellchecker.html',
- version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
- };
- },
-
- handleEvent : function(e) {
- var elm = tinyMCE.isMSIE ? e.srcElement : e.target;
- var inst = tinyMCE.selectedInstance, args = '';
- var self = TinyMCE_SpellCheckerPlugin;
- var cm = self._contextMenu;
- var p, p2, x, y, sx, sy, h, elm;
-
- // Handle click on word
- if ((e.type == "click" || e.type == "contextmenu") && elm) {
- do {
- if (tinyMCE.getAttrib(elm, 'class') == "mceItemHiddenSpellWord") {
- inst.spellCheckerElm = elm;
-
- // Setup arguments
- args += 'id=' + inst.editorId + "|" + (++self._counter);
- args += '&cmd=suggest&check=' + escape(elm.innerHTML);
- args += '&lang=' + escape(inst.spellCheckerLang);
-
- elm = inst.spellCheckerElm;
- p = tinyMCE.getAbsPosition(inst.iframeElement);
- p2 = tinyMCE.getAbsPosition(elm);
- h = parseInt(elm.offsetHeight);
- sx = inst.getBody().scrollLeft;
- sy = inst.getBody().scrollTop;
- x = p.absLeft + p2.absLeft - sx;
- y = p.absTop + p2.absTop - sy + h;
-
- cm.clear();
- cm.addTitle(tinyMCE.getLang('lang_spellchecker_wait', '', true));
- cm.show();
- cm.moveTo(x, y);
-
- inst.selection.selectNode(elm, false, false);
-
- self._sendAjax(self.baseURL + "/tinyspell.php", self._ajaxResponse, 'post', args);
-
- tinyMCE.cancelEvent(e);
- return false;
- }
- } while ((elm = elm.parentNode));
- }
-
- return true;
- },
-
- initInstance : function(inst) {
- var self = TinyMCE_SpellCheckerPlugin, m = self._menu, cm = self._contextMenu, e;
-
- tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/plugins/spellchecker/css/content.css");
-
- if (!tinyMCE.hasMenu('spellcheckercontextmenu')) {
- tinyMCE.importCSS(document, tinyMCE.baseURL + "/plugins/spellchecker/css/spellchecker.css");
-
- cm.init({drop_menu : false});
- tinyMCE.addMenu('spellcheckercontextmenu', cm);
- }
-
- if (!tinyMCE.hasMenu('spellcheckermenu')) {
- m.init({});
- tinyMCE.addMenu('spellcheckermenu', m);
- }
-
- inst.spellCheckerLang = 'en';
- self._buildSettingsMenu(inst, null);
-
- e = self._getBlockBoxLayer(inst).create('div', 'mceBlockBox', document.getElementById(inst.editorId + '_parent'));
- self._getMsgBoxLayer(inst).create('div', 'mceMsgBox', document.getElementById(inst.editorId + '_parent'));
- },
-
- _getMsgBoxLayer : function(inst) {
- if (!inst.spellCheckerMsgBoxL)
- inst.spellCheckerMsgBoxL = new TinyMCE_Layer(inst.editorId + '_spellcheckerMsgBox', false);
-
- return inst.spellCheckerMsgBoxL;
- },
-
- _getBlockBoxLayer : function(inst) {
- if (!inst.spellCheckerBoxL)
- inst.spellCheckerBoxL = new TinyMCE_Layer(inst.editorId + '_spellcheckerBlockBox', false);
-
- return inst.spellCheckerBoxL;
- },
-
- _buildSettingsMenu : function(inst, lang) {
- var i, ar = tinyMCE.getParam('spellchecker_languages', '+English=en').split(','), p;
- var self = TinyMCE_SpellCheckerPlugin, m = self._menu, c;
-
- m.clear();
- m.addTitle(tinyMCE.getLang('lang_spellchecker_langs', '', true));
-
- for (i=0; i<ar.length; i++) {
- if (ar[i] != '') {
- p = ar[i].split('=');
- c = 'mceMenuCheckItem';
-
- if (p[0].charAt(0) == '+') {
- p[0] = p[0].substring(1);
-
- if (lang == null) {
- c = 'mceMenuSelectedItem';
- inst.spellCheckerLang = p[1];
- }
- }
-
- if (lang == p[1])
- c = 'mceMenuSelectedItem';
-
- m.add({text : p[0], js : "tinyMCE.execInstanceCommand('" + inst.editorId + "','mceSpellCheckerSetLang',false,'" + p[1] + "');", class_name : c});
- }
- }
- },
-
- setupContent : function(editor_id, body, doc) {
- TinyMCE_SpellCheckerPlugin._removeWords(doc);
- },
-
- getControlHTML : function(cn) {
- switch (cn) {
- case "spellchecker":
- return TinyMCE_SpellCheckerPlugin._getMenuButtonHTML(cn, 'lang_spellchecker_desc', '{$pluginurl}/images/spellchecker.gif', 'lang_spellchecker_desc', 'mceSpellCheckerMenu', 'mceSpellCheck');
- }
-
- return "";
- },
-
- /**
- * Returns the HTML code for a normal button control.
- *
- * @param {string} id Button control id, this will be the suffix for the element id, the prefix is the editor id.
- * @param {string} lang Language variable key name to insert as the title/alt of the button image.
- * @param {string} img Image URL to insert, {$themeurl} and {$pluginurl} will be replaced.
- * @param {string} mlang Language variable key name to insert as the title/alt of the menu button image.
- * @param {string} mid Menu by id to display when the menu button is pressed.
- * @param {string} cmd Command to execute when the user clicks the button.
- * @param {string} ui Optional user interface boolean for command.
- * @param {string} val Optional value for command.
- * @return HTML code for a normal button based in input information.
- * @type string
- */
- _getMenuButtonHTML : function(id, lang, img, mlang, mid, cmd, ui, val) {
- var h = '', m, x;
-
- cmd = 'tinyMCE.hideMenus();tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + cmd + '\'';
-
- if (typeof(ui) != "undefined" && ui != null)
- cmd += ',' + ui;
-
- if (typeof(val) != "undefined" && val != null)
- cmd += ",'" + val + "'";
-
- cmd += ');';
-
- // Use tilemaps when enabled and found and never in MSIE since it loads the tile each time from cache if cahce is disabled
- if (tinyMCE.getParam('button_tile_map') && (!tinyMCE.isMSIE || tinyMCE.isOpera) && (m = tinyMCE.buttonMap[id]) != null && (tinyMCE.getParam("language") == "en" || img.indexOf('$lang') == -1)) {
- // Tiled button
- x = 0 - (m * 20) == 0 ? '0' : 0 - (m * 20);
- h += '<a id="{$editor_id}_' + id + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" class="mceTiledButton mceButtonNormal" target="_self">';
- h += '<img src="{$themeurl}/images/spacer.gif" style="background-position: ' + x + 'px 0" title="{$' + lang + '}" />';
- h += '<img src="{$themeurl}/images/button_menu.gif" title="{$' + lang + '}" class="mceMenuButton" onclick="' + mcmd + 'return false;" />';
- h += '</a>';
- } else {
- if (tinyMCE.isMSIE && !tinyMCE.isOpera)
- h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton" onmouseover="tinyMCE.plugins.spellchecker._menuButtonEvent(\'over\',this);" onmouseout="tinyMCE.plugins.spellchecker._menuButtonEvent(\'out\',this);">';
- else
- h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton">';
-
- h += '<a href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" class="mceMenuButtonNormal" target="_self">';
- h += '<img src="' + img + '" title="{$' + lang + '}" /></a>';
- h += '<a href="#" onclick="tinyMCE.plugins.spellchecker._toggleMenu(\'{$editor_id}\',\'' + mid + '\');return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$' + lang + '}" class="mceMenuButton" />';
- h += '</a></span>';
- }
-
- return h;
- },
-
- _menuButtonEvent : function(e, o) {
- if (o.className == 'mceMenuButtonFocus')
- return;
-
- if (e == 'over')
- o.className = o.className + ' mceMenuHover';
- else
- o.className = o.className.replace(/\s.*$/, '');
- },
-
- _toggleMenu : function(editor_id, id) {
- var self = TinyMCE_SpellCheckerPlugin;
- var e = document.getElementById(editor_id + '_spellchecker');
- var inst = tinyMCE.getInstanceById(editor_id);
-
- if (self._menu.isVisible()) {
- tinyMCE.hideMenus();
- return;
- }
-
- tinyMCE.lastMenuBtnClass = e.className.replace(/\s.*$/, '');
- tinyMCE.switchClass(editor_id + '_spellchecker', 'mceMenuButtonFocus');
-
- self._menu.moveRelativeTo(e, 'bl');
- self._menu.moveBy(tinyMCE.isMSIE && !tinyMCE.isOpera ? 0 : 1, -1);
-
- if (tinyMCE.isOpera)
- self._menu.moveBy(0, -2);
-
- self._onMenuEvent(inst, self._menu, 'show');
-
- self._menu.show();
-
- tinyMCE.lastSelectedMenuBtn = editor_id + '_spellchecker';
- },
-
- _onMenuEvent : function(inst, m, n) {
- TinyMCE_SpellCheckerPlugin._buildSettingsMenu(inst, inst.spellCheckerLang);
- },
-
- execCommand : function(editor_id, element, command, user_interface, value) {
- var inst = tinyMCE.getInstanceById(editor_id), self = TinyMCE_SpellCheckerPlugin, args = '', co, bb, mb, nl, i, e;
-
- // Handle commands
- switch (command) {
- case "mceSpellCheck":
- if (!inst.spellcheckerOn) {
- inst.spellCheckerBookmark = inst.selection.getBookmark();
-
- // Setup arguments
- args += 'id=' + inst.editorId + "|" + (++self._counter);
- args += '&cmd=spell&check=' + escape(self._getWordList(inst.getBody())).replace(/%20/g, '+');
- args += '&lang=' + escape(inst.spellCheckerLang);
-
- co = document.getElementById(inst.editorId + '_parent').firstChild;
- bb = self._getBlockBoxLayer(inst);
- bb.moveRelativeTo(co, 'tl');
- bb.resizeTo(co.offsetWidth, co.offsetHeight);
- bb.show();
-
- // Setup message box
- mb = self._getMsgBoxLayer(inst);
- e = mb.getElement();
- e.innerHTML = '<span>' + tinyMCE.getLang('lang_spellchecker_swait', '', true) + '</span>';
- mb.show();
- mb.moveRelativeTo(co, 'cc');
-
- if (tinyMCE.isMSIE && !tinyMCE.isOpera) {
- nl = co.getElementsByTagName('select');
- for (i=0; i<nl.length; i++)
- nl[i].disabled = true;
- }
-
- inst.spellcheckerOn = true;
- tinyMCE.switchClass(editor_id + '_spellchecker', 'mceMenuButtonSelected');
-
- self._sendAjax(self.baseURL + "/tinyspell.php", self._ajaxResponse, 'post', args);
- } else {
- self._removeWords(inst.getDoc());
- inst.spellcheckerOn = false;
- tinyMCE.switchClass(editor_id + '_spellchecker', 'mceMenuButton');
- }
-
- return true;
-
- case "mceSpellCheckReplace":
- if (inst.spellCheckerElm)
- tinyMCE.setOuterHTML(inst.spellCheckerElm, value);
-
- self._checkDone(inst);
- self._contextMenu.hide();
- self._menu.hide();
-
- return true;
-
- case "mceSpellCheckIgnore":
- if (inst.spellCheckerElm)
- self._removeWord(inst.spellCheckerElm);
-
- self._checkDone(inst);
- self._contextMenu.hide();
- self._menu.hide();
- return true;
-
- case "mceSpellCheckIgnoreAll":
- if (inst.spellCheckerElm)
- self._removeWords(inst.getDoc(), inst.spellCheckerElm.innerHTML);
-
- self._checkDone(inst);
- self._contextMenu.hide();
- self._menu.hide();
- return true;
-
- case "mceSpellCheckerSetLang":
- tinyMCE.hideMenus();
- inst.spellCheckerLang = value;
- self._removeWords(inst.getDoc());
- inst.spellcheckerOn = false;
- tinyMCE.switchClass(editor_id + '_spellchecker', 'mceMenuButton');
- return true;
- }
-
- // Pass to next handler in chain
- return false;
- },
-
- cleanup : function(type, content, inst) {
- switch (type) {
- case "get_from_editor_dom":
- TinyMCE_SpellCheckerPlugin._removeWords(content);
- inst.spellcheckerOn = false;
- break;
- }
-
- return content;
- },
-
- // Private plugin specific methods
-
- _displayUI : function(inst) {
- var self = TinyMCE_SpellCheckerPlugin;
- var bb = self._getBlockBoxLayer(inst);
- var mb = self._getMsgBoxLayer(inst);
- var nl, i;
- var co = document.getElementById(inst.editorId + '_parent').firstChild;
-
- if (tinyMCE.isMSIE && !tinyMCE.isOpera) {
- nl = co.getElementsByTagName('select');
- for (i=0; i<nl.length; i++)
- nl[i].disabled = false;
- }
-
- bb.hide();
- mb.hide();
- },
-
- _ajaxResponse : function(xml) {
- var el = xml ? xml.documentElement : null;
- var inst = tinyMCE.selectedInstance, self = TinyMCE_SpellCheckerPlugin;
- var cmd = el ? el.getAttribute("cmd") : null, err, id = el ? el.getAttribute("id") : null;
-
- if (id)
- inst = tinyMCE.getInstanceById(id.substring(0, id.indexOf('|')));
-
- self._displayUI(inst);
-
- // Ignore suggestions for other ajax responses
- if (cmd == "suggest" && id != inst.editorId + "|" + self._counter)
- return;
-
- if (!el) {
- inst.spellcheckerOn = false;
- tinyMCE.switchClass(inst.editorId + '_spellchecker', 'mceMenuButton');
- alert("Could not execute AJAX call, server didn't return valid a XML.");
- return;
- }
-
- err = el.getAttribute("error");
-
- if (err == "true") {
- inst.spellcheckerOn = false;
- tinyMCE.switchClass(inst.editorId + '_spellchecker', 'mceMenuButton');
- alert(el.getAttribute("msg"));
- return;
- }
-
- switch (cmd) {
- case "spell":
- if (xml.documentElement.firstChild) {
- self._markWords(inst.getDoc(), inst.getBody(), el.firstChild.nodeValue.split(' '));
- inst.selection.moveToBookmark(inst.spellCheckerBookmark);
- } else
- alert(tinyMCE.getLang('lang_spellchecker_no_mpell', '', true));
-
- self._checkDone(inst);
-
- break;
-
- case "suggest":
- self._buildMenu(el.firstChild ? el.firstChild.nodeValue.split(' ') : null, 10);
- self._contextMenu.show();
- break;
- }
- },
-
- _getWordSeparators : function() {
- var i, re = '', ch = tinyMCE.getParam('spellchecker_word_separator_chars', '\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}§©«®±¶·¸»¼½¾¿×÷¤\u201d\u201c');
-
- for (i=0; i<ch.length; i++)
- re += '\\' + ch.charAt(i);
-
- return re;
- },
-
- _getWordList : function(n) {
- var i, x, s, nv = '', nl = tinyMCE.getNodeTree(n, new Array(), 3), wl = new Array();
- var re = TinyMCE_SpellCheckerPlugin._getWordSeparators();
-
- for (i=0; i<nl.length; i++)
- nv += nl[i].nodeValue + " ";
-
- nv = nv.replace(new RegExp('([0-9]|[' + re + '])', 'g'), ' ');
- nv = tinyMCE.trim(nv.replace(/(\s+)/g, ' '));
-
- nl = nv.split(/\s+/);
- for (i=0; i<nl.length; i++) {
- s = false;
- for (x=0; x<wl.length; x++) {
- if (wl[x] == nl[i]) {
- s = true;
- break;
- }
- }
-
- if (!s)
- wl[wl.length] = nl[i];
- }
-
- return wl.join(' ');
- },
-
- _removeWords : function(doc, word) {
- var i, c, nl = doc.getElementsByTagName("span");
- var self = TinyMCE_SpellCheckerPlugin;
- var inst = tinyMCE.selectedInstance, b = inst ? inst.selection.getBookmark() : null;
-
- word = typeof(word) == 'undefined' ? null : word;
-
- for (i=nl.length-1; i>=0; i--) {
- c = tinyMCE.getAttrib(nl[i], 'class');
-
- if ((c == 'mceItemHiddenSpellWord' || c == 'mceItemHidden') && (word == null || nl[i].innerHTML == word))
- self._removeWord(nl[i]);
- }
-
- if (b)
- inst.selection.moveToBookmark(b);
- },
-
- _checkDone : function(inst) {
- var i, w = 0, nl = inst.getDoc().getElementsByTagName("span")
- var self = TinyMCE_SpellCheckerPlugin;
-
- for (i=nl.length-1; i>=0; i--) {
- c = tinyMCE.getAttrib(nl[i], 'class');
-
- if (c == 'mceItemHiddenSpellWord')
- w++;
- }
-
- if (w == 0) {
- self._removeWords(inst.getDoc());
- inst.spellcheckerOn = false;
- tinyMCE.switchClass(inst.editorId + '_spellchecker', 'mceMenuButton');
- }
- },
-
- _removeWord : function(e) {
- tinyMCE.setOuterHTML(e, e.innerHTML);
- },
-
- _markWords : function(doc, n, wl) {
- var i, nv, nn, nl = tinyMCE.getNodeTree(n, new Array(), 3);
- var r1, r2, r3, r4, r5, w = '';
- var re = TinyMCE_SpellCheckerPlugin._getWordSeparators();
-
- for (i=0; i<wl.length; i++)
- w += wl[i] + ((i == wl.length-1) ? '' : '|');
-
- r1 = new RegExp('([' + re + '])(' + w + ')([' + re + '])', 'g');
- r2 = new RegExp('^(' + w + ')', 'g');
- r3 = new RegExp('(' + w + ')([' + re + ']?)$', 'g');
- r4 = new RegExp('^(' + w + ')([' + re + ']?)$', 'g');
- r5 = new RegExp('(' + w + ')([' + re + '])', 'g');
-
- for (i=0; i<nl.length; i++) {
- nv = nl[i].nodeValue;
- if (r1.test(nv) || r2.test(nv) || r3.test(nv) || r4.test(nv)) {
- nv = tinyMCE.xmlEncode(nv);
- nv = nv.replace(r5, '<span class="mceItemHiddenSpellWord">$1</span>$2');
- nv = nv.replace(r3, '<span class="mceItemHiddenSpellWord">$1</span>$2');
-
- nn = doc.createElement('span');
- nn.className = "mceItemHidden";
- nn.innerHTML = nv;
-
- // Remove old text node
- nl[i].parentNode.replaceChild(nn, nl[i]);
- }
- }
- },
-
- _buildMenu : function(sg, max) {
- var i, self = TinyMCE_SpellCheckerPlugin, cm = self._contextMenu;
-
- cm.clear();
-
- if (sg != null) {
- cm.addTitle(tinyMCE.getLang('lang_spellchecker_sug', '', true));
-
- for (i=0; i<sg.length && i<max; i++)
- cm.addItem(sg[i], 'tinyMCE.execCommand("mceSpellCheckReplace",false,"' + sg[i] + '");');
-
- cm.addSeparator();
- cm.addItem(tinyMCE.getLang('lang_spellchecker_ignore_word', '', true), 'tinyMCE.execCommand(\'mceSpellCheckIgnore\');');
- cm.addItem(tinyMCE.getLang('lang_spellchecker_ignore_words', '', true), 'tinyMCE.execCommand(\'mceSpellCheckIgnoreAll\');');
- } else
- cm.addTitle(tinyMCE.getLang('lang_spellchecker_no_sug', '', true));
-
- cm.update();
- },
-
- _getAjaxHTTP : function() {
- try {
- return new ActiveXObject('Msxml2.XMLHTTP')
- } catch (e) {
- try {
- return new ActiveXObject('Microsoft.XMLHTTP')
- } catch (e) {
- return new XMLHttpRequest();
- }
- }
- },
-
- /**
- * Perform AJAX call.
- *
- * @param {string} u URL of AJAX service.
- * @param {function} f Function to call when response arrives.
- * @param {string} m Request method post or get.
- * @param {Array} a Array with arguments to send.
- */
- _sendAjax : function(u, f, m, a) {
- var x = TinyMCE_SpellCheckerPlugin._getAjaxHTTP();
-
- x.open(m, u, true);
-
- x.onreadystatechange = function() {
- if (x.readyState == 4)
- f(x.responseXML);
- };
-
- if (m == 'post')
- x.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
-
- x.send(a);
- }
-};
-
-// Register plugin
-tinyMCE.addPlugin('spellchecker', TinyMCE_SpellCheckerPlugin);
+tinyMCE.importPluginLanguagePack('spellchecker','en,fr,sv,nn,nb');var TinyMCE_SpellCheckerPlugin={_contextMenu:new TinyMCE_Menu(),_menu:new TinyMCE_Menu(),_counter:0,_ajaxPage:'/tinyspell.php',getInfo:function(){return{longname:'Spellchecker PHP',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_spellchecker.html',version:"1.0.3"};},handleEvent:function(e){var elm=tinyMCE.isMSIE?e.srcElement:e.target;var inst=tinyMCE.selectedInstance,args='';var self=TinyMCE_SpellCheckerPlugin;var cm=self._contextMenu;var p,p2,x,y,sx,sy,h,elm;if((e.type=="click"||e.type=="contextmenu")&&elm){do{if(tinyMCE.getAttrib(elm,'class')=="mceItemHiddenSpellWord"){inst.spellCheckerElm=elm;args+='id='+inst.editorId+"|"+(++self._counter);args+='&cmd=suggest&check='+encodeURIComponent(elm.innerHTML);args+='&lang='+escape(inst.spellCheckerLang);elm=inst.spellCheckerElm;p=tinyMCE.getAbsPosition(inst.iframeElement);p2=tinyMCE.getAbsPosition(elm);h=parseInt(elm.offsetHeight);sx=inst.getBody().scrollLeft;sy=inst.getBody().scrollTop;x=p.absLeft+p2.absLeft-sx;y=p.absTop+p2.absTop-sy+h;cm.clear();cm.addTitle(tinyMCE.getLang('lang_spellchecker_wait','',true));cm.show();cm.moveTo(x,y);inst.selection.selectNode(elm,false,false);self._sendAjax(self.baseURL+self._ajaxPage,self._ajaxResponse,'post',args);tinyMCE.cancelEvent(e);return false;}}while((elm=elm.parentNode));}return true;},initInstance:function(inst){var self=TinyMCE_SpellCheckerPlugin,m=self._menu,cm=self._contextMenu,e;tinyMCE.importCSS(inst.getDoc(),tinyMCE.baseURL+"/plugins/spellchecker/css/content.css");if(!tinyMCE.hasMenu('spellcheckercontextmenu')){tinyMCE.importCSS(document,tinyMCE.baseURL+"/plugins/spellchecker/css/spellchecker.css");cm.init({drop_menu:false});tinyMCE.addMenu('spellcheckercontextmenu',cm);}if(!tinyMCE.hasMenu('spellcheckermenu')){m.init({});tinyMCE.addMenu('spellcheckermenu',m);}inst.spellCheckerLang='en';self._buildSettingsMenu(inst,null);e=self._getBlockBoxLayer(inst).create('div','mceBlockBox',document.getElementById(inst.editorId+'_parent'));self._getMsgBoxLayer(inst).create('div','mceMsgBox',document.getElementById(inst.editorId+'_parent'));},_getMsgBoxLayer:function(inst){if(!inst.spellCheckerMsgBoxL)inst.spellCheckerMsgBoxL=new TinyMCE_Layer(inst.editorId+'_spellcheckerMsgBox',false);return inst.spellCheckerMsgBoxL;},_getBlockBoxLayer:function(inst){if(!inst.spellCheckerBoxL)inst.spellCheckerBoxL=new TinyMCE_Layer(inst.editorId+'_spellcheckerBlockBox',false);return inst.spellCheckerBoxL;},_buildSettingsMenu:function(inst,lang){var i,ar=tinyMCE.getParam('spellchecker_languages','+English=en').split(','),p;var self=TinyMCE_SpellCheckerPlugin,m=self._menu,c;m.clear();m.addTitle(tinyMCE.getLang('lang_spellchecker_langs','',true));for(i=0;i<ar.length;i++){if(ar[i]!=''){p=ar[i].split('=');c='mceMenuCheckItem';if(p[0].charAt(0)=='+'){p[0]=p[0].substring(1);if(lang==null){c='mceMenuSelectedItem';inst.spellCheckerLang=p[1];}}if(lang==p[1])c='mceMenuSelectedItem';m.add({text:p[0],js:"tinyMCE.execInstanceCommand('"+inst.editorId+"','mceSpellCheckerSetLang',false,'"+p[1]+"');",class_name:c});}}},setupContent:function(editor_id,body,doc){TinyMCE_SpellCheckerPlugin._removeWords(doc,null,true);},getControlHTML:function(cn){switch(cn){case"spellchecker":return TinyMCE_SpellCheckerPlugin._getMenuButtonHTML(cn,'lang_spellchecker_desc','{$pluginurl}/images/spellchecker.gif','lang_spellchecker_desc','mceSpellCheckerMenu','mceSpellCheck');}return"";},_getMenuButtonHTML:function(id,lang,img,mlang,mid,cmd,ui,val){var h='',m,x;cmd='tinyMCE.hideMenus();tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+cmd+'\'';if(typeof(ui)!="undefined"&&ui!=null)cmd+=','+ui;if(typeof(val)!="undefined"&&val!=null)cmd+=",'"+val+"'";cmd+=');';if(tinyMCE.getParam('button_tile_map')&&(!tinyMCE.isMSIE||tinyMCE.isOpera)&&(m=tinyMCE.buttonMap[id])!=null&&(tinyMCE.getParam("language")=="en"||img.indexOf('$lang')==-1)){x=0-(m*20)==0?'0':0-(m*20);h+='<a id="{$editor_id}_'+id+'" href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" class="mceTiledButton mceButtonNormal" target="_self">';h+='<img src="{$themeurl}/images/spacer.gif" style="background-position: '+x+'px 0" title="{$'+lang+'}" />';h+='<img src="{$themeurl}/images/button_menu.gif" title="{$'+lang+'}" class="mceMenuButton" onclick="'+mcmd+'return false;" />';h+='</a>';}else{if(tinyMCE.isMSIE&&!tinyMCE.isOpera)h+='<span id="{$editor_id}_'+id+'" class="mceMenuButton" onmouseover="tinyMCE.plugins.spellchecker._menuButtonEvent(\'over\',this);" onmouseout="tinyMCE.plugins.spellchecker._menuButtonEvent(\'out\',this);">';else h+='<span id="{$editor_id}_'+id+'" class="mceMenuButton">';h+='<a href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" class="mceMenuButtonNormal" target="_self">';h+='<img src="'+img+'" title="{$'+lang+'}" /></a>';h+='<a href="#" onclick="tinyMCE.plugins.spellchecker._toggleMenu(\'{$editor_id}\',\''+mid+'\');return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$'+lang+'}" class="mceMenuButton" />';h+='</a></span>';}return h;},_menuButtonEvent:function(e,o){var t=this;window.setTimeout(function(){t._menuButtonEvent2(e,o);},1);},_menuButtonEvent2:function(e,o){if(o.className=='mceMenuButtonFocus')return;if(e=='over')o.className=o.className+' mceMenuHover';else o.className=o.className.replace(/\s.*$/,'');},_toggleMenu:function(editor_id,id){var self=TinyMCE_SpellCheckerPlugin;var e=document.getElementById(editor_id+'_spellchecker');var inst=tinyMCE.getInstanceById(editor_id);if(self._menu.isVisible()){tinyMCE.hideMenus();return;}tinyMCE.lastMenuBtnClass=e.className.replace(/\s.*$/,'');tinyMCE.switchClass(editor_id+'_spellchecker','mceMenuButtonFocus');self._menu.moveRelativeTo(e,'bl');self._menu.moveBy(tinyMCE.isMSIE&&!tinyMCE.isOpera?0:1,-1);if(tinyMCE.isOpera)self._menu.moveBy(0,-2);self._onMenuEvent(inst,self._menu,'show');self._menu.show();tinyMCE.lastSelectedMenuBtn=editor_id+'_spellchecker';},_onMenuEvent:function(inst,m,n){TinyMCE_SpellCheckerPlugin._buildSettingsMenu(inst,inst.spellCheckerLang);},execCommand:function(editor_id,element,command,user_interface,value){var inst=tinyMCE.getInstanceById(editor_id),self=TinyMCE_SpellCheckerPlugin,args='',co,bb,mb,nl,i,e,mbs;switch(command){case"mceSpellCheck":if(!inst.spellcheckerOn){inst.spellCheckerBookmark=inst.selection.getBookmark();if(tinyMCE.isRealIE)tinyMCE.setInnerHTML(inst.getBody(),inst.getBody().innerHTML);args+='id='+inst.editorId+"|"+(++self._counter);args+='&cmd=spell&check='+encodeURIComponent(self._getWordList(inst.getBody())).replace(/\'/g,'%27');args+='&lang='+escape(inst.spellCheckerLang);co=document.getElementById(inst.editorId+'_parent').firstChild;bb=self._getBlockBoxLayer(inst);bb.moveRelativeTo(co,'tl');bb.resizeTo(co.offsetWidth,co.offsetHeight);bb.show();mb=self._getMsgBoxLayer(inst);e=mb.getElement();if(e.childNodes[0])e.removeChild(e.childNodes[0]);mbs=document.createElement("span");mbs.innerHTML='<span>'+tinyMCE.getLang('lang_spellchecker_swait','',true)+'</span>';e.appendChild(mbs);mb.show();mb.moveRelativeTo(co,'cc');if(tinyMCE.isMSIE&&!tinyMCE.isOpera){nl=co.getElementsByTagName('select');for(i=0;i<nl.length;i++)nl[i].disabled=true;}inst.spellcheckerOn=true;tinyMCE.switchClass(editor_id+'_spellchecker','mceMenuButtonSelected');self._sendAjax(self.baseURL+self._ajaxPage,self._ajaxResponse,'post',args);}else{self._removeWords(inst.getDoc());inst.spellcheckerOn=false;tinyMCE.switchClass(editor_id+'_spellchecker','mceMenuButton');}return true;case"mceSpellCheckReplace":if(inst.spellCheckerElm)tinyMCE.setOuterHTML(inst.spellCheckerElm,value);self._checkDone(inst);self._contextMenu.hide();self._menu.hide();return true;case"mceSpellCheckIgnore":if(inst.spellCheckerElm)self._removeWord(inst.spellCheckerElm);self._checkDone(inst);self._contextMenu.hide();self._menu.hide();return true;case"mceSpellCheckIgnoreAll":if(inst.spellCheckerElm)self._removeWords(inst.getDoc(),inst.spellCheckerElm.innerHTML);self._checkDone(inst);self._contextMenu.hide();self._menu.hide();return true;case"mceSpellCheckerSetLang":tinyMCE.hideMenus();inst.spellCheckerLang=value;self._removeWords(inst.getDoc());inst.spellcheckerOn=false;tinyMCE.switchClass(editor_id+'_spellchecker','mceMenuButton');return true;}return false;},cleanup:function(type,content,inst){switch(type){case"get_from_editor_dom":TinyMCE_SpellCheckerPlugin._removeWords(content,null,true);inst.spellcheckerOn=false;break;}return content;},_displayUI:function(inst){var self=TinyMCE_SpellCheckerPlugin;var bb=self._getBlockBoxLayer(inst);var mb=self._getMsgBoxLayer(inst);var nl,i;var co=document.getElementById(inst.editorId+'_parent').firstChild;if(tinyMCE.isMSIE&&!tinyMCE.isOpera){nl=co.getElementsByTagName('select');for(i=0;i<nl.length;i++)nl[i].disabled=false;}bb.hide();mb.hide();},_ajaxResponse:function(xml){var el=xml?xml.documentElement:null;var inst=tinyMCE.selectedInstance,self=TinyMCE_SpellCheckerPlugin;var cmd=el?el.getAttribute("cmd"):null,err,id=el?el.getAttribute("id"):null;if(id)inst=tinyMCE.getInstanceById(id.substring(0,id.indexOf('|')));self._displayUI(inst);if(cmd=="suggest"&&id!=inst.editorId+"|"+self._counter)return;if(!el){inst.spellcheckerOn=false;tinyMCE.switchClass(inst.editorId+'_spellchecker','mceMenuButton');alert("Could not execute AJAX call, server didn't return valid a XML.");return;}err=el.getAttribute("error");if(err=="true"){inst.spellcheckerOn=false;tinyMCE.switchClass(inst.editorId+'_spellchecker','mceMenuButton');alert(el.getAttribute("msg"));return;}switch(cmd){case"spell":if(xml.documentElement.firstChild){self._markWords(inst.getDoc(),inst.getBody(),decodeURIComponent(el.firstChild.nodeValue).split('+'));inst.selection.moveToBookmark(inst.spellCheckerBookmark);if(tinyMCE.getParam('spellchecker_report_misspellings',false))alert(tinyMCE.getLang('lang_spellchecker_mpell_found','',true,{words:self._countWords(inst)}));}else alert(tinyMCE.getLang('lang_spellchecker_no_mpell','',true));self._checkDone(inst);inst.useCSS=false;break;case"suggest":self._buildMenu(el.firstChild?decodeURIComponent(el.firstChild.nodeValue).split('+'):null,10);self._contextMenu.show();break;}},_getWordSeparators:function(){var i,re='',ch=tinyMCE.getParam('spellchecker_word_separator_chars','\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}\u201d\u201c');for(i=0;i<ch.length;i++)re+='\\'+ch.charAt(i);return re;},_getWordList:function(n){var i,x,s,nv='',nl=tinyMCE.getNodeTree(n,new Array(),3),wl=new Array();var re=TinyMCE_SpellCheckerPlugin._getWordSeparators();for(i=0;i<nl.length;i++){if(!new RegExp('/SCRIPT|STYLE/').test(nl[i].parentNode.nodeName))nv+=nl[i].nodeValue+" ";}nv=nv.replace(new RegExp('([0-9]|['+re+'])','g'),' ');nv=tinyMCE.trim(nv.replace(/(\s+)/g,' '));nl=nv.split(/\s+/);for(i=0;i<nl.length;i++){s=false;for(x=0;x<wl.length;x++){if(wl[x]==nl[i]){s=true;break;}}if(!s&&nl[i].length>0)wl[wl.length]=nl[i];}return wl.join(' ');},_removeWords:function(doc,word,cleanup){var i,c,nl=doc.getElementsByTagName("span");var self=TinyMCE_SpellCheckerPlugin;var inst=tinyMCE.selectedInstance,b=inst?inst.selection.getBookmark():null;word=typeof(word)=='undefined'?null:word;for(i=nl.length-1;i>=0;i--){c=tinyMCE.getAttrib(nl[i],'class');if((c=='mceItemHiddenSpellWord'||c=='mceItemHidden')&&(word==null||nl[i].innerHTML==word))self._removeWord(nl[i]);}if(b&&!cleanup)inst.selection.moveToBookmark(b);},_checkDone:function(inst){var self=TinyMCE_SpellCheckerPlugin;var w=self._countWords(inst);if(w==0){self._removeWords(inst.getDoc());inst.spellcheckerOn=false;tinyMCE.switchClass(inst.editorId+'_spellchecker','mceMenuButton');}},_countWords:function(inst){var i,w=0,nl=inst.getDoc().getElementsByTagName("span"),c;var self=TinyMCE_SpellCheckerPlugin;for(i=nl.length-1;i>=0;i--){c=tinyMCE.getAttrib(nl[i],'class');if(c=='mceItemHiddenSpellWord')w++;}return w;},_removeWord:function(e){if(e!=null)tinyMCE.setOuterHTML(e,e.innerHTML);},_markWords:function(doc,n,wl){var i,nv,nn,nl=tinyMCE.getNodeTree(n,new Array(),3);var r1,r2,r3,r4,r5,w='';var re=TinyMCE_SpellCheckerPlugin._getWordSeparators();for(i=0;i<wl.length;i++){if(wl[i].length>0)w+=wl[i]+((i==wl.length-1)?'':'|');}for(i=0;i<nl.length;i++){nv=nl[i].nodeValue;r1=new RegExp('(['+re+'])('+w+')(['+re+'])','g');r2=new RegExp('^('+w+')','g');r3=new RegExp('('+w+')(['+re+']?)$','g');r4=new RegExp('^('+w+')(['+re+']?)$','g');r5=new RegExp('('+w+')(['+re+'])','g');if(r1.test(nv)||r2.test(nv)||r3.test(nv)||r4.test(nv)){nv=tinyMCE.xmlEncode(nv);nv=nv.replace(r5,'<span class="mceItemHiddenSpellWord">$1</span>$2');nv=nv.replace(r3,'<span class="mceItemHiddenSpellWord">$1</span>$2');nn=doc.createElement('span');nn.className="mceItemHidden";nn.innerHTML=nv;nl[i].parentNode.replaceChild(nn,nl[i]);}}},_buildMenu:function(sg,max){var i,self=TinyMCE_SpellCheckerPlugin,cm=self._contextMenu;cm.clear();if(sg!=null){cm.addTitle(tinyMCE.getLang('lang_spellchecker_sug','',true));for(i=0;i<sg.length&&i<max;i++)cm.addItem(sg[i],'tinyMCE.execCommand("mceSpellCheckReplace",false,"'+sg[i]+'");');cm.addSeparator();}else cm.addTitle(tinyMCE.getLang('lang_spellchecker_no_sug','',true));cm.addItem(tinyMCE.getLang('lang_spellchecker_ignore_word','',true),'tinyMCE.execCommand(\'mceSpellCheckIgnore\');');cm.addItem(tinyMCE.getLang('lang_spellchecker_ignore_words','',true),'tinyMCE.execCommand(\'mceSpellCheckIgnoreAll\');');cm.update();},_getAjaxHTTP:function(){try{return new ActiveXObject('Msxml2.XMLHTTP')}catch(e){try{return new ActiveXObject('Microsoft.XMLHTTP')}catch(e){return new XMLHttpRequest();}}},_sendAjax:function(u,f,m,a){var x=TinyMCE_SpellCheckerPlugin._getAjaxHTTP();x.open(m,u,true);x.onreadystatechange=function(){if(x.readyState==4)f(x.responseXML);};if(m=='post')x.setRequestHeader('Content-type','application/x-www-form-urlencoded');x.send(a);}};tinyMCE.addPlugin('spellchecker',TinyMCE_SpellCheckerPlugin);
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/langs/en.js b/wp-includes/js/tinymce/plugins/spellchecker/langs/en.js index f40b202..02fdac5 100755 --- a/wp-includes/js/tinymce/plugins/spellchecker/langs/en.js +++ b/wp-includes/js/tinymce/plugins/spellchecker/langs/en.js @@ -10,5 +10,6 @@ tinyMCE.addToLang('spellchecker',{ swait : 'Spellchecking, please wait...',
sug : 'Suggestions',
no_sug : 'No suggestions',
- no_mpell : 'No misspellings found.'
+ no_mpell : 'No misspellings found.',
+ mpell_found : 'Found {$words} misspellings.'
});
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/tinyspell.php b/wp-includes/js/tinymce/plugins/spellchecker/tinyspell.php index 88da57d..18345e6 100755 --- a/wp-includes/js/tinymce/plugins/spellchecker/tinyspell.php +++ b/wp-includes/js/tinymce/plugins/spellchecker/tinyspell.php @@ -8,6 +8,9 @@ * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
+ // Ignore the Notice errors for now.
+ error_reporting(E_ALL ^ E_NOTICE);
+
require_once("config.php");
$id = sanitize($_POST['id'], "loose");
@@ -30,14 +33,14 @@ // Get input parameters.
- $check = $_POST['check'];
- $cmd = sanitize($_POST['cmd']);
- $lang = sanitize($_POST['lang'], "strict");
- $mode = sanitize($_POST['mode'], "strict");
- $spelling = sanitize($_POST['spelling'], "strict");
- $jargon = sanitize($_POST['jargon'], "strict");
- $encoding = sanitize($_POST['encoding'], "strict");
- $sg = sanitize($_POST['sg'], "bool");
+ $check = urldecode($_REQUEST['check']);
+ $cmd = sanitize($_REQUEST['cmd']);
+ $lang = sanitize($_REQUEST['lang'], "strict");
+ $mode = sanitize($_REQUEST['mode'], "strict");
+ $spelling = sanitize($_REQUEST['spelling'], "strict");
+ $jargon = sanitize($_REQUEST['jargon'], "strict");
+ $encoding = sanitize($_REQUEST['encoding'], "strict");
+ $sg = sanitize($_REQUEST['sg'], "bool");
$words = array();
$validRequest = true;
@@ -90,9 +93,11 @@ $words = preg_split("/ |\n/", $check, -1, PREG_SPLIT_NO_EMPTY);
$result = $tinyspell->checkWords($words);
break;
+
case "suggest":
$result = $tinyspell->getSuggestion($check);
break;
+
default:
// Just use this for now.
$tinyspell->errorMsg[] = "No command.";
@@ -109,19 +114,22 @@ switch($outputType) {
case "xml":
header('Content-type: text/xml; charset=utf-8');
- echo '<?xml version="1.0" encoding="utf-8" ?>';
- echo "\n";
+ $body = '<?xml version="1.0" encoding="utf-8" ?>';
+ $body .= "\n";
+
if (count($result) == 0)
- echo '<res id="' . $id . '" cmd="'. $cmd .'" />';
+ $body .= '<res id="' . $id . '" cmd="'. $cmd .'" />';
else
- echo '<res id="' . $id . '" cmd="'. $cmd .'">'. utf8_encode(implode(" ", $result)) .'</res>';
+ $body .= '<res id="' . $id . '" cmd="'. $cmd .'">'. urlencode(implode(" ", $result)) .'</res>';
+ echo $body;
break;
case "xmlerror";
header('Content-type: text/xml; charset=utf-8');
- echo '<?xml version="1.0" encoding="utf-8" ?>';
- echo "\n";
- echo '<res id="' . $id . '" cmd="'. $cmd .'" error="true" msg="'. implode(" ", $tinyspell->errorMsg) .'" />';
+ $body = '<?xml version="1.0" encoding="utf-8" ?>';
+ $body .= "\n";
+ $body .= '<res id="' . $id . '" cmd="'. $cmd .'" error="true" msg="'. implode(" ", $tinyspell->errorMsg) .'" />';
+ echo $body;
break;
case "html":
var_dump($result);
@@ -130,4 +138,5 @@ echo "Error";
break;
}
-?>
+
+?>
diff --git a/wp-includes/js/tinymce/plugins/wordpress/wordpress.css b/wp-includes/js/tinymce/plugins/wordpress/wordpress.css index cbc9bac..00b454f 100644 --- a/wp-includes/js/tinymce/plugins/wordpress/wordpress.css +++ b/wp-includes/js/tinymce/plugins/wordpress/wordpress.css @@ -48,7 +48,6 @@ pre { line-height: 6px;
overflow: hidden;
padding-left: 12px;
- background-image: url('../images/anchor_symbol.gif');
background-position: bottom;
background-repeat: no-repeat;
}
diff --git a/wp-includes/js/tinymce/wp-mce-help.php b/wp-includes/js/tinymce/wp-mce-help.php index fe90b0d..6d5f1e4 100644 --- a/wp-includes/js/tinymce/wp-mce-help.php +++ b/wp-includes/js/tinymce/wp-mce-help.php @@ -167,7 +167,7 @@ header('Content-Type: text/html; charset=' . get_bloginfo('charset')); <div id="content4" class="hidden"> <h2><?php _e('About TinyMCE'); ?></h2> <p><?php printf(__('Version: %s'), '2.0.9') ?></p> - <p><?php printf(__('TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under %sLGPL</a> by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.'), '<a href="'.get_bloginfo('home').'/wp-includes/js/tinymce/license.txt" target="_blank" title="'.__('GNU Library General Public Licence').'">') ?></p> + <p><?php printf(__('TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under %sLGPL</a> by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.'), '<a href="'.get_bloginfo('url').'/wp-includes/js/tinymce/license.txt" target="_blank" title="'.__('GNU Library General Public Licence').'">') ?></p> <p><?php _e('Copyright © 2005, <a href="http://www.moxiecode.com" target="_blank">Moxiecode Systems AB</a>, All rights reserved.') ?></p> <p><?php _e('For more information about this software visit the <a href="http://tinymce.moxiecode.com" target="_blank">TinyMCE website</a>.') ?></p> diff --git a/wp-includes/js/wp-ajax.js b/wp-includes/js/wp-ajax.js new file mode 100644 index 0000000..cc3bb5a --- /dev/null +++ b/wp-includes/js/wp-ajax.js @@ -0,0 +1,100 @@ +var WPAjax = Class.create(); +Object.extend(WPAjax.prototype, Ajax.Request.prototype); +Object.extend(WPAjax.prototype, { + WPComplete: false, // onComplete function + WPError: false, // onWPError function + defaultUrl: '', // We get these from WPAjaxL10n + permText: '', + strangeText: '', + whoaText: '', + + initialize: function(url, responseEl) { + var tempObj = this; + this.transport = Ajax.getTransport(); + if ( !this.transport ) + return false; + this.setOptions( { + parameters: 'cookie=' + encodeURIComponent(document.cookie), + onComplete: function(transport) { // transport = XMLHttpRequest object + if ( tempObj.parseAjaxResponse() ) { + if ( 'function' == typeof tempObj.WPComplete ) + tempObj.WPComplete(transport); + } else if ( 'function' == typeof tempObj.WPError ) // if response corresponds to an error (bad data, say, not 404) + tempObj.WPError(transport); + } + }); + this.url = url ? url : this.defaultUrl; + this.getResponseElement(responseEl); + }, + addArg: function(key, value) { + var a = []; + a[encodeURIComponent(key)] = encodeURIComponent(value); + this.options.parameters = $H(this.options.parameters).merge($H(a)); + }, + getResponseElement: function(r) { + var p = $(r + '-p'); + if ( !p ) { + new Insertion.Bottom(r, "<span id='" + r + "-p'></span>"); + var p = $(r + '-p'); + } + this.myResponseElement = p; + }, + parseAjaxResponse: function() { // 1 = good, 0 = strange (bad data?), -1 = you lack permission + if ( this.transport.responseXML && typeof this.transport.responseXML == 'object' && ( this.transport.responseXML.xml || 'undefined' == typeof this.transport.responseXML.xml ) ) { + var err = this.transport.responseXML.getElementsByTagName('wp_error'); + if ( err[0] ) { + var msg = $A(err).inject( '', function(a, b) { return a + '<p>' + b.firstChild.nodeValue + '</p>'; } ); + Element.update(this.myResponseElement,'<div class="error">' + msg + '</div>'); + return false; + } + return true; + } + var r = this.transport.responseText; + if ( isNaN(r) ) { + Element.update(this.myResponseElement,'<div class="error"><p>' + r + '</p></div>'); + return false; + } + var r = parseInt(r,10); + if ( -1 == r ) { + Element.update(this.myResponseElement,"<div class='error'><p>" + this.permText + "</p></div>"); + return false; + } else if ( 0 == r ) { + Element.update(this.myResponseElement,"<div class='error'><p>" + this.strangeText + "</p></div>"); + return false; + } + return true; + }, + addOnComplete: function(f) { + if ( 'function' == typeof f ) { var of = this.WPComplete; this.WPComplete = function(t) { if ( of ) of(t); f(t); } } + }, + addOnWPError: function(f) { + if ( 'function' == typeof f ) { var of = this.WPError; this.WPError = function(t) { if ( of ) of(t); f(t); } } + }, + notInitialized: function() { + return this.transport ? false : true; + } +}); + +Event.observe( window, 'load', function() { Object.extend(WPAjax.prototype, WPAjaxL10n); }, false ) + +Ajax.activeSendCount = 0; +Ajax.Responders.register( { + onCreate: function() { + Ajax.activeSendCount++; + if ( 1 != Ajax.activeSendCount ) + return; + wpBeforeUnload = window.onbeforeunload; + window.onbeforeunload = function() { + return WPAjax.whoaText; + } + }, + onLoading: function() { // Can switch to onLoaded if we lose data + Ajax.activeSendCount--; + if ( 0 != Ajax.activeSendCount ) + return; + window.onbeforeunload = wpBeforeUnload; + } +}); + +//Pretty func adapted from ALA http://www.alistapart.com/articles/gettingstartedwithajax +function getNodeValue(tree,el){try { var r = tree.getElementsByTagName(el)[0].firstChild.nodeValue; } catch(err) { var r = null; } return r; } diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 16f6b58..65a502a 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -70,7 +70,7 @@ function get_permalink($id = 0) { $unixtime = strtotime($post->post_date); $category = ''; - if ( strstr($permalink, '%category%') ) { + if (strpos($permalink, '%category%') !== false) { $cats = get_the_category($post->ID); $category = $cats[0]->category_nicename; if ( $parent=$cats[0]->category_parent ) @@ -158,12 +158,12 @@ function get_attachment_link($id = false) { $parentlink = _get_page_link( $object->post_parent ); // Ignores page_on_front else $parentlink = get_permalink( $object->post_parent ); - if (! strstr($parentlink, '?') ) + if (strpos($parentlink, '?') === false) $link = trim($parentlink, '/') . '/' . $object->post_name . '/'; } if (! $link ) { - $link = get_bloginfo('home') . "/?attachment_id=$id"; + $link = get_bloginfo('url') . "/?attachment_id=$id"; } return apply_filters('attachment_link', $link, $id); diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php index 1c9c111..b15b3fa 100644 --- a/wp-includes/pluggable.php +++ b/wp-includes/pluggable.php @@ -287,7 +287,7 @@ function check_admin_referer($action = -1) { $adminurl = strtolower(get_option('siteurl')).'/wp-admin'; $referer = strtolower(wp_get_referer()); if ( !wp_verify_nonce($_REQUEST['_wpnonce'], $action) && - !(-1 == $action && strstr($referer, $adminurl)) ) { + !(-1 == $action && strpos($referer, $adminurl) !== false)) { wp_nonce_ays($action); die(); } diff --git a/wp-includes/post.php b/wp-includes/post.php index 4a9d69c..33a0a3c 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -1200,9 +1200,9 @@ function generate_page_uri_index() { // function is_local_attachment($url) { - if ( !strstr($url, get_bloginfo('home') ) ) + if (strpos($url, get_bloginfo('url')) === false) return false; - if ( strstr($url, get_bloginfo('home') . '/?attachment_id=') ) + if (strpos($url, get_bloginfo('url') . '/?attachment_id=') !== false) return true; if ( $id = url_to_postid($url) ) { $post = & get_post($id); diff --git a/wp-includes/query.php b/wp-includes/query.php index 79b6ba1..3432f74 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -29,7 +29,7 @@ function &query_posts($query) { function is_admin () {
global $wp_query;
- return ( $wp_query->is_admin || strstr($_SERVER['REQUEST_URI'], 'wp-admin/') );
+ return ($wp_query->is_admin || (strpos($_SERVER['REQUEST_URI'], 'wp-admin/') !== false));
}
function is_archive () {
@@ -404,14 +404,14 @@ class WP_Query { if ( !empty($query) || !isset($this->query) ) {
$this->init();
if ( is_array($query) )
- $qv = & $query;
+ $this->query_vars = $query;
else
- parse_str($query, $qv);
+ parse_str($query, $this->query_vars);
$this->query = $query;
- $this->query_vars = $qv;
}
- $qv = $this->fill_query_vars($qv);
+ $this->query_vars = $this->fill_query_vars($this->query_vars);
+ $qv = &$this->query_vars;
if ( ! empty($qv['robots']) ) {
$this->is_robots = true;
@@ -426,8 +426,16 @@ class WP_Query { return;
}
- $qv['m'] = (int) $qv['m'];
$qv['p'] = (int) $qv['p'];
+ $qv['page_id'] = (int) $qv['page_id'];
+ $qv['year'] = (int) $qv['year'];
+ $qv['monthnum'] = (int) $qv['monthnum'];
+ $qv['day'] = (int) $qv['day'];
+ $qv['w'] = (int) $qv['w'];
+ $qv['m'] = (int) $qv['m'];
+ if ( '' != $qv['hour'] ) $qv['hour'] = (int) $qv['hour'];
+ if ( '' != $qv['minute'] ) $qv['minute'] = (int) $qv['minute'];
+ if ( '' != $qv['second'] ) $qv['second'] = (int) $qv['second'];
// Compat. Map subpost to attachment.
if ( '' != $qv['subpost'] )
@@ -435,62 +443,64 @@ class WP_Query { if ( '' != $qv['subpost_id'] )
$qv['attachment_id'] = $qv['subpost_id'];
- if ( ('' != $qv['attachment']) || (int) $qv['attachment_id'] ) {
+ $qv['attachment_id'] = (int) $qv['attachment_id'];
+
+ if ( ('' != $qv['attachment']) || !empty($qv['attachment_id']) ) {
$this->is_single = true;
$this->is_attachment = true;
- } elseif ('' != $qv['name']) {
+ } 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'])) {
+ } 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'] || (int) $qv['page_id']) {
+ } elseif ( '' != $qv['static'] || '' != $qv['pagename'] || !empty($qv['page_id']) ) {
$this->is_page = true;
$this->is_single = false;
- } elseif (!empty($qv['s'])) {
+ } elseif ( !empty($qv['s']) ) {
$this->is_search = true;
} else {
// Look for archive queries. Dates, categories, authors.
- if ( (int) $qv['second']) {
+ if ( '' != $qv['second'] ) {
$this->is_time = true;
$this->is_date = true;
}
- if ( (int) $qv['minute']) {
+ if ( '' != $qv['minute'] ) {
$this->is_time = true;
$this->is_date = true;
}
- if ( (int) $qv['hour']) {
+ if ( '' != $qv['hour'] ) {
$this->is_time = true;
$this->is_date = true;
}
- if ( (int) $qv['day']) {
+ if ( $qv['day'] ) {
if (! $this->is_date) {
$this->is_day = true;
$this->is_date = true;
}
}
- if ( (int) $qv['monthnum']) {
+ if ( $qv['monthnum'] ) {
if (! $this->is_date) {
$this->is_month = true;
$this->is_date = true;
}
}
- if ( (int) $qv['year']) {
+ if ( $qv['year'] ) {
if (! $this->is_date) {
$this->is_year = true;
$this->is_date = true;
}
}
- if ( (int) $qv['m']) {
+ if ( $qv['m'] ) {
$this->is_date = true;
if (strlen($qv['m']) > 9) {
$this->is_time = true;
@@ -507,62 +517,55 @@ class WP_Query { $this->is_date = true;
}
- if (empty($qv['cat']) || ($qv['cat'] == '0')) {
+ if ( empty($qv['cat']) || ($qv['cat'] == '0') ) {
$this->is_category = false;
} else {
- if (stristr($qv['cat'],'-')) {
+ if (strpos($qv['cat'], '-') !== false) {
$this->is_category = false;
} else {
$this->is_category = true;
}
}
- if ('' != $qv['category_name']) {
+ if ( '' != $qv['category_name'] ) {
$this->is_category = true;
}
- if ((empty($qv['author'])) || ($qv['author'] == '0')) {
+ if ( empty($qv['author']) || ($qv['author'] == '0') ) {
$this->is_author = false;
} else {
$this->is_author = true;
}
- if ('' != $qv['author_name']) {
+ if ( '' != $qv['author_name'] ) {
$this->is_author = true;
}
- if ( ($this->is_date || $this->is_author || $this->is_category)) {
+ if ( ($this->is_date || $this->is_author || $this->is_category) )
$this->is_archive = true;
- }
}
- if ('' != $qv['feed']) {
+ if ( '' != $qv['feed'] )
$this->is_feed = true;
- }
- if ('' != $qv['tb']) {
+ if ( '' != $qv['tb'] )
$this->is_trackback = true;
- }
- if ('' != $qv['paged']) {
+ if ( '' != $qv['paged'] )
$this->is_paged = true;
- }
- if ('' != $qv['comments_popup']) {
+ if ( '' != $qv['comments_popup'] )
$this->is_comments_popup = true;
- }
- //if we're previewing inside the write screen
- if ('' != $qv['preview']) {
+ // if we're previewing inside the write screen
+ if ('' != $qv['preview'])
$this->is_preview = true;
- }
- if (strstr($_SERVER['PHP_SELF'], 'wp-admin/')) {
+ if ( strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false )
$this->is_admin = true;
- }
if ( false !== strpos($qv['feed'], 'comments-') ) {
- $this->query_vars['feed'] = $qv['feed'] = str_replace('comments-', '', $qv['feed']);
+ $qv['feed'] = str_replace('comments-', '', $qv['feed']);
$qv['withcomments'] = 1;
}
@@ -571,15 +574,14 @@ class WP_Query { 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 ) ) {
+ 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_home = true;
- }
// Correct is_* for page_on_front and page_for_posts
if ( $this->is_home && ( empty($this->query) || $qv['preview'] == 'true' ) && 'page' == get_option('show_on_front') && get_option('page_on_front') ) {
$this->is_page = true;
$this->is_home = false;
- $this->query_vars['page_id'] = get_option('page_on_front');
+ $qv['page_id'] = get_option('page_on_front');
}
if ( '' != $qv['pagename'] ) {
@@ -596,8 +598,7 @@ class WP_Query { }
}
- if ( '' != $qv['page_id'] && 0 != intval($qv['page_id']) ) {
- $this->query_vars['page_id'] = intval($qv['page_id']);
+ 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;
@@ -611,9 +612,8 @@ class WP_Query { $this->is_singular = $this->is_single || $this->is_page || $this->is_attachment;
// Done correcting is_* for page_on_front and page_for_posts
- if ( !empty($query) ) {
+ if ( !empty($query) )
do_action_ref_array('parse_query', array(&$this));
- }
}
function set_404() {
@@ -704,7 +704,7 @@ class WP_Query { $wp_posts_post_date_field = "post_date"; // "DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)";
// If a month is specified in the querystring, load that month
- if ( (int) $q['m'] ) {
+ if ( $q['m'] ) {
$q['m'] = '' . preg_replace('|[^0-9]|', '', $q['m']);
$where .= ' AND YEAR(post_date)=' . substr($q['m'], 0, 4);
if (strlen($q['m'])>5)
@@ -719,41 +719,23 @@ class WP_Query { $where .= ' AND SECOND(post_date)=' . substr($q['m'], 12, 2);
}
- if ( (int) $q['hour'] ) {
- $q['hour'] = '' . intval($q['hour']);
+ if ( '' != $q['hour'] )
$where .= " AND HOUR(post_date)='" . $q['hour'] . "'";
- }
- if ( (int) $q['minute'] ) {
- $q['minute'] = '' . intval($q['minute']);
+ if ( '' != $q['minute'] )
$where .= " AND MINUTE(post_date)='" . $q['minute'] . "'";
- }
- if ( (int) $q['second'] ) {
- $q['second'] = '' . intval($q['second']);
+ if ( '' != $q['second'] )
$where .= " AND SECOND(post_date)='" . $q['second'] . "'";
- }
- if ( (int) $q['year'] ) {
- $q['year'] = '' . intval($q['year']);
+ if ( $q['year'] )
$where .= " AND YEAR(post_date)='" . $q['year'] . "'";
- }
- if ( (int) $q['monthnum'] ) {
- $q['monthnum'] = '' . intval($q['monthnum']);
+ if ( $q['monthnum'] )
$where .= " AND MONTH(post_date)='" . $q['monthnum'] . "'";
- }
- if ( (int) $q['day'] ) {
- $q['day'] = '' . intval($q['day']);
+ if ( $q['day'] )
$where .= " AND DAYOFMONTH(post_date)='" . $q['day'] . "'";
- }
-
- // Compat. Map subpost to attachment.
- if ( '' != $q['subpost'] )
- $q['attachment'] = $q['subpost'];
- if ( '' != $q['subpost_id'] )
- $q['attachment_id'] = $q['subpost_id'];
if ('' != $q['name']) {
$q['name'] = sanitize_title($q['name']);
@@ -784,34 +766,29 @@ class WP_Query { $where .= " AND post_name = '" . $q['attachment'] . "'";
}
- if ( (int) $q['w'] ) {
- $q['w'] = ''.intval($q['w']);
+ if ( $q['w'] )
$where .= " AND WEEK(post_date, 1)='" . $q['w'] . "'";
- }
if ( intval($q['comments_popup']) )
$q['p'] = intval($q['comments_popup']);
- // If a attachment is requested by number, let it supercede any post number.
- if ( ($q['attachment_id'] != '') && (intval($q['attachment_id']) != 0) )
- $q['p'] = (int) $q['attachment_id'];
+ // If an attachment is requested by number, let it supercede any post number.
+ if ( $q['attachment_id'] )
+ $q['p'] = $q['attachment_id'];
// If a post number is specified, load that post
- if (($q['p'] != '') && intval($q['p']) != 0) {
- $q['p'] = (int) $q['p'];
+ if ( $q['p'] )
$where = ' AND ID = ' . $q['p'];
- }
- if (($q['page_id'] != '') && (intval($q['page_id']) != 0)) {
- $q['page_id'] = intval($q['page_id']);
+ 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 ID = '.$q['page_id'];
+ $where = ' AND ID = ' . $q['page_id'];
}
}
// If a search pattern is specified, load the posts that match
- if (!empty($q['s'])) {
+ if ( !empty($q['s']) ) {
// added slashes screw with quote grouping when done early, so done later
$q['s'] = stripslashes($q['s']);
if ($q['sentence']) {
@@ -838,10 +815,10 @@ class WP_Query { // Category stuff
- if ((empty($q['cat'])) || ($q['cat'] == '0') ||
+ if ( empty($q['cat']) || ($q['cat'] == '0') ||
// Bypass cat checks if fetching specific posts
- ( $this->is_single || $this->is_page )) {
- $whichcat='';
+ $this->is_singular ) {
+ $whichcat = '';
} else {
$q['cat'] = ''.urldecode($q['cat']).'';
$q['cat'] = addslashes_gpc($q['cat']);
@@ -850,7 +827,7 @@ class WP_Query { $in_cats = $out_cats = $out_posts = '';
foreach ( $cat_array as $cat ) {
$cat = intval($cat);
- $in = strstr($cat, '-') ? false : true;
+ $in = (strpos($cat, '-') !== false) ? false : true;
$cat = trim($cat, '-');
if ( $in )
$in_cats .= "$cat, " . get_category_children($cat, '', ', ');
@@ -878,7 +855,7 @@ class WP_Query { }
// Category stuff for nice URLs
- if ('' != $q['category_name']) {
+ if ( '' != $q['category_name'] ) {
$reqcat = get_category_by_path($q['category_name']);
$q['category_name'] = str_replace('%2F', '/', urlencode(urldecode($q['category_name'])));
$cat_paths = '/' . trim($q['category_name'], '/');
@@ -913,12 +890,12 @@ class WP_Query { // Author/user stuff
- if ((empty($q['author'])) || ($q['author'] == '0')) {
+ if ( empty($q['author']) || ($q['author'] == '0') ) {
$whichauthor='';
} else {
$q['author'] = ''.urldecode($q['author']).'';
$q['author'] = addslashes_gpc($q['author']);
- if (stristr($q['author'], '-')) {
+ if (strpos($q['author'], '-') !== false) {
$eq = '!=';
$andor = 'AND';
$q['author'] = explode('-', $q['author']);
@@ -938,7 +915,7 @@ class WP_Query { // Author stuff for nice URLs
if ('' != $q['author_name']) {
- if (stristr($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
@@ -953,12 +930,11 @@ class WP_Query { $where .= $search.$whichcat.$whichauthor;
- if ((empty($q['order'])) || ((strtoupper($q['order']) != 'ASC') && (strtoupper($q['order']) != 'DESC'))) {
- $q['order']='DESC';
- }
+ if ( empty($q['order']) || ((strtoupper($q['order']) != 'ASC') && (strtoupper($q['order']) != 'DESC')) )
+ $q['order'] = 'DESC';
// Order by
- if (empty($q['orderby'])) {
+ if ( empty($q['orderby']) ) {
$q['orderby'] = 'post_date '.$q['order'];
} else {
// Used to filter values
@@ -1014,7 +990,7 @@ class WP_Query { $join = apply_filters('posts_join', $join);
// Paging
- if (empty($q['nopaging']) && !$this->is_singular) {
+ if ( empty($q['nopaging']) && !$this->is_singular ) {
$page = abs(intval($q['paged']));
if (empty($page)) {
$page = 1;
diff --git a/wp-includes/rewrite.php b/wp-includes/rewrite.php index a8af33a..d22d3fc 100644 --- a/wp-includes/rewrite.php +++ b/wp-includes/rewrite.php @@ -591,11 +591,11 @@ class WP_Rewrite { //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 (strstr($struct, '%postname%') || strstr($struct, '%post_id%')
- || strstr($struct, '%pagename%')
- || (strstr($struct, '%year%') && strstr($struct, '%monthnum%') && strstr($struct, '%day%') && strstr($struct, '%hour%') && strstr($struct, '%minute') && strstr($struct, '%second%'))) {
+ 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 ( strstr($struct, '%pagename%') )
+ if (strpos($struct, '%pagename%') !== false)
$page = true;
}
@@ -809,7 +809,7 @@ class WP_Rewrite { //nada.
}
- if (strstr($query, $this->index)) {
+ 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";
diff --git a/wp-includes/rss.php b/wp-includes/rss.php index a42e7e0..44005a7 100644 --- a/wp-includes/rss.php +++ b/wp-includes/rss.php @@ -782,13 +782,13 @@ function parse_w3cdtf ( $date_str ) { 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[6]); + 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[10] == 'Z' ) { + if ( $match[11] == 'Z' ) { # zulu time, aka GMT } else { diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 8026973..a763315 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -19,9 +19,26 @@ class WP_Scripts { $mce_config = apply_filters('tiny_mce_config_url', '/wp-includes/js/tinymce/tiny_mce_config.php'); $this->add( 'wp_tiny_mce', $mce_config, array('tiny_mce'), '20070225' ); $this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.5.0-0'); - $this->add( 'autosave', '/wp-includes/js/autosave-js.php', array('prototype', 'sack'), '20070116'); - $this->add( 'wp-ajax', '/wp-includes/js/wp-ajax-js.php', array('prototype'), '20070118'); - $this->add( 'listman', '/wp-includes/js/list-manipulation-js.php', array('wp-ajax', 'fat'), '20070118'); + $this->add( 'autosave', '/wp-includes/js/autosave.js', array('prototype', 'sack'), '20070306'); + $this->localize( 'autosave', 'autosaveL10n', array( + 'autosaveInterval' => apply_filters('autosave_interval', '120'), + 'errorText' => __('Error: %response%'), + 'saveText' => __('Saved at %time%.'), + 'requestFile' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php', + 'savingText' => __('Saving Draft...') + ) ); + $this->add( 'wp-ajax', '/wp-includes/js/wp-ajax.js', array('prototype'), '20070306'); + $this->localize( 'wp-ajax', 'WPAjaxL10n', array( + 'defaultUrl' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php', + 'permText' => __("You don't have permission to do that."), + 'strangeText' => __("Something strange happened. Try refreshing the page."), + 'whoaText' => __("Slow down, I'm still sending your data!") + ) ); + $this->add( 'listman', '/wp-includes/js/list-manipulation.js', array('wp-ajax', 'fat'), '20070306'); + $this->localize( 'listman', 'listManL10n', array( + 'jumpText' => __('Jump to new item'), + 'delText' => __('Are you sure you want to delete this %thing%?') + ) ); $this->add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/wp-scriptaculous.js', array('prototype'), '1.7.0'); $this->add( 'scriptaculous-builder', '/wp-includes/js/scriptaculous/builder.js', array('scriptaculous-root'), '1.7.0'); $this->add( 'scriptaculous-dragdrop', '/wp-includes/js/scriptaculous/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '1.7.0'); @@ -33,14 +50,66 @@ class WP_Scripts { $this->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.1.1'); $this->add( 'interface', '/wp-includes/js/jquery/interface.js', array('jquery'), '1.1.1'); if ( is_admin() ) { - $this->add( 'dbx-admin-key', '/wp-admin/dbx-admin-key-js.php', array('dbx'), '3651' ); - $this->add( 'ajaxcat', '/wp-admin/cat-js.php', array('listman'), '20070118' ); + global $pagenow; + $man = false; + switch ( $pagenow ) : + case 'post.php' : + case 'post-new.php' : + $man = 'postmeta'; + break; + case 'page.php' : + case 'page-new.php' : + $man = 'pagemeta'; + break; + case 'link.php' : + $man = 'linkmeta'; + break; + endswitch; + if ( $man ) { + $this->add( 'dbx-admin-key', '/wp-admin/dbx-admin-key.js', array('dbx'), '20070306' ); + $this->localize( 'dbx-admin-key', 'dbxL10n', array( + 'manager' => $man, + 'open' => __('open'), + 'close' => __('close'), + 'moveMouse' => __('click-down and drag to move this box'), + 'toggleMouse' => __('click to %toggle% this box'), + 'moveKey' => __('use the arrow keys to move this box'), + 'toggleKey' => __(', or press the enter key to %toggle% it'), + ) ); + } + $this->add( 'ajaxcat', '/wp-admin/cat.js', array('listman'), '20070306' ); + $this->localize( 'ajaxcat', 'catL10n', array( + 'add' => attribute_escape(__('Add')), + 'how' => __('Separate multiple categories with commas.') + ) ); $this->add( 'admin-categories', '/wp-admin/categories.js', array('listman'), '3684' ); $this->add( 'admin-custom-fields', '/wp-admin/custom-fields.js', array('listman'), '3733' ); $this->add( 'admin-comments', '/wp-admin/edit-comments.js', array('listman'), '3847' ); $this->add( 'admin-users', '/wp-admin/users.js', array('listman'), '4583' ); $this->add( 'xfn', '/wp-admin/xfn.js', false, '3517' ); - $this->add( 'upload', '/wp-admin/upload-js.php', array('prototype'), '20070118' ); + $this->add( 'upload', '/wp-admin/upload.js', array('prototype'), '20070306' ); + $this->localize( 'upload', 'uploadL10n', array( + 'browseTitle' => attribute_escape(__('Browse your files')), + 'back' => __('« Back'), + 'directTitle' => attribute_escape(__('Direct link to file')), + 'edit' => __('Edit'), + 'thumb' => __('Thumbnail'), + 'full' => __('Full size'), + 'icon' => __('Icon'), + 'title' => __('Title'), + 'show' => __('Show:'), + 'link' => __('Link to:'), + 'file' => __('File'), + 'page' => __('Page'), + 'none' => __('None'), + 'editorText' => attribute_escape(__('Send to editor »')), + 'insert' => __('Insert'), + 'urlText' => __('URL'), + 'desc' => __('Description'), + 'deleteText' => attribute_escape(__('Delete File')), + 'saveText' => attribute_escape(__('Save »')), + 'confirmText' => __("Are you sure you want to delete the file '%title%'?\nClick ok to delete or cancel to go back.") + ) ); } } @@ -81,14 +150,33 @@ class WP_Scripts { $ver .= '&' . $this->args[$handle]; $src = 0 === strpos($this->scripts[$handle]->src, 'http://') ? $this->scripts[$handle]->src : get_option( 'siteurl' ) . $this->scripts[$handle]->src; $src = add_query_arg('ver', $ver, $src); - $src = apply_filters( 'script_loader_src', $src ); + $src = attribute_escape(apply_filters( 'script_loader_src', $src )); echo "<script type='text/javascript' src='$src'></script>\n"; + $this->print_scripts_l10n( $handle ); } $this->printed[] = $handle; } } } + function print_scripts_l10n( $handle ) { + if ( empty($this->scripts[$handle]->l10n_object) || empty($this->scripts[$handle]->l10n) || !is_array($this->scripts[$handle]->l10n) ) + return; + + $object_name = $this->scripts[$handle]->l10n_object; + + echo "<script type='text/javascript'>\n"; + echo "/* <![CDATA[ */\n"; + echo "\t$object_name = {\n"; + $eol = ''; + foreach ( $this->scripts[$handle]->l10n as $var => $val ) { + echo "$eol\t\t$var: \"" . js_escape( $val ) . '"'; + $eol = ",\n"; + } + echo "\n\t}\n"; + echo "/* ]]> */\n"; + echo "</script>\n"; + } /** * Determines dependencies of scripts @@ -140,6 +228,22 @@ class WP_Scripts { return true; } + /** + * Localizes a script + * + * Localizes only if script has already been added + * + * @param string handle Script name + * @param string object_name Name of JS object to hold l10n info + * @param array l10n Array of JS var name => localized string + * @return bool Successful localization + */ + function localize( $handle, $object_name, $l10n ) { + if ( !isset($this->scripts[$handle]) ) + return false; + return $this->scripts[$handle]->localize( $object_name, $l10n ); + } + function remove( $handles ) { foreach ( (array) $handles as $handle ) unset($this->scripts[$handle]); @@ -182,7 +286,8 @@ class _WP_Script { var $src; var $deps = array(); var $ver = false; - var $args = false; + var $l10n_object = ''; + var $l10n = array(); function _WP_Script() { @list($this->handle, $this->src, $this->deps, $this->ver) = func_get_args(); @@ -191,6 +296,14 @@ class _WP_Script { if ( !$this->ver ) $this->ver = false; } + + function localize( $object_name, $l10n ) { + if ( !$object_name || !is_array($l10n) ) + return false; + $this->l10n_object = $object_name; + $this->l10n = $l10n; + return true; + } } /** @@ -227,6 +340,21 @@ function wp_register_script( $handle, $src, $deps = array(), $ver = false ) { $wp_scripts->add( $handle, $src, $deps, $ver ); } +/** + * Localizes a script + * + * Localizes only if script has already been added + * + * @see WP_Script::localize() + */ +function wp_localize_script( $handle, $object_name, $l10n ) { + global $wp_scripts; + if ( !is_a($wp_scripts, 'WP_Scripts') ) + return false; + + return $wp_scripts->localize( $handle, $object_name, $l10n ); +} + function wp_deregister_script( $handle ) { global $wp_scripts; if ( !is_a($wp_scripts, 'WP_Scripts') ) diff --git a/wp-includes/theme.php b/wp-includes/theme.php index 633412c..2f2c1fb 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -78,6 +78,7 @@ function get_theme_data( $theme_file ) { $name = $theme_name[1]; $name = trim( $name ); $theme = $name; + $theme_uri = trim( $theme_uri[1] ); if ( '' == $author_uri[1] ) { $author = trim( $author_name[1] ); @@ -85,7 +86,7 @@ function get_theme_data( $theme_file ) { $author = '<a href="' . trim( $author_uri[1] ) . '" title="' . __('Visit author homepage') . '">' . trim( $author_name[1] ) . '</a>'; } - return array( 'Name' => $name, 'Title' => $theme, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template[1], 'Status' => $status ); + return array( 'Name' => $name, 'Title' => $theme, 'URI' => $theme_uri, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template[1], 'Status' => $status ); } function get_themes() { diff --git a/wp-includes/vars.php b/wp-includes/vars.php index e5cf9ba..1675ca4 100644 --- a/wp-includes/vars.php +++ b/wp-includes/vars.php @@ -32,8 +32,8 @@ elseif ( preg_match('/Nav/', $_SERVER['HTTP_USER_AGENT']) || preg_match('/Mozill $is_IE = ( $is_macIE || $is_winIE ); // Server detection -$is_apache = ( strstr($_SERVER['SERVER_SOFTWARE'], 'Apache') || strstr($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') ) ? 1 : 0; -$is_IIS = strstr($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') ? 1 : 0; +$is_apache = ((strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false) || (strpos($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') !== false)) ? 1 : 0; +$is_IIS = (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false) ? 1 : 0; // if the config file does not provide the smilies array, let's define it here if (!isset($wpsmiliestrans)) { diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index 98ae962..89b2a37 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -437,7 +437,7 @@ class wpdb { header('Content-Type: text/html; charset=utf-8'); - if ( strstr($_SERVER['PHP_SELF'], 'wp-admin') ) + if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) $admin_dir = ''; else $admin_dir = 'wp-admin/'; |