XU
zS1>y0x$3z&T4hBAFV%R}7#d^Vh>N~eUoX;h``ZnUhgzhXrF!>j);R?R1|Ea$DJ1S8
z3@syj{5$s4AmC5e>A9h*$Z!PnOp`KW->tbWy!={0fC
ziqSf?q~8)B8Oh7Z$w`o9u^@ACNahbxU68h^z=VVosiWdy?U<3$nRdPJmHsuDNKYjx
zF?1f~{$-21&Up#peh=u2wk-bf6wkjQub3HRJz5tB|Uq&ckvAm-Seom
z^03_3o0rEhO?-KJzaxoMkg=WnN^@vnK(+cn^x)SU3tB_s)r93yqB=05(lA
z3P`;Dl-yb3&E5YaO;YWUHB((pA9a*tT(uPC1>ysSef%jttpjO>B*ZZ^pxYrmN{Hw&&oMu*~?@_G1-}
zQ@Alh=203AOUyW%=cXvxxoQ%i<%h($
literal 0
HcmV?d00001
diff --git a/wp-admin/images/upload-fresh.png b/wp-admin/images/upload-fresh.png
new file mode 100644
index 0000000000000000000000000000000000000000..92fd355c82ed81690fdc75dec27e0ddeeaa1a361
GIT binary patch
literal 1051
zcmV+$1mydPP)`DxA|}
z$Q@~Z-7%!cITdOI^F@p?sN!=cC_YsT#>pZ^>{Az2LYzALjN&3f3@(@o%>@RbE~3VF
zu{BJY@|_wHYC;8%UxMRNVS@U>3I7VuKQvJ$ZSh64F;NE$xD}o;`>4v?3QJ-_%BYg~
z8X_V}s0tpT@J#rEI>03m9+v}@$xnRY`H6|LITl~UDNVhybeRZ_t5=p0HBRva=SYf1onrYX}L+pt38)X24_AI+l36wOB{x
zITB5`6DAyyNBzZ1(RAzKvB@54Ko(o1SH`i)GSIU|L39z@de(^W*z?yph^}GGSdZa(j>LP!k>>oSc%iz|obQS^%dzJCU=_{z
zs|}u^=6qXx5w_<1uj2PUziQ5ZEq*t=5OaQ4^y!H1jPqq59r`oL`9-lc6z4hrv&b`b
zpBHid4z8#(mM%NXIsYvuT&BK)OHO#Z;{5-?`2h|sZ0aeGO$#USUya|22O@pLvSECOS!%y&O0Q93msRFu^Rx+OseQ&t-3IX;
z)>%_5(kGfE_t<1l{r~?z11Ui9CkrD3g8N{R)e(aBX(!`QWrgYPG|w0--4qivu|rtN|kg
BHa7qO
diff --git a/wp-admin/images/visit-site-button-grad.gif b/wp-admin/images/visit-site-button-grad.gif
deleted file mode 100644
index a7b703e5592564ab5ee0ca8694e4320897dea0e8..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 136
zcmZ?wbhEHbWM46!ic9e+C8y#h)yU3=Dig%|HM$gMr0#!bwT3U8?KPPBvelp!Fn?Ph){uj`tov
lo%1ER$Mr96(`w*b#_Xvm)W9>3rG2tyjKI_bDME}4)&Tv~Dv1C9
diff --git a/wp-admin/images/widgets-arrow-vs.gif b/wp-admin/images/widgets-arrow-vs.gif
new file mode 100644
index 0000000000000000000000000000000000000000..c6398e6775b2e9cfd8a9561f77a7d5f9316ed131
GIT binary patch
literal 213
zcmZ?wbhEHb6l73fIKsfNblqm>*esX0Y_q^v%a8=~z*wu$M9biKr`SyAxU7p$->urb
zecAfW8+PtJeCEQQqbC=y-MD%0!GovI|NsA=fe4`ZlZBCiL6|`Yq!wf+18dL%qu!KE
zzeg+kURG_(<2KGIVfk=u`DLBrRx{FZ}qZ)x34Qvi0sneNu#y_3jZEUrsapG7r9TVF|k`_~qB#Inzi9rxpu7%}VSYS`~
zKKlLs_9zc%bo!fl^VrAteLvsh^F3Z%C=`OHJ&pa7wYq6j&40MjyeAk831*jU&(QPS
zw4~2DE-p}%ozhaO%(z{n*>v+sx@Ig+P%7df?r9A8{l7ZiemFY!T7G8A^sX|cX=hP(
zl3XgvPm+m~=>ImC*S6yJO+6Sl+V1OSGNu>Ic@-r&@BR2I)yJNs`wI=Yc>Cd*wxQ|c
zFK7w}Ufo@uAAc_vs_41P>xX&k3i$j1CMOdMAuTbU-RU^Je#76}hNkZH={N5#&%1E6
zrsDK!z0>G@9(wN|&xE*q1~GqI33biS5>Mb
zj13L=^X;B9X^I5lL9KcpdH&mLjo`AG!MkDyzt78Ld~O#wt!DPzWw(OIVPhBjjhEYI
zp*X}0dG*H0C5<#Yo`vaOOwOx8$WUJ-)UEV
zbU+b{z}be*b1!Zy>O;a5Q0R!kQYj9(1vCe=5si=ss&fe%e7c-!1c;UN0;=
z+#nVS!GyJ6e}53(ZR%fFg5&dMXnLdvkx0a31!4)jd$)g`0W0X#*Pr{6s(X0$2s5C*
zYvh~iyo_OLGT3x@!dd90TrLLz0tf{hDt{I*k74_yR$mXL~p2huMmMiz14JSP^YH
zzOforW~>YaTpW|5>&o3eo*bo+un1F+*xcN*L$h^LMi!C-+}Ly;>gRbcJXf9v0e^gf
z(jka?hmp89FvXKgl!*Z&$&40o|BZrv-U8G`!_6uLGmADNB5YMbs8(JjL3QT=1h}rj$aASEfP^%G5-j9F=BHNrgSgPQeYF3z|hPRPqw;L8A}7JB!2|QX^QNh
z1CKAj48n?|NLdM+OHGO&U9!83WIaT3yo96~!+fnyLzyxSLJ@EZD*=tnEyK0e!8Os!
z0hh29!pYY1O%m
zI7G&N!y?Oj^z1^9Nf9Z?PfKLse>7oYUajT~ab!D^k&I1}Nzfn#v_^UcMGiM47KPTq
z=`_OT4r@!Vj?S1$T)u$eK$SW|Mvkppo!GUaht@4sW_Yw#At`bHLw^G)r^0o;V^4WL
zZ9|Zgn!vp6L0Lg$MAz*s0m358!_}o%86_)3bw!sO?jXF0aTxO`a6N$6>P!!@N
zVisoBQgLF&YV#DavfnCQx?H%7v
zqw>h}+rWv|Q@u_uSbtg9it(UK358k7Y|YZoTUk_yV8m?VL-f$^!?+6+VWoVAwNJdE
zXpwHhxYIkXd84lShrERZ*X{Fv__)hLAv;-D6)U;boiRNr9=^3t6H5&NMU5CUT6mnP
zeWnP~aZ`SbgNwW;our#Ev}MW*>o%g}FYi1(w`i5tcaGen_J4awt7gwXUz1i$8Dx4S&BfGhanU8St0f7Cs4moNxx!=3Q_(fwOKx<9a`V|2E0?`9Po
zuiXK&%XaML_LvN{+Ig!p7J3>?Qsj#a(?Y~teOh%haAN-sAYG)hzI8xD82@uArSq4Q
zUroPwt7q%=4u4%US$+09HL+pBlnzZXesGZuIeMs#lVP;RN6$-|0_OP#sEc%x?zMOu
z?$?)ab#5M*l>Gd9TQ`PQPi&4JS}=&&bkR^DlA5p)E#qLaI9$95=?{kVzxuGfvjufs
z+TfeuiJxZYZ+8Epb9naqFK7z-zOiSEN`{+EbgeR)9e>!A!tYWVGLWFuhcfA)WU8%ED>KD_^Suip4tUPk!iw5m7Q4nDi#$LT1RcS)qF#S9q1hj0G!jKb&fq`2K~h0o_x_`IHE
ztltD`>Rg;yDwP&)d&MhBt_*OJ%n(gnF?J=|bi5ufG9n}hdKSbUYqwk9`*G0canpN3
xq0k``i>s$Z;002ovPDHLkV1myfVoCr2
delta 2319
zcmV+q3Gnum62B6VNq^xV#C2D+x>qb703QF@BG*Mzt8iY-}fsLUU?5saQur=nB7SAW)$@O_r|^(~TVlCMd=
zWJ&z#`_oTiSHT3n`Q83`6&^fz5J{(BlI$cg-0rlXytxbgb|-Ak5up=i&?Cxdz>3B3
z$TThBM^2LSB(EzJih=oTGq(CMz&bj;Mp9_8-`AfkD#hiRCJZ`5LjEJ}%rLTUB*F_`l@tog$`Y)UDwPUkP<*pCJqa^2Gk=(xnu23w6sNwd#Ai3|;B-kj
zimMxO>hP|d?8N9Qvb~kQxixPMcs;Kwz0(%GkHFm%Q^MO{?=C=mLMA@w2nV6qSDXYSnoE@Gj)0C-sr)GAR;_t(;{*%bvIP+oBKr@w@=v
zyM8H7AAj0`q?kzf`T4=e$47WB5tuFfjL9)c)(Z;?z~TI5h%p8VTWphUGlmyS9LiZv
z9CeJka$bDvEXKyCus?4pe!OX=Fertay<`t3Cntq)$fau*e#bg26|Ftk|G`D{4pFBl
zl)~l9gs=AAbL!8P)d)|owe=zI
zw;#))i3|!v$uIW8>KMV^cRpt?9@&B~JZ;9&o%x>XrgVI}PWWJqgIm_+36`aHF9eKm1b>*_x5{k|To9YIWdyYqIdxp6A$$a8ALtiK%H_aZR%*q=K|K
z3YS8b>unbCoJFJ22!Pco@dydX_fWZ`z)Fl`A;Rxv6Y_|4-LI5rh&$o
zjLihrRkrnD*gc7i*l_GxwL}=6oD0i=HJTY@Dlnb#jcX!&27NB|PVYi-?N7~Nii_!d}JMqV+^&O{c;o}y||D-aUEw2KxD81i4jI|&zOwO1PmjtaltBB
z?*vvnZN^Yfq$wf5<0DVP83QTyF{dOH9JW>ljKTcx10t(|MPacsE6cmgMX~kX1kBB
zLAxNz;N7+%blOLd5^1E+hY08Fqi&%a;8{tXOrXsa9wgYbQ;#wLD?UxF7VPgMhqBD;
zoiuj&ei0Sb?&ZmI22DwQr+Cl0R~ov-v%EBuC|pio$DmU@^J2C!fjV=7C){`X?h57{
z1s%1~y2Y__c&)=O)X_-hm4B|b+lm3_81k3IA$N%h0lr#UudKx)beKR{Yac~Pg)Ny2
zg;VTY9bvGZz$9!Y@b9GwQP9zvUrxm~JmwNiIbYk%NppJra$P4}E*CD=c6bbDB_V(&
z=&CX@51YOdnd
z(S-5o2VgA5WNanvUU_HvVd3VLqV@iIqZ#)5!{P%maMEJsUhkn^zeG_Or0UO4jT6Pn
zl1<*k2J2U`mi7b362gK;cCJbjEqDB4
zwa6nMTPc4^Z=15bd%YD}GE$IX5^0h)A)ClkNvFo*M6+!eSu}Qo{Cq?`yjfh0A=d;L
zgR#i;8}fdDSo2&w`SP=?5KH;GP~U|!*XqTG;er0hiZ(tR&3}{AFvo@veR%2b)kMHE
zLUZD1cdSy%!$#_PzRyjL5(HVV);fa9UWc%8=HPa)O@FrS#hCxUfE239t7Yc+h@wlc
z?96%dLODLIY{sN_QMpS+dbXkknY3i9HJ;Di6O*X7*m1MlMrom1nNd&&D6wPtV!XU%
z1&6)D>-oSF{TZ<$k;tVFj~?5xu5kY|S-N*hYQz9)wvCW9&HHPn*J-gMI}r!-%rJ!-
zIMn=W_J6DSe$D=`pHqs0p^`Qpop-6t2JG~^=2><%Y9$uaf2*y_P1jDGI8ko3
pS|`0`d7!vv3t_q?%>N270Ekx(1`};=0{{R300>D%PDHLkV1n>`o6rCN
diff --git a/wp-admin/import.php b/wp-admin/import.php
index 08c5daf0..f94f7047 100644
--- a/wp-admin/import.php
+++ b/wp-admin/import.php
@@ -20,7 +20,7 @@ add_contextual_help($current_screen,
'' . __('This screen lists links to plugins to import data from blogging/content management platforms. Choose the platform you want to import from, and click Install Now when you are prompted in the popup window. If your platform is not listed, click the link to search the plugin directory for other importer plugins to see if there is one for your platform.') . '
' .
'' . __('In previous versions of WordPress, all the importers were built-in, but they have been turned into plugins as of version 3.0 since most people only use them once or infrequently.') . '
' .
'' . __('For more information:') . '
' .
- '' . __('Import Documentation ') . '
' .
+ '' . __('Documentation on Import ') . '
' .
'' . __('Support Forums ') . '
'
);
@@ -37,11 +37,14 @@ if ( current_user_can('install_plugins') )
);
if ( ! empty( $_GET['invalid'] ) && !empty($popular_importers[$_GET['invalid']][3]) ) {
- wp_redirect("import.php?import=" . $popular_importers[$_GET['invalid']][3]);
+ wp_redirect( admin_url('import.php?import=' . $popular_importers[$_GET['invalid']][3]) );
exit;
}
add_thickbox();
+wp_enqueue_script( 'plugin-install' );
+wp_admin_css( 'plugin-install' );
+
require_once ('admin-header.php');
$parent_file = 'tools.php';
?>
@@ -58,18 +61,21 @@ $parent_file = 'tools.php';
// Load all importers so that they can register.
$import_loc = 'wp-admin/import';
-$import_root = ABSPATH.$import_loc;
-$imports_dir = @ opendir($import_root);
-if ($imports_dir) {
- while (($file = readdir($imports_dir)) !== false) {
- if ($file{0} == '.') {
- continue;
- } elseif (substr($file, -4) == '.php') {
- require_once($import_root . '/' . $file);
+$import_root = ABSPATH . $import_loc;
+
+if ( file_exists( $import_root ) ) {
+ $imports_dir = opendir($import_root);
+ if ($imports_dir) {
+ while (($file = readdir($imports_dir)) !== false) {
+ if ($file[0] == '.') {
+ continue;
+ } elseif (substr($file, -4) == '.php') {
+ require_once($import_root . '/' . $file);
+ }
}
}
+ closedir( $imports_dir );
}
-@closedir($imports_dir);
$importers = get_importers();
@@ -108,8 +114,8 @@ if (empty ($importers)) {
}
}
if ( empty($action) )
- $action = '' . $data[0] . ' ';
} else {
$action = "{$data[0]} ";
@@ -130,7 +136,7 @@ if (empty ($importers)) {
}
if ( current_user_can('install_plugins') )
- echo '' . sprintf( __('If the importer you need is not listed, search the plugins directory to see if an importer is available.'), esc_url(admin_url('plugin-install.php?tab=search&type=tag&s=importer')) ) . '
';
+ echo '' . sprintf( __('If the importer you need is not listed, search the plugins directory to see if an importer is available.'), esc_url( network_admin_url( 'plugin-install.php?tab=search&type=tag&s=importer' ) ) ) . '
';
?>
diff --git a/wp-admin/includes/admin.php b/wp-admin/includes/admin.php
index 23c9ee2b..37f5c8ec 100644
--- a/wp-admin/includes/admin.php
+++ b/wp-admin/includes/admin.php
@@ -39,6 +39,10 @@ require_once(ABSPATH . 'wp-admin/includes/taxonomy.php');
/** WordPress Template Administration API */
require_once(ABSPATH . 'wp-admin/includes/template.php');
+/** WordPress List Table Administration API and base class */
+require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
+require_once(ABSPATH . 'wp-admin/includes/list-table.php');
+
/** WordPress Theme Administration API */
require_once(ABSPATH . 'wp-admin/includes/theme.php');
@@ -48,9 +52,6 @@ require_once(ABSPATH . 'wp-admin/includes/user.php');
/** WordPress Update Administration API */
require_once(ABSPATH . 'wp-admin/includes/update.php');
-/** WordPress Registration API */
-require_once(ABSPATH . WPINC . '/registration.php');
-
/** WordPress Deprecated Administration API */
require_once(ABSPATH . 'wp-admin/includes/deprecated.php');
diff --git a/wp-admin/includes/bookmark.php b/wp-admin/includes/bookmark.php
index 09e5411e..0ed560c1 100644
--- a/wp-admin/includes/bookmark.php
+++ b/wp-admin/includes/bookmark.php
@@ -7,27 +7,27 @@
*/
/**
- * {@internal Missing Short Description}}
+ * Add a link to using values provided in $_POST.
*
- * @since unknown
+ * @since 2.0.0
*
- * @return unknown
+ * @return int|WP_Error Value 0 or WP_Error on failure. The link ID on success.
*/
function add_link() {
return edit_link();
}
/**
- * {@internal Missing Short Description}}
+ * Update or insert a link using values provided in $_POST.
*
- * @since unknown
+ * @since 2.0.0
*
- * @param unknown_type $link_id
- * @return unknown
+ * @param int $link_id Optional. ID of the link to edit.
+ * @return int|WP_Error Value 0 or WP_Error on failure. The link ID on success.
*/
-function edit_link( $link_id = '' ) {
- if (!current_user_can( 'manage_links' ))
- wp_die( __( 'Cheatin’ uh?' ));
+function edit_link( $link_id = 0 ) {
+ if ( !current_user_can( 'manage_links' ) )
+ wp_die( __( 'Cheatin’ uh?' ) );
$_POST['link_url'] = esc_html( $_POST['link_url'] );
$_POST['link_url'] = esc_url($_POST['link_url']);
@@ -39,27 +39,27 @@ function edit_link( $link_id = '' ) {
if ( !empty( $link_id ) ) {
$_POST['link_id'] = $link_id;
- return wp_update_link( $_POST);
+ return wp_update_link( $_POST );
} else {
- return wp_insert_link( $_POST);
+ return wp_insert_link( $_POST );
}
}
/**
- * {@internal Missing Short Description}}
+ * Retrieve the default link for editing.
*
- * @since unknown
+ * @since 2.0.0
*
- * @return unknown
+ * @return object Default link
*/
function get_default_link_to_edit() {
if ( isset( $_GET['linkurl'] ) )
- $link->link_url = esc_url( $_GET['linkurl']);
+ $link->link_url = esc_url( $_GET['linkurl'] );
else
$link->link_url = '';
if ( isset( $_GET['name'] ) )
- $link->link_name = esc_attr( $_GET['name']);
+ $link->link_name = esc_attr( $_GET['name'] );
else
$link->link_name = '';
@@ -69,12 +69,12 @@ function get_default_link_to_edit() {
}
/**
- * {@internal Missing Short Description}}
+ * Delete link specified from database
*
- * @since unknown
+ * @since 2.0.0
*
- * @param unknown_type $link_id
- * @return unknown
+ * @param int $link_id ID of the link to delete
+ * @return bool True
*/
function wp_delete_link( $link_id ) {
global $wpdb;
@@ -93,12 +93,12 @@ function wp_delete_link( $link_id ) {
}
/**
- * {@internal Missing Short Description}}
+ * Retrieves the link categories associated with the link specified.
*
- * @since unknown
+ * @since 2.1.0
*
- * @param unknown_type $link_id
- * @return unknown
+ * @param int $link_id Link ID to look up
+ * @return array The requested link's categories
*/
function wp_get_link_cats( $link_id = 0 ) {
@@ -108,24 +108,25 @@ function wp_get_link_cats( $link_id = 0 ) {
}
/**
- * {@internal Missing Short Description}}
+ * Retrieve link data based on ID.
*
- * @since unknown
+ * @since 2.0.0
*
- * @param unknown_type $link_id
- * @return unknown
+ * @param int $link_id ID of link to retrieve
+ * @return object Link for editing
*/
function get_link_to_edit( $link_id ) {
return get_bookmark( $link_id, OBJECT, 'edit' );
}
/**
- * {@internal Missing Short Description}}
+ * This function inserts/updates links into/in the database.
*
- * @since unknown
+ * @since 2.0.0
*
- * @param unknown_type $linkdata
- * @return unknown
+ * @param array $linkdata Elements that make up the link to insert.
+ * @param bool $wp_error Optional. If true return WP_Error object on failure.
+ * @return int|WP_Error Value 0 or WP_Error on failure. The link ID on success.
*/
function wp_insert_link( $linkdata, $wp_error = false ) {
global $wpdb;
@@ -181,7 +182,7 @@ function wp_insert_link( $linkdata, $wp_error = false ) {
$link_rel = '';
// Make sure we set a valid category
- if ( ! isset( $link_category ) ||0 == count( $link_category ) || !is_array( $link_category ) ) {
+ if ( ! isset( $link_category ) || 0 == count( $link_category ) || !is_array( $link_category ) ) {
$link_category = array( get_option( 'default_link_category' ) );
}
@@ -215,12 +216,12 @@ function wp_insert_link( $linkdata, $wp_error = false ) {
}
/**
- * {@internal Missing Short Description}}
+ * Update link with the specified link categories.
*
- * @since unknown
+ * @since 2.1.0
*
- * @param unknown_type $link_id
- * @param unknown_type $link_categories
+ * @param int $link_id ID of link to update
+ * @param array $link_categories Array of categories to
*/
function wp_set_link_cats( $link_id = 0, $link_categories = array() ) {
// If $link_categories isn't already an array, make it one:
@@ -233,15 +234,15 @@ function wp_set_link_cats( $link_id = 0, $link_categories = array() ) {
wp_set_object_terms( $link_id, $link_categories, 'link_category' );
clean_bookmark_cache( $link_id );
-} // wp_set_link_cats()
+}
/**
- * {@internal Missing Short Description}}
+ * Update a link in the database.
*
- * @since unknown
+ * @since 2.0.0
*
- * @param unknown_type $linkdata
- * @return unknown
+ * @param array $linkdata Link data to update.
+ * @return int|WP_Error Value 0 or WP_Error on failure. The updated link ID on success.
*/
function wp_update_link( $linkdata ) {
$link_id = (int) $linkdata['link_id'];
diff --git a/wp-admin/includes/class-wp-comments-list-table.php b/wp-admin/includes/class-wp-comments-list-table.php
new file mode 100644
index 00000000..90c158fe
--- /dev/null
+++ b/wp-admin/includes/class-wp-comments-list-table.php
@@ -0,0 +1,557 @@
+ 'comments',
+ 'singular' => 'comment',
+ 'ajax' => true,
+ ) );
+ }
+
+ function ajax_user_can() {
+ return current_user_can('edit_posts');
+ }
+
+ function prepare_items() {
+ global $post_id, $comment_status, $search, $comment_type;
+
+ $comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all';
+ if ( !in_array( $comment_status, array( 'all', 'moderated', 'approved', 'spam', 'trash' ) ) )
+ $comment_status = 'all';
+
+ $comment_type = !empty( $_REQUEST['comment_type'] ) ? $_REQUEST['comment_type'] : '';
+
+ $search = ( isset( $_REQUEST['s'] ) ) ? $_REQUEST['s'] : '';
+
+ $user_id = ( isset( $_REQUEST['user_id'] ) ) ? $_REQUEST['user_id'] : '';
+
+ $orderby = ( isset( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : '';
+ $order = ( isset( $_REQUEST['order'] ) ) ? $_REQUEST['order'] : '';
+
+ $comments_per_page = $this->get_per_page( $comment_status );
+
+ $doing_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
+
+ if ( isset( $_REQUEST['number'] ) ) {
+ $number = (int) $_REQUEST['number'];
+ }
+ else {
+ $number = $comments_per_page + min( 8, $comments_per_page ); // Grab a few extra
+ }
+
+ $page = $this->get_pagenum();
+
+ if ( isset( $_REQUEST['start'] ) ) {
+ $start = $_REQUEST['start'];
+ } else {
+ $start = ( $page - 1 ) * $comments_per_page;
+ }
+
+ if ( $doing_ajax && isset( $_REQUEST['offset'] ) ) {
+ $start += $_REQUEST['offset'];
+ }
+
+ $status_map = array(
+ 'moderated' => 'hold',
+ 'approved' => 'approve'
+ );
+
+ $args = array(
+ 'status' => isset( $status_map[$comment_status] ) ? $status_map[$comment_status] : $comment_status,
+ 'search' => $search,
+ 'user_id' => $user_id,
+ 'offset' => $start,
+ 'number' => $number,
+ 'post_id' => $post_id,
+ 'type' => $comment_type,
+ 'orderby' => $orderby,
+ 'order' => $order,
+ );
+
+ $_comments = get_comments( $args );
+
+ update_comment_cache( $_comments );
+
+ $this->items = array_slice( $_comments, 0, $comments_per_page );
+ $this->extra_items = array_slice( $_comments, $comments_per_page );
+
+ $total_comments = get_comments( array_merge( $args, array('count' => true, 'offset' => 0, 'number' => 0) ) );
+
+ $_comment_post_ids = array();
+ foreach ( $_comments as $_c ) {
+ $_comment_post_ids[] = $_c->comment_post_ID;
+ }
+
+ $this->pending_count = get_pending_comments_num( $_comment_post_ids );
+
+ $this->set_pagination_args( array(
+ 'total_items' => $total_comments,
+ 'per_page' => $comments_per_page,
+ ) );
+ }
+
+ function get_per_page( $comment_status = 'all' ) {
+ $comments_per_page = $this->get_items_per_page( 'edit_comments_per_page' );
+ $comments_per_page = apply_filters( 'comments_per_page', $comments_per_page, $comment_status );
+ return $comments_per_page;
+ }
+
+ function no_items() {
+ global $comment_status;
+
+ if ( 'moderated' == $comment_status )
+ _e( 'No comments awaiting moderation… yet.' );
+ else
+ _e( 'No comments found.' );
+ }
+
+ function get_views() {
+ global $post_id, $comment_status;
+
+ $status_links = array();
+ $num_comments = ( $post_id ) ? wp_count_comments( $post_id ) : wp_count_comments();
+ //, number_format_i18n($num_comments->moderated) ), ""),
+ //, number_format_i18n($num_comments->spam) ), "")
+ $stati = array(
+ 'all' => _nx_noop('All', 'All', 'comments'), // singular not used
+ 'moderated' => _n_noop('Pending (%s ) ', 'Pending (%s ) '),
+ 'approved' => _n_noop('Approved', 'Approved'), // singular not used
+ 'spam' => _n_noop('Spam (%s ) ', 'Spam (%s ) '),
+ 'trash' => _n_noop('Trash (%s ) ', 'Trash (%s ) ')
+ );
+
+ if ( !EMPTY_TRASH_DAYS )
+ unset($stati['trash']);
+
+ $link = 'edit-comments.php';
+ if ( !empty($comment_type) && 'all' != $comment_type )
+ $link = add_query_arg( 'comment_type', $comment_type, $link );
+
+ foreach ( $stati as $status => $label ) {
+ $class = ( $status == $comment_status ) ? ' class="current"' : '';
+
+ if ( !isset( $num_comments->$status ) )
+ $num_comments->$status = 10;
+ $link = add_query_arg( 'comment_status', $status, $link );
+ if ( $post_id )
+ $link = add_query_arg( 'p', absint( $post_id ), $link );
+ /*
+ // I toyed with this, but decided against it. Leaving it in here in case anyone thinks it is a good idea. ~ Mark
+ if ( !empty( $_REQUEST['s'] ) )
+ $link = add_query_arg( 's', esc_attr( stripslashes( $_REQUEST['s'] ) ), $link );
+ */
+ $status_links[$status] = "" . sprintf(
+ translate_nooped_plural( $label, $num_comments->$status ),
+ number_format_i18n( $num_comments->$status )
+ ) . ' ';
+ }
+
+ $status_links = apply_filters( 'comment_status_links', $status_links );
+ return $status_links;
+ }
+
+ function get_bulk_actions() {
+ global $comment_status;
+
+ $actions = array();
+ if ( in_array( $comment_status, array( 'all', 'approved' ) ) )
+ $actions['unapprove'] = __( 'Unapprove' );
+ if ( in_array( $comment_status, array( 'all', 'moderated', 'spam' ) ) )
+ $actions['approve'] = __( 'Approve' );
+ if ( in_array( $comment_status, array( 'all', 'moderated', 'approved' ) ) )
+ $actions['spam'] = _x( 'Mark as Spam', 'comment' );
+
+ if ( 'trash' == $comment_status )
+ $actions['untrash'] = __( 'Restore' );
+ elseif ( 'spam' == $comment_status )
+ $actions['unspam'] = _x( 'Not Spam', 'comment' );
+
+ if ( in_array( $comment_status, array( 'trash', 'spam' ) ) || !EMPTY_TRASH_DAYS )
+ $actions['delete'] = __( 'Delete Permanently' );
+ else
+ $actions['trash'] = __( 'Move to Trash' );
+
+ return $actions;
+ }
+
+ function extra_tablenav( $which ) {
+ global $comment_status, $comment_type;
+?>
+
+
+
+
+ __( 'Comments' ),
+ 'pings' => __( 'Pings' ),
+ ) );
+
+ foreach ( $comment_types as $type => $label )
+ echo "\t$label \n";
+ ?>
+
+ 'post-query-submit' ) );
+ }
+
+ if ( ( 'spam' == $comment_status || 'trash' == $comment_status ) && current_user_can( 'moderate_comments' ) ) {
+ wp_nonce_field( 'bulk-destroy', '_destroy_nonce' );
+ $title = ( 'spam' == $comment_status ) ? esc_attr__( 'Empty Spam' ) : esc_attr__( 'Empty Trash' );
+ submit_button( $title, 'button-secondary apply', 'delete_all', false );
+ }
+ do_action( 'manage_comments_nav', $comment_status );
+ echo '
';
+ }
+
+ function current_action() {
+ if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) )
+ return 'delete_all';
+
+ return parent::current_action();
+ }
+
+ function get_columns() {
+ global $post_id;
+
+ $columns = array();
+
+ if ( $this->checkbox )
+ $columns['cb'] = ' ';
+
+ $columns['author'] = __( 'Author' );
+ $columns['comment'] = _x( 'Comment', 'column name' );
+
+ if ( !$post_id )
+ $columns['response'] = _x( 'In Response To', 'column name' );
+
+ return $columns;
+ }
+
+ function get_sortable_columns() {
+ return array(
+ 'author' => 'comment_author',
+ 'response' => 'comment_post_ID'
+ );
+ }
+
+ function display() {
+ extract( $this->_args );
+
+ wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
+
+ $this->display_tablenav( 'top' );
+
+?>
+
+
+
+ print_column_headers(); ?>
+
+
+
+
+
+ print_column_headers( false ); ?>
+
+
+
+
+
+
+
+display_tablenav( 'bottom' );
+ }
+
+ function single_row( $a_comment ) {
+ global $post, $comment, $the_comment_status;
+
+ $comment = $a_comment;
+ $the_comment_status = wp_get_comment_status( $comment->comment_ID );
+
+ $post = get_post( $comment->comment_post_ID );
+
+ $this->user_can = current_user_can( 'edit_comment', $comment->comment_ID );
+
+ echo "";
+ }
+
+ function column_cb( $comment ) {
+ if ( $this->user_can )
+ echo " ";
+ }
+
+ function column_comment( $comment ) {
+ global $post, $comment_status, $the_comment_status;
+
+ $user_can = $this->user_can;
+
+ $comment_url = esc_url( get_comment_link( $comment->comment_ID ) );
+
+ $ptime = date( 'G', strtotime( $comment->comment_date ) );
+ if ( ( abs( time() - $ptime ) ) < 86400 )
+ $ptime = sprintf( __( '%s ago' ), human_time_diff( $ptime ) );
+ else
+ $ptime = mysql2date( __( 'Y/m/d \a\t g:i A' ), $comment->comment_date );
+
+ if ( $user_can ) {
+ $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) );
+ $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) );
+
+ $url = "comment.php?c=$comment->comment_ID";
+
+ $approve_url = esc_url( $url . "&action=approvecomment&$approve_nonce" );
+ $unapprove_url = esc_url( $url . "&action=unapprovecomment&$approve_nonce" );
+ $spam_url = esc_url( $url . "&action=spamcomment&$del_nonce" );
+ $unspam_url = esc_url( $url . "&action=unspamcomment&$del_nonce" );
+ $trash_url = esc_url( $url . "&action=trashcomment&$del_nonce" );
+ $untrash_url = esc_url( $url . "&action=untrashcomment&$del_nonce" );
+ $delete_url = esc_url( $url . "&action=deletecomment&$del_nonce" );
+ }
+
+ echo '';
+ /* translators: 2: comment date, 3: comment time */
+ printf( __( 'Submitted on
%2$s at %3$s ' ), $comment_url,
+ /* translators: comment date format. See http://php.net/date */ get_comment_date( __( 'Y/m/d' ) ),
+ /* translators: comment time format. See http://php.net/date */ get_comment_date( get_option( 'time_format' ) ) );
+
+ if ( $comment->comment_parent ) {
+ $parent = get_comment( $comment->comment_parent );
+ $parent_link = esc_url( get_comment_link( $comment->comment_parent ) );
+ $name = get_comment_author( $parent->comment_ID );
+ printf( ' | '.__( 'In reply to
%2$s .' ), $parent_link, $name );
+ }
+
+ echo '
';
+ comment_text();
+ if ( $user_can ) { ?>
+
+ '', 'unapprove' => '',
+ 'reply' => '',
+ 'quickedit' => '',
+ 'edit' => '',
+ 'spam' => '', 'unspam' => '',
+ 'trash' => '', 'untrash' => '', 'delete' => ''
+ );
+
+ if ( $comment_status && 'all' != $comment_status ) { // not looking at all comments
+ if ( 'approved' == $the_comment_status )
+ $actions['unapprove'] = "';
+ else if ( 'unapproved' == $the_comment_status )
+ $actions['approve'] = "';
+ } else {
+ $actions['approve'] = "';
+ $actions['unapprove'] = "';
+ }
+
+ if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) {
+ $actions['spam'] = "';
+ } elseif ( 'spam' == $the_comment_status ) {
+ $actions['unspam'] = "';
+ } elseif ( 'trash' == $the_comment_status ) {
+ $actions['untrash'] = "';
+ }
+
+ if ( 'spam' == $the_comment_status || 'trash' == $the_comment_status || !EMPTY_TRASH_DAYS ) {
+ $actions['delete'] = "';
+ } else {
+ $actions['trash'] = "';
+ }
+
+ if ( 'trash' != $the_comment_status ) {
+ $actions['edit'] = "". __( 'Edit' ) . ' ';
+ $actions['quickedit'] = '' . __( 'Quick Edit' ) . ' ';
+ if ( 'spam' != $the_comment_status )
+ $actions['reply'] = '' . __( 'Reply' ) . ' ';
+ }
+
+ $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment );
+
+ $i = 0;
+ echo '';
+ foreach ( $actions as $action => $link ) {
+ ++$i;
+ ( ( ( 'approve' == $action || 'unapprove' == $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
+
+ // Reply and quickedit need a hide-if-no-js span when not added with ajax
+ if ( ( 'reply' == $action || 'quickedit' == $action ) && ! defined('DOING_AJAX') )
+ $action .= ' hide-if-no-js';
+ elseif ( ( $action == 'untrash' && $the_comment_status == 'trash' ) || ( $action == 'unspam' && $the_comment_status == 'spam' ) ) {
+ if ( '1' == get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ) )
+ $action .= ' approve';
+ else
+ $action .= ' unapprove';
+ }
+
+ echo "$sep$link ";
+ }
+ echo '
';
+ }
+ }
+
+ function column_author( $comment ) {
+ global $comment_status;
+
+ $author_url = get_comment_author_url();
+ if ( 'http://' == $author_url )
+ $author_url = '';
+ $author_url_display = preg_replace( '|http://(www\.)?|i', '', $author_url );
+ if ( strlen( $author_url_display ) > 50 )
+ $author_url_display = substr( $author_url_display, 0, 49 ) . '...';
+
+ echo ""; comment_author(); echo ' ';
+ if ( !empty( $author_url ) )
+ echo "$author_url_display ";
+
+ if ( $this->user_can ) {
+ if ( !empty( $comment->comment_author_email ) ) {
+ comment_author_email_link();
+ echo ' ';
+ }
+ echo '';
+ comment_author_IP();
+ echo ' ';
+ }
+ }
+
+ function column_date( $comment ) {
+ return get_comment_date( __( 'Y/m/d \a\t g:ia' ) );
+ }
+
+ function column_response( $comment ) {
+ global $post;
+
+ if ( isset( $this->pending_count[$post->ID] ) ) {
+ $pending_comments = $this->pending_count[$post->ID];
+ } else {
+ $_pending_count_temp = get_pending_comments_num( array( $post->ID ) );
+ $pending_comments = $this->pending_count[$post->ID] = $_pending_count_temp[$post->ID];
+ }
+
+ if ( current_user_can( 'edit_post', $post->ID ) ) {
+ $post_link = "";
+ $post_link .= get_the_title( $post->ID ) . ' ';
+ } else {
+ $post_link = get_the_title( $post->ID );
+ }
+
+ echo '';
+ echo $post_link . ' ';
+ $this->comments_bubble( $post->ID, $pending_comments );
+ echo ' ';
+ echo "
# ";
+ echo '
';
+ if ( 'attachment' == $post->post_type && ( $thumb = wp_get_attachment_image( $post->ID, array( 80, 60 ), true ) ) )
+ echo $thumb;
+ }
+
+ function column_default( $comment, $column_name ) {
+ do_action( 'manage_comments_custom_column', $column_name, $comment->comment_ID );
+ }
+}
+
+/**
+ * Post Comments List Table class.
+ *
+ * @package WordPress
+ * @subpackage List_Table
+ * @since 3.1.0
+ * @access private
+ *
+ * @see WP_Comments_Table
+ */
+class WP_Post_Comments_List_Table extends WP_Comments_List_Table {
+
+ function get_column_info() {
+ $this->_column_headers = array(
+ array(
+ 'author' => __( 'Author' ),
+ 'comment' => _x( 'Comment', 'column name' ),
+ ),
+ array(),
+ array(),
+ );
+
+ return $this->_column_headers;
+ }
+
+ function get_table_classes() {
+ $classes = parent::get_table_classes();
+ $classes[] = 'comments-box';
+ return $classes;
+ }
+
+ function display( $output_empty = false ) {
+ extract( $this->_args );
+
+ wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
+?>
+
+
diff --git a/wp-admin/includes/class-wp-filesystem-direct.php b/wp-admin/includes/class-wp-filesystem-direct.php
index 538a683e..94319bce 100644
--- a/wp-admin/includes/class-wp-filesystem-direct.php
+++ b/wp-admin/includes/class-wp-filesystem-direct.php
@@ -19,7 +19,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
/**
* constructor
*
- * @param $arg mixed ingored argument
+ * @param mixed $arg ingored argument
*/
function WP_Filesystem_Direct($arg) {
$this->method = 'direct';
@@ -36,7 +36,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
/**
* Reads entire file into a string
*
- * @param $file string Name of the file to read.
+ * @param string $file Name of the file to read.
* @return string|bool The function returns the read data or false on failure.
*/
function get_contents($file) {
@@ -45,7 +45,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
/**
* Reads entire file into an array
*
- * @param $file string Path to the file.
+ * @param string $file Path to the file.
* @return array|bool the file contents in an array or false on failure.
*/
function get_contents_array($file) {
@@ -54,9 +54,9 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
/**
* Write a string to a file
*
- * @param $file string Remote path to the file where to write the data.
- * @param $contents string The data to write.
- * @param $mode int (optional) The file permissions as octal number, usually 0644.
+ * @param string $file Remote path to the file where to write the data.
+ * @param string $contents The data to write.
+ * @param int $mode (optional) The file permissions as octal number, usually 0644.
* @return bool False upon failure.
*/
function put_contents($file, $contents, $mode = false ) {
@@ -78,7 +78,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
/**
* Change directory
*
- * @param $dir string The new current directory.
+ * @param string $dir The new current directory.
* @return bool Returns true on success or false on failure.
*/
function chdir($dir) {
@@ -87,9 +87,9 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
/**
* Changes file group
*
- * @param $file string Path to the file.
- * @param $group mixed A group name or number.
- * @param $recursive bool (optional) If set True changes file group recursivly. Defaults to False.
+ * @param string $file Path to the file.
+ * @param mixed $group A group name or number.
+ * @param bool $recursive (optional) If set True changes file group recursivly. Defaults to False.
* @return bool Returns true on success or false on failure.
*/
function chgrp($file, $group, $recursive = false) {
@@ -110,9 +110,9 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
/**
* Changes filesystem permissions
*
- * @param $file string Path to the file.
- * @param $mode int (optional) The permissions as octal number, usually 0644 for files, 0755 for dirs.
- * @param $recursive bool (optional) If set True changes file group recursivly. Defaults to False.
+ * @param string $file Path to the file.
+ * @param int $mode (optional) The permissions as octal number, usually 0644 for files, 0755 for dirs.
+ * @param bool $recursive (optional) If set True changes file group recursivly. Defaults to False.
* @return bool Returns true on success or false on failure.
*/
function chmod($file, $mode = false, $recursive = false) {
@@ -138,9 +138,9 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
/**
* Changes file owner
*
- * @param $file string Path to the file.
- * @param $owner mixed A user name or number.
- * @param $recursive bool (optional) If set True changes file owner recursivly. Defaults to False.
+ * @param string $file Path to the file.
+ * @param mixed $owner A user name or number.
+ * @param bool $recursive (optional) If set True changes file owner recursivly. Defaults to False.
* @return bool Returns true on success or false on failure.
*/
function chown($file, $owner, $recursive = false) {
@@ -160,7 +160,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
/**
* Gets file owner
*
- * @param $file string Path to the file.
+ * @param string $file Path to the file.
* @return string Username of the user.
*/
function owner($file) {
@@ -177,7 +177,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
*
* FIXME does not handle errors in fileperms()
*
- * @param $file string Path to the file.
+ * @param string $file Path to the file.
* @return string Mode of the file (last 4 digits).
*/
function getchmod($file) {
diff --git a/wp-admin/includes/class-wp-links-list-table.php b/wp-admin/includes/class-wp-links-list-table.php
new file mode 100644
index 00000000..bf1c0bc6
--- /dev/null
+++ b/wp-admin/includes/class-wp-links-list-table.php
@@ -0,0 +1,186 @@
+ 'bookmarks',
+ ) );
+ }
+
+ function ajax_user_can() {
+ return current_user_can( 'manage_links' );
+ }
+
+ function prepare_items() {
+ global $cat_id, $s, $orderby, $order;
+
+ wp_reset_vars( array( 'action', 'cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'orderby', 'order', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]', 's' ) );
+
+ $args = array( 'hide_invisible' => 0, 'hide_empty' => 0 );
+
+ if ( 'all' != $cat_id )
+ $args['category'] = $cat_id;
+ if ( !empty( $s ) )
+ $args['search'] = $s;
+ if ( !empty( $orderby ) )
+ $args['orderby'] = $orderby;
+ if ( !empty( $order ) )
+ $args['order'] = $order;
+
+ $this->items = get_bookmarks( $args );
+ }
+
+ function no_items() {
+ _e( 'No links found.' );
+ }
+
+ function get_bulk_actions() {
+ $actions = array();
+ $actions['delete'] = __( 'Delete' );
+
+ return $actions;
+ }
+
+ function extra_tablenav( $which ) {
+ global $cat_id;
+
+ if ( 'top' != $which )
+ return;
+?>
+
+ $cat_id,
+ 'name' => 'cat_id',
+ 'taxonomy' => 'link_category',
+ 'show_option_all' => __( 'View all categories' ),
+ 'hide_empty' => true,
+ 'hierarchical' => 1,
+ 'show_count' => 0,
+ 'orderby' => 'name',
+ );
+ wp_dropdown_categories( $dropdown_options );
+ submit_button( __( 'Filter' ), 'secondary', false, false, array( 'id' => 'post-query-submit' ) );
+?>
+
+ ' ',
+ 'name' => __( 'Name' ),
+ 'url' => __( 'URL' ),
+ 'categories' => __( 'Categories' ),
+ 'rel' => __( 'Relationship' ),
+ 'visible' => __( 'Visible' ),
+ 'rating' => __( 'Rating' )
+ );
+ }
+
+ function get_sortable_columns() {
+ return array(
+ 'name' => 'name',
+ 'url' => 'url',
+ 'visible' => 'visible',
+ 'rating' => 'rating'
+ );
+ }
+
+ function display_rows() {
+ global $cat_id;
+
+ $alt = 0;
+
+ foreach ( $this->items as $link ) {
+ $link = sanitize_bookmark( $link );
+ $link->link_name = esc_attr( $link->link_name );
+ $link->link_category = wp_get_link_cats( $link->link_id );
+
+ $short_url = url_shorten( $link->link_url );
+
+ $visible = ( $link->link_visible == 'Y' ) ? __( 'Yes' ) : __( 'No' );
+ $rating = $link->link_rating;
+ $style = ( $alt++ % 2 ) ? '' : ' class="alternate"';
+
+ $edit_link = get_edit_bookmark_link( $link );
+?>
+ >
+get_column_info();
+
+ foreach ( $columns as $column_name => $column_display_name ) {
+ $class = "class='column-$column_name'";
+
+ $style = '';
+ if ( in_array( $column_name, $hidden ) )
+ $style = ' style="display:none;"';
+
+ $attributes = $class . $style;
+
+ switch ( $column_name ) {
+ case 'cb':
+ echo ' ';
+ break;
+
+ case 'name':
+ echo "link_name ) ) . "'>$link->link_name ";
+
+ $actions = array();
+ $actions['edit'] = '' . __( 'Edit' ) . ' ';
+ $actions['delete'] = "link_id ) . "' onclick=\"if ( confirm( '" . esc_js( sprintf( __( "You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete." ), $link->link_name ) ) . "' ) ) { return true;}return false;\">" . __( 'Delete' ) . " ";
+ echo $this->row_actions( $actions );
+
+ echo ' ';
+ break;
+ case 'url':
+ echo "link_name ) )."'>$short_url ";
+ break;
+ case 'categories':
+ ?>>link_category as $category ) {
+ $cat = get_term( $category, 'link_category', OBJECT, 'display' );
+ if ( is_wp_error( $cat ) )
+ echo $cat->get_error_message();
+ $cat_name = $cat->name;
+ if ( $cat_id != $category )
+ $cat_name = "$cat_name ";
+ $cat_names[] = $cat_name;
+ }
+ echo implode( ', ', $cat_names );
+ ?> >link_rel ) ? ' ' : $link->link_rel; ?> > >
+ >link_id ); ?>
+
+
+
diff --git a/wp-admin/includes/class-wp-list-table.php b/wp-admin/includes/class-wp-list-table.php
new file mode 100644
index 00000000..1d80a7ba
--- /dev/null
+++ b/wp-admin/includes/class-wp-list-table.php
@@ -0,0 +1,894 @@
+ '',
+ 'singular' => '',
+ 'ajax' => false
+ ) );
+
+ $screen = get_current_screen();
+
+ add_filter( "manage_{$screen->id}_columns", array( &$this, 'get_columns' ), 0 );
+
+ if ( !$args['plural'] )
+ $args['plural'] = $screen->base;
+
+ $this->_args = $args;
+
+ if ( $args['ajax'] ) {
+ // wp_enqueue_script( 'list-table' );
+ add_action( 'admin_footer', array( &$this, '_js_vars' ) );
+ }
+ }
+
+ /**
+ * Checks the current user's permissions
+ * @uses wp_die()
+ *
+ * @since 3.1.0
+ * @access public
+ * @abstract
+ */
+ function ajax_user_can() {
+ die( 'function WP_List_Table::ajax_user_can() must be over-ridden in a sub-class.' );
+ }
+
+ /**
+ * Prepares the list of items for displaying.
+ * @uses WP_List_Table::set_pagination_args()
+ *
+ * @since 3.1.0
+ * @access public
+ * @abstract
+ */
+ function prepare_items() {
+ die( 'function WP_List_Table::prepare_items() must be over-ridden in a sub-class.' );
+ }
+
+ /**
+ * An internal method that sets all the necessary pagination arguments
+ *
+ * @param array $args An associative array with information about the pagination
+ * @access protected
+ */
+ function set_pagination_args( $args ) {
+ $args = wp_parse_args( $args, array(
+ 'total_items' => 0,
+ 'total_pages' => 0,
+ 'per_page' => 0,
+ ) );
+
+ if ( !$args['total_pages'] && $args['per_page'] > 0 )
+ $args['total_pages'] = ceil( $args['total_items'] / $args['per_page'] );
+
+ $this->_pagination_args = $args;
+ }
+
+ /**
+ * Access the pagination args
+ *
+ * @since 3.1.0
+ * @access public
+ *
+ * @param string $key
+ * @return array
+ */
+ function get_pagination_arg( $key ) {
+ if ( 'page' == $key )
+ return $this->get_pagenum();
+
+ if ( isset( $this->_pagination_args[$key] ) )
+ return $this->_pagination_args[$key];
+ }
+
+ /**
+ * Whether the table has items to display or not
+ *
+ * @since 3.1.0
+ * @access public
+ *
+ * @return bool
+ */
+ function has_items() {
+ return !empty( $this->items );
+ }
+
+ /**
+ * Message to be displayed when there are no items
+ *
+ * @since 3.1.0
+ * @access public
+ */
+ function no_items() {
+ _e( 'No items found.' );
+ }
+
+ /**
+ * Display the search box.
+ *
+ * @since 3.1.0
+ * @access public
+ *
+ * @param string $text The search button text
+ * @param string $input_id The search input id
+ */
+ function search_box( $text, $input_id ) {
+ if ( empty( $_REQUEST['s'] ) && !$this->has_items() )
+ return;
+
+ $input_id = $input_id . '-search-input';
+
+ if ( ! empty( $_REQUEST['orderby'] ) )
+ echo ' ';
+ if ( ! empty( $_REQUEST['order'] ) )
+ echo ' ';
+?>
+
+ :
+
+ 'search-submit') ); ?>
+
+ link ) with the list
+ * of views available on this table.
+ *
+ * @since 3.1.0
+ * @access protected
+ *
+ * @return array
+ */
+ function get_views() {
+ return array();
+ }
+
+ /**
+ * Display the bulk actions dropdown.
+ *
+ * @since 3.1.0
+ * @access public
+ */
+ function views() {
+ $screen = get_current_screen();
+
+ $views = $this->get_views();
+ $views = apply_filters( 'views_' . $screen->id, $views );
+
+ if ( empty( $views ) )
+ return;
+
+ echo "\n";
+ foreach ( $views as $class => $view ) {
+ $views[ $class ] = "\t$view";
+ }
+ echo implode( " | \n", $views ) . "\n";
+ echo " ";
+ }
+
+ /**
+ * Get an associative array ( option_name => option_title ) with the list
+ * of bulk actions available on this table.
+ *
+ * @since 3.1.0
+ * @access protected
+ *
+ * @return array
+ */
+ function get_bulk_actions() {
+ return array();
+ }
+
+ /**
+ * Display the bulk actions dropdown.
+ *
+ * @since 3.1.0
+ * @access public
+ */
+ function bulk_actions() {
+ $screen = get_current_screen();
+
+ if ( is_null( $this->_actions ) ) {
+ $no_new_actions = $this->_actions = $this->get_bulk_actions();
+ // This filter can currently only be used to remove actions.
+ $this->_actions = apply_filters( 'bulk_actions-' . $screen->id, $this->_actions );
+ $this->_actions = array_intersect_assoc( $this->_actions, $no_new_actions );
+ $two = '';
+ } else {
+ $two = '2';
+ }
+
+ if ( empty( $this->_actions ) )
+ return;
+
+ echo "\n";
+ echo "" . __( 'Bulk Actions' ) . " \n";
+ foreach ( $this->_actions as $name => $title )
+ echo "\t$title \n";
+ echo " \n";
+
+ submit_button( __( 'Apply' ), 'button-secondary action', false, false, array( 'id' => "doaction$two" ) );
+ echo "\n";
+ }
+
+ /**
+ * Get the current action selected from the bulk actions dropdown.
+ *
+ * @since 3.1.0
+ * @access public
+ *
+ * @return string|bool The action name or False if no action was selected
+ */
+ function current_action() {
+ if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] )
+ return $_REQUEST['action'];
+
+ if ( isset( $_REQUEST['action2'] ) && -1 != $_REQUEST['action2'] )
+ return $_REQUEST['action2'];
+
+ return false;
+ }
+
+ /**
+ * Generate row actions div
+ *
+ * @since 3.1.0
+ * @access protected
+ *
+ * @param array $actions The list of actions
+ * @param bool $always_visible Wether the actions should be always visible
+ * @return string
+ */
+ function row_actions( $actions, $always_visible = false ) {
+ $action_count = count( $actions );
+ $i = 0;
+
+ if ( !$action_count )
+ return '';
+
+ $out = '';
+ foreach ( $actions as $action => $link ) {
+ ++$i;
+ ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
+ $out .= "$link$sep ";
+ }
+ $out .= '
';
+
+ return $out;
+ }
+
+ /**
+ * Display a monthly dropdown for filtering items
+ *
+ * @since 3.1.0
+ * @access protected
+ */
+ function months_dropdown( $post_type ) {
+ global $wpdb, $wp_locale;
+
+ $months = $wpdb->get_results( $wpdb->prepare( "
+ SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
+ FROM $wpdb->posts
+ WHERE post_type = %s
+ ORDER BY post_date DESC
+ ", $post_type ) );
+
+ $month_count = count( $months );
+
+ if ( !$month_count || ( 1 == $month_count && 0 == $months[0]->month ) )
+ return;
+
+ $m = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0;
+?>
+
+ value='0'>
+year )
+ continue;
+
+ $month = zeroise( $arc_row->month, 2 );
+ $year = $arc_row->year;
+
+ printf( "%s \n",
+ selected( $m, $year . $month, false ),
+ esc_attr( $arc_row->year . $month ),
+ $wp_locale->get_month( $month ) . " $year"
+ );
+ }
+?>
+
+ __( 'List View' ),
+ 'excerpt' => __( 'Excerpt View' )
+ );
+
+?>
+
+
+ $title ) {
+ $class = ( $current_mode == $mode ) ? 'class="current"' : '';
+ echo "
\n";
+ }
+ ?>
+
+';
+
+ echo " ";
+
+ if ( $pending_comments )
+ echo '';
+ }
+
+ /**
+ * Get the current page number
+ *
+ * @since 3.1.0
+ * @access protected
+ *
+ * @return int
+ */
+ function get_pagenum() {
+ $pagenum = isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 0;
+
+ if( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] )
+ $pagenum = $this->_pagination_args['total_pages'];
+
+ return max( 1, $pagenum );
+ }
+
+ /**
+ * Get number of items to display on a single page
+ *
+ * @since 3.1.0
+ * @access protected
+ *
+ * @return int
+ */
+ function get_items_per_page( $option, $default = 20 ) {
+ $per_page = (int) get_user_option( $option );
+ if ( empty( $per_page ) || $per_page < 1 )
+ $per_page = $default;
+
+ return (int) apply_filters( $option, $per_page );
+ }
+
+ /**
+ * Display the pagination.
+ *
+ * @since 3.1.0
+ * @access protected
+ */
+ function pagination( $which ) {
+ if ( empty( $this->_pagination_args ) )
+ return;
+
+ extract( $this->_pagination_args );
+
+ $output = '' . sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) ) . ' ';
+
+ $current = $this->get_pagenum();
+
+ $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
+
+ $current_url = remove_query_arg( array( 'hotkeys_highlight_last', 'hotkeys_highlight_first' ), $current_url );
+
+ $page_links = array();
+
+ $disable_first = $disable_last = '';
+ if ( $current == 1 )
+ $disable_first = ' disabled';
+ if ( $current == $total_pages )
+ $disable_last = ' disabled';
+
+ $page_links[] = sprintf( "%s ",
+ 'first-page' . $disable_first,
+ esc_attr__( 'Go to the first page' ),
+ esc_url( remove_query_arg( 'paged', $current_url ) ),
+ '«'
+ );
+
+ $page_links[] = sprintf( "%s ",
+ 'prev-page' . $disable_first,
+ esc_attr__( 'Go to the previous page' ),
+ esc_url( add_query_arg( 'paged', max( 1, $current-1 ), $current_url ) ),
+ '‹'
+ );
+
+ if ( 'bottom' == $which )
+ $html_current_page = $current;
+ else
+ $html_current_page = sprintf( " ",
+ esc_attr__( 'Current page' ),
+ esc_attr( 'paged' ),
+ $current,
+ strlen( $total_pages )
+ );
+
+ $html_total_pages = sprintf( "%s ", number_format_i18n( $total_pages ) );
+ $page_links[] = '' . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . ' ';
+
+ $page_links[] = sprintf( "%s ",
+ 'next-page' . $disable_last,
+ esc_attr__( 'Go to the next page' ),
+ esc_url( add_query_arg( 'paged', min( $total_pages, $current+1 ), $current_url ) ),
+ '›'
+ );
+
+ $page_links[] = sprintf( "%s ",
+ 'last-page' . $disable_last,
+ esc_attr__( 'Go to the last page' ),
+ esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
+ '»'
+ );
+
+ $output .= "\n" . join( "\n", $page_links );
+
+ $page_class = $total_pages < 2 ? ' one-page' : '';
+
+ $this->_pagination = "$output
";
+
+ echo $this->_pagination;
+ }
+
+ /**
+ * Get a list of columns. The format is:
+ * 'internal-name' => 'Title'
+ *
+ * @since 3.1.0
+ * @access protected
+ * @abstract
+ *
+ * @return array
+ */
+ function get_columns() {
+ die( 'function WP_List_Table::get_columns() must be over-ridden in a sub-class.' );
+ }
+
+ /**
+ * Get a list of sortable columns. The format is:
+ * 'internal-name' => 'orderby'
+ * or
+ * 'internal-name' => array( 'orderby', true )
+ *
+ * The second format will make the initial sorting order be descending
+ *
+ * @since 3.1.0
+ * @access protected
+ *
+ * @return array
+ */
+ function get_sortable_columns() {
+ return array();
+ }
+
+ /**
+ * Get a list of all, hidden and sortable columns, with filter applied
+ *
+ * @since 3.1.0
+ * @access protected
+ *
+ * @return array
+ */
+ function get_column_info() {
+ if ( isset( $this->_column_headers ) )
+ return $this->_column_headers;
+
+ $screen = get_current_screen();
+
+ $columns = get_column_headers( $screen );
+ $hidden = get_hidden_columns( $screen );
+
+ $_sortable = apply_filters( "manage_{$screen->id}_sortable_columns", $this->get_sortable_columns() );
+
+ $sortable = array();
+ foreach ( $_sortable as $id => $data ) {
+ if ( empty( $data ) )
+ continue;
+
+ $data = (array) $data;
+ if ( !isset( $data[1] ) )
+ $data[1] = false;
+
+ $sortable[$id] = $data;
+ }
+
+ $this->_column_headers = array( $columns, $hidden, $sortable );
+
+ return $this->_column_headers;
+ }
+
+ /**
+ * Return number of visible columns
+ *
+ * @since 3.1.0
+ * @access public
+ *
+ * @return int
+ */
+ function get_column_count() {
+ list ( $columns, $hidden ) = $this->get_column_info();
+ $hidden = array_intersect( array_keys( $columns ), array_filter( $hidden ) );
+ return count( $columns ) - count( $hidden );
+ }
+
+ /**
+ * Print column headers, accounting for hidden and sortable columns.
+ *
+ * @since 3.1.0
+ * @access protected
+ *
+ * @param bool $with_id Whether to set the id attribute or not
+ */
+ function print_column_headers( $with_id = true ) {
+ $screen = get_current_screen();
+
+ list( $columns, $hidden, $sortable ) = $this->get_column_info();
+
+ $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
+ $current_url = remove_query_arg( 'paged', $current_url );
+
+ if ( isset( $_GET['orderby'] ) )
+ $current_orderby = $_GET['orderby'];
+ else
+ $current_orderby = '';
+
+ if ( isset( $_GET['order'] ) && 'desc' == $_GET['order'] )
+ $current_order = 'desc';
+ else
+ $current_order = 'asc';
+
+ foreach ( $columns as $column_key => $column_display_name ) {
+ $class = array( 'manage-column', "column-$column_key" );
+
+ $style = '';
+ if ( in_array( $column_key, $hidden ) )
+ $style = 'display:none;';
+
+ $style = ' style="' . $style . '"';
+
+ if ( 'cb' == $column_key )
+ $class[] = 'check-column';
+ elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ) ) )
+ $class[] = 'num';
+
+ if ( isset( $sortable[$column_key] ) ) {
+ list( $orderby, $desc_first ) = $sortable[$column_key];
+
+ if ( $current_orderby == $orderby ) {
+ $order = 'asc' == $current_order ? 'desc' : 'asc';
+ $class[] = 'sorted';
+ $class[] = $current_order;
+ } else {
+ $order = $desc_first ? 'desc' : 'asc';
+ $class[] = 'sortable';
+ $class[] = $desc_first ? 'asc' : 'desc';
+ }
+
+ $column_display_name = '' . $column_display_name . ' ';
+ }
+
+ $id = $with_id ? "id='$column_key'" : '';
+
+ if ( !empty( $class ) )
+ $class = "class='" . join( ' ', $class ) . "'";
+
+ echo "$column_display_name ";
+ }
+ }
+
+ /**
+ * Display the table
+ *
+ * @since 3.1.0
+ * @access public
+ */
+ function display() {
+ extract( $this->_args );
+
+ $this->display_tablenav( 'top' );
+
+?>
+
+
+
+ print_column_headers(); ?>
+
+
+
+
+
+ print_column_headers( false ); ?>
+
+
+
+ >
+ display_rows_or_placeholder(); ?>
+
+
+display_tablenav( 'bottom' );
+ }
+
+ /**
+ * Get a list of CSS classes for the tag
+ *
+ * @since 3.1.0
+ * @access protected
+ *
+ * @return array
+ */
+ function get_table_classes() {
+ return array( 'widefat', 'fixed', $this->_args['plural'] );
+ }
+
+ /**
+ * Generate the table navigation above or below the table
+ *
+ * @since 3.1.0
+ * @access protected
+ */
+ function display_tablenav( $which ) {
+ if ( 'top' == $which )
+ wp_nonce_field( 'bulk-' . $this->_args['plural'] );
+?>
+
+
+
+ bulk_actions( $which ); ?>
+
+extra_tablenav( $which );
+ $this->pagination( $which );
+?>
+
+
+
+ part of the table
+ *
+ * @since 3.1.0
+ * @access protected
+ */
+ function display_rows_or_placeholder() {
+ if ( $this->has_items() ) {
+ $this->display_rows();
+ } else {
+ list( $columns, $hidden ) = $this->get_column_info();
+ echo '';
+ $this->no_items();
+ echo ' ';
+ }
+ }
+
+ /**
+ * Generate the table rows
+ *
+ * @since 3.1.0
+ * @access protected
+ */
+ function display_rows() {
+ foreach ( $this->items as $item )
+ $this->single_row( $item );
+ }
+
+ /**
+ * Generates content for a single row of the table
+ *
+ * @since 3.1.0
+ * @access protected
+ *
+ * @param object $item The current item
+ */
+ function single_row( $item ) {
+ static $row_class = '';
+ $row_class = ( $row_class == '' ? ' class="alternate"' : '' );
+
+ echo '';
+ echo $this->single_row_columns( $item );
+ echo ' ';
+ }
+
+ /**
+ * Generates the columns for a single row of the table
+ *
+ * @since 3.1.0
+ * @access protected
+ *
+ * @param object $item The current item
+ */
+ function single_row_columns( $item ) {
+ list( $columns, $hidden ) = $this->get_column_info();
+
+ foreach ( $columns as $column_name => $column_display_name ) {
+ $class = "class='$column_name column-$column_name'";
+
+ $style = '';
+ if ( in_array( $column_name, $hidden ) )
+ $style = ' style="display:none;"';
+
+ $attributes = "$class$style";
+
+ if ( 'cb' == $column_name ) {
+ echo '';
+ echo $this->column_cb( $item );
+ echo ' ';
+ }
+ elseif ( method_exists( $this, 'column_' . $column_name ) ) {
+ echo "";
+ echo call_user_func( array( &$this, 'column_' . $column_name ), $item );
+ echo " ";
+ }
+ else {
+ echo "";
+ echo $this->column_default( $item, $column_name );
+ echo " ";
+ }
+ }
+ }
+
+ /**
+ * Handle an incoming ajax request (called from admin-ajax.php)
+ *
+ * @since 3.1.0
+ * @access public
+ */
+ function ajax_response() {
+ $this->prepare_items();
+
+ extract( $this->_args );
+ extract( $this->_pagination_args );
+
+ ob_start();
+ if ( ! empty( $_REQUEST['no_placeholder'] ) )
+ $this->display_rows();
+ else
+ $this->display_rows_or_placeholder();
+
+ $rows = ob_get_clean();
+
+ $response = array( 'rows' => $rows );
+
+ if ( isset( $total_items ) )
+ $response['total_items_i18n'] = sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) );
+
+ if ( isset( $total_pages ) ) {
+ $response['total_pages'] = $total_pages;
+ $response['total_pages_i18n'] = number_format_i18n( $total_pages );
+ }
+
+ die( json_encode( $response ) );
+ }
+
+ /**
+ * Send required variables to JavaScript land
+ *
+ * @access private
+ */
+ function _js_vars() {
+ $args = array(
+ 'class' => get_class( $this ),
+ 'screen' => get_current_screen()
+ );
+
+ printf( "\n", json_encode( $args ) );
+ }
+}
+?>
diff --git a/wp-admin/includes/class-wp-media-list-table.php b/wp-admin/includes/class-wp-media-list-table.php
new file mode 100644
index 00000000..5e05f01e
--- /dev/null
+++ b/wp-admin/includes/class-wp-media-list-table.php
@@ -0,0 +1,374 @@
+detached = isset( $_REQUEST['detached'] ) || isset( $_REQUEST['find_detached'] );
+
+ parent::WP_List_Table( array(
+ 'plural' => 'media'
+ ) );
+ }
+
+ function ajax_user_can() {
+ return current_user_can('upload_files');
+ }
+
+ function prepare_items() {
+ global $lost, $wpdb, $wp_query, $post_mime_types, $avail_post_mime_types;
+
+ $q = $_REQUEST;
+
+ if ( !empty( $lost ) )
+ $q['post__in'] = implode( ',', $lost );
+
+ list( $post_mime_types, $avail_post_mime_types ) = wp_edit_attachments_query( $q );
+
+ $this->is_trash = isset( $_REQUEST['status'] ) && 'trash' == $_REQUEST['status'];
+
+ $this->set_pagination_args( array(
+ 'total_items' => $wp_query->found_posts,
+ 'total_pages' => $wp_query->max_num_pages,
+ 'per_page' => $wp_query->query_vars['posts_per_page'],
+ ) );
+ }
+
+ function get_views() {
+ global $wpdb, $post_mime_types, $avail_post_mime_types;
+
+ $type_links = array();
+ $_num_posts = (array) wp_count_attachments();
+ $_total_posts = array_sum($_num_posts) - $_num_posts['trash'];
+ if ( !isset( $total_orphans ) )
+ $total_orphans = $wpdb->get_var( "SELECT COUNT( * ) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent < 1" );
+ $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
+ foreach ( $matches as $type => $reals )
+ foreach ( $reals as $real )
+ $num_posts[$type] = ( isset( $num_posts[$type] ) ) ? $num_posts[$type] + $_num_posts[$real] : $_num_posts[$real];
+
+ $class = ( empty($_GET['post_mime_type']) && !$this->detached && !isset($_GET['status']) ) ? ' class="current"' : '';
+ $type_links['all'] = "" . sprintf( _nx( 'All (%s) ', 'All (%s) ', $_total_posts, 'uploaded files' ), number_format_i18n( $_total_posts ) ) . ' ';
+ foreach ( $post_mime_types as $mime_type => $label ) {
+ $class = '';
+
+ if ( !wp_match_mime_types($mime_type, $avail_post_mime_types) )
+ continue;
+
+ if ( !empty($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type']) )
+ $class = ' class="current"';
+ if ( !empty( $num_posts[$mime_type] ) )
+ $type_links[$mime_type] = "" . sprintf( translate_nooped_plural( $label[2], $num_posts[$mime_type] ), number_format_i18n( $num_posts[$mime_type] )) . ' ';
+ }
+ $type_links['detached'] = 'detached ? ' class="current"' : '' ) . '>' . sprintf( _nx( 'Unattached (%s) ', 'Unattached (%s) ', $total_orphans, 'detached files' ), number_format_i18n( $total_orphans ) ) . ' ';
+
+ if ( !empty($_num_posts['trash']) )
+ $type_links['trash'] = '' . sprintf( _nx( 'Trash (%s) ', 'Trash (%s) ', $_num_posts['trash'], 'uploaded files' ), number_format_i18n( $_num_posts['trash'] ) ) . ' ';
+
+ return $type_links;
+ }
+
+ function get_bulk_actions() {
+ $actions = array();
+ $actions['delete'] = __( 'Delete Permanently' );
+ if ( $this->detached )
+ $actions['attach'] = __( 'Attach to a post' );
+
+ return $actions;
+ }
+
+ function extra_tablenav( $which ) {
+ global $post_type;
+ $post_type_obj = get_post_type_object( $post_type );
+?>
+
+detached && !$this->is_trash ) {
+ $this->months_dropdown( $post_type );
+
+ do_action( 'restrict_manage_posts' );
+ submit_button( __( 'Filter' ), 'secondary', false, false, array( 'id' => 'post-query-submit' ) );
+ }
+
+ if ( $this->detached ) {
+ submit_button( __( 'Scan for lost attachments' ), 'secondary', 'find_detached', false );
+ } elseif ( $this->is_trash && current_user_can( 'edit_others_posts' ) ) {
+ submit_button( __( 'Empty Trash' ), 'button-secondary apply', 'delete_all', false );
+ } ?>
+
+';
+ $posts_columns['icon'] = '';
+ /* translators: column name */
+ $posts_columns['title'] = _x( 'File', 'column name' );
+ $posts_columns['author'] = __( 'Author' );
+ //$posts_columns['tags'] = _x( 'Tags', 'column name' );
+ /* translators: column name */
+ if ( !$this->detached ) {
+ $posts_columns['parent'] = _x( 'Attached to', 'column name' );
+ $posts_columns['comments'] = ' ';
+ }
+ /* translators: column name */
+ $posts_columns['date'] = _x( 'Date', 'column name' );
+ $posts_columns = apply_filters( 'manage_media_columns', $posts_columns, $this->detached );
+
+ return $posts_columns;
+ }
+
+ function get_sortable_columns() {
+ return array(
+ 'title' => 'title',
+ 'author' => 'author',
+ 'parent' => 'parent',
+ 'comments' => 'comment_count',
+ 'date' => array( 'date', true ),
+ );
+ }
+
+ function display_rows() {
+ global $post, $id;
+
+ add_filter( 'the_title','esc_html' );
+ $alt = '';
+
+ while ( have_posts() ) : the_post();
+
+ if ( $this->is_trash && $post->post_status != 'trash'
+ || !$this->is_trash && $post->post_status == 'trash' )
+ continue;
+
+ $alt = ( 'alternate' == $alt ) ? '' : 'alternate';
+ $post_owner = ( get_current_user_id() == $post->post_author ) ? 'self' : 'other';
+ $att_title = _draft_or_post_title();
+?>
+ post_status ); ?>' valign="top">
+get_column_info();
+foreach ( $columns as $column_name => $column_display_name ) {
+ $class = "class='$column_name column-$column_name'";
+
+ $style = '';
+ if ( in_array( $column_name, $hidden ) )
+ $style = ' style="display:none;"';
+
+ $attributes = $class . $style;
+
+ switch ( $column_name ) {
+
+ case 'cb':
+?>
+ ID ) ) { ?>
+
+ >ID, array( 80, 60 ), true ) ) {
+ if ( $this->is_trash ) {
+ echo $thumb;
+ } else {
+?>
+
+
+
+
+
+
+
+ >is_trash ) echo $att_title; else { ?>
+
+ID ), $matches ) )
+ echo esc_html( strtoupper( $matches[1] ) );
+ else
+ echo strtoupper( str_replace( 'image/', '', get_post_mime_type() ) );
+?>
+
+row_actions( $this->_get_row_actions( $post, $att_title ) );
+?>
+
+
+ >
+
+ >slug'> " . esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'post_tag', 'display' ) ) . "";
+ echo join( ', ', $out );
+ } else {
+ _e( 'No Tags' );
+ }
+?>
+
+
+ >post_excerpt : ''; ?>
+post_date && 'date' == $column_name ) {
+ $t_time = $h_time = __( 'Unpublished' );
+ } else {
+ $t_time = get_the_time( __( 'Y/m/d g:i:s A' ) );
+ $m_time = $post->post_date;
+ $time = get_post_time( 'G', true, $post, false );
+ if ( ( abs( $t_diff = time() - $time ) ) < 86400 ) {
+ if ( $t_diff < 0 )
+ $h_time = sprintf( __( '%s from now' ), human_time_diff( $time ) );
+ else
+ $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
+ } else {
+ $h_time = mysql2date( __( 'Y/m/d' ), $m_time );
+ }
+ }
+?>
+ >
+post_parent > 0 ) {
+ if ( get_post( $post->post_parent ) ) {
+ $title =_draft_or_post_title( $post->post_parent );
+ }
+?>
+ >
+ ,
+
+
+
+ >
+
+
+ >
+
+ID );
+
+ $this->comments_bubble( $post->ID, $pending_comments );
+?>
+
+
+
+ >
+
+
+
+
+detached ) {
+ if ( current_user_can( 'edit_post', $post->ID ) )
+ $actions['edit'] = '' . __( 'Edit' ) . ' ';
+ if ( current_user_can( 'delete_post', $post->ID ) )
+ if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
+ $actions['trash'] = "ID ) . "'>" . __( 'Trash' ) . " ";
+ } else {
+ $delete_ays = !MEDIA_TRASH ? " onclick='return showNotice.warn();'" : '';
+ $actions['delete'] = "ID ) . "'>" . __( 'Delete Permanently' ) . " ";
+ }
+ $actions['view'] = '' . __( 'View' ) . ' ';
+ if ( current_user_can( 'edit_post', $post->ID ) )
+ $actions['attach'] = ''.__( 'Attach' ).' ';
+ }
+ else {
+ if ( current_user_can( 'edit_post', $post->ID ) && !$this->is_trash )
+ $actions['edit'] = '' . __( 'Edit' ) . ' ';
+ if ( current_user_can( 'delete_post', $post->ID ) ) {
+ if ( $this->is_trash )
+ $actions['untrash'] = "ID ) . "'>" . __( 'Restore' ) . " ";
+ elseif ( EMPTY_TRASH_DAYS && MEDIA_TRASH )
+ $actions['trash'] = "ID ) . "'>" . __( 'Trash' ) . " ";
+ if ( $this->is_trash || !EMPTY_TRASH_DAYS || !MEDIA_TRASH ) {
+ $delete_ays = ( !$this->is_trash && !MEDIA_TRASH ) ? " onclick='return showNotice.warn();'" : '';
+ $actions['delete'] = "ID ) . "'>" . __( 'Delete Permanently' ) . " ";
+ }
+ }
+ if ( !$this->is_trash ) {
+ $title =_draft_or_post_title( $post->post_parent );
+ $actions['view'] = '' . __( 'View' ) . ' ';
+ }
+ }
+
+ $actions = apply_filters( 'media_row_actions', $actions, $post, $this->detached );
+
+ return $actions;
+ }
+}
+
+?>
diff --git a/wp-admin/includes/class-wp-ms-sites-list-table.php b/wp-admin/includes/class-wp-ms-sites-list-table.php
new file mode 100644
index 00000000..c1bf68b6
--- /dev/null
+++ b/wp-admin/includes/class-wp-ms-sites-list-table.php
@@ -0,0 +1,340 @@
+ 'sites',
+ ) );
+ }
+
+ function ajax_user_can() {
+ return current_user_can( 'manage_sites' );
+ }
+
+ function prepare_items() {
+ global $s, $mode, $wpdb, $current_site;
+
+ $mode = ( empty( $_REQUEST['mode'] ) ) ? 'list' : $_REQUEST['mode'];
+
+ $per_page = $this->get_items_per_page( 'sites_network_per_page' );
+
+ $pagenum = $this->get_pagenum();
+
+ $s = isset( $_REQUEST['s'] ) ? stripslashes( trim( $_REQUEST[ 's' ] ) ) : '';
+ $wild = '';
+ if ( false !== strpos($s, '*') ) {
+ $wild = '%';
+ $s = trim($s, '*');
+ }
+
+ $like_s = esc_sql( like_escape( $s ) );
+
+ $large_network = false;
+ // If the network is large and a search is not being performed, show only the latest blogs with no paging in order
+ // to avoid expensive count queries.
+ if ( !$s && ( get_blog_count() >= 10000 ) ) {
+ if ( !isset($_REQUEST['orderby']) )
+ $_GET['orderby'] = $_REQUEST['orderby'] = '';
+ if ( !isset($_REQUEST['order']) )
+ $_GET['order'] = $_REQUEST['order'] = 'DESC';
+ $large_network = true;
+ }
+
+ $query = "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' ";
+
+ if ( empty($s) ) {
+ // Nothing to do.
+ } elseif ( preg_match('/^[0-9]+\./', $s) ) {
+ // IP address
+ $reg_blog_ids = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->registration_log} WHERE {$wpdb->registration_log}.IP LIKE ( '{$like_s}$wild' )" );
+
+ if ( !$reg_blog_ids )
+ $reg_blog_ids = array( 0 );
+
+ $query = "SELECT *
+ FROM {$wpdb->blogs}
+ WHERE site_id = '{$wpdb->siteid}'
+ AND {$wpdb->blogs}.blog_id IN (" . implode( ', ', $reg_blog_ids ) . ")";
+ } else {
+ if ( is_numeric($s) ) {
+ $query .= " AND ( {$wpdb->blogs}.blog_id = '{$like_s}' )";
+ } elseif ( is_subdomain_install() ) {
+ $blog_s = str_replace( '.' . $current_site->domain, '', $like_s );
+ $blog_s .= $wild . '.' . $current_site->domain;
+ $query .= " AND ( {$wpdb->blogs}.domain LIKE '$blog_s' ) ";
+ } else {
+ if ( $like_s != trim('/', $current_site->path) )
+ $blog_s = $current_site->path .= $like_s . $wild . '/';
+ else
+ $blog_s = $like_s;
+ $query .= " AND ( {$wpdb->blogs}.path LIKE '$blog_s' )";
+ }
+ }
+
+ $order_by = isset( $_REQUEST['orderby'] ) ? $_REQUEST['orderby'] : '';
+ if ( $order_by == 'registered' ) {
+ $query .= ' ORDER BY registered ';
+ } elseif ( $order_by == 'lastupdated' ) {
+ $query .= ' ORDER BY last_updated ';
+ } elseif ( $order_by == 'blogname' ) {
+ if ( is_subdomain_install() )
+ $query .= ' ORDER BY domain ';
+ else
+ $query .= ' ORDER BY path ';
+ } elseif ( $order_by == 'blog_id' ) {
+ $query .= ' ORDER BY blog_id ';
+ } else {
+ $order_by = null;
+ }
+
+ if ( isset( $order_by ) ) {
+ $order = ( isset( $_REQUEST['order'] ) && 'DESC' == strtoupper( $_REQUEST['order'] ) ) ? "DESC" : "ASC";
+ $query .= $order;
+ }
+
+ // Don't do an unbounded count on large networks
+ if ( ! $large_network )
+ $total = $wpdb->get_var( str_replace( 'SELECT *', 'SELECT COUNT( blog_id )', $query ) );
+
+ $query .= " LIMIT " . intval( ( $pagenum - 1 ) * $per_page ) . ", " . intval( $per_page );
+ $this->items = $wpdb->get_results( $query, ARRAY_A );
+
+ if ( $large_network )
+ $total = count($this->items);
+
+ $this->set_pagination_args( array(
+ 'total_items' => $total,
+ 'per_page' => $per_page,
+ ) );
+ }
+
+ function no_items() {
+ _e( 'No sites found.' );
+ }
+
+ function get_bulk_actions() {
+ $actions = array();
+ if ( current_user_can( 'delete_sites' ) )
+ $actions['delete'] = __( 'Delete' );
+ $actions['spam'] = _x( 'Mark as Spam', 'site' );
+ $actions['notspam'] = _x( 'Not Spam', 'site' );
+
+ return $actions;
+ }
+
+ function pagination( $which ) {
+ global $mode;
+
+ parent::pagination( $which );
+
+ if ( 'top' == $which )
+ $this->view_switcher( $mode );
+ }
+
+ function get_columns() {
+ $blogname_columns = ( is_subdomain_install() ) ? __( 'Domain' ) : __( 'Path' );
+ $sites_columns = array(
+ 'cb' => ' ',
+ 'blogname' => $blogname_columns,
+ 'lastupdated' => __( 'Last Updated' ),
+ 'registered' => _x( 'Registered', 'site' ),
+ 'users' => __( 'Users' )
+ );
+
+ if ( has_filter( 'wpmublogsaction' ) )
+ $sites_columns['plugins'] = __( 'Actions' );
+
+ $sites_columns = apply_filters( 'wpmu_blogs_columns', $sites_columns );
+
+ return $sites_columns;
+ }
+
+ function get_sortable_columns() {
+ return array(
+ 'blogname' => 'blogname',
+ 'lastupdated' => 'lastupdated',
+ 'registered' => 'blog_id',
+ );
+ }
+
+ function display_rows() {
+ global $current_site, $mode;
+
+ $status_list = array(
+ 'archived' => array( 'site-archived', __( 'Archived' ) ),
+ 'spam' => array( 'site-spammed', _x( 'Spam', 'site' ) ),
+ 'deleted' => array( 'site-deleted', __( 'Deleted' ) ),
+ 'mature' => array( 'site-mature', __( 'Mature' ) )
+ );
+
+ $class = '';
+ foreach ( $this->items as $blog ) {
+ $class = ( 'alternate' == $class ) ? '' : 'alternate';
+ reset( $status_list );
+
+ $blog_states = array();
+ foreach ( $status_list as $status => $col ) {
+ if ( get_blog_status( $blog['blog_id'], $status ) == 1 ) {
+ $class = $col[0];
+ $blog_states[] = $col[1];
+ }
+ }
+ $blog_state = '';
+ if ( ! empty( $blog_states ) ) {
+ $state_count = count( $blog_states );
+ $i = 0;
+ $blog_state .= ' - ';
+ foreach ( $blog_states as $state ) {
+ ++$i;
+ ( $i == $state_count ) ? $sep = '' : $sep = ', ';
+ $blog_state .= "$state$sep ";
+ }
+ }
+ echo "";
+
+ $blogname = ( is_subdomain_install() ) ? str_replace( '.'.$current_site->domain, '', $blog['domain'] ) : $blog['path'];
+
+ list( $columns, $hidden ) = $this->get_column_info();
+
+ foreach ( $columns as $column_name => $column_display_name ) {
+ $style = '';
+ if ( in_array( $column_name, $hidden ) )
+ $style = ' style="display:none;"';
+
+ switch ( $column_name ) {
+ case 'cb': ?>
+
+
+
+
+
+
+
+ "; ?>
+
+ ' . sprintf( _x( '%1$s – %2$s ', '%1$s: site name. %2$s: site tagline.' ), get_blog_option( $blog['blog_id'], 'blogname' ), get_blog_option( $blog['blog_id'], 'blogdescription ' ) ) . '';
+
+ // Preordered.
+ $actions = array(
+ 'edit' => '', 'backend' => '',
+ 'activate' => '', 'deactivate' => '',
+ 'archive' => '', 'unarchive' => '',
+ 'spam' => '', 'unspam' => '',
+ 'delete' => '',
+ 'visit' => '',
+ );
+
+ $actions['edit'] = '' . __( 'Edit' ) . ' ';
+ $actions['backend'] = "" . __( 'Dashboard' ) . ' ';
+ if ( $current_site->blog_id != $blog['blog_id'] ) {
+ if ( get_blog_status( $blog['blog_id'], 'deleted' ) == '1' )
+ $actions['activate'] = '' . __( 'Activate' ) . ' ';
+ else
+ $actions['deactivate'] = '' . __( 'Deactivate' ) . ' ';
+
+ if ( get_blog_status( $blog['blog_id'], 'archived' ) == '1' )
+ $actions['unarchive'] = '' . __( 'Unarchive' ) . ' ';
+ else
+ $actions['archive'] = '' . _x( 'Archive', 'verb; site' ) . ' ';
+
+ if ( get_blog_status( $blog['blog_id'], 'spam' ) == '1' )
+ $actions['unspam'] = '' . _x( 'Not Spam', 'site' ) . ' ';
+ else
+ $actions['spam'] = '' . _x( 'Spam', 'site' ) . ' ';
+
+ if ( current_user_can( 'delete_site', $blog['blog_id'] ) )
+ $actions['delete'] = '' . __( 'Delete' ) . ' ';
+ }
+
+ $actions['visit'] = "" . __( 'Visit' ) . ' ';
+
+ $actions = apply_filters( 'manage_sites_action_links', array_filter( $actions ), $blog['blog_id'], $blogname );
+ echo $this->row_actions( $actions );
+ ?>
+
+ ";
+ if ( 'list' == $mode )
+ $date = 'Y/m/d';
+ else
+ $date = 'Y/m/d \<\b\r \/\> g:i:s a';
+ echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __( 'Never' ) : mysql2date( $date, $blog['last_updated'] ); ?>
+
+ ";
+ if ( $blog['registered'] == '0000-00-00 00:00:00' )
+ echo '—';
+ else
+ echo mysql2date( $date, $blog['registered'] );
+ ?>
+
+ ";
+ $blogusers = get_users( array( 'blog_id' => $blog['blog_id'], 'number' => 6) );
+ if ( is_array( $blogusers ) ) {
+ $blogusers_warning = '';
+ if ( count( $blogusers ) > 5 ) {
+ $blogusers = array_slice( $blogusers, 0, 5 );
+ $blogusers_warning = __( 'Only showing first 5 users.' ) . ' ' . __( 'More' ) . ' ';
+ }
+ foreach ( $blogusers as $user_object ) {
+ echo '' . esc_html( $user_object->user_login ) . ' ';
+ if ( 'list' != $mode )
+ echo '( ' . $user_object->user_email . ' )';
+ echo ' ';
+ }
+ if ( $blogusers_warning != '' )
+ echo '' . $blogusers_warning . ' ';
+ }
+ ?>
+
+
+ ";
+ do_action( 'wpmublogsaction', $blog['blog_id'] ); ?>
+
+ ";
+ do_action( 'manage_sites_custom_column', $column_name, $blog['blog_id'] );
+ echo "";
+ break;
+ }
+ }
+ ?>
+
+
diff --git a/wp-admin/includes/class-wp-ms-themes-list-table.php b/wp-admin/includes/class-wp-ms-themes-list-table.php
new file mode 100644
index 00000000..6e34a163
--- /dev/null
+++ b/wp-admin/includes/class-wp-ms-themes-list-table.php
@@ -0,0 +1,361 @@
+get_pagenum();
+
+ $screen = get_current_screen();
+ $this->is_site_themes = ( 'site-themes-network' == $screen->id ) ? true : false;
+
+ if ( $this->is_site_themes )
+ $this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
+
+ parent::WP_List_Table( array(
+ 'plural' => 'themes'
+ ) );
+ }
+
+ function get_table_classes() {
+ return array( 'widefat', 'plugins' ); // todo: remove and add CSS for .themes
+ }
+
+ function ajax_user_can() {
+ $menu_perms = get_site_option( 'menu_items', array() );
+
+ if ( empty( $menu_perms['themes'] ) && ! is_super_admin() )
+ return false;
+
+ if ( $this->is_site_themes && !current_user_can('manage_sites') )
+ return false;
+ elseif ( !$this->is_site_themes && !current_user_can('manage_network_themes') )
+ return false;
+ return true;
+ }
+
+ function prepare_items() {
+ global $status, $themes, $totals, $page, $orderby, $order, $s;
+
+ wp_reset_vars( array( 'orderby', 'order', 's' ) );
+
+ $themes = array(
+ 'all' => apply_filters( 'all_themes', get_themes() ),
+ 'search' => array(),
+ 'enabled' => array(),
+ 'disabled' => array(),
+ 'upgrade' => array()
+ );
+
+ $site_allowed_themes = get_site_allowed_themes();
+ if ( !$this->is_site_themes ) {
+ $allowed_themes = $site_allowed_themes;
+ $themes_per_page = $this->get_items_per_page( 'themes_network_per_page' );
+ } else {
+ $allowed_themes = wpmu_get_blog_allowedthemes( $this->site_id );
+ $themes_per_page = $this->get_items_per_page( 'site_themes_network_per_page' );
+ }
+
+ $current = get_site_transient( 'update_themes' );
+
+ foreach ( (array) $themes['all'] as $key => $theme ) {
+ $theme_key = $theme['Stylesheet'];
+
+ if ( isset( $allowed_themes [ $theme_key ] ) ) {
+ $themes['all'][$key]['enabled'] = true;
+ $themes['enabled'][$key] = $themes['all'][$key];
+ }
+ else {
+ $themes['all'][$key]['enabled'] = false;
+ $themes['disabled'][$key] = $themes['all'][$key];
+ }
+ if ( isset( $current->response[ $theme['Template'] ] ) )
+ $themes['upgrade'][$key] = $themes['all'][$key];
+
+ if ( $this->is_site_themes && isset( $site_allowed_themes[$theme_key] ) ) {
+ unset( $themes['all'][$key] );
+ unset( $themes['enabled'][$key] );
+ unset( $themes['disabled'][$key] );
+ }
+ }
+
+ if ( !current_user_can( 'update_themes' ) || $this->is_site_themes )
+ $themes['upgrade'] = array();
+
+ if ( $s ) {
+ $status = 'search';
+ $themes['search'] = array_filter( $themes['all'], array( &$this, '_search_callback' ) );
+ }
+
+ $totals = array();
+ foreach ( $themes as $type => $list )
+ $totals[ $type ] = count( $list );
+
+ if ( empty( $themes[ $status ] ) && !in_array( $status, array( 'all', 'search' ) ) )
+ $status = 'all';
+
+ $this->items = $themes[ $status ];
+ $total_this_page = $totals[ $status ];
+
+ if ( $orderby ) {
+ $orderby = ucfirst( $orderby );
+ $order = strtoupper( $order );
+
+ uasort( $this->items, array( &$this, '_order_callback' ) );
+ }
+
+ $start = ( $page - 1 ) * $themes_per_page;
+
+ if ( $total_this_page > $themes_per_page )
+ $this->items = array_slice( $this->items, $start, $themes_per_page );
+
+ $this->set_pagination_args( array(
+ 'total_items' => $total_this_page,
+ 'per_page' => $themes_per_page,
+ ) );
+ }
+
+ function _search_callback( $theme ) {
+ static $term;
+ if ( is_null( $term ) )
+ $term = stripslashes( $_REQUEST['s'] );
+
+ $search_fields = array( 'Name', 'Title', 'Description', 'Author', 'Author Name', 'Author URI', 'Template', 'Stylesheet' );
+ foreach ( $search_fields as $field )
+ if ( stripos( $theme[ $field ], $term ) !== false )
+ return true;
+
+ return false;
+ }
+
+ function _order_callback( $theme_a, $theme_b ) {
+ global $orderby, $order;
+
+ $a = $theme_a[$orderby];
+ $b = $theme_b[$orderby];
+
+ if ( $a == $b )
+ return 0;
+
+ if ( 'DESC' == $order )
+ return ( $a < $b ) ? 1 : -1;
+ else
+ return ( $a < $b ) ? -1 : 1;
+ }
+
+ function no_items() {
+ global $themes;
+
+ if ( !empty( $themes['all'] ) )
+ _e( 'No themes found.' );
+ else
+ _e( 'You do not appear to have any themes available at this time.' );
+ }
+
+ function get_columns() {
+ global $status;
+
+ return array(
+ 'cb' => ' ',
+ 'name' => __( 'Theme' ),
+ 'description' => __( 'Description' ),
+ );
+ }
+
+ function get_sortable_columns() {
+ return array(
+ 'name' => 'name',
+ );
+ }
+
+ function get_views() {
+ global $totals, $status;
+
+ $status_links = array();
+ foreach ( $totals as $type => $count ) {
+ if ( !$count )
+ continue;
+
+ switch ( $type ) {
+ case 'all':
+ $text = _nx( 'All (%s) ', 'All (%s) ', $count, 'themes' );
+ break;
+ case 'enabled':
+ $text = _n( 'Enabled (%s) ', 'Enabled (%s) ', $count );
+ break;
+ case 'disabled':
+ $text = _n( 'Disabled (%s) ', 'Disabled (%s) ', $count );
+ break;
+ case 'upgrade':
+ $text = _n( 'Update Available (%s) ', 'Update Available (%s) ', $count );
+ break;
+ }
+
+ if ( $this->is_site_themes )
+ $url = 'site-themes.php?id=' . $this->site_id;
+ else
+ $url = 'themes.php';
+
+ if ( 'search' != $type ) {
+ $status_links[$type] = sprintf( "%s ",
+ esc_url( add_query_arg('theme_status', $type, $url) ),
+ ( $type == $status ) ? ' class="current"' : '',
+ sprintf( $text, number_format_i18n( $count ) )
+ );
+ }
+ }
+
+ return $status_links;
+ }
+
+ function get_bulk_actions() {
+ global $status;
+
+ $actions = array();
+ if ( 'enabled' != $status )
+ $actions['enable-selected'] = $this->is_site_themes ? __( 'Enable' ) : __( 'Network Enable' );
+ if ( 'disabled' != $status )
+ $actions['disable-selected'] = $this->is_site_themes ? __( 'Disable' ) : __( 'Network Disable' );
+ if ( ! $this->is_site_themes ) {
+ if ( current_user_can( 'delete_themes' ) )
+ $actions['delete-selected'] = __( 'Delete' );
+ if ( current_user_can( 'update_themes' ) )
+ $actions['update-selected'] = __( 'Update' );
+ }
+ return $actions;
+ }
+
+ function bulk_actions( $which ) {
+ global $status;
+ parent::bulk_actions( $which );
+ }
+
+ function current_action() {
+ return parent::current_action();
+ }
+
+ function display_rows() {
+ foreach ( $this->items as $key => $theme )
+ $this->single_row( $key, $theme );
+ }
+
+ function single_row( $key, $theme ) {
+ global $status, $page, $s;
+
+ $context = $status;
+
+ if ( $this->is_site_themes )
+ $url = "site-themes.php?id={$this->site_id}&";
+ else
+ $url = 'themes.php?';
+
+ // preorder
+ $actions = array(
+ 'enable' => '',
+ 'disable' => '',
+ 'edit' => '',
+ 'delete' => ''
+ );
+
+ $theme_key = $theme['Stylesheet'];
+
+ if ( empty( $theme['enabled'] ) )
+ $actions['enable'] = '' . ( $this->is_site_themes ? __( 'Enable' ) : __( 'Network Enable' ) ) . ' ';
+ else
+ $actions['disable'] = '' . ( $this->is_site_themes ? __( 'Disable' ) : __( 'Network Disable' ) ) . ' ';
+
+ if ( current_user_can('edit_themes') )
+ $actions['edit'] = '' . __('Edit') . ' ';
+
+ if ( empty( $theme['enabled'] ) && current_user_can( 'delete_themes' ) && ! $this->is_site_themes && $theme_key != get_option( 'stylesheet' ) && $theme_key != get_option( 'template' ) )
+ $actions['delete'] = '' . __( 'Delete' ) . ' ';
+
+ $actions = apply_filters( 'theme_action_links', array_filter( $actions ), $theme_key, $theme, $context );
+ $actions = apply_filters( "theme_action_links_$theme_key", $actions, $theme_key, $theme, $context );
+
+ $class = empty( $theme['enabled'] ) ? 'inactive' : 'active';
+ $checkbox_id = "checkbox_" . md5($theme['Name']);
+ $checkbox = "" . __('Select') . " " . $theme['Name'] . " ";
+
+ $description = '' . $theme['Description'] . '
';
+ $theme_name = $theme['Name'];
+
+ $id = sanitize_title( $theme_name );
+
+ echo "";
+
+ list( $columns, $hidden ) = $this->get_column_info();
+
+ foreach ( $columns as $column_name => $column_display_name ) {
+ $style = '';
+ if ( in_array( $column_name, $hidden ) )
+ $style = ' style="display:none;"';
+
+ switch ( $column_name ) {
+ case 'cb':
+ echo "$checkbox ";
+ break;
+ case 'name':
+ echo "$theme_name ";
+ echo $this->row_actions( $actions, true );
+ echo " ";
+ break;
+ case 'description':
+ echo "
+ $description
+ ";
+
+ $theme_meta = array();
+
+ if ( !empty( $theme['Version'] ) )
+ $theme_meta[] = sprintf( __( 'Version %s' ), $theme['Version'] );
+
+ if ( !empty( $theme['Author'] ) )
+ $theme_meta[] = sprintf( __( 'By %s' ), $theme['Author'] );
+
+ if ( !empty( $theme['Theme URI'] ) )
+ $theme_meta[] = '
' . __( 'Visit Theme Site' ) . ' ';
+
+ $theme_meta = apply_filters( 'theme_row_meta', $theme_meta, $theme_key, $theme, $status );
+ echo implode( ' | ', $theme_meta );
+
+ echo "
";
+ break;
+
+ default:
+ echo "";
+ do_action( 'manage_themes_custom_column', $column_name, $theme_key, $theme );
+ echo " ";
+ }
+ }
+
+ echo " ";
+
+ if ( $this->is_site_themes )
+ remove_action( "after_theme_row_$theme_key", 'wp_theme_update_row' );
+ do_action( 'after_theme_row', $theme_key, $theme, $status );
+ do_action( "after_theme_row_$theme_key", $theme_key, $theme, $status );
+ }
+}
+
+?>
diff --git a/wp-admin/includes/class-wp-ms-users-list-table.php b/wp-admin/includes/class-wp-ms-users-list-table.php
new file mode 100644
index 00000000..36d55e1c
--- /dev/null
+++ b/wp-admin/includes/class-wp-ms-users-list-table.php
@@ -0,0 +1,276 @@
+get_items_per_page( 'users_network_per_page' );
+
+ $role = isset( $_REQUEST['role'] ) ? $_REQUEST['role'] : '';
+
+ $paged = $this->get_pagenum();
+
+ $args = array(
+ 'number' => $users_per_page,
+ 'offset' => ( $paged-1 ) * $users_per_page,
+ 'search' => $usersearch,
+ 'blog_id' => 0,
+ 'fields' => 'all_with_meta'
+ );
+
+ $args['search'] = ltrim($args['search'], '*');
+
+ if ( $role == 'super' ) {
+ $logins = implode( "', '", get_super_admins() );
+ $args['include'] = $wpdb->get_col( "SELECT ID FROM $wpdb->users WHERE user_login IN ('$logins')" );
+ }
+
+ // If the network is large and a search is not being performed, show only the latest users with no paging in order
+ // to avoid expensive count queries.
+ if ( !$usersearch && ( get_blog_count() >= 10000 ) ) {
+ if ( !isset($_REQUEST['orderby']) )
+ $_GET['orderby'] = $_REQUEST['orderby'] = 'id';
+ if ( !isset($_REQUEST['order']) )
+ $_GET['order'] = $_REQUEST['order'] = 'DESC';
+ $args['count_total'] = false;
+ }
+
+ if ( isset( $_REQUEST['orderby'] ) )
+ $args['orderby'] = $_REQUEST['orderby'];
+
+ if ( isset( $_REQUEST['order'] ) )
+ $args['order'] = $_REQUEST['order'];
+
+ $mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode'];
+
+ // Query the user IDs for this page
+ $wp_user_search = new WP_User_Query( $args );
+
+ $this->items = $wp_user_search->get_results();
+
+ $this->set_pagination_args( array(
+ 'total_items' => $wp_user_search->get_total(),
+ 'per_page' => $users_per_page,
+ ) );
+ }
+
+ function get_bulk_actions() {
+ $actions = array();
+ if ( current_user_can( 'delete_users' ) )
+ $actions['delete'] = __( 'Delete' );
+ $actions['spam'] = _x( 'Mark as Spam', 'user' );
+ $actions['notspam'] = _x( 'Not Spam', 'user' );
+
+ return $actions;
+ }
+
+ function no_items() {
+ _e( 'No users found.' );
+ }
+
+ function get_views() {
+ global $wp_roles, $role;
+
+ $total_users = get_user_count();
+ $super_admins = get_super_admins();
+ $total_admins = count( $super_admins );
+
+ $current_role = false;
+ $class = $role != 'super' ? ' class="current"' : '';
+ $role_links = array();
+ $role_links['all'] = "" . sprintf( _nx( 'All (%s) ', 'All (%s) ', $total_users, 'users' ), number_format_i18n( $total_users ) ) . ' ';
+ $class = $role == 'super' ? ' class="current"' : '';
+ $role_links['super'] = "" . sprintf( _n( 'Super Admin (%s) ', 'Super Admins (%s) ', $total_admins ), number_format_i18n( $total_admins ) ) . ' ';
+
+ return $role_links;
+ }
+
+ function pagination( $which ) {
+ global $mode;
+
+ parent::pagination ( $which );
+
+ if ( 'top' == $which )
+ $this->view_switcher( $mode );
+ }
+
+ function get_columns() {
+ $users_columns = array(
+ 'cb' => ' ',
+ 'username' => __( 'Username' ),
+ 'name' => __( 'Name' ),
+ 'email' => __( 'E-mail' ),
+ 'registered' => _x( 'Registered', 'user' ),
+ 'blogs' => __( 'Sites' )
+ );
+ $users_columns = apply_filters( 'wpmu_users_columns', $users_columns );
+
+ return $users_columns;
+ }
+
+ function get_sortable_columns() {
+ return array(
+ 'username' => 'login',
+ 'name' => 'name',
+ 'email' => 'email',
+ 'registered' => 'id',
+ );
+ }
+
+ function display_rows() {
+ global $current_site, $mode;
+
+ $alt = '';
+ $super_admins = get_super_admins();
+ foreach ( $this->items as $user ) {
+ $alt = ( 'alternate' == $alt ) ? '' : 'alternate';
+
+ $status_list = array( 'spam' => 'site-spammed', 'deleted' => 'site-deleted' );
+
+ foreach ( $status_list as $status => $col ) {
+ if ( $user->$status )
+ $alt .= " $col";
+ }
+
+ ?>
+
+ get_column_info();
+
+ foreach ( $columns as $column_name => $column_display_name ) :
+ $class = "class='$column_name column-$column_name'";
+
+ $style = '';
+ if ( in_array( $column_name, $hidden ) )
+ $style = ' style="display:none;"';
+
+ $attributes = "$class$style";
+
+
+ switch ( $column_name ) {
+ case 'cb': ?>
+
+
+
+ user_email, 32 );
+ if ( get_current_user_id() == $user->ID ) {
+ $edit_link = esc_url( network_admin_url( 'profile.php' ) );
+ } else {
+ $edit_link = esc_url( network_admin_url( add_query_arg( 'wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), 'user-edit.php?user_id=' . $user->ID ) ) );
+ }
+
+ echo ""; ?>
+ user_login ); ?> user_login, $super_admins ) )
+ echo ' - ' . __( 'Super Admin' );
+ ?>
+
+ ' . __( 'Edit' ) . '';
+
+ if ( current_user_can( 'delete_user', $user->ID) && ! in_array( $user->user_login, $super_admins ) ) {
+ $actions['delete'] = '' . __( 'Delete' ) . ' ';
+ }
+
+ echo $this->row_actions( $actions );
+ ?>
+
+ $user->first_name $user->last_name";
+ break;
+
+ case 'email':
+ echo "$user->user_email ";
+ break;
+
+ case 'registered':
+ if ( 'list' == $mode )
+ $date = 'Y/m/d';
+ else
+ $date = 'Y/m/d \<\b\r \/\> g:i:s a';
+
+ echo "" . mysql2date( $date, $user->user_registered ) . " ";
+ break;
+
+ case 'blogs':
+ $blogs = get_blogs_of_user( $user->ID, true );
+ echo "";
+ if ( is_array( $blogs ) ) {
+ foreach ( (array) $blogs as $key => $val ) {
+ if ( !can_edit_network( $val->site_id ) )
+ continue;
+
+ $path = ( $val->path == '/' ) ? '' : $val->path;
+ echo '';
+ echo '' . str_replace( '.' . $current_site->domain, '', $val->domain . $path ) . ' ';
+ echo ' ';
+ $actions = array();
+ $actions['edit'] = '' . __( 'Edit' ) . ' ';
+
+ $class = '';
+ if ( get_blog_status( $val->userblog_id, 'spam' ) == 1 )
+ $class .= 'site-spammed ';
+ if ( get_blog_status( $val->userblog_id, 'mature' ) == 1 )
+ $class .= 'site-mature ';
+ if ( get_blog_status( $val->userblog_id, 'deleted' ) == 1 )
+ $class .= 'site-deleted ';
+ if ( get_blog_status( $val->userblog_id, 'archived' ) == 1 )
+ $class .= 'site-archived ';
+
+ $actions['view'] = '' . __( 'View' ) . ' ';
+
+ $actions = apply_filters('ms_user_list_site_actions', $actions, $val->userblog_id);
+
+ $i=0;
+ $action_count = count( $actions );
+ foreach ( $actions as $action => $link ) {
+ ++$i;
+ ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
+ echo "$link$sep ";
+ }
+ echo ' ';
+ }
+ }
+ ?>
+
+ ";
+ echo apply_filters( 'manage_users_custom_column', '', $column_name, $user->ID );
+ echo "";
+ break;
+ }
+ endforeach
+ ?>
+
+
diff --git a/wp-admin/includes/class-wp-plugin-install-list-table.php b/wp-admin/includes/class-wp-plugin-install-list-table.php
new file mode 100644
index 00000000..4893ae66
--- /dev/null
+++ b/wp-admin/includes/class-wp-plugin-install-list-table.php
@@ -0,0 +1,237 @@
+get_pagenum();
+
+ $per_page = 30;
+
+ // These are the tabs which are shown on the page
+ $tabs = array();
+ $tabs['dashboard'] = __( 'Search' );
+ if ( 'search' == $tab )
+ $tabs['search'] = __( 'Search Results' );
+ $tabs['upload'] = __( 'Upload' );
+ $tabs['featured'] = _x( 'Featured','Plugin Installer' );
+ $tabs['popular'] = _x( 'Popular','Plugin Installer' );
+ $tabs['new'] = _x( 'Newest','Plugin Installer' );
+ $tabs['updated'] = _x( 'Recently Updated','Plugin Installer' );
+
+ $nonmenu_tabs = array( 'plugin-information' ); //Valid actions to perform which do not have a Menu item.
+
+ $tabs = apply_filters( 'install_plugins_tabs', $tabs );
+ $nonmenu_tabs = apply_filters( 'install_plugins_nonmenu_tabs', $nonmenu_tabs );
+
+ // If a non-valid menu tab has been selected, And its not a non-menu action.
+ if ( empty( $tab ) || ( !isset( $tabs[ $tab ] ) && !in_array( $tab, (array) $nonmenu_tabs ) ) )
+ $tab = key( $tabs );
+
+ $args = array( 'page' => $paged, 'per_page' => $per_page );
+
+ switch ( $tab ) {
+ case 'search':
+ $type = isset( $_REQUEST['type'] ) ? stripslashes( $_REQUEST['type'] ) : '';
+ $term = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : '';
+
+ switch ( $type ) {
+ case 'tag':
+ $args['tag'] = sanitize_title_with_dashes( $term );
+ break;
+ case 'term':
+ $args['search'] = $term;
+ break;
+ case 'author':
+ $args['author'] = $term;
+ break;
+ }
+
+ add_action( 'install_plugins_table_header', 'install_search_form' );
+ break;
+
+ case 'featured':
+ case 'popular':
+ case 'new':
+ case 'updated':
+ $args['browse'] = $tab;
+ break;
+
+ default:
+ $args = false;
+ }
+
+ if ( !$args )
+ return;
+
+ $api = plugins_api( 'query_plugins', $args );
+
+ if ( is_wp_error( $api ) )
+ wp_die( $api->get_error_message() . ' ' . __( 'Try again' ) . ' ' );
+
+ $this->items = $api->plugins;
+
+ $this->set_pagination_args( array(
+ 'total_items' => $api->info['results'],
+ 'per_page' => $per_page,
+ ) );
+ }
+
+ function no_items() {
+ _e( 'No plugins match your request.' );
+ }
+
+ function get_views() {
+ global $tabs, $tab;
+
+ $display_tabs = array();
+ foreach ( (array) $tabs as $action => $text ) {
+ $class = ( $action == $tab ) ? ' class="current"' : '';
+ $href = self_admin_url('plugin-install.php?tab=' . $action);
+ $display_tabs['plugin-install-'.$action] = "$text ";
+ }
+
+ return $display_tabs;
+ }
+
+ function display_tablenav( $which ) {
+ if ( 'top' == $which ) { ?>
+
+
+
+
+ pagination( $which ); ?>
+
+
+
+
+
+ pagination( $which ); ?>
+
+
+
+ _args );
+
+ return array( 'widefat', $plural );
+ }
+
+ function get_columns() {
+ return array(
+ 'name' => __( 'Name' ),
+ 'version' => __( 'Version' ),
+ 'rating' => __( 'Rating' ),
+ 'description' => __( 'Description' ),
+ );
+ }
+
+ function display_rows() {
+ $plugins_allowedtags = array(
+ 'a' => array( 'href' => array(),'title' => array(), 'target' => array() ),
+ 'abbr' => array( 'title' => array() ),'acronym' => array( 'title' => array() ),
+ 'code' => array(), 'pre' => array(), 'em' => array(),'strong' => array(),
+ 'ul' => array(), 'ol' => array(), 'li' => array(), 'p' => array(), 'br' => array()
+ );
+
+ list( $columns, $hidden ) = $this->get_column_info();
+
+ $style = array();
+ foreach ( $columns as $column_name => $column_display_name ) {
+ $style[ $column_name ] = in_array( $column_name, $hidden ) ? 'style="display:none;"' : '';
+ }
+
+ foreach ( (array) $this->items as $plugin ) {
+ if ( is_object( $plugin ) )
+ $plugin = (array) $plugin;
+
+ $title = wp_kses( $plugin['name'], $plugins_allowedtags );
+ //Limit description to 400char, and remove any HTML.
+ $description = strip_tags( $plugin['description'] );
+ if ( strlen( $description ) > 400 )
+ $description = mb_substr( $description, 0, 400 ) . '…';
+ //remove any trailing entities
+ $description = preg_replace( '/&[^;\s]{0,6}$/', '', $description );
+ //strip leading/trailing & multiple consecutive lines
+ $description = trim( $description );
+ $description = preg_replace( "|(\r?\n)+|", "\n", $description );
+ //\n =>
+ $description = nl2br( $description );
+ $version = wp_kses( $plugin['version'], $plugins_allowedtags );
+
+ $name = strip_tags( $title . ' ' . $version );
+
+ $author = $plugin['author'];
+ if ( ! empty( $plugin['author'] ) )
+ $author = ' ' . sprintf( __( 'By %s' ), $author ) . '. ';
+
+ $author = wp_kses( $author, $plugins_allowedtags );
+
+ $action_links = array();
+ $action_links[] = '' . __( 'Details' ) . ' ';
+
+ if ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) {
+ $status = install_plugin_install_status( $plugin );
+
+ switch ( $status['status'] ) {
+ case 'install':
+ if ( $status['url'] )
+ $action_links[] = '' . __( 'Install Now' ) . ' ';
+ break;
+ case 'update_available':
+ if ( $status['url'] )
+ $action_links[] = '' . sprintf( __( 'Update Now' ), $status['version'] ) . ' ';
+ break;
+ case 'latest_installed':
+ case 'newer_installed':
+ $action_links[] = '' . __( 'Installed' ) . ' ';
+ break;
+ }
+ }
+
+ $action_links = apply_filters( 'plugin_install_action_links', $action_links, $plugin );
+ ?>
+
+ >
+
+
+ >
+ >
+
+
+ >
+
+
diff --git a/wp-admin/includes/class-wp-plugins-list-table.php b/wp-admin/includes/class-wp-plugins-list-table.php
new file mode 100644
index 00000000..eefffb10
--- /dev/null
+++ b/wp-admin/includes/class-wp-plugins-list-table.php
@@ -0,0 +1,453 @@
+get_pagenum();
+
+ parent::WP_List_Table( array(
+ 'plural' => 'plugins',
+ ) );
+ }
+
+ function get_table_classes() {
+ return array( 'widefat', $this->_args['plural'] );
+ }
+
+ function ajax_user_can() {
+ if ( is_multisite() ) {
+ $menu_perms = get_site_option( 'menu_items', array() );
+
+ if ( empty( $menu_perms['plugins'] ) && ! is_super_admin() )
+ return false;
+ }
+
+ return current_user_can('activate_plugins');
+ }
+
+ function prepare_items() {
+ global $status, $plugins, $totals, $page, $orderby, $order, $s;
+
+ wp_reset_vars( array( 'orderby', 'order', 's' ) );
+
+ $plugins = array(
+ 'all' => apply_filters( 'all_plugins', get_plugins() ),
+ 'search' => array(),
+ 'active' => array(),
+ 'inactive' => array(),
+ 'recently_activated' => array(),
+ 'upgrade' => array(),
+ 'mustuse' => array(),
+ 'dropins' => array()
+ );
+
+ $screen = get_current_screen();
+
+ if ( ! is_multisite() || ( $screen->is_network && current_user_can('manage_network_plugins') ) ) {
+ if ( apply_filters( 'show_advanced_plugins', true, 'mustuse' ) )
+ $plugins['mustuse'] = get_mu_plugins();
+ if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) )
+ $plugins['dropins'] = get_dropins();
+
+ $current = get_site_transient( 'update_plugins' );
+ foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) {
+ if ( isset( $current->response[ $plugin_file ] ) )
+ $plugins['upgrade'][ $plugin_file ] = $plugin_data;
+ }
+ }
+
+ set_transient( 'plugin_slugs', array_keys( $plugins['all'] ), 86400 );
+
+ $recently_activated = get_option( 'recently_activated', array() );
+
+ $one_week = 7*24*60*60;
+ foreach ( $recently_activated as $key => $time )
+ if ( $time + $one_week < time() )
+ unset( $recently_activated[$key] );
+ update_option( 'recently_activated', $recently_activated );
+
+ foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) {
+ // Filter into individual sections
+ if ( is_multisite() && is_network_only_plugin( $plugin_file ) && !$screen->is_network ) {
+ unset( $plugins['all'][ $plugin_file] );
+ } elseif ( is_plugin_active_for_network($plugin_file) && !$screen->is_network ) {
+ unset( $plugins['all'][ $plugin_file ] );
+ } elseif ( is_multisite() && is_network_only_plugin( $plugin_file ) && !current_user_can( 'manage_network_plugins' ) ) {
+ $plugins['network'][ $plugin_file ] = $plugin_data;
+ } elseif ( ( !$screen->is_network && is_plugin_active( $plugin_file ) )
+ || ( $screen->is_network && is_plugin_active_for_network( $plugin_file ) ) ) {
+ $plugins['active'][ $plugin_file ] = $plugin_data;
+ } else {
+ if ( !$screen->is_network && isset( $recently_activated[ $plugin_file ] ) ) // Was the plugin recently activated?
+ $plugins['recently_activated'][ $plugin_file ] = $plugin_data;
+ $plugins['inactive'][ $plugin_file ] = $plugin_data;
+ }
+ }
+
+ if ( !current_user_can( 'update_plugins' ) )
+ $plugins['upgrade'] = array();
+
+ if ( $s ) {
+ $status = 'search';
+ $plugins['search'] = array_filter( $plugins['all'], array( &$this, '_search_callback' ) );
+ }
+
+ $totals = array();
+ foreach ( $plugins as $type => $list )
+ $totals[ $type ] = count( $list );
+
+ if ( empty( $plugins[ $status ] ) && !in_array( $status, array( 'all', 'search' ) ) )
+ $status = 'all';
+
+ $this->items = array();
+ foreach ( $plugins[ $status ] as $plugin_file => $plugin_data ) {
+ // Translate, Don't Apply Markup, Sanitize HTML
+ $this->items[$plugin_file] = _get_plugin_data_markup_translate( $plugin_file, $plugin_data, false, true );
+ }
+
+ $total_this_page = $totals[ $status ];
+
+ if ( $orderby ) {
+ $orderby = ucfirst( $orderby );
+ $order = strtoupper( $order );
+
+ uasort( $this->items, array( &$this, '_order_callback' ) );
+ }
+
+ $plugins_per_page = $this->get_items_per_page( str_replace( '-', '_', $screen->id . '_per_page' ) );
+
+ $start = ( $page - 1 ) * $plugins_per_page;
+
+ if ( $total_this_page > $plugins_per_page )
+ $this->items = array_slice( $this->items, $start, $plugins_per_page );
+
+ $this->set_pagination_args( array(
+ 'total_items' => $total_this_page,
+ 'per_page' => $plugins_per_page,
+ ) );
+ }
+
+ function _search_callback( $plugin ) {
+ static $term;
+ if ( is_null( $term ) )
+ $term = stripslashes( $_REQUEST['s'] );
+
+ foreach ( $plugin as $value )
+ if ( stripos( $value, $term ) !== false )
+ return true;
+
+ return false;
+ }
+
+ function _order_callback( $plugin_a, $plugin_b ) {
+ global $orderby, $order;
+
+ $a = $plugin_a[$orderby];
+ $b = $plugin_b[$orderby];
+
+ if ( $a == $b )
+ return 0;
+
+ if ( 'DESC' == $order )
+ return ( $a < $b ) ? 1 : -1;
+ else
+ return ( $a < $b ) ? -1 : 1;
+ }
+
+ function no_items() {
+ global $plugins;
+
+ if ( !empty( $plugins['all'] ) )
+ _e( 'No plugins found.' );
+ else
+ _e( 'You do not appear to have any plugins available at this time.' );
+ }
+
+ function get_columns() {
+ global $status;
+
+ return array(
+ 'cb' => !in_array( $status, array( 'mustuse', 'dropins' ) ) ? ' ' : '',
+ 'name' => __( 'Plugin' ),
+ 'description' => __( 'Description' ),
+ );
+ }
+
+ function get_sortable_columns() {
+ return array();
+ }
+
+ function display_tablenav( $which ) {
+ global $status;
+
+ if ( !in_array( $status, array( 'mustuse', 'dropins' ) ) )
+ parent::display_tablenav( $which );
+ }
+
+ function get_views() {
+ global $totals, $status;
+
+ $status_links = array();
+ foreach ( $totals as $type => $count ) {
+ if ( !$count )
+ continue;
+
+ switch ( $type ) {
+ case 'all':
+ $text = _nx( 'All (%s) ', 'All (%s) ', $count, 'plugins' );
+ break;
+ case 'active':
+ $text = _n( 'Active (%s) ', 'Active (%s) ', $count );
+ break;
+ case 'recently_activated':
+ $text = _n( 'Recently Active (%s) ', 'Recently Active (%s) ', $count );
+ break;
+ case 'inactive':
+ $text = _n( 'Inactive (%s) ', 'Inactive (%s) ', $count );
+ break;
+ case 'network':
+ $text = _n( 'Network (%s) ', 'Network (%s) ', $count );
+ break;
+ case 'mustuse':
+ $text = _n( 'Must-Use (%s) ', 'Must-Use (%s) ', $count );
+ break;
+ case 'dropins':
+ $text = _n( 'Drop-ins (%s) ', 'Drop-ins (%s) ', $count );
+ break;
+ case 'upgrade':
+ $text = _n( 'Update Available (%s) ', 'Update Available (%s) ', $count );
+ break;
+ }
+
+ if ( 'search' != $type ) {
+ $status_links[$type] = sprintf( "%s ",
+ add_query_arg('plugin_status', $type, 'plugins.php'),
+ ( $type == $status ) ? ' class="current"' : '',
+ sprintf( $text, number_format_i18n( $count ) )
+ );
+ }
+ }
+
+ return $status_links;
+ }
+
+ function get_bulk_actions() {
+ global $status;
+
+ $actions = array();
+
+ $screen = get_current_screen();
+
+ if ( 'active' != $status ) {
+ $action = $screen->is_network ? 'network-activate-selected' : 'activate-selected';
+ $actions[ $action ] = __( 'Activate' );
+ }
+
+ if ( 'inactive' != $status && 'recent' != $status )
+ $actions['deactivate-selected'] = __( 'Deactivate' );
+
+ if ( !is_multisite() || $screen->is_network ) {
+ if ( current_user_can( 'update_plugins' ) )
+ $actions['update-selected'] = __( 'Update' );
+ if ( current_user_can( 'delete_plugins' ) && ( 'active' != $status ) )
+ $actions['delete-selected'] = __( 'Delete' );
+ }
+
+ return $actions;
+ }
+
+ function bulk_actions( $which ) {
+ global $status;
+
+ if ( in_array( $status, array( 'mustuse', 'dropins' ) ) )
+ return;
+
+ parent::bulk_actions( $which );
+ }
+
+ function extra_tablenav( $which ) {
+ global $status;
+
+ if ( 'recently_activated' == $status ) { ?>
+
+
+
+ is_network && in_array( $status, array( 'mustuse', 'dropins' ) ) )
+ return;
+
+ foreach ( $this->items as $plugin_file => $plugin_data )
+ $this->single_row( $plugin_file, $plugin_data );
+ }
+
+ function single_row( $plugin_file, $plugin_data ) {
+ global $status, $page, $s;
+
+ $context = $status;
+
+ $screen = get_current_screen();
+
+ // preorder
+ $actions = array(
+ 'network_deactivate' => '', 'deactivate' => '',
+ 'network_only' => '', 'activate' => '',
+ 'network_activate' => '',
+ 'edit' => '',
+ 'delete' => '',
+ );
+
+ if ( 'mustuse' == $context ) {
+ $is_active = true;
+ } elseif ( 'dropins' == $context ) {
+ $dropins = _get_dropins();
+ $plugin_name = $plugin_file;
+ if ( $plugin_file != $plugin_data['Name'] )
+ $plugin_name .= ' ' . $plugin_data['Name'];
+ if ( true === ( $dropins[ $plugin_file ][1] ) ) { // Doesn't require a constant
+ $is_active = true;
+ $description = '' . $dropins[ $plugin_file ][0] . '
';
+ } elseif ( constant( $dropins[ $plugin_file ][1] ) ) { // Constant is true
+ $is_active = true;
+ $description = '' . $dropins[ $plugin_file ][0] . '
';
+ } else {
+ $is_active = false;
+ $description = '' . $dropins[ $plugin_file ][0] . ' ' . __('Inactive:') . ' ' . sprintf( __( 'Requires %s
in wp-config.php
.' ), "define('" . $dropins[ $plugin_file ][1] . "', true);" ) . '
';
+ }
+ if ( $plugin_data['Description'] )
+ $description .= '' . $plugin_data['Description'] . '
';
+ } else {
+ $is_active_for_network = is_plugin_active_for_network($plugin_file);
+ if ( $screen->is_network )
+ $is_active = $is_active_for_network;
+ else
+ $is_active = is_plugin_active( $plugin_file );
+
+ if ( $is_active_for_network && !is_super_admin() && !$screen->is_network )
+ return;
+
+ if ( $screen->is_network ) {
+ if ( $is_active_for_network ) {
+ if ( current_user_can( 'manage_network_plugins' ) )
+ $actions['network_deactivate'] = '' . __('Network Deactivate') . ' ';
+ } else {
+ if ( current_user_can( 'manage_network_plugins' ) )
+ $actions['network_activate'] = '' . __('Network Activate') . ' ';
+ if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) )
+ $actions['delete'] = '' . __('Delete') . ' ';
+ }
+ } else {
+ if ( $is_active ) {
+ $actions['deactivate'] = '' . __('Deactivate') . ' ';
+ } else {
+ $actions['activate'] = '' . __('Activate') . ' ';
+
+ if ( ! is_multisite() && current_user_can('delete_plugins') )
+ $actions['delete'] = '' . __('Delete') . ' ';
+ } // end if $is_active
+ } // end if $screen->is_network
+
+ if ( ( ! is_multisite() || $screen->is_network ) && current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
+ $actions['edit'] = '' . __('Edit') . ' ';
+ } // end if $context
+
+ $prefix = $screen->is_network ? 'network_admin_' : '';
+ $actions = apply_filters( $prefix . 'plugin_action_links', array_filter( $actions ), $plugin_file, $plugin_data, $context );
+ $actions = apply_filters( $prefix . "plugin_action_links_$plugin_file", $actions, $plugin_file, $plugin_data, $context );
+
+ $class = $is_active ? 'active' : 'inactive';
+ $checkbox_id = "checkbox_" . md5($plugin_data['Name']);
+ $checkbox = in_array( $status, array( 'mustuse', 'dropins' ) ) ? '' : "" . __('Select') . " " . $plugin_data['Name'] . " ";
+ if ( 'dropins' != $context ) {
+ $description = '' . ( $plugin_data['Description'] ? $plugin_data['Description'] : ' ' ) . '
';
+ $plugin_name = $plugin_data['Name'];
+ }
+
+ $id = sanitize_title( $plugin_name );
+
+ echo "";
+
+ list( $columns, $hidden ) = $this->get_column_info();
+
+ foreach ( $columns as $column_name => $column_display_name ) {
+ $style = '';
+ if ( in_array( $column_name, $hidden ) )
+ $style = ' style="display:none;"';
+
+ switch ( $column_name ) {
+ case 'cb':
+ echo "$checkbox ";
+ break;
+ case 'name':
+ echo "$plugin_name ";
+ echo $this->row_actions( $actions, true );
+ echo " ";
+ break;
+ case 'description':
+ echo "
+ $description
+ ";
+
+ $plugin_meta = array();
+ if ( !empty( $plugin_data['Version'] ) )
+ $plugin_meta[] = sprintf( __( 'Version %s' ), $plugin_data['Version'] );
+ if ( !empty( $plugin_data['Author'] ) ) {
+ $author = $plugin_data['Author'];
+ if ( !empty( $plugin_data['AuthorURI'] ) )
+ $author = '
' . $plugin_data['Author'] . ' ';
+ $plugin_meta[] = sprintf( __( 'By %s' ), $author );
+ }
+ if ( ! empty( $plugin_data['PluginURI'] ) )
+ $plugin_meta[] = '
' . __( 'Visit plugin site' ) . ' ';
+
+ $plugin_meta = apply_filters( 'plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status );
+ echo implode( ' | ', $plugin_meta );
+
+ echo "
";
+ break;
+ default:
+ echo "";
+ do_action( 'manage_plugins_custom_column', $column_name, $plugin_file, $plugin_data );
+ echo " ";
+ }
+ }
+
+ echo " ";
+
+ do_action( 'after_plugin_row', $plugin_file, $plugin_data, $status );
+ do_action( "after_plugin_row_$plugin_file", $plugin_file, $plugin_data, $status );
+ }
+}
+
+?>
diff --git a/wp-admin/includes/class-wp-posts-list-table.php b/wp-admin/includes/class-wp-posts-list-table.php
new file mode 100644
index 00000000..e623ab59
--- /dev/null
+++ b/wp-admin/includes/class-wp-posts-list-table.php
@@ -0,0 +1,1019 @@
+ true ) ) ) )
+ $post_type = $_REQUEST['post_type'];
+ else
+ wp_die( __( 'Invalid post type' ) );
+ $_REQUEST['post_type'] = $post_type;
+
+ $post_type_object = get_post_type_object( $post_type );
+
+ if ( !current_user_can( $post_type_object->cap->edit_others_posts ) ) {
+ $this->user_posts_count = $wpdb->get_var( $wpdb->prepare( "
+ SELECT COUNT( 1 ) FROM $wpdb->posts
+ WHERE post_type = %s AND post_status NOT IN ( 'trash', 'auto-draft' )
+ AND post_author = %d
+ ", $post_type, get_current_user_id() ) );
+
+ if ( $this->user_posts_count && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['all_posts'] ) && empty( $_REQUEST['author'] ) && empty( $_REQUEST['show_sticky'] ) )
+ $_GET['author'] = get_current_user_id();
+ }
+
+ if ( 'post' == $post_type && $sticky_posts = get_option( 'sticky_posts' ) ) {
+ $sticky_posts = implode( ', ', array_map( 'absint', (array) $sticky_posts ) );
+ $this->sticky_posts_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( 1 ) FROM $wpdb->posts WHERE post_type = %s AND post_status != 'trash' AND ID IN ($sticky_posts)", $post_type ) );
+ }
+
+ parent::WP_List_Table( array(
+ 'plural' => 'posts',
+ ) );
+ }
+
+ function ajax_user_can() {
+ global $post_type_object;
+
+ return current_user_can( $post_type_object->cap->edit_posts );
+ }
+
+ function prepare_items() {
+ global $post_type_object, $post_type, $avail_post_stati, $wp_query, $per_page, $mode;
+
+ $avail_post_stati = wp_edit_posts_query();
+
+ $this->hierarchical_display = ( $post_type_object->hierarchical && 'menu_order title' == $wp_query->query['orderby'] );
+
+ $total_items = $this->hierarchical_display ? $wp_query->post_count : $wp_query->found_posts;
+
+ $per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' );
+ $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type );
+
+ if ( $this->hierarchical_display )
+ $total_pages = ceil( $total_items / $per_page );
+ else
+ $total_pages = $wp_query->max_num_pages;
+
+ $mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode'];
+
+ $this->is_trash = isset( $_REQUEST['post_status'] ) && $_REQUEST['post_status'] == 'trash';
+
+ $this->set_pagination_args( array(
+ 'total_items' => $total_items,
+ 'total_pages' => $total_pages,
+ 'per_page' => $per_page
+ ) );
+ }
+
+ function has_items() {
+ return have_posts();
+ }
+
+ function no_items() {
+ global $post_type_object;
+
+ if ( isset( $_REQUEST['post_status'] ) && 'trash' == $_REQUEST['post_status'] )
+ echo $post_type_object->labels->not_found_in_trash;
+ else
+ echo $post_type_object->labels->not_found;
+ }
+
+ function get_views() {
+ global $post_type, $post_type_object, $locked_post_status, $avail_post_stati;
+
+ if ( !empty($locked_post_status) )
+ return array();
+
+ $status_links = array();
+ $num_posts = wp_count_posts( $post_type, 'readable' );
+ $class = '';
+ $allposts = '';
+
+ $current_user_id = get_current_user_id();
+
+ if ( $this->user_posts_count ) {
+ if ( isset( $_GET['author'] ) && ( $_GET['author'] == $current_user_id ) )
+ $class = ' class="current"';
+ $status_links['mine'] = "" . sprintf( _nx( 'Mine (%s) ', 'Mine (%s) ', $this->user_posts_count, 'posts' ), number_format_i18n( $this->user_posts_count ) ) . ' ';
+ $allposts = '&all_posts=1';
+ }
+
+ $total_posts = array_sum( (array) $num_posts );
+
+ // Subtract post types that are not included in the admin all list.
+ foreach ( get_post_stati( array('show_in_admin_all_list' => false) ) as $state )
+ $total_posts -= $num_posts->$state;
+
+ $class = empty( $class ) && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['show_sticky'] ) ? ' class="current"' : '';
+ $status_links['all'] = "" . sprintf( _nx( 'All (%s) ', 'All (%s) ', $total_posts, 'posts' ), number_format_i18n( $total_posts ) ) . ' ';
+
+ foreach ( get_post_stati(array('show_in_admin_status_list' => true), 'objects') as $status ) {
+ $class = '';
+
+ $status_name = $status->name;
+
+ if ( !in_array( $status_name, $avail_post_stati ) )
+ continue;
+
+ if ( empty( $num_posts->$status_name ) )
+ continue;
+
+ if ( isset($_REQUEST['post_status']) && $status_name == $_REQUEST['post_status'] )
+ $class = ' class="current"';
+
+ $status_links[$status_name] = "" . sprintf( translate_nooped_plural( $status->label_count, $num_posts->$status_name ), number_format_i18n( $num_posts->$status_name ) ) . ' ';
+ }
+
+ if ( ! empty( $this->sticky_posts_count ) ) {
+ $class = ! empty( $_REQUEST['show_sticky'] ) ? ' class="current"' : '';
+
+ $sticky_link = array( 'sticky' => "" . sprintf( _nx( 'Sticky (%s) ', 'Sticky (%s) ', $this->sticky_posts_count, 'posts' ), number_format_i18n( $this->sticky_posts_count ) ) . ' ' );
+
+ // Sticky comes after Publish, or if not listed, after All.
+ $split = 1 + array_search( ( isset( $status_links['publish'] ) ? 'publish' : 'all' ), array_keys( $status_links ) );
+ $status_links = array_merge( array_slice( $status_links, 0, $split ), $sticky_link, array_slice( $status_links, $split ) );
+ }
+
+ return $status_links;
+ }
+
+ function get_bulk_actions() {
+ $actions = array();
+
+ if ( $this->is_trash )
+ $actions['untrash'] = __( 'Restore' );
+ else
+ $actions['edit'] = __( 'Edit' );
+
+ if ( $this->is_trash || !EMPTY_TRASH_DAYS )
+ $actions['delete'] = __( 'Delete Permanently' );
+ else
+ $actions['trash'] = __( 'Move to Trash' );
+
+ return $actions;
+ }
+
+ function extra_tablenav( $which ) {
+ global $post_type, $post_type_object, $cat;
+?>
+
+months_dropdown( $post_type );
+
+ if ( is_object_in_taxonomy( $post_type, 'category' ) ) {
+ $dropdown_options = array(
+ 'show_option_all' => __( 'View all categories' ),
+ 'hide_empty' => 0,
+ 'hierarchical' => 1,
+ 'show_count' => 0,
+ 'orderby' => 'name',
+ 'selected' => $cat
+ );
+ wp_dropdown_categories( $dropdown_options );
+ }
+ do_action( 'restrict_manage_posts' );
+ submit_button( __( 'Filter' ), 'secondary', false, false, array( 'id' => 'post-query-submit' ) );
+ }
+
+ if ( $this->is_trash && current_user_can( $post_type_object->cap->edit_others_posts ) ) {
+ submit_button( __( 'Empty Trash' ), 'button-secondary apply', 'delete_all', false );
+ }
+?>
+
+hierarchical )
+ $this->view_switcher( $mode );
+ }
+
+ function get_table_classes() {
+ global $post_type_object;
+
+ return array( 'widefat', 'fixed', $post_type_object->hierarchical ? 'pages' : 'posts' );
+ }
+
+ function get_columns() {
+ $screen = get_current_screen();
+
+ if ( empty( $screen ) )
+ $post_type = 'post';
+ else
+ $post_type = $screen->post_type;
+
+ $posts_columns = array();
+
+ $posts_columns['cb'] = ' ';
+
+ /* translators: manage posts column name */
+ $posts_columns['title'] = _x( 'Title', 'column name' );
+
+ if ( post_type_supports( $post_type, 'author' ) )
+ $posts_columns['author'] = __( 'Author' );
+
+ if ( empty( $post_type ) || is_object_in_taxonomy( $post_type, 'category' ) )
+ $posts_columns['categories'] = __( 'Categories' );
+
+ if ( empty( $post_type ) || is_object_in_taxonomy( $post_type, 'post_tag' ) )
+ $posts_columns['tags'] = __( 'Tags' );
+
+ $post_status = !empty( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all';
+ if ( post_type_supports( $post_type, 'comments' ) && !in_array( $post_status, array( 'pending', 'draft', 'future' ) ) )
+ $posts_columns['comments'] = ' ';
+
+ $posts_columns['date'] = __( 'Date' );
+
+ if ( 'page' == $post_type )
+ $posts_columns = apply_filters( 'manage_pages_columns', $posts_columns );
+ else
+ $posts_columns = apply_filters( 'manage_posts_columns', $posts_columns, $post_type );
+ $posts_columns = apply_filters( "manage_{$post_type}_posts_columns", $posts_columns );
+
+ return $posts_columns;
+ }
+
+ function get_sortable_columns() {
+ return array(
+ 'title' => 'title',
+ 'author' => 'author',
+ 'parent' => 'parent',
+ 'comments' => 'comment_count',
+ 'date' => array( 'date', true )
+ );
+ }
+
+ function display_rows( $posts = array() ) {
+ global $wp_query, $post_type_object, $per_page;
+
+ if ( empty( $posts ) )
+ $posts = $wp_query->posts;
+
+ if ( $this->hierarchical_display ) {
+ $this->_display_rows_hierarchical( $posts, $this->get_pagenum(), $per_page );
+ } else {
+ $this->_display_rows( $posts );
+ }
+ }
+
+ function _display_rows( $posts ) {
+ global $post, $mode;
+
+ add_filter( 'the_title', 'esc_html' );
+
+ // Create array of post IDs.
+ $post_ids = array();
+
+ foreach ( $posts as $a_post )
+ $post_ids[] = $a_post->ID;
+
+ $this->comment_pending_count = get_pending_comments_num( $post_ids );
+
+ foreach ( $posts as $post )
+ $this->single_row( $post );
+ }
+
+ function _display_rows_hierarchical( $pages, $pagenum = 1, $per_page = 20 ) {
+ global $wpdb;
+
+ $level = 0;
+
+ if ( ! $pages ) {
+ $pages = get_pages( array( 'sort_column' => 'menu_order' ) );
+
+ if ( ! $pages )
+ return false;
+ }
+
+ /*
+ * arrange pages into two parts: top level pages and children_pages
+ * children_pages is two dimensional array, eg.
+ * children_pages[10][] contains all sub-pages whose parent is 10.
+ * It only takes O( N ) to arrange this and it takes O( 1 ) for subsequent lookup operations
+ * If searching, ignore hierarchy and treat everything as top level
+ */
+ if ( empty( $_REQUEST['s'] ) ) {
+
+ $top_level_pages = array();
+ $children_pages = array();
+
+ foreach ( $pages as $page ) {
+
+ // catch and repair bad pages
+ if ( $page->post_parent == $page->ID ) {
+ $page->post_parent = 0;
+ $wpdb->update( $wpdb->posts, array( 'post_parent' => 0 ), array( 'ID' => $page->ID ) );
+ clean_page_cache( $page->ID );
+ }
+
+ if ( 0 == $page->post_parent )
+ $top_level_pages[] = $page;
+ else
+ $children_pages[ $page->post_parent ][] = $page;
+ }
+
+ $pages = &$top_level_pages;
+ }
+
+ $count = 0;
+ $start = ( $pagenum - 1 ) * $per_page;
+ $end = $start + $per_page;
+
+ foreach ( $pages as $page ) {
+ if ( $count >= $end )
+ break;
+
+ if ( $count >= $start )
+ echo "\t" . $this->single_row( $page, $level );
+
+ $count++;
+
+ if ( isset( $children_pages ) )
+ $this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
+ }
+
+ // if it is the last pagenum and there are orphaned pages, display them with paging as well
+ if ( isset( $children_pages ) && $count < $end ){
+ foreach ( $children_pages as $orphans ){
+ foreach ( $orphans as $op ) {
+ if ( $count >= $end )
+ break;
+ if ( $count >= $start )
+ echo "\t" . $this->single_row( $op, 0 );
+ $count++;
+ }
+ }
+ }
+ }
+
+ /**
+ * Given a top level page ID, display the nested hierarchy of sub-pages
+ * together with paging support
+ *
+ * @since 3.1.0 (Standalone function exists since 2.6.0)
+ *
+ * @param unknown_type $children_pages
+ * @param unknown_type $count
+ * @param unknown_type $parent
+ * @param unknown_type $level
+ * @param unknown_type $pagenum
+ * @param unknown_type $per_page
+ */
+ function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) {
+
+ if ( ! isset( $children_pages[$parent] ) )
+ return;
+
+ $start = ( $pagenum - 1 ) * $per_page;
+ $end = $start + $per_page;
+
+ foreach ( $children_pages[$parent] as $page ) {
+
+ if ( $count >= $end )
+ break;
+
+ // If the page starts in a subtree, print the parents.
+ if ( $count == $start && $page->post_parent > 0 ) {
+ $my_parents = array();
+ $my_parent = $page->post_parent;
+ while ( $my_parent ) {
+ $my_parent = get_post( $my_parent );
+ $my_parents[] = $my_parent;
+ if ( !$my_parent->post_parent )
+ break;
+ $my_parent = $my_parent->post_parent;
+ }
+ $num_parents = count( $my_parents );
+ while ( $my_parent = array_pop( $my_parents ) ) {
+ echo "\t" . $this->single_row( $my_parent, $level - $num_parents );
+ $num_parents--;
+ }
+ }
+
+ if ( $count >= $start )
+ echo "\t" . $this->single_row( $page, $level );
+
+ $count++;
+
+ $this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
+ }
+
+ unset( $children_pages[$parent] ); //required in order to keep track of orphans
+ }
+
+ function single_row( $a_post, $level = 0 ) {
+ global $post, $current_screen, $mode;
+ static $rowclass;
+
+ $global_post = $post;
+ $post = $a_post;
+ setup_postdata( $post );
+
+ $rowclass = 'alternate' == $rowclass ? '' : 'alternate';
+ $post_owner = ( get_current_user_id() == $post->post_author ? 'self' : 'other' );
+ $edit_link = get_edit_post_link( $post->ID );
+ $title = _draft_or_post_title();
+ $post_type_object = get_post_type_object( $post->post_type );
+ $can_edit_post = current_user_can( $post_type_object->cap->edit_post, $post->ID );
+ $post_format = get_post_format( $post->ID );
+ $post_format_class = ( $post_format && !is_wp_error($post_format) ) ? 'format-' . sanitize_html_class( $post_format ) : 'format-default';
+ ?>
+ post_status . ' ' . $post_format_class); ?> iedit' valign="top">
+ get_column_info();
+
+ foreach ( $columns as $column_name => $column_display_name ) {
+ $class = "class=\"$column_name column-$column_name\"";
+
+ $style = '';
+ if ( in_array( $column_name, $hidden ) )
+ $style = ' style="display:none;"';
+
+ $attributes = "$class$style";
+
+ switch ( $column_name ) {
+
+ case 'cb':
+ ?>
+
+ hierarchical_display ) {
+ $attributes = 'class="post-title page-title column-title"' . $style;
+
+ if ( 0 == $level && (int) $post->post_parent > 0 ) {
+ //sent level 0 by accident, by default, or because we don't know the actual level
+ $find_main_page = (int) $post->post_parent;
+ while ( $find_main_page > 0 ) {
+ $parent = get_page( $find_main_page );
+
+ if ( is_null( $parent ) )
+ break;
+
+ $level++;
+ $find_main_page = (int) $parent->post_parent;
+
+ if ( !isset( $parent_name ) )
+ $parent_name = apply_filters( 'the_title', $parent->post_title, $parent->ID );
+ }
+ }
+
+ $post->post_title = esc_html( $post->post_title );
+ $pad = str_repeat( '— ', $level );
+?>
+ >post_status != 'trash' ) { ?> labels->parent_item_colon . ' ' . esc_html( $parent_name ) : ''; ?>
+
+ >post_status != 'trash' ) { ?>
+post_status ) {
+ $actions['edit'] = '' . __( 'Edit' ) . ' ';
+ $actions['inline hide-if-no-js'] = '' . __( 'Quick Edit' ) . ' ';
+ }
+ if ( current_user_can( $post_type_object->cap->delete_post, $post->ID ) ) {
+ if ( 'trash' == $post->post_status )
+ $actions['untrash'] = "ID ) ), 'untrash-' . $post->post_type . '_' . $post->ID ) . "'>" . __( 'Restore' ) . " ";
+ elseif ( EMPTY_TRASH_DAYS )
+ $actions['trash'] = "" . __( 'Trash' ) . " ";
+ if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS )
+ $actions['delete'] = "" . __( 'Delete Permanently' ) . " ";
+ }
+ if ( in_array( $post->post_status, array( 'pending', 'draft' ) ) ) {
+ if ( $can_edit_post )
+ $actions['view'] = '' . __( 'Preview' ) . ' ';
+ } elseif ( 'trash' != $post->post_status ) {
+ $actions['view'] = '' . __( 'View' ) . ' ';
+ }
+
+ $actions = apply_filters( is_post_type_hierarchical( $post->post_type ) ? 'page_row_actions' : 'post_row_actions', $actions, $post );
+ echo $this->row_actions( $actions );
+
+ get_inline_data( $post );
+ echo ' ';
+ break;
+
+ case 'date':
+ if ( '0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name ) {
+ $t_time = $h_time = __( 'Unpublished' );
+ $time_diff = 0;
+ } else {
+ $t_time = get_the_time( __( 'Y/m/d g:i:s A' ) );
+ $m_time = $post->post_date;
+ $time = get_post_time( 'G', true, $post );
+
+ $time_diff = time() - $time;
+
+ if ( $time_diff > 0 && $time_diff < 24*60*60 )
+ $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
+ else
+ $h_time = mysql2date( __( 'Y/m/d' ), $m_time );
+ }
+
+ echo '';
+ if ( 'excerpt' == $mode )
+ echo apply_filters( 'post_date_column_time', $t_time, $post, $column_name, $mode );
+ else
+ echo '' . apply_filters( 'post_date_column_time', $h_time, $post, $column_name, $mode ) . ' ';
+ echo ' ';
+ if ( 'publish' == $post->post_status ) {
+ _e( 'Published' );
+ } elseif ( 'future' == $post->post_status ) {
+ if ( $time_diff > 0 )
+ echo '' . __( 'Missed schedule' ) . ' ';
+ else
+ _e( 'Scheduled' );
+ } else {
+ _e( 'Last Modified' );
+ }
+ echo ' ';
+ break;
+
+ case 'categories':
+ ?>
+ >%s',
+ esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'category_name' => $c->slug ), 'edit.php' ) ),
+ esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'category', 'display' ) )
+ );
+ }
+ echo join( ', ', $out );
+ } else {
+ _e( 'Uncategorized' );
+ }
+ ?>
+
+ >ID );
+ if ( !empty( $tags ) ) {
+ $out = array();
+ foreach ( $tags as $c ) {
+ $out[] = sprintf( '%s ',
+ esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'tag' => $c->slug ), 'edit.php' ) ),
+ esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'tag', 'display' ) )
+ );
+ }
+ echo join( ', ', $out );
+ } else {
+ _e( 'No Tags' );
+ }
+ ?>
+
+ >
+ comment_pending_count[$post->ID] ) ? $this->comment_pending_count[$post->ID] : 0;
+
+ $this->comments_bubble( $post->ID, $pending_comments );
+ ?>
+
+
+ >%s',
+ esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'author' => get_the_author_meta( 'ID' ) ), 'edit.php' )),
+ get_the_author()
+ );
+ ?>
+
+ >post_type ) )
+ do_action( 'manage_pages_custom_column', $column_name, $post->ID );
+ else
+ do_action( 'manage_posts_custom_column', $column_name, $post->ID );
+ do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID );
+ ?>
+
+
+ post_type );
+ $post_type_object = get_post_type_object( $screen->post_type );
+
+ $taxonomy_names = get_object_taxonomies( $screen->post_type );
+ $hierarchical_taxonomies = array();
+ $flat_taxonomies = array();
+ foreach ( $taxonomy_names as $taxonomy_name ) {
+ $taxonomy = get_taxonomy( $taxonomy_name );
+
+ if ( !$taxonomy->show_ui )
+ continue;
+
+ if ( $taxonomy->hierarchical )
+ $hierarchical_taxonomies[] = $taxonomy;
+ else
+ $flat_taxonomies[] = $taxonomy;
+ }
+
+ $m = ( isset( $mode ) && 'excerpt' == $mode ) ? 'excerpt' : 'list';
+ $can_publish = current_user_can( $post_type_object->cap->publish_posts );
+ $core_columns = array( 'cb' => true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true );
+
+ ?>
+
+
+
diff --git a/wp-admin/includes/class-wp-terms-list-table.php b/wp-admin/includes/class-wp-terms-list-table.php
new file mode 100644
index 00000000..ac4d963c
--- /dev/null
+++ b/wp-admin/includes/class-wp-terms-list-table.php
@@ -0,0 +1,379 @@
+ true ) ) ) )
+ $post_type = 'post';
+
+ parent::WP_List_Table( array(
+ 'plural' => 'tags',
+ 'singular' => 'tag',
+ ) );
+ }
+
+ function ajax_user_can() {
+ global $tax;
+
+ return current_user_can( $tax->cap->manage_terms );
+ }
+
+ function prepare_items() {
+ global $taxonomy;
+
+ $tags_per_page = $this->get_items_per_page( 'edit_' . $taxonomy . '_per_page' );
+
+ if ( 'post_tag' == $taxonomy ) {
+ $tags_per_page = apply_filters( 'edit_tags_per_page', $tags_per_page );
+ $tags_per_page = apply_filters( 'tagsperpage', $tags_per_page ); // Old filter
+ } elseif ( 'category' == $taxonomy ) {
+ $tags_per_page = apply_filters( 'edit_categories_per_page', $tags_per_page ); // Old filter
+ }
+
+ $search = !empty( $_REQUEST['s'] ) ? trim( stripslashes( $_REQUEST['s'] ) ) : '';
+
+ $args = array(
+ 'search' => $search,
+ 'page' => $this->get_pagenum(),
+ 'number' => $tags_per_page,
+ );
+
+ if ( !empty( $_REQUEST['orderby'] ) )
+ $args['orderby'] = trim( stripslashes( $_REQUEST['orderby'] ) );
+
+ if ( !empty( $_REQUEST['order'] ) )
+ $args['order'] = trim( stripslashes( $_REQUEST['order'] ) );
+
+ $this->callback_args = $args;
+
+ $this->set_pagination_args( array(
+ 'total_items' => wp_count_terms( $taxonomy, compact( 'search' ) ),
+ 'per_page' => $tags_per_page,
+ ) );
+ }
+
+ function has_items() {
+ // todo: populate $this->items in prepare_items()
+ return true;
+ }
+
+ function get_bulk_actions() {
+ $actions = array();
+ $actions['delete'] = __( 'Delete' );
+
+ return $actions;
+ }
+
+ function current_action() {
+ if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && ( 'delete' == $_REQUEST['action'] || 'delete' == $_REQUEST['action2'] ) )
+ return 'bulk-delete';
+
+ return parent::current_action();
+ }
+
+ function get_columns() {
+ global $taxonomy, $typenow;
+
+ $columns = array(
+ 'cb' => ' ',
+ 'name' => __( 'Name' ),
+ 'description' => __( 'Description' ),
+ 'slug' => __( 'Slug' ),
+ );
+
+ if ( 'link_category' == $taxonomy ) {
+ $columns['links'] = __( 'Links' );
+ } else {
+ $post_type = empty( $typenow ) ? 'post' : $typenow;
+ $post_type_object = get_post_type_object( $post_type );
+ $columns['posts'] = $post_type_object ? $post_type_object->labels->name : __( 'Posts' );
+ }
+
+ return $columns;
+ }
+
+ function get_sortable_columns() {
+ return array(
+ 'name' => 'name',
+ 'description' => 'description',
+ 'slug' => 'slug',
+ 'posts' => 'count',
+ 'links' => 'count'
+ );
+ }
+
+ function display_rows_or_placeholder() {
+ global $taxonomy;
+
+ $args = wp_parse_args( $this->callback_args, array(
+ 'page' => 1,
+ 'number' => 20,
+ 'search' => '',
+ 'hide_empty' => 0
+ ) );
+
+ extract( $args, EXTR_SKIP );
+
+ $args['offset'] = $offset = ( $page - 1 ) * $number;
+
+ // convert it to table rows
+ $out = '';
+ $count = 0;
+
+ $terms = array();
+
+ if ( is_taxonomy_hierarchical( $taxonomy ) && !isset( $orderby ) ) {
+ // We'll need the full set of terms then.
+ $args['number'] = $args['offset'] = 0;
+
+ $terms = get_terms( $taxonomy, $args );
+ if ( !empty( $search ) ) // Ignore children on searches.
+ $children = array();
+ else
+ $children = _get_term_hierarchy( $taxonomy );
+
+ // Some funky recursion to get the job done( Paging & parents mainly ) is contained within, Skip it for non-hierarchical taxonomies for performance sake
+ $out .= $this->_rows( $taxonomy, $terms, $children, $offset, $number, $count );
+ } else {
+ $terms = get_terms( $taxonomy, $args );
+ foreach ( $terms as $term )
+ $out .= $this->single_row( $term, 0, $taxonomy );
+ $count = $number; // Only displaying a single page.
+ }
+
+ if ( empty( $terms ) ) {
+ list( $columns, $hidden ) = $this->get_column_info();
+ echo '';
+ $this->no_items();
+ echo ' ';
+ } else {
+ echo $out;
+ }
+ }
+
+ function _rows( $taxonomy, $terms, &$children, $start = 0, $per_page = 20, &$count, $parent = 0, $level = 0 ) {
+
+ $end = $start + $per_page;
+
+ $output = '';
+ foreach ( $terms as $key => $term ) {
+
+ if ( $count >= $end )
+ break;
+
+ if ( $term->parent != $parent && empty( $_REQUEST['s'] ) )
+ continue;
+
+ // If the page starts in a subtree, print the parents.
+ if ( $count == $start && $term->parent > 0 && empty( $_REQUEST['s'] ) ) {
+ $my_parents = $parent_ids = array();
+ $p = $term->parent;
+ while ( $p ) {
+ $my_parent = get_term( $p, $taxonomy );
+ $my_parents[] = $my_parent;
+ $p = $my_parent->parent;
+ if ( in_array( $p, $parent_ids ) ) // Prevent parent loops.
+ break;
+ $parent_ids[] = $p;
+ }
+ unset( $parent_ids );
+
+ $num_parents = count( $my_parents );
+ while ( $my_parent = array_pop( $my_parents ) ) {
+ $output .= "\t" . $this->single_row( $my_parent, $level - $num_parents, $taxonomy );
+ $num_parents--;
+ }
+ }
+
+ if ( $count >= $start )
+ $output .= "\t" . $this->single_row( $term, $level, $taxonomy );
+
+ ++$count;
+
+ unset( $terms[$key] );
+
+ if ( isset( $children[$term->term_id] ) && empty( $_REQUEST['s'] ) )
+ $output .= $this->_rows( $taxonomy, $terms, $children, $start, $per_page, $count, $term->term_id, $level + 1 );
+ }
+
+ return $output;
+ }
+
+ function single_row( $tag, $level = 0 ) {
+ static $row_class = '';
+ $row_class = ( $row_class == '' ? ' class="alternate"' : '' );
+
+ $this->level = $level;
+
+ echo '';
+ echo $this->single_row_columns( $tag );
+ echo ' ';
+ }
+
+ function column_cb( $tag ) {
+ global $taxonomy, $tax;
+
+ $default_term = get_option( 'default_' . $taxonomy );
+
+ if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term )
+ return ' ';
+ else
+ return ' ';
+ }
+
+ function column_name( $tag ) {
+ global $taxonomy, $tax, $post_type;
+
+ $default_term = get_option( 'default_' . $taxonomy );
+
+ $pad = str_repeat( '— ', max( 0, $this->level ) );
+ $name = apply_filters( 'term_name', $pad . ' ' . $tag->name, $tag );
+ $qe_data = get_term( $tag->term_id, $taxonomy, OBJECT, 'edit' );
+ $edit_link = get_edit_term_link( $tag->term_id, $taxonomy, $post_type );
+
+ $out = '' . $name . ' ';
+
+ $actions = array();
+ if ( current_user_can( $tax->cap->edit_terms ) ) {
+ $actions['edit'] = '' . __( 'Edit' ) . ' ';
+ $actions['inline hide-if-no-js'] = '' . __( 'Quick Edit' ) . ' ';
+ }
+ if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term )
+ $actions['delete'] = "term_id ) . "'>" . __( 'Delete' ) . " ";
+
+ $actions = apply_filters( 'tag_row_actions', $actions, $tag );
+ $actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag );
+
+ $out .= $this->row_actions( $actions );
+ $out .= '';
+ $out .= '
' . $qe_data->name . '
';
+ $out .= '
' . apply_filters( 'editable_slug', $qe_data->slug ) . '
';
+ $out .= '
' . $qe_data->parent . '
';
+
+ return $out;
+ }
+
+ function column_description( $tag ) {
+ return $tag->description;
+ }
+
+ function column_slug( $tag ) {
+ return apply_filters( 'editable_slug', $tag->slug );
+ }
+
+ function column_posts( $tag ) {
+ global $taxonomy, $post_type;
+
+ $count = number_format_i18n( $tag->count );
+
+ $tax = get_taxonomy( $taxonomy );
+
+ if ( ! $tax->public )
+ return $count;
+
+ if ( $tax->query_var ) {
+ $args = array( $tax->query_var => $tag->slug );
+ } else {
+ $args = array( 'taxonomy' => $tax->name, 'term' => $tag->slug );
+ }
+
+ $args['post_type'] = $post_type;
+
+ return "$count ";
+ }
+
+ function column_links( $tag ) {
+ $count = number_format_i18n( $tag->count );
+ if ( $count )
+ $count = "$count ";
+ return $count;
+ }
+
+ function column_default( $tag, $column_name ) {
+ $screen = get_current_screen();
+
+ return apply_filters( "manage_{$screen->taxonomy}_custom_column", '', $column_name, $tag->term_id );
+ }
+
+ /**
+ * Outputs the hidden row displayed when inline editing
+ *
+ * @since 3.1.0
+ */
+ function inline_edit() {
+ global $tax;
+
+ if ( ! current_user_can( $tax->cap->edit_terms ) )
+ return;
+?>
+
+
+
diff --git a/wp-admin/includes/class-wp-theme-install-list-table.php b/wp-admin/includes/class-wp-theme-install-list-table.php
new file mode 100644
index 00000000..7e44267c
--- /dev/null
+++ b/wp-admin/includes/class-wp-theme-install-list-table.php
@@ -0,0 +1,185 @@
+get_pagenum();
+
+ $per_page = 30;
+
+ // These are the tabs which are shown on the page,
+ $tabs = array();
+ $tabs['dashboard'] = __( 'Search' );
+ if ( 'search' == $tab )
+ $tabs['search'] = __( 'Search Results' );
+ $tabs['upload'] = __( 'Upload' );
+ $tabs['featured'] = _x( 'Featured','Theme Installer' );
+ //$tabs['popular'] = _x( 'Popular','Theme Installer' );
+ $tabs['new'] = _x( 'Newest','Theme Installer' );
+ $tabs['updated'] = _x( 'Recently Updated','Theme Installer' );
+
+ $nonmenu_tabs = array( 'theme-information' ); // Valid actions to perform which do not have a Menu item.
+
+ $tabs = apply_filters( 'install_themes_tabs', $tabs );
+ $nonmenu_tabs = apply_filters( 'install_themes_nonmenu_tabs', $nonmenu_tabs );
+
+ // If a non-valid menu tab has been selected, And its not a non-menu action.
+ if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs ) ) )
+ $tab = key( $tabs );
+
+ $args = array( 'page' => $paged, 'per_page' => $per_page, 'fields' => $theme_field_defaults );
+
+ switch ( $tab ) {
+ case 'search':
+ $type = isset( $_REQUEST['type'] ) ? stripslashes( $_REQUEST['type'] ) : '';
+ $term = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : '';
+
+ switch ( $type ) {
+ case 'tag':
+ $terms = explode( ',', $term );
+ $terms = array_map( 'trim', $terms );
+ $terms = array_map( 'sanitize_title_with_dashes', $terms );
+ $args['tag'] = $terms;
+ break;
+ case 'term':
+ $args['search'] = $term;
+ break;
+ case 'author':
+ $args['author'] = $term;
+ break;
+ }
+
+ if ( !empty( $_POST['features'] ) ) {
+ $terms = $_POST['features'];
+ $terms = array_map( 'trim', $terms );
+ $terms = array_map( 'sanitize_title_with_dashes', $terms );
+ $args['tag'] = $terms;
+ $_REQUEST['s'] = implode( ',', $terms );
+ $_REQUEST['type'] = 'tag';
+ }
+
+ add_action( 'install_themes_table_header', 'install_theme_search_form' );
+ break;
+
+ case 'featured':
+ //case 'popular':
+ case 'new':
+ case 'updated':
+ $args['browse'] = $tab;
+ break;
+
+ default:
+ $args = false;
+ }
+
+ if ( !$args )
+ return;
+
+ $api = themes_api( 'query_themes', $args );
+
+ if ( is_wp_error( $api ) )
+ wp_die( $api->get_error_message() . ' ' . __( 'Try again' ) . ' ' );
+
+ $this->items = $api->themes;
+
+ $this->set_pagination_args( array(
+ 'total_items' => $api->info['results'],
+ 'per_page' => $per_page,
+ ) );
+ }
+
+ function no_items() {
+ _e( 'No themes match your request.' );
+ }
+
+ function get_views() {
+ global $tabs, $tab;
+
+ $display_tabs = array();
+ foreach ( (array) $tabs as $action => $text ) {
+ $class = ( $action == $tab ) ? ' class="current"' : '';
+ $href = self_admin_url('theme-install.php?tab=' . $action);
+ $display_tabs['theme-install-'.$action] = "$text ";
+ }
+
+ return $display_tabs;
+ }
+
+ function get_columns() {
+ return array();
+ }
+
+ function display() {
+
+ // wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
+?>
+
+
+
+
+ pagination( 'top' ); ?>
+
+
+
+
+
+
+ display_rows_or_placeholder(); ?>
+
+
+
+
+ pagination( 'bottom' ); ?>
+
+
+
+items;
+
+ $rows = ceil( count( $themes ) / 3 );
+ $table = array();
+ $theme_keys = array_keys( $themes );
+ for ( $row = 1; $row <= $rows; $row++ )
+ for ( $col = 1; $col <= 3; $col++ )
+ $table[$row][$col] = array_shift( $theme_keys );
+
+ foreach ( $table as $row => $cols ) {
+ echo "\t\n";
+ foreach ( $cols as $col => $theme_index ) {
+ $class = array( 'available-theme' );
+ if ( $row == 1 ) $class[] = 'top';
+ if ( $col == 1 ) $class[] = 'left';
+ if ( $row == $rows ) $class[] = 'bottom';
+ if ( $col == 3 ) $class[] = 'right';
+ ?>
+
+ \n";
+ } // end foreach $table
+ }
+}
+
+?>
diff --git a/wp-admin/includes/class-wp-themes-list-table.php b/wp-admin/includes/class-wp-themes-list-table.php
new file mode 100644
index 00000000..91e1d254
--- /dev/null
+++ b/wp-admin/includes/class-wp-themes-list-table.php
@@ -0,0 +1,241 @@
+search = array_merge( $this->search, array_filter( array_map( 'trim', explode( ',', $search ) ) ) );
+ $this->search = array_unique( $this->search );
+ }
+
+ if ( !empty( $_REQUEST['features'] ) ) {
+ $this->features = $_REQUEST['features'];
+ $this->features = array_map( 'trim', $this->features );
+ $this->features = array_map( 'sanitize_title_with_dashes', $this->features );
+ $this->features = array_unique( $this->features );
+ }
+
+ if ( $this->search || $this->features ) {
+ foreach ( $themes as $key => $theme ) {
+ if ( !$this->search_theme( $theme ) )
+ unset( $themes[ $key ] );
+ }
+ }
+
+ unset( $themes[$ct->name] );
+ uksort( $themes, "strnatcasecmp" );
+
+ $per_page = 15;
+ $page = $this->get_pagenum();
+
+ $start = ( $page - 1 ) * $per_page;
+
+ $this->items = array_slice( $themes, $start, $per_page );
+
+ $this->set_pagination_args( array(
+ 'total_items' => count( $themes ),
+ 'per_page' => $per_page,
+ ) );
+ }
+
+ function no_items() {
+ if ( $this->search || $this->features ) {
+ _e( 'No items found.' );
+ return;
+ }
+
+ if ( is_multisite() ) {
+ if ( current_user_can( 'install_themes' ) && current_user_can( 'manage_network_themes' ) ) {
+ printf( __( 'You only have one theme enabled for this site right now. Visit the Network Admin to enable or install more themes.' ), network_admin_url( 'site-themes.php?id=' . $GLOBALS['blog_id'] ), network_admin_url( 'theme-install.php' ) );
+
+ return;
+ } elseif ( current_user_can( 'manage_network_themes' ) ) {
+ printf( __( 'You only have one theme enabled for this site right now. Visit the Network Admin to enable more themes.' ), network_admin_url( 'site-themes.php?id=' . $GLOBALS['blog_id'] ) );
+
+ return;
+ }
+ // else, fallthrough. install_themes doesn't help if you can't enable it.
+ } else {
+ if ( current_user_can( 'install_themes' ) ) {
+ printf( __( 'You only have one theme installed right now. Live a little! You can choose from over 1,000 free themes in the WordPress.org Theme Directory at any time: just click on the Install Themes tab above.' ), admin_url( 'theme-install.php' ) );
+
+ return;
+ }
+ }
+ // Fallthrough.
+ printf( __( 'Only the current theme is available to you. Contact the %s administrator for information about accessing additional themes.' ), get_site_option( 'site_name' ) );
+ }
+
+ function tablenav( $which = 'top' ) {
+ if ( $this->get_pagination_arg( 'total_pages' ) <= 1 )
+ return;
+ ?>
+
+ pagination( $which ); ?>
+
+
+
+
+ tablenav( 'top' ); ?>
+
+
+
+ display_rows_or_placeholder(); ?>
+
+
+
+ tablenav( 'bottom' ); ?>
+items;
+ $theme_names = array_keys( $themes );
+ natcasesort( $theme_names );
+
+ $table = array();
+ $rows = ceil( count( $theme_names ) / 3 );
+ for ( $row = 1; $row <= $rows; $row++ )
+ for ( $col = 1; $col <= 3; $col++ )
+ $table[$row][$col] = array_shift( $theme_names );
+
+ foreach ( $table as $row => $cols ) {
+?>
+
+ $theme_name ) {
+ $class = array( 'available-theme' );
+ if ( $row == 1 ) $class[] = 'top';
+ if ( $col == 1 ) $class[] = 'left';
+ if ( $row == $rows ) $class[] = 'bottom';
+ if ( $col == 3 ) $class[] = 'right';
+?>
+
+ 1, 'template' => $template, 'stylesheet' => $stylesheet, 'preview_iframe' => true, 'TB_iframe' => 'true' ), $preview_link ) );
+ $preview_text = esc_attr( sprintf( __( 'Preview of “%s”' ), $title ) );
+ $tags = $themes[$theme_name]['Tags'];
+ $thickbox_class = 'thickbox thickbox-preview';
+ $activate_link = wp_nonce_url( "themes.php?action=activate&template=".urlencode( $template )."&stylesheet=".urlencode( $stylesheet ), 'switch-theme_' . $template );
+ $activate_text = esc_attr( sprintf( __( 'Activate “%s”' ), $title ) );
+ $actions = array();
+ $actions[] = '' . __( 'Activate' ) . ' ';
+ $actions[] = '' . __( 'Preview' ) . ' ';
+ if ( ! is_multisite() && current_user_can( 'delete_themes' ) )
+ $actions[] = '' . __( 'Delete' ) . ' ';
+ $actions = apply_filters( 'theme_action_links', $actions, $themes[$theme_name] );
+
+ $actions = implode ( ' | ', $actions );
+?>
+
+
+
+
+
+
+
+
+
+ %2$s. The stylesheet files are located in %3$s
. %4$s uses templates from %5$s . Changes made to the templates will affect both themes.' ), $title, str_replace( WP_CONTENT_DIR, '', $template_dir ), str_replace( WP_CONTENT_DIR, '', $stylesheet_dir ), $title, $parent_theme ); ?>
+
+ %2$s.' ), $title, str_replace( WP_CONTENT_DIR, '', $template_dir ), str_replace( WP_CONTENT_DIR, '', $stylesheet_dir ) ); ?>
+
+
+
+
+
+
+
+
+
+search ) > 0 ) {
+ foreach ( $this->search as $word ) {
+ $matched = 0;
+
+ // In a tag?
+ if ( in_array( $word, array_map( 'sanitize_title_with_dashes', $theme['Tags'] ) ) )
+ $matched = 1;
+
+ // In one of the fields?
+ foreach ( array( 'Name', 'Title', 'Description', 'Author', 'Template', 'Stylesheet' ) AS $field ) {
+ if ( stripos( $theme[$field], $word ) !== false )
+ $matched++;
+ }
+
+ if ( $matched == 0 )
+ return false;
+ }
+ }
+
+ // Now search the features
+ if ( count( $this->features ) > 0 ) {
+ foreach ( $this->features as $word ) {
+ // In a tag?
+ if ( !in_array( $word, array_map( 'sanitize_title_with_dashes', $theme['Tags'] ) ) )
+ return false;
+ }
+ }
+
+ // Only get here if each word exists in the tags or one of the fields
+ return true;
+ }
+}
+
+?>
diff --git a/wp-admin/includes/class-wp-upgrader.php b/wp-admin/includes/class-wp-upgrader.php
index 28185fce..3b5ab902 100644
--- a/wp-admin/includes/class-wp-upgrader.php
+++ b/wp-admin/includes/class-wp-upgrader.php
@@ -368,14 +368,14 @@ class Plugin_Upgrader extends WP_Upgrader {
function upgrade_strings() {
$this->strings['up_to_date'] = __('The plugin is at the latest version.');
- $this->strings['no_package'] = __('Upgrade package not available.');
+ $this->strings['no_package'] = __('Update package not available.');
$this->strings['downloading_package'] = __('Downloading update from %s …');
$this->strings['unpack_package'] = __('Unpacking the update…');
$this->strings['deactivate_plugin'] = __('Deactivating the plugin…');
$this->strings['remove_old'] = __('Removing the old version of the plugin…');
$this->strings['remove_old_failed'] = __('Could not remove the old plugin.');
- $this->strings['process_failed'] = __('Plugin upgrade failed.');
- $this->strings['process_success'] = __('Plugin upgraded successfully.');
+ $this->strings['process_failed'] = __('Plugin update failed.');
+ $this->strings['process_success'] = __('Plugin updated successfully.');
}
function install_strings() {
@@ -468,7 +468,12 @@ class Plugin_Upgrader extends WP_Upgrader {
$this->skin->bulk_header();
- $this->maintenance_mode(true);
+ // Only start maintenance mode if running in Multisite OR the plugin is in use
+ $maintenance = is_multisite(); // @TODO: This should only kick in for individual sites if at all possible.
+ foreach ( $plugins as $plugin )
+ $maintenance = $maintenance || (is_plugin_active($plugin) && isset($current->response[ $plugin ]) ); // Only activate Maintenance mode if a plugin is active AND has an update available
+ if ( $maintenance )
+ $this->maintenance_mode(true);
$results = array();
@@ -603,13 +608,13 @@ class Theme_Upgrader extends WP_Upgrader {
function upgrade_strings() {
$this->strings['up_to_date'] = __('The theme is at the latest version.');
- $this->strings['no_package'] = __('Upgrade package not available.');
+ $this->strings['no_package'] = __('Update package not available.');
$this->strings['downloading_package'] = __('Downloading update from %s …');
$this->strings['unpack_package'] = __('Unpacking the update…');
$this->strings['remove_old'] = __('Removing the old version of the theme…');
$this->strings['remove_old_failed'] = __('Could not remove the old theme.');
- $this->strings['process_failed'] = __('Theme upgrade failed.');
- $this->strings['process_success'] = __('Theme upgraded successfully.');
+ $this->strings['process_failed'] = __('Theme update failed.');
+ $this->strings['process_success'] = __('Theme updated successfully.');
}
function install_strings() {
@@ -712,7 +717,12 @@ class Theme_Upgrader extends WP_Upgrader {
$this->skin->bulk_header();
- $this->maintenance_mode(true);
+ // Only start maintenance mode if running in Multisite OR the theme is in use
+ $maintenance = is_multisite(); // @TODO: This should only kick in for individual sites if at all possible.
+ foreach ( $themes as $theme )
+ $maintenance = $maintenance || $theme == get_stylesheet() || $theme == get_template();
+ if ( $maintenance )
+ $this->maintenance_mode(true);
$results = array();
@@ -780,7 +790,7 @@ class Theme_Upgrader extends WP_Upgrader {
if ( $theme != get_stylesheet() ) //If not current
return $return;
- //Change to maintainence mode now.
+ //Change to maintenance mode now.
if ( ! $this->bulk )
$this->maintenance_mode(true);
@@ -796,6 +806,7 @@ class Theme_Upgrader extends WP_Upgrader {
return $return;
//Ensure stylesheet name hasnt changed after the upgrade:
+ // @TODO: Note, This doesnt handle the Template changing, or the Template name changing.
if ( $theme == get_stylesheet() && $theme != $this->result['destination_name'] ) {
$theme_info = $this->theme_info();
$stylesheet = $this->result['destination_name'];
@@ -803,7 +814,7 @@ class Theme_Upgrader extends WP_Upgrader {
switch_theme($template, $stylesheet, true);
}
- //Time to remove maintainence mode
+ //Time to remove maintenance mode
if ( ! $this->bulk )
$this->maintenance_mode(false);
return $return;
@@ -850,7 +861,7 @@ class Core_Upgrader extends WP_Upgrader {
function upgrade_strings() {
$this->strings['up_to_date'] = __('WordPress is at the latest version.');
- $this->strings['no_package'] = __('Upgrade package not available.');
+ $this->strings['no_package'] = __('Update package not available.');
$this->strings['downloading_package'] = __('Downloading update from %s …');
$this->strings['unpack_package'] = __('Unpacking the update…');
$this->strings['copy_failed'] = __('Could not copy files.');
@@ -1006,7 +1017,7 @@ class Plugin_Upgrader_Skin extends WP_Upgrader_Skin {
}
function __construct($args = array()) {
- $defaults = array( 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => __('Upgrade Plugin') );
+ $defaults = array( 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => __('Update Plugin') );
$args = wp_parse_args($args, $defaults);
$this->plugin = $args['plugin'];
@@ -1026,7 +1037,7 @@ class Plugin_Upgrader_Skin extends WP_Upgrader_Skin {
$update_actions = array(
'activate_plugin' => '' . __('Activate Plugin') . ' ',
- 'plugins_page' => '' . __('Return to Plugins page') . ' '
+ 'plugins_page' => '' . __('Return to Plugins page') . ' '
);
if ( $this->plugin_active )
unset( $update_actions['activate_plugin'] );
@@ -1035,7 +1046,7 @@ class Plugin_Upgrader_Skin extends WP_Upgrader_Skin {
$update_actions = apply_filters('update_plugin_complete_actions', $update_actions, $this->plugin);
if ( ! empty($update_actions) )
- $this->feedback('' . __('Actions:') . ' ' . implode(' | ', (array)$update_actions));
+ $this->feedback(implode(' | ', (array)$update_actions));
}
function before() {
@@ -1069,8 +1080,8 @@ class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
}
function add_strings() {
- $this->upgrader->strings['skin_upgrade_start'] = __('The update process is starting. This process may take awhile on some hosts, so please be patient.');
- $this->upgrader->strings['skin_update_failed_error'] = __('An error occured while updating %1$s: %2$s .');
+ $this->upgrader->strings['skin_upgrade_start'] = __('The update process is starting. This process may take a while on some hosts, so please be patient.');
+ $this->upgrader->strings['skin_update_failed_error'] = __('An error occurred while updating %1$s: %2$s .');
$this->upgrader->strings['skin_update_failed'] = __('The update of %1$s failed.');
$this->upgrader->strings['skin_update_successful'] = __('%1$s updated successfully.').' '.__('Show Details').' '.__('Hide Details').' . ';
$this->upgrader->strings['skin_upgrade_end'] = __('All updates have been completed.');
@@ -1184,13 +1195,13 @@ class Bulk_Plugin_Upgrader_Skin extends Bulk_Upgrader_Skin {
function bulk_footer() {
parent::bulk_footer();
$update_actions = array(
- 'plugins_page' => '' . __('Return to Plugins page') . ' ',
- 'updates_page' => '' . __('Return to WordPress Updates') . ' '
+ 'plugins_page' => '' . __('Return to Plugins page') . ' ',
+ 'updates_page' => '' . __('Return to WordPress Updates') . ' '
);
$update_actions = apply_filters('update_bulk_plugins_complete_actions', $update_actions, $this->plugin_info);
if ( ! empty($update_actions) )
- $this->feedback('' . __('Actions:') . ' ' . implode(' | ', (array)$update_actions));
+ $this->feedback(implode(' | ', (array)$update_actions));
}
}
@@ -1215,13 +1226,13 @@ class Bulk_Theme_Upgrader_Skin extends Bulk_Upgrader_Skin {
function bulk_footer() {
parent::bulk_footer();
$update_actions = array(
- 'themes_page' => '' . __('Return to Themes page') . ' ',
- 'updates_page' => '' . __('Return to WordPress Updates') . ' '
+ 'themes_page' => '' . __('Return to Themes page') . ' ',
+ 'updates_page' => '' . __('Return to WordPress Updates') . ' '
);
$update_actions = apply_filters('update_bulk_theme_complete_actions', $update_actions, $this->theme_info);
if ( ! empty($update_actions) )
- $this->feedback('' . __('Actions:') . ' ' . implode(' | ', (array)$update_actions));
+ $this->feedback(implode(' | ', (array)$update_actions));
}
}
@@ -1270,15 +1281,17 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
else
$install_actions['activate_plugin'] = '' . __('Activate Plugin') . ' ';
- if ( is_multisite() && current_user_can( 'manage_network_plugins' ) )
- $install_actions['network_activate'] = '' . __('Network Activate') . ' ';
+ if ( is_multisite() && current_user_can( 'manage_network_plugins' ) ) {
+ $install_actions['network_activate'] = '' . __('Network Activate') . ' ';
+ unset( $install_actions['activate_plugin'] );
+ }
if ( 'import' == $from )
$install_actions['importers_page'] = '' . __('Return to Importers') . ' ';
else if ( $this->type == 'web' )
- $install_actions['plugins_page'] = '' . __('Return to Plugin Installer') . ' ';
+ $install_actions['plugins_page'] = '' . __('Return to Plugin Installer') . ' ';
else
- $install_actions['plugins_page'] = '' . __('Return to Plugins page') . ' ';
+ $install_actions['plugins_page'] = '' . __('Return to Plugins page') . ' ';
if ( ! $this->result || is_wp_error($this->result) ) {
@@ -1287,7 +1300,7 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
}
$install_actions = apply_filters('install_plugin_complete_actions', $install_actions, $this->api, $plugin_file);
if ( ! empty($install_actions) )
- $this->feedback('' . __('Actions:') . ' ' . implode(' | ', (array)$install_actions));
+ $this->feedback(implode(' | ', (array)$install_actions));
}
}
@@ -1345,16 +1358,16 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
);
if ( $this->type == 'web' )
- $install_actions['themes_page'] = '' . __('Return to Theme Installer') . ' ';
+ $install_actions['themes_page'] = '' . __('Return to Theme Installer') . ' ';
else
- $install_actions['themes_page'] = '' . __('Return to Themes page') . ' ';
+ $install_actions['themes_page'] = '' . __('Return to Themes page') . ' ';
- if ( ! $this->result || is_wp_error($this->result) )
+ if ( ! $this->result || is_wp_error($this->result) || is_network_admin() )
unset( $install_actions['activate'], $install_actions['preview'] );
$install_actions = apply_filters('install_theme_complete_actions', $install_actions, $this->api, $stylesheet, $theme_info);
if ( ! empty($install_actions) )
- $this->feedback('' . __('Actions:') . ' ' . implode(' | ', (array)$install_actions));
+ $this->feedback(implode(' | ', (array)$install_actions));
}
}
@@ -1375,7 +1388,7 @@ class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
}
function __construct($args = array()) {
- $defaults = array( 'url' => '', 'theme' => '', 'nonce' => '', 'title' => __('Upgrade Theme') );
+ $defaults = array( 'url' => '', 'theme' => '', 'nonce' => '', 'title' => __('Update Theme') );
$args = wp_parse_args($args, $defaults);
$this->theme = $args['theme'];
@@ -1404,11 +1417,11 @@ class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
unset($update_actions['preview'], $update_actions['activate']);
}
- $update_actions['themes_page'] = '' . __('Return to Themes page') . ' ';
+ $update_actions['themes_page'] = '' . __('Return to Themes page') . ' ';
$update_actions = apply_filters('update_theme_complete_actions', $update_actions, $this->theme);
if ( ! empty($update_actions) )
- $this->feedback('' . __('Actions:') . ' ' . implode(' | ', (array)$update_actions));
+ $this->feedback(implode(' | ', (array)$update_actions));
}
}
@@ -1452,4 +1465,4 @@ class File_Upload_Upgrader {
$this->package = $uploads['basedir'] . '/' . $this->filename;
}
}
-}
+}
\ No newline at end of file
diff --git a/wp-admin/includes/class-wp-users-list-table.php b/wp-admin/includes/class-wp-users-list-table.php
new file mode 100644
index 00000000..d52d75f0
--- /dev/null
+++ b/wp-admin/includes/class-wp-users-list-table.php
@@ -0,0 +1,319 @@
+is_site_users = 'site-users-network' == $screen->id;
+
+ if ( $this->is_site_users )
+ $this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
+
+ parent::WP_List_Table( array(
+ 'singular' => 'user',
+ 'plural' => 'users'
+ ) );
+ }
+
+ function ajax_user_can() {
+ if ( $this->is_site_users )
+ return current_user_can( 'manage_sites' );
+ else
+ return current_user_can( 'list_users' );
+ }
+
+ function prepare_items() {
+ global $role, $usersearch;
+
+ $usersearch = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : '';
+
+ $role = isset( $_REQUEST['role'] ) ? $_REQUEST['role'] : '';
+
+ $per_page = ( $this->is_site_users ) ? 'site_users_network_per_page' : 'users_per_page';
+ $users_per_page = $this->get_items_per_page( $per_page );
+
+ $paged = $this->get_pagenum();
+
+ $args = array(
+ 'number' => $users_per_page,
+ 'offset' => ( $paged-1 ) * $users_per_page,
+ 'role' => $role,
+ 'search' => $usersearch,
+ 'fields' => 'all_with_meta'
+ );
+
+ $args['search'] = '*' . $args['search'] . '*';
+
+ if ( $this->is_site_users )
+ $args['blog_id'] = $this->site_id;
+
+ if ( isset( $_REQUEST['orderby'] ) )
+ $args['orderby'] = $_REQUEST['orderby'];
+
+ if ( isset( $_REQUEST['order'] ) )
+ $args['order'] = $_REQUEST['order'];
+
+ // Query the user IDs for this page
+ $wp_user_search = new WP_User_Query( $args );
+
+ $this->items = $wp_user_search->get_results();
+
+ $this->set_pagination_args( array(
+ 'total_items' => $wp_user_search->get_total(),
+ 'per_page' => $users_per_page,
+ ) );
+ }
+
+ function no_items() {
+ _e( 'No matching users were found.' );
+ }
+
+ function get_views() {
+ global $wp_roles, $role;
+
+ if ( $this->is_site_users ) {
+ $url = 'site-users.php?id=' . $this->site_id;
+ switch_to_blog( $this->site_id );
+ $users_of_blog = count_users();
+ restore_current_blog();
+ } else {
+ $url = 'users.php';
+ $users_of_blog = count_users();
+ }
+ $total_users = $users_of_blog['total_users'];
+ $avail_roles =& $users_of_blog['avail_roles'];
+ unset($users_of_blog);
+
+ $current_role = false;
+ $class = empty($role) ? ' class="current"' : '';
+ $role_links = array();
+ $role_links['all'] = "" . sprintf( _nx( 'All (%s) ', 'All (%s) ', $total_users, 'users' ), number_format_i18n( $total_users ) ) . ' ';
+ foreach ( $wp_roles->get_names() as $this_role => $name ) {
+ if ( !isset($avail_roles[$this_role]) )
+ continue;
+
+ $class = '';
+
+ if ( $this_role == $role ) {
+ $current_role = $role;
+ $class = ' class="current"';
+ }
+
+ $name = translate_user_role( $name );
+ /* translators: User role name with count */
+ $name = sprintf( __('%1$s (%2$s) '), $name, $avail_roles[$this_role] );
+ $role_links[$this_role] = "$name ";
+ }
+
+ return $role_links;
+ }
+
+ function get_bulk_actions() {
+ $actions = array();
+
+ if ( is_multisite() ) {
+ if ( current_user_can( 'remove_users' ) )
+ $actions['remove'] = __( 'Remove' );
+ } else {
+ if ( current_user_can( 'delete_users' ) )
+ $actions['delete'] = __( 'Delete' );
+ }
+
+ return $actions;
+ }
+
+ function extra_tablenav( $which ) {
+ if ( 'top' != $which )
+ return;
+ if ( ! current_user_can( 'promote_users' ) )
+ return;
+?>
+
+
+
+
+
+
+
+
+ ' ',
+ 'username' => __( 'Username' ),
+ 'name' => __( 'Name' ),
+ 'email' => __( 'E-mail' ),
+ 'role' => __( 'Role' ),
+ 'posts' => __( 'Posts' )
+ );
+
+ if ( $this->is_site_users )
+ unset( $c['posts'] );
+
+ return $c;
+ }
+
+ function get_sortable_columns() {
+ $c = array(
+ 'username' => 'login',
+ 'name' => 'name',
+ 'email' => 'email',
+ );
+
+ if ( $this->is_site_users )
+ unset( $c['posts'] );
+
+ return $c;
+ }
+
+ function display_rows() {
+ // Query the post counts for this page
+ if ( ! $this->is_site_users )
+ $post_counts = count_many_users_posts( array_keys( $this->items ) );
+
+ $style = '';
+ foreach ( $this->items as $userid => $user_object ) {
+ $role = reset( $user_object->roles );
+
+ if ( is_multisite() && empty( $role ) )
+ continue;
+
+ $style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"';
+ echo "\n\t", $this->single_row( $user_object, $style, $role, isset( $post_counts ) ? $post_counts[ $userid ] : 0 );
+ }
+ }
+
+ /**
+ * Generate HTML for a single row on the users.php admin panel.
+ *
+ * @since 2.1.0
+ *
+ * @param object $user_object
+ * @param string $style Optional. Attributes added to the TR element. Must be sanitized.
+ * @param string $role Key for the $wp_roles array.
+ * @param int $numposts Optional. Post count to display for this user. Defaults to zero, as in, a new user has made zero posts.
+ * @return string
+ */
+ function single_row( $user_object, $style = '', $role = '', $numposts = 0 ) {
+ global $wp_roles;
+
+ if ( !( is_object( $user_object ) && is_a( $user_object, 'WP_User' ) ) )
+ $user_object = new WP_User( (int) $user_object );
+ $user_object = sanitize_user_object( $user_object, 'display' );
+ $email = $user_object->user_email;
+
+ if ( $this->is_site_users )
+ $url = "site-users.php?id={$this->site_id}&";
+ else
+ $url = 'users.php?';
+
+ $checkbox = '';
+ // Check if the user for this row is editable
+ if ( current_user_can( 'list_users' ) ) {
+ // Set up the user editing link
+ // TODO: make profile/user-edit determination a separate function
+ if ( get_current_user_id() == $user_object->ID ) {
+ $edit_link = 'profile.php';
+ } else {
+ $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), "user-edit.php?user_id=$user_object->ID" ) );
+ }
+
+ // Set up the hover actions for this user
+ $actions = array();
+
+ if ( current_user_can( 'edit_user', $user_object->ID ) ) {
+ $edit = "$user_object->user_login ";
+ $actions['edit'] = '' . __( 'Edit' ) . ' ';
+ } else {
+ $edit = "$user_object->user_login ";
+ }
+
+ if ( !is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'delete_user', $user_object->ID ) )
+ $actions['delete'] = "" . __( 'Delete' ) . " ";
+ if ( is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'remove_user', $user_object->ID ) )
+ $actions['remove'] = "" . __( 'Remove' ) . " ";
+ $actions = apply_filters( 'user_row_actions', $actions, $user_object );
+ $edit .= $this->row_actions( $actions );
+
+ // Set up the checkbox ( because the user is editable, otherwise its empty )
+ $checkbox = " ";
+
+ } else {
+ $edit = '' . $user_object->user_login . ' ';
+ }
+ $role_name = isset( $wp_roles->role_names[$role] ) ? translate_user_role( $wp_roles->role_names[$role] ) : __( 'None' );
+ $avatar = get_avatar( $user_object->ID, 32 );
+
+ $r = "";
+
+ list( $columns, $hidden ) = $this->get_column_info();
+
+ foreach ( $columns as $column_name => $column_display_name ) {
+ $class = "class=\"$column_name column-$column_name\"";
+
+ $style = '';
+ if ( in_array( $column_name, $hidden ) )
+ $style = ' style="display:none;"';
+
+ $attributes = "$class$style";
+
+ switch ( $column_name ) {
+ case 'cb':
+ $r .= "$checkbox ";
+ break;
+ case 'username':
+ $r .= "$avatar $edit ";
+ break;
+ case 'name':
+ $r .= "$user_object->first_name $user_object->last_name ";
+ break;
+ case 'email':
+ $r .= "$email ";
+ break;
+ case 'role':
+ $r .= "$role_name ";
+ break;
+ case 'posts':
+ $attributes = 'class="posts column-posts num"' . $style;
+ $r .= "";
+ if ( $numposts > 0 ) {
+ $r .= "";
+ $r .= $numposts;
+ $r .= ' ';
+ } else {
+ $r .= 0;
+ }
+ $r .= " ";
+ break;
+ default:
+ $r .= "";
+ $r .= apply_filters( 'manage_users_custom_column', '', $column_name, $user_object->ID );
+ $r .= " ";
+ }
+ }
+ $r .= ' ';
+
+ return $r;
+ }
+}
+
+?>
diff --git a/wp-admin/includes/comment.php b/wp-admin/includes/comment.php
index 185251a0..d731130a 100644
--- a/wp-admin/includes/comment.php
+++ b/wp-admin/includes/comment.php
@@ -9,11 +9,11 @@
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.0.0
* @uses $wpdb
*
- * @param string $comment_author
- * @param string $comment_date
+ * @param string $comment_author Author of the comment
+ * @param string $comment_date Date of the comment
* @return mixed Comment ID on success.
*/
function comment_exists($comment_author, $comment_date) {
@@ -27,16 +27,14 @@ function comment_exists($comment_author, $comment_date) {
}
/**
- * {@internal Missing Short Description}}
+ * Update a comment with values provided in $_POST.
*
- * @since unknown
+ * @since 2.0.0
*/
function edit_comment() {
- $comment_post_ID = (int) $_POST['comment_post_ID'];
-
- if (!current_user_can( 'edit_post', $comment_post_ID ))
- wp_die( __('You are not allowed to edit comments on this post, so you cannot edit this comment.' ));
+ if ( ! current_user_can( 'edit_comment', (int) $_POST['comment_ID'] ) )
+ wp_die ( __( 'You are not allowed to edit comments on this post.' ) );
$_POST['comment_author'] = $_POST['newcomment_author'];
$_POST['comment_author_email'] = $_POST['newcomment_author_email'];
@@ -52,7 +50,7 @@ function edit_comment() {
}
}
- if (!empty ( $_POST['edit_date'] ) ) {
+ if ( !empty ( $_POST['edit_date'] ) ) {
$aa = $_POST['aa'];
$mm = $_POST['mm'];
$jj = $_POST['jj'];
@@ -66,16 +64,16 @@ function edit_comment() {
$_POST['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
}
- wp_update_comment( $_POST);
+ wp_update_comment( $_POST );
}
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.0.0
*
- * @param unknown_type $id
- * @return unknown
+ * @param int $id ID of comment to retrieve
+ * @return bool|object Comment if found. False on failure.
*/
function get_comment_to_edit( $id ) {
if ( !$comment = get_comment($id) )
@@ -98,7 +96,7 @@ function get_comment_to_edit( $id ) {
/**
* Get the number of pending comments on a post or posts
*
- * @since unknown
+ * @since 2.3.0
* @uses $wpdb
*
* @param int|array $post_id Either a single Post ID or an array of Post IDs
@@ -158,10 +156,4 @@ function enqueue_comment_hotkeys_js() {
if ( 'true' == get_user_option( 'comment_shortcuts' ) )
wp_enqueue_script( 'jquery-table-hotkeys' );
}
-
-if ( is_admin() && isset($pagenow) && ('edit-comments.php' == $pagenow || 'edit.php' == $pagenow) ) {
- if ( get_option('show_avatars') )
- add_filter( 'comment_author', 'floated_admin_avatar' );
-}
-
?>
diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php
index 8486581b..8f937f36 100644
--- a/wp-admin/includes/dashboard.php
+++ b/wp-admin/includes/dashboard.php
@@ -9,13 +9,14 @@
/**
* Registers dashboard widgets.
*
- * handles POST data, sets up filters.
+ * Handles POST data, sets up filters.
*
- * @since unknown
+ * @since 2.5.0
*/
function wp_dashboard_setup() {
global $wp_registered_widgets, $wp_registered_widget_controls, $wp_dashboard_control_callbacks;
$wp_dashboard_control_callbacks = array();
+ $screen = get_current_screen();
$update = false;
$widget_options = get_option( 'dashboard_widget_options' );
@@ -25,42 +26,50 @@ function wp_dashboard_setup() {
/* Register Widgets and Controls */
// Right Now
- wp_add_dashboard_widget( 'dashboard_right_now', __( 'Right Now' ), 'wp_dashboard_right_now' );
+ if ( is_blog_admin() && current_user_can('edit_posts') )
+ wp_add_dashboard_widget( 'dashboard_right_now', __( 'Right Now' ), 'wp_dashboard_right_now' );
+
+ if ( is_network_admin() )
+ wp_add_dashboard_widget( 'network_dashboard_right_now', __( 'Right Now' ), 'wp_network_dashboard_right_now' );
// Recent Comments Widget
- if ( !isset( $widget_options['dashboard_recent_comments'] ) || !isset( $widget_options['dashboard_recent_comments']['items'] ) ) {
- $update = true;
- $widget_options['dashboard_recent_comments'] = array(
- 'items' => 5,
- );
+ if ( is_blog_admin() && current_user_can('moderate_comments') ) {
+ if ( !isset( $widget_options['dashboard_recent_comments'] ) || !isset( $widget_options['dashboard_recent_comments']['items'] ) ) {
+ $update = true;
+ $widget_options['dashboard_recent_comments'] = array(
+ 'items' => 5,
+ );
+ }
+ $recent_comments_title = __( 'Recent Comments' );
+ wp_add_dashboard_widget( 'dashboard_recent_comments', $recent_comments_title, 'wp_dashboard_recent_comments', 'wp_dashboard_recent_comments_control' );
}
- $recent_comments_title = __( 'Recent Comments' );
- wp_add_dashboard_widget( 'dashboard_recent_comments', $recent_comments_title, 'wp_dashboard_recent_comments', 'wp_dashboard_recent_comments_control' );
// Incoming Links Widget
- if ( !isset( $widget_options['dashboard_incoming_links'] ) || !isset( $widget_options['dashboard_incoming_links']['home'] ) || $widget_options['dashboard_incoming_links']['home'] != get_option('home') ) {
- $update = true;
- $num_items = isset($widget_options['dashboard_incoming_links']['items']) ? $widget_options['dashboard_incoming_links']['items'] : 10;
- $widget_options['dashboard_incoming_links'] = array(
- 'home' => get_option('home'),
- 'link' => apply_filters( 'dashboard_incoming_links_link', 'http://blogsearch.google.com/blogsearch?scoring=d&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),
- 'url' => isset($widget_options['dashboard_incoming_links']['url']) ? apply_filters( 'dashboard_incoming_links_feed', $widget_options['dashboard_incoming_links']['url'] ) : apply_filters( 'dashboard_incoming_links_feed', 'http://blogsearch.google.com/blogsearch_feeds?scoring=d&ie=utf-8&num=' . $num_items . '&output=rss&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),
- 'items' => $num_items,
- 'show_date' => isset($widget_options['dashboard_incoming_links']['show_date']) ? $widget_options['dashboard_incoming_links']['show_date'] : false
- );
+ if ( is_blog_admin() && current_user_can('publish_posts') ) {
+ if ( !isset( $widget_options['dashboard_incoming_links'] ) || !isset( $widget_options['dashboard_incoming_links']['home'] ) || $widget_options['dashboard_incoming_links']['home'] != get_option('home') ) {
+ $update = true;
+ $num_items = isset($widget_options['dashboard_incoming_links']['items']) ? $widget_options['dashboard_incoming_links']['items'] : 10;
+ $widget_options['dashboard_incoming_links'] = array(
+ 'home' => get_option('home'),
+ 'link' => apply_filters( 'dashboard_incoming_links_link', 'http://blogsearch.google.com/blogsearch?scoring=d&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),
+ 'url' => isset($widget_options['dashboard_incoming_links']['url']) ? apply_filters( 'dashboard_incoming_links_feed', $widget_options['dashboard_incoming_links']['url'] ) : apply_filters( 'dashboard_incoming_links_feed', 'http://blogsearch.google.com/blogsearch_feeds?scoring=d&ie=utf-8&num=' . $num_items . '&output=rss&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),
+ 'items' => $num_items,
+ 'show_date' => isset($widget_options['dashboard_incoming_links']['show_date']) ? $widget_options['dashboard_incoming_links']['show_date'] : false
+ );
+ }
+ wp_add_dashboard_widget( 'dashboard_incoming_links', __( 'Incoming Links' ), 'wp_dashboard_incoming_links', 'wp_dashboard_incoming_links_control' );
}
- wp_add_dashboard_widget( 'dashboard_incoming_links', __( 'Incoming Links' ), 'wp_dashboard_incoming_links', 'wp_dashboard_incoming_links_control' );
// WP Plugins Widget
- if ( current_user_can( 'install_plugins' ) )
+ if ( ( ! is_multisite() && is_blog_admin() && current_user_can( 'install_plugins' ) ) || ( is_network_admin() && current_user_can( 'manage_network_plugins' ) && current_user_can( 'install_plugins' ) ) )
wp_add_dashboard_widget( 'dashboard_plugins', __( 'Plugins' ), 'wp_dashboard_plugins' );
// QuickPress Widget
- if ( current_user_can('edit_posts') )
+ if ( is_blog_admin() && current_user_can('edit_posts') )
wp_add_dashboard_widget( 'dashboard_quick_press', __( 'QuickPress' ), 'wp_dashboard_quick_press' );
// Recent Drafts
- if ( current_user_can('edit_posts') )
+ if ( is_blog_admin() && current_user_can('edit_posts') )
wp_add_dashboard_widget( 'dashboard_recent_drafts', __('Recent Drafts'), 'wp_dashboard_recent_drafts' );
// Primary feed (Dev Blog) Widget
@@ -94,10 +103,17 @@ function wp_dashboard_setup() {
wp_add_dashboard_widget( 'dashboard_secondary', $widget_options['dashboard_secondary']['title'], 'wp_dashboard_secondary', 'wp_dashboard_secondary_control' );
// Hook to register new widgets
- do_action( 'wp_dashboard_setup' );
-
// Filter widget order
- $dashboard_widgets = apply_filters( 'wp_dashboard_widgets', array() );
+ if ( is_network_admin() ) {
+ do_action( 'wp_network_dashboard_setup' );
+ $dashboard_widgets = apply_filters( 'wp_network_dashboard_widgets', array() );
+ } elseif ( is_user_admin() ) {
+ do_action( 'wp_user_dashboard_setup' );
+ $dashboard_widgets = apply_filters( 'wp_user_dashboard_widgets', array() );
+ } else {
+ do_action( 'wp_dashboard_setup' );
+ $dashboard_widgets = apply_filters( 'wp_dashboard_widgets', array() );
+ }
foreach ( $dashboard_widgets as $widget_id ) {
$name = empty( $wp_registered_widgets[$widget_id]['all_link'] ) ? $wp_registered_widgets[$widget_id]['name'] : $wp_registered_widgets[$widget_id]['name'] . " " . __('View all') . ' ';
@@ -115,46 +131,57 @@ function wp_dashboard_setup() {
if ( $update )
update_option( 'dashboard_widget_options', $widget_options );
- do_action('do_meta_boxes', 'dashboard', 'normal', '');
- do_action('do_meta_boxes', 'dashboard', 'side', '');
+ do_action('do_meta_boxes', $screen->id, 'normal', '');
+ do_action('do_meta_boxes', $screen->id, 'side', '');
}
function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null ) {
+ $screen = get_current_screen();
global $wp_dashboard_control_callbacks;
+
if ( $control_callback && current_user_can( 'edit_dashboard' ) && is_callable( $control_callback ) ) {
$wp_dashboard_control_callbacks[$widget_id] = $control_callback;
if ( isset( $_GET['edit'] ) && $widget_id == $_GET['edit'] ) {
list($url) = explode( '#', add_query_arg( 'edit', false ), 2 );
$widget_name .= ' ' . __( 'Cancel' ) . ' ';
- add_meta_box( $widget_id, $widget_name, '_wp_dashboard_control_callback', 'dashboard', 'normal', 'core' );
- return;
+ $callback = '_wp_dashboard_control_callback';
+ } else {
+ list($url) = explode( '#', add_query_arg( 'edit', $widget_id ), 2 );
+ $widget_name .= ' ' . __( 'Configure' ) . ' ';
}
- list($url) = explode( '#', add_query_arg( 'edit', $widget_id ), 2 );
- $widget_name .= ' ' . __( 'Configure' ) . ' ';
}
- $side_widgets = array('dashboard_quick_press', 'dashboard_recent_drafts', 'dashboard_primary', 'dashboard_secondary');
+
+ if ( is_blog_admin () )
+ $side_widgets = array('dashboard_quick_press', 'dashboard_recent_drafts', 'dashboard_primary', 'dashboard_secondary');
+ else if (is_network_admin() )
+ $side_widgets = array('dashboard_primary', 'dashboard_secondary');
+ else
+ $side_widgets = array();
+
$location = 'normal';
if ( in_array($widget_id, $side_widgets) )
$location = 'side';
- add_meta_box( $widget_id, $widget_name , $callback, 'dashboard', $location, 'core' );
+ add_meta_box( $widget_id, $widget_name , $callback, $screen->id, $location, 'core' );
}
function _wp_dashboard_control_callback( $dashboard, $meta_box ) {
echo '';
wp_dashboard_trigger_widget_control( $meta_box['id'] );
- echo '
';
-
+ echo ' ';
+ submit_button( __('Submit') );
echo ' ';
}
/**
* Displays the dashboard.
*
- * @since unknown
+ * @since 2.5.0
*/
function wp_dashboard() {
global $screen_layout_columns;
+ $screen = get_current_screen();
+
$hide2 = $hide3 = $hide4 = '';
switch ( $screen_layout_columns ) {
case 4:
@@ -176,16 +203,16 @@ function wp_dashboard() {
\n";
- do_meta_boxes( 'dashboard', 'normal', '' );
+ do_meta_boxes( $screen->id, 'normal', '' );
echo "\t
\n";
- do_meta_boxes( 'dashboard', 'side', '' );
+ do_meta_boxes( $screen->id, 'side', '' );
echo "\t
\n";
- do_meta_boxes( 'dashboard', 'column3', '' );
+ do_meta_boxes( $screen->id, 'column3', '' );
echo "\t
\n";
- do_meta_boxes( 'dashboard', 'column4', '' );
+ do_meta_boxes( $screen->id, 'column4', '' );
?>
@@ -383,6 +410,53 @@ function wp_dashboard_right_now() {
do_action( 'activity_box_end' );
}
+function wp_network_dashboard_right_now() {
+ $actions = array();
+ if ( current_user_can('create_sites') )
+ $actions['create-site'] = '' . __( 'Create a New Site' ) . ' ';
+ if ( current_user_can('create_users') )
+ $actions['create-user'] = '' . __( 'Create a New User' ) . ' ';
+
+ $c_users = get_user_count();
+ $c_blogs = get_blog_count();
+
+ $user_text = sprintf( _n( '%s user', '%s users', $c_users ), number_format_i18n( $c_users ) );
+ $blog_text = sprintf( _n( '%s site', '%s sites', $c_blogs ), number_format_i18n( $c_blogs ) );
+
+ $sentence = sprintf( __( 'You have %1$s and %2$s.' ), $blog_text, $user_text );
+
+ if ( $actions ) {
+ echo '';
+ foreach ( $actions as $class => $action ) {
+ $actions[ $class ] = "\t$action";
+ }
+ echo implode( " | \n", $actions ) . "\n";
+ echo ' ';
+ }
+?>
+
+
+
+
+
+
+
+
+ 'submit_users' ) ); ?>
+
+
+
+
+
+
+ 'submit_sites' ) ); ?>
+
+
+
- post_content; ?>
+ post_content ); ?>
@@ -460,7 +534,7 @@ function wp_dashboard_quick_press_output() {
-
+ 'save-post', 'tabindex'=> 4 ) ); ?>
@@ -517,7 +591,7 @@ function wp_dashboard_recent_drafts( $drafts = false ) {
/**
* Display recent comments dashboard widget content.
*
- * @since unknown
+ * @since 2.5.0
*/
function wp_dashboard_recent_comments() {
global $wpdb;
@@ -532,10 +606,8 @@ function wp_dashboard_recent_comments() {
$start = 0;
$widgets = get_option( 'dashboard_widget_options' );
- if ( isset( $widgets['dashboard_recent_comments'] ) && isset( $widgets['dashboard_recent_comments']['items'] ) )
- $total_items = (int) $widgets['dashboard_recent_comments']['items'];
- else
- $total_items = 5;
+ $total_items = isset( $widgets['dashboard_recent_comments'] ) && isset( $widgets['dashboard_recent_comments']['items'] )
+ ? absint( $widgets['dashboard_recent_comments']['items'] ) : 5;
while ( count( $comments ) < 5 && $possible = $wpdb->get_results( "SELECT * FROM $wpdb->comments c LEFT JOIN $wpdb->posts p ON c.comment_post_ID = p.ID WHERE p.post_status != 'trash' ORDER BY c.comment_date_gmt DESC LIMIT $start, 50" ) ) {
@@ -586,7 +658,7 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
$comment_link = '';
$actions_string = '';
- if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
+ if ( current_user_can( 'edit_comment', $comment->comment_ID ) ) {
// preorder it: Approve | Reply | Edit | Spam | Trash
$actions = array(
'approve' => '', 'unapprove' => '',
@@ -605,15 +677,15 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
$trash_url = esc_url( "comment.php?action=trashcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );
$delete_url = esc_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );
- $actions['approve'] = "';
- $actions['unapprove'] = "';
- $actions['edit'] = "". __('Edit') . ' ';
- $actions['reply'] = '' . __('Reply') . ' ';
- $actions['spam'] = "';
+ $actions['approve'] = "';
+ $actions['unapprove'] = "';
+ $actions['edit'] = "". __('Edit') . ' ';
+ $actions['reply'] = '' . __('Reply') . ' ';
+ $actions['spam'] = "';
if ( !EMPTY_TRASH_DAYS )
$actions['delete'] = "';
else
- $actions['trash'] = "';
+ $actions['trash'] = "';
$actions = apply_filters( 'comment_row_actions', array_filter($actions), $comment );
@@ -683,9 +755,7 @@ function wp_dashboard_recent_comments_control() {
$widget_options['dashboard_recent_comments'] = array();
if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget-recent-comments']) ) {
- $number = (int) stripslashes($_POST['widget-recent-comments']['items']);
- if ( $number < 1 || $number > 30 )
- $number = 5;
+ $number = absint( $_POST['widget-recent-comments']['items'] );
$widget_options['dashboard_recent_comments']['items'] = $number;
update_option( 'dashboard_widget_options', $widget_options );
}
@@ -693,7 +763,7 @@ function wp_dashboard_recent_comments_control() {
$number = isset( $widget_options['dashboard_recent_comments']['items'] ) ? (int) $widget_options['dashboard_recent_comments']['items'] : '';
echo '' . __('Number of comments to show:') . ' ';
- echo ' ' . __( '(at most 30)' ) . '
';
+ echo '';
}
function wp_dashboard_incoming_links() {
@@ -703,7 +773,7 @@ function wp_dashboard_incoming_links() {
/**
* Display incoming links dashboard widget content.
*
- * @since unknown
+ * @since 2.5.0
*/
function wp_dashboard_incoming_links_output() {
$widgets = get_option( 'dashboard_widget_options' );
@@ -763,8 +833,8 @@ function wp_dashboard_incoming_links_output() {
/* translators: incoming links feed, %1$s is other person, %3$s is content */
$text = __( '%1$s linked here saying, "%3$s"' );
- if ( $show_date ) {
- if ( $show_author || $show_summary )
+ if ( !empty($show_date) ) {
+ if ( !empty($show_author) || !empty($show_summary) )
/* translators: incoming links feed, %4$s is the date */
$text .= ' ' . __( 'on %4$s' );
$date = esc_html( strip_tags( $item->get_date() ) );
@@ -795,9 +865,9 @@ function wp_dashboard_primary_control() {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.5.0
*
- * @param int $widget_id
+ * @param string $widget_id
*/
function wp_dashboard_rss_output( $widget_id ) {
$widgets = get_option( 'dashboard_widget_options' );
@@ -817,7 +887,7 @@ function wp_dashboard_secondary_control() {
/**
* Display secondary dashboard RSS widget feed.
*
- * @since unknown
+ * @since 2.5.0
*
* @return unknown
*/
@@ -852,7 +922,7 @@ function wp_dashboard_plugins() {
/**
* Display plugins most popular, newest plugins, and recently updated widget text.
*
- * @since unknown
+ * @since 2.5.0
*/
function wp_dashboard_plugins_output() {
$popular = fetch_feed( 'http://wordpress.org/extend/plugins/rss/browse/popular/' );
@@ -938,9 +1008,9 @@ function wp_dashboard_plugins_output() {
* echoes out output for this widget. If not cache, echo a "Loading..." stub
* which is later replaced by AJAX call (see top of /wp-admin/index.php)
*
- * @since unknown
+ * @since 2.5.0
*
- * @param int $widget_id
+ * @param string $widget_id
* @param callback $callback
* @param array $check_urls RSS feeds
* @return bool False on failure. True on success.
@@ -981,7 +1051,7 @@ function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = ar
/**
* Calls widget control callback.
*
- * @since unknown
+ * @since 2.5.0
*
* @param int $widget_control_id Registered Widget ID.
*/
@@ -999,10 +1069,10 @@ function wp_dashboard_trigger_widget_control( $widget_control_id = false ) {
* Sets up $args to be used as input to wp_widget_rss_form(). Handles POST data
* from RSS-type widgets.
*
- * @since unknown
+ * @since 2.5.0
*
- * @param string widget_id
- * @param array form_inputs
+ * @param string $widget_id
+ * @param array $form_inputs
*/
function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) {
if ( !$widget_options = get_option( 'dashboard_widget_options' ) )
@@ -1034,6 +1104,45 @@ function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) {
wp_widget_rss_form( $widget_options[$widget_id], $form_inputs );
}
+// Display File upload quota on dashboard
+function wp_dashboard_quota() {
+ if ( !is_multisite() || !current_user_can('edit_posts') || get_site_option( 'upload_space_check_disabled' ) )
+ return true;
+
+ $quota = get_space_allowed();
+ $used = get_dirsize( BLOGUPLOADDIR ) / 1024 / 1024;
+
+ if ( $used > $quota )
+ $percentused = '100';
+ else
+ $percentused = ( $used / $quota ) * 100;
+ $used_color = ( $percentused < 70 ) ? ( ( $percentused >= 40 ) ? 'waiting' : 'approved' ) : 'spam';
+ $used = round( $used, 2 );
+ $percentused = number_format( $percentused );
+
+ ?>
+
+
+
+
+ %2$sMB' ), esc_url( admin_url( 'upload.php' ) ), $quota ); ?>
+
+
+
+
+
+
+
\ No newline at end of file
+
+/**
+ * @deprecated 3.1.0
+ *
+ * @return array List of user IDs.
+ */
+function get_author_user_ids() {
+ _deprecated_function( __FUNCTION__, '3.1', 'get_users()' );
+
+ global $wpdb;
+ if ( !is_multisite() )
+ $level_key = $wpdb->get_blog_prefix() . 'user_level';
+ else
+ $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
+
+ return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != '0'", $level_key) );
+}
+
+/**
+ * @deprecated 3.1.0
+ *
+ * @param int $user_id User ID.
+ * @return array|bool List of editable authors. False if no editable users.
+ */
+function get_editable_authors( $user_id ) {
+ _deprecated_function( __FUNCTION__, '3.1', 'get_users()' );
+
+ global $wpdb;
+
+ $editable = get_editable_user_ids( $user_id );
+
+ if ( !$editable ) {
+ return false;
+ } else {
+ $editable = join(',', $editable);
+ $authors = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($editable) ORDER BY display_name" );
+ }
+
+ return apply_filters('get_editable_authors', $authors);
+}
+
+/**
+ * @deprecated 3.1.0
+ *
+ * @param int $user_id User ID.
+ * @param bool $exclude_zeros Optional, default is true. Whether to exclude zeros.
+ * @return unknown
+ */
+function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'post' ) {
+ _deprecated_function( __FUNCTION__, '3.1', 'get_users()' );
+
+ global $wpdb;
+
+ $user = new WP_User( $user_id );
+ $post_type_obj = get_post_type_object($post_type);
+
+ if ( ! $user->has_cap($post_type_obj->cap->edit_others_posts) ) {
+ if ( $user->has_cap($post_type_obj->cap->edit_posts) || ! $exclude_zeros )
+ return array($user->id);
+ else
+ return array();
+ }
+
+ if ( !is_multisite() )
+ $level_key = $wpdb->get_blog_prefix() . 'user_level';
+ else
+ $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
+
+ $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key);
+ if ( $exclude_zeros )
+ $query .= " AND meta_value != '0'";
+
+ return $wpdb->get_col( $query );
+}
+
+/**
+ * @deprecated 3.1.0
+ */
+function get_nonauthor_user_ids() {
+ _deprecated_function( __FUNCTION__, '3.1', 'get_users()' );
+
+ global $wpdb;
+
+ if ( !is_multisite() )
+ $level_key = $wpdb->get_blog_prefix() . 'user_level';
+ else
+ $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
+
+ return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value = '0'", $level_key) );
+}
+
+if ( !class_exists('WP_User_Search') ) :
+/**
+ * WordPress User Search class.
+ *
+ * @since 2.1.0
+ * @deprecated 3.1.0
+ */
+class WP_User_Search {
+
+ /**
+ * {@internal Missing Description}}
+ *
+ * @since 2.1.0
+ * @access private
+ * @var unknown_type
+ */
+ var $results;
+
+ /**
+ * {@internal Missing Description}}
+ *
+ * @since 2.1.0
+ * @access private
+ * @var unknown_type
+ */
+ var $search_term;
+
+ /**
+ * Page number.
+ *
+ * @since 2.1.0
+ * @access private
+ * @var int
+ */
+ var $page;
+
+ /**
+ * Role name that users have.
+ *
+ * @since 2.5.0
+ * @access private
+ * @var string
+ */
+ var $role;
+
+ /**
+ * Raw page number.
+ *
+ * @since 2.1.0
+ * @access private
+ * @var int|bool
+ */
+ var $raw_page;
+
+ /**
+ * Amount of users to display per page.
+ *
+ * @since 2.1.0
+ * @access public
+ * @var int
+ */
+ var $users_per_page = 50;
+
+ /**
+ * {@internal Missing Description}}
+ *
+ * @since 2.1.0
+ * @access private
+ * @var unknown_type
+ */
+ var $first_user;
+
+ /**
+ * {@internal Missing Description}}
+ *
+ * @since 2.1.0
+ * @access private
+ * @var int
+ */
+ var $last_user;
+
+ /**
+ * {@internal Missing Description}}
+ *
+ * @since 2.1.0
+ * @access private
+ * @var string
+ */
+ var $query_limit;
+
+ /**
+ * {@internal Missing Description}}
+ *
+ * @since 3.0.0
+ * @access private
+ * @var string
+ */
+ var $query_orderby;
+
+ /**
+ * {@internal Missing Description}}
+ *
+ * @since 3.0.0
+ * @access private
+ * @var string
+ */
+ var $query_from;
+
+ /**
+ * {@internal Missing Description}}
+ *
+ * @since 3.0.0
+ * @access private
+ * @var string
+ */
+ var $query_where;
+
+ /**
+ * {@internal Missing Description}}
+ *
+ * @since 2.1.0
+ * @access private
+ * @var int
+ */
+ var $total_users_for_query = 0;
+
+ /**
+ * {@internal Missing Description}}
+ *
+ * @since 2.1.0
+ * @access private
+ * @var bool
+ */
+ var $too_many_total_users = false;
+
+ /**
+ * {@internal Missing Description}}
+ *
+ * @since 2.1.0
+ * @access private
+ * @var unknown_type
+ */
+ var $search_errors;
+
+ /**
+ * {@internal Missing Description}}
+ *
+ * @since 2.7.0
+ * @access private
+ * @var unknown_type
+ */
+ var $paging_text;
+
+ /**
+ * PHP4 Constructor - Sets up the object properties.
+ *
+ * @since 2.1.0
+ *
+ * @param string $search_term Search terms string.
+ * @param int $page Optional. Page ID.
+ * @param string $role Role name.
+ * @return WP_User_Search
+ */
+ function WP_User_Search ($search_term = '', $page = '', $role = '') {
+ _deprecated_function( __FUNCTION__, '3.1', 'WP_User_Query' );
+
+ $this->search_term = $search_term;
+ $this->raw_page = ( '' == $page ) ? false : (int) $page;
+ $this->page = (int) ( '' == $page ) ? 1 : $page;
+ $this->role = $role;
+
+ $this->prepare_query();
+ $this->query();
+ $this->prepare_vars_for_template_usage();
+ $this->do_paging();
+ }
+
+ /**
+ * {@internal Missing Short Description}}
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since 2.1.0
+ * @access public
+ */
+ function prepare_query() {
+ global $wpdb;
+ $this->first_user = ($this->page - 1) * $this->users_per_page;
+
+ $this->query_limit = $wpdb->prepare(" LIMIT %d, %d", $this->first_user, $this->users_per_page);
+ $this->query_orderby = ' ORDER BY user_login';
+
+ $search_sql = '';
+ if ( $this->search_term ) {
+ $searches = array();
+ $search_sql = 'AND (';
+ foreach ( array('user_login', 'user_nicename', 'user_email', 'user_url', 'display_name') as $col )
+ $searches[] = $col . " LIKE '%$this->search_term%'";
+ $search_sql .= implode(' OR ', $searches);
+ $search_sql .= ')';
+ }
+
+ $this->query_from = " FROM $wpdb->users";
+ $this->query_where = " WHERE 1=1 $search_sql";
+
+ if ( $this->role ) {
+ $this->query_from .= " INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id";
+ $this->query_where .= $wpdb->prepare(" AND $wpdb->usermeta.meta_key = '{$wpdb->prefix}capabilities' AND $wpdb->usermeta.meta_value LIKE %s", '%' . $this->role . '%');
+ } elseif ( is_multisite() ) {
+ $level_key = $wpdb->prefix . 'capabilities'; // wpmu site admins don't have user_levels
+ $this->query_from .= ", $wpdb->usermeta";
+ $this->query_where .= " AND $wpdb->users.ID = $wpdb->usermeta.user_id AND meta_key = '{$level_key}'";
+ }
+
+ do_action_ref_array( 'pre_user_search', array( &$this ) );
+ }
+
+ /**
+ * {@internal Missing Short Description}}
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since 2.1.0
+ * @access public
+ */
+ function query() {
+ global $wpdb;
+
+ $this->results = $wpdb->get_col("SELECT DISTINCT($wpdb->users.ID)" . $this->query_from . $this->query_where . $this->query_orderby . $this->query_limit);
+
+ if ( $this->results )
+ $this->total_users_for_query = $wpdb->get_var("SELECT COUNT(DISTINCT($wpdb->users.ID))" . $this->query_from . $this->query_where); // no limit
+ else
+ $this->search_errors = new WP_Error('no_matching_users_found', __('No matching users were found!'));
+ }
+
+ /**
+ * {@internal Missing Short Description}}
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since 2.1.0
+ * @access public
+ */
+ function prepare_vars_for_template_usage() {
+ $this->search_term = stripslashes($this->search_term); // done with DB, from now on we want slashes gone
+ }
+
+ /**
+ * {@internal Missing Short Description}}
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since 2.1.0
+ * @access public
+ */
+ function do_paging() {
+ if ( $this->total_users_for_query > $this->users_per_page ) { // have to page the results
+ $args = array();
+ if( ! empty($this->search_term) )
+ $args['usersearch'] = urlencode($this->search_term);
+ if( ! empty($this->role) )
+ $args['role'] = urlencode($this->role);
+
+ $this->paging_text = paginate_links( array(
+ 'total' => ceil($this->total_users_for_query / $this->users_per_page),
+ 'current' => $this->page,
+ 'base' => 'users.php?%_%',
+ 'format' => 'userspage=%#%',
+ 'add_args' => $args
+ ) );
+ if ( $this->paging_text ) {
+ $this->paging_text = sprintf( '' . __( 'Displaying %s–%s of %s' ) . ' %s',
+ number_format_i18n( ( $this->page - 1 ) * $this->users_per_page + 1 ),
+ number_format_i18n( min( $this->page * $this->users_per_page, $this->total_users_for_query ) ),
+ number_format_i18n( $this->total_users_for_query ),
+ $this->paging_text
+ );
+ }
+ }
+ }
+
+ /**
+ * {@internal Missing Short Description}}
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since 2.1.0
+ * @access public
+ *
+ * @return unknown
+ */
+ function get_results() {
+ return (array) $this->results;
+ }
+
+ /**
+ * Displaying paging text.
+ *
+ * @see do_paging() Builds paging text.
+ *
+ * @since 2.1.0
+ * @access public
+ */
+ function page_links() {
+ echo $this->paging_text;
+ }
+
+ /**
+ * Whether paging is enabled.
+ *
+ * @see do_paging() Builds paging text.
+ *
+ * @since 2.1.0
+ * @access public
+ *
+ * @return bool
+ */
+ function results_are_paged() {
+ if ( $this->paging_text )
+ return true;
+ return false;
+ }
+
+ /**
+ * Whether there are search terms.
+ *
+ * @since 2.1.0
+ * @access public
+ *
+ * @return bool
+ */
+ function is_search() {
+ if ( $this->search_term )
+ return true;
+ return false;
+ }
+}
+endif;
+
+/**
+ * Retrieve editable posts from other users.
+ *
+ * @deprecated 3.1.0
+ *
+ * @param int $user_id User ID to not retrieve posts from.
+ * @param string $type Optional, defaults to 'any'. Post type to retrieve, can be 'draft' or 'pending'.
+ * @return array List of posts from others.
+ */
+function get_others_unpublished_posts($user_id, $type='any') {
+ _deprecated_function( __FUNCTION__, '3.1' );
+
+ global $wpdb;
+
+ $editable = get_editable_user_ids( $user_id );
+
+ if ( in_array($type, array('draft', 'pending')) )
+ $type_sql = " post_status = '$type' ";
+ else
+ $type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) ";
+
+ $dir = ( 'pending' == $type ) ? 'ASC' : 'DESC';
+
+ if ( !$editable ) {
+ $other_unpubs = '';
+ } else {
+ $editable = join(',', $editable);
+ $other_unpubs = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != %d ORDER BY post_modified $dir", $user_id) );
+ }
+
+ return apply_filters('get_others_drafts', $other_unpubs);
+}
+
+/**
+ * Retrieve drafts from other users.
+ *
+ * @deprecated 3.1.0
+ *
+ * @param int $user_id User ID.
+ * @return array List of drafts from other users.
+ */
+function get_others_drafts($user_id) {
+ _deprecated_function( __FUNCTION__, '3.1' );
+
+ return get_others_unpublished_posts($user_id, 'draft');
+}
+
+/**
+ * Retrieve pending review posts from other users.
+ *
+ * @deprecated 3.1.0
+ *
+ * @param int $user_id User ID.
+ * @return array List of posts with pending review post type from other users.
+ */
+function get_others_pending($user_id) {
+ _deprecated_function( __FUNCTION__, '3.1' );
+
+ return get_others_unpublished_posts($user_id, 'pending');
+}
diff --git a/wp-admin/includes/export.php b/wp-admin/includes/export.php
index a9e8f22d..2efd0405 100644
--- a/wp-admin/includes/export.php
+++ b/wp-admin/includes/export.php
@@ -11,127 +11,112 @@
*
* Bump this when something changes that might affect compatibility.
*
- * @since unknown
- * @var string
+ * @since 2.5.0
*/
-define('WXR_VERSION', '1.0');
+define( 'WXR_VERSION', '1.1' );
/**
- * {@internal Missing Short Description}}
+ * Generates the WXR export file for download
*
- * @since unknown
+ * @since 2.1.0
*
- * @param unknown_type $args
+ * @param array $args Filters defining what should be included in the export
*/
function export_wp( $args = array() ) {
- global $wpdb, $post_ids, $post, $wp_taxonomies;
+ global $wpdb, $post;
- if ( ! is_array( $args ) )
- $args = array( 'author' => $args );
-
- $defaults = array( 'author' => null, 'taxonomy' => null, 'post_type' => null, 'post_status' => null, 'start_date' => null, 'end_date' => null );
+ $defaults = array( 'content' => 'all', 'author' => false, 'category' => false,
+ 'start_date' => false, 'end_date' => false, 'status' => false,
+ );
$args = wp_parse_args( $args, $defaults );
- extract($args);
-
- do_action('export_wp');
+ do_action( 'export_wp' );
- if( strlen( $start_date ) > 4 && strlen( $end_date ) > 4 )
- $filename = 'wordpress.' . $start_date . '.' . $end_date . '.xml';
- else
- $filename = 'wordpress.' . date( 'Y-m-d' ) . '.xml';
+ $sitename = sanitize_key( get_bloginfo( 'name' ) );
+ if ( ! empty($sitename) ) $sitename .= '.';
+ $filename = $sitename . 'wordpress.' . date( 'Y-m-d' ) . '.xml';
header( 'Content-Description: File Transfer' );
header( 'Content-Disposition: attachment; filename=' . $filename );
header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
- if ( $post_type && $post_type != 'all' )
- $where = $wpdb->prepare("WHERE post_type = %s ", $post_type);
- else
- $where = "WHERE post_type != 'revision' ";
+ if ( 'all' != $args['content'] && post_type_exists( $args['content'] ) ) {
+ $ptype = get_post_type_object( $args['content'] );
+ if ( ! $ptype->can_export )
+ $args['content'] = 'post';
- if ( $author && $author != 'all' ) {
- $author_id = (int) $author;
- $where .= $wpdb->prepare( "AND post_author = %d ", $author_id );
+ $where = $wpdb->prepare( "{$wpdb->posts}.post_type = %s", $args['content'] );
+ } else {
+ $post_types = get_post_types( array( 'can_export' => true ) );
+ $esses = array_fill( 0, count($post_types), '%s' );
+ $where = $wpdb->prepare( "{$wpdb->posts}.post_type IN (". implode(',',$esses) .")", $post_types );
}
- if ( $start_date && $start_date != 'all' )
- $where .= $wpdb->prepare( "AND post_date >= %s ", $start_date );
-
- if ( $end_date && $end_date != 'all' )
- $where .= $wpdb->prepare( "AND post_date < %s ", $end_date );
+ if ( $args['status'] && ( 'post' == $args['content'] || 'page' == $args['content'] ) )
+ $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_status = %s", $args['status'] );
+ else
+ $where .= " AND {$wpdb->posts}.post_status != 'auto-draft'";
- if ( $taxonomy && is_array( $taxonomy ) ) {
- foreach ( $taxonomy as $term_id ) {
- if ( $term_id != 'all' )
- $where .= $wpdb->prepare( "AND ID IN (SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d) ", $term_id );
+ $join = '';
+ if ( $args['category'] && 'post' == $args['content'] ) {
+ if ( $term = term_exists( $args['category'], 'category' ) ) {
+ $join = "INNER JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id)";
+ $where .= $wpdb->prepare( " AND {$wpdb->term_relationships}.term_taxonomy_id = %d", $term['term_taxonomy_id'] );
}
}
- if ( $post_status && $post_status != 'all' )
- $where .= $wpdb->prepare( "AND post_status = %s", $post_status );
+ if ( 'post' == $args['content'] || 'page' == $args['content'] ) {
+ if ( $args['author'] )
+ $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_author = %d", $args['author'] );
- // grab a snapshot of post IDs, just in case it changes during the export
- $post_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts $where ORDER BY post_date_gmt ASC" );
+ if ( $args['start_date'] )
+ $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date >= %s", date( 'Y-m-d', strtotime($args['start_date']) ) );
- $categories = (array) get_categories( array( 'get' => 'all' ) );
- $tags = (array) get_tags( array( 'get' => 'all' ) );
-
- $custom_taxonomies = $wp_taxonomies;
- unset( $custom_taxonomies['category'] );
- unset( $custom_taxonomies['post_tag'] );
- unset( $custom_taxonomies['link_category'] );
- $custom_taxonomies = array_keys( $custom_taxonomies );
- $terms = (array) get_terms( $custom_taxonomies, array( 'get' => 'all' ) );
-
- /**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @param unknown_type $categories
- */
- function wxr_missing_parents( $categories ) {
- if ( ! is_array( $categories ) || empty( $categories ) )
- return array();
+ if ( $args['end_date'] )
+ $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date < %s", date( 'Y-m-d', strtotime('+1 month', strtotime($args['end_date'])) ) );
+ }
- foreach ( $categories as $category ){
- $parents[$category->term_id] = $category->parent;
+ // grab a snapshot of post IDs, just in case it changes during the export
+ $post_ids = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} $join WHERE $where" );
+
+ // get the requested terms ready, empty unless posts filtered by category or all content
+ $cats = $tags = $terms = array();
+ if ( isset( $term ) && $term ) {
+ $cat = get_term( $term['term_id'], 'category' );
+ $cats = array( $cat->term_id => $cat );
+ unset( $term, $cat );
+ } else if ( 'all' == $args['content'] ) {
+ $categories = (array) get_categories( array( 'get' => 'all' ) );
+ $tags = (array) get_tags( array( 'get' => 'all' ) );
+
+ $custom_taxonomies = get_taxonomies( array( '_builtin' => false ) );
+ $custom_terms = (array) get_terms( $custom_taxonomies, array( 'get' => 'all' ) );
+
+ // put categories in order with no child going before its parent
+ while ( $cat = array_shift( $categories ) ) {
+ if ( $cat->parent == 0 || isset( $cats[$cat->parent] ) )
+ $cats[$cat->term_id] = $cat;
+ else
+ $categories[] = $cat;
}
- $parents = array_unique( array_diff( $parents, array_keys( $parents ) ) );
-
- if ( $zero = array_search( '0', $parents ) )
- unset( $parents[$zero] );
-
- return $parents;
- }
-
- while ( $parents = wxr_missing_parents( $categories ) ) {
- $found_parents = get_categories( array( 'include' => join( ', ', $parents) ) );
- if ( is_array( $found_parents ) && count( $found_parents ) )
- $categories = array_merge( $categories, $found_parents );
- else
- break;
- }
+ // put terms in order with no child going before its parent
+ while ( $t = array_shift( $custom_terms ) ) {
+ if ( $t->parent == 0 || isset( $terms[$t->parent] ) )
+ $terms[$t->term_id] = $t;
+ else
+ $custom_terms[] = $t;
+ }
- // Put them in order to be inserted with no child going before its parent
- $pass = 0;
- $passes = 1000 + count( $categories );
- while ( ( $cat = array_shift( $categories ) ) && ++$pass < $passes ) {
- if ( $cat->parent == 0 || isset( $cats[$cat->parent] ) )
- $cats[$cat->term_id] = $cat;
- else
- $categories[] = $cat;
+ unset( $categories, $custom_taxonomies, $custom_terms );
}
- unset( $categories );
/**
- * Place string in CDATA tag.
+ * Wrap given string in XML CDATA tag.
*
- * @since unknown
+ * @since 2.1.0
*
- * @param string $str String to place in XML CDATA tag.
+ * @param string $str String to wrap in XML CDATA tag.
*/
function wxr_cdata( $str ) {
if ( seems_utf8( $str ) == false )
@@ -144,17 +129,15 @@ function export_wp( $args = array() ) {
}
/**
- * {@internal Missing Short Description}}
+ * Return the URL of the site
*
- * @since unknown
+ * @since 2.5.0
*
* @return string Site URL.
*/
function wxr_site_url() {
- global $current_site;
-
- // mu: the base url
- if ( isset( $current_site->domain ) )
+ // ms: the base url
+ if ( is_multisite() )
return network_home_url();
// wp: the blog url
else
@@ -162,136 +145,172 @@ function export_wp( $args = array() ) {
}
/**
- * {@internal Missing Short Description}}
+ * Output a cat_name XML tag from a given category object
*
- * @since unknown
+ * @since 2.1.0
*
- * @param object $c Category Object
+ * @param object $category Category Object
*/
- function wxr_cat_name( $c ) {
- if ( empty( $c->name ) )
+ function wxr_cat_name( $category ) {
+ if ( empty( $category->name ) )
return;
- echo '' . wxr_cdata( $c->name ) . ' ';
+ echo '' . wxr_cdata( $category->name ) . ' ';
}
/**
- * {@internal Missing Short Description}}
+ * Output a category_description XML tag from a given category object
*
- * @since unknown
+ * @since 2.1.0
*
- * @param object $c Category Object
+ * @param object $category Category Object
*/
- function wxr_category_description( $c ) {
- if ( empty( $c->description ) )
+ function wxr_category_description( $category ) {
+ if ( empty( $category->description ) )
return;
- echo '' . wxr_cdata($c->description) . ' ';
+ echo '' . wxr_cdata( $category->description ) . ' ';
}
/**
- * {@internal Missing Short Description}}
+ * Output a tag_name XML tag from a given tag object
*
- * @since unknown
+ * @since 2.3.0
*
- * @param object $t Tag Object
+ * @param object $tag Tag Object
*/
- function wxr_tag_name( $t ) {
- if ( empty( $t->name ) )
+ function wxr_tag_name( $tag ) {
+ if ( empty( $tag->name ) )
return;
- echo '' . wxr_cdata($t->name) . ' ';
+ echo '' . wxr_cdata( $tag->name ) . ' ';
}
/**
- * {@internal Missing Short Description}}
+ * Output a tag_description XML tag from a given tag object
*
- * @since unknown
+ * @since 2.3.0
*
- * @param object $t Tag Object
+ * @param object $tag Tag Object
*/
- function wxr_tag_description( $t ) {
- if ( empty( $t->description ) )
+ function wxr_tag_description( $tag ) {
+ if ( empty( $tag->description ) )
return;
- echo '' . wxr_cdata($t->description) . ' ';
+ echo '' . wxr_cdata( $tag->description ) . ' ';
}
/**
- * {@internal Missing Short Description}}
+ * Output a term_name XML tag from a given term object
*
- * @since unknown
+ * @since 2.9.0
*
- * @param object $t Term Object
+ * @param object $term Term Object
*/
- function wxr_term_name( $t ) {
- if ( empty( $t->name ) )
+ function wxr_term_name( $term ) {
+ if ( empty( $term->name ) )
return;
- echo '' . wxr_cdata($t->name) . ' ';
+ echo '' . wxr_cdata( $term->name ) . ' ';
}
/**
- * {@internal Missing Short Description}}
+ * Output a term_description XML tag from a given term object
*
- * @since unknown
+ * @since 2.9.0
*
- * @param object $t Term Object
+ * @param object $term Term Object
*/
- function wxr_term_description( $t ) {
- if ( empty( $t->description ) )
+ function wxr_term_description( $term ) {
+ if ( empty( $term->description ) )
return;
- echo '' . wxr_cdata($t->description) . ' ';
+ echo '' . wxr_cdata( $term->description ) . ' ';
}
/**
- * {@internal Missing Short Description}}
+ * Output list of authors with posts
*
- * @since unknown
+ * @since 3.1.0
+ */
+ function wxr_authors_list() {
+ global $wpdb;
+
+ $authors = array();
+ $results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts" );
+ foreach ( (array) $results as $result )
+ $authors[] = get_userdata( $result->post_author );
+
+ $authors = array_filter( $authors );
+
+ foreach( $authors as $author ) {
+ echo "\t";
+ echo '' . $author->ID . ' ';
+ echo '' . $author->user_login . ' ';
+ echo '' . $author->user_email . ' ';
+ echo '' . wxr_cdata( $author->display_name ) . ' ';
+ echo '' . wxr_cdata( $author->user_firstname ) . ' ';
+ echo '' . wxr_cdata( $author->user_lastname ) . ' ';
+ echo " \n";
+ }
+ }
+
+ /**
+ * Ouput all navigation menu terms
+ *
+ * @since 3.1.0
+ */
+ function wxr_nav_menu_terms() {
+ $nav_menus = wp_get_nav_menus();
+ if ( empty( $nav_menus ) || ! is_array( $nav_menus ) )
+ return;
+
+ foreach ( $nav_menus as $menu ) {
+ echo "\t{$menu->term_id} nav_menu {$menu->slug} ";
+ wxr_term_name( $menu );
+ echo " \n";
+ }
+ }
+
+ /**
+ * Output list of taxonomy terms, in XML tag format, associated with a post
+ *
+ * @since 2.3.0
*/
function wxr_post_taxonomy() {
global $post;
- $the_list = '';
- $filter = 'rss';
+ $taxonomies = get_object_taxonomies( $post->post_type );
+ if ( empty( $taxonomies ) )
+ return;
+ $terms = wp_get_object_terms( $post->ID, $taxonomies );
- $taxonomies = get_object_taxonomies( 'post' );
- $terms = wp_get_post_terms( $post->ID, $taxonomies );
foreach ( (array) $terms as $term ) {
- $domain = ( 'post_tag' == $term->taxonomy ) ? 'tag' : $term->taxonomy;
- $term_name = sanitize_term_field( 'name', $term->name, $term->term_id, $term->taxonomy, $filter );
- // Back compat.
- if ( 'category' == $term->taxonomy )
- $the_list .= "\n\t\t \n";
- elseif ( 'post_tag' == $term->taxonomy )
- $the_list .= "\n\t\t \n";
- // forwards compatibility as above
- $the_list .= "\n\t\tslug}\"> \n";
+ echo "\t\ttaxonomy}\" nicename=\"{$term->slug}\">" . wxr_cdata( $term->name ) . " \n";
}
- echo $the_list;
}
- echo '\n";
+ echo '\n";
?>
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
- http://wordpress.org/?v=
+
+
+
-
- slug; ?> parent ? $cats[$c->parent]->name : ''; ?>
-
-
- slug; ?>
-
-
- taxonomy; ?> slug; ?> parent ? $custom_taxonomies[$t->parent]->name : ''; ?>
-
+
+
+
+
+ term_id ?> slug; ?> parent ? $cats[$c->parent]->slug : ''; ?>
+
+
+ term_id ?> slug; ?>
+
+
+ term_id ?> taxonomy; ?> slug; ?> parent ? $terms[$t->parent]->slug : ''; ?>
+
+
- in_the_loop = true; // Fake being in the loop.
+ $wp_query->in_the_loop = true; // Fake being in the loop.
// fetch 20 posts at a time rather than loading the entire table into memory
while ( $next_posts = array_splice( $post_ids, 0, 20 ) ) {
$where = "WHERE ID IN (" . join( ',', $next_posts ) . ")";
- $posts = $wpdb->get_results( "SELECT * FROM $wpdb->posts $where ORDER BY post_date_gmt ASC" );
+ $posts = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} $where" );
// Begin Loop
- foreach ($posts as $post) {
- setup_postdata( $post );
-
- $is_sticky = 0;
- if ( is_sticky( $post->ID ) )
- $is_sticky = 1;
-
- ?>
+ foreach ( $posts as $post ) {
+ setup_postdata( $post );
+ $is_sticky = is_sticky( $post->ID ) ? 1 : 0;
+?>
-
post_title ); ?>
-
-
-
+
post_content ) ); ?>
@@ -363,41 +379,36 @@ function export_wp( $args = array() ) {
post_type; ?>
post_password; ?>
- post_type == 'attachment' ) { ?>
+post_type == 'attachment' ) : ?>
ID ); ?>
-
- get_results( $wpdb->prepare( "SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID ) );
- if ( $postmeta ) {
- ?>
-
+
+
+get_results( $wpdb->prepare( "SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID ) );
+ if ( $postmeta ) : foreach( $postmeta as $meta ) : if ( $meta->meta_key != '_edit_lock' ) : ?>
- meta_key; ?>
- meta_value ); ?>
+ meta_key; ?>
+ meta_value ); ?>
-
-
- get_results( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d", $post->ID ) );
- if ( $comments ) { foreach ( $comments as $c ) { ?>
+
+get_results( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved <> 'spam'", $post->ID ) );
+ if ( $comments ) : foreach ( $comments as $c ) : ?>
- comment_ID; ?>
- comment_author ); ?>
- comment_author_email; ?>
- comment_author_url ); ?>
- comment_author_IP; ?>
- comment_date; ?>
- comment_date_gmt; ?>
- comment_content ) ?>
- comment_approved; ?>
- comment_type; ?>
- comment_parent; ?>
- user_id; ?>
+ comment_ID; ?>
+ comment_author ); ?>
+ comment_author_email; ?>
+ comment_author_url ); ?>
+ comment_author_IP; ?>
+ comment_date; ?>
+ comment_date_gmt; ?>
+ comment_content ) ?>
+ comment_approved; ?>
+ comment_type; ?>
+ comment_parent; ?>
+ user_id; ?>
-
+
-
@@ -405,5 +416,3 @@ function export_wp( $args = array() ) {
diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php
index d79f2e34..20d13616 100644
--- a/wp-admin/includes/file.php
+++ b/wp-admin/includes/file.php
@@ -7,10 +7,11 @@
*/
/** The descriptions for theme files. */
-$wp_file_descriptions = array (
+$wp_file_descriptions = array(
'index.php' => __( 'Main Index Template' ),
'style.css' => __( 'Stylesheet' ),
'editor-style.css' => __( 'Visual Editor Stylesheet' ),
+ 'editor-style-rtl.css' => __( 'Visual Editor RTL Stylesheet' ),
'rtl.css' => __( 'RTL Stylesheet' ),
'comments.php' => __( 'Comments' ),
'comments-popup.php' => __( 'Popup Comments' ),
@@ -36,15 +37,21 @@ $wp_file_descriptions = array (
'my-hacks.php' => __( 'my-hacks.php (legacy hacks support)' ),
'.htaccess' => __( '.htaccess (for rewrite rules )' ),
// Deprecated files
- 'wp-layout.css' => __( 'Stylesheet' ), 'wp-comments.php' => __( 'Comments Template' ), 'wp-comments-popup.php' => __( 'Popup Comments Template' ));
+ 'wp-layout.css' => __( 'Stylesheet' ),
+ 'wp-comments.php' => __( 'Comments Template' ),
+ 'wp-comments-popup.php' => __( 'Popup Comments Template' ),
+);
/**
- * {@internal Missing Short Description}}
+ * Get the description for standard WordPress theme files and other various standard
+ * WordPress files
*
- * @since unknown
+ * @since 1.5.0
*
- * @param unknown_type $file
- * @return unknown
+ * @uses _cleanup_header_comment
+ * @uses $wp_file_descriptions
+ * @param string $file Filesystem path or filename
+ * @return string Description of file from $wp_file_descriptions or basename of $file if description doesn't exist
*/
function get_file_description( $file ) {
global $wp_file_descriptions;
@@ -55,18 +62,19 @@ function get_file_description( $file ) {
elseif ( file_exists( $file ) && is_file( $file ) ) {
$template_data = implode( '', file( $file ) );
if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ))
- return _cleanup_header_comment($name[1]) . ' Page Template';
+ return sprintf( __( '%s Page Template' ), _cleanup_header_comment($name[1]) );
}
return basename( $file );
}
/**
- * {@internal Missing Short Description}}
+ * Get the absolute filesystem path to the root of the WordPress installation
*
- * @since unknown
+ * @since 1.5.0
*
- * @return unknown
+ * @uses get_option
+ * @return string Full filesystem path to the root of the WordPress installation
*/
function get_home_path() {
$home = get_option( 'home' );
@@ -84,12 +92,18 @@ function get_home_path() {
}
/**
- * {@internal Missing Short Description}}
+ * Get the real file system path to a file to edit within the admin
*
- * @since unknown
+ * If the $file is index.php or .htaccess this function will assume it is relative
+ * to the install root, otherwise it is assumed the file is relative to the wp-content
+ * directory
*
- * @param unknown_type $file
- * @return unknown
+ * @since 1.5.0
+ *
+ * @uses get_home_path
+ * @uses WP_CONTENT_DIR full filesystem path to the wp-content directory
+ * @param string $file filesystem path relative to the WordPress install directory or to the wp-content directory
+ * @return string full file system path to edit
*/
function get_real_file_to_edit( $file ) {
if ('index.php' == $file || '.htaccess' == $file ) {
@@ -201,13 +215,17 @@ function wp_tempnam($filename = '', $dir = '') {
}
/**
- * {@internal Missing Short Description}}
+ * Make sure that the file that was requested to edit, is allowed to be edited
+ *
+ * Function will die if if you are not allowed to edit the file
*
- * @since unknown
+ * @since 1.5.0
*
- * @param unknown_type $file
- * @param unknown_type $allowed_files
- * @return unknown
+ * @uses wp_die
+ * @uses validate_file
+ * @param string $file file the users is attempting to edit
+ * @param array $allowed_files Array of allowed files to edit, $file must match an entry exactly
+ * @return null
*/
function validate_file_to_edit( $file, $allowed_files = '' ) {
$code = validate_file( $file, $allowed_files );
@@ -228,10 +246,19 @@ function validate_file_to_edit( $file, $allowed_files = '' ) {
}
/**
- * {@internal Missing Short Description}}
+ * Handle PHP uploads in WordPress, sanitizing file names, checking extensions for mime type,
+ * and moving the file to the appropriate directory within the uploads directory.
*
- * @since unknown
+ * @since 2.0
*
+ * @uses wp_handle_upload_error
+ * @uses apply_filters
+ * @uses is_multisite
+ * @uses wp_check_filetype_and_ext
+ * @uses current_user_can
+ * @uses wp_upload_dir
+ * @uses wp_unique_filename
+ * @uses delete_transient
* @param array $file Reference to a single element of $_FILES. Call the function once for each uploaded file.
* @param array $overrides Optional. An associative array of names=>values to override default variables with extract( $overrides, EXTR_OVERWRITE ).
* @return array On success, returns an associative array of file attributes. On failure, returns $overrides['upload_error_handler'](&$file, $message ) or array( 'error'=>$message ).
@@ -315,7 +342,7 @@ function wp_handle_upload( &$file, $overrides = false, $time = null ) {
$file['name'] = $proper_filename;
if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) )
- return call_user_func($upload_error_handler, $file, __( 'File type does not meet security guidelines. Try another.' ));
+ return call_user_func($upload_error_handler, $file, __( 'Sorry, this file type is not permitted for security reasons.' ));
if ( !$ext )
$ext = ltrim(strrchr($file['name'], '.'), '.');
@@ -352,15 +379,21 @@ function wp_handle_upload( &$file, $overrides = false, $time = null ) {
}
/**
- * {@internal Missing Short Description}}
- *
- * Pass this function an array similar to that of a $_FILES POST array.
+ * Handle sideloads, which is the process of retriving a media item from another server instead of
+ * a traditional media upload. This process involves sanitizing the filename, checking extensions
+ * for mime type, and moving the file to the appropriate directory within the uploads directory.
*
- * @since unknown
+ * @since 2.6.0
*
- * @param unknown_type $file
- * @param unknown_type $overrides
- * @return unknown
+ * @uses wp_handle_upload_error
+ * @uses apply_filters
+ * @uses wp_check_filetype_and_ext
+ * @uses current_user_can
+ * @uses wp_upload_dir
+ * @uses wp_unique_filename
+ * @param array $file an array similar to that of a PHP $_FILES POST array
+ * @param array $overrides Optional. An associative array of names=>values to override default variables with extract( $overrides, EXTR_OVERWRITE ).
+ * @return array On success, returns an associative array of file attributes. On failure, returns $overrides['upload_error_handler'](&$file, $message ) or array( 'error'=>$message ).
*/
function wp_handle_sideload( &$file, $overrides = false ) {
// The default error handler.
@@ -429,7 +462,7 @@ function wp_handle_sideload( &$file, $overrides = false ) {
$file['name'] = $proper_filename;
if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) )
- return $upload_error_handler( $file, __( 'File type does not meet security guidelines. Try another.' ));
+ return $upload_error_handler( $file, __( 'Sorry, this file type is not permitted for security reasons.' ));
if ( !$ext )
$ext = ltrim(strrchr($file['name'], '.'), '.');
@@ -474,9 +507,10 @@ function wp_handle_sideload( &$file, $overrides = false ) {
* @since 2.5.0
*
* @param string $url the URL of the file to download
+ * @param int $timeout The timeout for the request to download the file default 300 seconds
* @return mixed WP_Error on failure, string Filename on success.
*/
-function download_url( $url ) {
+function download_url( $url, $timeout = 300 ) {
//WARNING: The file is not automatically deleted, The script must unlink() the file.
if ( ! $url )
return new WP_Error('http_no_url', __('Invalid URL Provided.'));
@@ -489,7 +523,7 @@ function download_url( $url ) {
if ( ! $handle )
return new WP_Error('http_no_file', __('Could not create Temporary file.'));
- $response = wp_remote_get($url, array('timeout' => 300));
+ $response = wp_remote_get($url, array('timeout' => $timeout));
if ( is_wp_error($response) ) {
fclose($handle);
@@ -936,8 +970,8 @@ function request_filesystem_credentials($form_post, $type = '', $error = false,
if ( $error ) {
$error_string = __('Error: There was an error connecting to the server, Please verify the settings are correct.');
if ( is_wp_error($error) )
- $error_string = $error->get_error_message();
- echo '' . esc_html( $error_string ) . '
';
+ $error_string = esc_html( $error->get_error_message() );
+ echo '';
}
$types = array();
@@ -971,7 +1005,7 @@ jQuery(function($){
';
}
+submit_button( __( 'Proceed' ), 'button', 'upgrade' );
?>
-
-
-
error = __('Cannot load image metadata.');
@@ -492,7 +493,7 @@ function wp_restore_image($post_id) {
}
function wp_save_image($post_id) {
- $return = '';
+ $return = new stdClass;
$success = $delete = $scaled = $nocrop = false;
$post = get_post($post_id);
@ini_set('memory_limit', '256M');
diff --git a/wp-admin/includes/import.php b/wp-admin/includes/import.php
index c323cdd0..51861bdc 100644
--- a/wp-admin/includes/import.php
+++ b/wp-admin/includes/import.php
@@ -56,7 +56,7 @@ function wp_import_cleanup( $id ) {
*
* @since 2.0.0
*
- * @return array
+ * @return array Uploaded file's details on success, error message on failure
*/
function wp_import_handle_upload() {
if ( !isset($_FILES['import']) ) {
@@ -73,7 +73,7 @@ function wp_import_handle_upload() {
$url = $file['url'];
$type = $file['type'];
- $file = addslashes( $file['file'] );
+ $file = $file['file'];
$filename = basename( $file );
// Construct the object array
diff --git a/wp-admin/includes/internal-linking.php b/wp-admin/includes/internal-linking.php
new file mode 100644
index 00000000..b2e60a20
--- /dev/null
+++ b/wp-admin/includes/internal-linking.php
@@ -0,0 +1,124 @@
+ true ), 'objects' );
+ $pt_names = array_keys( $pts );
+
+ $query = array(
+ 'post_type' => $pt_names,
+ 'suppress_filters' => true,
+ 'update_post_term_cache' => false,
+ 'update_post_meta_cache' => false,
+ 'post_status' => 'publish',
+ 'order' => 'DESC',
+ 'orderby' => 'post_date',
+ 'posts_per_page' => 20,
+ );
+
+ $args['pagenum'] = isset( $args['pagenum'] ) ? absint( $args['pagenum'] ) : 1;
+
+ if ( isset( $args['s'] ) )
+ $query['s'] = $args['s'];
+
+ $query['offset'] = $args['pagenum'] > 1 ? $query['posts_per_page'] * ( $args['pagenum'] - 1 ) : 0;
+
+ // Do main query.
+ $get_posts = new WP_Query;
+ $posts = $get_posts->query( $query );
+ // Check if any posts were found.
+ if ( ! $get_posts->post_count )
+ return false;
+
+ // Build results.
+ $results = array();
+ foreach ( $posts as $post ) {
+ if ( 'post' == $post->post_type )
+ $info = mysql2date( __( 'Y/m/d' ), $post->post_date );
+ else
+ $info = $pts[ $post->post_type ]->labels->singular_name;
+
+ $results[] = array(
+ 'ID' => $post->ID,
+ 'title' => trim( esc_html( strip_tags( get_the_title( $post ) ) ) ),
+ 'permalink' => get_permalink( $post->ID ),
+ 'info' => $info,
+ );
+ }
+
+ return $results;
+}
+
+/**
+ * Dialog for internal linking.
+ *
+ * @since 3.1.0
+ */
+function wp_link_dialog() {
+?>
+
+
+
+
+
+
+
>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wp-admin/includes/list-table.php b/wp-admin/includes/list-table.php
new file mode 100644
index 00000000..716e80ac
--- /dev/null
+++ b/wp-admin/includes/list-table.php
@@ -0,0 +1,104 @@
+ 'posts',
+ 'WP_Media_List_Table' => 'media',
+ 'WP_Terms_List_Table' => 'terms',
+ 'WP_Users_List_Table' => 'users',
+ 'WP_Comments_List_Table' => 'comments',
+ 'WP_Post_Comments_List_Table' => 'comments',
+ 'WP_Links_List_Table' => 'links',
+ 'WP_Plugin_Install_List_Table' => 'plugin-install',
+ 'WP_Themes_List_Table' => 'themes',
+ 'WP_Theme_Install_List_Table' => 'theme-install',
+ 'WP_Plugins_List_Table' => 'plugins',
+ // Network Admin
+ 'WP_MS_Sites_List_Table' => 'ms-sites',
+ 'WP_MS_Users_List_Table' => 'ms-users',
+ 'WP_MS_Themes_List_Table' => 'ms-themes',
+ );
+
+ if ( isset( $core_classes[ $class ] ) ) {
+ require_once( ABSPATH . 'wp-admin/includes/class-wp-' . $core_classes[ $class ] . '-list-table.php' );
+ return new $class;
+ }
+
+ return false;
+}
+
+/**
+ * Register column headers for a particular screen.
+ *
+ * @since 2.7.0
+ *
+ * @param string $screen The handle for the screen to add help to. This is usually the hook name returned by the add_*_page() functions.
+ * @param array $columns An array of columns with column IDs as the keys and translated column names as the values
+ * @see get_column_headers(), print_column_headers(), get_hidden_columns()
+ */
+function register_column_headers($screen, $columns) {
+ $wp_list_table = new _WP_List_Table_Compat($screen, $columns);
+}
+
+/**
+ * Prints column headers for a particular screen.
+ *
+ * @since 2.7.0
+ */
+function print_column_headers($screen, $id = true) {
+ $wp_list_table = new _WP_List_Table_Compat($screen);
+
+ $wp_list_table->print_column_headers($id);
+}
+
+/**
+ * Helper class to be used only by back compat functions
+ *
+ * @since 3.1.0
+ */
+class _WP_List_Table_Compat extends WP_List_Table {
+ var $_screen;
+ var $_columns;
+
+ function _WP_List_Table_Compat( $screen, $columns = array() ) {
+ if ( is_string( $screen ) )
+ $screen = convert_to_screen( $screen );
+
+ $this->_screen = $screen;
+
+ if ( !empty( $columns ) ) {
+ $this->_columns = $columns;
+ add_filter( 'manage_' . $screen->id . '_columns', array( &$this, 'get_columns' ), 0 );
+ }
+ }
+
+ function get_column_info() {
+ $columns = get_column_headers( $this->_screen );
+ $hidden = get_hidden_columns( $this->_screen );
+ $sortable = array();
+
+ return array( $columns, $hidden, $sortable );
+ }
+
+ function get_columns() {
+ return $this->_columns;
+ }
+}
+?>
\ No newline at end of file
diff --git a/wp-admin/includes/manifest.php b/wp-admin/includes/manifest.php
index 45348765..600b5dbd 100644
--- a/wp-admin/includes/manifest.php
+++ b/wp-admin/includes/manifest.php
@@ -39,7 +39,6 @@ function &get_manifest() {
array('images/icons32.png'),
array('images/icons32-vs.png'),
array('images/list.png'),
- array('images/list-vs.png'),
array('images/wpspin_light.gif'),
array('images/wpspin_dark.gif'),
array('images/logo.gif'),
@@ -175,7 +174,6 @@ function &get_manifest() {
array('../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif'),
array('../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif'),
array('../wp-includes/js/tinymce/plugins/media/img/flash.gif'),
- array('../wp-includes/js/tinymce/plugins/media/img/flv_player.swf'),
array('../wp-includes/js/tinymce/plugins/media/img/quicktime.gif'),
array('../wp-includes/js/tinymce/plugins/media/img/realmedia.gif'),
array('../wp-includes/js/tinymce/plugins/media/img/shockwave.gif'),
diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php
index 2bebcc86..5a13bcc2 100644
--- a/wp-admin/includes/media.php
+++ b/wp-admin/includes/media.php
@@ -9,7 +9,7 @@
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.5.0
*
* @return unknown
*/
@@ -27,7 +27,7 @@ function media_upload_tabs() {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.5.0
*
* @param unknown_type $tabs
* @return unknown
@@ -59,7 +59,7 @@ add_filter('media_upload_tabs', 'update_gallery_tab');
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.5.0
*/
function the_media_upload_tabs() {
global $redir_tab;
@@ -89,7 +89,7 @@ function the_media_upload_tabs() {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.5.0
*
* @param unknown_type $id
* @param unknown_type $alt
@@ -117,7 +117,7 @@ function get_image_send_to_editor($id, $caption, $title, $align, $url='', $rel =
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.6.0
*
* @param unknown_type $html
* @param unknown_type $id
@@ -140,6 +140,11 @@ function image_add_caption( $html, $id, $caption, $title, $align, $url, $size, $
$width = $matches[1];
+ $caption = str_replace( array( '>', '<', '"', "'" ),
+ array( '>', '<', '"', ''' ),
+ $caption
+ );
+
$html = preg_replace( '/(class=["\'][^\'"]*)align(none|left|right|center)\s?/', '$1', $html );
if ( empty($align) )
$align = 'none';
@@ -154,7 +159,7 @@ add_filter( 'image_send_to_editor', 'image_add_caption', 20, 8 );
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.5.0
*
* @param unknown_type $html
*/
@@ -175,7 +180,7 @@ win.send_to_editor('');
*
* This handles the file upload POST itself, creating the attachment post.
*
- * @since unknown
+ * @since 2.5.0
*
* @param string $file_id Index into the {@link $_FILES} array of the upload
* @param int $post_id The post ID the media is associated with
@@ -234,15 +239,15 @@ function media_handle_upload($file_id, $post_id, $post_data = array(), $override
}
/**
- * {@internal Missing Short Description}}
+ * This handles a sideloaded file in the same way as an uploaded file is handled by {@link media_handle_upload()}
*
- * @since unknown
+ * @since 2.6.0
*
- * @param unknown_type $file_array
- * @param unknown_type $post_id
- * @param unknown_type $desc
- * @param unknown_type $post_data
- * @return unknown
+ * @param array $file_array Array similar to a {@link $_FILES} upload array
+ * @param int $post_id The post ID the media is associated with
+ * @param string $desc Description of the sideloaded file
+ * @param array $post_data allows you to overwrite some of the attachment
+ * @return int|object The ID of the attachment or a WP_Error on failure
*/
function media_handle_sideload($file_array, $post_id, $desc = null, $post_data = array()) {
$overrides = array('test_form'=>false);
@@ -265,7 +270,7 @@ function media_handle_sideload($file_array, $post_id, $desc = null, $post_data =
$content = $image_meta['caption'];
}
- $title = @$desc;
+ $title = isset($desc) ? $desc : '';
// Construct the attachment array
$attachment = array_merge( array(
@@ -278,10 +283,9 @@ function media_handle_sideload($file_array, $post_id, $desc = null, $post_data =
// Save the attachment metadata
$id = wp_insert_attachment($attachment, $file, $post_id);
- if ( !is_wp_error($id) ) {
+ if ( !is_wp_error($id) )
wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
- return $url;
- }
+
return $id;
}
@@ -291,7 +295,7 @@ function media_handle_sideload($file_array, $post_id, $desc = null, $post_data =
* Wrap iframe content (produced by $content_func) in a doctype, html head/body
* etc any additional function args will be passed to content_func.
*
- * @since unknown
+ * @since 2.5.0
*
* @param unknown_type $content_func
*/
@@ -307,7 +311,8 @@ wp_enqueue_style( 'global' );
wp_enqueue_style( 'wp-admin' );
wp_enqueue_style( 'colors' );
// Check callback name for 'media'
-if ( ( is_array( $content_func ) && ! empty( $content_func[1] ) && 0 === strpos( (string) $content_func[1], 'media' ) ) || 0 === strpos( $content_func, 'media' ) )
+if ( ( is_array( $content_func ) && ! empty( $content_func[1] ) && 0 === strpos( (string) $content_func[1], 'media' ) )
+ || ( ! is_array( $content_func ) && 0 === strpos( $content_func, 'media' ) ) )
wp_enqueue_style( 'media' );
wp_enqueue_style( 'ie' );
?>
@@ -315,7 +320,8 @@ wp_enqueue_style( 'ie' );
//','uid':'ID; ?>','time':''};
-var ajaxurl = '', pagenow = 'media-upload-popup', adminpage = 'media-upload-popup';
+var ajaxurl = '', pagenow = 'media-upload-popup', adminpage = 'media-upload-popup',
+isRtl = ;
//]]>
";
+ return " ";
}
function get_upload_iframe_src($type) {
@@ -397,7 +403,7 @@ function get_upload_iframe_src($type) {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.5.0
*
* @return unknown
*/
@@ -484,7 +490,7 @@ function media_upload_form_handler() {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.5.0
*
* @return unknown
*/
@@ -493,7 +499,6 @@ function media_upload_image() {
$id = 0;
if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
- check_admin_referer('media-form');
// Upload File button was clicked
$id = media_handle_upload('async-upload', $_REQUEST['post_id']);
unset($_FILES);
@@ -542,19 +547,19 @@ function media_upload_image() {
}
/**
- * {@internal Missing Short Description}}
+ * Download an image from the specified URL and attach it to a post.
*
- * @since unknown
+ * @since 2.6.0
*
- * @param unknown_type $file
- * @param unknown_type $post_id
- * @param unknown_type $desc
- * @return unknown
+ * @param string $file The URL of the image to download
+ * @param int $post_id The post ID the media is to be associated with
+ * @param string $desc Optional. Description of the image
+ * @return string|WP_Error Populated HTML img tag on success
*/
function media_sideload_image($file, $post_id, $desc = null) {
- if (!empty($file) ) {
+ if ( ! empty($file) ) {
// Download file to temp location
- $tmp = download_url($file);
+ $tmp = download_url( $file );
// Set variables for storage
// fix file filename for query strings
@@ -563,25 +568,25 @@ function media_sideload_image($file, $post_id, $desc = null) {
$file_array['tmp_name'] = $tmp;
// If error storing temporarily, unlink
- if ( is_wp_error($tmp) ) {
+ if ( is_wp_error( $tmp ) ) {
@unlink($file_array['tmp_name']);
$file_array['tmp_name'] = '';
}
// do the validation and storage stuff
- $id = media_handle_sideload($file_array, $post_id, @$desc);
- $src = $id;
-
+ $id = media_handle_sideload( $file_array, $post_id, $desc );
// If error storing permanently, unlink
if ( is_wp_error($id) ) {
@unlink($file_array['tmp_name']);
return $id;
}
+
+ $src = wp_get_attachment_url( $id );
}
// Finally check to make sure the file has been saved, then return the html
- if ( !empty($src) ) {
- $alt = @$desc;
+ if ( ! empty($src) ) {
+ $alt = isset($desc) ? esc_attr($desc) : '';
$html = " ";
return $html;
}
@@ -590,7 +595,7 @@ function media_sideload_image($file, $post_id, $desc = null) {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.5.0
*
* @return unknown
*/
@@ -599,7 +604,6 @@ function media_upload_audio() {
$id = 0;
if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
- check_admin_referer('media-form');
// Upload File button was clicked
$id = media_handle_upload('async-upload', $_REQUEST['post_id']);
unset($_FILES);
@@ -649,7 +653,7 @@ function media_upload_audio() {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.5.0
*
* @return unknown
*/
@@ -658,7 +662,6 @@ function media_upload_video() {
$id = 0;
if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
- check_admin_referer('media-form');
// Upload File button was clicked
$id = media_handle_upload('async-upload', $_REQUEST['post_id']);
unset($_FILES);
@@ -708,7 +711,7 @@ function media_upload_video() {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.5.0
*
* @return unknown
*/
@@ -717,7 +720,6 @@ function media_upload_file() {
$id = 0;
if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
- check_admin_referer('media-form');
// Upload File button was clicked
$id = media_handle_upload('async-upload', $_REQUEST['post_id']);
unset($_FILES);
@@ -764,7 +766,7 @@ function media_upload_file() {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.5.0
*
* @return unknown
*/
@@ -787,7 +789,7 @@ function media_upload_gallery() {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.5.0
*
* @return unknown
*/
@@ -808,7 +810,7 @@ function media_upload_library() {
/**
* Retrieve HTML for the image alignment radio buttons with the specified one checked.
*
- * @since unknown
+ * @since 2.7.0
*
* @param unknown_type $post
* @param unknown_type $checked
@@ -836,10 +838,10 @@ function image_align_input_fields( $post, $checked = '' ) {
/**
* Retrieve HTML for the size radio buttons with the specified one checked.
*
- * @since unknown
+ * @since 2.7.0
*
* @param unknown_type $post
- * @param unknown_type $checked
+ * @param unknown_type $check
* @return unknown
*/
function image_size_input_fields( $post, $check = '' ) {
@@ -891,7 +893,7 @@ function image_size_input_fields( $post, $check = '' ) {
/**
* Retrieve HTML for the Link URL buttons with the default link type as specified.
*
- * @since unknown
+ * @since 2.7.0
*
* @param unknown_type $post
* @param unknown_type $url_type
@@ -922,7 +924,7 @@ function image_link_input_fields($post, $url_type = '') {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.5.0
*
* @param unknown_type $form_fields
* @param unknown_type $post
@@ -961,7 +963,7 @@ add_filter('attachment_fields_to_edit', 'image_attachment_fields_to_edit', 10, 2
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.5.0
*
* @param unknown_type $form_fields
* @param unknown_type $post
@@ -972,6 +974,15 @@ function media_single_attachment_fields_to_edit( $form_fields, $post ) {
return $form_fields;
}
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 2.8.0
+ *
+ * @param unknown_type $form_fields
+ * @param unknown_type $post
+ * @return unknown
+ */
function media_post_single_attachment_fields_to_edit( $form_fields, $post ) {
unset($form_fields['image_url']);
return $form_fields;
@@ -980,7 +991,7 @@ function media_post_single_attachment_fields_to_edit( $form_fields, $post ) {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.5.0
*
* @param unknown_type $post
* @param unknown_type $attachment
@@ -1002,7 +1013,7 @@ add_filter('attachment_fields_to_save', 'image_attachment_fields_to_save', 10, 2
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.5.0
*
* @param unknown_type $html
* @param unknown_type $attachment_id
@@ -1029,7 +1040,7 @@ add_filter('media_send_to_editor', 'image_media_send_to_editor', 10, 3);
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.5.0
*
* @param unknown_type $post
* @param unknown_type $errors
@@ -1083,6 +1094,8 @@ function get_attachment_fields_to_edit($post, $errors = null) {
foreach ( get_attachment_taxonomies($post) as $taxonomy ) {
$t = (array) get_taxonomy($taxonomy);
+ if ( ! $t['public'] )
+ continue;
if ( empty($t['label']) )
$t['label'] = $taxonomy;
if ( empty($t['args']) )
@@ -1117,7 +1130,7 @@ function get_attachment_fields_to_edit($post, $errors = null) {
* component. Will also create link for showing and hiding the form to modify
* the image attachment.
*
- * @since unknown
+ * @since 2.5.0
*
* @param int $post_id Optional. Post ID.
* @param array $errors Errors for attachment, if any.
@@ -1151,7 +1164,7 @@ function get_media_items( $post_id, $errors ) {
/**
* Retrieve HTML form for modifying the image attachment.
*
- * @since unknown
+ * @since 2.5.0
*
* @param int $attachment_id Attachment ID for modification.
* @param string|array $args Optional. Override defaults.
@@ -1167,8 +1180,9 @@ function get_media_item( $attachment_id, $args = null ) {
$post = get_post( $attachment_id );
- $default_args = array( 'errors' => null, 'send' => post_type_supports(get_post_type($post->post_parent), 'editor'), 'delete' => true, 'toggle' => true, 'show_title' => true );
+ $default_args = array( 'errors' => null, 'send' => $post->post_parent ? post_type_supports( get_post_type( $post->post_parent ), 'editor' ) : true, 'delete' => true, 'toggle' => true, 'show_title' => true );
$args = wp_parse_args( $args, $default_args );
+ $args = apply_filters( 'get_media_item_args', $args );
extract( $args, EXTR_SKIP );
$toggle_on = __( 'Show' );
@@ -1269,7 +1283,7 @@ function get_media_item( $attachment_id, $args = null ) {
);
if ( $send )
- $send = " ";
+ $send = get_submit_button( __( 'Insert into Post' ), 'button', "send[$attachment_id]", false );
if ( $delete && current_user_can( 'delete_post', $attachment_id ) ) {
if ( !EMPTY_TRASH_DAYS ) {
$delete = "" . __( 'Delete Permanently' ) . ' ';
@@ -1304,7 +1318,7 @@ function get_media_item( $attachment_id, $args = null ) {
$hidden_fields = array();
foreach ( $form_fields as $id => $field ) {
- if ( $id{0} == '_' )
+ if ( $id[0] == '_' )
continue;
if ( !empty( $field['tr'] ) ) {
@@ -1329,7 +1343,10 @@ function get_media_item( $attachment_id, $args = null ) {
if ( !empty( $field[ $field['input'] ] ) )
$item .= $field[ $field['input'] ];
elseif ( $field['input'] == 'textarea' ) {
- $item .= "" . esc_html( $field['value'] ) . ' ';
+ if ( user_can_richedit() ) { // textarea_escaped when user_can_richedit() = false
+ $field['value'] = esc_textarea( $field['value'] );
+ }
+ $item .= "" . $field['value'] . ' ';
} else {
$item .= " ";
}
@@ -1373,7 +1390,7 @@ function get_media_item( $attachment_id, $args = null ) {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.5.0
*/
function media_upload_header() {
?>
@@ -1387,12 +1404,12 @@ function media_upload_header() {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.5.0
*
* @param unknown_type $errors
*/
function media_upload_form( $errors = null ) {
- global $type, $tab;
+ global $type, $tab, $pagenow;
$flash_action_url = admin_url('async-upload.php');
@@ -1444,7 +1461,36 @@ if ( is_multisite() && !is_upload_space_available() ) {
do_action('pre-upload-ui');
-if ( $flash ) : ?>
+if ( $flash ) :
+
+// Set the post params, which SWFUpload will post back with the file, and pass
+// them through a filter.
+$post_params = array(
+ "post_id" => $post_id,
+ "auth_cookie" => (is_ssl() ? $_COOKIE[SECURE_AUTH_COOKIE] : $_COOKIE[AUTH_COOKIE]),
+ "logged_in_cookie" => $_COOKIE[LOGGED_IN_COOKIE],
+ "_wpnonce" => wp_create_nonce('media-form'),
+ "type" => $type,
+ "tab" => $tab,
+ "short" => "1",
+);
+$post_params = apply_filters( 'swfupload_post_params', $post_params );
+$p = array();
+foreach ( $post_params as $param => $val )
+ $p[] = "\t\t'$param' : '$val'";
+$post_params_str = implode( ", \n", $p );
+
+// #8545. wmode=transparent cannot be used with SWFUpload
+if ( 'media-new.php' == $pagenow ) {
+ $upload_image_path = get_user_option( 'admin_color' );
+ if ( 'classic' != $upload_image_path )
+ $upload_image_path = 'fresh';
+ $upload_image_path = admin_url( 'images/upload-' . $upload_image_path . '.png?ver=20101205' );
+} else {
+ $upload_image_path = includes_url( 'images/upload.png?ver=20100531' );
+}
+
+?>
post_type ); // TODO: ROLE SYSTEM
- if ( $post->post_author && !in_array($post->post_author, $authors) )
- $authors[] = $post->post_author;
?>
- $authors, 'name' => 'post_author_override', 'selected' => empty($post->ID) ? $user_ID : $post->post_author) ); ?>
+
'authors',
+ 'name' => 'post_author_override',
+ 'selected' => empty($post->ID) ? $user_ID : $post->post_author,
+ 'include_selected' => true
+ ) );
}
@@ -578,7 +600,7 @@ function link_submit_meta_box($link) {
-
+
@@ -862,7 +884,7 @@ function link_advanced_meta_box($link) {
- link_notes ) ? $link->link_notes : ''); ?>
+ link_notes ) ? $link->link_notes : ''); // textarea_escaped ?>
diff --git a/wp-admin/includes/misc.php b/wp-admin/includes/misc.php
index 1ecb3a05..d8ab0fca 100644
--- a/wp-admin/includes/misc.php
+++ b/wp-admin/includes/misc.php
@@ -9,7 +9,7 @@
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.0.0
*
* @return unknown
*/
@@ -21,7 +21,7 @@ function got_mod_rewrite() {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 1.5.0
*
* @param unknown_type $filename
* @param unknown_type $marker
@@ -57,7 +57,7 @@ function extract_from_markers( $filename, $marker ) {
* BEGIN and END markers. Replaces existing marked info. Retains surrounding
* data. Creates file if none exists.
*
- * @since unknown
+ * @since 1.5.0
*
* @param unknown_type $filename
* @param unknown_type $marker
@@ -117,7 +117,7 @@ function insert_with_markers( $filename, $marker, $insertion ) {
* Always writes to the file if it exists and is writable to ensure that we
* blank out old rules.
*
- * @since unknown
+ * @since 1.5.0
*/
function save_mod_rewrite_rules() {
if ( is_multisite() )
@@ -149,20 +149,21 @@ function save_mod_rewrite_rules() {
* @return bool True if web.config was updated successfully
*/
function iis7_save_url_rewrite_rules(){
+ if ( is_multisite() )
+ return;
+
global $wp_rewrite;
$home_path = get_home_path();
$web_config_file = $home_path . 'web.config';
// Using win_is_writable() instead of is_writable() because of a bug in Windows PHP
- if ( ( ! file_exists($web_config_file) && win_is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks() ) || win_is_writable($web_config_file) ) {
- if ( iis7_supports_permalinks() ) {
- $rule = $wp_rewrite->iis7_url_rewrite_rules(false, '', '');
- if ( ! empty($rule) ) {
- return iis7_add_rewrite_rule($web_config_file, $rule);
- } else {
- return iis7_delete_rewrite_rule($web_config_file);
- }
+ if ( iis7_supports_permalinks() && ( ( ! file_exists($web_config_file) && win_is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks() ) || win_is_writable($web_config_file) ) ) {
+ $rule = $wp_rewrite->iis7_url_rewrite_rules(false, '', '');
+ if ( ! empty($rule) ) {
+ return iis7_add_rewrite_rule($web_config_file, $rule);
+ } else {
+ return iis7_delete_rewrite_rule($web_config_file);
}
}
return false;
@@ -171,7 +172,7 @@ function iis7_save_url_rewrite_rules(){
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 1.5.0
*
* @param unknown_type $file
*/
@@ -193,7 +194,7 @@ function update_recently_edited( $file ) {
/**
* If siteurl or home changed, flush rewrite rules.
*
- * @since unknown
+ * @since 2.1.0
*
* @param unknown_type $old_value
* @param unknown_type $value
@@ -212,12 +213,12 @@ add_action( 'update_option_home', 'update_home_siteurl', 10, 2 );
add_action( 'update_option_siteurl', 'update_home_siteurl', 10, 2 );
/**
- * {@internal Missing Short Description}}
+ * Shorten an URL, to be used as link text
*
- * @since unknown
+ * @since 1.2.1
*
- * @param unknown_type $url
- * @return unknown
+ * @param string $url
+ * @return string
*/
function url_shorten( $url ) {
$short_url = str_replace( 'http://', '', stripslashes( $url ));
@@ -236,7 +237,7 @@ function url_shorten( $url ) {
* in the $vars array to the value of $_POST[$var] or $_GET[$var] or ''
* if neither is defined.
*
- * @since unknown
+ * @since 2.0.0
*
* @param array $vars An array of globals to reset.
*/
@@ -259,7 +260,7 @@ function wp_reset_vars( $vars ) {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.1.0
*
* @param unknown_type $message
*/
@@ -343,12 +344,18 @@ function set_screen_options() {
switch ( $map_option ) {
case 'edit_per_page':
- case 'ms_sites_per_page':
- case 'ms_users_per_page':
+ case 'users_per_page':
case 'edit_comments_per_page':
case 'upload_per_page':
case 'edit_tags_per_page':
case 'plugins_per_page':
+ // Network admin
+ case 'sites_network_per_page':
+ case 'users_network_per_page':
+ case 'site_users_network_per_page':
+ case 'plugins_network_per_page':
+ case 'themes_network_per_page':
+ case 'site_themes_network_per_page':
$value = (int) $value;
if ( $value < 1 || $value > 999 )
return;
@@ -374,34 +381,6 @@ function wp_menu_unfold() {
}
}
-/**
- * Check if IIS 7 supports pretty permalinks
- *
- * @since 2.8.0
- *
- * @return bool
- */
-function iis7_supports_permalinks() {
- global $is_iis7;
-
- $supports_permalinks = false;
- if ( $is_iis7 ) {
- /* First we check if the DOMDocument class exists. If it does not exist,
- * which is the case for PHP 4.X, then we cannot easily update the xml configuration file,
- * hence we just bail out and tell user that pretty permalinks cannot be used.
- * This is not a big issue because PHP 4.X is going to be depricated and for IIS it
- * is recommended to use PHP 5.X NTS.
- * Next we check if the URL Rewrite Module 1.1 is loaded and enabled for the web site. When
- * URL Rewrite 1.1 is loaded it always sets a server variable called 'IIS_UrlRewriteModule'.
- * Lastly we make sure that PHP is running via FastCGI. This is important because if it runs
- * via ISAPI then pretty permalinks will not work.
- */
- $supports_permalinks = class_exists('DOMDocument') && isset($_SERVER['IIS_UrlRewriteModule']) && ( php_sapi_name() == 'cgi-fcgi' );
- }
-
- return apply_filters('iis7_supports_permalinks', $supports_permalinks);
-}
-
/**
* Check if rewrite rule for WordPress already exists in the IIS 7 configuration file
*
@@ -561,29 +540,29 @@ function saveDomDocument($doc, $filename) {
*
* @since 2.8.0
*
- * @param object $path
+ * @param string $path
* @return bool
*/
-function win_is_writable($path) {
+function win_is_writable( $path ) {
/* will work in despite of Windows ACLs bug
* NOTE: use a trailing slash for folders!!!
* see http://bugs.php.net/bug.php?id=27609
* see http://bugs.php.net/bug.php?id=30931
*/
- if ( $path{strlen($path)-1} == '/' ) // recursively return a temporary file path
- return win_is_writable($path . uniqid(mt_rand()) . '.tmp');
- else if ( is_dir($path) )
- return win_is_writable($path . '/' . uniqid(mt_rand()) . '.tmp');
- // check tmp file for read/write capabilities
- $rm = file_exists($path);
- $f = @fopen($path, 'a');
- if ($f===false)
- return false;
- fclose($f);
- if ( ! $rm )
- unlink($path);
- return true;
+ if ( $path[strlen( $path ) - 1] == '/' ) // recursively return a temporary file path
+ return win_is_writable( $path . uniqid( mt_rand() ) . '.tmp');
+ else if ( is_dir( $path ) )
+ return win_is_writable( $path . '/' . uniqid( mt_rand() ) . '.tmp' );
+ // check tmp file for read/write capabilities
+ $should_delete_tmp_file = !file_exists( $path );
+ $f = @fopen( $path, 'a' );
+ if ( $f === false )
+ return false;
+ fclose( $f );
+ if ( $should_delete_tmp_file )
+ unlink( $path );
+ return true;
}
/**
diff --git a/wp-admin/includes/ms.php b/wp-admin/includes/ms.php
index 8009d7d2..84585264 100644
--- a/wp-admin/includes/ms.php
+++ b/wp-admin/includes/ms.php
@@ -65,12 +65,12 @@ function wpmu_delete_blog( $blog_id, $drop = false ) {
do_action( 'delete_blog', $blog_id, $drop );
- $users = get_users_of_blog( $blog_id );
+ $users = get_users( array( 'blog_id' => $blog_id, 'fields' => 'ids' ) );
// Remove users from this blog.
if ( ! empty( $users ) ) {
- foreach ( $users as $user ) {
- remove_user_from_blog( $user->user_id, $blog_id) ;
+ foreach ( $users as $user_id ) {
+ remove_user_from_blog( $user_id, $blog_id) ;
}
}
@@ -177,72 +177,6 @@ function wpmu_delete_user( $id ) {
return true;
}
-function confirm_delete_users( $users ) {
- $current_user = wp_get_current_user();
- if ( !is_array( $users ) )
- return false;
-
- screen_icon();
- ?>
-
-
-
-
- ID'>$current_user->user_login";
-
- foreach ( ( $allusers = (array) $_POST['allusers'] ) as $key => $val ) {
- if ( $val != '' && $val != '0' ) {
- $delete_user = new WP_User( $val );
-
- if ( in_array( $delete_user->user_login, $site_admins ) )
- wp_die( sprintf( __( 'Warning! User cannot be deleted. The user %s is a network admnistrator.' ), $delete_user->user_login ) );
-
- echo " \n";
- $blogs = get_blogs_of_user( $val, true );
-
- if ( !empty( $blogs ) ) {
- ?>
- %s?" ), $delete_user->user_login ); ?>
- $details ) {
- $blog_users = get_users_of_blog( $details->userblog_id );
- if ( is_array( $blog_users ) && !empty( $blog_users ) ) {
- $user_site = "{$details->blogname} ";
- $user_dropdown = "";
- $user_list = '';
- foreach ( $blog_users as $user ) {
- if ( $user->user_id != $val && !in_array( $user->user_id, $allusers ) )
- $user_list .= "{$user->user_login} ";
- }
- if ( '' == $user_list )
- $user_list = $admin_out;
- $user_dropdown .= $user_list;
- $user_dropdown .= " \n";
- ?>
-
- ";
- }
- }
- }
- ?>
-
-
- $quota )
- $percentused = '100';
- else
- $percentused = ( $used / $quota ) * 100;
- $used_color = ( $percentused < 70 ) ? ( ( $percentused >= 40 ) ? 'waiting' : 'approved' ) : 'spam';
- $used = round( $used, 2 );
- $percentused = number_format( $percentused );
-
- ?>
-
-
-
-
- %2$sMB' ), esc_url( admin_url( 'upload.php' ) ), $quota ); ?>
-
-
-
-
-
-
- update( $wpdb->users, array( $pref => $value ), array( 'ID' => $id ) );
- if ( $refresh == 1 )
- refresh_user_details( $id );
+ clean_user_cache( $id );
if ( $pref == 'spam' ) {
if ( $value == 1 )
@@ -608,30 +507,13 @@ function redirect_user_to_blog() {
$c ++;
$blog = get_active_blog_for_user( get_current_user_id() );
- $dashboard_blog = get_dashboard_blog();
+
if ( is_object( $blog ) ) {
wp_redirect( get_admin_url( $blog->blog_id, '?c=' . $c ) ); // redirect and count to 5, "just in case"
- exit;
- }
-
- /*
- If the user is a member of only 1 blog and the user's primary_blog isn't set to that blog,
- then update the primary_blog record to match the user's blog
- */
- $blogs = get_blogs_of_user( get_current_user_id() );
-
- if ( !empty( $blogs ) ) {
- foreach( $blogs as $blogid => $blog ) {
- if ( $blogid != $dashboard_blog->blog_id && get_user_meta( get_current_user_id() , 'primary_blog', true ) == $dashboard_blog->blog_id ) {
- update_user_meta( get_current_user_id(), 'primary_blog', $blogid );
- continue;
- }
- }
- $blog = get_blog_details( get_user_meta( get_current_user_id(), 'primary_blog', true ) );
- wp_redirect( get_admin_url( $blog->blog_id, '?c=' . $c ) );
- exit;
+ } else {
+ wp_redirect( user_admin_url( '?c=' . $c ) ); // redirect and count to 5, "just in case"
}
- wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
+ exit;
}
add_action( 'admin_page_access_denied', 'redirect_user_to_blog', 99 );
@@ -693,47 +575,17 @@ function secret_salt_warning() {
echo "$msg
";
}
}
-add_action( 'admin_notices', 'secret_salt_warning' );
-
-function admin_notice_feed() {
- global $current_screen;
- if ( $current_screen->id != 'dashboard' )
- return;
-
- if ( !empty( $_GET['feed_dismiss'] ) ) {
- update_user_option( get_current_user_id(), 'admin_feed_dismiss', $_GET['feed_dismiss'], true );
- return;
- }
-
- $url = get_site_option( 'admin_notice_feed' );
- if ( empty( $url ) )
- return;
-
- $rss = fetch_feed( $url );
- if ( ! is_wp_error( $rss ) && $item = $rss->get_item() ) {
- $title = $item->get_title();
- if ( md5( $title ) == get_user_option( 'admin_feed_dismiss' ) )
- return;
- $msg = "" . esc_html( $title ) . " \n";
- $content = $item->get_description();
- $content = $content ? wp_html_excerpt( $content, 200 ) . ' … ' : '';
- $link = esc_url( strip_tags( $item->get_link() ) );
- $msg .= "" . $content . "" . __( 'Read More' ) . " " . __( 'Dismiss' ) . "
";
- echo "$msg
";
- } elseif ( is_super_admin() ) {
- printf( '' . __( 'Your feed at %s is empty.' ) . '
', esc_html( $url ) );
- }
-}
-add_action( 'admin_notices', 'admin_notice_feed' );
+add_action( 'network_admin_notices', 'secret_salt_warning' );
function site_admin_notice() {
global $wp_db_version;
if ( !is_super_admin() )
return false;
if ( get_site_option( 'wpmu_upgrade_site' ) != $wp_db_version )
- echo "" . sprintf( __( 'Thank you for Updating! Please visit the
Update Network page to update all your sites.' ), esc_url( admin_url( 'ms-upgrade-network.php' ) ) ) . "
";
+ echo "" . sprintf( __( 'Thank you for Updating! Please visit the
Update Network page to update all your sites.' ), esc_url( network_admin_url( 'upgrade.php' ) ) ) . "
";
}
add_action( 'admin_notices', 'site_admin_notice' );
+add_action( 'network_admin_notices', 'site_admin_notice' );
function avoid_blog_page_permalink_collision( $data, $postarr ) {
if ( is_subdomain_install() )
@@ -805,16 +657,6 @@ function choose_primary_blog() {
" . sprintf( __( "Warning! The current theme supports Featured Images. You must enable image uploads on the options page for it to work." ), esc_url( admin_url( 'ms-options.php' ) ) ) . "";
- }
-}
-add_action( 'admin_notices', 'show_post_thumbnail_warning' );
-
function ms_deprecated_blogs_file() {
if ( ! is_super_admin() )
return;
@@ -822,24 +664,13 @@ function ms_deprecated_blogs_file() {
return;
echo '' . sprintf( __( 'The %1$s
file is deprecated. Please remove it and update your server rewrite rules to use %2$s
instead.' ), 'wp-content/blogs.php', 'wp-includes/ms-files.php' ) . '
';
}
-add_action( 'admin_notices', 'ms_deprecated_blogs_file' );
-
-/**
- * Outputs the notice message for multisite regarding activation of plugin page.
- *
- * @since 3.0.0
- * @return none
- */
-function _admin_notice_multisite_activate_plugins_page() {
- $message = sprintf( __( 'The plugins page is not visible to normal users. It must be activated first. %s' ), '' . __( 'Activate' ) . ' ' );
- echo "";
-}
+add_action( 'network_admin_notices', 'ms_deprecated_blogs_file' );
/**
* Grants super admin privileges.
*
* @since 3.0.0
- * @param $user_id
+ * @param int $user_id
*/
function grant_super_admin( $user_id ) {
global $super_admins;
@@ -867,7 +698,7 @@ function grant_super_admin( $user_id ) {
* Revokes super admin privileges.
*
* @since 3.0.0
- * @param $user_id
+ * @param int $user_id
*/
function revoke_super_admin( $user_id ) {
global $super_admins;
@@ -892,4 +723,41 @@ function revoke_super_admin( $user_id ) {
}
return false;
}
+
+/**
+ * Whether or not we can edit this network from this page
+ *
+ * By default editing of network is restricted to the Network Admin for that site_id this allows for this to be overridden
+ *
+ * @since 3.1.0
+ * @param integer $site_id The network/site id to check.
+ */
+function can_edit_network( $site_id ) {
+ global $wpdb;
+
+ if ($site_id == $wpdb->siteid )
+ $result = true;
+ else
+ $result = false;
+
+ return apply_filters( 'can_edit_network', $result, $site_id );
+}
+
+/**
+ * Thickbox image paths for Network Admin.
+ *
+ * @since 3.1.0
+ * @access private
+ */
+function _thickbox_path_admin_subfolder() {
+?>
+
+
diff --git a/wp-admin/includes/nav-menu.php b/wp-admin/includes/nav-menu.php
index 8c8e9697..6e929286 100644
--- a/wp-admin/includes/nav-menu.php
+++ b/wp-admin/includes/nav-menu.php
@@ -13,7 +13,6 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
* @since 3.0.0
*
* @param string $output Passed by reference.
- * @param int $depth Depth of page.
*/
function start_lvl(&$output) {}
@@ -22,7 +21,6 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
* @since 3.0.0
*
* @param string $output Passed by reference.
- * @param int $depth Depth of page.
*/
function end_lvl(&$output) {
}
@@ -34,7 +32,6 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
* @param string $output Passed by reference. Used to append additional content.
* @param object $item Menu item data object.
* @param int $depth Depth of menu item. Used for padding.
- * @param int $current_page Menu item ID.
* @param object $args
*/
function start_el(&$output, $item, $depth, $args) {
@@ -164,7 +161,7 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
-
+
@@ -218,7 +215,6 @@ class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu {
* @param string $output Passed by reference. Used to append additional content.
* @param object $item Menu item data object.
* @param int $depth Depth of menu item. Used for padding.
- * @param int $current_page Menu item ID.
* @param object $args
*/
function start_el(&$output, $item, $depth, $args) {
@@ -249,7 +245,6 @@ class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu {
$output .= '';
$output .= '';
$output .= '';
- $output .= '';
$output .= '';
$output .= '';
}
@@ -499,7 +494,7 @@ function wp_nav_menu_locations_meta_box() {
?>
- class="button-primary" name="nav-menu-locations" value="" />
+
">
'post_date', 'order' => 'DESC', 'showposts' => 15 ) );
+ $recent_args = array_merge( $args, array( 'orderby' => 'post_date', 'order' => 'DESC', 'posts_per_page' => 15 ) );
$most_recent = $get_posts->query( $recent_args );
$args['walker'] = $walker;
echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $most_recent), 0, (object) $args );
@@ -673,9 +668,9 @@ function wp_nav_menu_item_post_type_meta_box( $object, $post_type ) {
}
?>
-
+
-
+
+ ?>
+
>
>
@@ -173,43 +129,10 @@ function install_search_form(){
-
+
'featured', 'page' => $page);
- $api = plugins_api('query_plugins', $args);
- if ( is_wp_error($api) )
- wp_die($api->get_error_message() . ' ' . __('Try again') . ' ');
- display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']);
-}
-
-add_action('install_plugins_popular', 'install_popular', 10, 1);
-/**
- * Display popular plugins.
- *
- * @since 2.7.0
- *
- * @param string $page
- */
-function install_popular($page = 1) {
- $args = array('browse' => 'popular', 'page' => $page);
- $api = plugins_api('query_plugins', $args);
- if ( is_wp_error($api) )
- wp_die($api->get_error_message() . '
' . __('Try again') . ' ');
- display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']);
-}
-
-add_action('install_plugins_upload', 'install_plugins_upload', 10, 1);
/**
* Upload from zip
* @since 2.8.0
@@ -220,7 +143,7 @@ function install_plugins_upload( $page = 1 ) {
?>
-
+
@@ -228,193 +151,23 @@ function install_plugins_upload( $page = 1 ) {
'new', 'page' => $page);
- $api = plugins_api('query_plugins', $args);
- if ( is_wp_error($api) )
- wp_die($api->get_error_message() . ' ' . __('Try again') . ' ');
- display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']);
-}
-add_action('install_plugins_updated', 'install_updated', 10, 1);
-
-
-/**
- * Display recently updated plugins.
- *
- * @since 2.7.0
- *
- * @param string $page
- */
-function install_updated($page = 1) {
- $args = array('browse' => 'updated', 'page' => $page);
- $api = plugins_api('query_plugins', $args);
- if ( is_wp_error($api) )
- wp_die($api->get_error_message() . '
' . __('Try again') . ' ');
- display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']);
-}
+add_action('install_plugins_upload', 'install_plugins_upload', 10, 1);
/**
* Display plugin content based on plugin list.
*
* @since 2.7.0
- *
- * @param array $plugins List of plugins.
- * @param string $page
- * @param int $totalpages Number of pages.
*/
-function display_plugins_table($plugins, $page = 1, $totalpages = 1){
- $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';
- $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';
+function display_plugins_table() {
+ global $wp_list_table;
- $plugins_allowedtags = array('a' => array('href' => array(),'title' => array(), 'target' => array()),
- 'abbr' => array('title' => array()),'acronym' => array('title' => array()),
- 'code' => array(), 'pre' => array(), 'em' => array(),'strong' => array(),
- 'ul' => array(), 'ol' => array(), 'li' => array(), 'p' => array(), 'br' => array());
-
-?>
-
-
-
-
- add_query_arg('paged', '%#%', $url),
- 'format' => '',
- 'prev_text' => __('«'),
- 'next_text' => __('»'),
- 'total' => $totalpages,
- 'current' => $page
- ));
-
- if ( $page_links )
- echo "\t\t
$page_links
";
-?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ', __('No plugins match your request.'), ' ';
-
- foreach ( (array) $plugins as $plugin ){
- if ( is_object($plugin) )
- $plugin = (array) $plugin;
-
- $title = wp_kses($plugin['name'], $plugins_allowedtags);
- //Limit description to 400char, and remove any HTML.
- $description = strip_tags($plugin['description']);
- if ( strlen($description) > 400 )
- $description = mb_substr($description, 0, 400) . '…';
- //remove any trailing entities
- $description = preg_replace('/&[^;\s]{0,6}$/', '', $description);
- //strip leading/trailing & multiple consecutive lines
- $description = trim($description);
- $description = preg_replace("|(\r?\n)+|", "\n", $description);
- //\n =>
- $description = nl2br($description);
- $version = wp_kses($plugin['version'], $plugins_allowedtags);
-
- $name = strip_tags($title . ' ' . $version);
-
- $author = $plugin['author'];
- if ( ! empty($plugin['author']) )
- $author = ' ' . sprintf( __('By %s'), $author ) . '. ';
-
- $author = wp_kses($author, $plugins_allowedtags);
-
- $action_links = array();
- $action_links[] = '' . __('Details') . ' ';
-
- if ( current_user_can('install_plugins') || current_user_can('update_plugins') ) {
- $status = install_plugin_install_status($plugin);
-
- switch ( $status['status'] ) {
- case 'install':
- if ( $status['url'] )
- $action_links[] = '' . __('Install Now') . ' ';
- break;
- case 'update_available':
- if ( $status['url'] )
- $action_links[] = '' . sprintf( __('Update Now'), $status['version'] ) . ' ';
- break;
- case 'latest_installed':
- case 'newer_installed':
- $action_links[] = '' . __('Installed') . ' ';
- break;
- }
- }
-
- $action_links = apply_filters( 'plugin_install_action_links', $action_links, $plugin );
- ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $page_links
"; ?>
-
-
-
-display();
}
-
-add_action('install_plugins_pre_plugin-information', 'install_plugin_information');
+add_action('install_plugins_search', 'display_plugins_table');
+add_action('install_plugins_featured', 'display_plugins_table');
+add_action('install_plugins_popular', 'display_plugins_table');
+add_action('install_plugins_new', 'display_plugins_table');
+add_action('install_plugins_updated', 'display_plugins_table');
/**
* Determine the status we can perform on a plugin.
@@ -439,7 +192,7 @@ function install_plugin_install_status($api, $loop = false) {
$update_file = $file;
$version = $plugin->new_version;
if ( current_user_can('update_plugins') )
- $url = wp_nonce_url(admin_url('update.php?action=upgrade-plugin&plugin=' . $update_file), 'upgrade-plugin_' . $update_file);
+ $url = wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=' . $update_file), 'upgrade-plugin_' . $update_file);
break;
}
}
@@ -450,7 +203,7 @@ function install_plugin_install_status($api, $loop = false) {
$installed_plugin = get_plugins('/' . $api->slug);
if ( empty($installed_plugin) ) {
if ( current_user_can('install_plugins') )
- $url = wp_nonce_url(admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug);
+ $url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug);
} else {
$key = array_shift( $key = array_keys($installed_plugin) ); //Use the first plugin regardless of the name, Could have issues for multiple-plugins in one directory if they share different version numbers
if ( version_compare($api->version, $installed_plugin[ $key ]['Version'], '=') ){
@@ -470,7 +223,7 @@ function install_plugin_install_status($api, $loop = false) {
} else {
// "install" & no directory with that slug
if ( current_user_can('install_plugins') )
- $url = wp_nonce_url(admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug);
+ $url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug);
}
}
if ( isset($_GET['from']) )
@@ -613,3 +366,5 @@ function install_plugin_information() {
iframe_footer();
exit;
}
+add_action('install_plugins_pre_plugin-information', 'install_plugin_information');
+
diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php
index 98ee2a1b..d10c450b 100644
--- a/wp-admin/includes/plugin.php
+++ b/wp-admin/includes/plugin.php
@@ -100,13 +100,15 @@ function get_plugin_data( $plugin_file, $markup = true, $translate = true ) {
if ( $markup || $translate )
$plugin_data = _get_plugin_data_markup_translate( $plugin_file, $plugin_data, $markup, $translate );
+ else
+ $plugin_data['AuthorName'] = $plugin_data['Author'];
return $plugin_data;
}
function _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup = true, $translate = true) {
- //Translate fields30
+ //Translate fields
if ( $translate && ! empty($plugin_data['TextDomain']) ) {
if ( ! empty( $plugin_data['DomainPath'] ) )
load_plugin_textdomain($plugin_data['TextDomain'], false, dirname($plugin_file). $plugin_data['DomainPath']);
@@ -117,28 +119,37 @@ function _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup =
$plugin_data[ $field ] = translate($plugin_data[ $field ], $plugin_data['TextDomain']);
}
+ $plugins_allowedtags = array(
+ 'a' => array( 'href' => array(), 'title' => array() ),
+ 'abbr' => array( 'title' => array() ),
+ 'acronym' => array( 'title' => array() ),
+ 'code' => array(),
+ 'em' => array(),
+ 'strong' => array(),
+ );
+
+ $plugin_data['AuthorName'] = $plugin_data['Author'] = wp_kses( $plugin_data['Author'], $plugins_allowedtags );
+
//Apply Markup
if ( $markup ) {
if ( ! empty($plugin_data['PluginURI']) && ! empty($plugin_data['Name']) )
- $plugin_data['Title'] = '' . $plugin_data['Name'] . ' ';
+ $plugin_data['Title'] = '' . $plugin_data['Name'] . ' ';
else
$plugin_data['Title'] = $plugin_data['Name'];
if ( ! empty($plugin_data['AuthorURI']) && ! empty($plugin_data['Author']) )
- $plugin_data['Author'] = '' . $plugin_data['Author'] . ' ';
+ $plugin_data['Author'] = '' . $plugin_data['Author'] . ' ';
$plugin_data['Description'] = wptexturize( $plugin_data['Description'] );
if ( ! empty($plugin_data['Author']) )
$plugin_data['Description'] .= ' ' . sprintf( __('By %s'), $plugin_data['Author'] ) . '. ';
}
- $plugins_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array());
-
- // Sanitize all displayed data
- $plugin_data['Title'] = wp_kses($plugin_data['Title'], $plugins_allowedtags);
- $plugin_data['Version'] = wp_kses($plugin_data['Version'], $plugins_allowedtags);
- $plugin_data['Description'] = wp_kses($plugin_data['Description'], $plugins_allowedtags);
- $plugin_data['Author'] = wp_kses($plugin_data['Author'], $plugins_allowedtags);
+ // Sanitize all displayed data. Author and AuthorName sanitized above.
+ $plugin_data['Title'] = wp_kses( $plugin_data['Title'], $plugins_allowedtags );
+ $plugin_data['Version'] = wp_kses( $plugin_data['Version'], $plugins_allowedtags );
+ $plugin_data['Description'] = wp_kses( $plugin_data['Description'], $plugins_allowedtags );
+ $plugin_data['Name'] = wp_kses( $plugin_data['Name'], $plugins_allowedtags );
return $plugin_data;
}
@@ -198,7 +209,7 @@ function get_plugin_files($plugin) {
* be split for maintainability. Keep everything in one file for extreme
* optimization purposes.
*
- * @since unknown
+ * @since 1.5.0
*
* @param string $plugin_folder Optional. Relative path to single plugin folder.
* @return array Key is the plugin file path and the value is an array of the plugin data.
@@ -260,7 +271,7 @@ function get_plugins($plugin_folder = '') {
$wp_plugins[plugin_basename( $plugin_file )] = $plugin_data;
}
- uasort( $wp_plugins, create_function( '$a, $b', 'return strnatcasecmp( $a["Name"], $b["Name"] );' ));
+ uasort( $wp_plugins, '_sort_uname_callback' );
$cache_plugins[ $plugin_folder ] = $wp_plugins;
wp_cache_set('plugins', $cache_plugins, 'plugins');
@@ -312,11 +323,21 @@ function get_mu_plugins() {
if ( isset( $wp_plugins['index.php'] ) && filesize( WPMU_PLUGIN_DIR . '/index.php') <= 30 ) // silence is golden
unset( $wp_plugins['index.php'] );
- uasort( $wp_plugins, create_function( '$a, $b', 'return strnatcasecmp( $a["Name"], $b["Name"] );' ));
+ uasort( $wp_plugins, '_sort_uname_callback' );
return $wp_plugins;
}
+/**
+ * Callback to sort array by a 'Name' key.
+ *
+ * @since 3.1.0
+ * @access private
+ */
+function _sort_uname_callback( $a, $b ) {
+ return strnatcasecmp( $a['Name'], $b['Name'] );
+}
+
/**
* Check the wp-content directory and retrieve all drop-ins with any plugin data.
*
@@ -353,7 +374,7 @@ function get_dropins() {
$dropins[ $plugin_file ] = $plugin_data;
}
- uksort( $dropins, create_function( '$a, $b', 'return strnatcasecmp( $a, $b );' ));
+ uksort( $dropins, 'strnatcasecmp' );
return $dropins;
}
@@ -400,6 +421,21 @@ function is_plugin_active( $plugin ) {
return in_array( $plugin, (array) get_option( 'active_plugins', array() ) ) || is_plugin_active_for_network( $plugin );
}
+/**
+ * Check whether the plugin is inactive.
+ *
+ * Reverse of is_plugin_active(). Used as a callback.
+ *
+ * @since 3.1.0
+ * @see is_plugin_active()
+ *
+ * @param string $plugin Base plugin path from plugins directory.
+ * @return bool True if inactive. False if active.
+ */
+function is_plugin_inactive( $plugin ) {
+ return ! is_plugin_active( $plugin );
+}
+
/**
* Check whether the plugin is active for the entire network.
*
@@ -428,8 +464,8 @@ function is_plugin_active_for_network( $plugin ) {
*
* @since 3.0.0
*
- * @param $file Plugin to check
- * $return bool True if plugin is network only, false otherwise.
+ * @param string $plugin Plugin to check
+ * @return bool True if plugin is network only, false otherwise.
*/
function is_network_only_plugin( $plugin ) {
$plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
@@ -456,15 +492,17 @@ function is_network_only_plugin( $plugin ) {
* If any errors are found or text is outputted, then it will be captured to
* ensure that the success redirection will update the error redirection.
*
- * @since unknown
+ * @since 2.5.0
*
* @param string $plugin Plugin path to main plugin file with plugin data.
* @param string $redirect Optional. URL to redirect to.
- * @param bool $network_wide Whether to enable the plugin for all sites in the network or just the current site. Multisite only. Default is false.
+ * @param bool $network_wide Whether to enable the plugin for all sites in the
+ * network or just the current site. Multisite only. Default is false.
+ * @param bool $silent Prevent calling activation hooks. Optional, default is false.
* @return WP_Error|null WP_Error on invalid file or null on success.
*/
-function activate_plugin( $plugin, $redirect = '', $network_wide = false) {
- $plugin = plugin_basename( trim( $plugin ) );
+function activate_plugin( $plugin, $redirect = '', $network_wide = false, $silent = false ) {
+ $plugin = plugin_basename( trim( $plugin ) );
if ( is_multisite() && ( $network_wide || is_network_only_plugin($plugin) ) ) {
$network_wide = true;
@@ -481,9 +519,13 @@ function activate_plugin( $plugin, $redirect = '', $network_wide = false) {
if ( !empty($redirect) )
wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); // we'll override this later if the plugin can be included without fatal error
ob_start();
- include(WP_PLUGIN_DIR . '/' . $plugin);
- do_action( 'activate_plugin', trim( $plugin) );
- do_action( 'activate_' . trim( $plugin ) );
+ include_once(WP_PLUGIN_DIR . '/' . $plugin);
+
+ if ( ! $silent ) {
+ do_action( 'activate_plugin', $plugin, $network_wide );
+ do_action( 'activate_' . $plugin, $network_wide );
+ }
+
if ( $network_wide ) {
$current[$plugin] = time();
update_site_option( 'active_sitewide_plugins', $current );
@@ -492,7 +534,11 @@ function activate_plugin( $plugin, $redirect = '', $network_wide = false) {
sort($current);
update_option('active_plugins', $current);
}
- do_action( 'activated_plugin', trim( $plugin) );
+
+ if ( ! $silent ) {
+ do_action( 'activated_plugin', $plugin, $network_wide );
+ }
+
if ( ob_get_length() > 0 ) {
$output = ob_get_clean();
return new WP_Error('unexpected_output', __('The plugin generated unexpected output.'), $output);
@@ -509,40 +555,41 @@ function activate_plugin( $plugin, $redirect = '', $network_wide = false) {
* The deactivation hook is disabled by the plugin upgrader by using the $silent
* parameter.
*
- * @since unknown
+ * @since 2.5.0
*
* @param string|array $plugins Single plugin or list of plugins to deactivate.
- * @param bool $silent Optional, default is false. Prevent calling deactivate hook.
+ * @param bool $silent Prevent calling deactivation hooks. Default is false.
*/
function deactivate_plugins( $plugins, $silent = false ) {
- $network_current = get_site_option( 'active_sitewide_plugins', array() );
+ if ( is_multisite() )
+ $network_current = get_site_option( 'active_sitewide_plugins', array() );
$current = get_option( 'active_plugins', array() );
$do_blog = $do_network = false;
foreach ( (array) $plugins as $plugin ) {
- $plugin = plugin_basename($plugin);
+ $plugin = plugin_basename( trim( $plugin ) );
if ( ! is_plugin_active($plugin) )
continue;
+
+ $network_wide = is_plugin_active_for_network( $plugin );
+
if ( ! $silent )
- do_action( 'deactivate_plugin', trim( $plugin ) );
+ do_action( 'deactivate_plugin', $plugin, $network_wide );
- if ( is_plugin_active_for_network($plugin) ) {
- // Deactivate network wide
+ if ( $network_wide ) {
$do_network = true;
unset( $network_current[ $plugin ] );
} else {
- // Deactivate for this blog only
- $key = array_search( $plugin, (array) $current );
+ $key = array_search( $plugin, $current );
if ( false !== $key ) {
$do_blog = true;
array_splice( $current, $key, 1 );
}
}
- //Used by Plugin updater to internally deactivate plugin, however, not to notify plugins of the fact to prevent plugin output.
if ( ! $silent ) {
- do_action( 'deactivate_' . trim( $plugin ) );
- do_action( 'deactivated_plugin', trim( $plugin ) );
+ do_action( 'deactivate_' . $plugin, $network_wide );
+ do_action( 'deactivated_plugin', $plugin, $network_wide );
}
}
@@ -560,22 +607,23 @@ function deactivate_plugins( $plugins, $silent = false ) {
*
* The execution will be halted as soon as one of the plugins has an error.
*
- * @since unknown
+ * @since 2.6.0
*
* @param string|array $plugins
* @param string $redirect Redirect to page after successful activation.
* @param bool $network_wide Whether to enable the plugin for all sites in the network.
+ * @param bool $silent Prevent calling activation hooks. Default is false.
* @return bool|WP_Error True when finished or WP_Error if there were errors during a plugin activation.
*/
-function activate_plugins($plugins, $redirect = '', $network_wide) {
+function activate_plugins( $plugins, $redirect = '', $network_wide = false, $silent = false ) {
if ( !is_array($plugins) )
$plugins = array($plugins);
$errors = array();
- foreach ( (array) $plugins as $plugin ) {
+ foreach ( $plugins as $plugin ) {
if ( !empty($redirect) )
$redirect = add_query_arg('plugin', $plugin, $redirect);
- $result = activate_plugin($plugin, $redirect, $network_wide);
+ $result = activate_plugin($plugin, $redirect, $network_wide, $silent);
if ( is_wp_error($result) )
$errors[$plugin] = $result;
}
@@ -592,7 +640,7 @@ function activate_plugins($plugins, $redirect = '', $network_wide) {
* If the plugins parameter list is empty, false will be returned. True when
* completed.
*
- * @since unknown
+ * @since 2.6.0
*
* @param array $plugins List of plugin
* @param string $redirect Redirect to page when complete.
@@ -609,7 +657,7 @@ function delete_plugins($plugins, $redirect = '' ) {
$checked[] = 'checked[]=' . $plugin;
ob_start();
- $url = wp_nonce_url('plugins.php?action=delete-selected&verify-delete=1&' . implode('&', $checked), 'bulk-manage-plugins');
+ $url = wp_nonce_url('plugins.php?action=delete-selected&verify-delete=1&' . implode('&', $checked), 'bulk-plugins');
if ( false === ($credentials = request_filesystem_credentials($url)) ) {
$data = ob_get_contents();
ob_end_clean();
@@ -684,7 +732,7 @@ function delete_plugins($plugins, $redirect = '' ) {
* Validate all active plugins, deactivates invalid and
* returns an array of deactivated ones.
*
- * @since unknown
+ * @since 2.5.0
* @return array invalid plugins, plugin as key, error as value
*/
function validate_active_plugins() {
@@ -721,7 +769,7 @@ function validate_active_plugins() {
*
* Checks that the file exists and {@link validate_file() is valid file}.
*
- * @since unknown
+ * @since 2.5.0
*
* @param string $plugin Plugin Path
* @return WP_Error|int 0 on success, WP_Error on failure.
@@ -815,6 +863,8 @@ function uninstall_plugin($plugin) {
* @param callback $function The function to be called to output the content for this page.
* @param string $icon_url The url to the icon to be used for this menu
* @param int $position The position in the menu order this one should appear
+ *
+ * @return string The resulting page's hook_suffix
*/
function add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '', $position = NULL ) {
global $menu, $admin_page_hooks, $_registered_pages, $_parent_pages;
@@ -863,6 +913,8 @@ function add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $func
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
* @param callback $function The function to be called to output the content for this page.
* @param string $icon_url The url to the icon to be used for this menu
+ *
+ * @return string The resulting page's hook_suffix
*/
function add_object_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '') {
global $_wp_last_object_menu;
@@ -887,6 +939,8 @@ function add_object_page( $page_title, $menu_title, $capability, $menu_slug, $fu
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
* @param callback $function The function to be called to output the content for this page.
* @param string $icon_url The url to the icon to be used for this menu
+ *
+ * @return string The resulting page's hook_suffix
*/
function add_utility_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '') {
global $_wp_last_utility_menu;
@@ -911,6 +965,8 @@ function add_utility_page( $page_title, $menu_title, $capability, $menu_slug, $f
* @param string $capability The capability required for this menu to be displayed to the user.
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
* @param callback $function The function to be called to output the content for this page.
+ *
+ * @return string The resulting page's hook_suffix
*/
function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
global $submenu;
@@ -961,7 +1017,7 @@ function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability,
/**
* Add sub menu page to the tools main menu.
-*
+ *
* This function takes a capability which will be used to determine whether
* or not a page is included in the menu.
*
@@ -973,6 +1029,8 @@ function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability,
* @param string $capability The capability required for this menu to be displayed to the user.
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
* @param callback $function The function to be called to output the content for this page.
+ *
+ * @return string The resulting page's hook_suffix
*/
function add_management_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
return add_submenu_page( 'tools.php', $page_title, $menu_title, $capability, $menu_slug, $function );
@@ -980,7 +1038,7 @@ function add_management_page( $page_title, $menu_title, $capability, $menu_slug,
/**
* Add sub menu page to the options main menu.
-*
+ *
* This function takes a capability which will be used to determine whether
* or not a page is included in the menu.
*
@@ -992,6 +1050,8 @@ function add_management_page( $page_title, $menu_title, $capability, $menu_slug,
* @param string $capability The capability required for this menu to be displayed to the user.
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
* @param callback $function The function to be called to output the content for this page.
+ *
+ * @return string The resulting page's hook_suffix
*/
function add_options_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
return add_submenu_page( 'options-general.php', $page_title, $menu_title, $capability, $menu_slug, $function );
@@ -999,7 +1059,7 @@ function add_options_page( $page_title, $menu_title, $capability, $menu_slug, $f
/**
* Add sub menu page to the themes main menu.
-*
+ *
* This function takes a capability which will be used to determine whether
* or not a page is included in the menu.
*
@@ -1011,6 +1071,8 @@ function add_options_page( $page_title, $menu_title, $capability, $menu_slug, $f
* @param string $capability The capability required for this menu to be displayed to the user.
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
* @param callback $function The function to be called to output the content for this page.
+ *
+ * @return string The resulting page's hook_suffix
*/
function add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
return add_submenu_page( 'themes.php', $page_title, $menu_title, $capability, $menu_slug, $function );
@@ -1018,7 +1080,7 @@ function add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $fun
/**
* Add sub menu page to the plugins main menu.
-*
+ *
* This function takes a capability which will be used to determine whether
* or not a page is included in the menu.
*
@@ -1030,6 +1092,8 @@ function add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $fun
* @param string $capability The capability required for this menu to be displayed to the user.
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
* @param callback $function The function to be called to output the content for this page.
+ *
+ * @return string The resulting page's hook_suffix
*/
function add_plugins_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
return add_submenu_page( 'plugins.php', $page_title, $menu_title, $capability, $menu_slug, $function );
@@ -1037,7 +1101,7 @@ function add_plugins_page( $page_title, $menu_title, $capability, $menu_slug, $f
/**
* Add sub menu page to the Users/Profile main menu.
-*
+ *
* This function takes a capability which will be used to determine whether
* or not a page is included in the menu.
*
@@ -1049,6 +1113,8 @@ function add_plugins_page( $page_title, $menu_title, $capability, $menu_slug, $f
* @param string $capability The capability required for this menu to be displayed to the user.
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
* @param callback $function The function to be called to output the content for this page.
+ *
+ * @return string The resulting page's hook_suffix
*/
function add_users_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
if ( current_user_can('edit_users') )
@@ -1059,7 +1125,7 @@ function add_users_page( $page_title, $menu_title, $capability, $menu_slug, $fun
}
/**
* Add sub menu page to the Dashboard main menu.
-*
+ *
* This function takes a capability which will be used to determine whether
* or not a page is included in the menu.
*
@@ -1071,6 +1137,8 @@ function add_users_page( $page_title, $menu_title, $capability, $menu_slug, $fun
* @param string $capability The capability required for this menu to be displayed to the user.
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
* @param callback $function The function to be called to output the content for this page.
+ *
+ * @return string The resulting page's hook_suffix
*/
function add_dashboard_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
return add_submenu_page( 'index.php', $page_title, $menu_title, $capability, $menu_slug, $function );
@@ -1078,7 +1146,7 @@ function add_dashboard_page( $page_title, $menu_title, $capability, $menu_slug,
/**
* Add sub menu page to the posts main menu.
-*
+ *
* This function takes a capability which will be used to determine whether
* or not a page is included in the menu.
*
@@ -1090,6 +1158,8 @@ function add_dashboard_page( $page_title, $menu_title, $capability, $menu_slug,
* @param string $capability The capability required for this menu to be displayed to the user.
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
* @param callback $function The function to be called to output the content for this page.
+ *
+ * @return string The resulting page's hook_suffix
*/
function add_posts_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
return add_submenu_page( 'edit.php', $page_title, $menu_title, $capability, $menu_slug, $function );
@@ -1097,7 +1167,7 @@ function add_posts_page( $page_title, $menu_title, $capability, $menu_slug, $fun
/**
* Add sub menu page to the media main menu.
-*
+ *
* This function takes a capability which will be used to determine whether
* or not a page is included in the menu.
*
@@ -1109,6 +1179,8 @@ function add_posts_page( $page_title, $menu_title, $capability, $menu_slug, $fun
* @param string $capability The capability required for this menu to be displayed to the user.
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
* @param callback $function The function to be called to output the content for this page.
+ *
+ * @return string The resulting page's hook_suffix
*/
function add_media_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
return add_submenu_page( 'upload.php', $page_title, $menu_title, $capability, $menu_slug, $function );
@@ -1116,7 +1188,7 @@ function add_media_page( $page_title, $menu_title, $capability, $menu_slug, $fun
/**
* Add sub menu page to the links main menu.
-*
+ *
* This function takes a capability which will be used to determine whether
* or not a page is included in the menu.
*
@@ -1128,6 +1200,8 @@ function add_media_page( $page_title, $menu_title, $capability, $menu_slug, $fun
* @param string $capability The capability required for this menu to be displayed to the user.
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
* @param callback $function The function to be called to output the content for this page.
+ *
+ * @return string The resulting page's hook_suffix
*/
function add_links_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
return add_submenu_page( 'link-manager.php', $page_title, $menu_title, $capability, $menu_slug, $function );
@@ -1135,7 +1209,7 @@ function add_links_page( $page_title, $menu_title, $capability, $menu_slug, $fun
/**
* Add sub menu page to the pages main menu.
-*
+ *
* This function takes a capability which will be used to determine whether
* or not a page is included in the menu.
*
@@ -1147,14 +1221,16 @@ function add_links_page( $page_title, $menu_title, $capability, $menu_slug, $fun
* @param string $capability The capability required for this menu to be displayed to the user.
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
* @param callback $function The function to be called to output the content for this page.
- */
+ *
+ * @return string The resulting page's hook_suffix
+*/
function add_pages_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
return add_submenu_page( 'edit.php?post_type=page', $page_title, $menu_title, $capability, $menu_slug, $function );
}
/**
* Add sub menu page to the comments main menu.
-*
+ *
* This function takes a capability which will be used to determine whether
* or not a page is included in the menu.
*
@@ -1166,11 +1242,60 @@ function add_pages_page( $page_title, $menu_title, $capability, $menu_slug, $fun
* @param string $capability The capability required for this menu to be displayed to the user.
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
* @param callback $function The function to be called to output the content for this page.
- */
+ *
+ * @return string The resulting page's hook_suffix
+*/
function add_comments_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
return add_submenu_page( 'edit-comments.php', $page_title, $menu_title, $capability, $menu_slug, $function );
}
+
+/**
+ * Remove a top level admin menu
+ *
+ * @since 3.1.0
+ *
+ * @param string $menu_slug The slug of the menu
+ * @return array|bool The removed menu on success, False if not found
+ */
+function remove_menu_page( $menu_slug ) {
+ global $menu;
+
+ foreach ( $menu as $i => $item ) {
+ if ( $menu_slug == $item[2] ) {
+ unset( $menu[$i] );
+ return $item;
+ }
+ }
+
+ return false;
+}
+
+/**
+ * Remove an admin submenu
+ *
+ * @since 3.1.0
+ *
+ * @param string $menu_slug The slug for the parent menu
+ * @param string $submenu_slug The slug of the submenu
+ * @return array|bool The removed submenu on success, False if not found
+ */
+function remove_submenu_page( $menu_slug, $submenu_slug ) {
+ global $submenu;
+
+ if ( !isset( $submenu[$menu_slug] ) )
+ return false;
+
+ foreach ( $submenu[$menu_slug] as $i => $item ) {
+ if ( $submenu_slug == $item[2] ) {
+ unset( $submenu[$menu_slug][$i] );
+ return $item;
+ }
+ }
+
+ return false;
+}
+
/**
* Get the url to access a particular menu page based on the slug it was registered with.
*
@@ -1186,10 +1311,11 @@ function menu_page_url($menu_slug, $echo = true) {
global $_parent_pages;
if ( isset( $_parent_pages[$menu_slug] ) ) {
- if ( $_parent_pages[$menu_slug] ) {
- $url = admin_url( add_query_arg( 'page', $menu_slug, $_parent_pages[$menu_slug] ) );
+ $parent_slug = $_parent_pages[$menu_slug];
+ if ( $parent_slug && ! isset( $_parent_pages[$parent_slug] ) ) {
+ $url = admin_url( add_query_arg( 'page', $menu_slug, $parent_slug ) );
} else {
- $url = admin_url('admin.php?page=' . $menu_slug);
+ $url = admin_url( 'admin.php?page=' . $menu_slug );
}
} else {
$url = '';
@@ -1513,7 +1639,7 @@ function unregister_setting( $option_group, $option_name, $sanitize_callback = '
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.7.0
*
* @param unknown_type $options
* @return unknown
@@ -1531,7 +1657,7 @@ add_filter( 'whitelist_options', 'option_update_filter' );
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.7.0
*
* @param unknown_type $new_options
* @param unknown_type $options
@@ -1562,7 +1688,7 @@ function add_option_whitelist( $new_options, $options = '' ) {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.7.0
*
* @param unknown_type $del_options
* @param unknown_type $options
diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php
index 040cd6ca..12cbaa0f 100644
--- a/wp-admin/includes/post.php
+++ b/wp-admin/includes/post.php
@@ -15,7 +15,7 @@
* @since 2.6.0
*
* @param bool $update Are we updating a pre-existing post?
- * @param post_data array Array of post data. Defaults to the contents of $_POST.
+ * @param array $post_data Array of post data. Defaults to the contents of $_POST.
* @return object|bool WP_Error on failure, true on success.
*/
function _wp_translate_postdata( $update = false, $post_data = null ) {
@@ -125,7 +125,7 @@ function _wp_translate_postdata( $update = false, $post_data = null ) {
/**
* Update an existing post with values provided in $_POST.
*
- * @since unknown
+ * @since 1.5.0
*
* @param array $post_data Optional.
* @return int Post ID.
@@ -136,6 +136,8 @@ function edit_post( $post_data = null ) {
$post_data = &$_POST;
$post_ID = (int) $post_data['post_ID'];
+ $post = get_post( $post_ID );
+ $post_data['post_type'] = $post->post_type;
$ptype = get_post_type_object($post_data['post_type']);
if ( !current_user_can( $ptype->cap->edit_post, $post_ID ) ) {
@@ -156,10 +158,10 @@ function edit_post( $post_data = null ) {
}
$post_data = _wp_translate_postdata( true, $post_data );
- if ( 'autosave' != $post_data['action'] && 'auto-draft' == $post_data['post_status'] )
- $post_data['post_status'] = 'draft';
if ( is_wp_error($post_data) )
wp_die( $post_data->get_error_message() );
+ if ( 'autosave' != $post_data['action'] && 'auto-draft' == $post_data['post_status'] )
+ $post_data['post_status'] = 'draft';
if ( isset($post_data['visibility']) ) {
switch ( $post_data['visibility'] ) {
@@ -177,15 +179,38 @@ function edit_post( $post_data = null ) {
}
}
+ // Post Formats
+ if ( current_theme_supports( 'post-formats' ) && isset( $post_data['post_format'] ) ) {
+ $formats = get_theme_support( 'post-formats' );
+ if ( is_array( $formats ) ) {
+ $formats = $formats[0];
+ if ( in_array( $post_data['post_format'], $formats ) ) {
+ set_post_format( $post_ID, $post_data['post_format'] );
+ } elseif ( '0' == $post_data['post_format'] ) {
+ set_post_format( $post_ID, false );
+ }
+ }
+ }
+
// Meta Stuff
if ( isset($post_data['meta']) && $post_data['meta'] ) {
- foreach ( $post_data['meta'] as $key => $value )
+ foreach ( $post_data['meta'] as $key => $value ) {
+ if ( !$meta = get_post_meta_by_id( $key ) )
+ continue;
+ if ( $meta->post_id != $post_ID )
+ continue;
update_meta( $key, $value['key'], $value['value'] );
+ }
}
if ( isset($post_data['deletemeta']) && $post_data['deletemeta'] ) {
- foreach ( $post_data['deletemeta'] as $key => $value )
+ foreach ( $post_data['deletemeta'] as $key => $value ) {
+ if ( !$meta = get_post_meta_by_id( $key ) )
+ continue;
+ if ( $meta->post_id != $post_ID )
+ continue;
delete_meta( $key );
+ }
}
add_meta( $post_ID );
@@ -205,11 +230,11 @@ function edit_post( $post_data = null ) {
wp_set_post_lock( $post_ID, $GLOBALS['current_user']->ID );
- if ( current_user_can( 'edit_others_posts' ) ) {
- if ( !empty($post_data['sticky']) )
- stick_post($post_ID);
+ if ( current_user_can( $ptype->cap->edit_others_posts ) ) {
+ if ( ! empty( $post_data['sticky'] ) )
+ stick_post( $post_ID );
else
- unstick_post($post_ID);
+ unstick_post( $post_ID );
}
return $post_ID;
@@ -336,7 +361,7 @@ function bulk_edit_posts( $post_data = null ) {
$post_data['ID'] = $post_ID;
$updated[] = wp_update_post( $post_data );
- if ( isset( $post_data['sticky'] ) && current_user_can( 'edit_others_posts' ) ) {
+ if ( isset( $post_data['sticky'] ) && current_user_can( $ptype->cap->edit_others_posts ) ) {
if ( 'sticky' == $post_data['sticky'] )
stick_post( $post_ID );
else
@@ -351,9 +376,9 @@ function bulk_edit_posts( $post_data = null ) {
/**
* Default post information to use when populating the "Write Post" form.
*
- * @since unknown
+ * @since 2.0.0
*
- *@param string A post type string, defaults to 'post'.
+ * @param string $post_type A post type string, defaults to 'post'.
* @return object stdClass object containing all the default post data as attributes
*/
function get_default_post_to_edit( $post_type = 'post', $create_in_db = false ) {
@@ -378,6 +403,8 @@ function get_default_post_to_edit( $post_type = 'post', $create_in_db = false )
wp_delete_post( $delete, true ); // Force delete
$post_id = wp_insert_post( array( 'post_title' => __( 'Auto Draft' ), 'post_type' => $post_type, 'post_status' => 'auto-draft' ) );
$post = get_post( $post_id );
+ if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) && get_option( 'default_post_format' ) )
+ set_post_format( $post, get_option( 'default_post_format' ) );
} else {
$post->ID = 0;
$post->post_author = '';
@@ -421,7 +448,7 @@ function get_default_page_to_edit() {
/**
* Get an existing post and format it for editing.
*
- * @since unknown
+ * @since 2.0.0
*
* @param unknown_type $id
* @return unknown
@@ -439,7 +466,7 @@ function get_post_to_edit( $id ) {
/**
* Determine if a post exists based on title, content, and date
*
- * @since unknown
+ * @since 2.0.0
*
* @param string $title Post title
* @param string $content Optional post content
@@ -480,7 +507,7 @@ function post_exists($title, $content = '', $date = '') {
/**
* Creates a new post from the "Write Post" form using $_POST information.
*
- * @since unknown
+ * @since 2.1.0
*
* @return unknown
*/
@@ -577,7 +604,7 @@ function wp_write_post() {
/**
* Calls wp_write_post() and handles the errors.
*
- * @since unknown
+ * @since 2.0.0
*
* @return unknown
*/
@@ -596,7 +623,7 @@ function write_post() {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 1.2.0
*
* @param unknown_type $post_ID
* @return unknown
@@ -628,9 +655,10 @@ function add_meta( $post_ID ) {
wp_cache_delete($post_ID, 'post_meta');
$wpdb->insert( $wpdb->postmeta, array( 'post_id' => $post_ID, 'meta_key' => $metakey, 'meta_value' => $metavalue ) );
- do_action( 'added_postmeta', $wpdb->insert_id, $post_ID, $metakey, $metavalue );
+ $meta_id = $wpdb->insert_id;
+ do_action( 'added_postmeta', $meta_id, $post_ID, $metakey, $metavalue );
- return $wpdb->insert_id;
+ return $meta_id;
}
return false;
} // add_meta
@@ -638,7 +666,7 @@ function add_meta( $post_ID ) {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 1.2.0
*
* @param unknown_type $mid
* @return unknown
@@ -660,7 +688,7 @@ function delete_meta( $mid ) {
/**
* Get a list of previously defined keys.
*
- * @since unknown
+ * @since 1.2.0
*
* @return unknown
*/
@@ -679,7 +707,7 @@ function get_meta_keys() {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.1.0
*
* @param unknown_type $mid
* @return unknown
@@ -701,7 +729,7 @@ function get_post_meta_by_id( $mid ) {
*
* Some postmeta stuff.
*
- * @since unknown
+ * @since 1.2.0
*
* @param unknown_type $postid
* @return unknown
@@ -718,7 +746,7 @@ function has_meta( $postid ) {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 1.2.0
*
* @param unknown_type $meta_id
* @param unknown_type $meta_key Expect Slashed
@@ -761,7 +789,7 @@ function update_meta( $meta_id, $meta_key, $meta_value ) {
/**
* Replace hrefs of attachment anchors with up-to-date permalinks.
*
- * @since unknown
+ * @since 2.3.0
* @access private
*
* @param unknown_type $post_ID
@@ -817,7 +845,7 @@ function _fix_attachment_links_replace_cb($match) {
/**
* Move child posts to a new parent.
*
- * @since unknown
+ * @since 2.3.0
* @access private
*
* @param unknown_type $old_ID
@@ -882,16 +910,15 @@ function wp_edit_posts_query( $q = false ) {
$perm = 'readable';
}
- if ( isset($q['post_status']) && 'pending' === $q['post_status'] ) {
- $order = 'ASC';
- $orderby = 'modified';
- } elseif ( isset($q['post_status']) && 'draft' === $q['post_status'] ) {
- $order = 'DESC';
+ if ( isset($q['orderby']) )
+ $orderby = $q['orderby'];
+ elseif ( isset($q['post_status']) && in_array($q['post_status'], array('pending', 'draft')) )
$orderby = 'modified';
- } else {
- $order = 'DESC';
- $orderby = 'date';
- }
+
+ if ( isset($q['order']) )
+ $order = $q['order'];
+ elseif ( isset($q['post_status']) && 'pending' == $q['post_status'] )
+ $order = 'ASC';
$per_page = 'edit_' . $post_type . '_per_page';
$posts_per_page = (int) get_user_option( $per_page );
@@ -904,13 +931,16 @@ function wp_edit_posts_query( $q = false ) {
$query = compact('post_type', 'post_status', 'perm', 'order', 'orderby', 'posts_per_page');
// Hierarchical types require special args.
- if ( is_post_type_hierarchical( $post_type ) ) {
+ if ( is_post_type_hierarchical( $post_type ) && !isset($orderby) ) {
$query['orderby'] = 'menu_order title';
$query['order'] = 'asc';
$query['posts_per_page'] = -1;
$query['posts_per_archive_page'] = -1;
}
+ if ( ! empty( $q['show_sticky'] ) )
+ $query['post__in'] = (array) get_option( 'sticky_posts' );
+
wp( $query );
return $avail_post_stati;
@@ -936,7 +966,7 @@ function get_post_mime_types() {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.5.0
*
* @param unknown_type $type
* @return unknown
@@ -951,7 +981,7 @@ function get_available_post_mime_types($type = 'attachment') {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.5.0
*
* @param unknown_type $q
* @return unknown
@@ -975,16 +1005,26 @@ function wp_edit_attachments_query( $q = false ) {
if ( isset($q['post_mime_type']) && !array_intersect( (array) $q['post_mime_type'], array_keys($post_mime_types) ) )
unset($q['post_mime_type']);
- wp($q);
+ if ( isset($q['detached']) )
+ add_filter('posts_where', '_edit_attachments_query_helper');
+
+ wp( $q );
+
+ if ( isset($q['detached']) )
+ remove_filter('posts_where', '_edit_attachments_query_helper');
return array($post_mime_types, $avail_post_mime_types);
}
+function _edit_attachments_query_helper($where) {
+ return $where .= ' AND post_parent < 1';
+}
+
/**
* {@internal Missing Short Description}}
*
* @uses get_user_option()
- * @since unknown
+ * @since 2.5.0
*
* @param unknown_type $id
* @param unknown_type $page
@@ -1007,7 +1047,7 @@ function postbox_classes( $id, $page ) {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.5.0
*
* @param int|object $id Post ID or post object.
* @param string $title (optional) Title
@@ -1054,7 +1094,7 @@ function get_sample_permalink($id, $title = null, $name = null) {
$uri = untrailingslashit($uri);
if ( !empty($uri) )
$uri .= '/';
- $permalink = str_replace('%pagename%', "${uri}%pagename%", $permalink);
+ $permalink = str_replace('%pagename%', "{$uri}%pagename%", $permalink);
}
$permalink = array($permalink, apply_filters('editable_slug', $post->post_name));
@@ -1071,7 +1111,7 @@ function get_sample_permalink($id, $title = null, $name = null) {
*
* intended to be used for the inplace editor of the permalink post slug on in the post (and page?) editor.
*
- * @since unknown
+ * @since 2.5.0
*
* @param int|object $id Post ID or post object.
* @param string $new_title (optional) New title
@@ -1094,7 +1134,7 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
if ( false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%') ) {
$return = '' . __('Permalink:') . " \n" . '' . $permalink . " \n";
- if ( current_user_can( 'manage_options' ) && !( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') ) )
+ if ( '' == get_option( 'permalink_structure' ) && current_user_can( 'manage_options' ) && !( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') ) )
$return .= '' . __('Change Permalinks') . " \n";
if ( isset($view_post) )
$return .= "$view_post \n";
@@ -1177,13 +1217,17 @@ function wp_check_post_lock( $post_id ) {
if ( !$post = get_post( $post_id ) )
return false;
- $lock = get_post_meta( $post->ID, '_edit_lock', true );
- $last = get_post_meta( $post->ID, '_edit_last', true );
+ if ( !$lock = get_post_meta( $post->ID, '_edit_lock', true ) )
+ return false;
+
+ $lock = explode( ':', $lock );
+ $time = $lock[0];
+ $user = isset( $lock[1] ) ? $lock[1] : get_post_meta( $post->ID, '_edit_last', true );
$time_window = apply_filters( 'wp_check_post_lock_window', AUTOSAVE_INTERVAL * 2 );
- if ( $lock && $lock > time() - $time_window && $last != get_current_user_id() )
- return $last;
+ if ( $time && $time > time() - $time_window && $user != get_current_user_id() )
+ return $user;
return false;
}
@@ -1198,12 +1242,13 @@ function wp_check_post_lock( $post_id ) {
function wp_set_post_lock( $post_id ) {
if ( !$post = get_post( $post_id ) )
return false;
- if ( 0 == get_current_user_id() )
+ if ( 0 == ($user_id = get_current_user_id()) )
return false;
$now = time();
+ $lock = "$now:$user_id";
- update_post_meta( $post->ID, '_edit_lock', $now );
+ update_post_meta( $post->ID, '_edit_lock', $lock );
}
/**
@@ -1214,7 +1259,10 @@ function wp_set_post_lock( $post_id ) {
*/
function _admin_notice_post_locked() {
global $post;
- $last_user = get_userdata( get_post_meta( $post->ID, '_edit_last', true ) );
+
+ $lock = explode( ':', get_post_meta( $post->ID, '_edit_lock', true ) );
+ $user = isset( $lock[1] ) ? $lock[1] : get_post_meta( $post->ID, '_edit_last', true );
+ $last_user = get_userdata( $user );
$last_user_name = $last_user ? $last_user->display_name : __('Somebody');
switch ($post->post_type) {
@@ -1359,10 +1407,10 @@ function wp_tiny_mce( $teeny = false, $settings = false ) {
$mce_spellchecker_languages = apply_filters('mce_spellchecker_languages', '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv');
if ( $teeny ) {
- $plugins = apply_filters( 'teeny_mce_plugins', array('safari', 'inlinepopups', 'media', 'fullscreen', 'wordpress') );
+ $plugins = apply_filters( 'teeny_mce_plugins', array('inlinepopups', 'fullscreen', 'wordpress', 'wplink', 'wpdialogs') );
$ext_plugins = '';
} else {
- $plugins = array( 'safari', 'inlinepopups', 'spellchecker', 'paste', 'wordpress', 'media', 'fullscreen', 'wpeditimage', 'wpgallery', 'tabfocus' );
+ $plugins = array( 'inlinepopups', 'spellchecker', 'paste', 'wordpress', 'fullscreen', 'wpeditimage', 'wpgallery', 'tabfocus', 'wplink', 'wpdialogs' );
/*
The following filter takes an associative array of external plugins for TinyMCE in the form 'plugin_name' => 'url'.
@@ -1443,8 +1491,6 @@ function wp_tiny_mce( $teeny = false, $settings = false ) {
}
}
- $plugins = implode($plugins, ',');
-
if ( $teeny ) {
$mce_buttons = apply_filters( 'teeny_mce_buttons', array('bold, italic, underline, blockquote, separator, strikethrough, bullist, numlist,justifyleft, justifycenter, justifyright, undo, redo, link, unlink, fullscreen') );
$mce_buttons = implode($mce_buttons, ',');
@@ -1453,9 +1499,7 @@ function wp_tiny_mce( $teeny = false, $settings = false ) {
$mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', '|', 'bullist', 'numlist', 'blockquote', '|', 'justifyleft', 'justifycenter', 'justifyright', '|', 'link', 'unlink', 'wp_more', '|', 'spellchecker', 'fullscreen', 'wp_adv' ));
$mce_buttons = implode($mce_buttons, ',');
- $mce_buttons_2 = array('formatselect', 'underline', 'justifyfull', 'forecolor', '|', 'pastetext', 'pasteword', 'removeformat', '|', 'media', 'charmap', '|', 'outdent', 'indent', '|', 'undo', 'redo', 'wp_help' );
- if ( is_multisite() )
- unset( $mce_buttons_2[ array_search( 'media', $mce_buttons_2 ) ] );
+ $mce_buttons_2 = array( 'formatselect', 'underline', 'justifyfull', 'forecolor', '|', 'pastetext', 'pasteword', 'removeformat', '|', 'charmap', '|', 'outdent', 'indent', '|', 'undo', 'redo', 'wp_help' );
$mce_buttons_2 = apply_filters('mce_buttons_2', $mce_buttons_2);
$mce_buttons_2 = implode($mce_buttons_2, ',');
@@ -1486,6 +1530,21 @@ function wp_tiny_mce( $teeny = false, $settings = false ) {
'theme_advanced_resizing' => true,
'theme_advanced_resize_horizontal' => false,
'dialog_type' => 'modal',
+ 'formats' => "{
+ alignleft : [
+ {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'left'}},
+ {selector : 'img,table', classes : 'alignleft'}
+ ],
+ aligncenter : [
+ {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'center'}},
+ {selector : 'img,table', classes : 'aligncenter'}
+ ],
+ alignright : [
+ {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'right'}},
+ {selector : 'img,table', classes : 'alignright'}
+ ],
+ strikethrough : {inline : 'del'}
+ }",
'relative_urls' => false,
'remove_script_host' => false,
'convert_urls' => false,
@@ -1499,14 +1558,15 @@ function wp_tiny_mce( $teeny = false, $settings = false ) {
'paste_remove_styles' => true,
'paste_remove_spans' => true,
'paste_strip_class_attributes' => 'all',
+ 'paste_text_use_dialog' => true,
'wpeditimage_disable_captions' => $no_captions,
- 'plugins' => $plugins
+ 'plugins' => implode( ',', $plugins ),
);
if ( ! empty( $editor_styles ) && is_array( $editor_styles ) ) {
$mce_css = array();
$style_uri = get_stylesheet_directory_uri();
- if ( TEMPLATEPATH == STYLESHEETPATH ) {
+ if ( ! is_child_theme() ) {
foreach ( $editor_styles as $file )
$mce_css[] = "$style_uri/$file";
} else {
@@ -1514,10 +1574,10 @@ function wp_tiny_mce( $teeny = false, $settings = false ) {
$template_uri = get_template_directory_uri();
$template_dir = get_template_directory();
foreach ( $editor_styles as $file ) {
- if ( file_exists( "$style_dir/$file" ) )
- $mce_css[] = "$style_uri/$file";
if ( file_exists( "$template_dir/$file" ) )
$mce_css[] = "$template_uri/$file";
+ if ( file_exists( "$style_dir/$file" ) )
+ $mce_css[] = "$style_uri/$file";
}
}
$mce_css = implode( ',', $mce_css );
@@ -1570,8 +1630,18 @@ function wp_tiny_mce( $teeny = false, $settings = false ) {
include_once(ABSPATH . WPINC . '/js/tinymce/langs/wp-langs.php');
$mce_options = '';
- foreach ( $initArray as $k => $v )
- $mce_options .= $k . ':"' . $v . '", ';
+ foreach ( $initArray as $k => $v ) {
+ if ( is_bool($v) ) {
+ $val = $v ? 'true' : 'false';
+ $mce_options .= $k . ':' . $val . ', ';
+ continue;
+ } elseif ( !empty($v) && is_string($v) && ( '{' == $v{0} || '[' == $v{0} ) ) {
+ $mce_options .= $k . ':' . $v . ', ';
+ continue;
+ }
+
+ $mce_options .= $k . ':"' . $v . '", ';
+ }
$mce_options = rtrim( trim($mce_options), '\n\r,' ); ?>
@@ -1601,14 +1671,33 @@ tinyMCEPreInit = {
+
+
+
+ 'open',
'default_ping_status' => 'open',
'default_pingback_flag' => 1,
- 'default_post_edit_rows' => 10,
+ 'default_post_edit_rows' => 20,
'posts_per_page' => 10,
/* translators: default date format, see http://php.net/date */
'date_format' => __('F j, Y'),
@@ -318,6 +318,9 @@ function populate_options() {
// 3.0
'page_for_posts' => 0,
'page_on_front' => 0,
+
+ // 3.1
+ 'default_post_format' => 0,
);
// 3.0 multisite
@@ -357,9 +360,8 @@ function populate_options() {
if ( !__get_option('home') ) update_option('home', $guessurl);
// Delete unused options
- $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins', 'can_compress_scripts',
- 'page_uris', 'update_core', 'update_plugins', 'update_themes', 'doing_cron', 'random_seed', 'rss_excerpt_length', 'secret', 'use_linksupdate', 'default_comment_status_page' );
- foreach ($unusedoptions as $option)
+ $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins', 'can_compress_scripts', 'page_uris', 'update_core', 'update_plugins', 'update_themes', 'doing_cron', 'random_seed', 'rss_excerpt_length', 'secret', 'use_linksupdate', 'default_comment_status_page', 'wporg_popular_tags', 'what_to_show');
+ foreach ( $unusedoptions as $option )
delete_option($option);
// delete obsolete magpie stuff
@@ -668,7 +670,7 @@ function populate_network( $network_id = 1, $domain = '', $email = '', $site_nam
if ( !is_multisite() ) {
$site_admins = array( $site_user->user_login );
- $users = get_users_of_blog();
+ $users = get_users( array( 'fields' => array( 'ID', 'user_login' ) ) );
if ( $users ) {
foreach ( $users as $user ) {
if ( is_super_admin( $user->ID ) && !in_array( $user->user_login, $site_admins ) )
@@ -715,7 +717,7 @@ Thanks!
'subdomain_install' => intval( $subdomain_install ),
'global_terms_enabled' => global_terms_enabled() ? '1' : '0'
);
- if ( !intval( $subdomain_install ) )
+ if ( ! $subdomain_install )
$sitemeta['illegal_names'][] = 'blog';
$insert = '';
diff --git a/wp-admin/includes/taxonomy.php b/wp-admin/includes/taxonomy.php
index b371ec24..12e231a8 100644
--- a/wp-admin/includes/taxonomy.php
+++ b/wp-admin/includes/taxonomy.php
@@ -13,7 +13,7 @@
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.0.0
*
* @param unknown_type $cat_name
* @return unknown
@@ -28,7 +28,7 @@ function category_exists($cat_name, $parent = 0) {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.0.0
*
* @param unknown_type $id
* @return unknown
@@ -41,7 +41,7 @@ function get_category_to_edit( $id ) {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.0.0
*
* @param unknown_type $cat_name
* @param unknown_type $parent
@@ -57,7 +57,7 @@ function wp_create_category( $cat_name, $parent = 0 ) {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.0.0
*
* @param unknown_type $categories
* @param unknown_type $post_id
@@ -79,25 +79,6 @@ function wp_create_categories($categories, $post_id = '') {
return $cat_ids;
}
-/**
- * Deletes one existing category.
- *
- * @since 2.0.0
- *
- * @param int $cat_ID
- * @return mixed Returns true if completes delete action; false if term doesnt exist; Zero on attempted deletion of default Category; WP_Error object is also a possibility.
- */
-function wp_delete_category($cat_ID) {
- $cat_ID = (int) $cat_ID;
- $default = get_option('default_category');
-
- // Don't delete the default cat
- if ( $cat_ID == $default )
- return 0;
-
- return wp_delete_term($cat_ID, 'category', array('default' => $default));
-}
-
/**
* Updates an existing Category or creates a new Category.
*
@@ -192,7 +173,31 @@ function wp_update_category($catarr) {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.3.0
+ *
+ * @param unknown_type $tag_name
+ * @return unknown
+ */
+function tag_exists($tag_name) {
+ return term_exists($tag_name, 'post_tag');
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 2.3.0
+ *
+ * @param unknown_type $tag_name
+ * @return unknown
+ */
+function wp_create_tag($tag_name) {
+ return wp_create_term( $tag_name, 'post_tag');
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 2.3.0
*
* @param unknown_type $post_id
* @return unknown
@@ -204,7 +209,7 @@ function get_tags_to_edit( $post_id, $taxonomy = 'post_tag' ) {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.8.0
*
* @param unknown_type $post_id
* @return unknown
@@ -234,31 +239,7 @@ function get_terms_to_edit( $post_id, $taxonomy = 'post_tag' ) {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
- *
- * @param unknown_type $tag_name
- * @return unknown
- */
-function tag_exists($tag_name) {
- return term_exists($tag_name, 'post_tag');
-}
-
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @param unknown_type $tag_name
- * @return unknown
- */
-function wp_create_tag($tag_name) {
- return wp_create_term( $tag_name, 'post_tag');
-}
-
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
+ * @since 2.8.0
*
* @param unknown_type $tag_name
* @return unknown
diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php
index fd7e76f9..b345c36b 100644
--- a/wp-admin/includes/template.php
+++ b/wp-admin/includes/template.php
@@ -8,169 +8,6 @@
* @subpackage Administration
*/
-/**
- * {@internal Missing Short Description}}
- *
- * @since 2.7
- *
- * Outputs the HTML for the hidden table rows used in Categories, Link Categories and Tags quick edit.
- *
- * @param string $type "edit-tags", "categoried" or "edit-link-categories"
- * @param string $taxonomy The taxonomy of the row.
- * @return
- */
-function inline_edit_term_row($type, $taxonomy) {
-
- $tax = get_taxonomy($taxonomy);
- if ( ! current_user_can( $tax->cap->edit_terms ) )
- return;
-
- $columns = get_column_headers($type);
- $hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns($type) ) );
- $col_count = count($columns) - count($hidden);
- ?>
-
-
-name );
- $edit_link = "link-category.php?action=edit&cat_ID=$category->term_id";
- if ( current_user_can( 'manage_categories' ) ) {
- $edit = "name)) . "'>$name ";
- $actions = array();
- $actions['edit'] = '' . __('Edit') . ' ';
- $actions['inline hide-if-no-js'] = '' . __('Quick Edit') . ' ';
- if ( $default_cat_id != $category->term_id )
- $actions['delete'] = "term_id) . "'>" . __('Delete') . " ";
- $actions = apply_filters('link_cat_row_actions', $actions, $category);
- $action_count = count($actions);
- $i = 0;
- $edit .= '';
- foreach ( $actions as $action => $link ) {
- ++$i;
- ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
- $edit .= "$link$sep ";
- }
- $edit .= '
';
- } else {
- $edit = $name;
- }
-
- $row_class = 'alternate' == $row_class ? '' : 'alternate';
- $qe_data = get_term_to_edit($category->term_id, 'link_category');
-
- $category->count = number_format_i18n( $category->count );
- $count = ( $category->count > 0 ) ? "$category->count " : $category->count;
- $output = " ";
- $columns = get_column_headers('edit-link-categories');
- $hidden = get_hidden_columns('edit-link-categories');
- foreach ( $columns as $column_name => $column_display_name ) {
- $class = "class=\"$column_name column-$column_name\"";
-
- $style = '';
- if ( in_array($column_name, $hidden) )
- $style = ' style="display:none;"';
-
- $attributes = "$class$style";
-
- switch ($column_name) {
- case 'cb':
- $output .= "";
- if ( absint( get_option( 'default_link_category' ) ) != $category->term_id ) {
- $output .= " ";
- } else {
- $output .= " ";
- }
- $output .= " ";
- break;
- case 'name':
- $output .= "$edit";
- $output .= '';
- $output .= '
' . $qe_data->name . '
';
- $output .= '
' . apply_filters('editable_slug', $qe_data->slug) . '
';
- $output .= '
' . $qe_data->parent . '
';
- break;
- case 'description':
- $output .= "$category->description ";
- break;
- case 'slug':
- $output .= "" . apply_filters('editable_slug', $category->slug) . " ";
- break;
- case 'links':
- $attributes = 'class="links column-links num"' . $style;
- $output .= "$count ";
- break;
- default:
- $output .= "";
- $output .= apply_filters('manage_link_categories_custom_column', '', $column_name, $category->term_id);
- $output .= " ";
- }
- }
- $output .= ' ';
-
- return $output;
-}
//
// Category Checklists
@@ -179,7 +16,7 @@ function link_cat_row( $category, $name_override = false ) {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.5.1
*/
class Walker_Category_Checklist extends Walker {
var $tree_type = 'category';
@@ -217,7 +54,7 @@ class Walker_Category_Checklist extends Walker {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.5.1
*
* @param unknown_type $post_id
* @param unknown_type $descendants_and_self
@@ -239,6 +76,8 @@ function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $select
/**
* Taxonomy independent version of wp_category_checklist
*
+ * @since 3.0.0
+ *
* @param int $post_id
* @param array $args
*/
@@ -305,7 +144,7 @@ function wp_terms_checklist($post_id = 0, $args = array()) {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.5.0
*
* @param unknown_type $taxonomy
* @param unknown_type $default
@@ -353,7 +192,7 @@ function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $ech
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.5.1
*
* @param unknown_type $link_id
*/
@@ -374,1849 +213,110 @@ function wp_link_category_checklist( $link_id = 0 ) {
if ( empty( $categories ) )
return;
- foreach ( $categories as $category ) {
- $cat_id = $category->term_id;
- $name = esc_html( apply_filters( 'the_category', $category->name ) );
- $checked = in_array( $cat_id, $checked_categories ) ? ' checked="checked"' : '';
- echo '
', $name, "";
- }
-}
-
-// Tag stuff
-
-// Returns a single tag row (see tag_rows below)
-// Note: this is also used in admin-ajax.php!
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @param unknown_type $tag
- * @param unknown_type $class
- * @return unknown
- */
-function _tag_row( $tag, $level, $taxonomy = 'post_tag' ) {
- global $post_type, $current_screen;
- static $row_class = '';
- $row_class = ($row_class == '' ? ' class="alternate"' : '');
-
- $count = number_format_i18n( $tag->count );
- $tax = get_taxonomy($taxonomy);
-
- if ( 'post_tag' == $taxonomy ) {
- $tagsel = 'tag';
- } elseif ( 'category' == $taxonomy ) {
- $tagsel = 'category_name';
- } elseif ( ! empty($tax->query_var) ) {
- $tagsel = $tax->query_var;
- } else {
- $tagsel = $taxonomy;
- }
-
- $pad = str_repeat( '— ', max(0, $level) );
- $name = apply_filters( 'term_name', $pad . ' ' . $tag->name, $tag );
- $qe_data = get_term($tag->term_id, $taxonomy, object, 'edit');
- $edit_link = "edit-tags.php?action=edit&taxonomy=$taxonomy&post_type=$post_type&tag_ID=$tag->term_id";
-
- $out = '';
- $out .= '
';
-
-
- $columns = get_column_headers($current_screen);
- $hidden = get_hidden_columns($current_screen);
- $default_term = get_option('default_' . $taxonomy);
- foreach ( $columns as $column_name => $column_display_name ) {
- $class = "class=\"$column_name column-$column_name\"";
-
- $style = '';
- if ( in_array($column_name, $hidden) )
- $style = ' style="display:none;"';
-
- $attributes = "$class$style";
-
- switch ($column_name) {
- case 'cb':
- if ( current_user_can($tax->cap->delete_terms) && $tag->term_id != $default_term )
- $out .= ' ';
- else
- $out .= ' ';
- break;
- case 'name':
- $out .= '' . $name . ' ';
- $actions = array();
- if ( current_user_can($tax->cap->edit_terms) ) {
- $actions['edit'] = '' . __('Edit') . ' ';
- $actions['inline hide-if-no-js'] = '' . __('Quick Edit') . ' ';
- }
- if ( current_user_can($tax->cap->delete_terms) && $tag->term_id != $default_term )
- $actions['delete'] = "term_id) . "'>" . __('Delete') . " ";
-
- $actions = apply_filters('tag_row_actions', $actions, $tag);
- $actions = apply_filters("${taxonomy}_row_actions", $actions, $tag);
-
- $action_count = count($actions);
- $i = 0;
- $out .= '';
- foreach ( $actions as $action => $link ) {
- ++$i;
- ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
- $out .= "$link$sep ";
- }
- $out .= '
';
- $out .= '';
- $out .= '
' . $qe_data->name . '
';
- $out .= '
' . apply_filters('editable_slug', $qe_data->slug) . '
';
- $out .= '
' . $qe_data->parent . '
';
- break;
- case 'description':
- $out .= "$tag->description ";
- break;
- case 'slug':
- $out .= "" . apply_filters('editable_slug', $tag->slug) . " ";
- break;
- case 'posts':
- $attributes = 'class="posts column-posts num"' . $style;
- $out .= "$count ";
- break;
- default:
- $out .= "";
- $out .= apply_filters("manage_${taxonomy}_custom_column", '', $column_name, $tag->term_id);
- $out .= " ";
- }
- }
-
- $out .= " \n";
-
- return $out;
-}
-
-// Outputs appropriate rows for the Nth page of the Tag Management screen,
-// assuming M tags displayed at a time on the page
-// Returns the number of tags displayed
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @param unknown_type $page
- * @param unknown_type $pagesize
- * @param unknown_type $searchterms
- * @return unknown
- */
-function tag_rows( $page = 1, $pagesize = 20, $searchterms = '', $taxonomy = 'post_tag' ) {
-
- // Get a page worth of tags
- $start = ($page - 1) * $pagesize;
-
- $args = array('offset' => $start, 'number' => $pagesize, 'hide_empty' => 0);
-
- if ( !empty( $searchterms ) )
- $args['search'] = $searchterms;
-
- // convert it to table rows
- $out = '';
- $count = 0;
- if ( is_taxonomy_hierarchical($taxonomy) ) {
- // We'll need the full set of terms then.
- $args['number'] = $args['offset'] = 0;
-
- $terms = get_terms( $taxonomy, $args );
- if ( !empty( $searchterms ) ) // Ignore children on searches.
- $children = array();
- else
- $children = _get_term_hierarchy($taxonomy);
-
- // Some funky recursion to get the job done(Paging & parents mainly) is contained within, Skip it for non-hierarchical taxonomies for performance sake
- $out .= _term_rows($taxonomy, $terms, $children, $page, $pagesize, $count);
- } else {
- $terms = get_terms( $taxonomy, $args );
- foreach( $terms as $term )
- $out .= _tag_row( $term, 0, $taxonomy );
- $count = $pagesize; // Only displaying a single page.
- }
-
- echo $out;
- return $count;
-}
-
-function _term_rows( $taxonomy, $terms, &$children, $page = 1, $per_page = 20, &$count, $parent = 0, $level = 0 ) {
-
- $start = ($page - 1) * $per_page;
- $end = $start + $per_page;
-
- $output = '';
- foreach ( $terms as $key => $term ) {
-
- if ( $count >= $end )
- break;
-
- if ( $term->parent != $parent && empty($_GET['s']) )
- continue;
-
- // If the page starts in a subtree, print the parents.
- if ( $count == $start && $term->parent > 0 && empty($_GET['s']) ) {
- $my_parents = $parent_ids = array();
- $p = $term->parent;
- while ( $p ) {
- $my_parent = get_term( $p, $taxonomy );
- $my_parents[] = $my_parent;
- $p = $my_parent->parent;
- if ( in_array($p, $parent_ids) ) // Prevent parent loops.
- break;
- $parent_ids[] = $p;
- }
- unset($parent_ids);
-
- $num_parents = count($my_parents);
- while ( $my_parent = array_pop($my_parents) ) {
- $output .= "\t" . _tag_row( $my_parent, $level - $num_parents, $taxonomy );
- $num_parents--;
- }
- }
-
- if ( $count >= $start )
- $output .= "\t" . _tag_row( $term, $level, $taxonomy );
-
- ++$count;
-
- unset($terms[$key]);
-
- if ( isset($children[$term->term_id]) && empty($_GET['s']) )
- $output .= _term_rows( $taxonomy, $terms, $children, $page, $per_page, $count, $term->term_id, $level + 1 );
- }
-
- return $output;
-}
-
-// define the columns to display, the syntax is 'internal name' => 'display name'
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @return unknown
- */
-function wp_manage_posts_columns( $screen = '') {
- if ( empty($screen) )
- $post_type = 'post';
- else
- $post_type = $screen->post_type;
-
- $posts_columns = array();
- $posts_columns['cb'] = '
';
- /* translators: manage posts column name */
- $posts_columns['title'] = _x('Title', 'column name');
- $posts_columns['author'] = __('Author');
- if ( empty($post_type) || is_object_in_taxonomy($post_type, 'category') )
- $posts_columns['categories'] = __('Categories');
- if ( empty($post_type) || is_object_in_taxonomy($post_type, 'post_tag') )
- $posts_columns['tags'] = __('Tags');
- $post_status = !empty($_REQUEST['post_status']) ? $_REQUEST['post_status'] : 'all';
- if ( !in_array( $post_status, array('pending', 'draft', 'future') ) && ( empty($post_type) || post_type_supports($post_type, 'comments') ) )
- $posts_columns['comments'] = '
';
- $posts_columns['date'] = __('Date');
-
- if ( 'page' == $post_type )
- $posts_columns = apply_filters( 'manage_pages_columns', $posts_columns );
- else
- $posts_columns = apply_filters( 'manage_posts_columns', $posts_columns, $post_type );
- $posts_columns = apply_filters( "manage_{$post_type}_posts_columns", $posts_columns );
-
- return $posts_columns;
-}
-
-// define the columns to display, the syntax is 'internal name' => 'display name'
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @return unknown
- */
-function wp_manage_media_columns() {
- $posts_columns = array();
- $posts_columns['cb'] = '
';
- $posts_columns['icon'] = '';
- /* translators: column name */
- $posts_columns['media'] = _x('File', 'column name');
- $posts_columns['author'] = __('Author');
- //$posts_columns['tags'] = _x('Tags', 'column name');
- /* translators: column name */
- $posts_columns['parent'] = _x('Attached to', 'column name');
- $posts_columns['comments'] = '
';
- //$posts_columns['comments'] = __('Comments');
- /* translators: column name */
- $posts_columns['date'] = _x('Date', 'column name');
- $posts_columns = apply_filters('manage_media_columns', $posts_columns);
-
- return $posts_columns;
-}
-
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @return unknown
- */
-function wp_manage_pages_columns() {
- return wp_manage_posts_columns();
-}
-
-/**
- * Get the column headers for a screen
- *
- * @since unknown
- *
- * @param string|object $screen The screen you want the headers for
- * @return array Containing the headers in the format id => UI String
- */
-function get_column_headers($screen) {
- global $_wp_column_headers;
-
- if ( !isset($_wp_column_headers) )
- $_wp_column_headers = array();
-
- if ( is_string($screen) )
- $screen = convert_to_screen($screen);
-
- // Store in static to avoid running filters on each call
- if ( isset($_wp_column_headers[$screen->id]) )
- return $_wp_column_headers[$screen->id];
-
- switch ($screen->base) {
- case 'edit':
- $_wp_column_headers[$screen->id] = wp_manage_posts_columns( $screen );
- break;
- case 'edit-comments':
- $_wp_column_headers[$screen->id] = array(
- 'cb' => '
',
- 'author' => __('Author'),
- /* translators: column name */
- 'comment' => _x('Comment', 'column name'),
- //'date' => __('Submitted'),
- 'response' => __('In Response To')
- );
-
- break;
- case 'link-manager':
- $_wp_column_headers[$screen->id] = array(
- 'cb' => '
',
- 'name' => __('Name'),
- 'url' => __('URL'),
- 'categories' => __('Categories'),
- 'rel' => __('Relationship'),
- 'visible' => __('Visible'),
- 'rating' => __('Rating')
- );
-
- break;
- case 'upload':
- $_wp_column_headers[$screen->id] = wp_manage_media_columns();
- break;
- case 'categories':
- $_wp_column_headers[$screen->id] = array(
- 'cb' => '
',
- 'name' => __('Name'),
- 'description' => __('Description'),
- 'slug' => __('Slug'),
- 'posts' => __('Posts')
- );
-
- break;
- case 'edit-link-categories':
- $_wp_column_headers[$screen->id] = array(
- 'cb' => '
',
- 'name' => __('Name'),
- 'description' => __('Description'),
- 'slug' => __('Slug'),
- 'links' => __('Links')
- );
-
- break;
- case 'edit-tags':
- $_wp_column_headers[$screen->id] = array(
- 'cb' => '
',
- 'name' => __('Name'),
- 'description' => __('Description'),
- 'slug' => __('Slug'),
- 'posts' => __('Posts')
- );
-
- break;
- case 'users':
- $_wp_column_headers[$screen->id] = array(
- 'cb' => '
',
- 'username' => __('Username'),
- 'name' => __('Name'),
- 'email' => __('E-mail'),
- 'role' => __('Role'),
- 'posts' => __('Posts')
- );
- break;
- default :
- $_wp_column_headers[$screen->id] = array();
- }
-
- $_wp_column_headers[$screen->id] = apply_filters('manage_' . $screen->id . '_columns', $_wp_column_headers[$screen->id]);
- return $_wp_column_headers[$screen->id];
-}
-
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @param unknown_type $screen
- * @param unknown_type $id
- */
-function print_column_headers( $screen, $id = true ) {
- if ( is_string($screen) )
- $screen = convert_to_screen($screen);
-
- $columns = get_column_headers( $screen );
- $hidden = get_hidden_columns($screen);
- $styles = array();
-
- foreach ( $columns as $column_key => $column_display_name ) {
- $class = ' class="manage-column';
-
- $class .= " column-$column_key";
-
- if ( 'cb' == $column_key )
- $class .= ' check-column';
- elseif ( in_array($column_key, array('posts', 'comments', 'links')) )
- $class .= ' num';
-
- $class .= '"';
-
- $style = '';
- if ( in_array($column_key, $hidden) )
- $style = 'display:none;';
-
- if ( isset($styles[$screen->id]) && isset($styles[$screen->id][$column_key]) )
- $style .= ' ' . $styles[$screen>id][$column_key];
- $style = ' style="' . $style . '"';
-?>
-
>
-id] = $columns;
-}
-
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @param unknown_type $screen
- */
-function get_hidden_columns($screen) {
- if ( is_string($screen) )
- $screen = convert_to_screen($screen);
-
- return (array) get_user_option( 'manage' . $screen->id. 'columnshidden' );
-}
-
-/**
- * {@internal Missing Short Description}}
- *
- * Outputs the quick edit and bulk edit table rows for posts and pages
- *
- * @since 2.7
- *
- * @param string $screen
- */
-function inline_edit_row( $screen ) {
- global $mode;
-
- if ( is_string($screen) ) {
- $screen = array('id' => 'edit-' . $screen, 'base' => 'edit', 'post_type' => $screen );
- $screen = (object) $screen;
- }
-
- $post = get_default_post_to_edit( $screen->post_type );
- $post_type_object = get_post_type_object( $screen->post_type );
-
- $taxonomy_names = get_object_taxonomies( $screen->post_type );
- $hierarchical_taxonomies = array();
- $flat_taxonomies = array();
- foreach ( $taxonomy_names as $taxonomy_name ) {
- $taxonomy = get_taxonomy( $taxonomy_name);
-
- if ( !$taxonomy->show_ui )
- continue;
-
- if ( $taxonomy->hierarchical )
- $hierarchical_taxonomies[] = $taxonomy;
- else
- $flat_taxonomies[] = $taxonomy;
- }
-
- $columns = wp_manage_posts_columns($screen);
- $hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns($screen) ) );
- $col_count = count($columns) - count($hidden);
- $m = ( isset($mode) && 'excerpt' == $mode ) ? 'excerpt' : 'list';
- $can_publish = current_user_can($post_type_object->cap->publish_posts);
- $core_columns = array( 'cb' => true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true );
-
-?>
-
-
-
-
- post_type ";
- echo $bulk ? "bulk-edit-row bulk-edit-row-$hclass bulk-edit-$screen->post_type" : "quick-edit-row quick-edit-row-$hclass inline-edit-$screen->post_type";
- ?>" style="display: none">
-
-
-
-
-
-post_type, 'title' ) ) :
- if ( $bulk ) : ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-post_type, 'author' ) ) :
- $authors = get_editable_user_ids( get_current_user_id(), true, $screen->post_type ); // TODO: ROLE SYSTEM
- $authors_dropdown = '';
- if ( $authors && count( $authors ) > 1 ) :
- $users_opt = array('include' => $authors, 'name' => 'post_author', 'class'=> 'authors', 'multi' => 1, 'echo' => 0);
- if ( $bulk )
- $users_opt['show_option_none'] = __('— No Change —');
- $authors_dropdown = '
';
- $authors_dropdown .= '' . __( 'Author' ) . ' ';
- $authors_dropdown .= wp_dropdown_users( $users_opt );
- $authors_dropdown .= ' ';
-
- endif; // authors
-?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
labels->name) ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-post_type, 'author' ) && $bulk )
- echo $authors_dropdown;
-?>
-
-hierarchical ) : ?>
-
-
-
- $post_type_object->name, 'selected' => $post->post_parent, 'name' => 'post_parent', 'show_option_none' => __('Main Page (no parent)'), 'option_none_value' => 0, 'sort_column'=> 'menu_order, post_title');
- if ( $bulk )
- $dropdown_args['show_option_no_change'] = __('— No Change —');
- $dropdown_args = apply_filters('quick_edit_dropdown_pages_args', $dropdown_args);
- wp_dropdown_pages($dropdown_args);
-?>
-
-
-post_type, 'page-attributes' ) ) :
- if ( !$bulk ) : ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-hierarchical ?>
-
-
-
-
-
-
- labels->name) ?>
-
-
-
-
-
-
-
-post_type, 'comments' ) || post_type_supports( $screen->post_type, 'trackbacks' ) ) :
- if ( $bulk ) : ?>
-
-
- post_type, 'comments' ) ) : ?>
-
-
-
-
-
-
-
-
- post_type, 'trackbacks' ) ) : ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- post_type, 'comments' ) ) : ?>
-
-
-
-
- post_type, 'trackbacks' ) ) : ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-post_type && $can_publish && current_user_can( $post_type_object->cap->edit_others_posts ) ) : ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $column_display_name ) {
- if ( isset( $core_columns[$column_name] ) )
- continue;
- do_action( $bulk ? 'bulk_edit_custom_box' : 'quick_edit_custom_box', $column_name, $screen->post_type );
- }
-?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-post_type);
- if ( ! current_user_can($post_type_object->cap->edit_post, $post->ID) )
- return;
-
- $title = htmlspecialchars( trim( $post->post_title ), ENT_QUOTES );
-
- echo '
-
-
' . $title . '
-
' . apply_filters('editable_slug', $post->post_name) . '
-
' . $post->post_author . '
-
-
' . esc_html( $post->ping_status ) . '
-
' . esc_html( $post->post_status ) . '
-
' . mysql2date( 'd', $post->post_date, false ) . '
-
' . mysql2date( 'm', $post->post_date, false ) . '
-
' . mysql2date( 'Y', $post->post_date, false ) . '
-
' . mysql2date( 'H', $post->post_date, false ) . '
-
' . mysql2date( 'i', $post->post_date, false ) . '
-
' . mysql2date( 's', $post->post_date, false ) . '
-
' . esc_html( $post->post_password ) . '
';
-
- if ( $post_type_object->hierarchical )
- echo '
' . $post->post_parent . '
';
-
- if ( $post->post_type == 'page' )
- echo '
' . esc_html( get_post_meta( $post->ID, '_wp_page_template', true ) ) . '
';
-
- if ( $post_type_object->hierarchical )
- echo '';
-
- $taxonomy_names = get_object_taxonomies( $post->post_type );
- foreach ( $taxonomy_names as $taxonomy_name) {
- $taxonomy = get_taxonomy( $taxonomy_name );
-
- if ( $taxonomy->hierarchical && $taxonomy->show_ui )
- echo '
' . implode( ',', wp_get_object_terms( $post->ID, $taxonomy_name, array('fields'=>'ids')) ) . '
';
- elseif ( $taxonomy->show_ui )
- echo '
' . esc_html( str_replace( ',', ', ', get_terms_to_edit($post->ID, $taxonomy_name) ) ) . '
';
- }
-
- if ( !$post_type_object->hierarchical )
- echo '
' . (is_sticky($post->ID) ? 'sticky' : '') . '
';
-
- echo '
';
-}
-
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @param unknown_type $posts
- */
-function post_rows( $posts = array() ) {
- global $wp_query, $post, $mode;
-
- add_filter('the_title','esc_html');
-
- // Create array of post IDs.
- $post_ids = array();
-
- if ( empty($posts) )
- $posts = &$wp_query->posts;
-
- foreach ( $posts as $a_post )
- $post_ids[] = $a_post->ID;
-
- $comment_pending_count = get_pending_comments_num($post_ids);
-
- foreach ( $posts as $post ) {
- if ( empty($comment_pending_count[$post->ID]) )
- $comment_pending_count[$post->ID] = 0;
-
- _post_row($post, $comment_pending_count[$post->ID], $mode);
- }
-}
-
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
- *
- * @param unknown_type $a_post
- * @param unknown_type $pending_comments
- * @param unknown_type $mode
- */
-function _post_row($a_post, $pending_comments, $mode) {
- global $post, $current_screen;
- static $rowclass;
-
- $global_post = $post;
- $post = $a_post;
- setup_postdata($post);
-
- $rowclass = 'alternate' == $rowclass ? '' : 'alternate';
- $post_owner = ( get_current_user_id() == $post->post_author ? 'self' : 'other' );
- $edit_link = get_edit_post_link( $post->ID );
- $title = _draft_or_post_title();
- $post_type_object = get_post_type_object($post->post_type);
-?>
-
post_status ); ?> iedit' valign="top">
-$column_display_name ) {
- $class = "class=\"$column_name column-$column_name\"";
-
- $style = '';
- if ( in_array($column_name, $hidden) )
- $style = ' style="display:none;"';
-
- $attributes = "$class$style";
-
- switch ($column_name) {
-
- case 'cb':
- ?>
- cap->edit_post, $post->ID ) ) { ?>
- post_date && 'date' == $column_name ) {
- $t_time = $h_time = __('Unpublished');
- $time_diff = 0;
- } else {
- $t_time = get_the_time(__('Y/m/d g:i:s A'));
- $m_time = $post->post_date;
- $time = get_post_time('G', true, $post);
-
- $time_diff = time() - $time;
-
- if ( $time_diff > 0 && $time_diff < 24*60*60 )
- $h_time = sprintf( __('%s ago'), human_time_diff( $time ) );
- else
- $h_time = mysql2date(__('Y/m/d'), $m_time);
- }
-
- echo '';
- if ( 'excerpt' == $mode )
- echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode);
- else
- echo '' . apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) . ' ';
- echo ' ';
- if ( 'publish' == $post->post_status ) {
- _e('Published');
- } elseif ( 'future' == $post->post_status ) {
- if ( $time_diff > 0 )
- echo '' . __('Missed schedule') . ' ';
- else
- _e('Scheduled');
- } else {
- _e('Last Modified');
- }
- echo ' ';
- break;
-
- case 'title':
- $attributes = 'class="post-title column-title"' . $style;
- ?>
- >cap->edit_post, $post->ID) && $post->post_status != 'trash' ) { ?>
- cap->edit_post, $post->ID) && 'trash' != $post->post_status ) {
- $actions['edit'] = '' . __('Edit') . ' ';
- $actions['inline hide-if-no-js'] = '' . __('Quick Edit') . ' ';
- }
- if ( current_user_can($post_type_object->cap->delete_post, $post->ID) ) {
- if ( 'trash' == $post->post_status )
- $actions['untrash'] = "ID) ), 'untrash-' . $post->post_type . '_' . $post->ID ) . "'>" . __('Restore') . " ";
- elseif ( EMPTY_TRASH_DAYS )
- $actions['trash'] = "" . __('Trash') . " ";
- if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS )
- $actions['delete'] = "" . __('Delete Permanently') . " ";
- }
- if ( in_array($post->post_status, array('pending', 'draft')) ) {
- if ( current_user_can($post_type_object->cap->edit_post, $post->ID) )
- $actions['view'] = '' . __('Preview') . ' ';
- } elseif ( 'trash' != $post->post_status ) {
- $actions['view'] = '' . __('View') . ' ';
- }
- $actions = apply_filters('post_row_actions', $actions, $post);
- $action_count = count($actions);
- $i = 0;
- echo '';
- foreach ( $actions as $action => $link ) {
- ++$i;
- ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
- echo "$link$sep ";
- }
- echo '
';
-
- get_inline_data($post);
- ?>
-
-
- >post_type}&category_name={$c->slug}'> " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'category', 'display')) . "";
- echo join( ', ', $out );
- } else {
- _e('Uncategorized');
- }
- ?>
-
- >ID);
- if ( !empty( $tags ) ) {
- $out = array();
- foreach ( $tags as $c )
- $out[] = " " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'post_tag', 'display')) . " ";
- echo join( ', ', $out );
- } else {
- _e('No Tags');
- }
- ?>
-
- >
- ';
- comments_number("
', "
', "
');
- if ( $pending_comments )
- echo '';
- ?>
-
-
- >
-
-
-
- cap->edit_post, $post->ID) ) { echo "" . __('Edit') . " "; } ?>
-
- cap->delete_post, $post->ID) ) { echo "ID) . "' class='delete'>" . __('Delete') . " "; } ?>
-
- >ID); ?>
-
-
-post_parent > 0 ) {
- //sent level 0 by accident, by default, or because we don't know the actual level
- $find_main_page = (int)$page->post_parent;
- while ( $find_main_page > 0 ) {
- $parent = get_page($find_main_page);
-
- if ( is_null($parent) )
- break;
-
- $level++;
- $find_main_page = (int)$parent->post_parent;
-
- if ( !isset($parent_name) )
- $parent_name = $parent->post_title;
- }
- }
-
- $page->post_title = esc_html( $page->post_title );
- $pad = str_repeat( '— ', $level );
- $id = (int) $page->ID;
- $rowclass = 'alternate' == $rowclass ? '' : 'alternate';
- $posts_columns = get_column_headers( $current_screen );
- $hidden = get_hidden_columns( $current_screen );
- $title = _draft_or_post_title();
- $post_type = $page->post_type;
- $post_type_object = get_post_type_object($post_type);
-?>
-
- $column_display_name ) {
- $class = "class=\"$column_name column-$column_name\"";
-
- $style = '';
- if ( in_array($column_name, $hidden) )
- $style = ' style="display:none;"';
-
- $attributes = "$class$style";
-
- switch ($column_name) {
-
- case 'cb':
- ?>
- cap->edit_post, $page->ID ) ) { ?>
- post_date && 'date' == $column_name ) {
- $t_time = $h_time = __('Unpublished');
- $time_diff = 0;
- } else {
- $t_time = get_the_time(__('Y/m/d g:i:s A'));
- $m_time = $page->post_date;
- $time = get_post_time('G', true);
-
- $time_diff = time() - $time;
-
- if ( $time_diff > 0 && $time_diff < 24*60*60 )
- $h_time = sprintf( __('%s ago'), human_time_diff( $time ) );
- else
- $h_time = mysql2date(__('Y/m/d'), $m_time);
- }
- echo '';
- echo '' . apply_filters('post_date_column_time', $h_time, $page, $column_name, '') . ' ';
- echo ' ';
- if ( 'publish' == $page->post_status ) {
- _e('Published');
- } elseif ( 'future' == $page->post_status ) {
- if ( $time_diff > 0 )
- echo '' . __('Missed schedule') . ' ';
- else
- _e('Scheduled');
- } else {
- _e('Last Modified');
- }
- echo ' ';
- break;
- case 'title':
- $attributes = 'class="post-title page-title column-title"' . $style;
- $edit_link = get_edit_post_link( $page->ID );
- ?>
- >cap->edit_post, $page->ID) && $post->post_status != 'trash' ) { ?> labels->parent_item_colon . ' ' . esc_html($parent_name) : ''; ?>
- cap->edit_post, $page->ID) && $post->post_status != 'trash' ) {
- $actions['edit'] = '' . __('Edit') . ' ';
- $actions['inline'] = '' . __('Quick Edit') . ' ';
- }
- if ( current_user_can($post_type_object->cap->delete_post, $page->ID) ) {
- if ( $post->post_status == 'trash' )
- $actions['untrash'] = "post_type . '_' . $page->ID) . "'>" . __('Restore') . " ";
- elseif ( EMPTY_TRASH_DAYS )
- $actions['trash'] = "" . __('Trash') . " ";
- if ( $post->post_status == 'trash' || !EMPTY_TRASH_DAYS )
- $actions['delete'] = "post_type . '_' . $page->ID) . "'>" . __('Delete Permanently') . " ";
- }
- if ( in_array($post->post_status, array('pending', 'draft')) ) {
- if ( current_user_can($post_type_object->cap->edit_post, $page->ID) )
- $actions['view'] = '' . __('Preview') . ' ';
- } elseif ( $post->post_status != 'trash' ) {
- $actions['view'] = '' . __('View') . ' ';
- }
- $actions = apply_filters('page_row_actions', $actions, $page);
- $action_count = count($actions);
-
- $i = 0;
- echo '';
- foreach ( $actions as $action => $link ) {
- ++$i;
- ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
- echo "$link$sep ";
- }
- echo '
';
-
- get_inline_data($post);
- echo ' ';
- break;
-
- case 'comments':
- ?>
- >
- ID );
- $pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
- if ( $left )
- echo '
';
- comments_number(" ', " ', " ');
- if ( $left )
- echo ' ';
- ?>
-
-
- >
-
- >
-
-
-
-
- 'menu_order') );
-
- if ( ! $pages )
- return false;
- }
-
- /*
- * arrange pages into two parts: top level pages and children_pages
- * children_pages is two dimensional array, eg.
- * children_pages[10][] contains all sub-pages whose parent is 10.
- * It only takes O(N) to arrange this and it takes O(1) for subsequent lookup operations
- * If searching, ignore hierarchy and treat everything as top level
- */
- if ( empty($_GET['s']) ) {
-
- $top_level_pages = array();
- $children_pages = array();
-
- foreach ( $pages as $page ) {
-
- // catch and repair bad pages
- if ( $page->post_parent == $page->ID ) {
- $page->post_parent = 0;
- $wpdb->update($wpdb->posts, array('post_parent' => 0), array('ID' => $page->ID));
- clean_page_cache( $page->ID );
- }
-
- if ( 0 == $page->post_parent )
- $top_level_pages[] = $page;
- else
- $children_pages[ $page->post_parent ][] = $page;
- }
-
- $pages = &$top_level_pages;
- }
-
- $count = 0;
- $start = ($pagenum - 1) * $per_page;
- $end = $start + $per_page;
-
- foreach ( $pages as $page ) {
- if ( $count >= $end )
- break;
-
- if ( $count >= $start )
- echo "\t" . display_page_row( $page, $level );
-
- $count++;
-
- if ( isset($children_pages) )
- _page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
- }
-
- // if it is the last pagenum and there are orphaned pages, display them with paging as well
- if ( isset($children_pages) && $count < $end ){
- foreach( $children_pages as $orphans ){
- foreach ( $orphans as $op ) {
- if ( $count >= $end )
- break;
- if ( $count >= $start )
- echo "\t" . display_page_row( $op, 0 );
- $count++;
- }
- }
- }
-}
-
-/**
- * Given a top level page ID, display the nested hierarchy of sub-pages
- * together with paging support
- *
- * @since unknown
- *
- * @param unknown_type $children_pages
- * @param unknown_type $count
- * @param unknown_type $parent
- * @param unknown_type $level
- * @param unknown_type $pagenum
- * @param unknown_type $per_page
- */
-function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) {
-
- if ( ! isset( $children_pages[$parent] ) )
- return;
-
- $start = ($pagenum - 1) * $per_page;
- $end = $start + $per_page;
-
- foreach ( $children_pages[$parent] as $page ) {
-
- if ( $count >= $end )
- break;
-
- // If the page starts in a subtree, print the parents.
- if ( $count == $start && $page->post_parent > 0 ) {
- $my_parents = array();
- $my_parent = $page->post_parent;
- while ( $my_parent) {
- $my_parent = get_post($my_parent);
- $my_parents[] = $my_parent;
- if ( !$my_parent->post_parent )
- break;
- $my_parent = $my_parent->post_parent;
- }
- $num_parents = count($my_parents);
- while( $my_parent = array_pop($my_parents) ) {
- echo "\t" . display_page_row( $my_parent, $level - $num_parents );
- $num_parents--;
- }
- }
-
- if ( $count >= $start )
- echo "\t" . display_page_row( $page, $level );
-
- $count++;
-
- _page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
- }
-
- unset( $children_pages[$parent] ); //required in order to keep track of orphans
-}
-
-/**
- * Generate HTML for a single row on the users.php admin panel.
- *
- * @since 2.1.0
- *
- * @param object $user_object
- * @param string $style Optional. Attributes added to the TR element. Must be sanitized.
- * @param string $role Key for the $wp_roles array.
- * @param int $numposts Optional. Post count to display for this user. Defaults to zero, as in, a new user has made zero posts.
- * @return string
- */
-function user_row( $user_object, $style = '', $role = '', $numposts = 0 ) {
- global $wp_roles;
-
- if ( !( is_object( $user_object) && is_a( $user_object, 'WP_User' ) ) )
- $user_object = new WP_User( (int) $user_object );
- $user_object = sanitize_user_object($user_object, 'display');
- $email = $user_object->user_email;
- $url = $user_object->user_url;
- $short_url = str_replace( 'http://', '', $url );
- $short_url = str_replace( 'www.', '', $short_url );
- if ('/' == substr( $short_url, -1 ))
- $short_url = substr( $short_url, 0, -1 );
- if ( strlen( $short_url ) > 35 )
- $short_url = substr( $short_url, 0, 32 ).'...';
- $checkbox = '';
- // Check if the user for this row is editable
- if ( current_user_can( 'list_users' ) ) {
- // Set up the user editing link
- // TODO: make profile/user-edit determination a separate function
- if ( get_current_user_id() == $user_object->ID) {
- $edit_link = 'profile.php';
- } else {
- $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( esc_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), "user-edit.php?user_id=$user_object->ID" ) );
- }
- $edit = "
$user_object->user_login ";
-
- // Set up the hover actions for this user
- $actions = array();
-
- if ( current_user_can('edit_user', $user_object->ID) ) {
- $edit = "
$user_object->user_login ";
- $actions['edit'] = '
' . __('Edit') . ' ';
- } else {
- $edit = "
$user_object->user_login ";
- }
-
- if ( !is_multisite() && get_current_user_id() != $user_object->ID && current_user_can('delete_user', $user_object->ID) )
- $actions['delete'] = "
" . __('Delete') . " ";
- if ( is_multisite() && get_current_user_id() != $user_object->ID && current_user_can('remove_user', $user_object->ID) )
- $actions['remove'] = "
" . __('Remove') . " ";
- $actions = apply_filters('user_row_actions', $actions, $user_object);
- $action_count = count($actions);
- $i = 0;
- $edit .= '
';
- foreach ( $actions as $action => $link ) {
- ++$i;
- ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
- $edit .= "$link$sep ";
- }
- $edit .= '
';
-
- // Set up the checkbox (because the user is editable, otherwise its empty)
- $checkbox = "
";
-
- } else {
- $edit = '
' . $user_object->user_login . ' ';
- }
- $role_name = isset($wp_roles->role_names[$role]) ? translate_user_role($wp_roles->role_names[$role] ) : __('None');
- $r = "
";
- $columns = get_column_headers('users');
- $hidden = get_hidden_columns('users');
- $avatar = get_avatar( $user_object->ID, 32 );
- foreach ( $columns as $column_name => $column_display_name ) {
- $class = "class=\"$column_name column-$column_name\"";
-
- $style = '';
- if ( in_array($column_name, $hidden) )
- $style = ' style="display:none;"';
-
- $attributes = "$class$style";
-
- switch ($column_name) {
- case 'cb':
- $r .= "$checkbox ";
- break;
- case 'username':
- $r .= "$avatar $edit ";
- break;
- case 'name':
- $r .= "$user_object->first_name $user_object->last_name ";
- break;
- case 'email':
- $r .= "$email ";
- break;
- case 'role':
- $r .= "$role_name ";
- break;
- case 'posts':
- $attributes = 'class="posts column-posts num"' . $style;
- $r .= "";
- if ( $numposts > 0 ) {
- $r .= "";
- $r .= $numposts;
- $r .= ' ';
- } else {
- $r .= 0;
- }
- $r .= " ";
- break;
- default:
- $r .= "";
- $r .= apply_filters('manage_users_custom_column', '', $column_name, $user_object->ID);
- $r .= " ";
- }
- }
- $r .= ' ';
-
- return $r;
+ foreach ( $categories as $category ) {
+ $cat_id = $category->term_id;
+ $name = esc_html( apply_filters( 'the_category', $category->name ) );
+ $checked = in_array( $cat_id, $checked_categories ) ? ' checked="checked"' : '';
+ echo '
', $name, "";
+ }
}
/**
- * {@internal Missing Short Description}}
+ * Get the column headers for a screen
*
- * @since unknown
+ * @since 2.7.0
*
- * @param string $status Comment status (approved, spam, trash, etc)
- * @param string $s Term to search for
- * @param int $start Offset to start at for pagination
- * @param int $num Maximum number of comments to return
- * @param int $post Post ID or 0 to return all comments
- * @param string $type Comment type (comment, trackback, pingback, etc)
- * @return array [0] contains the comments and [1] contains the total number of comments that match (ignoring $start and $num)
+ * @param string|object $screen The screen you want the headers for
+ * @return array Containing the headers in the format id => UI String
*/
-function _wp_get_comment_list( $status = '', $s = false, $start, $num, $post = 0, $type = '' ) {
- global $wpdb;
-
- $start = abs( (int) $start );
- $num = (int) $num;
- $post = (int) $post;
- $count = wp_count_comments();
- $index = '';
-
- if ( 'moderated' == $status ) {
- $approved = "c.comment_approved = '0'";
- $total = $count->moderated;
- } elseif ( 'approved' == $status ) {
- $approved = "c.comment_approved = '1'";
- $total = $count->approved;
- } elseif ( 'spam' == $status ) {
- $approved = "c.comment_approved = 'spam'";
- $total = $count->spam;
- } elseif ( 'trash' == $status ) {
- $approved = "c.comment_approved = 'trash'";
- $total = $count->trash;
- } else {
- $approved = "( c.comment_approved = '0' OR c.comment_approved = '1' )";
- $total = $count->moderated + $count->approved;
- $index = 'USE INDEX (c.comment_date_gmt)';
- }
-
- if ( $post ) {
- $total = '';
- $post = " AND c.comment_post_ID = '$post'";
- } else {
- $post = '';
- }
+function get_column_headers( $screen ) {
+ if ( is_string( $screen ) )
+ $screen = convert_to_screen( $screen );
- $orderby = "ORDER BY c.comment_date_gmt DESC LIMIT $start, $num";
+ global $_wp_column_headers;
- if ( 'comment' == $type )
- $typesql = "AND c.comment_type = ''";
- elseif ( 'pings' == $type )
- $typesql = "AND ( c.comment_type = 'pingback' OR c.comment_type = 'trackback' )";
- elseif ( 'all' == $type )
- $typesql = '';
- elseif ( !empty($type) )
- $typesql = $wpdb->prepare("AND c.comment_type = %s", $type);
- else
- $typesql = '';
-
- if ( !empty($type) )
- $total = '';
-
- $query = "FROM $wpdb->comments c LEFT JOIN $wpdb->posts p ON c.comment_post_ID = p.ID WHERE p.post_status != 'trash' ";
- if ( $s ) {
- $total = '';
- $s = $wpdb->escape($s);
- $query .= "AND
- (c.comment_author LIKE '%$s%' OR
- c.comment_author_email LIKE '%$s%' OR
- c.comment_author_url LIKE ('%$s%') OR
- c.comment_author_IP LIKE ('%$s%') OR
- c.comment_content LIKE ('%$s%') ) AND
- $approved
- $typesql";
- } else {
- $query .= "AND $approved $post $typesql";
+ if ( !isset( $_wp_column_headers[ $screen->id ] ) ) {
+ $_wp_column_headers[ $screen->id ] = apply_filters( 'manage_' . $screen->id . '_columns', array() );
}
- $comments = $wpdb->get_results("SELECT * $query $orderby");
- if ( '' === $total )
- $total = $wpdb->get_var("SELECT COUNT(c.comment_ID) $query");
+ return $_wp_column_headers[ $screen->id ];
+}
- update_comment_cache($comments);
+/**
+ * Get a list of hidden columns.
+ *
+ * @since 2.7.0
+ *
+ * @param string|object $screen The screen you want the hidden columns for
+ * @return array
+ */
+function get_hidden_columns( $screen ) {
+ if ( is_string( $screen ) )
+ $screen = convert_to_screen( $screen );
- return array($comments, $total);
+ return (array) get_user_option( 'manage' . $screen->id . 'columnshidden' );
}
+// adds hidden fields with the data for use in the inline editor for posts and pages
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.7.0
*
- * @param unknown_type $comment_id
- * @param unknown_type $mode
- * @param unknown_type $comment_status
- * @param unknown_type $checkbox
+ * @param unknown_type $post
*/
-function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true, $from_ajax = false ) {
- global $comment, $post, $_comment_pending_count;
- $comment = get_comment( $comment_id );
- $post = get_post($comment->comment_post_ID);
- $the_comment_status = wp_get_comment_status($comment->comment_ID);
+function get_inline_data($post) {
$post_type_object = get_post_type_object($post->post_type);
- $user_can = current_user_can($post_type_object->cap->edit_post, $post->ID);
-
- $comment_url = esc_url(get_comment_link($comment->comment_ID));
- $author_url = get_comment_author_url();
- if ( 'http://' == $author_url )
- $author_url = '';
- $author_url_display = preg_replace('|http://(www\.)?|i', '', $author_url);
- if ( strlen($author_url_display) > 50 )
- $author_url_display = substr($author_url_display, 0, 49) . '...';
-
- $ptime = date('G', strtotime( $comment->comment_date ) );
- if ( ( abs(time() - $ptime) ) < 86400 )
- $ptime = sprintf( __('%s ago'), human_time_diff( $ptime ) );
- else
- $ptime = mysql2date(__('Y/m/d \a\t g:i A'), $comment->comment_date );
-
- if ( $user_can ) {
- $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) );
- $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) );
-
- $approve_url = esc_url( "comment.php?action=approvecomment&p=$post->ID&c=$comment->comment_ID&$approve_nonce" );
- $unapprove_url = esc_url( "comment.php?action=unapprovecomment&p=$post->ID&c=$comment->comment_ID&$approve_nonce" );
- $spam_url = esc_url( "comment.php?action=spamcomment&p=$post->ID&c=$comment->comment_ID&$del_nonce" );
- $unspam_url = esc_url( "comment.php?action=unspamcomment&p=$post->ID&c=$comment->comment_ID&$del_nonce" );
- $trash_url = esc_url( "comment.php?action=trashcomment&p=$post->ID&c=$comment->comment_ID&$del_nonce" );
- $untrash_url = esc_url( "comment.php?action=untrashcomment&p=$post->ID&c=$comment->comment_ID&$del_nonce" );
- $delete_url = esc_url( "comment.php?action=deletecomment&p=$post->ID&c=$comment->comment_ID&$del_nonce" );
- }
+ if ( ! current_user_can($post_type_object->cap->edit_post, $post->ID) )
+ return;
- echo "\n";
+ echo '
';
}
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.7.0
*
* @param unknown_type $position
* @param unknown_type $checkbox
@@ -2231,14 +331,16 @@ function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single',
return;
}
- $columns = get_column_headers('edit-comments');
- $hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns('edit-comments') ) );
- $col_count = count($columns) - count($hidden);
+ if ( $mode == 'single' ) {
+ $wp_list_table = _get_list_table('WP_Post_Comments_List_Table');
+ } else {
+ $wp_list_table = _get_list_table('WP_Comments_List_Table');
+ }
?>
-
+
@@ -2469,7 +573,7 @@ function meta_form() {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 0.71
*
* @param unknown_type $edit
* @param unknown_type $for_post
@@ -2543,7 +647,7 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 1.5.0
*
* @param unknown_type $default
*/
@@ -2562,7 +666,7 @@ function page_template_dropdown( $default = '' ) {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 1.5.0
*
* @param unknown_type $default
* @param unknown_type $parent
@@ -2598,7 +702,7 @@ function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.0.0
*
* @param unknown_type $id
* @return unknown
@@ -2620,7 +724,7 @@ function the_attachment_links( $id = false ) {
-
+
@@ -2648,14 +752,11 @@ function the_attachment_links( $id = false ) {
/**
- * Print out html elements for role selectors based on $wp_roles
+ * Print out html elements for role selectors
*
- * @package WordPress
- * @subpackage Administration
- * @since 2.1
+ * @since 2.1.0
*
- * @uses $wp_roles
- * @param string $default slug for the role that should be already selected
+ * @param string $selected slug for the role that should be already selected
*/
function wp_dropdown_roles( $selected = false ) {
$p = '';
@@ -2665,7 +766,7 @@ function wp_dropdown_roles( $selected = false ) {
foreach ( $editable_roles as $role => $details ) {
$name = translate_user_role($details['name'] );
- if ( $selected == $role ) // Make default first in list
+ if ( $selected == $role ) // preselect specified role
$p = "\n\t $name ";
else
$r .= "\n\t$name ";
@@ -2676,7 +777,7 @@ function wp_dropdown_roles( $selected = false ) {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.3.0
*
* @param unknown_type $size
* @return unknown
@@ -2696,7 +797,7 @@ function wp_convert_hr_to_bytes( $size ) {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.3.0
*
* @param unknown_type $bytes
* @return unknown
@@ -2712,7 +813,7 @@ function wp_convert_bytes_to_hr( $bytes ) {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.5.0
*
* @return unknown
*/
@@ -2726,7 +827,7 @@ function wp_max_upload_size() {
/**
* Outputs the form used by the importers to accept the data to be imported
*
- * @since 2.0
+ * @since 2.0.0
*
* @param string $action The action attribute for the form.
*/
@@ -2746,9 +847,7 @@ function wp_import_upload_form( $action ) {
-
-
-
+
' . "\n";
- echo '
';
+ echo '
';
echo "{$box['title']} \n";
echo '' . "\n";
call_user_func($box['callback'], $object, $box);
@@ -2901,7 +1000,7 @@ function remove_meta_box($id, $page, $context) {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.7.0
*
* @param unknown_type $screen
*/
@@ -2936,7 +1035,7 @@ function meta_box_prefs($screen) {
/**
* Get Hidden Meta Boxes
*
- * @since 2.7
+ * @since 2.7.0
*
* @param string|object $screen Screen identifier
* @return array Hidden Meta Boxes
@@ -2948,8 +1047,13 @@ function get_hidden_meta_boxes( $screen ) {
$hidden = get_user_option( "metaboxhidden_{$screen->id}" );
// Hide slug boxes by default
- if ( !is_array( $hidden ) )
- $hidden = array('slugdiv');
+ if ( !is_array( $hidden ) ) {
+ if ( 'post' == $screen->base || 'page' == $screen->base )
+ $hidden = array('slugdiv', 'trackbacksdiv', 'postcustom', 'postexcerpt', 'commentstatusdiv', 'commentsdiv', 'authordiv', 'revisionsdiv');
+ else
+ $hidden = array( 'slugdiv' );
+ $hidden = apply_filters('default_hidden_meta_boxes', $hidden, $screen);
+ }
return $hidden;
}
@@ -3041,7 +1145,7 @@ function add_settings_field($id, $title, $callback, $page, $section = 'default',
*
* @global $wp_settings_sections Storage array of all settings sections added to admin pages
* @global $wp_settings_fields Storage array of settings fields and info about their pages/sections
- * @since unknown
+ * @since 2.7.0
*
* @param string $page The slug name of the page whos settings sections you want to output
*/
@@ -3071,7 +1175,7 @@ function do_settings_sections($page) {
*
* @global $wp_settings_fields Storage array of settings fields and their pages/sections
*
- * @since unknown
+ * @since 2.7.0
*
* @param string $page Slug title of the admin page who's settings fields you want to show.
* @param section $section Slug title of the settings section who's fields you want to show.
@@ -3108,6 +1212,8 @@ function do_settings_fields($page, $section) {
* Additional calls to settings_errors() can be used to show errors even when the settings
* page is first accessed.
*
+ * @since 3.0.0
+ *
* @global array $wp_settings_errors Storage array of errors registered during this pageload
*
* @param string $setting Slug title of the setting to which this error applies
@@ -3136,7 +1242,7 @@ function add_settings_error( $setting, $code, $message, $type = 'error' ) {
* Checks the $wp_settings_errors array for any errors declared during the current
* pageload and returns them.
*
- * If changes were just submitted ($_GET['updated']) and settings errors were saved
+ * If changes were just submitted ($_GET['settings-updated']) and settings errors were saved
* to the 'settings_errors' transient then those errors will be returned instead. This
* is used to pass errors back across pageloads.
*
@@ -3144,6 +1250,8 @@ function add_settings_error( $setting, $code, $message, $type = 'error' ) {
* This is useful if you have errors or notices you want to show even when the user
* hasn't submitted data (i.e. when they first load an options page, or in admin_notices action hook)
*
+ * @since 3.0.0
+ *
* @global array $wp_settings_errors Storage array of errors registered during this pageload
*
* @param string $setting Optional slug title of a specific setting who's errors you want.
@@ -3161,7 +1269,7 @@ function get_settings_errors( $setting = '', $sanitize = FALSE ) {
// If settings were passed back from options.php then use them
// Ignore transients if $sanitize is true, we dont' want the old values anyway
- if ( isset($_GET['updated']) && $_GET['updated'] && get_transient('settings_errors') ) {
+ if ( isset($_GET['settings-updated']) && $_GET['settings-updated'] && get_transient('settings_errors') ) {
$settings_errors = get_transient('settings_errors');
delete_transient('settings_errors');
// Otherwise check global in case validation has been run on this pageload
@@ -3196,14 +1304,15 @@ function get_settings_errors( $setting = '', $sanitize = FALSE ) {
* shown in the default error reporting after submission. This is useful to show general errors like missing
* settings when the user arrives at the settings page.
*
+ * @since 3.0.0
+ *
* @param string $setting Optional slug title of a specific setting who's errors you want.
* @param boolean $sanitize Whether to re-sanitize the setting value before returning errors.
* @param boolean $hide_on_update If set to true errors will not be shown if the settings page has already been submitted.
- * @return
*/
-function settings_errors ( $setting = '', $sanitize = FALSE, $hide_on_update = FALSE ) {
+function settings_errors( $setting = '', $sanitize = FALSE, $hide_on_update = FALSE ) {
- if ($hide_on_update AND $_GET['updated']) return;
+ if ($hide_on_update AND $_GET['settings-updated']) return;
$settings_errors = get_settings_errors( $setting, $sanitize );
@@ -3223,35 +1332,7 @@ function settings_errors ( $setting = '', $sanitize = FALSE, $hide_on_update = F
/**
* {@internal Missing Short Description}}
*
- * @since unknown
- *
- * @param unknown_type $page
- */
-function manage_columns_prefs( $page ) {
- $columns = get_column_headers( $page );
- $hidden = get_hidden_columns( $page );
- $special = array('_title', 'cb', 'comment', 'media', 'name', 'title', 'username');
-
- foreach ( $columns as $column => $title ) {
- // Can't hide these or they are special
- if ( in_array( $column, $special ) )
- continue;
- if ( empty( $title ) )
- continue;
-
- if ( 'comments' == $column )
- $title = __( 'Comments' );
- $id = "$column-hide";
- echo '';
- echo ' ';
- echo "$title \n";
- }
-}
-
-/**
- * {@internal Missing Short Description}}
- *
- * @since unknown
+ * @since 2.7.0
*
* @param unknown_type $found_action
*/
@@ -3269,7 +1350,7 @@ function find_posts_div($found_action = '') {
-
+
true), 'objects' );
@@ -3285,8 +1366,8 @@ function find_posts_div($found_action = '') {
-
-
+
+
is_user )
+ return;
+
if ( isset($screen->post_type) ) {
$post_type_object = get_post_type_object($screen->post_type);
if ( 'add' != $screen->action )
@@ -3326,58 +1410,69 @@ function favorite_actions( $screen = null ) {
}
if ( !$default_action ) {
- switch ( $screen->id ) {
- case 'upload':
- $default_action = array('media-new.php' => array(__('New Media'), 'upload_files'));
- break;
- case 'media':
- $default_action = array('upload.php' => array(__('Edit Media'), 'upload_files'));
- break;
- case 'link-manager':
- case 'link':
- if ( 'add' != $screen->action )
- $default_action = array('link-add.php' => array(__('New Link'), 'manage_links'));
- else
- $default_action = array('link-manager.php' => array(__('Edit Links'), 'manage_links'));
- break;
- case 'users':
- $default_action = array('user-new.php' => array(__('New User'), 'create_users'));
- break;
- case 'user':
- $default_action = array('users.php' => array(__('Edit Users'), 'edit_users'));
- break;
- case 'plugins':
- $default_action = array('plugin-install.php' => array(__('Install Plugins'), 'install_plugins'));
- break;
- case 'plugin-install':
- $default_action = array('plugins.php' => array(__('Manage Plugins'), 'activate_plugins'));
- break;
- case 'themes':
- $default_action = array('theme-install.php' => array(__('Install Themes'), 'install_themes'));
- break;
- case 'theme-install':
- $default_action = array('themes.php' => array(__('Manage Themes'), 'switch_themes'));
- break;
- default:
- $default_action = array('post-new.php' => array(__('New Post'), 'edit_posts'));
- break;
+ if ( $screen->is_network ) {
+ $default_action = array('sites.php' => array( __('Sites'), 'manage_sites'));
+ } else {
+ switch ( $screen->id ) {
+ case 'upload':
+ $default_action = array('media-new.php' => array(__('New Media'), 'upload_files'));
+ break;
+ case 'media':
+ $default_action = array('upload.php' => array(__('Edit Media'), 'upload_files'));
+ break;
+ case 'link-manager':
+ case 'link':
+ if ( 'add' != $screen->action )
+ $default_action = array('link-add.php' => array(__('New Link'), 'manage_links'));
+ else
+ $default_action = array('link-manager.php' => array(__('Edit Links'), 'manage_links'));
+ break;
+ case 'users':
+ $default_action = array('user-new.php' => array(__('New User'), 'create_users'));
+ break;
+ case 'user':
+ $default_action = array('users.php' => array(__('Edit Users'), 'edit_users'));
+ break;
+ case 'plugins':
+ $default_action = array('plugin-install.php' => array(__('Install Plugins'), 'install_plugins'));
+ break;
+ case 'plugin-install':
+ $default_action = array('plugins.php' => array(__('Manage Plugins'), 'activate_plugins'));
+ break;
+ case 'themes':
+ $default_action = array('theme-install.php' => array(__('Install Themes'), 'install_themes'));
+ break;
+ case 'theme-install':
+ $default_action = array('themes.php' => array(__('Manage Themes'), 'switch_themes'));
+ break;
+ default:
+ $default_action = array('post-new.php' => array(__('New Post'), 'edit_posts'));
+ break;
+ }
}
}
- $actions = array(
- 'post-new.php' => array(__('New Post'), 'edit_posts'),
- 'edit.php?post_status=draft' => array(__('Drafts'), 'edit_posts'),
- 'post-new.php?post_type=page' => array(__('New Page'), 'edit_pages'),
- 'media-new.php' => array(__('Upload'), 'upload_files'),
- 'edit-comments.php' => array(__('Comments'), 'moderate_comments')
+ if ( !$screen->is_network ) {
+ $actions = array(
+ 'post-new.php' => array(__('New Post'), 'edit_posts'),
+ 'edit.php?post_status=draft' => array(__('Drafts'), 'edit_posts'),
+ 'post-new.php?post_type=page' => array(__('New Page'), 'edit_pages'),
+ 'media-new.php' => array(__('Upload'), 'upload_files'),
+ 'edit-comments.php' => array(__('Comments'), 'moderate_comments')
+ );
+ } else {
+ $actions = array(
+ 'sites.php' => array( __('Sites'), 'manage_sites'),
+ 'users.php' => array( __('Users'), 'manage_network_users')
);
+ }
$default_key = array_keys($default_action);
$default_key = $default_key[0];
if ( isset($actions[$default_key]) )
unset($actions[$default_key]);
$actions = array_merge($default_action, $actions);
- $actions = apply_filters('favorite_actions', $actions);
+ $actions = apply_filters( 'favorite_actions', $actions, $screen );
$allowed_actions = array();
foreach ( $actions as $action => $data ) {
@@ -3411,10 +1506,10 @@ function favorite_actions( $screen = null ) {
* returned.
*
* @since 2.7.0
- * @param int $id The post id. If not supplied the global $post is used.
- *
+ * @param int $post_id The post id. If not supplied the global $post is used.
+ * @return string The post title if set
*/
-function _draft_or_post_title($post_id = 0) {
+function _draft_or_post_title( $post_id = 0 ) {
$title = get_the_title($post_id);
if ( empty($title) )
$title = __('(no title)');
@@ -3432,7 +1527,7 @@ function _draft_or_post_title($post_id = 0) {
*
*/
function _admin_search_query() {
- echo isset($_GET['s']) ? esc_attr( stripslashes( $_GET['s'] ) ) : '';
+ echo isset($_REQUEST['s']) ? esc_attr( stripslashes( $_REQUEST['s'] ) ) : '';
}
/**
@@ -3444,7 +1539,11 @@ function _admin_search_query() {
*
*/
function iframe_header( $title = '', $limit_styles = false ) {
-global $hook_suffix;
+ show_admin_bar( false );
+ global $hook_suffix, $current_screen, $current_user, $admin_body_class, $wp_locale;
+ $admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
+ $admin_body_class .= ' iframe';
+
?>
>
@@ -3460,14 +1559,28 @@ wp_enqueue_style( 'colors' );
//',
+ 'uid': 'ID; ?>',
+ 'time':''
+ },
+ ajaxurl = '',
+ pagenow = 'id; ?>',
+ typenow = 'post_type) ) echo $current_screen->post_type; ?>',
+ adminpage = '',
+ thousandsSeparator = 'number_format['thousands_sep'] ); ?>',
+ decimalPoint = 'number_format['decimal_point'] ); ?>',
+ isRtl = ;
//]]>
class="no-js ">
@@ -3533,6 +1646,9 @@ function _post_states($post) {
echo "$state$sep ";
}
}
+
+ if ( get_post_format( $post->ID ) )
+ echo ' - ' . get_post_format_string( get_post_format( $post->ID ) ) . ' ';
}
/**
@@ -3544,19 +1660,27 @@ function _post_states($post) {
* @return object An object containing the safe screen name and id
*/
function convert_to_screen( $screen ) {
- $screen = str_replace( array('.php', '-new', '-add' ), '', $screen);
+ $screen = str_replace( array('.php', '-new', '-add', '-network', '-user' ), '', $screen);
+
+ if ( is_network_admin() )
+ $screen .= '-network';
+ elseif ( is_user_admin() )
+ $screen .= '-user';
+
$screen = (string) apply_filters( 'screen_meta_screen', $screen );
$screen = (object) array('id' => $screen, 'base' => $screen);
return $screen;
}
function screen_meta($screen) {
- global $wp_meta_boxes, $_wp_contextual_help, $title;
+ global $wp_meta_boxes, $_wp_contextual_help, $wp_list_table, $wp_current_screen_options;
if ( is_string($screen) )
$screen = convert_to_screen($screen);
- $column_screens = get_column_headers($screen);
+ $columns = get_column_headers( $screen );
+ $hidden = get_hidden_columns( $screen );
+
$meta_screens = array('index' => 'dashboard');
if ( isset($meta_screens[$screen->id]) ) {
@@ -3565,7 +1689,7 @@ function screen_meta($screen) {
}
$show_screen = false;
- if ( !empty($wp_meta_boxes[$screen->id]) || !empty($column_screens) )
+ if ( !empty($wp_meta_boxes[$screen->id]) || !empty($columns) )
$show_screen = true;
$screen_options = screen_options($screen);
@@ -3583,8 +1707,12 @@ function screen_meta($screen) {
$show_screen = true;
break;
}
- if( ! empty( $settings ) )
+ if ( ! empty( $settings ) )
$show_screen = true;
+
+ if ( !empty($wp_current_screen_options) )
+ $show_screen = true;
+
?>
@@ -3597,10 +1725,27 @@ function screen_meta($screen) {
-
+ if ( ! empty($columns) ) : ?>
+
-
+ $title ) {
+ // Can't hide these for they are special
+ if ( in_array( $column, $special ) )
+ continue;
+ if ( empty( $title ) )
+ continue;
+
+ if ( 'comments' == $column )
+ $title = __( 'Comments' );
+ $id = "$column-hide";
+ echo '';
+ echo ' ';
+ echo "$title \n";
+ }
+?>
id] = $help;
}
-function drag_drop_help() {
- return '
- ' . __('Most of the modules on this screen can be moved. If you hover your mouse over the title bar of a module you’ll notice the 4 arrow cursor appears to let you know it is movable. Click on it, hold down the mouse button and start dragging the module to a new location. As you drag the module, notice the dotted gray box that also moves. This box indicates where the module will be placed when you release the mouse button.') . '
- ' . __('The same modules can be expanded and collapsed by clicking once on their title bar and also completely hidden from the Screen Options tab.') . '
-';
-}
-
-function plugins_search_help() {
- return '
- ' . __('Search help') . '
' .
- '' . __('You may search based on 3 criteria:') . ' ' .
- __('Term: Searches theme names and descriptions for the specified term.') . ' ' .
- __('Tag: Searches for themes tagged as such.') . ' ' .
- __('Author: Searches for themes created by the Author, or which the Author contributed to.') . '
-';
-}
-
function screen_layout($screen) {
- global $screen_layout_columns;
+ global $screen_layout_columns, $wp_current_screen_options;
if ( is_string($screen) )
$screen = convert_to_screen($screen);
- $columns = array('dashboard' => 4, 'link' => 2);
-
- // Add custom post types
- foreach ( get_post_types( array('show_ui' => true) ) as $post_type )
- $columns[$post_type] = 2;
-
- $columns = apply_filters('screen_layout_columns', $columns, $screen->id, $screen);
+ // Back compat for plugins using the filter instead of add_screen_option()
+ $columns = apply_filters('screen_layout_columns', array(), $screen->id, $screen);
+ if ( !empty($columns) && isset($columns[$screen->id]) )
+ add_screen_option('layout_columns', array('max' => $columns[$screen->id]) );
- if ( !isset($columns[$screen->id]) ) {
+ if ( !isset($wp_current_screen_options['layout_columns']) ) {
$screen_layout_columns = 0;
return '';
- }
+ }
$screen_layout_columns = get_user_option("screen_layout_$screen->id");
- $num = $columns[$screen->id];
+ $num = $wp_current_screen_options['layout_columns']['max'];
- if ( ! $screen_layout_columns )
+ if ( ! $screen_layout_columns ) {
+ if ( isset($wp_current_screen_options['layout_columns']['default']) )
+ $screen_layout_columns = $wp_current_screen_options['layout_columns']['default'];
+ else
$screen_layout_columns = 2;
+ }
$i = 1;
$return = '' . __('Screen Layout') . " \n" . __('Number of Columns:') . "\n";
@@ -3726,54 +1855,45 @@ function screen_layout($screen) {
return $return;
}
+/**
+ * Register and configure an admin screen option
+ *
+ * @since 3.1.0
+ *
+ * @param string $option An option name.
+ * @param mixed $args Option dependent arguments
+ * @return void
+ */
+function add_screen_option( $option, $args = array() ) {
+ global $wp_current_screen_options;
+
+ if ( !isset($wp_current_screen_options) )
+ $wp_current_screen_options = array();
+
+ $wp_current_screen_options[$option] = $args;
+}
+
function screen_options($screen) {
+ global $wp_current_screen_options;
+
if ( is_string($screen) )
$screen = convert_to_screen($screen);
- switch ( $screen->base ) {
- case 'edit':
- case 'edit-pages':
- $post_type = 'post';
- if ( isset($_GET['post_type']) && in_array( $_GET['post_type'], get_post_types( array('public' => true ) ) ) )
- $post_type = $_GET['post_type'];
- $post_type_object = get_post_type_object($post_type);
- $per_page_label = $post_type_object->labels->name;
- break;
- case 'ms-sites':
- $per_page_label = _x( 'Sites', 'sites per page (screen options)' );
- break;
- case 'ms-users':
- $per_page_label = _x( 'Users', 'users per page (screen options)' );
- break;
- case 'edit-comments':
- $per_page_label = _x( 'Comments', 'comments per page (screen options)' );
- break;
- case 'upload':
- $per_page_label = _x( 'Media items', 'items per page (screen options)' );
- break;
- case 'edit-tags':
- global $tax;
- $per_page_label = $tax->labels->name;
- break;
- case 'plugins':
- $per_page_label = _x( 'Plugins', 'plugins per page (screen options)' );
- break;
- default:
- return '';
- }
+ if ( !isset($wp_current_screen_options['per_page']) )
+ return '';
+
+ $per_page_label = $wp_current_screen_options['per_page']['label'];
- $option = str_replace( '-', '_', "{$screen->id}_per_page" );
- if ( 'edit_tags_per_page' == $option ) {
- if ( 'category' == $tax->name )
- $option = 'categories_per_page';
- elseif ( 'post_tag' != $tax->name )
- $option = 'edit_' . $tax->name . '_per_page';
+ if ( empty($wp_current_screen_options['per_page']['option']) ) {
+ $option = str_replace( '-', '_', "{$screen->id}_per_page" );
+ } else {
+ $option = $wp_current_screen_options['per_page']['option'];
}
$per_page = (int) get_user_option( $option );
if ( empty( $per_page ) || $per_page < 1 ) {
- if ( 'plugins' == $screen->id )
- $per_page = 999;
+ if ( isset($wp_current_screen_options['per_page']['default']) )
+ $per_page = $wp_current_screen_options['per_page']['default'];
else
$per_page = 20;
}
@@ -3785,23 +1905,29 @@ function screen_options($screen) {
else
$per_page = apply_filters( $option, $per_page );
+ // Back compat
+ if ( isset( $screen->post_type ) )
+ $per_page = apply_filters( 'edit_posts_per_page', $per_page, $screen->post_type );
+
$return = "
\n";
if ( !empty($per_page_label) )
$return .= " $per_page_label \n";
- $return .= " ";
+ $return .= get_submit_button( __( 'Apply' ), 'button', 'screen-options-apply', false );
$return .= " ";
$return .= "
\n";
return $return;
}
function screen_icon($screen = '') {
- global $current_screen;
+ global $current_screen, $typenow;
if ( empty($screen) )
$screen = $current_screen;
elseif ( is_string($screen) )
$name = $screen;
+ $class = 'icon32';
+
if ( empty($name) ) {
if ( !empty($screen->parent_base) )
$name = $screen->parent_base;
@@ -3810,10 +1936,18 @@ function screen_icon($screen = '') {
if ( 'edit' == $name && isset($screen->post_type) && 'page' == $screen->post_type )
$name = 'edit-pages';
+
+ $post_type = '';
+ if ( isset( $screen->post_type ) )
+ $post_type = $screen->post_type;
+ elseif ( $current_screen == $screen )
+ $post_type = $typenow;
+ if ( $post_type )
+ $class .= ' ' . sanitize_html_class( 'icon32-posts-' . $post_type );
}
?>
-
+
taxonomy = $taxnow;
}
+ $current_screen->is_network = is_network_admin();
+ $current_screen->is_user = is_user_admin();
+
+ if ( $current_screen->is_network ) {
+ $current_screen->base .= '-network';
+ $current_screen->id .= '-network';
+ } elseif ( $current_screen->is_user ) {
+ $current_screen->base .= '-user';
+ $current_screen->id .= '-user';
+ }
+
$current_screen = apply_filters('current_screen', $current_screen);
}
-?>
+/**
+ * Echos a submit button, with provided text and appropriate class
+ *
+ * @since 3.1.0
+ *
+ * @param string $text The text of the button (defaults to 'Save Changes')
+ * @param string $type The type of button. One of: primary, secondary, delete
+ * @param string $name The HTML name of the submit button. Defaults to "submit". If no id attribute
+ * is given in $other_attributes below, $name will be used as the button's id.
+ * @param bool $wrap True if the output button should be wrapped in a paragraph tag,
+ * false otherwise. Defaults to true
+ * @param array|string $other_attributes Other attributes that should be output with the button,
+ * mapping attributes to their values, such as array( 'tabindex' => '1' ).
+ * These attributes will be ouput as attribute="value", such as tabindex="1".
+ * Defaults to no other attributes. Other attributes can also be provided as a
+ * string such as 'tabindex="1"', though the array format is typically cleaner.
+ */
+function submit_button( $text = NULL, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = NULL ) {
+ echo get_submit_button( $text, $type, $name, $wrap, $other_attributes );
+}
+
+/**
+ * Returns a submit button, with provided text and appropriate class
+ *
+ * @since 3.1.0
+ *
+ * @param string $text The text of the button (defaults to 'Save Changes')
+ * @param string $type The type of button. One of: primary, secondary, delete
+ * @param string $name The HTML name of the submit button. Defaults to "submit". If no id attribute
+ * is given in $other_attributes below, $name will be used as the button's id.
+ * @param bool $wrap True if the output button should be wrapped in a paragraph tag,
+ * false otherwise. Defaults to true
+ * @param array|string $other_attributes Other attributes that should be output with the button,
+ * mapping attributes to their values, such as array( 'tabindex' => '1' ).
+ * These attributes will be ouput as attribute="value", such as tabindex="1".
+ * Defaults to no other attributes. Other attributes can also be provided as a
+ * string such as 'tabindex="1"', though the array format is typically cleaner.
+ */
+function get_submit_button( $text = NULL, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = NULL ) {
+ switch ( $type ) :
+ case 'primary' :
+ case 'secondary' :
+ $class = 'button-' . $type;
+ break;
+ case 'delete' :
+ $class = 'button-secondary delete';
+ break;
+ default :
+ $class = $type; // Custom cases can just pass in the classes they want to be used
+ endswitch;
+ $text = ( NULL == $text ) ? __( 'Save Changes' ) : $text;
+
+ // Default the id attribute to $name unless an id was specifically provided in $other_attributes
+ $id = $name;
+ if ( is_array( $other_attributes ) && isset( $other_attributes['id'] ) ) {
+ $id = $other_attributes['id'];
+ unset( $other_attributes['id'] );
+ }
+
+ $attributes = '';
+ if ( is_array( $other_attributes ) ) {
+ foreach ( $other_attributes as $attribute => $value ) {
+ $attributes .= $attribute . '="' . esc_attr( $value ) . '" '; // Trailing space is important
+ }
+ } else if ( !empty( $other_attributes ) ) { // Attributes provided as a string
+ $attributes = $other_attributes;
+ }
+
+ $button = '
';
+
+ if ( $wrap ) {
+ $button = '
' . $button . '
';
+ }
+
+ return $button;
+}
+
diff --git a/wp-admin/includes/theme-install.php b/wp-admin/includes/theme-install.php
index ea96ef8b..da7c069e 100644
--- a/wp-admin/includes/theme-install.php
+++ b/wp-admin/includes/theme-install.php
@@ -19,57 +19,13 @@ $theme_field_defaults = array( 'description' => true, 'sections' => false, 'test
'tags' => true, 'num_ratings' => true
);
-
-/**
- * Retrieve theme installer pages from WordPress Themes API.
- *
- * It is possible for a theme to override the Themes API result with three
- * filters. Assume this is for themes, which can extend on the Theme Info to
- * offer more choices. This is very powerful and must be used with care, when
- * overridding the filters.
- *
- * The first filter, 'themes_api_args', is for the args and gives the action as
- * the second parameter. The hook for 'themes_api_args' must ensure that an
- * object is returned.
- *
- * The second filter, 'themes_api', is the result that would be returned.
- *
- * @since 2.8.0
- *
- * @param string $action
- * @param array|object $args Optional. Arguments to serialize for the Theme Info API.
- * @return mixed
- */
-function themes_api($action, $args = null) {
-
- if ( is_array($args) )
- $args = (object)$args;
-
- if ( !isset($args->per_page) )
- $args->per_page = 24;
-
- $args = apply_filters('themes_api_args', $args, $action); //NOTE: Ensure that an object is returned via this filter.
- $res = apply_filters('themes_api', false, $action, $args); //NOTE: Allows a theme to completely override the builtin WordPress.org API.
-
- if ( ! $res ) {
- $request = wp_remote_post('http://api.wordpress.org/themes/info/1.0/', array( 'body' => array('action' => $action, 'request' => serialize($args))) );
- if ( is_wp_error($request) ) {
- $res = new WP_Error('themes_api_failed', __('An Unexpected HTTP Error occured during the API request.
Try again '), $request->get_error_message() );
- } else {
- $res = unserialize($request['body']);
- if ( ! $res )
- $res = new WP_Error('themes_api_failed', __('An unknown error occured'), $request['body']);
- }
- }
- //var_dump(array($args, $res));
- return apply_filters('themes_api_result', $res, $action, $args);
-}
-
/**
* Retrieve list of WordPress theme features (aka theme tags)
*
* @since 2.8.0
*
+ * @deprecated since 3.1.0 Use get_theme_feature_list() instead.
+ *
* @return array
*/
function install_themes_feature_list( ) {
@@ -88,59 +44,6 @@ function install_themes_feature_list( ) {
return $feature_list;
}
-add_action('install_themes_search', 'install_theme_search', 10, 1);
-/**
- * Display theme search results
- *
- * @since 2.8.0
- *
- * @param string $page
- */
-function install_theme_search($page) {
- global $theme_field_defaults;
-
- $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';
- $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';
-
- $args = array();
-
- switch( $type ){
- case 'tag':
- $terms = explode(',', $term);
- $terms = array_map('trim', $terms);
- $terms = array_map('sanitize_title_with_dashes', $terms);
- $args['tag'] = $terms;
- break;
- case 'term':
- $args['search'] = $term;
- break;
- case 'author':
- $args['author'] = $term;
- break;
- }
-
- $args['page'] = $page;
- $args['fields'] = $theme_field_defaults;
-
- if ( !empty( $_POST['features'] ) ) {
- $terms = $_POST['features'];
- $terms = array_map( 'trim', $terms );
- $terms = array_map( 'sanitize_title_with_dashes', $terms );
- $args['tag'] = $terms;
- $_REQUEST['s'] = implode( ',', $terms );
- $_REQUEST['type'] = 'tag';
- }
-
- $api = themes_api('query_themes', $args);
-
- if ( is_wp_error($api) )
- wp_die($api);
-
- add_action('install_themes_table_header', 'install_theme_search_form');
-
- display_themes($api->themes, $api->info['page'], $api->info['pages']);
-}
-
/**
* Display search form for searching themes.
*
@@ -152,19 +55,19 @@ function install_theme_search_form() {
?>
-
+
+
>
>
>
-
+
-
+
';
- $trans = array ('Colors' => __('Colors'), 'black' => __('Black'), 'blue' => __('Blue'), 'brown' => __('Brown'),
- 'green' => __('Green'), 'orange' => __('Orange'), 'pink' => __('Pink'), 'purple' => __('Purple'), 'red' => __('Red'),
- 'silver' => __('Silver'), 'tan' => __('Tan'), 'white' => __('White'), 'yellow' => __('Yellow'), 'dark' => __('Dark'),
- 'light' => __('Light'), 'Columns' => __('Columns'), 'one-column' => __('One Column'), 'two-columns' => __('Two Columns'),
- 'three-columns' => __('Three Columns'), 'four-columns' => __('Four Columns'), 'left-sidebar' => __('Left Sidebar'),
- 'right-sidebar' => __('Right Sidebar'), 'Width' => __('Width'), 'fixed-width' => __('Fixed Width'), 'flexible-width' => __('Flexible Width'),
- 'Features' => __('Features'), 'custom-colors' => __('Custom Colors'), 'custom-header' => __('Custom Header'), 'theme-options' => __('Theme Options'),
- 'threaded-comments' => __('Threaded Comments'), 'sticky-post' => __('Sticky Post'), 'microformats' => __('Microformats'),
- 'Subject' => __('Subject'), 'holiday' => __('Holiday'), 'photoblogging' => __('Photoblogging'), 'seasonal' => __('Seasonal'),
- );
foreach ( (array) $feature_list as $feature_name => $features ) {
- if ( isset($trans[$feature_name]) )
- $feature_name = $trans[$feature_name];
$feature_name = esc_html( $feature_name );
echo '' . $feature_name . '
';
- echo '';
- foreach ( $features as $feature ) {
- $feature_name = $feature;
- if ( isset($trans[$feature]) )
- $feature_name = $trans[$feature];
+ echo '';
+ foreach ( $features as $feature => $feature_name ) {
$feature_name = esc_html( $feature_name );
$feature = esc_attr($feature);
?>
@@ -218,73 +106,24 @@ function install_themes_dashboard() {
-
+
'featured', 'page' => $page, 'fields' => $theme_field_defaults);
- $api = themes_api('query_themes', $args);
- if ( is_wp_error($api) )
- wp_die($api);
- display_themes($api->themes, $api->info['page'], $api->info['pages']);
-}
-
-add_action('install_themes_new', 'install_themes_new', 10, 1);
-/**
- * Display new themes/
- *
- * @since 2.8.0
- *
- * @param string $page
- */
-function install_themes_new($page = 1) {
- global $theme_field_defaults;
- $args = array('browse' => 'new', 'page' => $page, 'fields' => $theme_field_defaults);
- $api = themes_api('query_themes', $args);
- if ( is_wp_error($api) )
- wp_die($api);
- display_themes($api->themes, $api->info['page'], $api->info['pages']);
-}
-
-add_action('install_themes_updated', 'install_themes_updated', 10, 1);
-/**
- * Display recently updated themes.
- *
- * @since 2.8.0
- *
- * @param string $page
- */
-function install_themes_updated($page = 1) {
- global $theme_field_defaults;
- $args = array('browse' => 'updated', 'page' => $page, 'fields' => $theme_field_defaults);
- $api = themes_api('query_themes', $args);
- display_themes($api->themes, $api->info['page'], $api->info['pages']);
-}
-
-add_action('install_themes_upload', 'install_themes_upload', 10, 1);
function install_themes_upload($page = 1) {
?>
-
+
-
+
preview_url . '?TB_iframe=true&width=600&height=400';
if ( !is_array($actions) ) {
$actions = array();
- $actions[] = 'slug .
'&TB_iframe=true&tbWidth=500&tbHeight=385') . '" class="thickbox thickbox-preview onclick" title="' . esc_attr(sprintf(__('Install “%s”'), $name)) . '">' . __('Install') . ' ';
- $actions[] = '' . __('Preview') . ' ';
+ if ( !is_network_admin() )
+ $actions[] = '' . __('Preview') . ' ';
$actions = apply_filters('theme_install_action_links', $actions, $theme);
}
@@ -360,83 +200,16 @@ function display_theme($theme, $actions = null, $show_details = true) {
* Display theme content based on theme list.
*
* @since 2.8.0
- *
- * @param array $themes List of themes.
- * @param string $page
- * @param int $totalpages Number of pages.
*/
-function display_themes($themes, $page = 1, $totalpages = 1) {
- $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';
- $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';
- ?>
-
-
- add_query_arg('paged', '%#%', $url),
- 'format' => '',
- 'prev_text' => __('«'),
- 'next_text' => __('»'),
- 'total' => $totalpages,
- 'current' => $page
- ));
-
- if ( $page_links )
- echo "\t\t
$page_links
";
- ?>
-
-
-
-
- $cols ) {
- ?>
-
- $theme_index ) {
- $class = array('available-theme');
- if ( $row == 1 ) $class[] = 'top';
- if ( $col == 1 ) $class[] = 'left';
- if ( $row == $rows ) $class[] = 'bottom';
- if ( $col == 3 ) $class[] = 'right';
- ?>
-
-
-
-
-
-
-$page_links
"; ?>
-
+function display_themes() {
+ global $wp_list_table;
-display();
}
-
-add_action('install_themes_pre_theme-information', 'install_theme_information');
+add_action('install_themes_search', 'display_themes');
+add_action('install_themes_featured', 'display_themes');
+add_action('install_themes_new', 'display_themes');
+add_action('install_themes_updated', 'display_themes');
/**
* Display theme information in dialog box form.
@@ -515,12 +288,12 @@ switch ( $type ) {
default:
case 'install':
if ( current_user_can('install_themes') ) :
- $buttons .= '' . __('Install Now') . ' ';
+ $buttons .= '' . __('Install Now') . ' ';
endif;
break;
case 'update_available':
if ( current_user_can('update_themes') ) :
- $buttons .= '' . __('Install Update Now') . ' ';
+ $buttons .= '' . __('Install Update Now') . ' ';
endif;
break;
case 'newer_installed':
@@ -546,3 +319,5 @@ case 'latest_installed':
iframe_footer();
exit;
}
+add_action('install_themes_pre_theme-information', 'install_theme_information');
+
diff --git a/wp-admin/includes/theme.php b/wp-admin/includes/theme.php
index 44a1f629..80e96741 100644
--- a/wp-admin/includes/theme.php
+++ b/wp-admin/includes/theme.php
@@ -9,7 +9,7 @@
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.0.0
*
* @return unknown
*/
@@ -43,17 +43,19 @@ function current_theme_info() {
* @since 2.8.0
*
* @param string $template Template directory of the theme to delete
+ * @param string $redirect Redirect to page when complete.
* @return mixed
*/
-function delete_theme($template) {
+function delete_theme($template, $redirect = '') {
global $wp_filesystem;
if ( empty($template) )
return false;
ob_start();
- $url = wp_nonce_url('themes.php?action=delete&template=' . $template, 'delete-theme_' . $template);
- if ( false === ($credentials = request_filesystem_credentials($url)) ) {
+ if ( empty( $redirect ) )
+ $redirect = wp_nonce_url('themes.php?action=delete&template=' . $template, 'delete-theme_' . $template);
+ if ( false === ($credentials = request_filesystem_credentials($redirect)) ) {
$data = ob_get_contents();
ob_end_clean();
if ( ! empty($data) ){
@@ -106,7 +108,7 @@ function delete_theme($template) {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 1.5.0
*
* @return unknown
*/
@@ -159,7 +161,7 @@ function get_allowed_themes() {
/**
* Get the Page Templates available in this theme
*
- * @since unknown
+ * @since 1.5.0
*
* @return array Key is template name, Value is template name
*/
@@ -239,15 +241,165 @@ function theme_update_available( $theme ) {
$theme_name = is_object($theme) ? $theme->name : (is_array($theme) ? $theme['Name'] : '');
$details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), $update['url']); //Theme browser inside WP? replace this, Also, theme preview JS will override this on the available list.
$update_url = wp_nonce_url('update.php?action=upgrade-theme&theme=' . urlencode($stylesheet), 'upgrade-theme_' . $stylesheet);
- $update_onclick = 'onclick="if ( confirm(\'' . esc_js( __("Upgrading this theme will lose any customizations you have made. 'Cancel' to stop, 'OK' to upgrade.") ) . '\') ) {return true;}return false;"';
-
- if ( ! current_user_can('update_themes') )
- printf( '' . __('There is a new version of %1$s available. View version %3$s Details .') . '
', $theme_name, $details_url, $update['new_version']);
- else if ( empty($update['package']) )
- printf( '' . __('There is a new version of %1$s available. View version %3$s Details automatic upgrade unavailable for this theme .') . '
', $theme_name, $details_url, $update['new_version']);
- else
- printf( '' . __('There is a new version of %1$s available. View version %3$s Details or upgrade automatically .') . '
', $theme_name, $details_url, $update['new_version'], $update_url, $update_onclick );
+ $update_onclick = 'onclick="if ( confirm(\'' . esc_js( __("Updating this theme will lose any customizations you have made. 'Cancel' to stop, 'OK' to update.") ) . '\') ) {return true;}return false;"';
+
+ if ( !is_multisite() ) {
+ if ( ! current_user_can('update_themes') )
+ printf( '' . __('There is a new version of %1$s available. View version %3$s details .') . '
', $theme_name, $details_url, $update['new_version']);
+ else if ( empty($update['package']) )
+ printf( '' . __('There is a new version of %1$s available. View version %3$s details . Automatic update is unavailable for this theme. ') . '
', $theme_name, $details_url, $update['new_version']);
+ else
+ printf( '' . __('There is a new version of %1$s available. View version %3$s details or update automatically .') . '
', $theme_name, $details_url, $update['new_version'], $update_url, $update_onclick );
+ }
+ }
+}
+
+/**
+ * Retrieve list of WordPress theme features (aka theme tags)
+ *
+ * @since 3.1.0
+ *
+ * @return array Array of features keyed by category with translations keyed by slug.
+ */
+function get_theme_feature_list() {
+ // Hard-coded list is used if api not accessible.
+ $features = array(
+ __('Colors') => array(
+ 'black' => __( 'Black' ),
+ 'blue' => __( 'Blue' ),
+ 'brown' => __( 'Brown' ),
+ 'green' => __( 'Green' ),
+ 'orange' => __( 'Orange' ),
+ 'pink' => __( 'Pink' ),
+ 'purple' => __( 'Purple' ),
+ 'red' => __( 'Red' ),
+ 'silver' => __( 'Silver' ),
+ 'tan' => __( 'Tan' ),
+ 'white' => __( 'White' ),
+ 'yellow' => __( 'Yellow' ),
+ 'dark' => __( 'Dark' ),
+ 'light' => __( 'Light ')
+ ),
+
+ __('Columns') => array(
+ 'one-column' => __( 'One Column' ),
+ 'two-columns' => __( 'Two Columns' ),
+ 'three-columns' => __( 'Three Columns' ),
+ 'four-columns' => __( 'Four Columns' ),
+ 'left-sidebar' => __( 'Left Sidebar' ),
+ 'right-sidebar' => __( 'Right Sidebar' )
+ ),
+
+ __('Width') => array(
+ 'fixed-width' => __( 'Fixed Width' ),
+ 'flexible-width' => __( 'Flexible Width' )
+ ),
+
+ __( 'Features' ) => array(
+ 'blavatar' => __( 'Blavatar' ),
+ 'buddypress' => __( 'BuddyPress' ),
+ 'custom-background' => __( 'Custom Background' ),
+ 'custom-colors' => __( 'Custom Colors' ),
+ 'custom-header' => __( 'Custom Header' ),
+ 'custom-menu' => __( 'Custom Menu' ),
+ 'editor-style' => __( 'Editor Style' ),
+ 'front-page-post-form' => __( 'Front Page Posting' ),
+ 'microformats' => __( 'Microformats' ),
+ 'sticky-post' => __( 'Sticky Post' ),
+ 'theme-options' => __( 'Theme Options' ),
+ 'threaded-comments' => __( 'Threaded Comments' ),
+ 'translation-ready' => __( 'Translation Ready' ),
+ 'rtl-language-support' => __( 'RTL Language Support' )
+ ),
+
+ __( 'Subject' ) => array(
+ 'holiday' => __( 'Holiday' ),
+ 'photoblogging' => __( 'Photoblogging' ),
+ 'seasonal' => __( 'Seasonal' )
+ )
+ );
+
+ if ( !current_user_can('install_themes') )
+ return $features;
+
+ if ( !$feature_list = get_site_transient( 'wporg_theme_feature_list' ) )
+ set_site_transient( 'wporg_theme_feature_list', array( ), 10800);
+
+ if ( !$feature_list ) {
+ $feature_list = themes_api( 'feature_list', array( ) );
+ if ( is_wp_error( $feature_list ) )
+ return $features;
+ }
+
+ if ( !$feature_list )
+ return $features;
+
+ set_site_transient( 'wporg_theme_feature_list', $feature_list, 10800 );
+
+ $category_translations = array( 'Colors' => __('Colors'), 'Columns' => __('Columns'), 'Width' => __('Width'),
+ 'Features' => __('Features'), 'Subject' => __('Subject') );
+
+ // Loop over the wporg canonical list and apply translations
+ $wporg_features = array();
+ foreach ( (array) $feature_list as $feature_category => $feature_items ) {
+ if ( isset($category_translations[$feature_category]) )
+ $feature_category = $category_translations[$feature_category];
+ $wporg_features[$feature_category] = array();
+
+ foreach ( $feature_items as $feature ) {
+ if ( isset($features[$feature_category][$feature]) )
+ $wporg_features[$feature_category][$feature] = $features[$feature_category][$feature];
+ else
+ $wporg_features[$feature_category][$feature] = $feature;
+ }
+ }
+
+ return $wporg_features;
+}
+
+/**
+ * Retrieve theme installer pages from WordPress Themes API.
+ *
+ * It is possible for a theme to override the Themes API result with three
+ * filters. Assume this is for themes, which can extend on the Theme Info to
+ * offer more choices. This is very powerful and must be used with care, when
+ * overridding the filters.
+ *
+ * The first filter, 'themes_api_args', is for the args and gives the action as
+ * the second parameter. The hook for 'themes_api_args' must ensure that an
+ * object is returned.
+ *
+ * The second filter, 'themes_api', is the result that would be returned.
+ *
+ * @since 2.8.0
+ *
+ * @param string $action
+ * @param array|object $args Optional. Arguments to serialize for the Theme Info API.
+ * @return mixed
+ */
+function themes_api($action, $args = null) {
+
+ if ( is_array($args) )
+ $args = (object)$args;
+
+ if ( !isset($args->per_page) )
+ $args->per_page = 24;
+
+ $args = apply_filters('themes_api_args', $args, $action); //NOTE: Ensure that an object is returned via this filter.
+ $res = apply_filters('themes_api', false, $action, $args); //NOTE: Allows a theme to completely override the builtin WordPress.org API.
+
+ if ( ! $res ) {
+ $request = wp_remote_post('http://api.wordpress.org/themes/info/1.0/', array( 'body' => array('action' => $action, 'request' => serialize($args))) );
+ if ( is_wp_error($request) ) {
+ $res = new WP_Error('themes_api_failed', __('An Unexpected HTTP Error occurred during the API request.'), $request->get_error_message() );
+ } else {
+ $res = unserialize($request['body']);
+ if ( ! $res )
+ $res = new WP_Error('themes_api_failed', __('An unknown error occurred.'), $request['body']);
+ }
}
+ //var_dump(array($args, $res));
+ return apply_filters('themes_api_result', $res, $action, $args);
}
?>
diff --git a/wp-admin/includes/update-core.php b/wp-admin/includes/update-core.php
index 7431d7fd..fe34eb0c 100644
--- a/wp-admin/includes/update-core.php
+++ b/wp-admin/includes/update-core.php
@@ -213,7 +213,6 @@ $_old_files = array(
'wp-includes/js/jquery/autocomplete.js',
'wp-includes/js/scriptaculous/prototype.js',
'wp-includes/js/tinymce/wp-tinymce.js',
-'wp-content/themes/twentyten/searchform.php',
'wp-admin/import',
'wp-admin/images/ico-edit.png',
'wp-admin/images/fav-top.png',
@@ -223,6 +222,27 @@ $_old_files = array(
'wp-admin/images/ico-add.png',
'wp-admin/images/browse-happy.gif',
'wp-admin/images/ico-viewpage.png',
+// 3.1
+'wp-includes/js/tinymce/blank.htm',
+'wp-includes/js/tinymce/plugins/safari',
+'wp-includes/js/tinymce/plugins/media',
+'wp-admin/edit-link-categories.php',
+'wp-admin/edit-post-rows.php',
+'wp-admin/edit-attachment-rows.php',
+'wp-admin/link-category.php',
+'wp-admin/edit-link-category-form.php',
+'wp-admin/sidebar.php',
+'wp-admin/images/list-vs.png',
+'wp-admin/images/button-grad-vs.png',
+'wp-admin/images/button-grad-active-vs.png',
+'wp-admin/images/fav-arrow-vs.gif',
+'wp-admin/images/fav-arrow-vs-rtl.gif',
+'wp-admin/images/fav-top-vs.gif',
+'wp-admin/images/screen-options-right.gif',
+'wp-admin/images/screen-options-right-up.gif',
+'wp-admin/images/visit-site-button-grad-vs.gif',
+'wp-admin/images/visit-site-button-grad.gif',
+'wp-includes/classes.php',
);
/**
@@ -274,7 +294,7 @@ function update_core($from, $to) {
$mysql_version = $wpdb->db_version();
$required_php_version = '4.3';
$required_mysql_version = '4.1.2';
- $wp_version = '3.0.6';
+ $wp_version = '3.1';
$php_compat = version_compare( $php_version, $required_php_version, '>=' );
$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' );
diff --git a/wp-admin/includes/update.php b/wp-admin/includes/update.php
index 52e9ee1a..06e06c24 100644
--- a/wp-admin/includes/update.php
+++ b/wp-admin/includes/update.php
@@ -100,11 +100,11 @@ function core_update_footer( $msg = '' ) {
switch ( $cur->response ) {
case 'development' :
- return sprintf( __( 'You are using a development version (%1$s). Cool! Please stay updated .' ), $GLOBALS['wp_version'], 'update-core.php');
+ return sprintf( __( 'You are using a development version (%1$s). Cool! Please stay updated .' ), $GLOBALS['wp_version'], network_admin_url( 'update-core.php' ) );
break;
case 'upgrade' :
- return sprintf( ''.__( 'Get Version %2$s ' ).' ', 'update-core.php', $cur->current);
+ return sprintf( ''.__( 'Get Version %2$s ' ).' ', network_admin_url( 'update-core.php' ), $cur->current);
break;
case 'latest' :
@@ -129,11 +129,11 @@ function update_nag() {
if ( ! isset( $cur->response ) || $cur->response != 'upgrade' )
return false;
- if ( current_user_can('update_core') )
- $msg = sprintf( __('WordPress %1$s is available! Please update now .'), $cur->current, 'update-core.php' );
- else
+ if ( current_user_can('update_core') ) {
+ $msg = sprintf( __('WordPress %1$s is available! Please update now .'), $cur->current, network_admin_url( 'update-core.php' ) );
+ } else {
$msg = sprintf( __('WordPress %1$s is available! Please notify the site administrator.'), $cur->current );
-
+ }
echo "$msg
";
}
add_action( 'admin_notices', 'update_nag', 3 );
@@ -146,8 +146,10 @@ function update_right_now_message() {
$cur = get_preferred_from_update_core();
$msg = sprintf( __('You are using WordPress %s .'), $GLOBALS['wp_version'] );
- if ( isset( $cur->response ) && $cur->response == 'upgrade' && current_user_can('update_core') )
- $msg .= " " . sprintf( __('Update to %s'), $cur->current ? $cur->current : __( 'Latest' ) ) . ' ';
+
+ if ( isset( $cur->response ) && $cur->response == 'upgrade' && current_user_can('update_core') ) {
+ $msg .= " " . sprintf( __('Update to %s'), $cur->current ? $cur->current : __( 'Latest' ) ) . ' ';
+ }
echo "$msg ";
}
@@ -190,15 +192,19 @@ function wp_plugin_update_row( $file, $plugin_data ) {
$plugins_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array());
$plugin_name = wp_kses( $plugin_data['Name'], $plugins_allowedtags );
- $details_url = admin_url('plugin-install.php?tab=plugin-information&plugin=' . $r->slug . '&TB_iframe=true&width=600&height=800');
+ $details_url = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $r->slug . '&TB_iframe=true&width=600&height=800');
- echo ' ';
- if ( ! current_user_can('update_plugins') )
- printf( __('There is a new version of %1$s available.
View version %4$s Details .'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version );
- else if ( empty($r->package) )
- printf( __('There is a new version of %1$s available.
View version %4$s Details automatic upgrade unavailable for this plugin .'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version );
- else
- printf( __('There is a new version of %1$s available.
View version %4$s Details or
upgrade automatically .'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version, wp_nonce_url('update.php?action=upgrade-plugin&plugin=' . $file, 'upgrade-plugin_' . $file) );
+ $wp_list_table = _get_list_table('WP_Plugins_List_Table');
+
+ if ( is_network_admin() || !is_multisite() ) {
+ echo '
';
+ if ( ! current_user_can('update_plugins') )
+ printf( __('There is a new version of %1$s available.
View version %4$s details .'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version );
+ else if ( empty($r->package) )
+ printf( __('There is a new version of %1$s available.
View version %4$s details .
Automatic update is unavailable for this plugin. '), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version );
+ else
+ printf( __('There is a new version of %1$s available.
View version %4$s details or
update automatically .'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version, wp_nonce_url( self_admin_url('update.php?action=upgrade-plugin&plugin=') . $file, 'upgrade-plugin_' . $file) );
+ }
do_action( "in_plugin_update_message-$file", $plugin_data, $r );
@@ -239,6 +245,45 @@ function wp_update_theme($theme, $feedback = '') {
return $upgrader->upgrade($theme);
}
+function wp_theme_update_rows() {
+ if ( !current_user_can('update_themes' ) )
+ return;
+
+ $themes = get_site_transient( 'update_themes' );
+ if ( isset($themes->response) && is_array($themes->response) ) {
+ $themes = array_keys( $themes->response );
+
+ foreach( $themes as $theme ) {
+ add_action( "after_theme_row_$theme", 'wp_theme_update_row', 10, 2 );
+ }
+ }
+}
+add_action( 'admin_init', 'wp_theme_update_rows' );
+
+function wp_theme_update_row( $theme_key, $theme ) {
+ $current = get_site_transient( 'update_themes' );
+ if ( !isset( $current->response[ $theme_key ] ) )
+ return false;
+ $r = $current->response[ $theme_key ];
+ $themes_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array());
+ $theme_name = wp_kses( $theme['Name'], $themes_allowedtags );
+
+ $details_url = self_admin_url("theme-install.php?tab=theme-information&theme=$theme_key&TB_iframe=true&width=600&height=400");
+
+ $wp_list_table = _get_list_table('WP_MS_Themes_List_Table');
+
+ echo '
';
+ if ( ! current_user_can('update_themes') )
+ printf( __('There is a new version of %1$s available.
View version %4$s details .'), $theme['Name'], esc_url($details_url), esc_attr($theme['Name']), $r->new_version );
+ else if ( empty( $r['package'] ) )
+ printf( __('There is a new version of %1$s available.
View version %4$s details .
Automatic update is unavailable for this plugin. '), $theme['Name'], esc_url($details_url), esc_attr($theme['Name']), $r['new_version'] );
+ else
+ printf( __('There is a new version of %1$s available.
View version %4$s details or
update automatically .'), $theme['Name'], esc_url($details_url), esc_attr($theme['Name']), $r['new_version'], wp_nonce_url( self_admin_url('update.php?action=upgrade-theme&theme=') . $theme_key, 'upgrade-theme_' . $theme_key) );
+
+ do_action( "in_theme_update_message-$theme_key", $theme, $r );
+
+ echo '
';
+}
function wp_update_core($current, $feedback = '') {
if ( !empty($feedback) )
diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php
index 7ae2384e..f29f594e 100644
--- a/wp-admin/includes/upgrade.php
+++ b/wp-admin/includes/upgrade.php
@@ -24,7 +24,7 @@ if ( !function_exists('wp_install') ) :
*
* {@internal Missing Long Description}}
*
- * @since unknown
+ * @since 2.1.0
*
* @param string $blog_title Blog title.
* @param string $user_name User's username.
@@ -64,7 +64,7 @@ function wp_install( $blog_title, $user_name, $user_email, $public, $deprecated
$user_password = trim($user_password);
$email_password = false;
if ( !$user_id && empty($user_password) ) {
- $user_password = wp_generate_password();
+ $user_password = wp_generate_password( 12, false );
$message = __('
Note that password carefully! It is a
random password that was generated just for you.');
$user_id = wp_create_user($user_name, $user_password, $user_email);
update_user_option($user_id, 'default_password_nag', true, true);
@@ -98,7 +98,7 @@ if ( !function_exists('wp_install_defaults') ) :
*
* {@internal Missing Long Description}}
*
- * @since unknown
+ * @since 2.1.0
*
* @param int $user_id User ID.
*/
@@ -243,7 +243,15 @@ function wp_install_defaults($user_id) {
));
// First Page
- $first_page = __('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.');
+ $first_page = sprintf( __( "This is an example page. It's different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most people start with an About page that introduces them to potential site visitors. It might say something like this:
+
+
Hi there! I'm a bike messenger by day, aspiring actor by night, and this is my blog. I live in Los Angeles, have a great dog named Jack, and I like piña coladas. (And gettin' caught in the rain.)
+
+...or something like this:
+
+
The XYZ Doohickey Company was founded in 1971, and has been providing quality doohickies to the public ever since. Located in Gotham City, XYZ employs over 2,000 people and does all kinds of awesome things for the Gotham community.
+
+As a new WordPress user, you should go to
your dashboard to delete this page and create new pages for your content. Have fun!" ), admin_url() );
if ( is_multisite() )
$first_page = get_site_option( 'first_page', $first_page );
$first_post_guid = get_option('home') . '/?page_id=2';
@@ -253,9 +261,9 @@ function wp_install_defaults($user_id) {
'post_date_gmt' => $now_gmt,
'post_content' => $first_page,
'post_excerpt' => '',
- 'post_title' => __('About'),
+ 'post_title' => __( 'Sample Page' ),
/* translators: Default page slug */
- 'post_name' => _x('about', 'Default page slug'),
+ 'post_name' => __( 'sample-page' ),
'post_modified' => $now,
'post_modified_gmt' => $now_gmt,
'guid' => $first_post_guid,
@@ -266,7 +274,7 @@ function wp_install_defaults($user_id) {
));
$wpdb->insert( $wpdb->postmeta, array( 'post_id' => 2, 'meta_key' => '_wp_page_template', 'meta_value' => 'default' ) );
- // Setup default widgets for default theme.
+ // Set up default widgets for default theme.
update_option( 'widget_search', array ( 2 => array ( 'title' => '' ), '_multiwidget' => 1 ) );
update_option( 'widget_recent-posts', array ( 2 => array ( 'title' => '', 'number' => 5 ), '_multiwidget' => 1 ) );
update_option( 'widget_recent-comments', array ( 2 => array ( 'title' => '', 'number' => 5 ), '_multiwidget' => 1 ) );
@@ -300,7 +308,7 @@ if ( !function_exists('wp_new_blog_notification') ) :
*
* {@internal Missing Long Description}}
*
- * @since unknown
+ * @since 2.1.0
*
* @param string $blog_title Blog title.
* @param string $blog_url Blog url.
@@ -336,7 +344,7 @@ if ( !function_exists('wp_upgrade') ) :
*
* {@internal Missing Long Description}}
*
- * @since unknown
+ * @since 2.1.0
*
* @return null
*/
@@ -375,7 +383,7 @@ endif;
*
* {@internal Missing Long Description}}
*
- * @since unknown
+ * @since 1.0.1
*/
function upgrade_all() {
global $wp_current_db_version, $wp_db_version, $wp_rewrite;
@@ -1187,7 +1195,7 @@ function upgrade_network() {
*
* {@internal Missing Long Description}}
*
- * @since unknown
+ * @since 1.0.0
*
* @param string $table_name Database table name to create.
* @param string $create_ddl SQL statement to create table.
@@ -1210,7 +1218,7 @@ function maybe_create_table($table_name, $create_ddl) {
*
* {@internal Missing Long Description}}
*
- * @since unknown
+ * @since 1.0.1
*
* @param string $table Database table name.
* @param string $index Index name to drop.
@@ -1233,7 +1241,7 @@ function drop_index($table, $index) {
*
* {@internal Missing Long Description}}
*
- * @since unknown
+ * @since 1.0.1
*
* @param string $table Database table name.
* @param string $index Database table index column.
@@ -1296,7 +1304,7 @@ function get_alloptions_110() {
/**
* Version of get_option that is private to install/upgrade.
*
- * @since unknown
+ * @since 1.5.1
* @access private
*
* @param string $setting Option name.
@@ -1333,7 +1341,7 @@ function __get_option($setting) {
*
* {@internal Missing Long Description}}
*
- * @since unknown
+ * @since 1.5.0
*
* @param string $content
* @return string
@@ -1360,7 +1368,7 @@ function deslash($content) {
*
* {@internal Missing Long Description}}
*
- * @since unknown
+ * @since 1.5.0
*
* @param unknown_type $queries
* @param unknown_type $execute
@@ -1567,7 +1575,7 @@ function dbDelta($queries, $execute = true) {
*
* {@internal Missing Long Description}}
*
- * @since unknown
+ * @since 1.5.0
*/
function make_db_current() {
global $wp_queries;
@@ -1583,7 +1591,7 @@ function make_db_current() {
*
* {@internal Missing Long Description}}
*
- * @since unknown
+ * @since 1.5.0
*/
function make_db_current_silent() {
global $wp_queries;
@@ -1596,7 +1604,7 @@ function make_db_current_silent() {
*
* {@internal Missing Long Description}}
*
- * @since unknown
+ * @since 1.5.0
*
* @param unknown_type $theme_name
* @param unknown_type $template
@@ -1656,7 +1664,7 @@ function make_site_theme_from_oldschool($theme_name, $template) {
}
// Add a theme header.
- $header = "/*\nTheme Name: $theme_name\nTheme URI: " . __get_option('siteurl') . "\nDescription: A theme automatically created by the upgrade.\nVersion: 1.0\nAuthor: Moi\n*/\n";
+ $header = "/*\nTheme Name: $theme_name\nTheme URI: " . __get_option('siteurl') . "\nDescription: A theme automatically created by the update.\nVersion: 1.0\nAuthor: Moi\n*/\n";
$stylelines = file_get_contents("$site_dir/style.css");
if ($stylelines) {
@@ -1675,7 +1683,7 @@ function make_site_theme_from_oldschool($theme_name, $template) {
*
* {@internal Missing Long Description}}
*
- * @since unknown
+ * @since 1.5.0
*
* @param unknown_type $theme_name
* @param unknown_type $template
@@ -1741,7 +1749,7 @@ function make_site_theme_from_default($theme_name, $template) {
*
* {@internal Missing Long Description}}
*
- * @since unknown
+ * @since 1.5.0
*
* @return unknown
*/
@@ -1789,7 +1797,7 @@ function make_site_theme() {
/**
* Translate user level to user role name.
*
- * @since unknown
+ * @since 2.0.0
*
* @param int $level User level.
* @return string User role name.
@@ -1820,7 +1828,7 @@ function translate_level_to_role($level) {
*
* {@internal Missing Long Description}}
*
- * @since unknown
+ * @since 2.1.0
*/
function wp_check_mysql_version() {
global $wpdb;
@@ -1834,7 +1842,7 @@ function wp_check_mysql_version() {
*
* {@internal Missing Long Description}}
*
- * @since unknown
+ * @since 2.2.0
*/
function maybe_disable_automattic_widgets() {
$plugins = __get_option( 'active_plugins' );
@@ -1850,6 +1858,8 @@ function maybe_disable_automattic_widgets() {
/**
* Runs before the schema is upgraded.
+ *
+ * @since 2.9.0
*/
function pre_schema_upgrade() {
global $wp_current_db_version, $wp_db_version, $wpdb;
diff --git a/wp-admin/includes/user.php b/wp-admin/includes/user.php
index b31c38bd..758c065a 100644
--- a/wp-admin/includes/user.php
+++ b/wp-admin/includes/user.php
@@ -55,14 +55,14 @@ function add_user() {
*/
function edit_user( $user_id = 0 ) {
global $wp_roles, $wpdb;
- if ( $user_id != 0 ) {
+ $user = new stdClass;
+ if ( $user_id ) {
$update = true;
$user->ID = (int) $user_id;
$userdata = get_userdata( $user_id );
$user->user_login = $wpdb->escape( $userdata->user_login );
} else {
$update = false;
- $user = '';
}
if ( !$update && isset( $_POST['user_login'] ) )
@@ -110,7 +110,7 @@ function edit_user( $user_id = 0 ) {
if ( isset( $_POST['description'] ) )
$user->description = trim( $_POST['description'] );
- foreach ( _wp_get_user_contactmethods() as $method => $name ) {
+ foreach ( _wp_get_user_contactmethods( $user ) as $method => $name ) {
if ( isset( $_POST[$method] ))
$user->$method = sanitize_text_field( $_POST[$method] );
}
@@ -118,6 +118,8 @@ function edit_user( $user_id = 0 ) {
if ( $update ) {
$user->rich_editing = isset( $_POST['rich_editing'] ) && 'false' == $_POST['rich_editing'] ? 'false' : 'true';
$user->admin_color = isset( $_POST['admin_color'] ) ? sanitize_text_field( $_POST['admin_color'] ) : 'fresh';
+ $user->show_admin_bar_front = isset( $_POST['admin_bar_front'] ) ? 'true' : 'false';
+ $user->show_admin_bar_admin = isset( $_POST['admin_bar_admin'] ) ? 'true' : 'false';
}
$user->comment_shortcuts = isset( $_POST['comment_shortcuts'] ) && 'true' == $_POST['comment_shortcuts'] ? 'true' : '';
@@ -169,7 +171,7 @@ function edit_user( $user_id = 0 ) {
$errors->add( 'empty_email', __( '
ERROR : Please enter an e-mail address.' ), array( 'form-field' => 'email' ) );
} elseif ( !is_email( $user->user_email ) ) {
$errors->add( 'invalid_email', __( '
ERROR : The e-mail address isn’t correct.' ), array( 'form-field' => 'email' ) );
- } elseif ( ( $owner_id = email_exists($user->user_email) ) && $owner_id != $user->ID ) {
+ } elseif ( ( $owner_id = email_exists($user->user_email) ) && ( !$update || ( $owner_id != $user->ID ) ) ) {
$errors->add( 'email_exists', __('
ERROR : This email is already registered, please choose another one.'), array( 'form-field' => 'email' ) );
}
@@ -188,86 +190,6 @@ function edit_user( $user_id = 0 ) {
return $user_id;
}
-/**
- * {@internal Missing Short Description}}
- *
- * {@internal Missing Long Description}}
- *
- * @since unknown
- *
- * @return array List of user IDs.
- */
-function get_author_user_ids() {
- global $wpdb;
- if ( !is_multisite() )
- $level_key = $wpdb->get_blog_prefix() . 'user_level';
- else
- $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
-
- return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != '0'", $level_key) );
-}
-
-/**
- * {@internal Missing Short Description}}
- *
- * {@internal Missing Long Description}}
- *
- * @since unknown
- *
- * @param int $user_id User ID.
- * @return array|bool List of editable authors. False if no editable users.
- */
-function get_editable_authors( $user_id ) {
- global $wpdb;
-
- $editable = get_editable_user_ids( $user_id );
-
- if ( !$editable ) {
- return false;
- } else {
- $editable = join(',', $editable);
- $authors = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($editable) ORDER BY display_name" );
- }
-
- return apply_filters('get_editable_authors', $authors);
-}
-
-/**
- * {@internal Missing Short Description}}
- *
- * {@internal Missing Long Description}}
- *
- * @since unknown
- *
- * @param int $user_id User ID.
- * @param bool $exclude_zeros Optional, default is true. Whether to exclude zeros.
- * @return unknown
- */
-function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'post' ) {
- global $wpdb;
-
- $user = new WP_User( $user_id );
- $post_type_obj = get_post_type_object($post_type);
-
- if ( ! $user->has_cap($post_type_obj->cap->edit_others_posts) ) {
- if ( $user->has_cap($post_type_obj->cap->edit_posts) || ! $exclude_zeros )
- return array($user->id);
- else
- return array();
- }
-
- if ( !is_multisite() )
- $level_key = $wpdb->get_blog_prefix() . 'user_level';
- else
- $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
-
- $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key);
- if ( $exclude_zeros )
- $query .= " AND meta_value != '0'";
-
- return $wpdb->get_col( $query );
-}
-
/**
* Fetch a filtered list of user roles that the current user is
* allowed to edit.
@@ -293,85 +215,10 @@ function get_editable_roles() {
return $editable_roles;
}
-/**
- * {@internal Missing Short Description}}
- *
- * {@internal Missing Long Description}}
- *
- * @since unknown
- *
- * @return unknown
- */
-function get_nonauthor_user_ids() {
- global $wpdb;
-
- if ( !is_multisite() )
- $level_key = $wpdb->get_blog_prefix() . 'user_level';
- else
- $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
-
- return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value = '0'", $level_key) );
-}
-
-/**
- * Retrieve editable posts from other users.
- *
- * @since unknown
- *
- * @param int $user_id User ID to not retrieve posts from.
- * @param string $type Optional, defaults to 'any'. Post type to retrieve, can be 'draft' or 'pending'.
- * @return array List of posts from others.
- */
-function get_others_unpublished_posts($user_id, $type='any') {
- global $wpdb;
-
- $editable = get_editable_user_ids( $user_id );
-
- if ( in_array($type, array('draft', 'pending')) )
- $type_sql = " post_status = '$type' ";
- else
- $type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) ";
-
- $dir = ( 'pending' == $type ) ? 'ASC' : 'DESC';
-
- if ( !$editable ) {
- $other_unpubs = '';
- } else {
- $editable = join(',', $editable);
- $other_unpubs = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != %d ORDER BY post_modified $dir", $user_id) );
- }
-
- return apply_filters('get_others_drafts', $other_unpubs);
-}
-
-/**
- * Retrieve drafts from other users.
- *
- * @since unknown
- *
- * @param int $user_id User ID.
- * @return array List of drafts from other users.
- */
-function get_others_drafts($user_id) {
- return get_others_unpublished_posts($user_id, 'draft');
-}
-
-/**
- * Retrieve pending review posts from other users.
- *
- * @since unknown
- *
- * @param int $user_id User ID.
- * @return array List of posts with pending review post type from other users.
- */
-function get_others_pending($user_id) {
- return get_others_unpublished_posts($user_id, 'pending');
-}
-
/**
* Retrieve user data and filter it.
*
- * @since unknown
+ * @since 2.0.5
*
* @param int $user_id User ID.
* @return object WP_User object with user data.
@@ -379,7 +226,7 @@ function get_others_pending($user_id) {
function get_user_to_edit( $user_id ) {
$user = new WP_User( $user_id );
- $user_contactmethods = _wp_get_user_contactmethods();
+ $user_contactmethods = _wp_get_user_contactmethods( $user );
foreach ($user_contactmethods as $method => $name) {
if ( empty( $user->{$method} ) )
$user->{$method} = '';
@@ -396,7 +243,7 @@ function get_user_to_edit( $user_id ) {
/**
* Retrieve the user's drafts.
*
- * @since unknown
+ * @since 2.0.0
*
* @param int $user_id User ID.
* @return array
@@ -416,7 +263,7 @@ function get_users_drafts( $user_id ) {
* being deleted will be run after the posts are either reassigned or deleted.
* The user meta will also be deleted that are for that User ID.
*
- * @since unknown
+ * @since 2.0.0
*
* @param int $id User ID.
* @param int $reassign Optional. Reassign posts and links to new User ID.
@@ -471,7 +318,7 @@ function wp_delete_user( $id, $reassign = 'novalue' ) {
/**
* Remove all capabilities from user.
*
- * @since unknown
+ * @since 2.1.0
*
* @param int $id User ID.
*/
@@ -482,344 +329,10 @@ function wp_revoke_user($id) {
$user->remove_all_caps();
}
-if ( !class_exists('WP_User_Search') ) :
+add_action('admin_init', 'default_password_nag_handler');
/**
- * WordPress User Search class.
- *
- * @since unknown
+ * @since 2.8.0
*/
-class WP_User_Search {
-
- /**
- * {@internal Missing Description}}
- *
- * @since unknown
- * @access private
- * @var unknown_type
- */
- var $results;
-
- /**
- * {@internal Missing Description}}
- *
- * @since unknown
- * @access private
- * @var unknown_type
- */
- var $search_term;
-
- /**
- * Page number.
- *
- * @since unknown
- * @access private
- * @var int
- */
- var $page;
-
- /**
- * Role name that users have.
- *
- * @since unknown
- * @access private
- * @var string
- */
- var $role;
-
- /**
- * Raw page number.
- *
- * @since unknown
- * @access private
- * @var int|bool
- */
- var $raw_page;
-
- /**
- * Amount of users to display per page.
- *
- * @since unknown
- * @access public
- * @var int
- */
- var $users_per_page = 50;
-
- /**
- * {@internal Missing Description}}
- *
- * @since unknown
- * @access private
- * @var unknown_type
- */
- var $first_user;
-
- /**
- * {@internal Missing Description}}
- *
- * @since unknown
- * @access private
- * @var int
- */
- var $last_user;
-
- /**
- * {@internal Missing Description}}
- *
- * @since unknown
- * @access private
- * @var string
- */
- var $query_limit;
-
- /**
- * {@internal Missing Description}}
- *
- * @since 3.0.0
- * @access private
- * @var string
- */
- var $query_orderby;
-
- /**
- * {@internal Missing Description}}
- *
- * @since 3.0.0
- * @access private
- * @var string
- */
- var $query_from;
-
- /**
- * {@internal Missing Description}}
- *
- * @since 3.0.0
- * @access private
- * @var string
- */
- var $query_where;
-
- /**
- * {@internal Missing Description}}
- *
- * @since unknown
- * @access private
- * @var int
- */
- var $total_users_for_query = 0;
-
- /**
- * {@internal Missing Description}}
- *
- * @since unknown
- * @access private
- * @var bool
- */
- var $too_many_total_users = false;
-
- /**
- * {@internal Missing Description}}
- *
- * @since unknown
- * @access private
- * @var unknown_type
- */
- var $search_errors;
-
- /**
- * {@internal Missing Description}}
- *
- * @since unknown
- * @access private
- * @var unknown_type
- */
- var $paging_text;
-
- /**
- * PHP4 Constructor - Sets up the object properties.
- *
- * @since unknown
- *
- * @param string $search_term Search terms string.
- * @param int $page Optional. Page ID.
- * @param string $role Role name.
- * @return WP_User_Search
- */
- function WP_User_Search ($search_term = '', $page = '', $role = '') {
- $this->search_term = $search_term;
- $this->raw_page = ( '' == $page ) ? false : (int) $page;
- $this->page = (int) ( '' == $page ) ? 1 : $page;
- $this->role = $role;
-
- $this->prepare_query();
- $this->query();
- $this->prepare_vars_for_template_usage();
- $this->do_paging();
- }
-
- /**
- * {@internal Missing Short Description}}
- *
- * {@internal Missing Long Description}}
- *
- * @since unknown
- * @access public
- */
- function prepare_query() {
- global $wpdb;
- $this->first_user = ($this->page - 1) * $this->users_per_page;
-
- $this->query_limit = $wpdb->prepare(" LIMIT %d, %d", $this->first_user, $this->users_per_page);
- $this->query_orderby = ' ORDER BY user_login';
-
- $search_sql = '';
- if ( $this->search_term ) {
- $searches = array();
- $search_sql = 'AND (';
- foreach ( array('user_login', 'user_nicename', 'user_email', 'user_url', 'display_name') as $col )
- $searches[] = $col . " LIKE '%$this->search_term%'";
- $search_sql .= implode(' OR ', $searches);
- $search_sql .= ')';
- }
-
- $this->query_from = " FROM $wpdb->users";
- $this->query_where = " WHERE 1=1 $search_sql";
-
- if ( $this->role ) {
- $this->query_from .= " INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id";
- $this->query_where .= $wpdb->prepare(" AND $wpdb->usermeta.meta_key = '{$wpdb->prefix}capabilities' AND $wpdb->usermeta.meta_value LIKE %s", '%' . $this->role . '%');
- } elseif ( is_multisite() ) {
- $level_key = $wpdb->prefix . 'capabilities'; // wpmu site admins don't have user_levels
- $this->query_from .= ", $wpdb->usermeta";
- $this->query_where .= " AND $wpdb->users.ID = $wpdb->usermeta.user_id AND meta_key = '{$level_key}'";
- }
-
- do_action_ref_array( 'pre_user_search', array( &$this ) );
- }
-
- /**
- * {@internal Missing Short Description}}
- *
- * {@internal Missing Long Description}}
- *
- * @since unknown
- * @access public
- */
- function query() {
- global $wpdb;
-
- $this->results = $wpdb->get_col("SELECT DISTINCT($wpdb->users.ID)" . $this->query_from . $this->query_where . $this->query_orderby . $this->query_limit);
-
- if ( $this->results )
- $this->total_users_for_query = $wpdb->get_var("SELECT COUNT(DISTINCT($wpdb->users.ID))" . $this->query_from . $this->query_where); // no limit
- else
- $this->search_errors = new WP_Error('no_matching_users_found', __('No matching users were found!'));
- }
-
- /**
- * {@internal Missing Short Description}}
- *
- * {@internal Missing Long Description}}
- *
- * @since unknown
- * @access public
- */
- function prepare_vars_for_template_usage() {
- $this->search_term = stripslashes($this->search_term); // done with DB, from now on we want slashes gone
- }
-
- /**
- * {@internal Missing Short Description}}
- *
- * {@internal Missing Long Description}}
- *
- * @since unknown
- * @access public
- */
- function do_paging() {
- if ( $this->total_users_for_query > $this->users_per_page ) { // have to page the results
- $args = array();
- if( ! empty($this->search_term) )
- $args['usersearch'] = urlencode($this->search_term);
- if( ! empty($this->role) )
- $args['role'] = urlencode($this->role);
-
- $this->paging_text = paginate_links( array(
- 'total' => ceil($this->total_users_for_query / $this->users_per_page),
- 'current' => $this->page,
- 'base' => 'users.php?%_%',
- 'format' => 'userspage=%#%',
- 'add_args' => $args
- ) );
- if ( $this->paging_text ) {
- $this->paging_text = sprintf( '
' . __( 'Displaying %s–%s of %s' ) . ' %s',
- number_format_i18n( ( $this->page - 1 ) * $this->users_per_page + 1 ),
- number_format_i18n( min( $this->page * $this->users_per_page, $this->total_users_for_query ) ),
- number_format_i18n( $this->total_users_for_query ),
- $this->paging_text
- );
- }
- }
- }
-
- /**
- * {@internal Missing Short Description}}
- *
- * {@internal Missing Long Description}}
- *
- * @since unknown
- * @access public
- *
- * @return unknown
- */
- function get_results() {
- return (array) $this->results;
- }
-
- /**
- * Displaying paging text.
- *
- * @see do_paging() Builds paging text.
- *
- * @since unknown
- * @access public
- */
- function page_links() {
- echo $this->paging_text;
- }
-
- /**
- * Whether paging is enabled.
- *
- * @see do_paging() Builds paging text.
- *
- * @since unknown
- * @access public
- *
- * @return bool
- */
- function results_are_paged() {
- if ( $this->paging_text )
- return true;
- return false;
- }
-
- /**
- * Whether there are search terms.
- *
- * @since unknown
- * @access public
- *
- * @return bool
- */
- function is_search() {
- if ( $this->search_term )
- return true;
- return false;
- }
-}
-endif;
-
-add_action('admin_init', 'default_password_nag_handler');
function default_password_nag_handler($errors = false) {
global $user_ID;
if ( ! get_user_option('default_password_nag') ) //Short circuit it.
@@ -833,6 +346,9 @@ function default_password_nag_handler($errors = false) {
}
add_action('profile_update', 'default_password_nag_edit_user', 10, 2);
+/**
+ * @since 2.8.0
+ */
function default_password_nag_edit_user($user_ID, $old_data) {
if ( ! get_user_option('default_password_nag', $user_ID) ) //Short circuit it.
return;
@@ -846,14 +362,18 @@ function default_password_nag_edit_user($user_ID, $old_data) {
}
add_action('admin_notices', 'default_password_nag');
+/**
+ * @since 2.8.0
+ */
function default_password_nag() {
- if ( ! get_user_option('default_password_nag') ) //Short circuit it.
+ global $pagenow;
+ if ( 'profile.php' == $pagenow || ! get_user_option('default_password_nag') ) //Short circuit it.
return;
echo '
';
echo '
';
echo '' . __('Notice:') . ' ';
- _e('You’re using the auto-generated password for your account. Would you like to change it to something you’ll remember easier?');
+ _e('You’re using the auto-generated password for your account. Would you like to change it to something easier to remember?');
echo '
';
printf( '' . __('Yes, take me to my profile page') . ' | ', admin_url('profile.php') . '#password' );
printf( '' . __('No thanks, do not remind me again') . ' ', '?default_password_nag=0' );
diff --git a/wp-admin/includes/widgets.php b/wp-admin/includes/widgets.php
index aef0dbaf..a591c60d 100644
--- a/wp-admin/includes/widgets.php
+++ b/wp-admin/includes/widgets.php
@@ -7,20 +7,15 @@
*/
/**
- * Display list of the available widgets, either all or matching search.
+ * Display list of the available widgets.
*
- * The search parameter are search terms separated by spaces.
- *
- * @since unknown
- *
- * @param string $show Optional, default is all. What to display, can be 'all', 'unused', or 'used'.
- * @param string $_search Optional. Search for widgets. Should be unsanitized.
+ * @since 2.5.0
*/
function wp_list_widgets() {
global $wp_registered_widgets, $sidebars_widgets, $wp_registered_widget_controls;
$sort = $wp_registered_widgets;
- usort( $sort, create_function( '$a, $b', 'return strnatcasecmp( $a["name"], $b["name"] );' ) );
+ usort( $sort, '_sort_name_callback' );
$done = array();
foreach ( $sort as $widget ) {
@@ -51,11 +46,21 @@ function wp_list_widgets() {
}
}
+/**
+ * Callback to sort array by a 'name' key.
+ *
+ * @since 3.1.0
+ * @access private
+ */
+function _sort_name_callback( $a, $b ) {
+ return strnatcasecmp( $a['name'], $b['name'] );
+}
+
/**
* Show the widgets and their settings for a sidebar.
* Used in the the admin widget config screen.
*
- * @since unknown
+ * @since 2.5.0
*
* @param string $sidebar id slug of the sidebar
*/
@@ -79,7 +84,7 @@ function wp_list_widget_controls( $sidebar ) {
/**
* {@internal Missing Short Description}}
*
- * @since unknown
+ * @since 2.5.0
*
* @param array $params
* @return array
@@ -93,7 +98,7 @@ function wp_list_widget_controls_dynamic_sidebar( $params ) {
$id = isset($params[0]['_temp_id']) ? $params[0]['_temp_id'] : $widget_id;
$hidden = isset($params[0]['_hide']) ? ' style="display:none;"' : '';
- $params[0]['before_widget'] = "
diff --git a/wp-admin/index-extra.php b/wp-admin/index-extra.php
index 22df0d67..efa2526c 100644
--- a/wp-admin/index-extra.php
+++ b/wp-admin/index-extra.php
@@ -10,7 +10,7 @@
require_once( './admin.php' );
/** Load WordPress Administration Dashboard API */
-require( './includes/dashboard.php' );
+require(ABSPATH . 'wp-admin/includes/dashboard.php' );
@header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
send_nosniff_header();
diff --git a/wp-admin/index.php b/wp-admin/index.php
index 789835c9..748141e0 100644
--- a/wp-admin/index.php
+++ b/wp-admin/index.php
@@ -24,25 +24,32 @@ add_thickbox();
$title = __('Dashboard');
$parent_file = 'index.php';
+if ( is_user_admin() )
+ add_screen_option('layout_columns', array('max' => 4, 'default' => 1) );
+else
+ add_screen_option('layout_columns', array('max' => 4, 'default' => 2) );
+
add_contextual_help($current_screen,
- '
' . __('Welcome to your WordPress Dashboard! You will find helpful tips in the Help tab of each screen to assist you as you get to know the application.') . '
' .
- '
' . __('The left-hand navigation menu provides links to the administration screens in your WordPress application. You can expand or collapse navigation sections by clicking on the arrow that appears on the right side of each navigation item when you hover over it. You can also minimize the navigation menu to a narrow icon strip by clicking on the separator lines between navigation sections that end in double arrowheads; when minimized, the submenu items will be displayed on hover.') . '
' .
- '
' . __('You can configure your dashboard by choosing which modules to display, how many columns to display them in, and where each module should be placed. You can hide/show modules and select the number of columns in the Screen Options tab. To rearrange the modules, drag and drop by clicking on the title bar of the selected module and releasing when you see a gray dotted-line box appear in the location you want to place the module. You can also expand or collapse each module by clicking once on the the module’s title bar. In addition, some modules are configurable, and will show a “Configure” link in the title bar when you hover over it.') . '
' .
- '
' . __('The modules on your Dashboard screen are:') . '
' .
- '
' . __('Right Now - Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.') . '
' .
- '
' . __('Recent Comments - Shows the most recent comments on your posts (configurable, up to 30) and allows you to moderate them.') . '
' .
- '
' . __('Incoming Links - Shows links to your site found by Google Blog Search.') . '
' .
- '
' . __('QuickPress - Allows you to create a new post and either publish it or save it as a draft.') . '
' .
- '
' . __('Recent Drafts - Displays links to the 5 most recent draft posts you’ve started.') . '
' .
- '
' . __('Other WordPress News - Shows the feed from WordPress Planet . You can configure it to show a different feed of your choosing.') . '
' .
- '
' . __('Plugins - Features the most popular, newest, and recently updated plugins from the WordPress.org Plugin Directory.') . '
' .
- '
' . __('For more information:') . '
' .
- '
' . __('Dashboard Documentation ') . '
' .
- '
' . __('Support Forums ') . '
'
+ '
' . __( 'Welcome to your WordPress Dashboard! You will find helpful tips in the Help tab of each screen to assist you as you get to know the application.' ) . '
' .
+ '
' . __( 'The Admin Bar at the top, new in 3.1, provides quick access to common tasks when you are viewing your site.' ) . '
' .
+ '
' . __( 'The left-hand navigation menu provides links to the administration screens in your WordPress application. You can expand or collapse navigation sections by clicking on the arrow that appears on the right side of each navigation item when you hover over it. You can also minimize the navigation menu to a narrow icon strip by clicking on the faint separator lines between the Dashboard and Posts sections, or between Comments and Appearance; when minimized, the submenu items will be displayed on hover.' ) . '
' .
+ '
' . __( 'You can configure your dashboard by choosing which boxes, or modules, to display in the work area, how many columns to display them in, and where each box should be placed. You can hide/show boxes and select the number of columns in the Screen Options tab. To rearrange the boxes, drag and drop by clicking on the title bar of the selected box and releasing when you see a gray dotted-line rectangle appear in the location you want to place the box. You can also expand or collapse each box by clicking once on the title bar of the box. In addition, some boxes are configurable, and will show a “Configure” link in the title bar when you hover over it.' ) . '
' .
+ '
' . __( 'The boxes on your Dashboard screen are:' ) . '
' .
+ '
' . __( 'Right Now - Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.' ) . '
' .
+ '
' . __( 'Recent Comments - Shows the most recent comments on your posts (configurable, up to 30) and allows you to moderate them.' ) . '
' .
+ '
' . __( 'Incoming Links - Shows links to your site found by Google Blog Search.' ) . '
' .
+ '
' . __( 'QuickPress - Allows you to create a new post and either publish it or save it as a draft.' ) . '
' .
+ '
' . __( 'Recent Drafts - Displays links to the 5 most recent draft posts you’ve started.' ) . '
' .
+ '
' . __( 'WordPress Development Blog - Come here for the latest scoop.' ) . '
' .
+ '
' . __( 'Other WordPress News - Shows the feed from WordPress Planet . You can configure it to show a different feed of your choosing.' ) . '
' .
+ '
' . __( 'Plugins - Features the most popular, newest, and recently updated plugins from the WordPress.org Plugin Directory.' ) . '
' .
+ '
' . __( 'For more information:' ) . '
' .
+ '
' . __( 'Documentation on Dashboard ' ) . '
' .
+ '
' . __( 'Support Forums ' ) . '
'
);
-require_once('./admin-header.php');
+include (ABSPATH . 'wp-admin/admin-header.php');
$today = current_time('mysql', 1);
?>
diff --git a/wp-admin/install-helper.php b/wp-admin/install-helper.php
index cddbc26a..2970b7cb 100644
--- a/wp-admin/install-helper.php
+++ b/wp-admin/install-helper.php
@@ -38,14 +38,6 @@
* @subpackage Plugin
*/
-/**
- * @global bool $wp_only_load_config
- * @name $wp_only_load_config
- * @var bool
- * @since unknown
- */
-$wp_only_load_config = true;
-
/** Load WordPress Bootstrap */
require_once(dirname(dirname(__FILE__)).'/wp-load.php');
@@ -54,7 +46,7 @@ require_once(dirname(dirname(__FILE__)).'/wp-load.php');
* @global bool|int $debug
* @name $debug
* @var bool|int
- * @since unknown
+ * @since 1.0.0
*/
$debug = 0;
@@ -62,7 +54,7 @@ if ( ! function_exists('maybe_create_table') ) :
/**
* Create database table, if it doesn't already exist.
*
- * @since unknown
+ * @since 1.0.0
* @package WordPress
* @subpackage Plugin
* @uses $wpdb
@@ -94,7 +86,7 @@ if ( ! function_exists('maybe_add_column') ) :
/**
* Add column to database table, if column doesn't already exist in table.
*
- * @since unknown
+ * @since 1.0.0
* @package WordPress
* @subpackage Plugin
* @uses $wpdb
@@ -129,7 +121,7 @@ endif;
/**
* Drop column from database table, if it exists.
*
- * @since unknown
+ * @since 1.0.0
* @package WordPress
* @subpackage Plugin
* @uses $wpdb
@@ -173,7 +165,7 @@ function maybe_drop_column($table_name, $column_name, $drop_ddl) {
* Default
* Extra
*
- * @since unknown
+ * @since 1.0.0
* @package WordPress
* @subpackage Plugin
*
@@ -222,4 +214,4 @@ function check_column($table_name, $col_name, $col_type, $is_null = null, $key =
return false;
}
-?>
+?>
\ No newline at end of file
diff --git a/wp-admin/install.php b/wp-admin/install.php
index d23073b6..0b65f523 100644
--- a/wp-admin/install.php
+++ b/wp-admin/install.php
@@ -246,7 +246,7 @@ switch($step) {
-
+
-
-
-
-
diff --git a/wp-admin/ms-users.php b/wp-admin/ms-users.php
index 594406ac..5b4f1c52 100644
--- a/wp-admin/ms-users.php
+++ b/wp-admin/ms-users.php
@@ -9,370 +9,6 @@
require_once( './admin.php' );
-if ( !is_multisite() )
- wp_die( __( 'Multisite support is not enabled.' ) );
-
-if ( ! current_user_can( 'manage_network_users' ) )
- wp_die( __( 'You do not have permission to access this page.' ) );
-
-$title = __( 'Users' );
-$parent_file = 'ms-admin.php';
-
-add_contextual_help($current_screen,
- '' . __('This table shows all users across the network and the sites to which they are assigned.') . '
' .
- '' . __('Hover over any user on the list to make the edit links appear. The Edit link on the left will take you to his or her Edit User profile page; the Edit link on the right by any site name goes to an Edit Site screen for that site.') . '
' .
- '' . __('You can also go to the user’s profile page by clicking on the individual username.') . '
' .
- '' . __('You can sort the table by clicking on any of the bold headings and switch between list and excerpt views by using the icons in the upper right.') . '
' .
- '' . __('The bulk action will permanently delete selected users, or mark/unmark those selected as spam. Spam users will have posts removed and will be unable to sign up again with the same email addresses.') . '
' .
- '' . __('Add User will add that person to this table and send them an email.') . '
' .
- '' . __('Users who are signed up to the network without a site are added as subscribers to the main or primary dashboard site, giving them profile pages to manage their accounts. These users will only see Dashboard and My Sites in the main navigation until a site is created for them.') . '
' .
- '' . __('You can make an existing user an additional super admin by going to the Edit User profile page and checking the box to grant that privilege.') . '
' .
- '' . __('For more information:') . '
' .
- '' . __('Network Users Documentation ') . '
' .
- '' . __('Support Forums ') . '
'
-);
-
-wp_enqueue_script( 'admin-forms' );
-
-require_once( './admin-header.php' );
-
-if ( isset( $_GET['updated'] ) && $_GET['updated'] == 'true' && ! empty( $_GET['action'] ) ) {
- ?>
-
- users}";
-
- if ( !empty( $like_s ) ) {
- $query .= " WHERE user_login LIKE '%$like_s%' OR user_email LIKE '%$like_s%'";
- }
-
- $order_by = isset( $_GET['sortby'] ) ? $_GET['sortby'] : 'id';
- if ( $order_by == 'email' ) {
- $query .= ' ORDER BY user_email ';
- } elseif ( $order_by == 'login' ) {
- $query .= ' ORDER BY user_login ';
- } elseif ( $order_by == 'name' ) {
- $query .= ' ORDER BY display_name ';
- } elseif ( $order_by == 'registered' ) {
- $query .= ' ORDER BY user_registered ';
- } else {
- $order_by = 'id';
- $query .= ' ORDER BY ID ';
- }
-
- $order = ( isset( $_GET['order'] ) && 'DESC' == $_GET['order'] ) ? 'DESC' : 'ASC';
- $query .= $order;
-
- $total = $wpdb->get_var( str_replace( 'SELECT *', 'SELECT COUNT(ID)', $query ) );
-
- $query .= " LIMIT " . intval( ( $pagenum - 1 ) * $per_page) . ", " . intval( $per_page );
-
- $user_list = $wpdb->get_results( $query, ARRAY_A );
-
- $num_pages = ceil( $total / $per_page );
- $page_links = paginate_links( array(
- 'base' => add_query_arg( 'paged', '%#%' ),
- 'format' => '',
- 'prev_text' => __( '«' ),
- 'next_text' => __( '»' ),
- 'total' => $num_pages,
- 'current' => $pagenum
- ));
-
- if ( empty( $_GET['mode'] ) )
- $mode = 'list';
- else
- $mode = esc_attr( $_GET['mode'] );
-
- ?>
-
-
-
-
- ' . __( 'Search results for “%s”' ) . '', esc_html( $s ) );
- ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ' . __( 'Displaying %s–%s of %s' ) . '%s',
- number_format_i18n( ( $pagenum - 1 ) * $per_page + 1 ),
- number_format_i18n( min( $pagenum * $per_page, $total ) ),
- number_format_i18n( $total ),
- $page_links
- ); echo $page_links_text; ?>
-
-
-
-
-
-
-
- 'display name'
- $users_columns = array(
- 'id' => __( 'ID' ),
- 'login' => __( 'Username' ),
- 'name' => __( 'Name' ),
- 'email' => __( 'E-mail' ),
- 'registered' => _x( 'Registered', 'user' ),
- 'blogs' => __( 'Sites' )
- );
- $users_columns = apply_filters( 'wpmu_users_columns', $users_columns );
- ?>
-
-
-
- $page_links_text
";
- ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/wp-admin/my-sites.php b/wp-admin/my-sites.php
index f38ac1c1..4e13096f 100644
--- a/wp-admin/my-sites.php
+++ b/wp-admin/my-sites.php
@@ -42,7 +42,7 @@ add_contextual_help($current_screen,
'' . __('This screen shows an individual user all of their sites in this network, and also allows that user to set a primary site. He or she can use the links under each site to visit either the frontend or the dashboard for that site.') . '
' .
'' . __('Up until WordPress version 3.0, what is now called a Multi-site Network had to be installed separately as WordPress MU (multi-user).') . '
' .
'' . __('For more information:') . '
' .
- '' . __('My Sites Documentation ') . '
' .
+ '' . __('Documentation on My Sites ') . '
' .
'' . __('Support Forums ') . '
'
);
@@ -102,9 +102,7 @@ if ( $updated ) { ?>
-
-
-
+
' . __('The current theme does not natively support menus, but you can use the “Custom Menu” widget to add any menus you create here to the theme’s sidebar.') . '
';
-$help = '' . __('This feature is new in version 3.0; to use a custom menu in place of your theme’s default menus, support for this feature must be registered in the theme’s functions.php file. If your theme does not support the custom menus feature yet (the new default theme, Twenty Ten, does), you can learn about adding support yourself by following the below link.') . '
';
+$help = '' . __('This feature, introduced in version 3.0, allows you to use a custom menu in place of your theme’s default menus. If your theme does not support the custom menus feature yet (the default theme, Twenty Ten, does), you can learn about adding this support by following the Documentation link in this tab. You can still use the “Custom Menu” widget to add menus to a sidebar.') . '
';
$help .= '' . __('You can create custom menus for your site. These menus may contain links to pages, categories, custom links or other content types (use the Screen Options tab to decide which ones to show on the screen). You can specify a different navigation label for a menu item as well as other attributes. You can create multiple menus. If your theme includes more than one menu, you can choose which custom menu to associate with each. You can also use custom menus in conjunction with the Custom Menus widget.') . '
';
-$help .= '' . __('To create a new custom menu, click on the + tab, give the menu a name, and click Create Menu. Next, add menu items from the appropriate boxes. You’ll be able to edit the information for each menu item, and can drag and drop to put them in order. You can also drag a menu item a little to the right to make it a submenu, to create menus with hierarchy. You’ll see when the position of the drop target shifts over to create the nested placement. Don’t forget to click Save when you’re finished.') . '
';
+$help .= '' . __('To create a new custom menu, click on the + tab, give the menu a name, and click Create Menu. Next, add menu items from the appropriate boxes. You’ll be able to edit the information for each menu item, and can drag and drop to put them in order. You can also drag a menu item a little to the right to make it a submenu, to create menus with hierarchy. Drop the item into its new nested placement when the dotted rectangle target shifts over, also a little to the right. Don’t forget to click Save when you’re finished.') . '
';
$help .= '' . __('For more information:') . '
';
-$help .= '' . __('Menus Documentation ') . '
';
+$help .= '' . __('Documentation on Menus ') . '
';
$help .= '' . __('Support Forums ') . '
';
add_contextual_help($current_screen, $help);
// Get the admin header
-require_once( 'admin-header.php' );
+require_once( './admin-header.php' );
?>
@@ -494,7 +494,7 @@ require_once( 'admin-header.php' );
-
+
@@ -556,7 +556,7 @@ require_once( 'admin-header.php' );
-
+
@@ -590,6 +590,13 @@ require_once( 'admin-header.php' );
?>
+
@@ -598,4 +605,4 @@ require_once( 'admin-header.php' );
-
+
diff --git a/wp-admin/network.php b/wp-admin/network.php
index a2951641..6a9aca33 100644
--- a/wp-admin/network.php
+++ b/wp-admin/network.php
@@ -18,8 +18,14 @@ require_once( './admin.php' );
if ( ! is_super_admin() )
wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
-if ( is_multisite() && ! defined( 'MULTISITE' ) )
- wp_die( __( 'The Network creation panel is not for WordPress MU networks.' ) );
+if ( is_multisite() ) {
+ if ( ! is_network_admin() ) {
+ wp_redirect( network_admin_url( 'setup.php' ) );
+ exit;
+ }
+ if ( ! defined( 'MULTISITE' ) )
+ wp_die( __( 'The Network creation panel is not for WordPress MU networks.' ) );
+}
// We need to create references to ms global tables to enable Network.
foreach ( $wpdb->tables( 'ms_global' ) as $table => $prefixed_table )
@@ -89,8 +95,13 @@ function get_clean_basedomain() {
if ( ! network_domain_check() && ( ! defined( 'WP_ALLOW_MULTISITE' ) || ! WP_ALLOW_MULTISITE ) )
wp_die( __( 'You must define the WP_ALLOW_MULTISITE
constant as true in your wp-config.php file to allow creation of a Network.' ) );
-$title = __( 'Create a Network of WordPress Sites' );
-$parent_file = 'tools.php';
+if ( is_network_admin() ) {
+ $title = __( 'Network Setup' );
+ $parent_file = 'settings.php';
+} else {
+ $title = __( 'Create a Network of WordPress Sites' );
+ $parent_file = 'tools.php';
+}
add_contextual_help($current_screen,
'' . __('This screen allows you to configure a network as having subdomains (site1.example.com
) or subdirectories (example.com/site1
). Subdomains require wildcard subdomains to be enabled in Apache and DNS records, if your host allows it.') . '
' .
@@ -100,15 +111,15 @@ add_contextual_help($current_screen,
'' . __('Refreshing your browser will take you to a screen with an archive of those added lines of code. A set of six links under Super Admin will appear at the top of the main left navigation menu. The multisite network is now enabled.') . '
' .
'' . __('The choice of subdirectory sites is disabled if this setup is more than a month old because of permalink problems with “/blog/” from the main site. This disabling will be addressed soon in a future version.') . '
' .
'' . __('For more information:') . '
' .
- '' . __('General Network Creation Documentation ') . '
' .
- '' . __('Tools > Network Documentation ') . '
' .
+ '' . __('Documentation on Creating a Network ') . '
' .
+ '' . __('Documentation on the Network Screen ') . '
' .
'' . __('Support Forums ') . '
'
);
-include( './admin-header.php' );
+include( ABSPATH . 'wp-admin/admin-header.php' );
?>
-
+
' . __('Error:') . ' ' . sprintf( __( 'Your WordPress address must match your Site address before creating a Network. See General Settings .' ), esc_url( admin_url( 'options-general.php' ) ) ) . '
';
echo '';
- include ('./admin-footer.php' );
+ include ( ABSPATH . 'wp-admin/admin-footer.php' );
+ die();
+ }
+
+ if ( defined('DO_NOT_UPGRADE_GLOBAL_TABLES') ) {
+ echo '' . __('Error:') . ' ' . __( 'The constant DO_NOT_UPGRADE_GLOBAL_TABLES cannot be defined when creating a network.' ) . '
';
+ echo '';
+ include ( ABSPATH . 'wp-admin/admin-footer.php' );
die();
}
@@ -134,7 +152,7 @@ function network_step1( $errors = false ) {
if ( ! empty( $active_plugins ) ) {
echo '' . __('Warning:') . ' ' . sprintf( __( 'Please deactivate your plugins before enabling the Network feature.' ), admin_url( 'plugins.php?plugin_status=active' ) ) . '
' . __( 'Once the network is created, you may reactivate your plugins.' ) . '
';
echo '';
- include( './admin-footer.php' );
+ include( ABSPATH . 'wp-admin/admin-footer.php' );
die();
}
@@ -145,7 +163,7 @@ function network_step1( $errors = false ) {
echo '' . sprintf( __( 'You cannot use port numbers such as %s
.' ), $has_ports ) . '
';
echo '' . __( 'Return to Dashboard' ) . ' ';
echo '';
- include( './admin-footer.php' );
+ include( ABSPATH . 'wp-admin/admin-footer.php' );
die();
}
@@ -275,9 +293,9 @@ function network_step1( $errors = false ) {
- ' />
+
- ' . $errors->get_error_message() . '';
if ( $_POST ) {
- $subdomain_install = allow_subdomain_install() ? ( allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true ) : false;
+ if ( allow_subdomain_install() )
+ $subdomain_install = allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true;
+ else
+ $subdomain_install = false;
} else {
if ( is_multisite() ) {
$subdomain_install = is_subdomain_install();
?>
-
-
+get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" );
?>
@@ -314,17 +339,19 @@ function network_step2( $errors = false ) {
Caution: We recommend you back up your existing wp-config.php
file.' );
+ if ( file_exists( ABSPATH . '.htaccess' ) )
+ printf( __( 'Caution: We recommend you back up your existing wp-config.php
and %s
files.' ), '.htaccess' );
+ elseif ( file_exists( ABSPATH . 'web.config' ) )
+ printf( __( 'Caution: We recommend you back up your existing wp-config.php
and %s
files.' ), 'web.config' );
else
- _e( 'Caution: We recommend you back up your existing wp-config.php
and .htaccess
files.' );
+ _e( 'Caution: We recommend you back up your existing wp-config.php
file.' );
?>
blogs.dir directory in %s
. This directory is used to stored uploaded media for your additional sites and must be writeable by the web server.' ), WP_CONTENT_DIR );
+ printf( __( 'Create a blogs.dir
directory at %s/blogs.dir
. This directory is used to store uploaded media for your additional sites and must be writeable by the web server.' ), WP_CONTENT_DIR );
if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' )
echo ' ' . __('Warning:') . ' ' . __( 'Networks may not be fully compatible with custom wp-content directories.' ) . '
@@ -344,26 +371,23 @@ define( 'BLOG_ID_CURRENT_SITE', 1 );
unset( $keys_salts[ $c ] );
}
if ( ! empty( $keys_salts ) ) {
+ $keys_salts_str = '';
$from_api = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' );
if ( is_wp_error( $from_api ) ) {
foreach ( $keys_salts as $c => $v ) {
- $keys_salts[ $c ] = wp_generate_password( 64, true, true );
+ $keys_salts_str .= "\ndefine( '$c', '" . wp_generate_password( 64, true, true ) . "' );";
}
} else {
$from_api = explode( "\n", wp_remote_retrieve_body( $from_api ) );
foreach ( $keys_salts as $c => $v ) {
- $keys_salts[ $c ] = substr( array_shift( $from_api ), 28, 64 );
+ $keys_salts_str .= "\ndefine( '$c', '" . substr( array_shift( $from_api ), 28, 64 ) . "' );";
}
}
$num_keys_salts = count( $keys_salts );
?>
wp-config.php file.', 'These unique authentication keys are also missing from your wp-config.php
file.', $num_keys_salts ); ?>
- $v ) {
- echo "\ndefine( '$c', '$v' );";
- }
-?>
+
@@ -430,7 +454,7 @@ define( 'BLOG_ID_CURRENT_SITE', 1 );
-
+
@@ -449,7 +473,7 @@ define( 'BLOG_ID_CURRENT_SITE', 1 );
?>
web.config file in %s
, replacing other WordPress rules:' ), ABSPATH ); ?>
-
+
@@ -471,14 +495,14 @@ RewriteRule ^ - [L]';
// @todo custom content dir.
if ( ! $subdomain_install )
- $htaccess_file .= "\nRewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]\nRewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]";
+ $htaccess_file .= "\nRewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]\nRewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]";
$htaccess_file .= "\nRewriteRule . index.php [L]";
?>
.htaccess file in %s
, replacing other WordPress rules:' ), ABSPATH ); ?>
-
+
-
+
diff --git a/wp-admin/network/admin.php b/wp-admin/network/admin.php
new file mode 100644
index 00000000..d4374de0
--- /dev/null
+++ b/wp-admin/network/admin.php
@@ -0,0 +1,22 @@
+
diff --git a/wp-admin/network/edit.php b/wp-admin/network/edit.php
new file mode 100644
index 00000000..2d3f9522
--- /dev/null
+++ b/wp-admin/network/edit.php
@@ -0,0 +1,482 @@
+
+
+
+
+
+ ID'>$current_user->user_login";
+
+ foreach ( ( $allusers = (array) $_POST['allusers'] ) as $key => $val ) {
+ if ( $val != '' && $val != '0' ) {
+ $delete_user = new WP_User( $val );
+
+ if ( ! current_user_can( 'delete_user', $delete_user->ID ) )
+ wp_die( sprintf( __( 'Warning! User %s cannot be deleted.' ), $delete_user->user_login ) );
+
+ if ( in_array( $delete_user->user_login, $site_admins ) )
+ wp_die( sprintf( __( 'Warning! User cannot be deleted. The user %s is a network admnistrator.' ), $delete_user->user_login ) );
+
+ echo " \n";
+ $blogs = get_blogs_of_user( $val, true );
+
+ if ( !empty( $blogs ) ) {
+ ?>
+ %s?" ), $delete_user->user_login ); ?>
+ $details ) {
+ $blog_users = get_users( array( 'blog_id' => $details->userblog_id ) );
+ if ( is_array( $blog_users ) && !empty( $blog_users ) ) {
+ $user_site = "{$details->blogname} ";
+ $user_dropdown = "";
+ $user_list = '';
+ foreach ( $blog_users as $user ) {
+ if ( ! in_array( $user->ID, $allusers ) )
+ $user_list .= "{$user->user_login} ";
+ }
+ if ( '' == $user_list )
+ $user_list = $admin_out;
+ $user_dropdown .= $user_list;
+ $user_dropdown .= " \n";
+ ?>
+
+ ";
+ }
+ }
+ }
+
+ submit_button( __('Confirm Deletion'), 'delete' );
+ ?>
+
+ options page.' ), esc_url( admin_url( 'settings.php' ) ) ) );
+
+ if ( isset($_POST['WPLANG']) && ( '' === $_POST['WPLANG'] || in_array( $_POST['WPLANG'], get_available_languages() ) ) )
+ update_site_option( 'WPLANG', $_POST['WPLANG'] );
+
+ if ( is_email( $_POST['admin_email'] ) )
+ update_site_option( 'admin_email', $_POST['admin_email'] );
+
+ $illegal_names = split( ' ', $_POST['illegal_names'] );
+ foreach ( (array) $illegal_names as $name ) {
+ $name = trim( $name );
+ if ( $name != '' )
+ $names[] = trim( $name );
+ }
+ update_site_option( 'illegal_names', $names );
+
+ if ( $_POST['limited_email_domains'] != '' ) {
+ $limited_email_domains = str_replace( ' ', "\n", $_POST['limited_email_domains'] );
+ $limited_email_domains = split( "\n", stripslashes( $limited_email_domains ) );
+ $limited_email = array();
+ foreach ( (array) $limited_email_domains as $domain ) {
+ $domain = trim( $domain );
+ if ( ! preg_match( '/(--|\.\.)/', $domain ) && preg_match( '|^([a-zA-Z0-9-\.])+$|', $domain ) )
+ $limited_email[] = trim( $domain );
+ }
+ update_site_option( 'limited_email_domains', $limited_email );
+ } else {
+ update_site_option( 'limited_email_domains', '' );
+ }
+
+ if ( $_POST['banned_email_domains'] != '' ) {
+ $banned_email_domains = split( "\n", stripslashes( $_POST['banned_email_domains'] ) );
+ $banned = array();
+ foreach ( (array) $banned_email_domains as $domain ) {
+ $domain = trim( $domain );
+ if ( ! preg_match( '/(--|\.\.)/', $domain ) && preg_match( '|^([a-zA-Z0-9-\.])+$|', $domain ) )
+ $banned[] = trim( $domain );
+ }
+ update_site_option( 'banned_email_domains', $banned );
+ } else {
+ update_site_option( 'banned_email_domains', '' );
+ }
+
+ $options = array( 'registrationnotification', 'registration', 'add_new_users', 'menu_items', 'mu_media_buttons', 'upload_space_check_disabled', 'blog_upload_space', 'upload_filetypes', 'site_name', 'first_post', 'first_page', 'first_comment', 'first_comment_url', 'first_comment_author', 'welcome_email', 'welcome_user_email', 'fileupload_maxk', 'global_terms_enabled' );
+ $checked_options = array( 'mu_media_buttons' => array(), 'menu_items' => array(), 'registrationnotification' => 'no', 'upload_space_check_disabled' => 1, 'add_new_users' => 0 );
+ foreach ( $checked_options as $option_name => $option_unchecked_value ) {
+ if ( ! isset( $_POST[$option_name] ) )
+ $_POST[$option_name] = $option_unchecked_value;
+ }
+ foreach ( $options as $option_name ) {
+ if ( ! isset($_POST[$option_name]) )
+ continue;
+ $value = stripslashes_deep( $_POST[$option_name] );
+ update_site_option( $option_name, $value );
+ }
+
+ // Update more options here
+ do_action( 'update_wpmu_options' );
+
+ wp_redirect( add_query_arg( 'updated', 'true', network_admin_url( 'settings.php' ) ) );
+ exit();
+ break;
+
+ case 'updateblog':
+ // No longer used.
+ break;
+
+ case 'deleteblog':
+ check_admin_referer('deleteblog');
+ if ( ! ( current_user_can( 'manage_sites' ) && current_user_can( 'delete_sites' ) ) )
+ wp_die( __( 'You do not have permission to access this page.' ) );
+
+ if ( $id != '0' && $id != $current_site->blog_id && current_user_can( 'delete_site', $id ) ) {
+ wpmu_delete_blog( $id, true );
+ wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'delete' ), wp_get_referer() ) );
+ } else {
+ wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'not_deleted' ), wp_get_referer() ) );
+ }
+
+ exit();
+ break;
+
+ case 'allblogs':
+ if ( ( isset( $_POST['action'] ) || isset( $_POST['action2'] ) ) && isset( $_POST['allblogs'] ) ) {
+ check_admin_referer( 'bulk-sites' );
+
+ if ( ! current_user_can( 'manage_sites' ) )
+ wp_die( __( 'You do not have permission to access this page.' ) );
+
+ if ( $_GET['action'] != -1 || $_POST['action2'] != -1 )
+ $doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2'];
+
+ $blogfunction = '';
+
+ foreach ( (array) $_POST['allblogs'] as $key => $val ) {
+ if ( $val != '0' && $val != $current_site->blog_id ) {
+ switch ( $doaction ) {
+ case 'delete':
+ if ( ! current_user_can( 'delete_site', $val ) )
+ wp_die( __( 'You are not allowed to delete the site.' ) );
+ $blogfunction = 'all_delete';
+ wpmu_delete_blog( $val, true );
+ break;
+
+ case 'spam':
+ $blogfunction = 'all_spam';
+ update_blog_status( $val, 'spam', '1' );
+ set_time_limit( 60 );
+ break;
+
+ case 'notspam':
+ $blogfunction = 'all_notspam';
+ update_blog_status( $val, 'spam', '0' );
+ set_time_limit( 60 );
+ break;
+ }
+ } else {
+ wp_die( __( 'You are not allowed to change the current site.' ) );
+ }
+ }
+
+ wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $blogfunction ), wp_get_referer() ) );
+ } else {
+ wp_redirect( network_admin_url( 'sites.php' ) );
+ }
+ exit();
+ break;
+
+ case 'archiveblog':
+ check_admin_referer( 'archiveblog' );
+ if ( ! current_user_can( 'manage_sites' ) )
+ wp_die( __( 'You do not have permission to access this page.' ) );
+
+ update_blog_status( $id, 'archived', '1' );
+ wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'archive' ), wp_get_referer() ) );
+ exit();
+ break;
+
+ case 'unarchiveblog':
+ check_admin_referer( 'unarchiveblog' );
+ if ( ! current_user_can( 'manage_sites' ) )
+ wp_die( __( 'You do not have permission to access this page.' ) );
+
+ update_blog_status( $id, 'archived', '0' );
+ wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'unarchive' ), wp_get_referer() ) );
+ exit();
+ break;
+
+ case 'activateblog':
+ check_admin_referer( 'activateblog' );
+ if ( ! current_user_can( 'manage_sites' ) )
+ wp_die( __( 'You do not have permission to access this page.' ) );
+
+ update_blog_status( $id, 'deleted', '0' );
+ do_action( 'activate_blog', $id );
+ wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'activate' ), wp_get_referer() ) );
+ exit();
+ break;
+
+ case 'deactivateblog':
+ check_admin_referer( 'deactivateblog' );
+ if ( ! current_user_can( 'manage_sites' ) )
+ wp_die( __( 'You do not have permission to access this page.' ) );
+
+ do_action( 'deactivate_blog', $id );
+ update_blog_status( $id, 'deleted', '1' );
+ wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'deactivate' ), wp_get_referer() ) );
+ exit();
+ break;
+
+ case 'unspamblog':
+ check_admin_referer( 'unspamblog' );
+ if ( ! current_user_can( 'manage_sites' ) )
+ wp_die( __( 'You do not have permission to access this page.' ) );
+
+ update_blog_status( $id, 'spam', '0' );
+ wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'unspam' ), wp_get_referer() ) );
+ exit();
+ break;
+
+ case 'spamblog':
+ check_admin_referer( 'spamblog' );
+ if ( ! current_user_can( 'manage_sites' ) )
+ wp_die( __( 'You do not have permission to access this page.' ) );
+
+ update_blog_status( $id, 'spam', '1' );
+ wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'spam' ), wp_get_referer() ) );
+ exit();
+ break;
+
+ case 'unmatureblog':
+ check_admin_referer( 'unmatureblog' );
+ if ( ! current_user_can( 'manage_sites' ) )
+ wp_die( __( 'You do not have permission to access this page.' ) );
+
+ update_blog_status( $id, 'mature', '0' );
+ wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'unmature' ), wp_get_referer() ) );
+ exit();
+ break;
+
+ case 'matureblog':
+ check_admin_referer( 'matureblog' );
+ if ( ! current_user_can( 'manage_sites' ) )
+ wp_die( __( 'You do not have permission to access this page.' ) );
+
+ update_blog_status( $id, 'mature', '1' );
+ wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'mature' ), wp_get_referer() ) );
+ exit();
+ break;
+
+ // Common
+ case 'confirm':
+ check_admin_referer( 'confirm' );
+ if ( !headers_sent() ) {
+ nocache_headers();
+ header( 'Content-Type: text/html; charset=utf-8' );
+ }
+ if ( $current_site->blog_id == $id )
+ wp_die( __( 'You are not allowed to change the current site.' ) );
+ ?>
+
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ';
+ confirm_delete_users( $_POST['allusers'] );
+ echo '';
+ require_once( '../admin-footer.php' );
+ } else {
+ wp_redirect( network_admin_url( 'users.php' ) );
+ }
+ exit();
+ break;
+
+ case 'allusers':
+ if ( !current_user_can( 'manage_network_users' ) )
+ wp_die( __( 'You do not have permission to access this page.' ) );
+
+ if ( ( isset( $_POST['action']) || isset($_POST['action2'] ) ) && isset( $_POST['allusers'] ) ) {
+ check_admin_referer( 'bulk-users-network' );
+
+ if ( $_GET['action'] != -1 || $_POST['action2'] != -1 )
+ $doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2'];
+
+ $userfunction = '';
+
+ foreach ( (array) $_POST['allusers'] as $key => $val ) {
+ if ( !empty( $val ) ) {
+ switch ( $doaction ) {
+ case 'delete':
+ if ( ! current_user_can( 'delete_users' ) )
+ wp_die( __( 'You do not have permission to access this page.' ) );
+ $title = __( 'Users' );
+ $parent_file = 'users.php';
+ require_once( '../admin-header.php' );
+ echo '';
+ confirm_delete_users( $_POST['allusers'] );
+ echo '
';
+ require_once( '../admin-footer.php' );
+ exit();
+ break;
+
+ case 'spam':
+ $user = new WP_User( $val );
+ if ( in_array( $user->user_login, get_super_admins() ) )
+ wp_die( sprintf( __( 'Warning! User cannot be modified. The user %s is a network administrator.' ), esc_html( $user->user_login ) ) );
+
+ $userfunction = 'all_spam';
+ $blogs = get_blogs_of_user( $val, true );
+ foreach ( (array) $blogs as $key => $details ) {
+ if ( $details->userblog_id != $current_site->blog_id ) // main blog not a spam !
+ update_blog_status( $details->userblog_id, 'spam', '1' );
+ }
+ update_user_status( $val, 'spam', '1' );
+ break;
+
+ case 'notspam':
+ $userfunction = 'all_notspam';
+ $blogs = get_blogs_of_user( $val, true );
+ foreach ( (array) $blogs as $key => $details )
+ update_blog_status( $details->userblog_id, 'spam', '0' );
+
+ update_user_status( $val, 'spam', '0' );
+ break;
+ }
+ }
+ }
+
+ wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $userfunction ), wp_get_referer() ) );
+ } else {
+ $location = network_admin_url( 'users.php' );
+
+ if ( ! empty( $_REQUEST['paged'] ) )
+ $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location );
+ wp_redirect( $location );
+ }
+ exit();
+ break;
+
+ case 'dodelete':
+ check_admin_referer( 'ms-users-delete' );
+ if ( ! ( current_user_can( 'manage_network_users' ) && current_user_can( 'delete_users' ) ) )
+ wp_die( __( 'You do not have permission to access this page.' ) );
+
+ if ( ! empty( $_POST['blog'] ) && is_array( $_POST['blog'] ) ) {
+ foreach ( $_POST['blog'] as $id => $users ) {
+ foreach ( $users as $blogid => $user_id ) {
+ if ( ! current_user_can( 'delete_user', $id ) )
+ continue;
+
+ if ( ! empty( $_POST['delete'] ) && 'reassign' == $_POST['delete'][$blogid][$id] )
+ remove_user_from_blog( $id, $blogid, $user_id );
+ else
+ remove_user_from_blog( $id, $blogid );
+ }
+ }
+ }
+ $i = 0;
+ if ( is_array( $_POST['user'] ) && ! empty( $_POST['user'] ) )
+ foreach( $_POST['user'] as $id ) {
+ if ( ! current_user_can( 'delete_user', $id ) )
+ continue;
+ wpmu_delete_user( $id );
+ $i++;
+ }
+
+ if ( $i == 1 )
+ $deletefunction = 'delete';
+ else
+ $deletefunction = 'all_delete';
+
+ wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $deletefunction ), network_admin_url( 'users.php' ) ) );
+ exit();
+ break;
+
+ default:
+ // Let plugins use us as a post handler easily
+ do_action( 'network_admin_edit_' . $_GET['action'] );
+ wp_redirect( network_admin_url( 'index.php' ) );
+ exit();
+ break;
+}
+?>
diff --git a/wp-admin/network/index-extra.php b/wp-admin/network/index-extra.php
new file mode 100644
index 00000000..17ead786
--- /dev/null
+++ b/wp-admin/network/index-extra.php
@@ -0,0 +1,13 @@
+' . __('Until WordPress 3.0, running multiple sites required using WordPress MU instead of regular WordPress. In version 3.0, these applications have merged. If you are a former MU user, you should be aware of the following changes:') . '' .
+ '' . __('Site Admin is now Super Admin (we highly encourage you to get yourself a cape!).') . ' ' .
+ '' . __('Blogs are now called Sites; Site is now called Network.') . ' ' .
+ '' . __('This screen provides the network administrator with links to the screens for Sites and Users to either create a new site or user, or to search existing users and sites, as well as Dashboard widgets. Those screens are also accessible through the left-hand navigation in the Network Admin section.') . '
' .
+ '' . __('For more information:') . '
' .
+ '' . __('Documentation on the Network Admin ') . '
' .
+ '' . __('Support Forums ') . '
'
+);
+
+wp_dashboard_setup();
+
+wp_enqueue_script( 'dashboard' );
+wp_enqueue_script( 'plugin-install' );
+wp_admin_css( 'dashboard' );
+wp_admin_css( 'plugin-install' );
+add_thickbox();
+
+add_screen_option('layout_columns', array('max' => 4, 'default' => 2) );
+
+require_once( '../admin-header.php' );
+
+?>
+
+
+
+
diff --git a/wp-admin/network/menu.php b/wp-admin/network/menu.php
new file mode 100644
index 00000000..7fbfb995
--- /dev/null
+++ b/wp-admin/network/menu.php
@@ -0,0 +1,73 @@
+response) )
+ $theme_update_count = count( $update_themes->response );
+$menu[15] = array(sprintf(__('Themes %s'), "" . number_format_i18n($theme_update_count) . " " ), 'manage_network_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div');
+$submenu['themes.php'][5] = array( __('Themes'), 'manage_network_themes', 'themes.php' );
+$submenu['themes.php'][10] = array( _x('Add New', 'theme'), 'install_themes', 'theme-install.php' );
+$submenu['themes.php'][15] = array( _x('Editor', 'theme editor'), 'edit_themes', 'theme-editor.php' );
+
+$update_plugins = get_site_transient( 'update_plugins' );
+if ( !empty($update_plugins->response) )
+ $plugin_update_count = count( $update_plugins->response );
+$menu[20] = array(sprintf( __('Plugins %s'), "" . number_format_i18n($plugin_update_count) . " " ), 'manage_network_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'div');
+$submenu['plugins.php'][5] = array( __('Plugins'), 'manage_network_plugins', 'plugins.php' );
+$submenu['plugins.php'][10] = array( _x('Add New', 'plugin editor'), 'install_plugins', 'plugin-install.php' );
+$submenu['plugins.php'][15] = array( _x('Editor', 'plugin editor'), 'edit_plugins', 'plugin-editor.php' );
+
+
+$menu[25] = array(__('Settings'), 'manage_network_options', 'settings.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'div');
+if ( defined( 'MULTISITE' ) && defined( 'WP_ALLOW_MULTISITE' ) && WP_ALLOW_MULTISITE ) {
+ $submenu['settings.php'][5] = array( __('Settings'), 'manage_network_options', 'settings.php' );
+ $submenu['settings.php'][10] = array( __('Network Setup'), 'manage_network_options', 'setup.php' );
+}
+
+$update_wordpress = get_core_updates( array('dismissed' => false) );
+if ( !empty($update_wordpress) && !in_array( $update_wordpress[0]->response, array('development', 'latest') ) )
+ $wordpress_update_count = 1;
+
+$update_count = $plugin_update_count + $theme_update_count + $wordpress_update_count;
+$update_title = array();
+if ( $wordpress_update_count )
+ $update_title[] = sprintf(__('%d WordPress Update'), $wordpress_update_count);
+if ( $plugin_update_count )
+ $update_title[] = sprintf(_n('%d Plugin Update', '%d Plugin Updates', $plugin_update_count), $plugin_update_count);
+if ( $theme_update_count )
+ $update_title[] = sprintf(_n('%d Theme Update', '%d Themes Updates', $theme_update_count), $theme_update_count);
+
+$update_title = !empty($update_title) ? esc_attr(implode(', ', $update_title)) : '';
+
+$menu[30] = array(sprintf( __('Updates %s'), "" . number_format_i18n($update_count) . " " ), 'manage_network', 'upgrade.php', '', 'menu-top menu-icon-tools', 'menu-update', 'div');
+$submenu[ 'upgrade.php' ][10] = array( __( 'Updates' ), 'update_core', 'update-core.php' );
+$submenu[ 'upgrade.php' ][15] = array( __( 'Update Network' ), 'manage_network', 'upgrade.php' );
+unset($plugin_update_count, $theme_update_count, $wordpress_update_count, $update_count, $update_title, $update_themes, $update_plugins, $update_wordpress);
+
+
+$menu[99] = array( '', 'read', 'separator-last', '', 'wp-menu-separator-last' );
+
+require_once(ABSPATH . 'wp-admin/includes/menu.php');
+
+?>
\ No newline at end of file
diff --git a/wp-admin/network/plugin-editor.php b/wp-admin/network/plugin-editor.php
new file mode 100644
index 00000000..8850aa8f
--- /dev/null
+++ b/wp-admin/network/plugin-editor.php
@@ -0,0 +1,16 @@
+' . __('This screen sets and changes options for the network as a whole. The first site is the main site in the network and network options are pulled from that original site’s options.') . '' .
+ '' . __('Operational settings has fields for the network’s name and admin email.') . '
' .
+ '' . __('Dashboard Site is an option to give a site to users who do not have a site on the system. Their default role is Subscriber, but that default can be changed. The Admin Notice Feed can provide a notice on all dashboards of the latest post via RSS or Atom, or provide no such notice if left blank.') . '
' .
+ '' . __('Registration settings can disable/enable public signups. If you let others sign up for a site, install spam plugins. Spaces, not commas, should separate names banned as sites for this network.') . '
' .
+ '' . __('New site settings are defaults applied when a new site is created in the network. These include welcome email for when a new site or user account is registered, and what᾿s put in the first post, page, comment, comment author, and comment URL.') . '
' .
+ '' . __('Upload settings control the size of the uploaded files and the amount of available upload space for each site. You can change the default value for specific sites when you edit a particular site. Allowed file types are also listed (space separated only).') . '
' .
+ '' . __('Checkboxes for media upload buttons set which are shown in the visual editor. If unchecked, a generic upload button is still visible; other media types can still be uploaded if on the allowed file types list.') . '
' .
+ '' . __('Menu setting enables/disables the plugin menus from appearing for non super admins, so that only super admins, not site admins, have access to activate plugins.') . '
' .
+ '' . __('Super admins can no longer be added on the Options screen. You must now go to the list of existing users on Super Admin > Users and click on Username or the Edit action link below that name. This goes to an Edit User page where you can check a box to grant super admin privileges.') . '
' .
+ '' . __('For more information:') . '
' .
+ '' . __('Documentation on Network Settings ') . '
' .
+ '' . __('Support Forums ') . '
'
+);
+
+include( '../admin-header.php' );
+
+if (isset($_GET['updated'])) {
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/wp-admin/network/setup.php b/wp-admin/network/setup.php
new file mode 100644
index 00000000..e5d5880f
--- /dev/null
+++ b/wp-admin/network/setup.php
@@ -0,0 +1,16 @@
+' . __('The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.') . '' .
+ '' . __('Info - The domain and path are rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.') . '
' .
+ '' . __('Users - This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network.') . '
' .
+ '' . sprintf( __('Themes - This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site’s Appearance menu. To enable a theme for the entire network, see the Network Themes screen.' ), network_admin_url( 'themes.php' ) ) . '
' .
+ '' . __('Settings - This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database.') . '
' .
+ '' . __('For more information:') . '
' .
+ '' . __('Documentation on Site Management ') . '
' .
+ '' . __('Support Forums ') . '
'
+);
+
+$id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
+
+if ( ! $id )
+ wp_die( __('Invalid site ID.') );
+
+$details = get_blog_details( $id );
+if ( !can_edit_network( $details->site_id ) )
+ wp_die( __( 'You do not have permission to access this page.' ) );
+
+$is_main_site = is_main_site( $id );
+
+if ( isset($_REQUEST['action']) && 'update-site' == $_REQUEST['action'] ) {
+ check_admin_referer( 'edit-site' );
+
+ switch_to_blog( $id );
+
+ if ( isset( $_POST['update_home_url'] ) && $_POST['update_home_url'] == 'update' ) {
+ $blog_address = get_blogaddress_by_domain( $_POST['blog']['domain'], $_POST['blog']['path'] );
+ if ( get_option( 'siteurl' ) != $blog_address )
+ update_option( 'siteurl', $blog_address );
+
+ if ( get_option( 'home' ) != $blog_address )
+ update_option( 'home', $blog_address );
+ }
+
+ // rewrite rules can't be flushed during switch to blog
+ delete_option( 'rewrite_rules' );
+
+ // update blogs table
+ $blog_data = stripslashes_deep( $_POST['blog'] );
+ $existing_details = get_blog_details( $id, false );
+ $blog_data_checkboxes = array( 'public', 'archived', 'spam', 'mature', 'deleted' );
+ foreach ( $blog_data_checkboxes as $c ) {
+ if ( ! in_array( $existing_details->$c, array( 0, 1 ) ) )
+ $blog_data[ $c ] = $existing_details->$c;
+ else
+ $blog_data[ $c ] = isset( $_POST['blog'][ $c ] ) ? 1 : 0;
+ }
+ update_blog_details( $id, $blog_data );
+
+ restore_current_blog();
+ wp_redirect( add_query_arg( array( 'update' => 'updated', 'id' => $id ), 'site-info.php') );
+ exit;
+}
+
+if ( isset($_GET['update']) ) {
+ $messages = array();
+ if ( 'updated' == $_GET['update'] )
+ $messages[] = __('Site info updated.');
+}
+
+$title = sprintf( __('Edit Site: %s'), get_blogaddress_by_id($id));
+$parent_file = 'sites.php';
+$submenu_file = 'sites.php';
+
+require('../admin-header.php');
+
+?>
+
+
+
+
+
+ array( 'label' => __( 'Info' ), 'url' => 'site-info.php' ),
+ 'site-users' => array( 'label' => __( 'Users' ), 'url' => 'site-users.php' ),
+ 'site-themes' => array( 'label' => __( 'Themes' ), 'url' => 'site-themes.php' ),
+ 'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php' ),
+);
+foreach ( $tabs as $tab_id => $tab ) {
+ $class = ( $tab['url'] == $pagenow ) ? ' nav-tab-active' : '';
+ echo '' . esc_html( $tab['label'] ) . ' ';
+}
+?>
+
+
' . $msg . '
';
+} ?>
+
+
+
+
+
+
+
+
+' . __('This screen is for Super Admins to add new sites to the network. This is not affected by the registration settings.') . '' .
+ '' . __('If the admin email for the new site does not exist in the database, a new user will also be created.') . '
' .
+ '' . __('For more information:') . '
' .
+ '' . __('Documentation on Site Management ') . '
' .
+ '' . __('Support Forums ') . '
'
+);
+
+if ( isset($_REQUEST['action']) && 'add-site' == $_REQUEST['action'] ) {
+ check_admin_referer( 'add-blog', '_wpnonce_add-blog' );
+
+ if ( ! current_user_can( 'manage_sites' ) )
+ wp_die( __( 'You do not have permission to access this page.' ) );
+
+ if ( ! is_array( $_POST['blog'] ) )
+ wp_die( __( 'Can’t create an empty site.' ) );
+ $blog = $_POST['blog'];
+ $domain = '';
+ if ( ! preg_match( '/(--)/', $blog['domain'] ) && preg_match( '|^([a-zA-Z0-9-])+$|', $blog['domain'] ) )
+ $domain = strtolower( $blog['domain'] );
+
+ // If not a subdomain install, make sure the domain isn't a reserved word
+ if ( ! is_subdomain_install() ) {
+ $subdirectory_reserved_names = apply_filters( 'subdirectory_reserved_names', array( 'page', 'comments', 'blog', 'files', 'feed' ) );
+ if ( in_array( $domain, $subdirectory_reserved_names ) )
+ wp_die( sprintf( __('The following words are reserved for use by WordPress functions and cannot be used as blog names: %s
' ), implode( ', ', $subdirectory_reserved_names ) ) );
+ }
+
+ $email = sanitize_email( $blog['email'] );
+ $title = $blog['title'];
+
+ if ( empty( $domain ) )
+ wp_die( __( 'Missing or invalid site address.' ) );
+ if ( empty( $email ) )
+ wp_die( __( 'Missing email address.' ) );
+ if ( !is_email( $email ) )
+ wp_die( __( 'Invalid email address.' ) );
+
+ if ( is_subdomain_install() ) {
+ $newdomain = $domain . '.' . preg_replace( '|^www\.|', '', $current_site->domain );
+ $path = $base;
+ } else {
+ $newdomain = $current_site->domain;
+ $path = $base . $domain . '/';
+ }
+
+ $password = 'N/A';
+ $user_id = email_exists($email);
+ if ( !$user_id ) { // Create a new user with a random password
+ $password = wp_generate_password( 12, false );
+ $user_id = wpmu_create_user( $domain, $password, $email );
+ if ( false == $user_id )
+ wp_die( __( 'There was an error creating the user.' ) );
+ else
+ wp_new_user_notification( $user_id, $password );
+ }
+
+ $wpdb->hide_errors();
+ $id = wpmu_create_blog( $newdomain, $path, $title, $user_id , array( 'public' => 1 ), $current_site->id );
+ $wpdb->show_errors();
+ if ( !is_wp_error( $id ) ) {
+ if ( !is_super_admin( $user_id ) && !get_user_option( 'primary_blog', $user_id ) )
+ update_user_option( $user_id, 'primary_blog', $id, true );
+ $content_mail = sprintf( __( "New site created by %1s\n\nAddress: http://%2s\nName: %3s"), $current_user->user_login , $newdomain . $path, stripslashes( $title ) );
+ wp_mail( get_site_option('admin_email'), sprintf( __( '[%s] New Site Created' ), $current_site->site_name ), $content_mail, 'From: "Site Admin" <' . get_site_option( 'admin_email' ) . '>' );
+ wpmu_welcome_notification( $id, $user_id, $password, $title, array( 'public' => 1 ) );
+ wp_redirect( add_query_arg( array('update' => 'added'), 'site-new.php' ) );
+ exit;
+ } else {
+ wp_die( $id->get_error_message() );
+ }
+}
+
+if ( isset($_GET['update']) ) {
+ $messages = array();
+ if ( 'added' == $_GET['update'] )
+ $messages[] = __('Site added.');
+}
+
+$title = __('Add New Site');
+$parent_file = 'sites.php';
+
+require('../admin-header.php');
+
+?>
+
+';
+} ?>
+
+
+
+
+
+
+
diff --git a/wp-admin/network/site-settings.php b/wp-admin/network/site-settings.php
new file mode 100644
index 00000000..b90bb76d
--- /dev/null
+++ b/wp-admin/network/site-settings.php
@@ -0,0 +1,150 @@
+' . __('The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.') . '' .
+ '' . __('Info - The domain and path are rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.') . '
' .
+ '' . __('Users - This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network.') . '
' .
+ '' . sprintf( __('Themes - This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site’s Appearance menu. To enable a theme for the entire network, see the Network Themes screen.' ), network_admin_url( 'themes.php' ) ) . '
' .
+ '' . __('Settings - This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database.') . '
' .
+ '' . __('For more information:') . '
' .
+ '' . __('Documentation on Site Management ') . '
' .
+ '' . __('Support Forums ') . '
'
+);
+
+$id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
+
+if ( ! $id )
+ wp_die( __('Invalid site ID.') );
+
+$details = get_blog_details( $id );
+if ( !can_edit_network( $details->site_id ) )
+ wp_die( __( 'You do not have permission to access this page.' ) );
+
+$is_main_site = is_main_site( $id );
+
+if ( isset($_REQUEST['action']) && 'update-site' == $_REQUEST['action'] && is_array( $_POST['option'] ) ) {
+ check_admin_referer( 'edit-site' );
+
+ switch_to_blog( $id );
+
+ $c = 1;
+ $count = count( $_POST['option'] );
+ $skip_options = array( 'allowedthemes' ); // Don't update these options since they are handled elsewhere in the form.
+ foreach ( (array) $_POST['option'] as $key => $val ) {
+ if ( $key === 0 || is_array( $val ) || in_array($key, $skip_options) )
+ continue; // Avoids "0 is a protected WP option and may not be modified" error when edit blog options
+ if ( $c == $count )
+ update_option( $key, stripslashes( $val ) );
+ else
+ update_option( $key, stripslashes( $val ), false ); // no need to refresh blog details yet
+ $c++;
+ }
+
+ do_action( 'wpmu_update_blog_options' );
+ restore_current_blog();
+ wp_redirect( add_query_arg( array( 'update' => 'updated', 'id' => $id ), 'site-settings.php') );
+ exit;
+}
+
+if ( isset($_GET['update']) ) {
+ $messages = array();
+ if ( 'updated' == $_GET['update'] )
+ $messages[] = __('Site options updated.');
+}
+
+$title = sprintf( __('Edit Site: %s'), get_blogaddress_by_id($id));
+$parent_file = 'sites.php';
+$submenu_file = 'sites.php';
+
+require('../admin-header.php');
+
+?>
+
+
+
+
+
+ array( 'label' => __( 'Info' ), 'url' => 'site-info.php' ),
+ 'site-users' => array( 'label' => __( 'Users' ), 'url' => 'site-users.php' ),
+ 'site-themes' => array( 'label' => __( 'Themes' ), 'url' => 'site-themes.php' ),
+ 'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php' ),
+);
+foreach ( $tabs as $tab_id => $tab ) {
+ $class = ( $tab['url'] == $pagenow ) ? ' nav-tab-active' : '';
+ echo '' . esc_html( $tab['label'] ) . ' ';
+}
+?>
+
+
' . $msg . '
';
+} ?>
+
+
+
+
+
+
+
+
+' . __('The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.') . '' .
+ '' . __('Info - The domain and path are rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.') . '
' .
+ '' . __('Users - This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network.') . '
' .
+ '' . sprintf( __('Themes - This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site’s Appearance menu. To enable a theme for the entire network, see the Network Themes screen.' ), network_admin_url( 'themes.php' ) ) . '
' .
+ '' . __('Settings - This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database.') . '
' .
+ '' . __('For more information:') . '
' .
+ '' . __('Documentation on Site Management ') . '
' .
+ '' . __('Support Forums ') . '
'
+);
+
+$wp_list_table = _get_list_table('WP_MS_Themes_List_Table');
+
+$action = $wp_list_table->current_action();
+
+$s = isset($_REQUEST['s']) ? $_REQUEST['s'] : '';
+
+// Clean up request URI from temporary args for screen options/paging uri's to work as expected.
+$temp_args = array( 'enabled', 'disabled', 'error' );
+$_SERVER['REQUEST_URI'] = remove_query_arg( $temp_args, $_SERVER['REQUEST_URI'] );
+$referer = remove_query_arg( $temp_args, wp_get_referer() );
+
+$id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
+
+if ( ! $id )
+ wp_die( __('Invalid site ID.') );
+
+$wp_list_table->prepare_items();
+
+$details = get_blog_details( $id );
+if ( !can_edit_network( $details->site_id ) )
+ wp_die( __( 'You do not have permission to access this page.' ) );
+
+$is_main_site = is_main_site( $id );
+
+if ( $action ) {
+ switch_to_blog( $id );
+ $allowed_themes = get_option( 'allowedthemes' );
+
+ switch ( $action ) {
+ case 'enable':
+ check_admin_referer( 'enable-theme_' . $_GET['theme'] );
+ $theme = $_GET['theme'];
+ $action = 'enabled';
+ $n = 1;
+ if ( !$allowed_themes )
+ $allowed_themes = array( $theme => true );
+ else
+ $allowed_themes[$theme] = true;
+ break;
+ case 'disable':
+ check_admin_referer( 'disable-theme_' . $_GET['theme'] );
+ $theme = $_GET['theme'];
+ $action = 'disabled';
+ $n = 1;
+ if ( !$allowed_themes )
+ $allowed_themes = array();
+ else
+ unset( $allowed_themes[$theme] );
+ break;
+ case 'enable-selected':
+ check_admin_referer( 'bulk-themes' );
+ if ( isset( $_POST['checked'] ) ) {
+ $themes = (array) $_POST['checked'];
+ $action = 'enabled';
+ $n = count( $themes );
+ foreach( (array) $themes as $theme )
+ $allowed_themes[ $theme ] = true;
+ } else {
+ $action = 'error';
+ $n = 'none';
+ }
+ break;
+ case 'disable-selected':
+ check_admin_referer( 'bulk-themes' );
+ if ( isset( $_POST['checked'] ) ) {
+ $themes = (array) $_POST['checked'];
+ $action = 'disabled';
+ $n = count( $themes );
+ foreach( (array) $themes as $theme )
+ unset( $allowed_themes[ $theme ] );
+ } else {
+ $action = 'error';
+ $n = 'none';
+ }
+ break;
+ }
+
+ update_option( 'allowedthemes', $allowed_themes );
+ restore_current_blog();
+
+ wp_redirect( add_query_arg( $action, $n, $referer ) );
+ exit;
+}
+
+if ( isset( $_GET['action'] ) && 'update-site' == $_GET['action'] ) {
+ wp_redirect( $referer );
+ exit();
+}
+
+add_thickbox();
+add_screen_option( 'per_page', array( 'label' => _x( 'Themes', 'themes per page (screen options)' ) ) );
+
+$title = sprintf( __('Edit Site: %s'), get_blogaddress_by_id($id));
+$parent_file = 'sites.php';
+$submenu_file = 'sites.php';
+
+require('../admin-header.php'); ?>
+
+
+
+
+
+ array( 'label' => __( 'Info' ), 'url' => 'site-info.php' ),
+ 'site-users' => array( 'label' => __( 'Users' ), 'url' => 'site-users.php' ),
+ 'site-themes' => array( 'label' => __( 'Themes' ), 'url' => 'site-themes.php' ),
+ 'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php' ),
+);
+foreach ( $tabs as $tab_id => $tab ) {
+ $class = ( $tab['url'] == $pagenow ) ? ' nav-tab-active' : '';
+ echo '' . esc_html( $tab['label'] ) . ' ';
+}
+?>
+ ' . sprintf( _n( 'Theme enabled.', '%s themes enabled.', $_GET['enabled'] ), number_format_i18n( $_GET['enabled'] ) ) . '
';
+} elseif ( isset( $_GET['disabled'] ) ) {
+ $_GET['disabled'] = absint( $_GET['disabled'] );
+ echo '' . sprintf( _n( 'Theme disabled.', '%s themes disabled.', $_GET['disabled'] ), number_format_i18n( $_GET['disabled'] ) ) . '
';
+} elseif ( isset( $_GET['error'] ) && 'none' == $_GET['error'] ) {
+ echo '' . __( 'No theme selected.' ) . '
';
+} ?>
+
+
+
+
+search_box( __( 'Search Installed Themes' ), 'theme' ); ?>
+
+
+
+views(); ?>
+
+
+
+
+
+display(); ?>
+
+
+
+
+
diff --git a/wp-admin/network/site-users.php b/wp-admin/network/site-users.php
new file mode 100644
index 00000000..9366cb93
--- /dev/null
+++ b/wp-admin/network/site-users.php
@@ -0,0 +1,308 @@
+prepare_items();
+
+$action = $wp_list_table->current_action();
+
+add_contextual_help($current_screen,
+ '' . __('The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.') . '
' .
+ '' . __('Info - The domain and path are rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.') . '
' .
+ '' . __('Users - This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network.') . '
' .
+ '' . sprintf( __('Themes - This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site’s Appearance menu. To enable a theme for the entire network, see the Network Themes screen.' ), network_admin_url( 'themes.php' ) ) . '
' .
+ '' . __('Settings - This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database.') . '
' .
+ '' . __('For more information:') . '
' .
+ '' . __('Documentation on Site Management ') . '
' .
+ '' . __('Support Forums ') . '
'
+);
+
+$id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
+
+if ( ! $id )
+ wp_die( __('Invalid site ID.') );
+
+$details = get_blog_details( $id );
+if ( !can_edit_network( $details->site_id ) )
+ wp_die( __( 'You do not have permission to access this page.' ) );
+
+$is_main_site = is_main_site( $id );
+
+// get blog prefix
+$blog_prefix = $wpdb->get_blog_prefix( $id );
+
+// @todo This is a hack. Eventually, add API to WP_Roles allowing retrieval of roles for a particular blog.
+if ( ! empty($wp_roles->use_db) ) {
+ $editblog_roles = get_blog_option( $id, "{$blog_prefix}user_roles" );
+} else {
+ // Roles are stored in memory, not the DB.
+ $editblog_roles = $wp_roles->roles;
+}
+$default_role = get_blog_option( $id, 'default_role' );
+
+$action = $wp_list_table->current_action();
+
+if ( $action ) {
+ switch_to_blog( $id );
+
+ switch ( $action ) {
+ case 'newuser':
+ check_admin_referer( 'add-user', '_wpnonce_add-new-user' );
+ $user = $_POST['user'];
+ if ( !is_array( $_POST['user'] ) || empty( $user['username'] ) || empty( $user['email'] ) ) {
+ $update = 'err_new';
+ } else {
+ $password = wp_generate_password( 12, false);
+ $user_id = wpmu_create_user( esc_html( strtolower( $user['username'] ) ), $password, esc_html( $user['email'] ) );
+
+ if ( false == $user_id ) {
+ $update = 'err_new_dup';
+ } else {
+ wp_new_user_notification( $user_id, $password );
+ add_user_to_blog( $id, $user_id, $_POST['new_role'] );
+ $update = 'newuser';
+ }
+ }
+ break;
+
+ case 'adduser':
+ check_admin_referer( 'add-user', '_wpnonce_add-user' );
+ if ( !empty( $_POST['newuser'] ) ) {
+ $update = 'adduser';
+ $newuser = $_POST['newuser'];
+ $userid = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . $wpdb->users . " WHERE user_login = %s", $newuser ) );
+ if ( $userid ) {
+ $user = $wpdb->get_var( "SELECT user_id FROM " . $wpdb->usermeta . " WHERE user_id='$userid' AND meta_key='{$blog_prefix}capabilities'" );
+ if ( $user == false )
+ add_user_to_blog( $id, $userid, $_POST['new_role'] );
+ else
+ $update = 'err_add_member';
+ } else {
+ $update = 'err_add_notfound';
+ }
+ } else {
+ $update = 'err_add_notfound';
+ }
+ break;
+
+ case 'remove':
+ if ( !current_user_can('remove_users') )
+ die(__('You can’t remove users.'));
+ check_admin_referer( 'bulk-users' );
+
+ $update = 'remove';
+ if ( isset( $_REQUEST['users'] ) ) {
+ $userids = $_REQUEST['users'];
+
+ foreach ( $userids as $user_id ) {
+ $user_id = (int) $user_id;
+ remove_user_from_blog( $user_id, $id );
+ }
+ } elseif ( isset( $_GET['user'] ) ) {
+ remove_user_from_blog( $_GET['user'] );
+ } else {
+ $update = 'err_remove';
+ }
+ break;
+
+ case 'promote':
+ check_admin_referer( 'bulk-users' );
+ $editable_roles = get_editable_roles();
+ if ( empty( $editable_roles[$_REQUEST['new_role']] ) )
+ wp_die(__('You can’t give users that role.'));
+
+ if ( isset( $_REQUEST['users'] ) ) {
+ $userids = $_REQUEST['users'];
+ $update = 'promote';
+ foreach ( $userids as $user_id ) {
+ $user_id = (int) $user_id;
+
+ // If the user doesn't already belong to the blog, bail.
+ if ( !is_user_member_of_blog( $user_id ) )
+ wp_die(__('Cheatin’ uh?'));
+
+ $user = new WP_User( $user_id );
+ $user->set_role( $_REQUEST['new_role'] );
+ }
+ } else {
+ $update = 'err_promote';
+ }
+ break;
+ }
+
+ restore_current_blog();
+ wp_redirect( add_query_arg( 'update', $update, wp_get_referer() ) );
+ exit();
+}
+
+if ( isset( $_GET['action'] ) && 'update-site' == $_GET['action'] ) {
+ wp_redirect( wp_get_referer() );
+ exit();
+}
+
+add_screen_option( 'per_page', array( 'label' => _x( 'Users', 'users per page (screen options)' ) ) );
+
+$title = sprintf( __('Edit Site: %s'), get_blogaddress_by_id($id));
+$parent_file = 'sites.php';
+$submenu_file = 'sites.php';
+
+require('../admin-header.php'); ?>
+
+
+
+
+
+ array( 'label' => __( 'Info' ), 'url' => 'site-info.php' ),
+ 'site-users' => array( 'label' => __( 'Users' ), 'url' => 'site-users.php' ),
+ 'site-themes' => array( 'label' => __( 'Themes' ), 'url' => 'site-themes.php' ),
+ 'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php' ),
+);
+foreach ( $tabs as $tab_id => $tab ) {
+ $class = ( $tab['url'] == $pagenow ) ? ' nav-tab-active' : '';
+ echo '' . esc_html( $tab['label'] ) . ' ';
+}
+?>
+ ' . __( 'User added.' ) . '
';
+ break;
+ case 'err_add_member':
+ echo '' . __( 'User is already a member of this site.' ) . '
';
+ break;
+ case 'err_add_notfound':
+ echo '' . __( 'Enter the username of an existing user.' ) . '
';
+ break;
+ case 'promote':
+ echo '' . __( 'Changed roles.' ) . '
';
+ break;
+ case 'err_promote':
+ echo '' . __( 'Select a user to change role.' ) . '
';
+ break;
+ case 'remove':
+ echo '' . __( 'User removed from this site.' ) . '
';
+ break;
+ case 'err_remove':
+ echo '' . __( 'Select a user to remove.' ) . '
';
+ break;
+ case 'newuser':
+ echo '' . __( 'User created.' ) . '
';
+ break;
+ case 'err_new':
+ echo '' . __( 'Enter the username and email.' ) . '
';
+ break;
+ case 'err_new_dup':
+ echo '' . __( 'Duplicated username or email address.' ) . '
';
+ break;
+ }
+endif; ?>
+
+
+search_box( __( 'Search Users' ), 'user' ); ?>
+
+
+
+views(); ?>
+
+
+
+
+
+display(); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+get_pagenum();
+
+$title = __( 'Sites' );
+$parent_file = 'sites.php';
+
+add_screen_option( 'per_page', array('label' => _x( 'Sites', 'sites per page (screen options)' )) );
+
+add_contextual_help($current_screen,
+ '' . __('Add New takes you to the Add New Site screen. You can search for a site by Name, ID number, or IP address. Screen Options allows you to choose how many sites to display on one page.') . '
' .
+ '' . __('This is the main table of all sites on this network. Switch between list and excerpt views by using the icons above the right side of the table.') . '
' .
+ '' . __('Hovering over each site reveals seven options (three for the primary site):') . '
' .
+ '' . __('An Edit link to a separate Edit Site screen.') . ' ' .
+ '' . __('Dashboard leads to the Dashboard for that site.') . ' ' .
+ '' . __('Deactivate, Archive, and Spam which lead to confirmation screens. These actions can be reversed later.') . ' ' .
+ '' . __('Delete which is a permanent action after the confirmation screens.') . ' ' .
+ '' . __('Visit to go to the frontend site live.') . ' ' .
+ '' . __('The site ID is used internally, and is not shown on the front end of the site or to users/viewers.') . '
' .
+ '' . __('Clicking on bold settings can re-sort this table. The upper right icons switch between list and excerpt views.') . '
' .
+ '' . __('For more information:') . '
' .
+ '' . __('Documentation on Site Management ') . '
' .
+ '' . __('Support Forums ') . '
'
+);
+
+$id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
+
+$msg = '';
+if ( isset( $_REQUEST['updated'] ) && $_REQUEST['updated'] == 'true' && ! empty( $_REQUEST['action'] ) ) {
+ switch ( $_REQUEST['action'] ) {
+ case 'all_notspam':
+ $msg = __( 'Sites removed from spam.' );
+ break;
+ case 'all_spam':
+ $msg = __( 'Sites marked as spam.' );
+ break;
+ case 'all_delete':
+ $msg = __( 'Sites deleted.' );
+ break;
+ case 'delete':
+ $msg = __( 'Site deleted.' );
+ break;
+ case 'not_deleted':
+ $msg = __( 'You do not have permission to delete that site.' );
+ break;
+ case 'archive':
+ $msg = __( 'Site archived.' );
+ break;
+ case 'unarchive':
+ $msg = __( 'Site unarchived.' );
+ break;
+ case 'activate':
+ $msg = __( 'Site activated.' );
+ break;
+ case 'deactivate':
+ $msg = __( 'Site deactivated.' );
+ break;
+ case 'unspam':
+ $msg = __( 'Site removed from spam.' );
+ break;
+ case 'spam':
+ $msg = __( 'Site marked as spam.' );
+ break;
+ default:
+ $msg = apply_filters( 'network_sites_updated_message_' . $_REQUEST['action'] , __( 'Settings saved.' ) );
+ break;
+ }
+ if ( $msg )
+ $msg = '';
+}
+
+$wp_list_table->prepare_items();
+
+$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
+if ( $pagenum > $total_pages && $total_pages > 0 ) {
+ wp_redirect( add_query_arg( 'paged', $total_pages ) );
+ exit;
+}
+
+require_once( '../admin-header.php' );
+?>
+
+
+
+
+
+
+
+
+
+' . __( 'Search results for “%s”' ) . '', esc_html( $s ) );
+} ?>
+
+
+
+search_box( __( 'Search Sites' ), 'site' ); ?>
+
+
+
+
+ display(); ?>
+
+
+
diff --git a/wp-admin/network/theme-editor.php b/wp-admin/network/theme-editor.php
new file mode 100644
index 00000000..f6ac9c2e
--- /dev/null
+++ b/wp-admin/network/theme-editor.php
@@ -0,0 +1,16 @@
+get_pagenum();
+
+$action = $wp_list_table->current_action();
+
+$s = isset($_REQUEST['s']) ? $_REQUEST['s'] : '';
+
+// Clean up request URI from temporary args for screen options/paging uri's to work as expected.
+$temp_args = array( 'enabled', 'disabled', 'deleted', 'error' );
+$_SERVER['REQUEST_URI'] = remove_query_arg( $temp_args, $_SERVER['REQUEST_URI'] );
+$referer = remove_query_arg( $temp_args, wp_get_referer() );
+
+if ( $action ) {
+ $allowed_themes = get_site_option( 'allowedthemes' );
+ switch ( $action ) {
+ case 'enable':
+ check_admin_referer('enable-theme_' . $_GET['theme']);
+ $allowed_themes[ $_GET['theme'] ] = true;
+ update_site_option( 'allowedthemes', $allowed_themes );
+ wp_redirect( add_query_arg( 'enabled', '1', $referer ) );
+ exit;
+ break;
+ case 'disable':
+ check_admin_referer('disable-theme_' . $_GET['theme']);
+ unset( $allowed_themes[ $_GET['theme'] ] );
+ update_site_option( 'allowedthemes', $allowed_themes );
+ wp_redirect( add_query_arg( 'disabled', '1', $referer ) );
+ exit;
+ break;
+ case 'enable-selected':
+ check_admin_referer('bulk-themes');
+ $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
+ if ( empty($themes) ) {
+ wp_redirect( add_query_arg( 'error', 'none', $referer ) );
+ exit;
+ }
+ foreach( (array) $themes as $theme )
+ $allowed_themes[ $theme ] = true;
+ update_site_option( 'allowedthemes', $allowed_themes );
+ wp_redirect( add_query_arg( 'enabled', count( $themes ), $referer ) );
+ exit;
+ break;
+ case 'disable-selected':
+ check_admin_referer('bulk-themes');
+ $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
+ if ( empty($themes) ) {
+ wp_redirect( add_query_arg( 'error', 'none', $referer ) );
+ exit;
+ }
+ foreach( (array) $themes as $theme )
+ unset( $allowed_themes[ $theme ] );
+ update_site_option( 'allowedthemes', $allowed_themes );
+ wp_redirect( add_query_arg( 'disabled', count( $themes ), $referer ) );
+ exit;
+ break;
+ case 'delete-selected':
+ if ( ! current_user_can( 'delete_themes' ) )
+ wp_die( __('You do not have sufficient permissions to delete themes for this site.') );
+ check_admin_referer( 'bulk-themes' );
+
+ $themes = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array();
+
+ if ( isset( $themes[ get_option( 'template' ) ] ) )
+ unset( $themes[ get_option( 'template' ) ] );
+ if ( isset( $themes[ get_option( 'stylesheet' ) ] ) )
+ unset( $themes[ get_option( 'stylesheet' ) ] );
+
+ if ( empty( $themes ) ) {
+ wp_redirect( add_query_arg( 'error', 'none', $referer ) );
+ exit;
+ }
+
+ $main_theme = get_current_theme();
+ $files_to_delete = $theme_info = array();
+ foreach ( $themes as $key => $theme ) {
+ $data = get_theme_data( WP_CONTENT_DIR . '/themes/' . $theme . '/style.css' );
+ if ( $data['Name'] == $main_theme ) {
+ unset( $themes[$key] );
+ } else {
+ $files_to_delete = array_merge( $files_to_delete, list_files( WP_CONTENT_DIR . "/themes/$theme" ) );
+ $theme_info[ $theme ] = $data;
+ }
+ }
+
+ if ( empty( $themes ) ) {
+ wp_redirect( add_query_arg( 'error', 'main', $referer ) );
+ exit;
+ }
+
+ include(ABSPATH . 'wp-admin/update.php');
+
+ $parent_file = 'themes.php';
+
+ if ( ! isset( $_REQUEST['verify-delete'] ) ) {
+ wp_enqueue_script( 'jquery' );
+ require_once( ABSPATH . 'wp-admin/admin-header.php' );
+ ?>
+
+ ' . _n( 'Delete Theme', 'Delete Themes', $themes_to_delete ) . '';
+ ?>
+
+
+
+ ', sprintf( __('%1$s by %2$s ' ), esc_html( $theme['Name'] ), esc_html( $theme['AuthorName'] ) ), ''; /* translators: 1: theme name, 2: theme author */ ?>
+
+
+
+
+
+ ';
+ ?>
+
+
+
+
+
+
+
+
+
+
+ ' . esc_html( str_replace( WP_CONTENT_DIR . "/themes", '', $file) ) . '';
+ ?>
+
+
+
+ 1), $_SERVER['REQUEST_URI'] ) ) );
+ $paged = ( $_REQUEST['paged'] ) ? $_REQUEST['paged'] : 1;
+ wp_redirect( network_admin_url( "themes.php?deleted=".count( $themes )."&paged=$paged&s=$s" ) );
+ exit;
+ break;
+ }
+}
+
+$wp_list_table->prepare_items();
+
+$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
+if ( $pagenum > $total_pages && $total_pages > 0 ) {
+ wp_redirect( add_query_arg( 'paged', $total_pages ) );
+ exit;
+}
+
+add_thickbox();
+
+add_screen_option( 'per_page', array('label' => _x( 'Themes', 'themes per page (screen options)' )) );
+
+add_contextual_help($current_screen,
+ '' . __('This screen enables and disables the inclusion of themes available to choose in the Appearance menu for each site. It does not activate or deactivate which theme a site is currently using.') . '
' .
+ '' . __('If the network admin disables a theme that is in use, it can still remain selected on that site. If another theme is chosen, the disabled theme will not appear in the site’s Appearance > Themes screen.') . '
' .
+ '' . __('Themes can be enabled on a site by site basis by the network admin on the Edit Site screen you go to via the Edit action link on the Sites screen. Only network admins are able to install or edit themes.') . '
' .
+ '' . __('For more information:') . '
' .
+ '' . __('Documentation on Network Themes ') . '
' .
+ '' . __('Support Forums ') . '
'
+);
+
+$title = __('Themes');
+$parent_file = 'themes.php';
+
+require_once(ABSPATH . 'wp-admin/admin-header.php');
+
+?>
+
+
+
+
' . __('Search results for “%s”') . '', esc_html( $s ) ); ?>
+
+
+
' . sprintf( _n( 'Theme enabled.', '%s themes enabled.', $_GET['enabled'] ), number_format_i18n( $_GET['enabled'] ) ) . '
';
+} elseif ( isset( $_GET['disabled'] ) ) {
+ $_GET['disabled'] = absint( $_GET['disabled'] );
+ echo '' . sprintf( _n( 'Theme disabled.', '%s themes disabled.', $_GET['disabled'] ), number_format_i18n( $_GET['disabled'] ) ) . '
';
+} elseif ( isset( $_GET['deleted'] ) ) {
+ $_GET['deleted'] = absint( $_GET['deleted'] );
+ echo '' . sprintf( _nx( 'Theme deleted.', '%s themes deleted.', $_GET['deleted'], 'network' ), number_format_i18n( $_GET['deleted'] ) ) . '
';
+} elseif ( isset( $_GET['error'] ) && 'none' == $_GET['error'] ) {
+ echo '' . __( 'No theme selected.' ) . '
';
+} elseif ( isset( $_GET['error'] ) && 'main' == $_GET['error'] ) {
+ echo '' . __( 'You cannot delete a theme while it is active on the main site.' ) . '
';
+}
+
+?>
+
+
+search_box( __( 'Search Installed Themes' ), 'theme' ); ?>
+
+
+views(); ?>
+
+
+
+
+
+display(); ?>
+
+
+
+
+' . __('Only use this screen once you have updated to a new version of WordPress through Dashboard > Updates. Clicking the Update Network button will step through each site in the network, five at a time, and make sure any database updates are applied.') . '' .
+ '' . __('If a version update to core has not happened, clicking this button won’t affect anything.') . '
' .
+ '' . __('If this process fails for any reason, users logging in to their sites will force the same update.') . '
' .
+ '' . __('For more information:') . '
' .
+ '' . __('Documentation on Update Network ') . '
' .
+ '' . __('Support Forums ') . '
'
+);
+
+require_once('../admin-header.php');
+
+if ( ! current_user_can( 'manage_network' ) )
+ wp_die( __( 'You do not have permission to access this page.' ) );
+
+echo '';
+screen_icon('tools');
+echo '
' . __( 'Update Network' ) . ' ';
+
+$action = isset($_GET['action']) ? $_GET['action'] : 'show';
+
+switch ( $action ) {
+ case "upgrade":
+ $n = ( isset($_GET['n']) ) ? intval($_GET['n']) : 0;
+
+ if ( $n < 5 ) {
+ global $wp_db_version;
+ update_site_option( 'wpmu_upgrade_site', $wp_db_version );
+ }
+
+ $blogs = $wpdb->get_results( "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' AND spam = '0' AND deleted = '0' AND archived = '0' ORDER BY registered DESC LIMIT {$n}, 5", ARRAY_A );
+ if ( empty( $blogs ) ) {
+ echo '
' . __( 'All done!' ) . '
';
+ break;
+ }
+ echo "
";
+ foreach ( (array) $blogs as $details ) {
+ $siteurl = get_blog_option( $details['blog_id'], 'siteurl' );
+ echo "$siteurl ";
+ $response = wp_remote_get( trailingslashit( $siteurl ) . "wp-admin/upgrade.php?step=upgrade_db", array( 'timeout' => 120, 'httpversion' => '1.1' ) );
+ if ( is_wp_error( $response ) )
+ wp_die( sprintf( __( 'Warning! Problem updating %1$s. Your server may not be able to connect to sites running on it. Error message: %2$s ' ), $siteurl, $response->get_error_message() ) );
+ do_action( 'after_mu_upgrade', $response );
+ do_action( 'wpmu_upgrade_site', $details[ 'blog_id' ] );
+ }
+ echo " ";
+ ?>
+
+
+
+
+
diff --git a/wp-admin/network/user-edit.php b/wp-admin/network/user-edit.php
new file mode 100644
index 00000000..0b2cfd26
--- /dev/null
+++ b/wp-admin/network/user-edit.php
@@ -0,0 +1,16 @@
+' . __('Add User will set up a new user account on the network and send them an email with their username and password.') . '' .
+ '' . __('Users who are signed up to the network without a site are added as subscribers to the main or primary dashboard site, giving them profile pages to manage their accounts. These users will only see Dashboard and My Sites in the main navigation until a site is created for them.') . '
' .
+ '' . __('For more information:') . '
' .
+ '' . __('Documentation on Network Users ') . '
' .
+ '' . __('Support Forums ') . '
'
+);
+
+if ( isset($_REQUEST['action']) && 'add-user' == $_REQUEST['action'] ) {
+ check_admin_referer( 'add-user', '_wpnonce_add-user' );
+ if ( ! current_user_can( 'manage_network_users' ) )
+ wp_die( __( 'You do not have permission to access this page.' ) );
+
+ if ( is_array( $_POST['user'] ) == false )
+ wp_die( __( 'Cannot create an empty user.' ) );
+ $user = $_POST['user'];
+ if ( empty($user['username']) && empty($user['email']) )
+ wp_die( __( 'Missing username and email.' ) );
+ elseif ( empty($user['username']) )
+ wp_die( __( 'Missing username.' ) );
+ elseif ( empty($user['email']) )
+ wp_die( __( 'Missing email.' ) );
+
+ $password = wp_generate_password( 12, false);
+ $user_id = wpmu_create_user( esc_html( strtolower( $user['username'] ) ), $password, esc_html( $user['email'] ) );
+
+ if ( false == $user_id )
+ wp_die( __( 'Duplicated username or email address.' ) );
+ else
+ wp_new_user_notification( $user_id, $password );
+
+ wp_redirect( add_query_arg( array('update' => 'added'), 'user-new.php' ) );
+ exit;
+}
+
+if ( isset($_GET['update']) ) {
+ $messages = array();
+ if ( 'added' == $_GET['update'] )
+ $messages[] = __('User added.');
+}
+
+$title = __('Add New User');
+$parent_file = 'users.php';
+
+require('../admin-header.php'); ?>
+
+';
+} ?>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wp-admin/network/users.php b/wp-admin/network/users.php
new file mode 100644
index 00000000..6523c989
--- /dev/null
+++ b/wp-admin/network/users.php
@@ -0,0 +1,96 @@
+get_pagenum();
+$wp_list_table->prepare_items();
+$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
+
+if ( $pagenum > $total_pages && $total_pages > 0 ) {
+ wp_redirect( add_query_arg( 'paged', $total_pages ) );
+ exit;
+}
+$title = __( 'Users' );
+$parent_file = 'users.php';
+
+add_screen_option( 'per_page', array('label' => _x( 'Users', 'users per page (screen options)' )) );
+
+add_contextual_help($current_screen,
+ '' . __('This table shows all users across the network and the sites to which they are assigned.') . '
' .
+ '' . __('Hover over any user on the list to make the edit links appear. The Edit link on the left will take you to his or her Edit User profile page; the Edit link on the right by any site name goes to an Edit Site screen for that site.') . '
' .
+ '' . __('You can also go to the user’s profile page by clicking on the individual username.') . '
' .
+ '' . __('You can sort the table by clicking on any of the bold headings and switch between list and excerpt views by using the icons in the upper right.') . '
' .
+ '' . __('The bulk action will permanently delete selected users, or mark/unmark those selected as spam. Spam users will have posts removed and will be unable to sign up again with the same email addresses.') . '
' .
+ '' . __('You can make an existing user an additional super admin by going to the Edit User profile page and checking the box to grant that privilege.') . '
' .
+ '' . __('For more information:') . '
' .
+ '' . __('Documentation on Network Users ') . '
' .
+ '' . __('Support Forums ') . '
'
+);
+
+require_once( '../admin-header.php' );
+
+if ( isset( $_REQUEST['updated'] ) && $_REQUEST['updated'] == 'true' && ! empty( $_REQUEST['action'] ) ) {
+ ?>
+
+
+
+
+
+ ' . __( 'Search results for “%s”' ) . '', esc_html( $usersearch ) );
+ ?>
+
+
+ views(); ?>
+
+
+ search_box( __( 'Search Users' ), 'user' ); ?>
+
+
+
+ display(); ?>
+
+
+
+
diff --git a/wp-admin/options-discussion.php b/wp-admin/options-discussion.php
index b2110a29..e9bb1a67 100644
--- a/wp-admin/options-discussion.php
+++ b/wp-admin/options-discussion.php
@@ -19,7 +19,7 @@ add_contextual_help($current_screen,
'' . __('This screen provides many options for controlling the management and display of comments and links to your posts/pages. So many, in fact, they won’t all fit here! :) Use the documentation link below to get information on what each discussion setting does.') . '
' .
'' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '
' .
'' . __('For more information:') . '
' .
- '' . __('Discussion Settings Documentation ') . '
' .
+ '' . __('Documentation on Discussion Settings ') . '
' .
'' . __('Support Forums ') . '
'
);
@@ -60,7 +60,7 @@ include('./admin-header.php');
/>
-
+
@@ -141,7 +141,7 @@ printf( __('Comments should be displayed with the %s comments at the top of each
moderation queue. One word or IP per line. It will match inside words, so “press” will match “WordPress”.') ?>
-
+
@@ -150,7 +150,7 @@ printf( __('Comments should be displayed with the %s comments at the top of each
-
+
@@ -212,7 +212,8 @@ $avatar_defaults = array(
'gravatar_default' => __('Gravatar Logo'),
'identicon' => __('Identicon (Generated)'),
'wavatar' => __('Wavatar (Generated)'),
- 'monsterid' => __('MonsterID (Generated)')
+ 'monsterid' => __('MonsterID (Generated)'),
+ 'retro' => __('Retro (Generated)')
);
$avatar_defaults = apply_filters('avatar_defaults', $avatar_defaults);
$default = get_option('avatar_default');
@@ -240,9 +241,7 @@ echo apply_filters('default_avatar_select', $avatar_list);
-
-
-
+
diff --git a/wp-admin/options-general.php b/wp-admin/options-general.php
index 1aaee472..57a1b149 100644
--- a/wp-admin/options-general.php
+++ b/wp-admin/options-general.php
@@ -21,7 +21,7 @@ $timezone_format = _x('Y-m-d G:i:s', 'timezone date format');
* Display JavaScript on the page.
*
* @package WordPress
- * @subpackage General_Settings_Panel
+ * @subpackage General_Settings_Screen
*/
function add_js() {
?>
@@ -30,7 +30,7 @@ function add_js() {
jQuery(document).ready(function($){
$("input[name='date_format']").click(function(){
if ( "date_format_custom_radio" != $(this).attr("id") )
- $("input[name='date_format_custom']").val( $(this).val() );
+ $("input[name='date_format_custom']").val( $(this).val() ).siblings('.example').text( $(this).siblings('span').text() );
});
$("input[name='date_format_custom']").focus(function(){
$("#date_format_custom_radio").attr("checked", "checked");
@@ -38,17 +38,25 @@ function add_js() {
$("input[name='time_format']").click(function(){
if ( "time_format_custom_radio" != $(this).attr("id") )
- $("input[name='time_format_custom']").val( $(this).val() );
+ $("input[name='time_format_custom']").val( $(this).val() ).siblings('.example').text( $(this).siblings('span').text() );
});
$("input[name='time_format_custom']").focus(function(){
$("#time_format_custom_radio").attr("checked", "checked");
});
+ $("input[name='date_format_custom'], input[name='time_format_custom']").change( function() {
+ var format = $(this);
+ format.siblings('img').css('visibility','visible');
+ $.post(ajaxurl, {
+ action: 'date_format_custom' == format.attr('name') ? 'date_format' : 'time_format',
+ date : format.val()
+ }, function(d) { format.siblings('img').css('visibility','hidden'); format.siblings('.example').text(d); } );
+ });
});
//]]>
' . __('The fields on this screen determine some of the basics of your site setup.') . '' .
@@ -114,7 +122,7 @@ include('./admin-header.php');
-The new address will not become active until confirmed.') ?>
+The new address will not become active until confirmed.') ?>
@@ -265,14 +273,14 @@ if ( empty($tzstring) ) { // Create a UTC+- zone if no timezone string exists
echo " checked='checked'";
$custom = false;
}
- echo ' /> ' . date_i18n( $format ) . " \n";
+ echo ' /> ' . date_i18n( $format ) . " \n";
}
echo ' ' . __('Custom:') . ' ' . date_i18n( get_option('date_format') ) . "\n";
+ echo '/> ' . __('Custom:') . ' ' . date_i18n( get_option('date_format') ) . " \n";
- echo "\t" . __('Documentation on date formatting . Click “Save Changes” to update sample output.') . "
\n";
+ echo "\t" . __('Documentation on date and time formatting .') . "
\n";
?>
@@ -297,12 +305,13 @@ if ( empty($tzstring) ) { // Create a UTC+- zone if no timezone string exists
echo " checked='checked'";
$custom = false;
}
- echo ' /> ' . date_i18n( $format ) . " \n";
+ echo ' /> ' . date_i18n( $format ) . " \n";
}
echo ' ' . __('Custom:') . ' ' . date_i18n( get_option('time_format') ) . "\n";
+ echo '/> ' . __('Custom:') . ' ' . date_i18n( get_option('time_format') ) . " \n";
+ ;
?>
@@ -338,9 +347,7 @@ endfor;
-
-
-
+
diff --git a/wp-admin/options-head.php b/wp-admin/options-head.php
index 965615fd..7f2cc74d 100644
--- a/wp-admin/options-head.php
+++ b/wp-admin/options-head.php
@@ -11,6 +11,11 @@
wp_reset_vars(array('action', 'standalone', 'option_group_id'));
+if ( isset( $_GET['updated'] ) && isset( $_GET['page'] ) ) {
+ // For backwards compat with plugins that don't use the Settings API and just set updated=1 in the redirect
+ add_settings_error('general', 'settings_updated', __('Settings saved.'), 'updated');
+}
+
settings_errors();
?>
\ No newline at end of file
diff --git a/wp-admin/options-media.php b/wp-admin/options-media.php
index 2e5d10d0..67c30ad4 100644
--- a/wp-admin/options-media.php
+++ b/wp-admin/options-media.php
@@ -18,7 +18,7 @@ $parent_file = 'options-general.php';
add_contextual_help($current_screen,
'' . __('You can set maximum sizes for images inserted into your written content; you can also insert an image as Full Size.') . '
' .
'' . __('The Embed option allows you embed a video, image, or other media content into your content automatically by typing the URL (of the web page where the file lives) on its own line when you create your content.') . '
' .
- '' . __('Uploading Options gives you folder and path choices for storing your files in your installation’s directory.') . '
' .
+ ( is_multisite() ? '' : '' . __('Uploading Options gives you folder and path choices for storing your files in your installation’s directory.') . '
' ) .
'' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '
' .
'' . __('For more information:') . '
' .
'' . __('Documentation on Media Settings ') . '
' .
@@ -81,8 +81,8 @@ include('./admin-header.php');
-
- />
+
+ />
@@ -132,9 +132,7 @@ include('./admin-header.php');
-
-
-
+
diff --git a/wp-admin/options-permalink.php b/wp-admin/options-permalink.php
index 35cacf4f..e5f9a751 100644
--- a/wp-admin/options-permalink.php
+++ b/wp-admin/options-permalink.php
@@ -23,8 +23,8 @@ add_contextual_help($current_screen,
'' . __('The Optional fields let you customize the “category” and “tag” base names that will appear in archive URLs. For example, the page listing all posts in the “Uncategorized” category could be /topics/uncategorized
instead of /category/uncategorized
.') . '
' .
'' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '
' .
'' . __('For more information:') . '
' .
- '' . __('Permalinks Settings Documentation ') . '
' .
- '' . __('Using Permalinks Documentation ') . '
' .
+ '' . __('Documentation on Permalinks Settings ') . '
' .
+ '' . __('Documentation on Using Permalinks ') . '
' .
'' . __('Support Forums ') . '
'
);
@@ -35,48 +35,19 @@ add_contextual_help($current_screen,
* @subpackage Permalink_Settings_Panel
*/
function add_js() {
-?>
+ ?>
set_tag_base( $tag_base );
}
+
+ create_initial_taxonomies();
}
$permalink_structure = get_option('permalink_structure');
@@ -250,9 +223,7 @@ $structures = array(
-
-
-
+
web.config
file were writable , we could do this automatically, but it isn’t so this is the url rewrite rule you should have in your web.config
file. Click in the field and press CTRL + a to select all. Then insert this rule inside of the /<configuration>/<system.webServer>/<rewrite>/<rules>
element in web.config
file.') ?>
- iis7_url_rewrite_rules()); ?>
+ iis7_url_rewrite_rules() ); ?>
web.config file writable for us to generate rewrite rules automatically, do not forget to revert the permissions after rule has been saved.') ?>
writable, we could do this automatically, but it isn’t so this is the url rewrite rule you should have in your web.config
file. Create a new file, called web.config
in the root directory of your site. Click in the field and press CTRL + a to select all. Then insert this code into the web.config
file.') ?>
- iis7_url_rewrite_rules(true)); ?>
+ iis7_url_rewrite_rules(true) ); ?>
web.config file automatically, do not forget to revert the permissions after the file has been created.') ?>
@@ -278,7 +249,7 @@ $structures = array(
.htaccess file were writable , we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your .htaccess
file. Click in the field and press CTRL + a to select all.') ?>
- mod_rewrite_rules()); ?>
+ mod_rewrite_rules() ); ?>
diff --git a/wp-admin/options-privacy.php b/wp-admin/options-privacy.php
index caac6a1d..5f70b9e8 100644
--- a/wp-admin/options-privacy.php
+++ b/wp-admin/options-privacy.php
@@ -20,7 +20,7 @@ add_contextual_help($current_screen,
'' . __('When this setting is in effect a reminder is shown in the header of these administration screens that says, “Search Engines Blocked,” to remind you that your site is not being crawled.') . '
' .
'' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '
' .
'' . __('For more information:') . '
' .
- '' . __('Privacy Settings Documentation ') . '
' .
+ '' . __('Documentation on Privacy Settings ') . '
' .
'' . __('Support Forums ') . '
'
);
@@ -50,9 +50,7 @@ include('./admin-header.php');
-
-
-
+
diff --git a/wp-admin/options-reading.php b/wp-admin/options-reading.php
index 7cd4c463..7c8e1545 100644
--- a/wp-admin/options-reading.php
+++ b/wp-admin/options-reading.php
@@ -15,13 +15,39 @@ if ( ! current_user_can( 'manage_options' ) )
$title = __( 'Reading Settings' );
$parent_file = 'options-general.php';
+/**
+ * Display JavaScript on the page.
+ *
+ * @package WordPress
+ * @subpackage Reading_Settings_Screen
+ */
+function add_js() {
+?>
+
+' . __('This screen contains the settings that affect the display of your content.') . '' .
'' . sprintf(__('You can choose what’s displayed on the front page of your site. It can be posts in reverse chronological order (classic blog), or a fixed/static page. To set a static home page, you first need to create two Pages . One will become the front page, and the other will be where your posts are displayed.'), 'post-new.php?post_type=page') . '
' .
'' . __('You can also control the display of your content in RSS feeds, including the maximum numbers of posts to display, whether to show full text or a summary, and the character set encoding.') . '
' .
'' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '
' .
'' . __('For more information:') . '
' .
- '' . __('Reading Settings Documentation ') . '
' .
+ '' . __('Documentation on Reading Settings ') . '
' .
'' . __('Support Forums ') . '
'
);
@@ -38,7 +64,12 @@ include( './admin-header.php' );
-
@@ -94,9 +125,7 @@ include( './admin-header.php' );
-
-
-
+
diff --git a/wp-admin/options-writing.php b/wp-admin/options-writing.php
index dc06459d..a2c55dca 100644
--- a/wp-admin/options-writing.php
+++ b/wp-admin/options-writing.php
@@ -19,7 +19,7 @@ add_contextual_help($current_screen,
'' . __('You can submit content in several different ways; this screen holds the settings for all of them. The top section controls the editor within these administration screens, while the rest control external publishing methods. For more information on any of these methods, use the documentation links below.') . '
' .
'' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '
' .
'' . __('For more information:') . '
' .
- '' . __('Writing Settings Documentation ') . '
' .
+ '' . __('Documentation on Writing Settings ') . '
' .
'' . __('Support Forums ') . '
'
);
@@ -56,6 +56,23 @@ wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_category', 'o
?>
+
+
+
+
+
+
+
+ value="">
+
+
+
+
+
@@ -137,7 +154,7 @@ wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_email_categor
Update Services on the Codex. Separate multiple service URL s with line breaks.') ?>
-
+
@@ -148,9 +165,7 @@ wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_email_categor
-
-
-
+
diff --git a/wp-admin/options.php b/wp-admin/options.php
index 15f489d3..d802057f 100644
--- a/wp-admin/options.php
+++ b/wp-admin/options.php
@@ -60,7 +60,7 @@ $whitelist_options = array(
'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type', 'embed_autourls', 'embed_size_w', 'embed_size_h' ),
'privacy' => array( 'blog_public' ),
'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'blog_charset', 'show_on_front', 'page_on_front', 'page_for_posts' ),
- 'writing' => array( 'default_post_edit_rows', 'use_smilies', 'default_category', 'default_email_category', 'use_balanceTags', 'default_link_category', 'enable_app', 'enable_xmlrpc' ),
+ 'writing' => array( 'default_post_edit_rows', 'use_smilies', 'default_category', 'default_email_category', 'use_balanceTags', 'default_link_category', 'default_post_format', 'enable_app', 'enable_xmlrpc' ),
'options' => array( '' ) );
$mail_options = array('mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass');
@@ -157,7 +157,7 @@ if ( 'update' == $action ) {
/**
* Redirect back to the settings page that was submitted
*/
- $goback = add_query_arg( 'updated', 'true', wp_get_referer() );
+ $goback = add_query_arg( 'settings-updated', 'true', wp_get_referer() );
wp_redirect( $goback );
exit;
}
@@ -201,7 +201,7 @@ foreach ( (array) $options as $option ) :
" . esc_html( $option->option_name ) . "
";
if ( strpos( $value, "\n" ) !== false )
- echo "" . wp_htmledit_pre( $value ) . " ";
+ echo "" . esc_textarea( $value ) . " ";
else
echo " ";
echo "
@@ -209,7 +209,11 @@ foreach ( (array) $options as $option ) :
endforeach;
?>
-
+
+
+
+
+
diff --git a/wp-admin/plugin-editor.php b/wp-admin/plugin-editor.php
index 47437079..7efcecd3 100644
--- a/wp-admin/plugin-editor.php
+++ b/wp-admin/plugin-editor.php
@@ -9,6 +9,11 @@
/** WordPress Administration Bootstrap */
require_once('./admin.php');
+if ( is_multisite() && ! is_network_admin() ) {
+ wp_redirect( network_admin_url( 'plugin-editor.php' ) );
+ exit();
+}
+
if ( !current_user_can('edit_plugins') )
wp_die( __('You do not have sufficient permissions to edit plugins for this site.') );
@@ -67,9 +72,9 @@ case 'update':
wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file=$file&liveupdate=1&scrollto=$scrollto&networkwide=" . $network_wide));
exit;
}
- wp_redirect("plugin-editor.php?file=$file&a=te&scrollto=$scrollto");
+ wp_redirect( self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto") );
} else {
- wp_redirect("plugin-editor.php?file=$file&scrollto=$scrollto");
+ wp_redirect( self_admin_url("plugin-editor.php?file=$file&scrollto=$scrollto") );
}
exit;
@@ -84,10 +89,10 @@ default:
if ( is_wp_error($error) )
wp_die( $error );
- if ( ! is_plugin_active($file) )
+ if ( ( ! empty( $_GET['networkwide'] ) && ! is_plugin_active_for_network($file) ) || ! is_plugin_active($file) )
activate_plugin($file, "plugin-editor.php?file=$file&phperror=1", ! empty( $_GET['networkwide'] ) ); // we'll override this later if the plugin can be included without fatal error
- wp_redirect("plugin-editor.php?file=$file&a=te&scrollto=$scrollto");
+ wp_redirect( self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto") );
exit;
}
@@ -111,13 +116,15 @@ default:
'' . __('You can use the editor to make changes to any of your plugins’ individual PHP files. Be aware that if you make changes, plugins updates will overwrite your customizations.') . '
' .
'' . __('Choose a plugin to edit from the menu in the upper right and click the Select button. Click once on any file name to load it in the editor, and make your changes. Don’t forget to save your changes (Update File) when you’re finished.') . '
' .
'' . __('The Documentation menu below the editor lists the PHP functions recognized in the plugin file. Clicking Lookup takes you to a web page about that particular function.') . '
' .
- '' . __('If you want to make changes but don’t want them to be overwritten when the plugin is updated, you may be ready to think about writing your own plugin. For information on how to edit a plugin or start from scratch, check out the links below.') . '
' .
+ '' . __('If you want to make changes but don’t want them to be overwritten when the plugin is updated, you may be ready to think about writing your own plugin. For information on how to edit plugins, write your own from scratch, or just better understand their anatomy, check out the links below.') . '
' .
+ ( is_network_admin() ? '' . __('Any edits to files from this screen will be reflected on all sites in the network.') . '
' : '' ) .
'' . __('For more information:') . '
' .
'' . __('Documentation on Editing Plugins ') . '
' .
+ '' . __('Documentation on Writing Plugins ') . '
' .
'' . __('Support Forums ') . '
'
);
- require_once('./admin-header.php');
+ require_once(ABSPATH . 'wp-admin/admin-header.php');
update_recently_edited(WP_PLUGIN_DIR . '/' . $file);
@@ -136,7 +143,7 @@ default:
}
}
- $content = htmlspecialchars( $content );
+ $content = esc_textarea( $content );
?>
@@ -185,7 +192,7 @@ default:
}
?>
-
+
@@ -229,10 +236,12 @@ foreach ( $plugin_files as $plugin_file ) :
";
- else
- echo " ";
+ if ( isset($_GET['phperror']) ) {
+ echo " ";
+ submit_button( __( 'Update File and Attempt to Reactivate' ), 'primary', 'submit', false, array( 'tabindex' => '2' ) );
+ } else {
+ submit_button( __( 'Update File' ), 'primary', 'submit', false, array( 'tabindex' => '2' ) );
+ }
?>
@@ -252,4 +261,4 @@ jQuery(document).ready(function($){
get_pagenum();
+$wp_list_table->prepare_items();
+$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
+if ( $pagenum > $total_pages && $total_pages > 0 ) {
+ wp_redirect( add_query_arg( 'paged', $total_pages ) );
+ exit;
+}
$title = __('Install Plugins');
$parent_file = 'plugins.php';
-wp_reset_vars( array('tab', 'paged') );
-
-//These are the tabs which are shown on the page,
-$tabs = array();
-$tabs['dashboard'] = __('Search');
-if ( 'search' == $tab )
- $tabs['search'] = __('Search Results');
-$tabs['upload'] = __('Upload');
-$tabs['featured'] = _x('Featured','Plugin Installer');
-$tabs['popular'] = _x('Popular','Plugin Installer');
-$tabs['new'] = _x('Newest','Plugin Installer');
-$tabs['updated'] = _x('Recently Updated','Plugin Installer');
-
-$nonmenu_tabs = array('plugin-information'); //Valid actions to perform which do not have a Menu item.
-
-$tabs = apply_filters('install_plugins_tabs', $tabs );
-$nonmenu_tabs = apply_filters('install_plugins_nonmenu_tabs', $nonmenu_tabs);
-
-//If a non-valid menu tab has been selected, And its not a non-menu action.
-if ( empty($tab) || ( ! isset($tabs[ $tab ]) && ! in_array($tab, (array)$nonmenu_tabs) ) ) {
- $tab_actions = array_keys($tabs);
- $tab = $tab_actions[0];
-}
-if ( empty($paged) )
- $paged = 1;
-
wp_enqueue_style( 'plugin-install' );
wp_enqueue_script( 'plugin-install' );
if ( 'plugin-information' != $tab )
@@ -62,25 +51,17 @@ add_contextual_help($current_screen,
'' . __('Support Forums ') . '
'
);
-include('./admin-header.php');
+include(ABSPATH . 'wp-admin/admin-header.php');
?>
-
- $text ) {
- $sep = ( end($tabs) != $text ) ? ' | ' : '';
- $class = ( $action == $tab ) ? ' class="current"' : '';
- $href = admin_url('plugin-install.php?tab=' . $action);
- echo "\t\t$text $sep \n";
-}
-?>
-
-
-
+views(); ?>
+
+
+
get_pagenum();
-$default_status = get_user_option('plugins_last_view');
-if ( empty($default_status) )
- $default_status = 'all';
-$status = isset($_REQUEST['plugin_status']) ? $_REQUEST['plugin_status'] : $default_status;
-if ( !in_array($status, array('all', 'active', 'inactive', 'recent', 'upgrade', 'network', 'mustuse', 'dropins', 'search')) )
- $status = 'all';
-if ( $status != $default_status && 'search' != $status )
- update_user_meta($current_user->ID, 'plugins_last_view', $status);
+$action = $wp_list_table->current_action();
-$page = isset($_REQUEST['paged']) ? $_REQUEST['paged'] : 1;
+$plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : '';
+$s = isset($_REQUEST['s']) ? $_REQUEST['s'] : '';
-//Clean up request URI from temporary args for screen options/paging uri's to work as expected.
+// Clean up request URI from temporary args for screen options/paging uri's to work as expected.
$_SERVER['REQUEST_URI'] = remove_query_arg(array('error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', '_error_nonce'), $_SERVER['REQUEST_URI']);
-if ( !empty($action) ) {
+if ( $action ) {
$network_wide = false;
if ( ( isset( $_GET['networkwide'] ) || 'network-activate-selected' == $action ) && is_multisite() && current_user_can( 'manage_network_plugins' ) )
$network_wide = true;
@@ -57,10 +42,10 @@ if ( !empty($action) ) {
check_admin_referer('activate-plugin_' . $plugin);
- $result = activate_plugin($plugin, 'plugins.php?error=true&plugin=' . $plugin, $network_wide);
+ $result = activate_plugin($plugin, self_admin_url('plugins.php?error=true&plugin=' . $plugin), $network_wide);
if ( is_wp_error( $result ) ) {
if ( 'unexpected_output' == $result->get_error_code() ) {
- $redirect = 'plugins.php?error=true&charsout=' . strlen($result->get_error_data()) . '&plugin=' . $plugin;
+ $redirect = self_admin_url('plugins.php?error=true&charsout=' . strlen($result->get_error_data()) . '&plugin=' . $plugin . "&plugin_status=$status&paged=$page&s=$s");
wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect));
exit;
} else {
@@ -74,9 +59,9 @@ if ( !empty($action) ) {
update_option('recently_activated', $recent);
}
if ( isset($_GET['from']) && 'import' == $_GET['from'] ) {
- wp_redirect("import.php?import=" . str_replace('-importer', '', dirname($plugin)) ); // overrides the ?error=true one above and redirects to the Imports page, striping the -importer suffix
+ wp_redirect( self_admin_url("import.php?import=" . str_replace('-importer', '', dirname($plugin))) ); // overrides the ?error=true one above and redirects to the Imports page, striping the -importer suffix
} else {
- wp_redirect("plugins.php?activate=true&plugin_status=$status&paged=$page"); // overrides the ?error=true one above
+ wp_redirect( self_admin_url("plugins.php?activate=true&plugin_status=$status&paged=$page&s=$s") ); // overrides the ?error=true one above
}
exit;
break;
@@ -85,16 +70,22 @@ if ( !empty($action) ) {
if ( ! current_user_can('activate_plugins') )
wp_die(__('You do not have sufficient permissions to activate plugins for this site.'));
- check_admin_referer('bulk-manage-plugins');
+ check_admin_referer('bulk-plugins');
$plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
- $plugins = array_filter($plugins, create_function('$plugin', 'return !is_plugin_active($plugin);') ); // Only activate plugins which are not already active.
+
+ // Only activate plugins which are not already active.
+ $check = $network_wide ? 'is_plugin_active_for_network' : 'is_plugin_active';
+ foreach ( $plugins as $i => $plugin )
+ if ( $check( $plugin ) )
+ unset( $plugins[ $i ] );
+
if ( empty($plugins) ) {
- wp_redirect("plugins.php?plugin_status=$status&paged=$page");
+ wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
exit;
}
- activate_plugins($plugins, 'plugins.php?error=true', $network_wide);
+ activate_plugins($plugins, self_admin_url('plugins.php?error=true'), $network_wide);
$recent = (array)get_option('recently_activated');
foreach ( $plugins as $plugin => $time)
@@ -103,12 +94,12 @@ if ( !empty($action) ) {
update_option('recently_activated', $recent);
- wp_redirect("plugins.php?activate-multi=true&plugin_status=$status&paged=$page");
+ wp_redirect( self_admin_url("plugins.php?activate-multi=true&plugin_status=$status&paged=$page&s=$s") );
exit;
break;
case 'update-selected' :
- check_admin_referer( 'bulk-manage-plugins' );
+ check_admin_referer( 'bulk-plugins' );
if ( isset( $_GET['plugins'] ) )
$plugins = explode( ',', $_GET['plugins'] );
@@ -117,22 +108,22 @@ if ( !empty($action) ) {
else
$plugins = array();
- $title = __( 'Upgrade Plugins' );
+ $title = __( 'Update Plugins' );
$parent_file = 'plugins.php';
- require_once( './admin-header.php' );
+ require_once(ABSPATH . 'wp-admin/admin-header.php');
echo '';
screen_icon();
echo '
' . esc_html( $title ) . ' ';
- $url = 'update.php?action=update-selected&plugins=' . urlencode( join(',', $plugins) );
+ $url = self_admin_url('update.php?action=update-selected&plugins=' . urlencode( join(',', $plugins) ));
$url = wp_nonce_url($url, 'bulk-update-plugins');
echo "";
echo '';
- require_once( './admin-footer.php' );
+ require_once(ABSPATH . 'wp-admin/admin-footer.php');
exit;
break;
case 'error_scrape':
@@ -168,22 +159,22 @@ if ( !empty($action) ) {
check_admin_referer('deactivate-plugin_' . $plugin);
deactivate_plugins($plugin);
update_option('recently_activated', array($plugin => time()) + (array)get_option('recently_activated'));
- if (headers_sent())
- echo " ";
+ if ( headers_sent() )
+ echo " ";
else
- wp_redirect("plugins.php?deactivate=true&plugin_status=$status&paged=$page");
+ wp_redirect( self_admin_url("plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s") );
exit;
break;
case 'deactivate-selected':
if ( ! current_user_can('activate_plugins') )
wp_die(__('You do not have sufficient permissions to deactivate plugins for this site.'));
- check_admin_referer('bulk-manage-plugins');
+ check_admin_referer('bulk-plugins');
$plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
$plugins = array_filter($plugins, 'is_plugin_active'); //Do not deactivate plugins which are already deactivated.
if ( empty($plugins) ) {
- wp_redirect("plugins.php?plugin_status=$status&paged=$page");
+ wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
exit;
}
@@ -194,20 +185,25 @@ if ( !empty($action) ) {
$deactivated[ $plugin ] = time();
update_option('recently_activated', $deactivated + (array)get_option('recently_activated'));
- wp_redirect("plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page");
+ wp_redirect( self_admin_url("plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page&s=$s") );
exit;
break;
case 'delete-selected':
if ( ! current_user_can('delete_plugins') )
wp_die(__('You do not have sufficient permissions to delete plugins for this site.'));
- check_admin_referer('bulk-manage-plugins');
+ check_admin_referer('bulk-plugins');
//$_POST = from the plugin form; $_GET = from the FTP details screen.
$plugins = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array();
- $plugins = array_filter($plugins, create_function('$plugin', 'return !is_plugin_active($plugin);') ); //Do not allow to delete Activated plugins.
- if ( empty($plugins) ) {
- wp_redirect("plugins.php?plugin_status=$status&paged=$page");
+ if ( empty( $plugins ) ) {
+ wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
+ exit;
+ }
+
+ $plugins = array_filter($plugins, 'is_plugin_inactive'); // Do not allow to delete Activated plugins.
+ if ( empty( $plugins ) ) {
+ wp_redirect( self_admin_url( "plugins.php?error=true&main=true&plugin_status=$status&paged=$page&s=$s" ) );
exit;
}
@@ -217,17 +213,20 @@ if ( !empty($action) ) {
if ( ! isset($_REQUEST['verify-delete']) ) {
wp_enqueue_script('jquery');
- require_once('./admin-header.php');
+ require_once(ABSPATH . 'wp-admin/admin-header.php');
?>
$data ) {
- $plugin_info[ $plugin_file ] = $data;
+ $plugin_info[ $plugin_file ] = _get_plugin_data_markup_translate( $plugin_file, $data );
$plugin_info[ $plugin_file ]['is_uninstallable'] = is_uninstallable_plugin( $plugin );
+ if ( ! $plugin_info[ $plugin_file ]['Network'] )
+ $have_non_network_plugins = true;
}
}
}
@@ -248,6 +249,9 @@ if ( !empty($action) ) {
$plugins_to_delete = count( $plugin_info );
echo '
' . _n( 'Delete Plugin', 'Delete Plugins', $plugins_to_delete ) . ' ';
?>
+
+
+
', sprintf( __( '%1$s by %2$s (will also delete its data )' ), esc_html($plugin['Name']), esc_html($plugin['Author']) ), '';
+ echo '', sprintf( __( '%1$s by %2$s (will also delete its data )' ), esc_html($plugin['Name']), esc_html($plugin['AuthorName']) ), ' ';
$data_to_delete = true;
} else {
/* translators: 1: plugin name, 2: plugin author */
- echo '', sprintf( __('%1$s by %2$s ' ), esc_html($plugin['Name']), esc_html($plugin['Author']) ), ' ';
+ echo '', sprintf( __('%1$s by %2$s ' ), esc_html($plugin['Name']), esc_html($plugin['AuthorName']) ), ' ';
}
}
?>
@@ -274,14 +278,14 @@ if ( !empty($action) ) {
';
?>
-
-
+
+
-
+
@@ -295,13 +299,13 @@ if ( !empty($action) ) {
prepare_items();
+
+$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
+if ( $pagenum > $total_pages && $total_pages > 0 ) {
+ wp_redirect( add_query_arg( 'paged', $total_pages ) );
+ exit;
+}
+
wp_enqueue_script('plugin-install');
add_thickbox();
+add_screen_option( 'per_page', array('label' => _x( 'Plugins', 'plugins per page (screen options)' )) );
+
add_contextual_help($current_screen,
'' . __('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.') . '
' .
'' . sprintf(__('You can find additional plugins for your site by using the Plugin Browser/Installer functionality or by browsing the WordPress Plugin Directory directly and installing new plugins manually. To manually install a plugin you generally just need to upload the plugin file into your /wp-content/plugins
directory. Once a plugin has been installed, you can activate it here.'), 'plugin-install.php', 'http://wordpress.org/extend/plugins/') . '
' .
@@ -324,8 +338,9 @@ add_contextual_help($current_screen,
);
$title = __('Plugins');
+$parent_file = 'plugins.php';
-require_once('./admin-header.php');
+require_once(ABSPATH . 'wp-admin/admin-header.php');
$invalid = validate_active_plugins();
if ( !empty($invalid) )
@@ -335,15 +350,17 @@ if ( !empty($invalid) )
unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.'), $_GET['charsout']);
else
$errmsg = __('Plugin could not be activated because it triggered a fatal error .');
?>
-
+ if ( !isset( $_GET['main'] ) && !isset($_GET['charsout']) && wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $plugin) ) { ?>
+
@@ -371,415 +388,36 @@ if ( !empty($invalid) )
-
-
-
+
+' . __('Search results for “%s”') . '', esc_html( $s ) ); ?>
+
-$all_plugins = apply_filters( 'all_plugins', get_plugins() );
-$search_plugins = array();
-$active_plugins = array();
-$inactive_plugins = array();
-$recent_plugins = array();
-$recently_activated = get_option('recently_activated', array());
-$upgrade_plugins = array();
-$network_plugins = array();
-$mustuse_plugins = $dropins_plugins = array();
-if ( ! is_multisite() || current_user_can('manage_network_plugins') ) {
- if ( apply_filters( 'show_advanced_plugins', true, 'mustuse' ) )
- $mustuse_plugins = get_mu_plugins();
- if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) )
- $dropins_plugins = get_dropins();
-}
+
-set_transient( 'plugin_slugs', array_keys($all_plugins), 86400 );
-
-// Clean out any plugins which were deactivated over a week ago.
-foreach ( $recently_activated as $key => $time )
- if ( $time + (7*24*60*60) < time() ) //1 week
- unset($recently_activated[ $key ]);
-if ( $recently_activated != get_option('recently_activated') ) //If array changed, update it.
- update_option('recently_activated', $recently_activated);
-$current = get_site_transient( 'update_plugins' );
-
-foreach ( array( 'all_plugins', 'mustuse_plugins', 'dropins_plugins' ) as $plugin_array_name) {
- foreach ( (array) $$plugin_array_name as $plugin_file => $plugin_data ) {
- // Translate, Apply Markup, Sanitize HTML
- $plugin_data = _get_plugin_data_markup_translate($plugin_file, $plugin_data, false, true);
- ${$plugin_array_name}[ $plugin_file ] = $plugin_data;
- }
-}
-unset( $plugin_array_name );
-
-foreach ( (array) $all_plugins as $plugin_file => $plugin_data) {
- // Filter into individual sections
- if ( is_multisite() && is_network_only_plugin( $plugin_file ) && !current_user_can( 'manage_network_plugins' ) ) {
- unset( $all_plugins[ $plugin_file ] );
- continue;
- } elseif ( is_plugin_active_for_network($plugin_file) ) {
- $network_plugins[ $plugin_file ] = $plugin_data;
- } elseif ( is_plugin_active($plugin_file) ) {
- $active_plugins[ $plugin_file ] = $plugin_data;
- } else {
- if ( isset( $recently_activated[ $plugin_file ] ) ) // Was the plugin recently activated?
- $recent_plugins[ $plugin_file ] = $plugin_data;
- $inactive_plugins[ $plugin_file ] = $plugin_data;
- }
+views(); ?>
- if ( isset( $current->response[ $plugin_file ] ) )
- $upgrade_plugins[ $plugin_file ] = $plugin_data;
-}
+
-if ( !current_user_can('update_plugins') )
- $upgrade_plugins = array();
-
-$total_all_plugins = count($all_plugins);
-$total_inactive_plugins = count($inactive_plugins);
-$total_active_plugins = count($active_plugins);
-$total_recent_plugins = count($recent_plugins);
-$total_upgrade_plugins = count($upgrade_plugins);
-$total_network_plugins = count($network_plugins);
-$total_mustuse_plugins = count($mustuse_plugins);
-$total_dropins_plugins = count($dropins_plugins);
-
-// Searching.
-if ( !empty($_GET['s']) ) {
- function _search_plugins_filter_callback($plugin) {
- static $term;
- if ( is_null($term) )
- $term = stripslashes($_GET['s']);
- if ( stripos($plugin['Name'], $term) !== false ||
- stripos($plugin['Description'], $term) !== false ||
- stripos($plugin['Author'], $term) !== false ||
- stripos($plugin['PluginURI'], $term) !== false ||
- stripos($plugin['AuthorURI'], $term) !== false ||
- stripos($plugin['Version'], $term) !== false )
- return true;
- else
- return false;
- }
- $status = 'search';
- $search_plugins = array_filter($all_plugins, '_search_plugins_filter_callback');
- $total_search_plugins = count($search_plugins);
-}
+search_box( __( 'Search Plugins' ), 'plugin' ); ?>
-$plugin_array_name = "${status}_plugins";
-if ( empty($$plugin_array_name) && !in_array($status, array('all', 'search')) ) {
- $status = 'all';
- $plugin_array_name = "${status}_plugins";
-}
-
-$plugins = &$$plugin_array_name;
-
-// Paging.
-$total_this_page = "total_{$status}_plugins";
-$total_this_page = $$total_this_page;
-$plugins_per_page = (int) get_user_option( 'plugins_per_page' );
-if ( empty( $plugins_per_page ) || $plugins_per_page < 1 )
- $plugins_per_page = 999;
-$plugins_per_page = apply_filters( 'plugins_per_page', $plugins_per_page );
-
-$start = ($page - 1) * $plugins_per_page;
-
-$page_links = paginate_links( array(
- 'base' => add_query_arg( 'paged', '%#%' ),
- 'format' => '',
- 'prev_text' => __('«'),
- 'next_text' => __('»'),
- 'total' => ceil($total_this_page / $plugins_per_page),
- 'current' => $page
-));
-$page_links_text = sprintf( '' . __( 'Displaying %s–%s of %s' ) . ' %s',
- number_format_i18n( $start + 1 ),
- number_format_i18n( min( $page * $plugins_per_page, $total_this_page ) ),
- '' . number_format_i18n( $total_this_page ) . ' ',
- $page_links
-);
-
-/**
- * @ignore
- *
- * @param array $plugins
- * @param string $context
- */
-function print_plugins_table($plugins, $context = '') {
- global $page;
- $checkbox = ! in_array( $context, array( 'mustuse', 'dropins' ) ) ? ' ' : '';
-?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ' . __('No plugins to show') . '
- ';
- }
- foreach ( (array)$plugins as $plugin_file => $plugin_data) {
- // preorder
- $actions = array(
- 'network_deactivate' => '', 'deactivate' => '',
- 'network_only' => '', 'activate' => '',
- 'network_activate' => '',
- 'edit' => '',
- 'delete' => '',
- );
-
- if ( 'mustuse' == $context ) {
- $is_active = true;
- } elseif ( 'dropins' == $context ) {
- $dropins = _get_dropins();
- $plugin_name = $plugin_file;
- if ( $plugin_file != $plugin_data['Name'] )
- $plugin_name .= ' ' . $plugin_data['Name'];
- if ( true === ( $dropins[ $plugin_file ][1] ) ) { // Doesn't require a constant
- $is_active = true;
- $description = '' . $dropins[ $plugin_file ][0] . '
';
- } elseif ( constant( $dropins[ $plugin_file ][1] ) ) { // Constant is true
- $is_active = true;
- $description = '' . $dropins[ $plugin_file ][0] . '
';
- } else {
- $is_active = false;
- $description = '' . $dropins[ $plugin_file ][0] . ' ' . __('Inactive:') . ' ' . sprintf( __( 'Requires %s
in wp-config.php
.' ), "define('" . $dropins[ $plugin_file ][1] . "', true);" ) . '
';
- }
- if ( $plugin_data['Description'] )
- $description .= '' . $plugin_data['Description'] . '
';
- } else {
- $is_active_for_network = is_plugin_active_for_network($plugin_file);
- $is_active = $is_active_for_network || is_plugin_active( $plugin_file );
- if ( $is_active_for_network && !is_super_admin() )
- continue;
-
- if ( $is_active ) {
- if ( $is_active_for_network ) {
- if ( is_super_admin() )
- $actions['network_deactivate'] = '' . __('Network Deactivate') . ' ';
- } else {
- $actions['deactivate'] = '' . __('Deactivate') . ' ';
- }
- } else {
- if ( is_multisite() && is_network_only_plugin( $plugin_file ) )
- $actions['network_only'] = '' . __('Network Only') . ' ';
- else
- $actions['activate'] = '' . __('Activate') . ' ';
-
- if ( is_multisite() && current_user_can( 'manage_network_plugins' ) )
- $actions['network_activate'] = '' . __('Network Activate') . ' ';
-
- if ( current_user_can('delete_plugins') )
- $actions['delete'] = '' . __('Delete') . ' ';
- } // end if $is_active
-
- if ( current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
- $actions['edit'] = '' . __('Edit') . ' ';
- } // end if $context
-
- $actions = apply_filters( 'plugin_action_links', array_filter( $actions ), $plugin_file, $plugin_data, $context );
- $actions = apply_filters( "plugin_action_links_$plugin_file", $actions, $plugin_file, $plugin_data, $context );
-
- $class = $is_active ? 'active' : 'inactive';
- $checkbox = in_array( $context, array( 'mustuse', 'dropins' ) ) ? '' : " ";
- if ( 'dropins' != $context ) {
- $description = '' . $plugin_data['Description'] . '
';
- $plugin_name = $plugin_data['Name'];
- }
- echo "
-
- $checkbox
- $plugin_name
- $description
-
-
-
- ";
- echo '';
- foreach ( $actions as $action => $link ) {
- $sep = end($actions) == $link ? '' : ' | ';
- echo "$link$sep ";
- }
- echo "
- ";
- $plugin_meta = array();
- if ( !empty($plugin_data['Version']) )
- $plugin_meta[] = sprintf(__('Version %s'), $plugin_data['Version']);
- if ( !empty($plugin_data['Author']) ) {
- $author = $plugin_data['Author'];
- if ( !empty($plugin_data['AuthorURI']) )
- $author = '' . $plugin_data['Author'] . ' ';
- $plugin_meta[] = sprintf( __('By %s'), $author );
- }
- if ( ! empty($plugin_data['PluginURI']) )
- $plugin_meta[] = '' . __('Visit plugin site') . ' ';
-
- $plugin_meta = apply_filters('plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $context);
- echo implode(' | ', $plugin_meta);
- echo "
- \n";
-
- do_action( 'after_plugin_row', $plugin_file, $plugin_data, $context );
- do_action( "after_plugin_row_$plugin_file", $plugin_file, $plugin_data, $context );
- }
-?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- :
-
-
-
-
-
-
-
-
-
-
-" . sprintf( _nx( 'All (%s) ', 'All (%s) ', $total_all_plugins, 'plugins' ), number_format_i18n( $total_all_plugins ) ) . ' ';
-if ( ! empty($active_plugins) ) {
- $class = ( 'active' == $status ) ? ' class="current"' : '';
- $status_links[] = "" . sprintf( _n( 'Active (%s) ', 'Active (%s) ', $total_active_plugins ), number_format_i18n( $total_active_plugins ) ) . ' ';
-}
-if ( ! empty($recent_plugins) ) {
- $class = ( 'recent' == $status ) ? ' class="current"' : '';
- $status_links[] = "" . sprintf( _n( 'Recently Active (%s) ', 'Recently Active (%s) ', $total_recent_plugins ), number_format_i18n( $total_recent_plugins ) ) . ' ';
-}
-if ( ! empty($inactive_plugins) ) {
- $class = ( 'inactive' == $status ) ? ' class="current"' : '';
- $status_links[] = "" . sprintf( _n( 'Inactive (%s) ', 'Inactive (%s) ', $total_inactive_plugins ), number_format_i18n( $total_inactive_plugins ) ) . ' ';
-}
-if ( ! empty($network_plugins) ) {
- $class = ( 'network' == $status ) ? ' class="current"' : '';
- $status_links[] = "" . sprintf( _n( 'Network (%s) ', 'Network (%s) ', $total_network_plugins ), number_format_i18n( $total_network_plugins ) ) . ' ';
-}
-if ( ! empty($mustuse_plugins) ) {
- $class = ( 'mustuse' == $status ) ? ' class="current"' : '';
- $status_links[] = "" . sprintf( _n( 'Must-Use (%s) ', 'Must-Use (%s) ', $total_mustuse_plugins ), number_format_i18n( $total_mustuse_plugins ) ) . ' ';
-}
-if ( ! empty($dropins_plugins) ) {
- $class = ( 'dropins' == $status ) ? ' class="current"' : '';
- $status_links[] = "" . sprintf( _n( 'Drop-ins (%s) ', 'Drop-ins (%s) ', $total_dropins_plugins ), number_format_i18n( $total_dropins_plugins ) ) . ' ';
-}
-if ( ! empty($upgrade_plugins) ) {
- $class = ( 'upgrade' == $status ) ? ' class="current"' : '';
- $status_links[] = "" . sprintf( _n( 'Upgrade Available (%s) ', 'Upgrade Available (%s) ', $total_upgrade_plugins ), number_format_i18n( $total_upgrade_plugins ) ) . ' ';
-}
-if ( ! empty($search_plugins) ) {
- $class = ( 'search' == $status ) ? ' class="current"' : '';
- $term = isset($_REQUEST['s']) ? urlencode(stripslashes($_REQUEST['s'])) : '';
- $status_links[] = "" . sprintf( _n( 'Search Results (%s) ', 'Search Results (%s) ', $total_search_plugins ), number_format_i18n( $total_search_plugins ) ) . ' ';
-}
-echo implode( " | \n", $status_links ) . '';
-unset( $status_links );
-?>
-
-
' . __( 'Files in the /wp-content/mu-plugins
directory are executed automatically.' ) . '
';
+ echo '
' . __( 'Files in the /wp-content/mu-plugins
directory are executed automatically.' ) . '
';
elseif ( 'dropins' == $status )
- echo '
' . __( 'Drop-ins are advanced plugins in the /wp-content
directory that replace WordPress functionality when present.' ) . '
';
-
-if ( !empty( $plugins ) && ( ! in_array( $status, array( 'mustuse', 'dropins' ) ) || $page_links ) ) :
+ echo '
' . __( 'Drop-ins are advanced plugins in the /wp-content
directory that replace WordPress functionality when present.' ) . '
';
?>
-
-', $page_links_text, '
';
-print_plugin_actions($status);
-?>
-
-
- $plugins_per_page )
- $plugins = array_slice($plugins, $start, $plugins_per_page);
-
-print_plugins_table($plugins, $status);
-
-if ( !empty( $plugins ) && ! in_array( $status, array( 'mustuse', 'dropins' ) ) || $page_links ) {
-?>
-
-$page_links_text
";
-
-print_plugin_actions($status, "action2");
-?>
-
-
+display(); ?>
-
-
-
-
-
+include(ABSPATH . 'wp-admin/admin-footer.php');
diff --git a/wp-admin/post-new.php b/wp-admin/post-new.php
index 93c4ffbc..ed123a46 100644
--- a/wp-admin/post-new.php
+++ b/wp-admin/post-new.php
@@ -30,27 +30,14 @@ $title = $post_type_object->labels->add_new_item;
$editing = true;
-if ( 'post' == $post_type && !current_user_can('edit_posts') ) {
- include('./admin-header.php'); ?>
-
-
edit_posts capability to your user, in order to be authorized to post.
-You can also e-mail the admin to ask for a promotion.
-When you’re promoted, just reload this page and you’ll be able to blog. :)'), get_option('admin_email')); ?>
-
-
-cap->edit_posts ) )
+ wp_die( __( 'Cheatin’ uh?' ) );
wp_enqueue_script('autosave');
// Show post form.
-if ( current_user_can($post_type_object->cap->edit_posts) ) {
- $post = get_default_post_to_edit( $post_type, true );
- $post_ID = $post->ID;
- include('edit-form-advanced.php');
-}
-
+$post = get_default_post_to_edit( $post_type, true );
+$post_ID = $post->ID;
+include('edit-form-advanced.php');
include('./admin-footer.php');
-?>
\ No newline at end of file
+?>
diff --git a/wp-admin/post.php b/wp-admin/post.php
index 548007f7..0dae46dd 100644
--- a/wp-admin/post.php
+++ b/wp-admin/post.php
@@ -51,12 +51,7 @@ if ( $post_id ) {
* @param int $post_id Optional. Post ID.
*/
function redirect_post($post_id = '') {
- if ( !empty($_POST['mode']) && 'sidebar' == $_POST['mode'] ) {
- if ( isset($_POST['saveasdraft']) )
- $location = 'sidebar.php?a=c';
- elseif ( isset($_POST['publish']) )
- $location = 'sidebar.php?a=b';
- } elseif ( isset($_POST['save']) || isset($_POST['publish']) ) {
+ if ( isset($_POST['save']) || isset($_POST['publish']) ) {
$status = get_post_status( $post_id );
if ( isset( $_POST['publish'] ) ) {
@@ -90,6 +85,7 @@ function redirect_post($post_id = '') {
}
wp_redirect( apply_filters( 'redirect_post_location', $location, $post_id ) );
+ exit;
}
if ( isset( $_POST['deletepost'] ) )
@@ -143,7 +139,7 @@ case 'edit':
$editing = true;
if ( empty( $post_id ) ) {
- wp_redirect("post.php");
+ wp_redirect( admin_url('post.php') );
exit();
}
@@ -166,7 +162,10 @@ case 'edit':
$parent_file = "edit.php";
$submenu_file = "edit.php";
} else {
- $parent_file = "edit.php?post_type=$post_type";
+ if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true )
+ $parent_file = $post_type_object->show_in_menu;
+ else
+ $parent_file = "edit.php?post_type=$post_type";
$submenu_file = "edit.php?post_type=$post_type";
}
@@ -270,7 +269,7 @@ case 'preview':
break;
default:
- wp_redirect('edit.php');
+ wp_redirect( admin_url('edit.php') );
exit();
break;
} // end switch
diff --git a/wp-admin/press-this.php b/wp-admin/press-this.php
index 04f8d0f5..aa4eb47f 100644
--- a/wp-admin/press-this.php
+++ b/wp-admin/press-this.php
@@ -6,8 +6,11 @@
* @subpackage Press_This
*/
+define('IFRAME_REQUEST' , true);
+
/** WordPress Administration Bootstrap */
require_once('./admin.php');
+
header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
if ( ! current_user_can('edit_posts') )
@@ -24,6 +27,7 @@ if ( ! current_user_can('edit_posts') )
*/
function press_it() {
// define some basic variables
+ $quick = array();
$quick['post_status'] = 'draft'; // set as draft first
$quick['post_category'] = isset($_POST['post_category']) ? $_POST['post_category'] : null;
$quick['tax_input'] = isset($_POST['tax_input']) ? $_POST['tax_input'] : null;
@@ -52,18 +56,25 @@ function press_it() {
}
}
// set the post_content and status
- if ( isset( $_POST['publish'] ) && current_user_can( 'publish_posts' ) )
- $quick['post_status'] = 'publish';
- elseif ( isset( $_POST['review'] ) )
- $quick['post_status'] = 'pending';
- else
- $quick['post_status'] = 'draft';
+ $quick['post_status'] = isset($_POST['publish']) ? 'publish' : 'draft';
$quick['post_content'] = $content;
// error handling for media_sideload
if ( is_wp_error($upload) ) {
wp_delete_post($post_ID);
wp_die($upload);
} else {
+ // Post formats
+ if ( current_theme_supports( 'post-formats' ) && isset( $_POST['post_format'] ) ) {
+ $post_formats = get_theme_support( 'post-formats' );
+ if ( is_array( $post_formats ) ) {
+ $post_formats = $post_formats[0];
+ if ( in_array( $_POST['post_format'], $post_formats ) )
+ set_post_format( $post_ID, $_POST['post_format'] );
+ elseif ( '0' == $_POST['post_format'] )
+ set_post_format( $post_ID, false );
+ }
+ }
+
$quick['ID'] = $post_ID;
wp_update_post($quick);
}
@@ -115,7 +126,7 @@ if ( !empty($_REQUEST['ajax']) ) {
@@ -322,7 +333,7 @@ die;
//','uid':'ID; ?>','time':''};
-var ajaxurl = '', pagenow = 'press-this';
+var ajaxurl = '', pagenow = 'press-this', isRtl = ;
var photostorage = false;
//]]>
@@ -332,8 +343,10 @@ var photostorage = false;
do_action('admin_print_scripts');
do_action('admin_head');
- if ( user_can_richedit() )
+ if ( user_can_richedit() ) {
wp_tiny_mce( true, array( 'height' => '370' ) );
+ add_action( 'admin_print_footer_scripts', 'wp_tiny_mce_preload_dialogs', 30 );
+ }
?>
diff --git a/wp-admin/user-new.php b/wp-admin/user-new.php
index 12da9e19..b9d87256 100644
--- a/wp-admin/user-new.php
+++ b/wp-admin/user-new.php
@@ -9,25 +9,24 @@
/** WordPress Administration Bootstrap */
require_once('./admin.php');
-if ( !current_user_can('create_users') )
- wp_die(__('Cheatin’ uh?'));
-
-if ( is_multisite() && !get_site_option( 'add_new_users' ) )
- wp_die( __('Page disabled by the administrator') );
-
-/** WordPress Registration API */
-require_once( ABSPATH . WPINC . '/registration.php');
+if ( is_multisite() ) {
+ if ( ! current_user_can( 'create_users' ) && ! current_user_can( 'promote_users' ) )
+ wp_die( __( 'Cheatin’ uh?' ) );
+} elseif ( ! current_user_can( 'create_users' ) ) {
+ wp_die( __( 'Cheatin’ uh?' ) );
+}
if ( is_multisite() ) {
function admin_created_user_email( $text ) {
- return sprintf( __( "Hi,
-You've been invited to join '%s' at
-%s as a %s.
+ /* translators: 1: Site name, 2: site URL, 3: role */
+ return sprintf( __( 'Hi,
+You\'ve been invited to join \'%1$s\' at
+%2$s as a %3$s.
If you do not want to join this site please ignore
this email. This invitation will expire in a few days.
Please click the following link to activate your user account:
-%%s" ), get_bloginfo('name'), site_url(), esc_html( $_REQUEST[ 'role' ] ) );
+%%s' ), get_bloginfo('name'), site_url(), esc_html( $_REQUEST[ 'role' ] ) );
}
add_filter( 'wpmu_signup_user_notification_email', 'admin_created_user_email' );
@@ -37,7 +36,54 @@ Please click the following link to activate your user account:
}
if ( isset($_REQUEST['action']) && 'adduser' == $_REQUEST['action'] ) {
- check_admin_referer('add-user');
+ check_admin_referer( 'add-user', '_wpnonce_add-user' );
+
+ $user_details = null;
+ if ( false !== strpos($_REQUEST[ 'email' ], '@') ) {
+ $user_details = get_user_by('email', $_REQUEST[ 'email' ]);
+ } else {
+ if ( is_super_admin() ) {
+ $user_details = get_user_by('login', $_REQUEST[ 'email' ]);
+ } else {
+ wp_redirect( add_query_arg( array('update' => 'enter_email'), 'user-new.php' ) );
+ die();
+ }
+ }
+
+ if ( !$user_details ) {
+ wp_redirect( add_query_arg( array('update' => 'does_not_exist'), 'user-new.php' ) );
+ die();
+ }
+
+ if ( ! current_user_can('promote_user', $user_details->ID) )
+ wp_die(__('Cheatin’ uh?'));
+
+ // Adding an existing user to this blog
+ $new_user_email = esc_html(trim($_REQUEST['email']));
+ $redirect = 'user-new.php';
+ $username = $user_details->user_login;
+ $user_id = $user_details->ID;
+ if ( ( $username != null && !is_super_admin( $user_id ) ) && ( array_key_exists($blog_id, get_blogs_of_user($user_id)) ) ) {
+ $redirect = add_query_arg( array('update' => 'addexisting'), 'user-new.php' );
+ } else {
+ if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) {
+ add_existing_user_to_blog( array( 'user_id' => $user_id, 'role' => $_REQUEST[ 'role' ] ) );
+ $redirect = add_query_arg( array('update' => 'addnoconfirmation'), 'user-new.php' );
+ } else {
+ $newuser_key = substr( md5( $user_id ), 0, 5 );
+ add_option( 'new_user_' . $newuser_key, array( 'user_id' => $user_id, 'email' => $user_details->user_email, 'role' => $_REQUEST[ 'role' ] ) );
+ $message = __("Hi,\n\nYou have been invited to join '%s' at\n%s as a %s.\nPlease click the following link to confirm the invite:\n%s\n");
+ wp_mail( $new_user_email, sprintf( __( '[%s] Joining confirmation' ), get_option( 'blogname' ) ), sprintf($message, get_option('blogname'), site_url(), $_REQUEST[ 'role' ], site_url("/newbloguser/$newuser_key/")));
+ $redirect = add_query_arg( array('update' => 'add'), 'user-new.php' );
+ }
+ }
+ wp_redirect( $redirect );
+ die();
+} elseif ( isset($_REQUEST['action']) && 'createuser' == $_REQUEST['action'] ) {
+ check_admin_referer( 'create-user', '_wpnonce_create-user' );
+
+ if ( ! current_user_can('create_users') )
+ wp_die(__('Cheatin’ uh?'));
if ( !is_multisite() ) {
$user_id = add_user();
@@ -55,59 +101,38 @@ if ( isset($_REQUEST['action']) && 'adduser' == $_REQUEST['action'] ) {
die();
}
} else {
- $user_login = preg_replace( "/\s+/", '', sanitize_user( $_REQUEST[ 'user_login' ], true ) );
- $user_details = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->users} WHERE user_login = %s AND user_email = %s", $user_login, $_REQUEST[ 'email' ] ) );
- if ( $user_details ) {
- // Adding an existing user to this blog
- $new_user_email = esc_html(trim($_REQUEST['email']));
- $redirect = 'user-new.php';
- $username = $user_details->user_login;
- $user_id = $user_details->ID;
- if ( ( $username != null && !is_super_admin( $user_id ) ) && ( array_key_exists($blog_id, get_blogs_of_user($user_id)) ) ) {
- $redirect = add_query_arg( array('update' => 'addexisting'), 'user-new.php' );
+ // Adding a new user to this blog
+ $user_details = wpmu_validate_user_signup( $_REQUEST[ 'user_login' ], $_REQUEST[ 'email' ] );
+ unset( $user_details[ 'errors' ]->errors[ 'user_email_used' ] );
+ if ( is_wp_error( $user_details[ 'errors' ] ) && !empty( $user_details[ 'errors' ]->errors ) ) {
+ $add_user_errors = $user_details[ 'errors' ];
+ } else {
+ $new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_REQUEST['user_login']), true));
+ if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) {
+ add_filter( 'wpmu_signup_user_notification', '__return_false' ); // Disable confirmation email
+ }
+ wpmu_signup_user( $new_user_login, $_REQUEST[ 'email' ], array( 'add_to_blog' => $wpdb->blogid, 'new_role' => $_REQUEST[ 'role' ] ) );
+ if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) {
+ $key = $wpdb->get_var( $wpdb->prepare( "SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $new_user_login, $_REQUEST[ 'email' ] ) );
+ wpmu_activate_signup( $key );
+ $redirect = add_query_arg( array('update' => 'addnoconfirmation'), 'user-new.php' );
} else {
- if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) {
- add_existing_user_to_blog( array( 'user_id' => $user_id, 'role' => $_REQUEST[ 'role' ] ) );
- $redirect = add_query_arg( array('update' => 'addnoconfirmation'), 'user-new.php' );
- } else {
- $newuser_key = substr( md5( $user_id ), 0, 5 );
- add_option( 'new_user_' . $newuser_key, array( 'user_id' => $user_id, 'email' => $user_details->user_email, 'role' => $_REQUEST[ 'role' ] ) );
- $message = __("Hi,\n\nYou have been invited to join '%s' at\n%s as a %s.\nPlease click the following link to confirm the invite:\n%s\n");
- wp_mail( $new_user_email, sprintf( __( '[%s] Joining confirmation' ), get_option( 'blogname' ) ), sprintf($message, get_option('blogname'), site_url(), $_REQUEST[ 'role' ], site_url("/newbloguser/$newuser_key/")));
- $redirect = add_query_arg( array('update' => 'add'), 'user-new.php' );
- }
+ $redirect = add_query_arg( array('update' => 'newuserconfimation'), 'user-new.php' );
}
wp_redirect( $redirect );
die();
- } else {
- // Adding a new user to this blog
- $user_details = wpmu_validate_user_signup( $_REQUEST[ 'user_login' ], $_REQUEST[ 'email' ] );
- unset( $user_details[ 'errors' ]->errors[ 'user_email_used' ] );
- if ( is_wp_error( $user_details[ 'errors' ] ) && !empty( $user_details[ 'errors' ]->errors ) ) {
- $add_user_errors = $user_details[ 'errors' ];
- } else {
- $new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_REQUEST['user_login']), true));
- if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) {
- add_filter( 'wpmu_signup_user_notification', '__return_false' ); // Disable confirmation email
- }
- wpmu_signup_user( $new_user_login, $_REQUEST[ 'email' ], array( 'add_to_blog' => $wpdb->blogid, 'new_role' => $_REQUEST[ 'role' ] ) );
- if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) {
- $key = $wpdb->get_var( $wpdb->prepare( "SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $new_user_login, $_REQUEST[ 'email' ] ) );
- wpmu_activate_signup( $key );
- $redirect = add_query_arg( array('update' => 'addnoconfirmation'), 'user-new.php' );
- } else {
- $redirect = add_query_arg( array('update' => 'newuserconfimation'), 'user-new.php' );
- }
- wp_redirect( $redirect );
- die();
- }
}
}
}
+
$title = __('Add New User');
$parent_file = 'users.php';
+$do_both = false;
+if ( is_multisite() && current_user_can('promote_users') && current_user_can('create_users') )
+ $do_both = true;
+
add_contextual_help($current_screen,
'' . __('To add a new user to your site, fill in the form on this screen. If you’re not sure which role to assign, you can use the link below to review the different roles and their capabilities. Here is a basic overview of roles:') . '
' .
'' .
@@ -127,7 +152,6 @@ add_contextual_help($current_screen,
wp_enqueue_script('wp-ajax-response');
wp_enqueue_script('user-profile');
-wp_enqueue_script('password-strength-meter');
require_once ('admin-header.php');
@@ -147,6 +171,12 @@ if ( isset($_GET['update']) ) {
case "addexisting":
$messages[] = __('That user is already a member of this site.');
break;
+ case "does_not_exist":
+ $messages[] = __('The requested user does not exist.');
+ break;
+ case "does_not_exist":
+ $messages[] = __('Please enter a valid email address.');
+ break;
}
} else {
if ( 'add' == $_GET['update'] )
@@ -156,7 +186,13 @@ if ( isset($_GET['update']) ) {
?>
-
+
+
@@ -185,32 +221,70 @@ if ( ! empty( $messages ) ) {
' . sprintf(__('Users can
register themselves or you can manually create users here.'), site_url('wp-register.php')) . '';
- else
- echo '
' . sprintf(__('Users cannot currently register themselves , but you can manually create users here.'), admin_url('options-general.php#users_can_register')) . '
';
-} else {
- echo '
' . __( 'You can add new users to your site in two ways:' ) . '
' . __( 'Enter the username and email address of an existing user on this site.' ) . ' ' . __( 'Enter the username and the email address of a person who is not already a member of this site. Choose the username carefully, it cannot be changed.' ) . ' ';
- echo '
' . __( 'That person will be sent an email asking them to click a link confirming the invite. New users will then be sent an email with a randomly generated password and a login link.' ) . '
';
-}
+if ( is_multisite() ) {
+ if ( $do_both )
+ echo '
' . __('Add Existing User') . ' ';
+ if ( !is_super_admin() ) {
+ _e( 'Enter the email address of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.' );
+ $label = __('E-mail');
+ } else {
+ _e( 'Enter the email address or username of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.' );
+ $label = __('E-mail or Username');
+ }
?>
-
>
-
+ >
+
+
+
+
+ 'addusersub' ) ); ?>
+
+' . __( 'Add New User' ) . '';
+?>
+
+
>
+
+
'login', 'first_name' => 'firstname', 'last_name' => 'lastname',
- 'email' => 'email', 'url' => 'uri', 'role' => 'role') as $post_field => $var ) {
+// Load up the passed data, else set to a default.
+foreach ( array( 'user_login' => 'login', 'first_name' => 'firstname', 'last_name' => 'lastname',
+ 'email' => 'email', 'url' => 'uri', 'role' => 'role', 'send_password' => 'send_password', 'noconfirmation' => 'ignore_pass' ) as $post_field => $var ) {
$var = "new_user_$var";
- if ( ! isset($$var) )
- $$var = isset($_POST[$post_field]) ? stripslashes($_POST[$post_field]) : '';
+ if( isset( $_POST['createuser'] ) ) {
+ if ( ! isset($$var) )
+ $$var = isset( $_POST[$post_field] ) ? stripslashes( $_POST[$post_field] ) : '';
+ } else {
+ $$var = false;
+ }
}
-$new_user_send_password = !$_POST || isset($_POST['send_password']);
+
?>
-
-
-
-
+ 'createusersub' ) ); ?>
+
+
+
diff --git a/wp-admin/user/index-extra.php b/wp-admin/user/index-extra.php
new file mode 100644
index 00000000..48812635
--- /dev/null
+++ b/wp-admin/user/index-extra.php
@@ -0,0 +1,12 @@
+
\ No newline at end of file
diff --git a/wp-admin/user/profile.php b/wp-admin/user/profile.php
new file mode 100644
index 00000000..4857a508
--- /dev/null
+++ b/wp-admin/user/profile.php
@@ -0,0 +1,12 @@
+get_pagenum();
$title = __('Users');
$parent_file = 'users.php';
+add_screen_option( 'per_page', array('label' => _x( 'Users', 'users per page (screen options)' )) );
+
// contextual help - choose Help on the top right of admin panel to preview this.
add_contextual_help($current_screen,
- '
' . __('This screen lists all the existing users for your site. Each user has one of five defined roles as set by the site admin: Site Administrator, Editor, Author, Contributor, or Subscriber. Users with roles other than Administrator will see fewer options when they are logged in, based on their role.') . '
' .
+ '
' . __('This screen lists all the existing users for your site. Each user has one of five defined roles as set by the site admin: Site Administrator, Editor, Author, Contributor, or Subscriber. Users with roles other than Administrator will see fewer options in the dashboard navigation when they are logged in, based on their role.') . '
' .
'
' . __('You can customize the display of information on this screen as you can on other screens, by using the Screen Options tab and the on-screen filters.') . '
' .
'
' . __('To add a new user for your site, click the Add New button at the top of the screen or Add New in the Users menu section.') . '
' .
'
' . __('For more information:') . '
' .
- '
' . __('Documentation on Authors and Users ') . '
' .
- '
' . __('Roles and Capabilities Descriptions ') . '
' .
+ '
' . __('Documentation on Managing Users ') . '
' .
+ '
' . __('Descriptions of Roles and Capabilities ') . '
' .
'
' . __('Support Forums ') . '
'
);
-$update = $doaction = '';
-if ( isset($_REQUEST['action']) )
- $doaction = $_REQUEST['action'] ? $_REQUEST['action'] : $_REQUEST['action2'];
-
-if ( empty($doaction) ) {
- if ( isset($_GET['changeit']) && !empty($_GET['new_role']) )
- $doaction = 'promote';
-}
-
if ( empty($_REQUEST) ) {
$referer = '
';
} elseif ( isset($_REQUEST['wp_http_referer']) ) {
@@ -48,12 +40,17 @@ if ( empty($_REQUEST) ) {
$referer = '';
}
-switch ($doaction) {
+$update = '';
+
+switch ( $wp_list_table->current_action() ) {
/* Bulk Dropdown menu Role changes */
case 'promote':
check_admin_referer('bulk-users');
+ if ( ! current_user_can( 'promote_users' ) )
+ wp_die( __( 'You can’t edit that user.' ) );
+
if ( empty($_REQUEST['users']) ) {
wp_redirect($redirect);
exit();
@@ -178,18 +175,6 @@ case 'delete':
$go_delete = true;
}
}
- // @todo Delete is always for !is_multisite(). Use API.
- if ( !is_multisite() ) {
- $all_logins = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users ORDER BY user_login");
- } else {
- // WPMU only searches users of current blog
- $all_logins = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users, $wpdb->usermeta WHERE $wpdb->users.ID = $wpdb->usermeta.user_id AND meta_key = '".$wpdb->prefix."capabilities' ORDER BY user_login");
- }
- $user_dropdown = '
';
- foreach ( (array) $all_logins as $login )
- if ( $login->ID == $current_user->ID || !in_array($login->ID, $userids) )
- $user_dropdown .= "ID) . "\">{$login->user_login} ";
- $user_dropdown .= ' ';
?>
@@ -198,10 +183,11 @@ case 'delete':
- '.__('Attribute all posts and links to:')." $user_dropdown"; ?>
+ '.__('Attribute all posts and links to:').'';
+ wp_dropdown_users( array( 'name' => 'reassign_user', 'exclude' => array_diff( $userids, array($current_user->ID) ) ) ); ?>
-
+
@@ -214,13 +200,16 @@ break;
case 'doremove':
check_admin_referer('remove-users');
+ if ( ! is_multisite() )
+ wp_die( __( 'You can’t remove users.' ) );
+
if ( empty($_REQUEST['users']) ) {
wp_redirect($redirect);
exit;
}
- if ( !current_user_can('remove_users') )
- die(__('You can’t remove users.'));
+ if ( ! current_user_can( 'remove_users' ) )
+ wp_die( __( 'You can’t remove users.' ) );
$userids = $_REQUEST['users'];
@@ -248,6 +237,9 @@ case 'remove':
check_admin_referer('bulk-users');
+ if ( ! is_multisite() )
+ wp_die( __( 'You can’t remove users.' ) );
+
if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) {
wp_redirect($redirect);
exit();
@@ -289,7 +281,7 @@ case 'remove':
?>
-
+
@@ -306,21 +298,14 @@ default:
exit;
}
+ $wp_list_table->prepare_items();
+ $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
+ if ( $pagenum > $total_pages && $total_pages > 0 ) {
+ wp_redirect( add_query_arg( 'paged', $total_pages ) );
+ exit;
+ }
include('./admin-header.php');
- $usersearch = isset($_GET['usersearch']) ? $_GET['usersearch'] : null;
- $userspage = isset($_GET['userspage']) ? $_GET['userspage'] : null;
- $role = isset($_GET['role']) ? $_GET['role'] : null;
-
- // Query the user IDs for this page
- $wp_user_search = new WP_User_Search($usersearch, $userspage, $role);
-
- // Query the post counts for this page
- $post_counts = count_many_users_posts($wp_user_search->get_results());
-
- // Query the users for this page
- cache_users($wp_user_search->get_results());
-
$messages = array();
if ( isset($_GET['update']) ) :
switch($_GET['update']) {
@@ -371,153 +356,27 @@ if ( ! empty($messages) ) {
-
' . __('Search results for “%s”') . '', esc_html( $_GET['usersearch'] ) ); ?>
-
-
-
-
-
+
" . sprintf( _nx( 'All (%s) ', 'All (%s) ', $total_users, 'users' ), number_format_i18n( $total_users ) ) . ' ';
-foreach ( $wp_roles->get_names() as $this_role => $name ) {
- if ( !isset($avail_roles[$this_role]) )
- continue;
-
- $class = '';
-
- if ( $this_role == $role ) {
- $current_role = $role;
- $class = ' class="current"';
- }
-
- $name = translate_user_role( $name );
- /* translators: User role name with count */
- $name = sprintf( __('%1$s (%2$s) '), $name, $avail_roles[$this_role] );
- $role_links[] = " $name ";
-}
-echo implode( " | \n", $role_links) . '';
-unset($role_links);
-?>
-
-
-
-
-
-
- :
-
-
-
-
-
-
-
-
-results_are_paged() ) : ?>
-
page_links(); ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- search_errors ) ) : ?>
-
-
- search_errors->get_error_messages() as $message )
- echo "$message ";
- ?>
-
-
-
-
-
-get_results() ) : ?>
-
- is_search() ) : ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-get_results() as $userid ) {
- $user_object = new WP_User($userid);
- $roles = $user_object->roles;
- $role = array_shift($roles);
-
- if ( is_multisite() && empty( $role ) )
- continue;
-
- $style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"';
- echo "\n\t", user_row( $user_object, $style, $role, $post_counts[ $userid ] );
-}
-?>
-
-
-
-
-
-results_are_paged() ) : ?>
-
page_links(); ?>
-
+echo esc_html( $title );
+if ( current_user_can( 'create_users' ) ) { ?>
+
+
+
+' . __('Search results for “%s”') . '', esc_html( $usersearch ) ); ?>
+
-
-
-
-
-
-
-
-
-
-
+views(); ?>
-
-
+
-
+search_box( __( 'Search Users' ), 'user' ); ?>
+display(); ?>
-
+
diff --git a/wp-admin/widgets.php b/wp-admin/widgets.php
index d3c401b1..4ae5478f 100644
--- a/wp-admin/widgets.php
+++ b/wp-admin/widgets.php
@@ -35,14 +35,14 @@ $parent_file = 'themes.php';
$help = '
' . __('Widgets are independent sections of content that can be placed into any widgetized area provided by your theme (commonly called sidebars). To populate your sidebars/widget areas with individual widgets, drag and drop the title bars into the desired area. By default, only the first widget area is expanded. To populate additional widget areas, click on their title bars to expand them.') . '
- ' . __('Available Widgets section contains all the widgets you can choose from. Once you drag a widget into a sidebar, it will open to allow you to configure its settings. When you are happy with the widget settings, click the Save button and the widget will go live on your site. If you click Delete, it will remove the widget.') . '
+ ' . __('The Available Widgets section contains all the widgets you can choose from. Once you drag a widget into a sidebar, it will open to allow you to configure its settings. When you are happy with the widget settings, click the Save button and the widget will go live on your site. If you click Delete, it will remove the widget.') . '
' . __('If you want to remove the widget but save its setting for possible future use, just drag it into the Inactive Widgets area. You can add them back anytime from there. This is especially helpful when you switch to a theme with fewer or different widget areas.') . '
' . __('Widgets may be used multiple times. You can give each widget a title, to display on your site, but it’s not required.') . '
' . __('Enabling Accessibility Mode, via Screen Options, allows you to use Add and Edit buttons instead of using drag and drop.') . '
' . __('Many themes show some sidebar widgets by default until you edit your sidebars, but they are not automatically displayed in your sidebar management tool. After you make your first widget change, you can re-add the default widgets by adding them from the Available Widgets area.') . '
';
$help .= '' . __('For more information:') . '
';
-$help .= '' . __('Widgets Documentation ') . '
';
+$help .= '' . __('Documentation on Widgets ') . '
';
$help .= '' . __('Support Forums ') . '
';
add_contextual_help($current_screen, $help);
@@ -175,7 +175,7 @@ if ( isset($_POST['savewidget']) || isset($_POST['removewidget']) ) {
if ( isset($_POST['removewidget']) && $_POST['removewidget'] ) {
if ( !in_array($widget_id, $sidebar, true) ) {
- wp_redirect('widgets.php?error=0');
+ wp_redirect( admin_url('widgets.php?error=0') );
exit;
}
@@ -208,7 +208,7 @@ if ( isset($_POST['savewidget']) || isset($_POST['removewidget']) ) {
}
wp_set_sidebars_widgets($sidebars_widgets);
- wp_redirect('widgets.php?message=0');
+ wp_redirect( admin_url('widgets.php?message=0') );
exit;
}
@@ -306,12 +306,14 @@ if ( isset($_GET['editwidget']) && $_GET['editwidget'] ) {
-
+
-
-
-
-
+
diff --git a/wp-app.php b/wp-app.php
index f21c3c06..6de52882 100644
--- a/wp-app.php
+++ b/wp-app.php
@@ -387,7 +387,7 @@ EOD;
* @since 2.2.0
*/
function create_post() {
- global $blog_id, $user_ID;
+ global $user_ID;
$this->get_accepted_content_type($this->atom_content_types);
$parser = new AtomParser();
@@ -419,7 +419,7 @@ EOD;
if ( !current_user_can($cap) )
$this->auth_required(__('Sorry, you do not have the right to edit/publish new posts.'));
- $blog_ID = (int ) $blog_id;
+ $blog_ID = get_current_blog_id();
$post_status = ($publish) ? 'publish' : 'draft';
$post_author = (int) $user_ID;
$post_title = $entry->title[1];
@@ -712,7 +712,7 @@ EOD;
$filetype = wp_check_filetype($location);
if ( !isset($location) || 'attachment' != $entry['post_type'] || empty($filetype['ext']) )
- $this->internal_error(__('Error ocurred while accessing post metadata for file location.'));
+ $this->internal_error(__('Error occurred while accessing post metadata for file location.'));
// delete file
@unlink($location);
@@ -749,7 +749,7 @@ EOD;
$filetype = wp_check_filetype($location);
if ( !isset($location) || 'attachment' != $entry['post_type'] || empty($filetype['ext']) )
- $this->internal_error(__('Error ocurred while accessing post metadata for file location.'));
+ $this->internal_error(__('Error occurred while accessing post metadata for file location.'));
status_header('200');
header('Content-Type: ' . $entry['post_mime_type']);
@@ -801,7 +801,7 @@ EOD;
$location = "{$upload_dir['basedir']}/{$location}";
if (!isset($location) || 'attachment' != $entry['post_type'] || empty($filetype['ext']))
- $this->internal_error(__('Error ocurred while accessing post metadata for file location.'));
+ $this->internal_error(__('Error occurred while accessing post metadata for file location.'));
$fp = fopen("php://input", "rb");
$localfp = fopen($location, "w+");
diff --git a/wp-atom.php b/wp-atom.php
index f7221f3f..a83ac7db 100644
--- a/wp-atom.php
+++ b/wp-atom.php
@@ -8,5 +8,5 @@
require( './wp-load.php' );
wp_redirect( get_bloginfo( 'atom_url' ), 301 );
-
-?>
\ No newline at end of file
+exit;
+?>
diff --git a/wp-comments-post.php b/wp-comments-post.php
index e2e12f76..9c17a355 100644
--- a/wp-comments-post.php
+++ b/wp-comments-post.php
@@ -101,5 +101,5 @@ $location = empty($_POST['redirect_to']) ? get_comment_link($comment_id) : $_POS
$location = apply_filters('comment_post_redirect', $location, $comment);
wp_redirect($location);
-
+exit;
?>
diff --git a/wp-commentsrss2.php b/wp-commentsrss2.php
index 1c146b14..280766ed 100644
--- a/wp-commentsrss2.php
+++ b/wp-commentsrss2.php
@@ -8,5 +8,5 @@
require( './wp-load.php' );
wp_redirect( get_bloginfo( 'comments_rss2_url' ), 301 );
-
-?>
\ No newline at end of file
+exit;
+?>
diff --git a/wp-config-sample.php b/wp-config-sample.php
index 69cd75e5..e47e1b5a 100644
--- a/wp-config-sample.php
+++ b/wp-config-sample.php
@@ -64,12 +64,12 @@ $table_prefix = 'wp_';
/**
* WordPress Localized Language, defaults to English.
*
- * Change this to localize WordPress. A corresponding MO file for the chosen
+ * Change this to localize WordPress. A corresponding MO file for the chosen
* language must be installed to wp-content/languages. For example, install
- * de.mo to wp-content/languages and set WPLANG to 'de' to enable German
+ * de_DE.mo to wp-content/languages and set WPLANG to 'de_DE' to enable German
* language support.
*/
-define ('WPLANG', '');
+define('WPLANG', '');
/**
* For developers: WordPress debugging mode.
diff --git a/wp-content/plugins/akismet/admin.php b/wp-content/plugins/akismet/admin.php
index a1954039..91cedb29 100644
--- a/wp-content/plugins/akismet/admin.php
+++ b/wp-content/plugins/akismet/admin.php
@@ -7,11 +7,11 @@ function akismet_admin_init() {
global $wp_version;
// all admin functions are disabled in old versions
- if ( version_compare( $wp_version, '3.0', '<' ) ) {
+ if ( !function_exists('is_multisite') && version_compare( $wp_version, '3.0', '<' ) ) {
function akismet_version_warning() {
echo "
-
+
";
}
add_action('admin_notices', 'akismet_version_warning');
@@ -24,7 +24,11 @@ function akismet_admin_init() {
else
$hook = 'dashboard_page_akismet-stats-display';
add_action('admin_head-'.$hook, 'akismet_stats_script');
- add_meta_box('akismet-status', __('Akismet Status'), 'akismet_comment_status_meta_box', 'comment', 'normal');
+ add_meta_box('akismet-status', __('Comment History'), 'akismet_comment_status_meta_box', 'comment', 'normal');
+ wp_register_style('akismet.css', AKISMET_PLUGIN_URL . 'akismet.css');
+ wp_enqueue_style('akismet.css');
+ wp_register_script('akismet.js', AKISMET_PLUGIN_URL . 'akismet.js', array('jquery'));
+ wp_enqueue_script('akismet.js');
}
add_action('admin_init', 'akismet_admin_init');
@@ -34,9 +38,18 @@ $akismet_nonce = 'akismet-update-key';
function akismet_config_page() {
if ( function_exists('add_submenu_page') )
add_submenu_page('plugins.php', __('Akismet Configuration'), __('Akismet Configuration'), 'manage_options', 'akismet-key-config', 'akismet_conf');
+}
+
+function akismet_plugin_action_links( $links, $file ) {
+ if ( $file == plugin_basename( dirname(__FILE__).'/akismet.php' ) ) {
+ $links[] = '
'.__('Settings').' ';
+ }
+ return $links;
}
+add_filter( 'plugin_action_links', 'akismet_plugin_action_links', 10, 2 );
+
function akismet_conf() {
global $akismet_nonce, $wpcom_api_key;
@@ -46,11 +59,15 @@ function akismet_conf() {
check_admin_referer( $akismet_nonce );
$key = preg_replace( '/[^a-h0-9]/i', '', $_POST['key'] );
+ $home_url = parse_url( get_bloginfo('url') );
if ( empty($key) ) {
$key_status = 'empty';
$ms[] = 'new_key_empty';
delete_option('wordpress_api_key');
+ } elseif ( empty($home_url['host']) ) {
+ $key_status = 'empty';
+ $ms[] = 'bad_home_url';
} else {
$key_status = akismet_verify_key( $key );
}
@@ -68,6 +85,12 @@ function akismet_conf() {
update_option( 'akismet_discard_month', 'true' );
else
update_option( 'akismet_discard_month', 'false' );
+
+ if ( isset( $_POST['akismet_show_user_comments_approved'] ) )
+ update_option( 'akismet_show_user_comments_approved', 'true' );
+ else
+ update_option( 'akismet_show_user_comments_approved', 'false' );
+
} elseif ( isset($_POST['check']) ) {
akismet_get_server_connectivity(0);
}
@@ -97,19 +120,24 @@ function akismet_conf() {
$messages = array(
'new_key_empty' => array('color' => 'aa0', 'text' => __('Your key has been cleared.')),
- 'new_key_valid' => array('color' => '2d2', 'text' => __('Your key has been verified. Happy blogging!')),
- 'new_key_invalid' => array('color' => 'd22', 'text' => __('The key you entered is invalid. Please double-check it.')),
- 'new_key_failed' => array('color' => 'd22', 'text' => __('The key you entered could not be verified because a connection to akismet.com could not be established. Please check your server configuration.')),
- 'no_connection' => array('color' => 'd22', 'text' => __('There was a problem connecting to the Akismet server. Please check your server configuration.')),
+ 'new_key_valid' => array('color' => '4AB915', 'text' => __('Your key has been verified. Happy blogging!')),
+ 'new_key_invalid' => array('color' => '888', 'text' => __('The key you entered is invalid. Please double-check it.')),
+ 'new_key_failed' => array('color' => '888', 'text' => __('The key you entered could not be verified because a connection to akismet.com could not be established. Please check your server configuration.')),
+ 'no_connection' => array('color' => '888', 'text' => __('There was a problem connecting to the Akismet server. Please check your server configuration.')),
'key_empty' => array('color' => 'aa0', 'text' => sprintf(__('Please enter an API key. (
Get your key. )'), 'http://akismet.com/get/')),
- 'key_valid' => array('color' => '2d2', 'text' => __('This key is valid.')),
- 'key_failed' => array('color' => 'aa0', 'text' => __('The key below was previously validated but a connection to akismet.com can not be established at this time. Please check your server configuration.')));
+ 'key_valid' => array('color' => '4AB915', 'text' => __('This key is valid.')),
+ 'key_failed' => array('color' => 'aa0', 'text' => __('The key below was previously validated but a connection to akismet.com can not be established at this time. Please check your server configuration.')),
+ 'bad_home_url' => array('color' => '888', 'text' => sprintf( __('Your WordPress home URL %s is invalid. Please fix the
home option .'), esc_html( get_bloginfo('url') ), admin_url('options.php#home') ) ),
+ );
?>
+
+
Sign up success! Please check your email for your Akismet API Key and enter it below.' ); ?>
+
@@ -126,7 +154,8 @@ function akismet_conf() {
- />
+ />
+ />
@@ -136,7 +165,7 @@ function akismet_conf() {
-
+
fsockopen or gethostbynamel
functions. Akismet cannot work correctly until this is fixed. Please contact your web host or firewall administrator and give them this information about Akismet\'s system requirements .'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?>
0 ) { ?>
-
+
Akismet cannot work correctly until this is fixed. Please contact your web host or firewall administrator and give them this information about Akismet and firewalls .'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?>
-
+
-
+
Akismet cannot work correctly until this is fixed. Please contact your web host or firewall administrator and give them this information about Akismet and firewalls .'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?>
$status ) {
- $color = ( $status ? '#2d2' : '#d22');
+ $color = ( $status ? '#4AB915' : '#888');
?>
-
+
+ Click here to confirm that Akismet.com is up .'), 'http://status.automattic.com/9931/136079/Akismet-API', 'http://status.automattic.com/9931/136079/Akismet-API' ); ?>
@@ -206,11 +236,8 @@ function akismet_stats_script() {
?>
-
-
-
- '.__('Spam').'';
- global $submenu;
- if ( isset( $submenu['edit-comments.php'] ) )
- $link = 'edit-comments.php';
- else
- $link = 'edit.php';
- echo ''.sprintf(__('Akismet has protected your site from %3$s spam comments .'), 'http://akismet.com/', clean_url("$link?page=akismet-admin"), number_format_i18n($count) ).'
';
-}
-add_action('activity_box_end', 'akismet_stats');
-
function akismet_get_key() {
global $wpcom_api_key;
if ( !empty($wpcom_api_key) )
@@ -316,104 +81,11 @@ function akismet_verify_key( $key, $ip = null ) {
return $response[1];
}
-// Check connectivity between the WordPress blog and Akismet's servers.
-// Returns an associative array of server IP addresses, where the key is the IP address, and value is true (available) or false (unable to connect).
-function akismet_check_server_connectivity() {
- global $akismet_api_host, $akismet_api_port, $wpcom_api_key;
-
- $test_host = 'rest.akismet.com';
-
- // Some web hosts may disable one or both functions
- if ( !function_exists('fsockopen') || !function_exists('gethostbynamel') )
- return array();
-
- $ips = gethostbynamel($test_host);
- if ( !$ips || !is_array($ips) || !count($ips) )
- return array();
-
- $servers = array();
- foreach ( $ips as $ip ) {
- $response = akismet_verify_key( akismet_get_key(), $ip );
- // even if the key is invalid, at least we know we have connectivity
- if ( $response == 'valid' || $response == 'invalid' )
- $servers[$ip] = true;
- else
- $servers[$ip] = false;
- }
-
- return $servers;
-}
-
-// Check the server connectivity and store the results in an option.
-// Cached results will be used if not older than the specified timeout in seconds; use $cache_timeout = 0 to force an update.
-// Returns the same associative array as akismet_check_server_connectivity()
-function akismet_get_server_connectivity( $cache_timeout = 86400 ) {
- $servers = get_option('akismet_available_servers');
- if ( (time() - get_option('akismet_connectivity_time') < $cache_timeout) && $servers !== false )
- return $servers;
-
- // There's a race condition here but the effect is harmless.
- $servers = akismet_check_server_connectivity();
- update_option('akismet_available_servers', $servers);
- update_option('akismet_connectivity_time', time());
- return $servers;
-}
-
-// Returns true if server connectivity was OK at the last check, false if there was a problem that needs to be fixed.
-function akismet_server_connectivity_ok() {
- // skip the check on WPMU because the status page is hidden
- global $wpcom_api_key;
- if ( $wpcom_api_key )
+// if we're in debug or test modes, use a reduced service level so as not to polute training or stats data
+function akismet_test_mode() {
+ if ( defined('AKISMET_TEST_MODE') && AKISMET_TEST_MODE )
return true;
- $servers = akismet_get_server_connectivity();
- return !( empty($servers) || !count($servers) || count( array_filter($servers) ) < count($servers) );
-}
-
-function akismet_admin_warnings() {
- global $wpcom_api_key;
- if ( !get_option('wordpress_api_key') && !$wpcom_api_key && !isset($_POST['submit']) ) {
- function akismet_warning() {
- echo "
- ".__('Akismet is almost ready.')." ".sprintf(__('You must enter your Akismet API key for it to work.'), "plugins.php?page=akismet-key-config")."
- ";
- }
- add_action('admin_notices', 'akismet_warning');
- return;
- } elseif ( get_option('akismet_connectivity_time') && empty($_POST) && is_admin() && !akismet_server_connectivity_ok() ) {
- function akismet_warning() {
- echo "
- ".__('Akismet has detected a problem.')." ".sprintf(__('A server or network problem is preventing Akismet from working correctly. Click here for more information about how to fix the problem.'), "plugins.php?page=akismet-key-config")."
- ";
- }
- add_action('admin_notices', 'akismet_warning');
- return;
- }
-}
-
-function akismet_get_host($host) {
- // if all servers are accessible, just return the host name.
- // if not, return an IP that was known to be accessible at the last check.
- if ( akismet_server_connectivity_ok() ) {
- return $host;
- } else {
- $ips = akismet_get_server_connectivity();
- // a firewall may be blocking access to some Akismet IPs
- if ( count($ips) > 0 && count(array_filter($ips)) < count($ips) ) {
- // use DNS to get current IPs, but exclude any known to be unreachable
- $dns = (array)gethostbynamel( rtrim($host, '.') . '.' );
- $dns = array_filter($dns);
- foreach ( $dns as $ip ) {
- if ( array_key_exists( $ip, $ips ) && empty( $ips[$ip] ) )
- unset($dns[$ip]);
- }
- // return a random IP from those available
- if ( count($dns) )
- return $dns[ array_rand($dns) ];
-
- }
- }
- // if all else fails try the host name
- return $host;
+ return false;
}
// return a comma-separated list of role names for the given user
@@ -428,42 +100,76 @@ function akismet_get_user_roles($user_id ) {
if ( isset($comment_user->roles) )
$roles = join(',', $comment_user->roles);
}
-
+
+ if ( is_multisite() && is_super_admin( $user_id ) ) {
+ if ( empty( $roles ) ) {
+ $roles = 'super_admin';
+ } else {
+ $comment_user->roles[] = 'super_admin';
+ $roles = join( ',', $comment_user->roles );
+ }
+ }
+
return $roles;
}
// Returns array with headers in $response[0] and body in $response[1]
function akismet_http_post($request, $host, $path, $port = 80, $ip=null) {
global $wp_version;
-
- $akismet_version = constant('AKISMET_VERSION');
-
- $http_request = "POST $path HTTP/1.0\r\n";
- $http_request .= "Host: $host\r\n";
- $http_request .= "Content-Type: application/x-www-form-urlencoded; charset=" . get_option('blog_charset') . "\r\n";
- $http_request .= "Content-Length: " . strlen($request) . "\r\n";
- $http_request .= "User-Agent: WordPress/$wp_version | Akismet/$akismet_version\r\n";
- $http_request .= "\r\n";
- $http_request .= $request;
-
+
+ $akismet_ua = "WordPress/{$wp_version} | ";
+ $akismet_ua .= 'Akismet/' . constant( 'AKISMET_VERSION' );
+
+ $content_length = strlen( $request );
+
$http_host = $host;
- // use a specific IP if provided - needed by akismet_check_server_connectivity()
- if ( $ip && long2ip(ip2long($ip)) ) {
+ // use a specific IP if provided
+ // needed by akismet_check_server_connectivity()
+ if ( $ip && long2ip( ip2long( $ip ) ) ) {
$http_host = $ip;
} else {
- $http_host = akismet_get_host($host);
+ $http_host = $host;
}
-
- $response = '';
- if( false != ( $fs = @fsockopen($http_host, $port, $errno, $errstr, 10) ) ) {
- fwrite($fs, $http_request);
-
- while ( !feof($fs) )
- $response .= fgets($fs, 1160); // One TCP-IP packet
- fclose($fs);
- $response = explode("\r\n\r\n", $response, 2);
+
+ // use the WP HTTP class if it is available
+ if ( function_exists( 'wp_remote_post' ) ) {
+ $http_args = array(
+ 'body' => $request,
+ 'headers' => array(
+ 'Content-Type' => 'application/x-www-form-urlencoded; ' .
+ 'charset=' . get_option( 'blog_charset' ),
+ 'Host' => $host,
+ 'User-Agent' => $akismet_ua
+ ),
+ 'httpversion' => '1.0',
+ 'timeout' => 15
+ );
+ $akismet_url = "http://{$http_host}{$path}";
+ $response = wp_remote_post( $akismet_url, $http_args );
+ if ( is_wp_error( $response ) )
+ return '';
+
+ return array( $response['headers'], $response['body'] );
+ } else {
+ $http_request = "POST $path HTTP/1.0\r\n";
+ $http_request .= "Host: $host\r\n";
+ $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset=' . get_option('blog_charset') . "\r\n";
+ $http_request .= "Content-Length: {$content_length}\r\n";
+ $http_request .= "User-Agent: {$akismet_ua}\r\n";
+ $http_request .= "\r\n";
+ $http_request .= $request;
+
+ $response = '';
+ if( false != ( $fs = @fsockopen( $http_host, $port, $errno, $errstr, 10 ) ) ) {
+ fwrite( $fs, $http_request );
+
+ while ( !feof( $fs ) )
+ $response .= fgets( $fs, 1160 ); // One TCP-IP packet
+ fclose( $fs );
+ $response = explode( "\r\n\r\n", $response, 2 );
+ }
+ return $response;
}
- return $response;
}
// filter handler used to return a spam result to pre_comment_approved
@@ -471,11 +177,122 @@ function akismet_result_spam( $approved ) {
// bump the counter here instead of when the filter is added to reduce the possibility of overcounting
if ( $incr = apply_filters('akismet_spam_count_incr', 1) )
update_option( 'akismet_spam_count', get_option('akismet_spam_count') + $incr );
+ // this is a one-shot deal
+ remove_filter( 'pre_comment_approved', 'akismet_result_spam' );
return 'spam';
}
+function akismet_result_hold( $approved ) {
+ // once only
+ remove_filter( 'pre_comment_approved', 'akismet_result_hold' );
+ return '0';
+}
+
+// how many approved comments does this author have?
+function akismet_get_user_comments_approved( $user_id, $comment_author_email, $comment_author, $comment_author_url ) {
+ global $wpdb;
+
+ if ( !empty($user_id) )
+ return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->comments WHERE user_id = %d AND comment_approved = 1", $user_id ) );
+
+ if ( !empty($comment_author_email) )
+ return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_author_email = %s AND comment_author = %s AND comment_author_url = %s AND comment_approved = 1", $comment_author_email, $comment_author, $comment_author_url ) );
+
+ return 0;
+}
+
+function akismet_microtime() {
+ $mtime = explode( ' ', microtime() );
+ return $mtime[1] + $mtime[0];
+}
+
+// log an event for a given comment, storing it in comment_meta
+function akismet_update_comment_history( $comment_id, $message, $event=null ) {
+ global $current_user;
+
+ // failsafe for old WP versions
+ if ( !function_exists('add_comment_meta') )
+ return false;
+
+ $user = '';
+ if ( is_object($current_user) && isset($current_user->user_login) )
+ $user = $current_user->user_login;
+
+ $event = array(
+ 'time' => akismet_microtime(),
+ 'message' => $message,
+ 'event' => $event,
+ 'user' => $user,
+ );
+
+ // $unique = false so as to allow multiple values per comment
+ $r = add_comment_meta( $comment_id, 'akismet_history', $event, false );
+}
+
+// get the full comment history for a given comment, as an array in reverse chronological order
+function akismet_get_comment_history( $comment_id ) {
+
+ // failsafe for old WP versions
+ if ( !function_exists('add_comment_meta') )
+ return false;
+
+ $history = get_comment_meta( $comment_id, 'akismet_history', false );
+ usort( $history, 'akismet_cmp_time' );
+ return $history;
+}
+
+function akismet_cmp_time( $a, $b ) {
+ return $a['time'] > $b['time'] ? -1 : 1;
+}
+
+// this fires on wp_insert_comment. we can't update comment_meta when akismet_auto_check_comment() runs
+// because we don't know the comment ID at that point.
+function akismet_auto_check_update_meta( $id, $comment ) {
+ global $akismet_last_comment;
+
+ // failsafe for old WP versions
+ if ( !function_exists('add_comment_meta') )
+ return false;
+
+ // wp_insert_comment() might be called in other contexts, so make sure this is the same comment
+ // as was checked by akismet_auto_check_comment
+ if ( is_object($comment) && !empty($akismet_last_comment) && is_array($akismet_last_comment) ) {
+ if ( intval($akismet_last_comment['comment_post_ID']) == intval($comment->comment_post_ID)
+ && $akismet_last_comment['comment_author'] == $comment->comment_author
+ && $akismet_last_comment['comment_author_email'] == $comment->comment_author_email ) {
+ // normal result: true or false
+ if ( $akismet_last_comment['akismet_result'] == 'true' ) {
+ update_comment_meta( $comment->comment_ID, 'akismet_result', 'true' );
+ akismet_update_comment_history( $comment->comment_ID, __('Akismet caught this comment as spam'), 'check-spam' );
+ if ( $comment->comment_approved != 'spam' )
+ akismet_update_comment_history( $comment->comment_ID, sprintf( __('Comment status was changed to %s'), $comment->comment_approved), 'status-changed'.$comment->comment_approved );
+ } elseif ( $akismet_last_comment['akismet_result'] == 'false' ) {
+ update_comment_meta( $comment->comment_ID, 'akismet_result', 'false' );
+ akismet_update_comment_history( $comment->comment_ID, __('Akismet cleared this comment'), 'check-ham' );
+ if ( $comment->comment_approved == 'spam' ) {
+ if ( wp_blacklist_check($comment->comment_author, $comment->comment_author_email, $comment->comment_author_url, $comment->comment_content, $comment->comment_author_IP, $comment->comment_agent) )
+ akismet_update_comment_history( $comment->comment_ID, __('Comment was caught by wp_blacklist_check'), 'wp-blacklisted' );
+ else
+ akismet_update_comment_history( $comment->comment_ID, sprintf( __('Comment status was changed to %s'), $comment->comment_approved), 'status-changed-'.$comment->comment_approved );
+ }
+ // abnormal result: error
+ } else {
+ update_comment_meta( $comment->comment_ID, 'akismet_error', time() );
+ akismet_update_comment_history( $comment->comment_ID, sprintf( __('Akismet was unable to check this comment (response: %s), will automatically retry again later.'), $akismet_last_comment['akismet_result']), 'check-error' );
+ }
+
+ // record the complete original data as submitted for checking
+ if ( isset($akismet_last_comment['comment_as_submitted']) )
+ update_comment_meta( $comment->comment_ID, 'akismet_as_submitted', $akismet_last_comment['comment_as_submitted'] );
+ }
+ }
+}
+
+add_action( 'wp_insert_comment', 'akismet_auto_check_update_meta', 10, 2 );
+
+
function akismet_auto_check_comment( $commentdata ) {
- global $akismet_api_host, $akismet_api_port;
+ global $akismet_api_host, $akismet_api_port, $akismet_last_comment;
$comment = $commentdata;
$comment['user_ip'] = $_SERVER['REMOTE_ADDR'];
@@ -488,17 +305,41 @@ function akismet_auto_check_comment( $commentdata ) {
$comment['user_role'] = akismet_get_user_roles($comment['user_ID']);
+ $akismet_nonce_option = apply_filters( 'akismet_comment_nonce', get_option( 'akismet_comment_nonce' ) );
+ $comment['akismet_comment_nonce'] = 'inactive';
+ if ( $akismet_nonce_option == 'true' || $akismet_nonce_option == '' ) {
+ $comment['akismet_comment_nonce'] = 'failed';
+ if ( isset( $_POST['akismet_comment_nonce'] ) && wp_verify_nonce( $_POST['akismet_comment_nonce'], 'akismet_comment_nonce_' . $comment['comment_post_ID'] ) )
+ $comment['akismet_comment_nonce'] = 'passed';
+
+ // comment reply in wp-admin
+ if ( isset( $_POST['_ajax_nonce-replyto-comment'] ) && check_ajax_referer( 'replyto-comment', '_ajax_nonce-replyto-comment' ) )
+ $comment['akismet_comment_nonce'] = 'passed';
+
+ }
+
+ if ( akismet_test_mode() )
+ $comment['is_test'] = 'true';
+
+ foreach ($_POST as $key => $value ) {
+ if ( is_string($value) )
+ $comment["POST_{$key}"] = $value;
+ }
+
$ignore = array( 'HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW' );
- foreach ( $_SERVER as $key => $value )
+ foreach ( $_SERVER as $key => $value ) {
if ( !in_array( $key, $ignore ) && is_string($value) )
$comment["$key"] = $value;
else
$comment["$key"] = '';
+ }
$query_string = '';
foreach ( $comment as $key => $data )
$query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&';
+
+ $commentdata['comment_as_submitted'] = $comment;
$response = akismet_http_post($query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port);
$commentdata['akismet_result'] = $response[1];
@@ -517,10 +358,17 @@ function akismet_auto_check_comment( $commentdata ) {
// akismet_result_spam() won't be called so bump the counter here
if ( $incr = apply_filters('akismet_spam_count_incr', 1) )
update_option( 'akismet_spam_count', get_option('akismet_spam_count') + $incr );
- die;
+ wp_redirect( $_SERVER['HTTP_REFERER'] );
+ die();
}
}
+ // if the response is neither true nor false, hold the comment for moderation and schedule a recheck
+ if ( 'true' != $response[1] && 'false' != $response[1] ) {
+ add_filter('pre_comment_approved', 'akismet_result_hold');
+ wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' );
+ }
+
if ( function_exists('wp_next_scheduled') && function_exists('wp_schedule_event') ) {
// WP 2.1+: delete old comments daily
if ( !wp_next_scheduled('akismet_scheduled_delete') )
@@ -529,18 +377,25 @@ function akismet_auto_check_comment( $commentdata ) {
// WP 2.0: run this one time in ten
akismet_delete_old();
}
+ $akismet_last_comment = $commentdata;
return $commentdata;
}
+add_action('preprocess_comment', 'akismet_auto_check_comment', 1);
+
function akismet_delete_old() {
global $wpdb;
$now_gmt = current_time('mysql', 1);
$comment_ids = $wpdb->get_col("SELECT comment_id FROM $wpdb->comments WHERE DATE_SUB('$now_gmt', INTERVAL 15 DAY) > comment_date_gmt AND comment_approved = 'spam'");
if ( empty( $comment_ids ) )
return;
+
+ $comma_comment_ids = implode( ', ', array_map('intval', $comment_ids) );
do_action( 'delete_comment', $comment_ids );
- $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_id IN ( " . implode( ', ', $comment_ids ) . " )");
+ $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_id IN ( $comma_comment_ids )");
+ $wpdb->query("DELETE FROM $wpdb->commentmeta WHERE comment_id IN ( $comma_comment_ids )");
+ clean_comment_cache( $comment_ids );
$n = mt_rand(1, 5000);
if ( apply_filters('akismet_optimize_table', ($n == 11)) ) // lucky number
$wpdb->query("OPTIMIZE TABLE $wpdb->comments");
@@ -549,341 +404,109 @@ function akismet_delete_old() {
add_action('akismet_scheduled_delete', 'akismet_delete_old');
-function akismet_submit_nonspam_comment ( $comment_id ) {
- global $wpdb, $akismet_api_host, $akismet_api_port, $current_user, $current_site;
- $comment_id = (int) $comment_id;
+function akismet_check_db_comment( $id, $recheck_reason = 'recheck_queue' ) {
+ global $wpdb, $akismet_api_host, $akismet_api_port;
- $comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment_id'");
- if ( !$comment ) // it was deleted
- return;
- $comment->blog = get_option('home');
- $comment->blog_lang = get_locale();
- $comment->blog_charset = get_option('blog_charset');
- $comment->permalink = get_permalink($comment->comment_post_ID);
- if ( is_object($current_user) ) {
- $comment->reporter = $current_user->user_login;
- }
- if ( is_object($current_site) ) {
- $comment->site_domain = $current_site->domain;
- }
-
- $comment->user_role = '';
- if ( isset( $comment->user_ID ) )
- $comment->user_role = akismet_get_user_roles($comment->user_ID);
-
- $query_string = '';
- foreach ( $comment as $key => $data )
- $query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&';
-
- $response = akismet_http_post($query_string, $akismet_api_host, "/1.1/submit-ham", $akismet_api_port);
- do_action('akismet_submit_nonspam_comment', $comment_id, $response[1]);
-}
-
-function akismet_submit_spam_comment ( $comment_id ) {
- global $wpdb, $akismet_api_host, $akismet_api_port, $current_user, $current_site;
- $comment_id = (int) $comment_id;
-
- $comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment_id'");
- if ( !$comment ) // it was deleted
- return;
- if ( 'spam' != $comment->comment_approved )
- return;
- $comment->blog = get_option('home');
- $comment->blog_lang = get_locale();
- $comment->blog_charset = get_option('blog_charset');
- $comment->permalink = get_permalink($comment->comment_post_ID);
- if ( is_object($current_user) ) {
- $comment->reporter = $current_user->user_login;
- }
- if ( is_object($current_site) ) {
- $comment->site_domain = $current_site->domain;
- }
-
- $comment->user_role = '';
- if ( !isset( $comment->user_id ) )
- $comment->user_role = akismet_get_user_roles($comment->user_ID);
+ $id = (int) $id;
+ $c = $wpdb->get_row( "SELECT * FROM $wpdb->comments WHERE comment_ID = '$id'", ARRAY_A );
+ if ( !$c )
+ return;
- $query_string = '';
- foreach ( $comment as $key => $data )
- $query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&';
-
- $response = akismet_http_post($query_string, $akismet_api_host, "/1.1/submit-spam", $akismet_api_port);
- do_action('akismet_submit_spam_comment', $comment_id, $response[1]);
-}
+ $c['user_ip'] = $c['comment_author_IP'];
+ $c['user_agent'] = $c['comment_agent'];
+ $c['referrer'] = '';
+ $c['blog'] = get_option('home');
+ $c['blog_lang'] = get_locale();
+ $c['blog_charset'] = get_option('blog_charset');
+ $c['permalink'] = get_permalink($c['comment_post_ID']);
+ $id = $c['comment_ID'];
+ if ( akismet_test_mode() )
+ $c['is_test'] = 'true';
+ $c['recheck_reason'] = $recheck_reason;
-add_action('preprocess_comment', 'akismet_auto_check_comment', 1);
+ $query_string = '';
+ foreach ( $c as $key => $data )
+ $query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&';
-// For old versions of WP only
-function akismet_set_comment_status( $comment_id, $status ) {
- if ( $status == 'spam' ) {
- akismet_submit_spam_comment( $comment_id );
- } elseif ( $status == 'approve' ) {
- akismet_submit_nonspam_comment( $comment_id );
- }
+ $response = akismet_http_post($query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port);
+ return $response[1];
}
-// For WP 2.7+
-function akismet_transition_comment_status( $new_status, $old_status, $comment ) {
- if ( $new_status == $old_status )
- return;
-
- if ( $new_status == 'spam' ) {
- akismet_submit_spam_comment( $comment->comment_ID );
- } elseif ( $old_status == 'spam' && ( $new_status == 'approved' || $new_status == 'unapproved' ) ) {
- akismet_submit_nonspam_comment( $comment->comment_ID );
- }
-}
-
-function akismet_spamtoham( $comment ) { akismet_submit_nonspam_comment( $comment->comment_ID ); }
-
-if ( function_exists( 'wp_transition_comment_status' ) ) {
- add_action( 'transition_comment_status', 'akismet_transition_comment_status', 10, 3 );
-} else {
- add_action('wp_set_comment_status', 'akismet_set_comment_status', 10, 2);
- add_action('edit_comment', 'akismet_submit_spam_comment');
- add_filter( 'comment_spam_to_approved', 'akismet_spamtoham' );
- add_filter( 'comment_spam_to_unapproved', 'akismet_spamtoham' );
-}
-// Total spam in queue
-// get_option( 'akismet_spam_count' ) is the total caught ever
-function akismet_spam_count( $type = false ) {
+function akismet_cron_recheck() {
global $wpdb;
- if ( !$type ) { // total
- $count = wp_cache_get( 'akismet_spam_count', 'widget' );
- if ( false === $count ) {
- if ( function_exists('wp_count_comments') ) {
- $count = wp_count_comments();
- $count = $count->spam;
- } else {
- $count = (int) $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_approved = 'spam'");
+ delete_option('akismet_available_servers');
+
+ $comment_errors = $wpdb->get_col( "
+ SELECT comment_id
+ FROM {$wpdb->prefix}commentmeta
+ WHERE meta_key = 'akismet_error'
+ LIMIT 100
+ " );
+
+ foreach ( (array) $comment_errors as $comment_id ) {
+ // if the comment no longer exists, remove the meta entry from the queue to avoid getting stuck
+ if ( !get_comment( $comment_id ) ) {
+ delete_comment_meta( $comment_id, 'akismet_error' );
+ continue;
+ }
+
+ add_comment_meta( $comment_id, 'akismet_rechecking', true );
+ $status = akismet_check_db_comment( $comment_id, 'retry' );
+
+ $msg = '';
+ if ( $status == 'true' ) {
+ $msg = __( 'Akismet caught this comment as spam during an automatic retry.' );
+ } elseif ( $status == 'false' ) {
+ $msg = __( 'Akismet cleared this comment during an automatic retry.' );
+ }
+
+ // If we got back a legit response then update the comment history
+ // other wise just bail now and try again later. No point in
+ // re-trying all the comments once we hit one failure.
+ if ( !empty( $msg ) ) {
+ delete_comment_meta( $comment_id, 'akismet_error' );
+ akismet_update_comment_history( $comment_id, $msg, 'cron-retry' );
+ update_comment_meta( $comment_id, 'akismet_result', $status );
+ // make sure the comment status is still pending. if it isn't, that means the user has already moved it elsewhere.
+ $comment = get_comment( $comment_id );
+ if ( $comment && 'unapproved' == wp_get_comment_status( $comment_id ) ) {
+ if ( $status == 'true' ) {
+ wp_spam_comment( $comment_id );
+ } elseif ( $status == 'false' ) {
+ // comment is good, but it's still in the pending queue. depending on the moderation settings
+ // we may need to change it to approved.
+ if ( check_comment($comment->comment_author, $comment->comment_author_email, $comment->comment_author_url, $comment->comment_content, $comment->comment_author_IP, $comment->comment_agent, $comment->comment_type) )
+ wp_set_comment_status( $comment_id, 1 );
+ }
}
- wp_cache_set( 'akismet_spam_count', $count, 'widget', 3600 );
+ } else {
+ delete_comment_meta( $comment_id, 'akismet_rechecking' );
+ wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' );
+ return;
}
- return $count;
- } elseif ( 'comments' == $type || 'comment' == $type ) { // comments
- $type = '';
- } else { // pingback, trackback, ...
- $type = $wpdb->escape( $type );
- }
-
- return (int) $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_approved = 'spam' AND comment_type='$type'");
-}
-
-
-// WP 2.5+
-function akismet_rightnow() {
- global $submenu, $wp_db_version;
-
- // clean_url was deprecated in WP 3.0
- $esc_url = 'clean_url';
- if ( function_exists( 'esc_url' ) )
- $esc_url = 'esc_url';
-
- if ( 8645 < $wp_db_version ) // 2.7
- $link = 'edit-comments.php?comment_status=spam';
- elseif ( isset( $submenu['edit-comments.php'] ) )
- $link = 'edit-comments.php?page=akismet-admin';
- else
- $link = 'edit.php?page=akismet-admin';
-
- if ( $count = get_option('akismet_spam_count') ) {
- $intro = sprintf( __ngettext(
- 'Akismet has protected your site from %2$s spam comment already,',
- 'Akismet has protected your site from %2$s spam comments already,',
- $count
- ), 'http://akismet.com/', number_format_i18n( $count ) );
- } else {
- $intro = sprintf( __('Akismet blocks spam from getting to your blog,'), 'http://akismet.com/' );
}
-
- if ( $queue_count = akismet_spam_count() ) {
- $queue_text = sprintf( __ngettext(
- 'and there\'s %1$s comment in your spam queue right now.',
- 'and there are %1$s comments in your spam queue right now.',
- $queue_count
- ), number_format_i18n( $queue_count ), clean_url($link) );
- } else {
- $queue_text = sprintf( __( "but there's nothing in your spam queue at the moment." ), $esc_url($link) );
- }
-
- // _c was deprecated in WP 2.9.0
- if ( function_exists( '_x' ) )
- $text = sprintf( _x( '%1$s %2$s', 'akismet_rightnow' ), $intro, $queue_text );
- else
- $text = sprintf( _c( '%1$s %2$s|akismet_rightnow' ), $intro, $queue_text );
-
- echo "$text
\n";
-}
-add_action('rightnow_end', 'akismet_rightnow');
-
-
-// For WP >= 2.5
-function akismet_check_for_spam_button($comment_status) {
- if ( 'approved' == $comment_status )
- return;
- if ( function_exists('plugins_url') )
- $link = 'admin.php?action=akismet_recheck_queue';
- else
- $link = 'edit-comments.php?page=akismet-admin&recheckqueue=true&noheader=true';
- echo "" . __('Check for Spam') . " ";
-}
-add_action('manage_comments_nav', 'akismet_check_for_spam_button');
-
-function akismet_recheck_queue() {
- global $wpdb, $akismet_api_host, $akismet_api_port;
-
- if ( ! ( isset( $_GET['recheckqueue'] ) || ( isset( $_REQUEST['action'] ) && 'akismet_recheck_queue' == $_REQUEST['action'] ) ) )
- return;
-
- $moderation = $wpdb->get_results( "SELECT * FROM $wpdb->comments WHERE comment_approved = '0'", ARRAY_A );
- foreach ( (array) $moderation as $c ) {
- $c['user_ip'] = $c['comment_author_IP'];
- $c['user_agent'] = $c['comment_agent'];
- $c['referrer'] = '';
- $c['blog'] = get_option('home');
- $c['blog_lang'] = get_locale();
- $c['blog_charset'] = get_option('blog_charset');
- $c['permalink'] = get_permalink($c['comment_post_ID']);
-
- $c['user_role'] = '';
- if ( isset( $c['user_ID'] ) )
- $c['user_role'] = akismet_get_user_roles($c['user_ID']);
-
- $id = (int) $c['comment_ID'];
-
- $query_string = '';
- foreach ( $c as $key => $data )
- $query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&';
-
- $response = akismet_http_post($query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port);
- if ( 'true' == $response[1] ) {
- if ( function_exists('wp_set_comment_status') )
- wp_set_comment_status($id, 'spam');
- else
- $wpdb->query("UPDATE $wpdb->comments SET comment_approved = 'spam' WHERE comment_ID = $id");
-
- }
+ $remaining = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->commentmeta WHERE meta_key = 'akismet_error'" ) );
+ if ( $remaining && !wp_next_scheduled('akismet_schedule_cron_recheck') ) {
+ wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' );
}
- wp_redirect( $_SERVER['HTTP_REFERER'] );
- exit;
}
+add_action( 'akismet_schedule_cron_recheck', 'akismet_cron_recheck' );
-add_action('admin_action_akismet_recheck_queue', 'akismet_recheck_queue');
-
-function akismet_check_db_comment( $id ) {
- global $wpdb, $akismet_api_host, $akismet_api_port;
-
- $id = (int) $id;
- $c = $wpdb->get_row( "SELECT * FROM $wpdb->comments WHERE comment_ID = '$id'", ARRAY_A );
- if ( !$c )
- return;
-
- $c['user_ip'] = $c['comment_author_IP'];
- $c['user_agent'] = $c['comment_agent'];
- $c['referrer'] = '';
- $c['blog'] = get_option('home');
- $c['blog_lang'] = get_locale();
- $c['blog_charset'] = get_option('blog_charset');
- $c['permalink'] = get_permalink($c['comment_post_ID']);
- $id = $c['comment_ID'];
-
- $query_string = '';
- foreach ( $c as $key => $data )
- $query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&';
-
- $response = akismet_http_post($query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port);
- return $response[1];
+function akismet_add_comment_nonce( $post_id ) {
+ echo '
';
+ wp_nonce_field( 'akismet_comment_nonce_' . $post_id, 'akismet_comment_nonce', FALSE );
+ echo '
';
}
-// Widget stuff
-function widget_akismet_register() {
- if ( function_exists('register_sidebar_widget') ) :
- function widget_akismet($args) {
- extract($args);
- $options = get_option('widget_akismet');
- $count = number_format_i18n(get_option('akismet_spam_count'));
- ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/wp-content/plugins/akismet/readme.txt b/wp-content/plugins/akismet/readme.txt
index db8234fc..fbd3513b 100644
--- a/wp-content/plugins/akismet/readme.txt
+++ b/wp-content/plugins/akismet/readme.txt
@@ -1,10 +1,10 @@
=== Akismet ===
-Contributors: matt, ryan, andy, mdawaffe, tellyworth, automattic
+Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, automattic
Tags: akismet, comments, spam
-Requires at least: 2.0
-Tested up to: 3.0
-Stable tag: 2.4.0
-License: GPLv2
+Requires at least: 3.0
+Tested up to: 3.1
+Stable tag: 2.5.3
+License: GPLv2 or later
Akismet checks your comments against the Akismet web service to see if they look like spam or not.
@@ -13,11 +13,15 @@ Akismet checks your comments against the Akismet web service to see if they look
Akismet checks your comments against the Akismet web service to see if they look like spam or not and lets you
review the spam it catches under your blog's "Comments" admin screen.
-Want to show off how much spam Akismet has caught for you? Just put `` in your template.
+Major new features in Akismet 2.5 include:
-See also: [WP Stats plugin](http://wordpress.org/extend/plugins/stats/).
+* A comment status history, so you can easily see which comments were caught or cleared by Akismet, and which were spammed or unspammed by a moderator
+* Links are highlighted in the comment body, to reveal hidden or misleading links
+* If your web host is unable to reach Akismet's servers, the plugin will automatically retry when your connection is back up
+* Moderators can see the number of approved comments for each user
+* Spam and Unspam reports now include more information, to help improve accuracy
-PS: You'll need an [Akismet.com API key](http://akismet.com/get/) to use it.
+PS: You'll need an [Akismet.com API key](http://akismet.com/get/) to use it. Keys are free for personal blogs, with paid subscriptions available for businesses and commercial sites.
== Installation ==
@@ -27,6 +31,53 @@ Upload the Akismet plugin to your blog, Activate it, then enter your [Akismet.co
== Changelog ==
+= 2.5.3 =
+* Specify the license is GPL v2 or later
+* Fix a bug that could result in orphaned commentmeta entries
+* Include hotfix for WordPress 3.0.5 filter issue
+
+= 2.5.2 =
+
+* Properly format the comment count for author counts
+* Look for super admins on multisite installs when looking up user roles
+* Increase the HTTP request timeout
+* Removed padding for author approved count
+* Fix typo in function name
+* Set Akismet stats iframe height to fixed 2500px. Better to have one tall scroll bar than two side by side.
+
+= 2.5.1 =
+
+* Fix a bug that caused the "Auto delete" option to fail to discard comments correctly
+* Remove the comment nonce form field from the 'Akismet Configuration' page in favor of using a filter, akismet_comment_nonce
+* Fixed padding bug in "author" column of posts screen
+* Added margin-top to "cleared by ..." badges on dashboard
+* Fix possible error when calling akismet_cron_recheck()
+* Fix more PHP warnings
+* Clean up XHTML warnings for comment nonce
+* Fix for possible condition where scheduled comment re-checks could get stuck
+* Clean up the comment meta details after deleting a comment
+* Only show the status badge if the comment status has been changed by someone/something other than Akismet
+* Show a 'History' link in the row-actions
+* Translation fixes
+* Reduced font-size on author name
+* Moved "flagged by..." notification to top right corner of comment container and removed heavy styling
+* Hid "flagged by..." notification while on dashboard
+
+= 2.5.0 =
+
+* Track comment actions under 'Akismet Status' on the edit comment screen
+* Fix a few remaining deprecated function calls ( props Mike Glendinning )
+* Use HTTPS for the stats IFRAME when wp-admin is using HTTPS
+* Use the WordPress HTTP class if available
+* Move the admin UI code to a separate file, only loaded when needed
+* Add cron retry feature, to replace the old connectivity check
+* Display Akismet status badge beside each comment
+* Record history for each comment, and display it on the edit page
+* Record the complete comment as originally submitted in comment_meta, to use when reporting spam and ham
+* Highlight links in comment content
+* New option, "Show the number of comments you've approved beside each comment author."
+* New option, "Use a nonce on the comment form."
+
= 2.4.0 =
* Spell out that the license is GPLv2
diff --git a/wp-content/plugins/akismet/widget.php b/wp-content/plugins/akismet/widget.php
new file mode 100644
index 00000000..e9a3f626
--- /dev/null
+++ b/wp-content/plugins/akismet/widget.php
@@ -0,0 +1,90 @@
+
+
+
+
%8$sAkismet%9$s', '%1$s%2$s%3$s %4$sspam comments%5$s %6$sblocked by%7$s %8$sAkismet%9$s', $count ), '', number_format_i18n( $count ), ' ', '', ' ', '', ' ', '', ' ' ); ?>
+
+
+
+
+
+
+
+
+
', '', $count ), number_format_i18n( $count ) );
+}
diff --git a/wp-content/plugins/hello.php b/wp-content/plugins/hello.php
index 2877f083..d2287e24 100644
--- a/wp-content/plugins/hello.php
+++ b/wp-content/plugins/hello.php
@@ -1,14 +1,14 @@
Hello, Dolly in the upper right of your admin screen on every page.
Author: Matt Mullenweg
-Version: 1.5.1
+Version: 1.6
Author URI: http://ma.tt/
*/
@@ -44,10 +44,10 @@ Dolly'll never go away
Dolly'll never go away again";
// Here we split it into lines
- $lyrics = explode("\n", $lyrics);
+ $lyrics = explode( "\n", $lyrics );
// And then randomly choose a line
- return wptexturize( $lyrics[ mt_rand(0, count($lyrics) - 1) ] );
+ return wptexturize( $lyrics[ mt_rand( 0, count( $lyrics ) - 1 ) ] );
}
// This just echoes the chosen line, we'll position it later
@@ -56,28 +56,27 @@ function hello_dolly() {
echo "$chosen
";
}
-// Now we set that function up to execute when the admin_footer action is called
-add_action('admin_footer', 'hello_dolly');
+// Now we set that function up to execute when the admin_notices action is called
+add_action( 'admin_notices', 'hello_dolly' );
// We need some CSS to position the paragraph
function dolly_css() {
- // This makes sure that the posinioning is also good for right-to-left languages
- $x = ( is_rtl() ) ? 'left' : 'right';
+ // This makes sure that the positioning is also good for right-to-left languages
+ $x = is_rtl() ? 'left' : 'right';
echo "
";
}
-add_action('admin_head', 'dolly_css');
+add_action( 'admin_head', 'dolly_css' );
?>
diff --git a/wp-content/themes/twentyten/archive.php b/wp-content/themes/twentyten/archive.php
index 52baaa70..0707e186 100644
--- a/wp-content/themes/twentyten/archive.php
+++ b/wp-content/themes/twentyten/archive.php
@@ -32,9 +32,9 @@ get_header(); ?>
%s', 'twentyten' ), get_the_date() ); ?>
- %s', 'twentyten' ), get_the_date('F Y') ); ?>
+ %s', 'twentyten' ), get_the_date( 'F Y' ) ); ?>
- %s', 'twentyten' ), get_the_date('Y') ); ?>
+ %s', 'twentyten' ), get_the_date( 'Y' ) ); ?>
@@ -49,7 +49,7 @@ get_header(); ?>
/* Run the loop for the archives page to output the posts.
* If you want to overload this in a child theme then include a file
- * called loop-archives.php and that will be used instead.
+ * called loop-archive.php and that will be used instead.
*/
get_template_part( 'loop', 'archive' );
?>
diff --git a/wp-content/themes/twentyten/attachment.php b/wp-content/themes/twentyten/attachment.php
index f805bcdb..5b35936e 100644
--- a/wp-content/themes/twentyten/attachment.php
+++ b/wp-content/themes/twentyten/attachment.php
@@ -12,105 +12,13 @@ get_header(); ?>
-
-
- post_parent ) ) : ?>
-
← %s', 'twentyten' ), get_the_title( $post->post_parent ) );
- ?>
-
-
-
>
-
-
-
- By %2$s', 'twentyten'),
- 'meta-prep meta-prep-author',
- sprintf( '
%3$s ',
- get_author_posts_url( get_the_author_meta( 'ID' ) ),
- sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ),
- get_the_author()
- )
- );
- ?>
-
|
- Published %2$s', 'twentyten'),
- 'meta-prep meta-prep-entry-date',
- sprintf( '
%2$s ',
- esc_attr( get_the_time() ),
- get_the_date()
- )
- );
- if ( wp_attachment_is_image() ) {
- echo '
| ';
- $metadata = wp_get_attachment_metadata();
- printf( __( 'Full size is %s pixels', 'twentyten'),
- sprintf( '
%3$s × %4$s ',
- wp_get_attachment_url(),
- esc_attr( __('Link to full-size image', 'twentyten') ),
- $metadata['width'],
- $metadata['height']
- )
- );
- }
- ?>
- |
', ' ' ); ?>
-
-
-
-
- $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID' ) ) );
- foreach ( $attachments as $k => $attachment ) {
- if ( $attachment->ID == $post->ID )
- break;
- }
- $k++;
- // If there is more than 1 image attachment in a gallery
- if ( count( $attachments ) > 1 ) {
- if ( isset( $attachments[ $k ] ) )
- // get the URL of the next image attachment
- $next_attachment_url = get_attachment_link( $attachments[ $k ]->ID );
- else
- // or get the URL of the first image attachment
- $next_attachment_url = get_attachment_link( $attachments[ 0 ]->ID );
- } else {
- // or, if there's only 1 image attachment, get the URL of the image
- $next_attachment_url = wp_get_attachment_url();
- }
-?>
-
ID, array( $attachment_size, 9999 ) ); // filterable image width with, essentially, no limit for image height.
- ?>
-
-
-
-
-
-
-
post_excerpt ) ) the_excerpt(); ?>
-
-→', 'twentyten' ) ); ?>
- '
' . __( 'Pages:', 'twentyten' ), 'after' => '
' ) ); ?>
-
-
-
-
-
- ', '' ); ?>
-
-
-
-
-
-
+
diff --git a/wp-content/themes/twentyten/editor-style.css b/wp-content/themes/twentyten/editor-style.css
index 31ea0d5b..7d051355 100644
--- a/wp-content/themes/twentyten/editor-style.css
+++ b/wp-content/themes/twentyten/editor-style.css
@@ -1,15 +1,13 @@
/*
Theme Name: Twenty Ten
-*/
-/*
-Used to style the TinyMCE editor.
+Description: Used to style the TinyMCE editor.
*/
html .mceContentBody {
- max-width:640px;
+ max-width: 640px;
}
* {
- font-family: Georgia, "Bitstream Charter", serif;
color: #444;
+ font-family: Georgia, "Bitstream Charter", serif;
line-height: 1.5;
}
p,
@@ -40,10 +38,10 @@ body, input, textarea {
}
hr {
background-color: #e7e7e7;
- border:0;
+ border: 0;
+ clear: both;
height: 1px;
margin-bottom: 18px;
- clear:both;
}
/* Text elements */
p {
@@ -58,22 +56,22 @@ ol {
margin: 0 0 18px 1.5em;
}
ol ol {
- list-style:upper-alpha;
+ list-style: upper-alpha;
}
ol ol ol {
- list-style:lower-roman;
+ list-style: lower-roman;
}
ol ol ol ol {
- list-style:lower-alpha;
+ list-style: lower-alpha;
}
ul ul,
ol ol,
ul ol,
ol ul {
- margin-bottom:0;
+ margin-bottom: 0;
}
dl {
- margin:0 0 24px 0;
+ margin: 0 0 24px 0;
}
dt {
font-weight: bold;
@@ -82,20 +80,20 @@ dd {
margin-bottom: 18px;
}
strong {
- font-weight: bold;
color: #000;
+ font-weight: bold;
}
cite,
em,
i {
- font-style: italic;
border: none;
+ font-style: italic;
}
big {
font-size: 131.25%;
}
ins {
- background: #ffffcc;
+ background: #ffc;
border: none;
color: #333;
}
@@ -129,11 +127,11 @@ ins {
}
sup,
sub {
+ font-size: 10px;
height: 0;
line-height: 1;
- vertical-align: baseline;
position: relative;
- font-size: 10px;
+ vertical-align: baseline;
}
sup {
bottom: 1ex;
@@ -142,10 +140,10 @@ sub {
top: .5ex;
}
a:link {
- color:#0066cc;
+ color: #06c;
}
a:visited {
- color:#743399;
+ color: #743399;
}
a:active,
a:hover {
@@ -157,13 +155,13 @@ ol,
dd,
pre,
hr {
- margin-bottom:24px;
+ margin-bottom: 24px;
}
ul ul,
ol ol,
ul ol,
ol ul {
- margin-bottom:0;
+ margin-bottom: 0;
}
pre,
kbd,
@@ -188,9 +186,9 @@ h4,
h5,
h6 {
color: #000;
- margin: 0 0 20px 0;
- line-height: 1.5em;
font-weight: normal;
+ line-height: 1.5em;
+ margin: 0 0 20px 0;
}
h1 {
font-size: 2.4em;
@@ -212,11 +210,11 @@ h6 {
}
table {
border: 1px solid #e7e7e7 !important;
- text-align: left;
- margin: 0 -1px 24px 0;
- width: 100%;
border-collapse: collapse;
border-spacing: 0;
+ margin: 0 -1px 24px 0;
+ text-align: left;
+ width: 100%;
}
tr th,
thead th {
@@ -232,11 +230,15 @@ tr td {
border-top: 1px solid #e7e7e7 !important;
padding: 6px 24px;
}
-
-
img {
margin: 0;
- max-width: 640px;
+}
+img.size-auto,
+img.size-large,
+img.size-full,
+img.size-medium {
+ max-width: 100%;
+ height: auto;
}
.alignleft,
img.alignleft {
@@ -265,18 +267,19 @@ img.aligncenter {
margin-bottom: 12px;
}
.wp-caption {
- border: none;
background: #f1f1f1;
+ border: none;
+ -khtml-border-radius: 0;
+ -moz-border-radius: 0;
+ -webkit-border-radius: 0;
+ border-radius: 0;
color: #888;
font-size: 12px;
line-height: 18px;
- text-align: center;
margin-bottom: 20px;
+ max-width: 632px !important; /* prevent too-wide images from breaking layout */
padding: 4px;
- -moz-border-radius: 0;
- -khtml-border-radius: 0;
- -webkit-border-radius: 0;
- border-radius: 0;
+ text-align: center;
}
.wp-caption img {
margin: 5px;
@@ -285,5 +288,5 @@ img.aligncenter {
margin: 0 0 4px;
}
.wp-smiley {
- margin:0;
+ margin: 0;
}
\ No newline at end of file
diff --git a/wp-content/themes/twentyten/footer.php b/wp-content/themes/twentyten/footer.php
index 61f2d948..6d0d1ab5 100644
--- a/wp-content/themes/twentyten/footer.php
+++ b/wp-content/themes/twentyten/footer.php
@@ -23,17 +23,14 @@
?>
diff --git a/wp-content/themes/twentyten/functions.php b/wp-content/themes/twentyten/functions.php
index d7a127a2..36f55066 100644
--- a/wp-content/themes/twentyten/functions.php
+++ b/wp-content/themes/twentyten/functions.php
@@ -77,6 +77,9 @@ function twentyten_setup() {
// This theme styles the visual editor with editor-style.css to match the theme style.
add_editor_style();
+ // Post Format support. You can also use the legacy "gallery" or "asides" (note the plural) categories.
+ add_theme_support( 'post-formats', array( 'aside', 'gallery' ) );
+
// This theme uses post thumbnails
add_theme_support( 'post-thumbnails' );
@@ -101,9 +104,12 @@ function twentyten_setup() {
add_custom_background();
// Your changeable header business starts here
- define( 'HEADER_TEXTCOLOR', '' );
+ if ( ! defined( 'HEADER_TEXTCOLOR' ) )
+ define( 'HEADER_TEXTCOLOR', '' );
+
// No CSS, just IMG call. The %s is a placeholder for the theme template directory URI.
- define( 'HEADER_IMAGE', '%s/images/headers/path.jpg' );
+ if ( ! defined( 'HEADER_IMAGE' ) )
+ define( 'HEADER_IMAGE', '%s/images/headers/path.jpg' );
// The height and width of your custom header. You can hook into the theme's own filters to change these values.
// Add a filter to twentyten_header_image_width and twentyten_header_image_height to change these values.
@@ -116,7 +122,8 @@ function twentyten_setup() {
set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true );
// Don't support text inside the header image.
- define( 'NO_HEADER_TEXT', true );
+ if ( ! defined( 'NO_HEADER_TEXT' ) )
+ define( 'NO_HEADER_TEXT', true );
// Add a way for the custom header to be styled in the admin panel that controls
// custom headers. See twentyten_admin_header_style(), below.
@@ -275,15 +282,30 @@ add_filter( 'get_the_excerpt', 'twentyten_custom_excerpt_more' );
/**
* Remove inline styles printed when the gallery shortcode is used.
*
- * Galleries are styled by the theme in Twenty Ten's style.css.
+ * Galleries are styled by the theme in Twenty Ten's style.css. This is just
+ * a simple filter call that tells WordPress to not use the default styles.
+ *
+ * @since Twenty Ten 1.2
+ */
+add_filter( 'use_default_gallery_style', '__return_false' );
+
+/**
+ * Deprecated way to remove inline styles printed when the gallery shortcode is used.
+ *
+ * This function is no longer needed or used. Use the use_default_gallery_style
+ * filter instead, as seen above.
*
* @since Twenty Ten 1.0
+ * @deprecated Deprecated in Twenty Ten 1.2 for WordPress 3.1
+ *
* @return string The gallery style filter, with the styles themselves removed.
*/
function twentyten_remove_gallery_css( $css ) {
return preg_replace( "##s", '', $css );
}
-add_filter( 'gallery_style', 'twentyten_remove_gallery_css' );
+// Backwards compatibility with WordPress 3.0.
+if ( version_compare( $GLOBALS['wp_version'], '3.1', '<' ) )
+ add_filter( 'gallery_style', 'twentyten_remove_gallery_css' );
if ( ! function_exists( 'twentyten_comment' ) ) :
/**
@@ -308,7 +330,7 @@ function twentyten_comment( $comment, $args, $depth ) {
says:', 'twentyten' ), sprintf( '%s ', get_comment_author_link() ) ); ?>
comment_approved == '0' ) : ?>
-
+
@@ -332,7 +354,7 @@ function twentyten_comment( $comment, $args, $depth ) {
case 'trackback' :
?>
-
+
widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) );
+ add_filter( 'show_recent_comments_widget_style', '__return_false' );
}
add_action( 'widgets_init', 'twentyten_remove_recent_comments_style' );
if ( ! function_exists( 'twentyten_posted_on' ) ) :
/**
- * Prints HTML with meta information for the current post—date/time and author.
+ * Prints HTML with meta information for the current post-date/time and author.
*
* @since Twenty Ten 1.0
*/
diff --git a/wp-content/themes/twentyten/header.php b/wp-content/themes/twentyten/header.php
index fa4b7279..54971c93 100644
--- a/wp-content/themes/twentyten/header.php
+++ b/wp-content/themes/twentyten/header.php
@@ -67,13 +67,13 @@
ID ) &&
( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ) ) &&
$image[1] >= HEADER_IMAGE_WIDTH ) :
// Houston, we have a new header image!
- echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
- else : ?>
+ echo get_the_post_thumbnail( $post->ID );
+ elseif ( get_header_image() ) : ?>
diff --git a/wp-content/themes/twentyten/index.php b/wp-content/themes/twentyten/index.php
index 9f7d240c..7bc3fd46 100644
--- a/wp-content/themes/twentyten/index.php
+++ b/wp-content/themes/twentyten/index.php
@@ -4,7 +4,7 @@
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
- * It is used to display a page when nothing more specific matches a query.
+ * It is used to display a page when nothing more specific matches a query.
* E.g., it puts together the home page when no home.php file exists.
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
diff --git a/wp-content/themes/twentyten/languages/twentyten.pot b/wp-content/themes/twentyten/languages/twentyten.pot
index 1febb300..403d43e4 100644
--- a/wp-content/themes/twentyten/languages/twentyten.pot
+++ b/wp-content/themes/twentyten/languages/twentyten.pot
@@ -2,9 +2,9 @@
# This file is distributed under the same license as the Twenty Ten package.
msgid ""
msgstr ""
-"Project-Id-Version: Twenty Ten 1.1\n"
+"Project-Id-Version: Twenty Ten 1.2\n"
"Report-Msgid-Bugs-To: http://wordpress.org/tag/twentyten\n"
-"POT-Creation-Date: 2011-01-01 21:26:51+00:00\n"
+"POT-Creation-Date: 2011-02-22 08:27:25+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -12,17 +12,58 @@ msgstr ""
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
-#. #-#-#-#-# twentyten.pot (Twenty Ten 1.1) #-#-#-#-#
+#: loop-attachment.php:21
+msgid "Return to %s"
+msgstr ""
+
+#: loop-attachment.php:23
+msgid "← %s"
+msgstr ""
+
+#: loop-attachment.php:32
+msgid "By %2$s"
+msgstr ""
+
+#: loop-attachment.php:36 functions.php:476
+msgid "View all posts by %s"
+msgstr ""
+
+#: loop-attachment.php:43
+msgid "Published %2$s"
+msgstr ""
+
+#: loop-attachment.php:53
+msgid "Full size is %s pixels"
+msgstr ""
+
+#: loop-attachment.php:56
+msgid "Link to full-size image"
+msgstr ""
+
+#: loop-attachment.php:63 loop-attachment.php:111 loop.php:100 loop.php:123
+#: loop.php:165 loop-page.php:30 loop-single.php:56
+msgid "Edit"
+msgstr ""
+
+#: loop-attachment.php:104 loop.php:115 loop.php:143 functions.php:248
+msgid "Continue reading → "
+msgstr ""
+
+#: loop-attachment.php:105 loop.php:144 loop-page.php:29 loop-single.php:34
+msgid "Pages:"
+msgstr ""
+
+#. #-#-#-#-# twentyten.pot (Twenty Ten 1.2) #-#-#-#-#
#. Theme URI of the plugin/theme
#: footer.php:33
msgid "http://wordpress.org/"
msgstr ""
-#: footer.php:34
+#: footer.php:33
msgid "Semantic Personal Publishing Platform"
msgstr ""
-#: footer.php:35
+#: footer.php:33
msgid "Proudly powered by %s."
msgstr ""
@@ -75,11 +116,11 @@ msgid ""
"will help."
msgstr ""
-#: loop.php:25 loop.php:173
+#: loop.php:25 loop.php:178
msgid "← Older posts"
msgstr ""
-#: loop.php:26 loop.php:174
+#: loop.php:26 loop.php:179
msgid "Newer posts → "
msgstr ""
@@ -89,193 +130,181 @@ msgid ""
"searching will help find a related post."
msgstr ""
-#: loop.php:60 loop.php:92
+#: loop.php:60 loop.php:95 loop.php:96
msgctxt "gallery category slug"
msgid "gallery"
msgstr ""
-#: loop.php:62 loop.php:83 loop.php:126
+#: loop.php:62 loop.php:83 loop.php:131
msgid "Permalink to %s"
msgstr ""
#: loop.php:82
-msgid "This gallery contains %2$s photos ."
-msgstr ""
+msgid "This gallery contains %2$s photo ."
+msgid_plural "This gallery contains %2$s photos ."
+msgstr[0] ""
+msgstr[1] ""
-#: loop.php:92
-msgid "View posts in the Gallery category"
+#: loop.php:93
+msgid "View Galleries"
msgstr ""
-#: loop.php:92
+#: loop.php:93 loop.php:96
msgid "More Galleries"
msgstr ""
-#: loop.php:94 loop.php:117 loop.php:159
+#: loop.php:96
+msgid "View posts in the Gallery category"
+msgstr ""
+
+#: loop.php:99 loop.php:122 loop.php:164
msgid "Leave a comment"
msgstr ""
-#: loop.php:94 loop.php:117 loop.php:159
+#: loop.php:99 loop.php:122 loop.php:164
msgid "1 Comment"
msgstr ""
-#: loop.php:94 loop.php:117 loop.php:159
+#: loop.php:99 loop.php:122 loop.php:164
msgid "% Comments"
msgstr ""
-#: loop.php:95 loop.php:118 loop.php:160 page.php:32 attachment.php:60
-#: attachment.php:107 onecolumn-page.php:27 single.php:53
-msgid "Edit"
-msgstr ""
-
-#: loop.php:101
+#: loop.php:106
msgctxt "asides category slug"
msgid "asides"
msgstr ""
-#: loop.php:110 loop.php:138 functions.php:241 attachment.php:100
-msgid "Continue reading → "
-msgstr ""
-
-#: loop.php:139 page.php:31 attachment.php:101 onecolumn-page.php:26
-#: single.php:31
-msgid "Pages:"
-msgstr ""
-
-#: loop.php:146
+#: loop.php:151
msgid "Posted in %2$s"
msgstr ""
-#: loop.php:155
+#: loop.php:160
msgid "Tagged %2$s"
msgstr ""
-#: functions.php:97
+#: functions.php:100
msgid "Primary Navigation"
msgstr ""
-#: functions.php:133
+#: functions.php:140
msgid "Berries"
msgstr ""
-#: functions.php:139
+#: functions.php:146
msgid "Cherry Blossoms"
msgstr ""
-#: functions.php:145
+#: functions.php:152
msgid "Concave"
msgstr ""
-#: functions.php:151
+#: functions.php:158
msgid "Fern"
msgstr ""
-#: functions.php:157
+#: functions.php:164
msgid "Forest Floor"
msgstr ""
-#: functions.php:163
+#: functions.php:170
msgid "Inkwell"
msgstr ""
-#: functions.php:169
+#: functions.php:176
msgid "Path"
msgstr ""
-#: functions.php:175
+#: functions.php:182
msgid "Sunset"
msgstr ""
-#: functions.php:308
+#: functions.php:330
msgid "%s says: "
msgstr ""
-#: functions.php:311
+#: functions.php:333
msgid "Your comment is awaiting moderation."
msgstr ""
-#: functions.php:318
+#: functions.php:340
msgid "%1$s at %2$s"
msgstr ""
-#: functions.php:318 functions.php:335
+#: functions.php:340 functions.php:357
msgid "(Edit)"
msgstr ""
-#: functions.php:335
+#: functions.php:357
msgid "Pingback:"
msgstr ""
-#: functions.php:354
+#: functions.php:376
msgid "Primary Widget Area"
msgstr ""
-#: functions.php:356
+#: functions.php:378
msgid "The primary widget area"
msgstr ""
-#: functions.php:365
+#: functions.php:387
msgid "Secondary Widget Area"
msgstr ""
-#: functions.php:367
+#: functions.php:389
msgid "The secondary widget area"
msgstr ""
-#: functions.php:376
+#: functions.php:398
msgid "First Footer Widget Area"
msgstr ""
-#: functions.php:378
+#: functions.php:400
msgid "The first footer widget area"
msgstr ""
-#: functions.php:387
+#: functions.php:409
msgid "Second Footer Widget Area"
msgstr ""
-#: functions.php:389
+#: functions.php:411
msgid "The second footer widget area"
msgstr ""
-#: functions.php:398
+#: functions.php:420
msgid "Third Footer Widget Area"
msgstr ""
-#: functions.php:400
+#: functions.php:422
msgid "The third footer widget area"
msgstr ""
-#: functions.php:409
+#: functions.php:431
msgid "Fourth Footer Widget Area"
msgstr ""
-#: functions.php:411
+#: functions.php:433
msgid "The fourth footer widget area"
msgstr ""
-#: functions.php:442
+#: functions.php:467
msgid ""
"Posted on %2$s by"
"span> %3$s"
msgstr ""
-#: functions.php:451 attachment.php:33
-msgid "View all posts by %s"
-msgstr ""
-
-#: functions.php:468
+#: functions.php:493
msgid ""
"This entry was posted in %1$s and tagged %2$s. Bookmark the permalink ."
msgstr ""
-#: functions.php:470
+#: functions.php:495
msgid ""
"This entry was posted in %1$s. Bookmark the permalink ."
msgstr ""
-#: functions.php:472
+#: functions.php:497
msgid ""
"Bookmark the permalink ."
@@ -293,34 +322,10 @@ msgstr ""
msgid "Author Archives: %s"
msgstr ""
-#: author.php:37 single.php:40
+#: author.php:37 loop-single.php:43
msgid "About %s"
msgstr ""
-#: attachment.php:18
-msgid "Return to %s"
-msgstr ""
-
-#: attachment.php:20
-msgid "← %s"
-msgstr ""
-
-#: attachment.php:29
-msgid "By %2$s"
-msgstr ""
-
-#: attachment.php:40
-msgid "Published %2$s"
-msgstr ""
-
-#: attachment.php:50
-msgid "Full size is %s pixels"
-msgstr ""
-
-#: attachment.php:53
-msgid "Link to full-size image"
-msgstr ""
-
#: search.php:16
msgid "Search Results for: %s"
msgstr ""
@@ -335,6 +340,20 @@ msgid ""
"different keywords."
msgstr ""
+#: loop-single.php:21 loop-single.php:61
+msgctxt "Previous post link"
+msgid "←"
+msgstr ""
+
+#: loop-single.php:22 loop-single.php:62
+msgctxt "Next post link"
+msgid "→"
+msgstr ""
+
+#: loop-single.php:47
+msgid "View all posts by %s → "
+msgstr ""
+
#: archive.php:33
msgid "Daily Archives: %s "
msgstr ""
@@ -351,20 +370,6 @@ msgstr ""
msgid "Blog Archives"
msgstr ""
-#: single.php:18 single.php:58
-msgctxt "Previous post link"
-msgid "←"
-msgstr ""
-
-#: single.php:19 single.php:59
-msgctxt "Next post link"
-msgid "→"
-msgstr ""
-
-#: single.php:44
-msgid "View all posts by %s → "
-msgstr ""
-
#. Theme Name of the plugin/theme
msgid "Twenty Ten"
msgstr ""
@@ -389,5 +394,5 @@ msgstr ""
msgid ""
"black, blue, white, two-columns, fixed-width, custom-header, custom-"
"background, threaded-comments, sticky-post, translation-ready, microformats, "
-"rtl-language-support, editor-style"
+"rtl-language-support, editor-style, custom-menu"
msgstr ""
diff --git a/wp-content/themes/twentyten/loop-attachment.php b/wp-content/themes/twentyten/loop-attachment.php
new file mode 100644
index 00000000..20794fba
--- /dev/null
+++ b/wp-content/themes/twentyten/loop-attachment.php
@@ -0,0 +1,117 @@
+
+
+
+
+ post_parent ) ) : ?>
+ ←
%s', 'twentyten' ), get_the_title( $post->post_parent ) );
+ ?>
+
+
+ >
+
+
+
+ By %2$s', 'twentyten' ),
+ 'meta-prep meta-prep-author',
+ sprintf( '
%3$s ',
+ get_author_posts_url( get_the_author_meta( 'ID' ) ),
+ sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ),
+ get_the_author()
+ )
+ );
+ ?>
+
|
+ Published %2$s', 'twentyten' ),
+ 'meta-prep meta-prep-entry-date',
+ sprintf( '
%2$s ',
+ esc_attr( get_the_time() ),
+ get_the_date()
+ )
+ );
+ if ( wp_attachment_is_image() ) {
+ echo '
| ';
+ $metadata = wp_get_attachment_metadata();
+ printf( __( 'Full size is %s pixels', 'twentyten' ),
+ sprintf( '
%3$s × %4$s ',
+ wp_get_attachment_url(),
+ esc_attr( __( 'Link to full-size image', 'twentyten' ) ),
+ $metadata['width'],
+ $metadata['height']
+ )
+ );
+ }
+ ?>
+ |
', ' ' ); ?>
+
+
+
+
+ $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID' ) ) );
+ foreach ( $attachments as $k => $attachment ) {
+ if ( $attachment->ID == $post->ID )
+ break;
+ }
+ $k++;
+ // If there is more than 1 image attachment in a gallery
+ if ( count( $attachments ) > 1 ) {
+ if ( isset( $attachments[ $k ] ) )
+ // get the URL of the next image attachment
+ $next_attachment_url = get_attachment_link( $attachments[ $k ]->ID );
+ else
+ // or get the URL of the first image attachment
+ $next_attachment_url = get_attachment_link( $attachments[ 0 ]->ID );
+ } else {
+ // or, if there's only 1 image attachment, get the URL of the image
+ $next_attachment_url = wp_get_attachment_url();
+ }
+?>
+
ID, array( $attachment_width, $attachment_height ) ); // filterable image width with, essentially, no limit for image height.
+ ?>
+
+
+
+
+
+
+
post_excerpt ) ) the_excerpt(); ?>
+
+→', 'twentyten' ) ); ?>
+ '
' . __( 'Pages:', 'twentyten' ), 'after' => '
' ) ); ?>
+
+
+
+
+
+ ', '' ); ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wp-content/themes/twentyten/loop-page.php b/wp-content/themes/twentyten/loop-page.php
new file mode 100644
index 00000000..252a1d0e
--- /dev/null
+++ b/wp-content/themes/twentyten/loop-page.php
@@ -0,0 +1,36 @@
+
+
+
+
+ >
+
+
+
+
+
+
+
+
+ '
' . __( 'Pages:', 'twentyten' ), 'after' => '
' ) ); ?>
+ ', '' ); ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wp-content/themes/twentyten/loop-single.php b/wp-content/themes/twentyten/loop-single.php
new file mode 100644
index 00000000..50860e24
--- /dev/null
+++ b/wp-content/themes/twentyten/loop-single.php
@@ -0,0 +1,67 @@
+
+
+
+
+
+
' . _x( '←', 'Previous post link', 'twentyten' ) . ' %title' ); ?>
+
' . _x( '→', 'Next post link', 'twentyten' ) . '' ); ?>
+
+
+ >
+
+
+
+
+
+
+
+
+ '
' . __( 'Pages:', 'twentyten' ), 'after' => '
' ) ); ?>
+
+
+
+
+
+
+
+
+ ', '' ); ?>
+
+
+
+
+
' . _x( '←', 'Previous post link', 'twentyten' ) . ' %title' ); ?>
+
' . _x( '→', 'Next post link', 'twentyten' ) . '' ); ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/wp-content/themes/twentyten/loop.php b/wp-content/themes/twentyten/loop.php
index c0d746f3..9dc6297d 100644
--- a/wp-content/themes/twentyten/loop.php
+++ b/wp-content/themes/twentyten/loop.php
@@ -55,9 +55,9 @@
*/ ?>
-
+
-
+ ID ) ) || in_category( _x( 'gallery', 'gallery category slug', 'twentyten' ) ) ) : ?>
>
@@ -68,8 +68,8 @@
-
-
+ $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
if ( $images ) :
$total_images = count( $images );
@@ -79,9 +79,9 @@
-
%2$s photos.', 'twentyten' ),
+ %2$s photo.', 'This gallery contains %2$s photos .', $total_images, 'twentyten' ),
'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
- $total_images
+ number_format_i18n( $total_images )
); ?>
@@ -89,16 +89,21 @@
-
+ ID ) ) : ?>
+
+
|
+
+
|
+
|
', ' ' ); ?>
-
+
-
+ ID ) ) || in_category( _x( 'asides', 'asides category slug', 'twentyten' ) ) ) : ?>
>
diff --git a/wp-content/themes/twentyten/onecolumn-page.php b/wp-content/themes/twentyten/onecolumn-page.php
index 90b1abf3..1a8d5b7e 100644
--- a/wp-content/themes/twentyten/onecolumn-page.php
+++ b/wp-content/themes/twentyten/onecolumn-page.php
@@ -17,20 +17,13 @@ get_header(); ?>
-
-
-
>
-
-
-
- '
' . __( 'Pages:', 'twentyten' ), 'after' => '
' ) ); ?>
- ', '' ); ?>
-
-
-
-
-
-
+
diff --git a/wp-content/themes/twentyten/page.php b/wp-content/themes/twentyten/page.php
index a6081c80..1a550423 100644
--- a/wp-content/themes/twentyten/page.php
+++ b/wp-content/themes/twentyten/page.php
@@ -17,25 +17,13 @@ get_header(); ?>
-
-
-
>
-
-
-
-
-
-
-
-
- '
' . __( 'Pages:', 'twentyten' ), 'after' => '
' ) ); ?>
- ', '' ); ?>
-
-
-
-
-
-
+
diff --git a/wp-content/themes/twentyten/rtl.css b/wp-content/themes/twentyten/rtl.css
index 4ae54e4d..339e6e52 100644
--- a/wp-content/themes/twentyten/rtl.css
+++ b/wp-content/themes/twentyten/rtl.css
@@ -94,7 +94,7 @@ input[type=submit] {
-------------------------------------------------------------- */
/* Text elements */
-ul {
+ul, ol {
margin: 0 1.5em 18px 0;
}
blockquote {
@@ -120,6 +120,9 @@ blockquote {
float: left;
font-style: normal;
}
+#branding img {
+ float: right;
+}
/* =Menu
-------------------------------------------------------------- */
diff --git a/wp-content/themes/twentyten/sidebar.php b/wp-content/themes/twentyten/sidebar.php
index 7e2565b8..8a1664f3 100644
--- a/wp-content/themes/twentyten/sidebar.php
+++ b/wp-content/themes/twentyten/sidebar.php
@@ -18,7 +18,7 @@
* some default sidebar stuff just in case.
*/
if ( ! dynamic_sidebar( 'primary-widget-area' ) ) : ?>
-
+
diff --git a/wp-content/themes/twentyten/single.php b/wp-content/themes/twentyten/single.php
index f97fd460..a0dea11f 100644
--- a/wp-content/themes/twentyten/single.php
+++ b/wp-content/themes/twentyten/single.php
@@ -12,56 +12,13 @@ get_header(); ?>
-
-
-
-
' . _x( '←', 'Previous post link', 'twentyten' ) . ' %title' ); ?>
-
' . _x( '→', 'Next post link', 'twentyten' ) . '' ); ?>
-
-
-
>
-
-
-
-
-
-
-
-
- '
' . __( 'Pages:', 'twentyten' ), 'after' => '
' ) ); ?>
-
-
-
-
-
-
-
-
- ', '' ); ?>
-
-
-
-
-
' . _x( '←', 'Previous post link', 'twentyten' ) . ' %title' ); ?>
-
' . _x( '→', 'Next post link', 'twentyten' ) . '' ); ?>
-
-
-
-
-
+
diff --git a/wp-content/themes/twentyten/style.css b/wp-content/themes/twentyten/style.css
index 5dbf6317..ee5d61d4 100644
--- a/wp-content/themes/twentyten/style.css
+++ b/wp-content/themes/twentyten/style.css
@@ -3,8 +3,10 @@ Theme Name: Twenty Ten
Theme URI: http://wordpress.org/
Description: The 2010 theme for WordPress is stylish, customizable, simple, and readable -- make it yours with a custom menu, header image, and background. Twenty Ten supports six widgetized areas (two in the sidebar, four in the footer) and featured images (thumbnails for gallery posts and custom header images for posts and pages). It includes stylesheets for print and the admin Visual Editor, special styles for posts in the "Asides" and "Gallery" categories, and has an optional one-column page template that removes the sidebar.
Author: the WordPress team
-Version: 1.1
-Tags: black, blue, white, two-columns, fixed-width, custom-header, custom-background, threaded-comments, sticky-post, translation-ready, microformats, rtl-language-support, editor-style
+Version: 1.2
+License: GNU General Public License
+License URI: license.txt
+Tags: black, blue, white, two-columns, fixed-width, custom-header, custom-background, threaded-comments, sticky-post, translation-ready, microformats, rtl-language-support, editor-style, custom-menu
*/
@@ -139,7 +141,9 @@ h3#reply-title,
.pingback p,
.reply,
.widget-title,
-.wp-caption-text,
+.wp-caption-text {
+ font-family: "Helvetica Neue", Arial, Helvetica, "Nimbus Sans L", sans-serif;
+}
input[type=submit] {
font-family: "Helvetica Neue", Arial, Helvetica, "Nimbus Sans L", sans-serif;
}
@@ -350,7 +354,7 @@ a:hover {
clear: right;
float: right;
font-style: italic;
- margin: 14px 0 18px 0;
+ margin: 15px 0 18px 0;
width: 220px;
}
@@ -358,8 +362,8 @@ a:hover {
#branding img {
border-top: 4px solid #000;
border-bottom: 1px solid #000;
- clear: both;
display: block;
+ float: left;
}
@@ -636,6 +640,7 @@ div.menu li {
width: 33%;
}
.page-link {
+ clear: both;
color: #000;
font-weight: bold;
margin: 0 0 22px 0;
@@ -710,15 +715,18 @@ body.page .edit-link {
/* =Asides
-------------------------------------------------------------- */
+.home #content .format-aside p,
.home #content .category-asides p {
font-size: 14px;
line-height: 20px;
margin-bottom: 10px;
margin-top: 0;
}
+.home .hentry.format-aside,
.home .hentry.category-asides {
padding: 0;
}
+.home #content .format-aside .entry-content,
.home #content .category-asides .entry-content {
padding-top: 0;
}
@@ -727,15 +735,18 @@ body.page .edit-link {
/* =Gallery listing
-------------------------------------------------------------- */
+.format-gallery .size-thumbnail img,
.category-gallery .size-thumbnail img {
border: 10px solid #f1f1f1;
margin-bottom: 0;
}
+.format-gallery .gallery-thumb,
.category-gallery .gallery-thumb {
float: left;
margin-right: 20px;
margin-top: -4px;
}
+.home #content .format-gallery .entry-utility,
.home #content .category-gallery .entry-utility {
padding-top: 4px;
}
@@ -759,86 +770,105 @@ body.page .edit-link {
/* =Images
-------------------------------------------------------------- */
-#content img {
- margin: 0;
- height: auto;
- max-width: 640px;
- width: auto;
-}
-#content .attachment img {
- max-width: 900px;
-}
-#content .alignleft,
-#content img.alignleft {
+/*
+Resize images to fit the main content area.
+- Applies only to images uploaded via WordPress by targeting size-* classes.
+- Other images will be left alone. Use "size-auto" class to apply to other images.
+*/
+img.size-auto,
+img.size-full,
+img.size-large,
+img.size-medium,
+.attachment img {
+ max-width: 100%; /* When images are too wide for containing element, force them to fit. */
+ height: auto; /* Override height to match resized width for correct aspect ratio. */
+}
+.alignleft,
+img.alignleft {
display: inline;
float: left;
margin-right: 24px;
margin-top: 4px;
}
-#content .alignright,
-#content img.alignright {
+.alignright,
+img.alignright {
display: inline;
float: right;
margin-left: 24px;
margin-top: 4px;
}
-#content .aligncenter,
-#content img.aligncenter {
+.aligncenter,
+img.aligncenter {
clear: both;
display: block;
margin-left: auto;
margin-right: auto;
}
-#content img.alignleft,
-#content img.alignright,
-#content img.aligncenter {
+img.alignleft,
+img.alignright,
+img.aligncenter {
margin-bottom: 12px;
}
-#content .wp-caption {
+.wp-caption {
background: #f1f1f1;
line-height: 18px;
margin-bottom: 20px;
+ max-width: 632px !important; /* prevent too-wide images from breaking layout */
padding: 4px;
text-align: center;
}
-#content .wp-caption img {
+.wp-caption img {
margin: 5px 5px 0;
}
-#content .wp-caption p.wp-caption-text {
+.wp-caption p.wp-caption-text {
color: #888;
font-size: 12px;
margin: 5px;
}
-#content .wp-smiley {
+.wp-smiley {
margin: 0;
}
-#content .gallery {
+.gallery {
margin: 0 auto 18px;
}
-#content .gallery .gallery-item {
+.gallery .gallery-item {
float: left;
margin-top: 0;
text-align: center;
width: 33%;
}
-#content .gallery img {
+.gallery-columns-2 .gallery-item {
+ width: 50%;
+}
+.gallery-columns-4 .gallery-item {
+ width: 25%;
+}
+.gallery img {
border: 2px solid #cfcfcf;
}
-#content .gallery .gallery-caption {
+.gallery-columns-2 .attachment-medium {
+ max-width: 92%;
+ height: auto;
+}
+.gallery-columns-4 .attachment-thumbnail {
+ max-width: 84%;
+ height: auto;
+}
+.gallery .gallery-caption {
color: #888;
font-size: 12px;
margin: 0 0 12px;
}
-#content .gallery dl {
+.gallery dl {
margin: 0;
}
-#content .gallery img {
+.gallery img {
border: 10px solid #f1f1f1;
}
-#content .gallery br+br {
+.gallery br+br {
display: none;
}
-#content .attachment img { /* single attachment images should be centered */
+#content .attachment img {/* single attachment images should be centered */
display: block;
margin: 0 auto;
}
@@ -1087,6 +1117,9 @@ h3#reply-title {
list-style: square;
margin-left: 1.3em;
}
+.widget-area select {
+ max-width: 100%;
+}
.widget_search #s {/* This keeps the search inputs in line */
width: 60%;
}
diff --git a/wp-feed.php b/wp-feed.php
index 24cd8d67..afce8cd4 100644
--- a/wp-feed.php
+++ b/wp-feed.php
@@ -8,5 +8,5 @@
require( './wp-load.php' );
wp_redirect( get_bloginfo( get_default_feed() . '_url' ), 301 );
-
-?>
\ No newline at end of file
+exit;
+?>
diff --git a/wp-includes/admin-bar.php b/wp-includes/admin-bar.php
new file mode 100644
index 00000000..a3f84ad5
--- /dev/null
+++ b/wp-includes/admin-bar.php
@@ -0,0 +1,378 @@
+initialize();
+ $wp_admin_bar->add_menus();
+
+ return true;
+}
+add_action( 'init', '_wp_admin_bar_init' ); // Don't remove. Wrong way to disable.
+
+/**
+ * Render the admin bar to the page based on the $wp_admin_bar->menu member var.
+ * This is called very late on the footer actions so that it will render after anything else being
+ * added to the footer.
+ *
+ * It includes the action "admin_bar_menu" which should be used to hook in and
+ * add new menus to the admin bar. That way you can be sure that you are adding at most optimal point,
+ * right before the admin bar is rendered. This also gives you access to the $post global, among others.
+ *
+ * @since 3.1.0
+ */
+function wp_admin_bar_render() {
+ global $wp_admin_bar;
+
+ if ( ! is_admin_bar_showing() || ! is_object( $wp_admin_bar ) )
+ return false;
+
+ $wp_admin_bar->load_user_locale_translations();
+
+ do_action_ref_array( 'admin_bar_menu', array( &$wp_admin_bar ) );
+
+ do_action( 'wp_before_admin_bar_render' );
+
+ $wp_admin_bar->render();
+
+ do_action( 'wp_after_admin_bar_render' );
+
+ $wp_admin_bar->unload_user_locale_translations();
+}
+add_action( 'wp_footer', 'wp_admin_bar_render', 1000 );
+add_action( 'admin_footer', 'wp_admin_bar_render', 1000 );
+
+/**
+ * Add the "My Account" menu and all submenus.
+ *
+ * @since 3.1.0
+ */
+function wp_admin_bar_my_account_menu() {
+ global $wp_admin_bar, $user_identity;
+
+ $user_id = get_current_user_id();
+
+ if ( 0 != $user_id ) {
+ /* Add the 'My Account' menu */
+ $avatar = get_avatar( get_current_user_id(), 16 );
+ $id = ( ! empty( $avatar ) ) ? 'my-account-with-avatar' : 'my-account';
+
+ $wp_admin_bar->add_menu( array( 'id' => $id, 'title' => $avatar . $user_identity, 'href' => get_edit_profile_url( $user_id ) ) );
+
+ /* Add the "My Account" sub menus */
+ $wp_admin_bar->add_menu( array( 'parent' => $id, 'title' => __( 'Edit My Profile' ), 'href' => get_edit_profile_url( $user_id ) ) );
+ if ( is_multisite() )
+ $wp_admin_bar->add_menu( array( 'parent' => $id, 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) );
+ else
+ $wp_admin_bar->add_menu( array( 'parent' => $id, 'title' => __( 'Dashboard' ), 'href' => admin_url() ) );
+ $wp_admin_bar->add_menu( array( 'parent' => $id, 'title' => __( 'Log Out' ), 'href' => wp_logout_url() ) );
+ }
+}
+
+/**
+ * Add the "My Sites/[Site Name]" menu and all submenus.
+ *
+ * @since 3.1.0
+ */
+function wp_admin_bar_my_sites_menu() {
+ global $wpdb, $wp_admin_bar;
+
+ /* Add the 'My Sites' menu if the user has more than one site. */
+ if ( count( $wp_admin_bar->user->blogs ) <= 1 )
+ return;
+
+ $wp_admin_bar->add_menu( array( 'id' => 'my-blogs', 'title' => __( 'My Sites' ), 'href' => admin_url( 'my-sites.php' ) ) );
+
+ $default = includes_url('images/wpmini-blue.png');
+
+ foreach ( (array) $wp_admin_bar->user->blogs as $blog ) {
+ // @todo Replace with some favicon lookup.
+ //$blavatar = '
';
+ $blavatar = '
';
+
+ $blogname = empty( $blog->blogname ) ? $blog->domain : $blog->blogname;
+
+ $wp_admin_bar->add_menu( array( 'parent' => 'my-blogs', 'id' => 'blog-' . $blog->userblog_id, 'title' => $blavatar . $blogname, 'href' => get_admin_url($blog->userblog_id) ) );
+ $wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-d', 'title' => __( 'Dashboard' ), 'href' => get_admin_url($blog->userblog_id) ) );
+
+ if ( current_user_can_for_blog( $blog->userblog_id, 'edit_posts' ) ) {
+ $wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-n', 'title' => __( 'New Post' ), 'href' => get_admin_url($blog->userblog_id, 'post-new.php') ) );
+ $wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-c', 'title' => __( 'Manage Comments' ), 'href' => get_admin_url($blog->userblog_id, 'edit-comments.php') ) );
+ }
+
+ $wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-v', 'title' => __( 'Visit Site' ), 'href' => get_home_url($blog->userblog_id) ) );
+ }
+}
+
+/**
+ * Provide a shortlink.
+ *
+ * @since 3.1.0
+ */
+function wp_admin_bar_shortlink_menu() {
+ global $wp_admin_bar;
+
+ $short = wp_get_shortlink( 0, 'query' );
+ $id = 'get-shortlink';
+
+ if ( empty( $short ) )
+ return;
+
+ $html = '
';
+
+ $wp_admin_bar->add_menu( array(
+ 'id' => $id,
+ 'title' => __( 'Shortlink' ),
+ 'href' => $short,
+ 'meta' => array( 'html' => $html ),
+ ) );
+}
+
+/**
+ * Provide an edit link for posts and terms.
+ *
+ * @since 3.1.0
+ */
+function wp_admin_bar_edit_menu () {
+ global $wp_admin_bar;
+
+ $current_object = get_queried_object();
+
+ if ( empty($current_object) )
+ return;
+
+ if ( ! empty( $current_object->post_type ) && ( $post_type_object = get_post_type_object( $current_object->post_type ) ) && current_user_can( $post_type_object->cap->edit_post, $current_object->ID ) && $post_type_object->show_ui ) {
+ $wp_admin_bar->add_menu( array( 'id' => 'edit', 'title' => $post_type_object->labels->edit_item, 'href' => get_edit_post_link( $current_object->ID ) ) );
+ } elseif ( ! empty( $current_object->taxonomy ) && ( $tax = get_taxonomy( $current_object->taxonomy ) ) && current_user_can( $tax->cap->edit_terms ) && $tax->show_ui ) {
+ $wp_admin_bar->add_menu( array( 'id' => 'edit', 'title' => $tax->labels->edit_item, 'href' => get_edit_term_link( $current_object->term_id, $current_object->taxonomy ) ) );
+ }
+}
+
+/**
+ * Add "Add New" menu.
+ *
+ * @since 3.1.0
+ */
+function wp_admin_bar_new_content_menu() {
+ global $wp_admin_bar;
+
+ $actions = array();
+ foreach ( (array) get_post_types( array( 'show_ui' => true ), 'objects' ) as $ptype_obj ) {
+ if ( true !== $ptype_obj->show_in_menu || ! current_user_can( $ptype_obj->cap->edit_posts ) )
+ continue;
+
+ $actions[ 'post-new.php?post_type=' . $ptype_obj->name ] = array( $ptype_obj->labels->singular_name, $ptype_obj->cap->edit_posts, 'new-' . $ptype_obj->name );
+ }
+
+ if ( empty( $actions ) )
+ return;
+
+ $wp_admin_bar->add_menu( array( 'id' => 'new-content', 'title' => _x( 'Add New', 'admin bar menu group label' ), 'href' => admin_url( array_shift( array_keys( $actions ) ) ) ) );
+
+ foreach ( $actions as $link => $action ) {
+ $wp_admin_bar->add_menu( array( 'parent' => 'new-content', 'id' => $action[2], 'title' => $action[0], 'href' => admin_url($link) ) );
+ }
+}
+
+/**
+ * Add edit comments link with awaiting moderation count bubble.
+ *
+ * @since 3.1.0
+ */
+function wp_admin_bar_comments_menu() {
+ global $wp_admin_bar;
+
+ if ( !current_user_can('edit_posts') )
+ return;
+
+ $awaiting_mod = wp_count_comments();
+ $awaiting_mod = $awaiting_mod->moderated;
+
+ $awaiting_mod = $awaiting_mod ? "
" . number_format_i18n( $awaiting_mod ) . " " : '';
+ $wp_admin_bar->add_menu( array( 'id' => 'comments', 'title' => sprintf( __('Comments %s'), $awaiting_mod ), 'href' => admin_url('edit-comments.php') ) );
+}
+
+/**
+ * Add "Appearance" menu with widget and nav menu submenu.
+ *
+ * @since 3.1.0
+ */
+function wp_admin_bar_appearance_menu() {
+ global $wp_admin_bar;
+
+ if ( !current_user_can('switch_themes') )
+ return;
+
+ $wp_admin_bar->add_menu( array( 'id' => 'appearance', 'title' => __('Appearance'), 'href' => admin_url('themes.php') ) );
+
+ if ( !current_user_can('edit_theme_options') )
+ return;
+
+ if ( current_theme_supports( 'widgets' ) )
+ $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'widgets', 'title' => __('Widgets'), 'href' => admin_url('widgets.php') ) );
+
+ if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
+ $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'menus', 'title' => __('Menus'), 'href' => admin_url('nav-menus.php') ) );
+}
+
+/**
+ * Provide an update link if theme/plugin/core updates are available.
+ *
+ * @since 3.1.0
+ */
+function wp_admin_bar_updates_menu() {
+ global $wp_admin_bar;
+
+ if ( !current_user_can('install_plugins') )
+ return;
+
+ $plugin_update_count = $theme_update_count = $wordpress_update_count = 0;
+ $update_plugins = get_site_transient( 'update_plugins' );
+ if ( !empty($update_plugins->response) )
+ $plugin_update_count = count( $update_plugins->response );
+ $update_themes = get_site_transient( 'update_themes' );
+ if ( !empty($update_themes->response) )
+ $theme_update_count = count( $update_themes->response );
+ /* @todo get_core_updates() is only available on admin page loads
+ $update_wordpress = get_core_updates( array('dismissed' => false) );
+ if ( !empty($update_wordpress) && !in_array( $update_wordpress[0]->response, array('development', 'latest') ) )
+ $wordpress_update_count = 1;
+ */
+
+ $update_count = $plugin_update_count + $theme_update_count + $wordpress_update_count;
+
+ if ( !$update_count )
+ return;
+
+ $update_title = array();
+ if ( $wordpress_update_count )
+ $update_title[] = sprintf(__('%d WordPress Update'), $wordpress_update_count);
+ if ( $plugin_update_count )
+ $update_title[] = sprintf(_n('%d Plugin Update', '%d Plugin Updates', $plugin_update_count), $plugin_update_count);
+ if ( $theme_update_count )
+ $update_title[] = sprintf(_n('%d Theme Update', '%d Themes Updates', $theme_update_count), $theme_update_count);
+
+ $update_title = !empty($update_title) ? esc_attr(implode(', ', $update_title)) : '';
+
+ $update_title = "
";
+ $update_title .= sprintf( __('Updates %s'), "" . number_format_i18n($update_count) . ' ' );
+ $update_title .= ' ';
+
+ $wp_admin_bar->add_menu( array( 'id' => 'updates', 'title' => $update_title, 'href' => network_admin_url( 'update-core.php' ) ) );
+}
+
+/**
+ * Style and scripts for the admin bar.
+ *
+ * @since 3.1.0
+ *
+ */
+function wp_admin_bar_header() { ?>
+
+
+
+
\ No newline at end of file
diff --git a/wp-includes/author-template.php b/wp-includes/author-template.php
index bc44349f..641b69d4 100644
--- a/wp-includes/author-template.php
+++ b/wp-includes/author-template.php
@@ -102,6 +102,8 @@ function get_the_author_meta($field = '', $user_id = false) {
else
$authordata = get_userdata( $user_id );
+ // Keys used as object vars cannot have dashes.
+ $field = str_replace('-', '', $field);
$field = strtolower($field);
$user_field = "user_$field";
@@ -211,7 +213,7 @@ function the_author_posts_link($deprecated = '') {
}
/**
- * Retrieve the URL to the author page of the author of the current post.
+ * Retrieve the URL to the author page for the user with the ID provided.
*
* @since 2.1.0
* @uses $wp_rewrite WP_Rewrite
@@ -223,7 +225,7 @@ function get_author_posts_url($author_id, $author_nicename = '') {
$link = $wp_rewrite->get_author_permastruct();
if ( empty($link) ) {
- $file = home_url() . '/';
+ $file = home_url( '/' );
$link = $file . '?author=' . $auth_ID;
} else {
if ( '' == $author_nicename ) {
@@ -232,7 +234,7 @@ function get_author_posts_url($author_id, $author_nicename = '') {
$author_nicename = $user->user_nicename;
}
$link = str_replace('%author%', $author_nicename, $link);
- $link = home_url() . trailingslashit($link);
+ $link = home_url( user_trailingslashit( $link ) );
}
$link = apply_filters('author_link', $link, $author_id, $author_nicename);
@@ -257,7 +259,7 @@ function get_author_posts_url($author_id, $author_nicename = '') {
* echoing.
*
style (string) ('list'): Whether to display list of authors in list form
* or as a string.
- *
html (bool) (true): Whether to list the items in html for or plaintext.
+ * html (bool) (true): Whether to list the items in html form or plaintext.
*
*
*
@@ -270,101 +272,97 @@ function wp_list_authors($args = '') {
global $wpdb;
$defaults = array(
+ 'orderby' => 'name', 'order' => 'ASC', 'number' => '',
'optioncount' => false, 'exclude_admin' => true,
'show_fullname' => false, 'hide_empty' => true,
'feed' => '', 'feed_image' => '', 'feed_type' => '', 'echo' => true,
'style' => 'list', 'html' => true
);
- $r = wp_parse_args( $args, $defaults );
- extract($r, EXTR_SKIP);
+ $args = wp_parse_args( $args, $defaults );
+ extract( $args, EXTR_SKIP );
+
$return = '';
- /** @todo Move select to get_authors(). */
- $users = get_users_of_blog();
- $author_ids = array();
- foreach ( (array) $users as $user )
- $author_ids[] = $user->user_id;
- if ( count($author_ids) > 0 ) {
- $author_ids = implode(',', $author_ids );
- $authors = $wpdb->get_results( "SELECT ID, user_nicename from $wpdb->users WHERE ID IN($author_ids) " . ($exclude_admin ? "AND user_login <> 'admin' " : '') . "ORDER BY display_name" );
- } else {
- $authors = array();
- }
+ $query_args = wp_array_slice_assoc( $args, array( 'orderby', 'order', 'number' ) );
+ $query_args['fields'] = 'ids';
+ $authors = get_users( $query_args );
$author_count = array();
foreach ( (array) $wpdb->get_results("SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb->posts WHERE post_type = 'post' AND " . get_private_posts_cap_sql( 'post' ) . " GROUP BY post_author") as $row )
$author_count[$row->post_author] = $row->count;
- foreach ( (array) $authors as $author ) {
+ foreach ( $authors as $author_id ) {
+ $author = get_userdata( $author_id );
- $link = '';
+ if ( $exclude_admin && 'admin' == $author->display_name )
+ continue;
- $author = get_userdata( $author->ID );
- $posts = (isset($author_count[$author->ID])) ? $author_count[$author->ID] : 0;
- $name = $author->display_name;
+ $posts = isset( $author_count[$author->ID] ) ? $author_count[$author->ID] : 0;
- if ( $show_fullname && ($author->first_name != '' && $author->last_name != '') )
+ if ( !$posts && $hide_empty )
+ continue;
+
+ $link = '';
+
+ if ( $show_fullname && $author->first_name && $author->last_name )
$name = "$author->first_name $author->last_name";
+ else
+ $name = $author->display_name;
- if( !$html ) {
- if ( $posts == 0 ) {
- if ( ! $hide_empty )
- $return .= $name . ', ';
- } else
- $return .= $name . ', ';
+ if ( !$html ) {
+ $return .= $name . ', ';
- // No need to go further to process HTML.
- continue;
+ continue; // No need to go further to process HTML.
}
- if ( !($posts == 0 && $hide_empty) && 'list' == $style )
+ if ( 'list' == $style ) {
$return .= '
';
- if ( $posts == 0 ) {
- if ( ! $hide_empty )
- $link = $name;
- } else {
- $link = 'display_name) ) . '">' . $name . ' ';
-
- if ( (! empty($feed_image)) || (! empty($feed)) ) {
- $link .= ' ';
- if (empty($feed_image))
- $link .= '(';
- $link .= ' ';
- else
- $link .= $name;
-
- $link .= '';
-
- if ( empty($feed_image) )
- $link .= ')';
+ }
+
+ $link = 'display_name) ) . '">' . $name . ' ';
+
+ if ( !empty( $feed_image ) || !empty( $feed ) ) {
+ $link .= ' ';
+ if ( empty( $feed_image ) ) {
+ $link .= '(';
+ }
+
+ $link .= ' ';
+ else
+ $link .= $name;
+
+ $link .= '';
+ if ( empty( $feed_image ) )
+ $link .= ')';
}
- if ( $posts || ! $hide_empty )
- $return .= $link . ( ( 'list' == $style ) ? ' ' : ', ' );
+ if ( $optioncount )
+ $link .= ' ('. $posts . ')';
+
+ $return .= $link;
+ $return .= ( 'list' == $style ) ? '' : ', ';
}
- $return = trim($return, ', ');
+ $return = rtrim($return, ', ');
- if ( ! $echo )
+ if ( !$echo )
return $return;
+
echo $return;
}
diff --git a/wp-includes/bookmark.php b/wp-includes/bookmark.php
index 641ae3b4..8b0fe487 100644
--- a/wp-includes/bookmark.php
+++ b/wp-includes/bookmark.php
@@ -7,12 +7,12 @@
*/
/**
- * Retrieve Bookmark data based on ID
+ * Retrieve Bookmark data
*
* @since 2.1.0
* @uses $wpdb Database Object
*
- * @param int $bookmark_id
+ * @param mixed $bookmark
* @param string $output Optional. Either OBJECT, ARRAY_N, or ARRAY_A constant
* @param string $filter Optional, default is 'raw'.
* @return array|object Type returned depends on $output value.
@@ -334,11 +334,10 @@ function sanitize_bookmark_field($field, $value, $bookmark_id, $context) {
return $value;
if ( 'edit' == $context ) {
- $format_to_edit = array('link_notes');
$value = apply_filters("edit_$field", $value, $bookmark_id);
- if ( in_array($field, $format_to_edit) ) {
- $value = format_to_edit($value);
+ if ( 'link_notes' == $field ) {
+ $value = esc_html( $value ); // textarea_escaped
} else {
$value = esc_attr($value);
}
diff --git a/wp-includes/cache.php b/wp-includes/cache.php
index 62438662..895c4316 100644
--- a/wp-includes/cache.php
+++ b/wp-includes/cache.php
@@ -110,7 +110,7 @@ function wp_cache_init() {
* @uses $wp_object_cache Object Cache Class
* @see WP_Object_Cache::replace()
*
- * @param int|string $id What to call the contents in the cache
+ * @param int|string $key What to call the contents in the cache
* @param mixed $data The contents to store in the cache
* @param string $flag Where to group the cache contents
* @param int $expire When to expire the cache contents
@@ -129,7 +129,7 @@ function wp_cache_replace($key, $data, $flag = '', $expire = 0) {
* @uses $wp_object_cache Object Cache Class
* @see WP_Object_Cache::set()
*
- * @param int|string $id What to call the contents in the cache
+ * @param int|string $key What to call the contents in the cache
* @param mixed $data The contents to store in the cache
* @param string $flag Where to group the cache contents
* @param int $expire When to expire the cache contents
@@ -171,8 +171,6 @@ function wp_cache_add_non_persistent_groups( $groups ) {
* this function instructs the backend to reset those keys and perform any cleanup since blog or site IDs have changed since cache init.
*
* @since 2.6.0
- *
- * @param string|array $groups A group or an array of groups to add
*/
function wp_cache_reset() {
global $wp_object_cache;
@@ -451,15 +449,11 @@ class WP_Object_Cache {
echo "
Cache Hits: {$this->cache_hits}
";
echo "
Cache Misses: {$this->cache_misses}
";
echo "";
-
+ echo '
";
- print_r($cache);
- echo " ";
+ echo "
Group: $group - ( " . number_format( strlen( serialize( $cache ) ) / 1024, 2 ) . 'k )';
}
+ echo '';
}
/**
diff --git a/wp-includes/canonical.php b/wp-includes/canonical.php
index 91b394b9..36411968 100644
--- a/wp-includes/canonical.php
+++ b/wp-includes/canonical.php
@@ -34,10 +34,10 @@
* @return null|false|string Null, if redirect not needed. False, if redirect
* not needed or the string of the URL
*/
-function redirect_canonical($requested_url=null, $do_redirect=true) {
- global $wp_rewrite, $is_IIS, $wp_query, $wpdb;
+function redirect_canonical( $requested_url = null, $do_redirect = true ) {
+ global $wp_rewrite, $is_iis7, $wp_query, $wpdb;
- if ( is_trackback() || is_search() || is_comments_popup() || is_admin() || $is_IIS || ( isset($_POST) && count($_POST) ) || is_preview() || is_robots() )
+ if ( is_trackback() || is_search() || is_comments_popup() || is_admin() || !empty($_POST) || is_preview() || is_robots() || ( $is_iis7 && !iis7_supports_permalinks() ) )
return;
if ( !$requested_url ) {
@@ -146,26 +146,24 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
} elseif ( is_category() || is_tag() || is_tax() ) { // Terms (Tags/categories)
$term_count = 0;
- foreach ( array('category__in', 'category__not_in', 'category__and', 'post__in', 'post__not_in',
- 'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and') as $key )
- $term_count += count($wp_query->query_vars[$key]);
+ foreach ( $wp_query->tax_query->queries as $tax_query )
+ $term_count += count( $tax_query['terms'] );
$obj = $wp_query->get_queried_object();
-
- if ( $term_count <= 1 && !empty($obj->term_id) && ( $tax_url = get_term_link((int)$obj->term_id, $obj->taxonomy) )
- && !is_wp_error($tax_url) && $redirect['query'] ) {
- if ( is_category() ) {
- $redirect['query'] = remove_query_arg( array( 'category_name', 'category', 'cat'), $redirect['query']);
- } elseif ( is_tag() ) {
- $redirect['query'] = remove_query_arg( array( 'tag', 'tag_id'), $redirect['query']);
- } elseif ( is_tax() ) { // Custom taxonomies will have a custom query var, remove those too:
- $tax = get_taxonomy( $obj->taxonomy );
- if ( false !== $tax->query_var)
- $redirect['query'] = remove_query_arg($tax->query_var, $redirect['query']);
- else
- $redirect['query'] = remove_query_arg( array( 'term', 'taxonomy'), $redirect['query']);
+ if ( $term_count <= 1 && !empty($obj->term_id) && ( $tax_url = get_term_link((int)$obj->term_id, $obj->taxonomy) ) && !is_wp_error($tax_url) ) {
+ if ( !empty($redirect['query']) ) {
+ if ( is_category() ) {
+ $redirect['query'] = remove_query_arg( array( 'category_name', 'category', 'cat'), $redirect['query']);
+ } elseif ( is_tag() ) {
+ $redirect['query'] = remove_query_arg( array( 'tag', 'tag_id'), $redirect['query']);
+ } elseif ( is_tax() ) { // Custom taxonomies will have a custom query var, remove those too:
+ $tax = get_taxonomy( $obj->taxonomy );
+ if ( false !== $tax->query_var)
+ $redirect['query'] = remove_query_arg($tax->query_var, $redirect['query']);
+ else
+ $redirect['query'] = remove_query_arg( array( 'term', 'taxonomy'), $redirect['query']);
+ }
}
-
$tax_url = parse_url($tax_url);
if ( ! empty($tax_url['query']) ) { // Custom taxonomies may only be accessable via ?taxonomy=..&term=..
parse_str($tax_url['query'], $query_vars);
@@ -173,7 +171,6 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
} else { // Taxonomy is accessable via a "pretty-URL"
$redirect['path'] = $tax_url['path'];
}
-
}
} elseif ( is_single() && strpos($wp_rewrite->permalink_structure, '%category%') !== false ) {
$category = get_category_by_path(get_query_var('category_name'));
@@ -190,14 +187,11 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
// paging and feeds
if ( get_query_var('paged') || is_feed() || get_query_var('cpage') ) {
- if ( !$redirect_url )
- $redirect_url = $requested_url;
- $paged_redirect = @parse_url($redirect_url);
- while ( preg_match( '#/page/?[0-9]+?(/+)?$#', $paged_redirect['path'] ) || preg_match( '#/(comments/?)?(feed|rss|rdf|atom|rss2)(/+)?$#', $paged_redirect['path'] ) || preg_match( '#/comment-page-[0-9]+(/+)?$#', $paged_redirect['path'] ) ) {
+ while ( preg_match( "#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", $redirect['path'] ) || preg_match( '#/(comments/?)?(feed|rss|rdf|atom|rss2)(/+)?$#', $redirect['path'] ) || preg_match( '#/comment-page-[0-9]+(/+)?$#', $redirect['path'] ) ) {
// Strip off paging and feed
- $paged_redirect['path'] = preg_replace('#/page/?[0-9]+?(/+)?$#', '/', $paged_redirect['path']); // strip off any existing paging
- $paged_redirect['path'] = preg_replace('#/(comments/?)?(feed|rss2?|rdf|atom)(/+|$)#', '/', $paged_redirect['path']); // strip off feed endings
- $paged_redirect['path'] = preg_replace('#/comment-page-[0-9]+?(/+)?$#', '/', $paged_redirect['path']); // strip off any existing comment paging
+ $redirect['path'] = preg_replace("#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", '/', $redirect['path']); // strip off any existing paging
+ $redirect['path'] = preg_replace('#/(comments/?)?(feed|rss2?|rdf|atom)(/+|$)#', '/', $redirect['path']); // strip off feed endings
+ $redirect['path'] = preg_replace('#/comment-page-[0-9]+?(/+)?$#', '/', $redirect['path']); // strip off any existing comment paging
}
$addl_path = '';
@@ -214,7 +208,7 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
$redirect['query'] = remove_query_arg( 'paged', $redirect['query'] );
if ( !is_feed() ) {
if ( $paged > 1 && !is_single() ) {
- $addl_path = ( !empty( $addl_path ) ? trailingslashit($addl_path) : '' ) . user_trailingslashit("page/$paged", 'paged');
+ $addl_path = ( !empty( $addl_path ) ? trailingslashit($addl_path) : '' ) . user_trailingslashit("$wp_rewrite->pagination_base/$paged", 'paged');
} elseif ( !is_single() ) {
$addl_path = !empty( $addl_path ) ? trailingslashit($addl_path) : '';
}
@@ -228,24 +222,29 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
$redirect['query'] = remove_query_arg( 'cpage', $redirect['query'] );
}
- $paged_redirect['path'] = user_trailingslashit( preg_replace('|/index.php/?$|', '/', $paged_redirect['path']) ); // strip off trailing /index.php/
- if ( !empty( $addl_path ) && $wp_rewrite->using_index_permalinks() && strpos($paged_redirect['path'], '/index.php/') === false )
- $paged_redirect['path'] = trailingslashit($paged_redirect['path']) . 'index.php/';
+ $redirect['path'] = user_trailingslashit( preg_replace('|/index.php/?$|', '/', $redirect['path']) ); // strip off trailing /index.php/
+ if ( !empty( $addl_path ) && $wp_rewrite->using_index_permalinks() && strpos($redirect['path'], '/index.php/') === false )
+ $redirect['path'] = trailingslashit($redirect['path']) . 'index.php/';
if ( !empty( $addl_path ) )
- $paged_redirect['path'] = trailingslashit($paged_redirect['path']) . $addl_path;
- $redirect_url = $paged_redirect['scheme'] . '://' . $paged_redirect['host'] . $paged_redirect['path'];
- $redirect['path'] = $paged_redirect['path'];
+ $redirect['path'] = trailingslashit($redirect['path']) . $addl_path;
+ $redirect_url = $redirect['scheme'] . '://' . $redirect['host'] . $redirect['path'];
}
}
// tack on any additional query vars
$redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] );
if ( $redirect_url && !empty($redirect['query']) ) {
- if ( strpos($redirect_url, '?') !== false )
- $redirect_url .= '&';
- else
- $redirect_url .= '?';
- $redirect_url .= $redirect['query'];
+ parse_str( $redirect['query'], $_parsed_query );
+ $redirect = @parse_url($redirect_url);
+
+ if ( ! empty( $_parsed_query['name'] ) && ! empty( $redirect['query'] ) ) {
+ parse_str( $redirect['query'], $_parsed_redirect_query );
+
+ if ( empty( $_parsed_redirect_query['name'] ) )
+ unset( $_parsed_query['name'] );
+ }
+
+ $redirect_url = add_query_arg( $_parsed_query, $redirect_url );
}
if ( $redirect_url )
@@ -345,13 +344,13 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
if ( !$redirect_url || $redirect_url == $requested_url )
return false;
-
- // Hex encoded octets are case-insensitive.
+
+ // Hex encoded octets are case-insensitive.
if ( false !== strpos($requested_url, '%') ) {
if ( !function_exists('lowercase_octets') ) {
- function lowercase_octets($matches) {
- return strtolower( $matches[0] );
- }
+ function lowercase_octets($matches) {
+ return strtolower( $matches[0] );
+ }
}
$requested_url = preg_replace_callback('|%[a-fA-F0-9][a-fA-F0-9]|', 'lowercase_octets', $requested_url);
}
@@ -392,7 +391,7 @@ function redirect_guess_404_permalink() {
if ( !get_query_var('name') )
return false;
- $where = $wpdb->prepare("post_name LIKE %s", get_query_var('name') . '%');
+ $where = $wpdb->prepare("post_name LIKE %s", like_escape( get_query_var('name') ) . '%');
// if any of post_type, year, monthnum, or day are set, use them to refine the query
if ( get_query_var('post_type') )
diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php
index 57a7cd78..7d8a00d7 100644
--- a/wp-includes/capabilities.php
+++ b/wp-includes/capabilities.php
@@ -471,9 +471,10 @@ class WP_User {
*
* @param int|string $id User's ID or username
* @param int $name Optional. User's username
+ * @param int $blog_id Optional Blog ID, defaults to current blog.
* @return WP_User
*/
- function WP_User( $id, $name = '' ) {
+ function WP_User( $id, $name = '', $blog_id = '' ) {
if ( empty( $id ) && empty( $name ) )
return;
@@ -496,7 +497,7 @@ class WP_User {
}
$this->id = $this->ID;
- $this->_init_caps();
+ $this->for_blog( $blog_id );
}
/**
@@ -604,6 +605,10 @@ class WP_User {
function set_role( $role ) {
foreach ( (array) $this->roles as $oldrole )
unset( $this->caps[$oldrole] );
+
+ if ( 1 == count( $this->roles ) && $role == $this->roles[0] )
+ return;
+
if ( !empty( $role ) ) {
$this->caps[$role] = true;
$this->roles = array( $role => true );
@@ -736,6 +741,7 @@ class WP_User {
// Must have ALL requested caps
$capabilities = apply_filters( 'user_has_cap', $this->allcaps, $caps, $args );
+ $capabilities['exist'] = true; // Everyone is allowed to exist
foreach ( (array) $caps as $cap ) {
//echo "Checking cap $cap
";
if ( empty( $capabilities[$cap] ) || !$capabilities[$cap] )
@@ -815,19 +821,23 @@ function map_meta_cap( $cap, $user_id ) {
$caps[] = 'edit_users'; // Explicit due to primitive fall through
break;
case 'delete_post':
+ case 'delete_page':
$author_data = get_userdata( $user_id );
- //echo "post ID: {$args[0]}
";
$post = get_post( $args[0] );
$post_type = get_post_type_object( $post->post_type );
- if ( $post_type && 'post' != $post_type->capability_type ) {
- $args = array_merge( array( $post_type->cap->delete_post, $user_id ), $args );
- return call_user_func_array( 'map_meta_cap', $args );
+
+ if ( ! $post_type->map_meta_cap ) {
+ $caps[] = $post_type->cap->$cap;
+ // Prior to 3.1 we would re-call map_meta_cap here.
+ if ( 'delete_post' == $cap )
+ $cap = $post_type->cap->$cap;
+ break;
}
if ( '' != $post->post_author ) {
$post_author_data = get_userdata( $post->post_author );
} else {
- //No author set yet so default to current user for cap checks
+ // No author set yet, so default to current user for cap checks.
$post_author_data = $author_data;
}
@@ -835,157 +845,107 @@ function map_meta_cap( $cap, $user_id ) {
if ( is_object( $post_author_data ) && $user_id == $post_author_data->ID ) {
// If the post is published...
if ( 'publish' == $post->post_status ) {
- $caps[] = 'delete_published_posts';
+ $caps[] = $post_type->cap->delete_published_posts;
} elseif ( 'trash' == $post->post_status ) {
if ('publish' == get_post_meta($post->ID, '_wp_trash_meta_status', true) )
- $caps[] = 'delete_published_posts';
+ $caps[] = $post_type->cap->delete_published_posts;
} else {
// If the post is draft...
- $caps[] = 'delete_posts';
+ $caps[] = $post_type->cap->delete_posts;
}
} else {
// The user is trying to edit someone else's post.
- $caps[] = 'delete_others_posts';
+ $caps[] = $post_type->cap->delete_others_posts;
// The post is published, extra cap required.
if ( 'publish' == $post->post_status )
- $caps[] = 'delete_published_posts';
+ $caps[] = $post_type->cap->delete_published_posts;
elseif ( 'private' == $post->post_status )
- $caps[] = 'delete_private_posts';
- }
- break;
- case 'delete_page':
- $author_data = get_userdata( $user_id );
- //echo "post ID: {$args[0]}
";
- $page = get_page( $args[0] );
- $page_author_data = get_userdata( $page->post_author );
- //echo "current user id : $user_id, page author id: " . $page_author_data->ID . "
";
- // If the user is the author...
-
- if ('' != $page->post_author) {
- $page_author_data = get_userdata( $page->post_author );
- } else {
- //No author set yet so default to current user for cap checks
- $page_author_data = $author_data;
- }
-
- if ( is_object( $page_author_data ) && $user_id == $page_author_data->ID ) {
- // If the page is published...
- if ( $page->post_status == 'publish' ) {
- $caps[] = 'delete_published_pages';
- } elseif ( 'trash' == $page->post_status ) {
- if ('publish' == get_post_meta($page->ID, '_wp_trash_meta_status', true) )
- $caps[] = 'delete_published_pages';
- } else {
- // If the page is draft...
- $caps[] = 'delete_pages';
- }
- } else {
- // The user is trying to edit someone else's page.
- $caps[] = 'delete_others_pages';
- // The page is published, extra cap required.
- if ( $page->post_status == 'publish' )
- $caps[] = 'delete_published_pages';
- elseif ( $page->post_status == 'private' )
- $caps[] = 'delete_private_pages';
+ $caps[] = $post_type->cap->delete_private_posts;
}
break;
// edit_post breaks down to edit_posts, edit_published_posts, or
// edit_others_posts
case 'edit_post':
+ case 'edit_page':
$author_data = get_userdata( $user_id );
- //echo "post ID: {$args[0]}
";
$post = get_post( $args[0] );
$post_type = get_post_type_object( $post->post_type );
- if ( $post_type && 'post' != $post_type->capability_type ) {
- $args = array_merge( array( $post_type->cap->edit_post, $user_id ), $args );
- return call_user_func_array( 'map_meta_cap', $args );
+
+ if ( ! $post_type->map_meta_cap ) {
+ $caps[] = $post_type->cap->$cap;
+ // Prior to 3.1 we would re-call map_meta_cap here.
+ if ( 'edit_post' == $cap )
+ $cap = $post_type->cap->$cap;
+ break;
}
- $post_author_data = get_userdata( $post->post_author );
+
+ if ( '' != $post->post_author ) {
+ $post_author_data = get_userdata( $post->post_author );
+ } else {
+ // No author set yet, so default to current user for cap checks.
+ $post_author_data = $author_data;
+ }
+
//echo "current user id : $user_id, post author id: " . $post_author_data->ID . "
";
// If the user is the author...
if ( is_object( $post_author_data ) && $user_id == $post_author_data->ID ) {
// If the post is published...
if ( 'publish' == $post->post_status ) {
- $caps[] = 'edit_published_posts';
+ $caps[] = $post_type->cap->edit_published_posts;
} elseif ( 'trash' == $post->post_status ) {
if ('publish' == get_post_meta($post->ID, '_wp_trash_meta_status', true) )
- $caps[] = 'edit_published_posts';
+ $caps[] = $post_type->cap->edit_published_posts;
} else {
// If the post is draft...
- $caps[] = 'edit_posts';
+ $caps[] = $post_type->cap->edit_posts;
}
} else {
// The user is trying to edit someone else's post.
- $caps[] = 'edit_others_posts';
+ $caps[] = $post_type->cap->edit_others_posts;
// The post is published, extra cap required.
if ( 'publish' == $post->post_status )
- $caps[] = 'edit_published_posts';
+ $caps[] = $post_type->cap->edit_published_posts;
elseif ( 'private' == $post->post_status )
- $caps[] = 'edit_private_posts';
- }
- break;
- case 'edit_page':
- $author_data = get_userdata( $user_id );
- //echo "post ID: {$args[0]}
";
- $page = get_page( $args[0] );
- $page_author_data = get_userdata( $page->post_author );
- //echo "current user id : $user_id, page author id: " . $page_author_data->ID . "
";
- // If the user is the author...
- if ( is_object( $page_author_data ) && $user_id == $page_author_data->ID ) {
- // If the page is published...
- if ( 'publish' == $page->post_status ) {
- $caps[] = 'edit_published_pages';
- } elseif ( 'trash' == $page->post_status ) {
- if ('publish' == get_post_meta($page->ID, '_wp_trash_meta_status', true) )
- $caps[] = 'edit_published_pages';
- } else {
- // If the page is draft...
- $caps[] = 'edit_pages';
- }
- } else {
- // The user is trying to edit someone else's page.
- $caps[] = 'edit_others_pages';
- // The page is published, extra cap required.
- if ( 'publish' == $page->post_status )
- $caps[] = 'edit_published_pages';
- elseif ( 'private' == $page->post_status )
- $caps[] = 'edit_private_pages';
+ $caps[] = $post_type->cap->edit_private_posts;
}
break;
case 'read_post':
+ case 'read_page':
+ $author_data = get_userdata( $user_id );
$post = get_post( $args[0] );
$post_type = get_post_type_object( $post->post_type );
- if ( $post_type && 'post' != $post_type->capability_type ) {
- $args = array_merge( array( $post_type->cap->read_post, $user_id ), $args );
- return call_user_func_array( 'map_meta_cap', $args );
+
+ if ( ! $post_type->map_meta_cap ) {
+ $caps[] = $post_type->cap->$cap;
+ // Prior to 3.1 we would re-call map_meta_cap here.
+ if ( 'read_post' == $cap )
+ $cap = $post_type->cap->$cap;
+ break;
}
if ( 'private' != $post->post_status ) {
- $caps[] = 'read';
+ $caps[] = $post_type->cap->read;
break;
}
- $author_data = get_userdata( $user_id );
- $post_author_data = get_userdata( $post->post_author );
+ if ( '' != $post->post_author ) {
+ $post_author_data = get_userdata( $post->post_author );
+ } else {
+ // No author set yet, so default to current user for cap checks.
+ $post_author_data = $author_data;
+ }
+
if ( is_object( $post_author_data ) && $user_id == $post_author_data->ID )
- $caps[] = 'read';
+ $caps[] = $post_type->cap->read;
else
- $caps[] = 'read_private_posts';
+ $caps[] = $post_type->cap->read_private_posts;
break;
- case 'read_page':
- $page = get_page( $args[0] );
+ case 'edit_comment':
+ $comment = get_comment( $args[0] );
+ $post = get_post( $comment->comment_post_ID );
+ $post_type_object = get_post_type_object( $post->post_type );
- if ( 'private' != $page->post_status ) {
- $caps[] = 'read';
- break;
- }
-
- $author_data = get_userdata( $user_id );
- $page_author_data = get_userdata( $page->post_author );
- if ( is_object( $page_author_data ) && $user_id == $page_author_data->ID )
- $caps[] = 'read';
- else
- $caps[] = 'read_private_pages';
+ $caps = map_meta_cap( $post_type_object->cap->edit_post, $user_id, $post->ID );
break;
case 'unfiltered_upload':
if ( defined('ALLOW_UNFILTERED_UPLOADS') && ALLOW_UNFILTERED_UPLOADS && ( !is_multisite() || is_super_admin( $user_id ) ) )
@@ -1034,12 +994,21 @@ function map_meta_cap( $cap, $user_id ) {
}
break;
case 'create_users':
- if ( is_multisite() && !get_site_option( 'add_new_users' ) )
- $caps[] = 'do_not_allow';
- else
+ if ( !is_multisite() )
+ $caps[] = $cap;
+ elseif ( is_super_admin() || get_site_option( 'add_new_users' ) )
$caps[] = $cap;
+ else
+ $caps[] = 'do_not_allow';
break;
default:
+ // Handle meta capabilities for custom post types.
+ $post_type_meta_caps = _post_type_meta_capabilities();
+ if ( isset( $post_type_meta_caps[ $cap ] ) ) {
+ $args = array_merge( array( $post_type_meta_caps[ $cap ], $user_id ), $args );
+ return call_user_func_array( 'map_meta_cap', $args );
+ }
+
// If no meta caps match, return the original cap.
$caps[] = $cap;
}
@@ -1118,6 +1087,28 @@ function author_can( $post, $capability ) {
return call_user_func_array( array( &$author, 'has_cap' ), $args );
}
+/**
+ * Whether a particular user has capability or role.
+ *
+ * @since 3.1.0
+ *
+ * @param int|object $user User ID or object.
+ * @param string $capability Capability or role name.
+ * @return bool
+ */
+function user_can( $user, $capability ) {
+ if ( ! is_object( $user ) )
+ $user = new WP_User( $user );
+
+ if ( ! $user || ! $user->ID )
+ return false;
+
+ $args = array_slice( func_get_args(), 2 );
+ $args = array_merge( array( $capability ), $args );
+
+ return call_user_func_array( array( &$user, 'has_cap' ), $args );
+}
+
/**
* Retrieve role object.
*
@@ -1144,7 +1135,7 @@ function get_role( $role ) {
*
* @param string $role Role name.
* @param string $display_name Display name for role.
- * @param array $capabilities List of capabilities.
+ * @param array $capabilities List of capabilities, e.g. array( 'edit_posts' => true, 'delete_posts' => false );
* @return null|WP_Role WP_Role object if role is added, null if already exists.
*/
function add_role( $role, $display_name, $capabilities = array() ) {
@@ -1201,16 +1192,14 @@ function get_super_admins() {
* @return bool True if the user is a site admin.
*/
function is_super_admin( $user_id = false ) {
- if ( ! $user_id ) {
- $current_user = wp_get_current_user();
- $user_id = ! empty($current_user) ? $current_user->id : 0;
- }
+ if ( $user_id )
+ $user = new WP_User( $user_id );
+ else
+ $user = wp_get_current_user();
- if ( ! $user_id )
+ if ( empty( $user->id ) )
return false;
- $user = new WP_User($user_id);
-
if ( is_multisite() ) {
$super_admins = get_super_admins();
if ( is_array( $super_admins ) && in_array( $user->user_login, $super_admins ) )
diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php
index db55a12c..382488de 100644
--- a/wp-includes/category-template.php
+++ b/wp-includes/category-template.php
@@ -10,32 +10,21 @@
* Retrieve category link URL.
*
* @since 1.0.0
- * @uses apply_filters() Calls 'category_link' filter on category link and category ID.
+ * @see get_term_link()
*
- * @param int $category_id Category ID.
- * @return string
+ * @param int|object $category Category ID or object.
+ * @return string Link on success, empty string if category does not exist.
*/
-function get_category_link( $category_id ) {
- global $wp_rewrite;
- $catlink = $wp_rewrite->get_category_permastruct();
+function get_category_link( $category ) {
+ if ( ! is_object( $category ) )
+ $category = (int) $category;
- if ( empty( $catlink ) ) {
- $catlink = home_url('?cat=' . $category_id);
- } else {
- $category = &get_category( $category_id );
- if ( is_wp_error( $category ) )
- return $category;
- $category_nicename = $category->slug;
-
- if ( $category->parent == $category_id ) // recursive recursion
- $category->parent = 0;
- elseif ($category->parent != 0 )
- $category_nicename = get_category_parents( $category->parent, false, '/', true ) . $category_nicename;
-
- $catlink = str_replace( '%category%', $category_nicename, $catlink );
- $catlink = home_url( user_trailingslashit( $catlink, 'category' ) );
- }
- return apply_filters( 'category_link', $catlink, $category_id );
+ $category = get_term_link( $category, 'category' );
+
+ if ( is_wp_error( $category ) )
+ return '';
+
+ return $category;
}
/**
@@ -59,7 +48,7 @@ function get_category_parents( $id, $link = false, $separator = '/', $nicename =
if ( $nicename )
$name = $parent->slug;
else
- $name = $parent->cat_name;
+ $name = $parent->name;
if ( $parent->parent && ( $parent->parent != $parent->term_id ) && !in_array( $parent->parent, $visited ) ) {
$visited[] = $parent->parent;
@@ -67,7 +56,7 @@ function get_category_parents( $id, $link = false, $separator = '/', $nicename =
}
if ( $link )
- $chain .= '
cat_name ) ) . '">'.$name.' ' . $separator;
+ $chain .= '
name ) ) . '">'.$name.' ' . $separator;
else
$chain .= $name.$separator;
return $chain;
@@ -83,28 +72,18 @@ function get_category_parents( $id, $link = false, $separator = '/', $nicename =
* @return array
*/
function get_the_category( $id = false ) {
- global $post;
-
- $id = (int) $id;
- if ( !$id )
- $id = (int) $post->ID;
-
- $categories = get_object_term_cache( $id, 'category' );
- if ( false === $categories ) {
- $categories = wp_get_object_terms( $id, 'category' );
- wp_cache_add($id, $categories, 'category_relationships');
- }
-
- if ( !empty( $categories ) )
- usort( $categories, '_usort_terms_by_name' );
- else
+ $categories = get_the_terms( $id, 'category' );
+ if ( ! $categories )
$categories = array();
- foreach ( (array) array_keys( $categories ) as $key ) {
+ $categories = array_values( $categories );
+
+ foreach ( array_keys( $categories ) as $key ) {
_make_cat_compat( $categories[$key] );
}
- return $categories;
+ // Filter name is plural because we return alot of categories not just one
+ return apply_filters( 'get_the_categories', $categories );
}
/**
@@ -202,7 +181,7 @@ function get_the_category_list( $separator = '', $parents='', $post_id = false )
break;
case '':
default:
- $thelist .= '
name ) ) . '" ' . $rel . '>' . $category->cat_name.' ';
+ $thelist .= '
name ) ) . '" ' . $rel . '>' . $category->name.' ';
}
}
$thelist .= '';
@@ -215,13 +194,13 @@ function get_the_category_list( $separator = '', $parents='', $post_id = false )
case 'multiple':
if ( $category->parent )
$thelist .= get_category_parents( $category->parent, true, $separator );
- $thelist .= '
name ) ) . '" ' . $rel . '>' . $category->cat_name.' ';
+ $thelist .= '
name ) ) . '" ' . $rel . '>' . $category->name.' ';
break;
case 'single':
$thelist .= '
name ) ) . '" ' . $rel . '>';
if ( $category->parent )
$thelist .= get_category_parents( $category->parent, false, $separator );
- $thelist .= "$category->cat_name ";
+ $thelist .= "$category->name";
break;
case '':
default:
@@ -248,29 +227,15 @@ function get_the_category_list( $separator = '', $parents='', $post_id = false )
*
* @since 1.2.0
*
- * @uses is_object_in_term()
- *
- * @param int|string|array $category. Category ID, name or slug, or array of said.
- * @param int|post object Optional. Post to check instead of the current post. @since 2.7.0
+ * @param int|string|array $category Category ID, name or slug, or array of said.
+ * @param int|object $_post Optional. Post to check instead of the current post. (since 2.7.0)
* @return bool True if the current post is in any of the given categories.
*/
-function in_category( $category, $_post = null ) {
+function in_category( $category, $post = null ) {
if ( empty( $category ) )
return false;
- if ( $_post ) {
- $_post = get_post( $_post );
- } else {
- $_post =& $GLOBALS['post'];
- }
-
- if ( !$_post )
- return false;
-
- $r = is_object_in_term( $_post->ID, 'category', $category );
- if ( is_wp_error( $r ) )
- return false;
- return $r;
+ return has_term( $category, 'category', $post );
}
/**
@@ -489,7 +454,7 @@ function wp_list_categories( $args = '' ) {
$output = '';
if ( $title_li && 'list' == $style )
- $output = '
' . $title_li . '';
+ $output = '' . $title_li . '';
if ( empty( $categories ) ) {
if ( ! empty( $show_option_none ) ) {
@@ -499,16 +464,17 @@ function wp_list_categories( $args = '' ) {
$output .= $show_option_none;
}
} else {
- global $wp_query;
-
if( !empty( $show_option_all ) )
if ( 'list' == $style )
$output .= '' . $show_option_all . ' ';
else
$output .= '' . $show_option_all . ' ';
- if ( empty( $r['current_category'] ) && ( is_category() || is_tax() ) )
- $r['current_category'] = $wp_query->get_queried_object_id();
+ if ( empty( $r['current_category'] ) && ( is_category() || is_tax() || is_tag() ) ) {
+ $current_term_object = get_queried_object();
+ if ( $r['taxonomy'] == $current_term_object->taxonomy )
+ $r['current_category'] = get_queried_object_id();
+ }
if ( $hierarchical )
$depth = $r['depth'];
@@ -572,9 +538,9 @@ function wp_tag_cloud( $args = '' ) {
foreach ( $tags as $key => $tag ) {
if ( 'edit' == $args['link'] )
- $link = get_edit_tag_link( $tag->term_id, $args['taxonomy'] );
+ $link = get_edit_tag_link( $tag->term_id, $tag->taxonomy );
else
- $link = get_term_link( intval($tag->term_id), $args['taxonomy'] );
+ $link = get_term_link( intval($tag->term_id), $tag->taxonomy );
if ( is_wp_error( $link ) )
return false;
@@ -712,7 +678,7 @@ function wp_generate_tag_cloud( $tags, $args = '' ) {
$tag_link = '#' != $tag->link ? esc_url( $tag->link ) : '#';
$tag_id = isset($tags[ $key ]->id) ? $tags[ $key ]->id : $key;
$tag_name = $tags[ $key ]->name;
- $a[] = "$tag_name ";
}
@@ -731,12 +697,32 @@ function wp_generate_tag_cloud( $tags, $args = '' ) {
break;
endswitch;
- if ( $filter )
+ if ( $filter )
return apply_filters( 'wp_generate_tag_cloud', $return, $tags, $args );
- else
+ else
return $return;
}
+/**
+ * Callback for comparing tags based on name
+ *
+ * @since 3.1.0
+ * @access private
+ */
+function _wp_tag_cloud_name_sort_cb( $a, $b ) {
+ return strnatcasecmp( $a->name, $b->name );
+}
+
+/**
+ * Callback for comparing tags based on count
+ *
+ * @since 3.1.0
+ * @access private
+ */
+function _wp_tag_cloud_count_sort_cb( $a, $b ) {
+ return ( $a->count > $b->count );
+}
+
//
// Helper functions
//
@@ -777,6 +763,205 @@ function walk_category_dropdown_tree() {
return call_user_func_array(array( &$walker, 'walk' ), $args );
}
+/**
+ * Create HTML list of categories.
+ *
+ * @package WordPress
+ * @since 2.1.0
+ * @uses Walker
+ */
+class Walker_Category extends Walker {
+ /**
+ * @see Walker::$tree_type
+ * @since 2.1.0
+ * @var string
+ */
+ var $tree_type = 'category';
+
+ /**
+ * @see Walker::$db_fields
+ * @since 2.1.0
+ * @todo Decouple this
+ * @var array
+ */
+ var $db_fields = array ('parent' => 'parent', 'id' => 'term_id');
+
+ /**
+ * @see Walker::start_lvl()
+ * @since 2.1.0
+ *
+ * @param string $output Passed by reference. Used to append additional content.
+ * @param int $depth Depth of category. Used for tab indentation.
+ * @param array $args Will only append content if style argument value is 'list'.
+ */
+ function start_lvl(&$output, $depth, $args) {
+ if ( 'list' != $args['style'] )
+ return;
+
+ $indent = str_repeat("\t", $depth);
+ $output .= "$indent\n";
+ }
+
+ /**
+ * @see Walker::end_lvl()
+ * @since 2.1.0
+ *
+ * @param string $output Passed by reference. Used to append additional content.
+ * @param int $depth Depth of category. Used for tab indentation.
+ * @param array $args Will only append content if style argument value is 'list'.
+ */
+ function end_lvl(&$output, $depth, $args) {
+ if ( 'list' != $args['style'] )
+ return;
+
+ $indent = str_repeat("\t", $depth);
+ $output .= "$indent \n";
+ }
+
+ /**
+ * @see Walker::start_el()
+ * @since 2.1.0
+ *
+ * @param string $output Passed by reference. Used to append additional content.
+ * @param object $category Category data object.
+ * @param int $depth Depth of category in reference to parents.
+ * @param array $args
+ */
+ function start_el(&$output, $category, $depth, $args) {
+ extract($args);
+
+ $cat_name = esc_attr( $category->name );
+ $cat_name = apply_filters( 'list_cats', $cat_name, $category );
+ $link = 'description) )
+ $link .= 'title="' . esc_attr( sprintf(__( 'View all posts filed under %s' ), $cat_name) ) . '"';
+ else
+ $link .= 'title="' . esc_attr( strip_tags( apply_filters( 'category_description', $category->description, $category ) ) ) . '"';
+ $link .= '>';
+ $link .= $cat_name . ' ';
+
+ if ( !empty($feed_image) || !empty($feed) ) {
+ $link .= ' ';
+
+ if ( empty($feed_image) )
+ $link .= '(';
+
+ $link .= ' ';
+
+ $link .= '';
+
+ if ( empty($feed_image) )
+ $link .= ')';
+ }
+
+ if ( !empty($show_count) )
+ $link .= ' (' . intval($category->count) . ')';
+
+ if ( !empty($show_date) )
+ $link .= ' ' . gmdate('Y-m-d', $category->last_update_timestamp);
+
+ if ( 'list' == $args['style'] ) {
+ $output .= "\tterm_id;
+ if ( !empty($current_category) ) {
+ $_current_category = get_term( $current_category, $category->taxonomy );
+ if ( $category->term_id == $current_category )
+ $class .= ' current-cat';
+ elseif ( $category->term_id == $_current_category->parent )
+ $class .= ' current-cat-parent';
+ }
+ $output .= ' class="' . $class . '"';
+ $output .= ">$link\n";
+ } else {
+ $output .= "\t$link \n";
+ }
+ }
+
+ /**
+ * @see Walker::end_el()
+ * @since 2.1.0
+ *
+ * @param string $output Passed by reference. Used to append additional content.
+ * @param object $page Not used.
+ * @param int $depth Depth of category. Not used.
+ * @param array $args Only uses 'list' for whether should append to output.
+ */
+ function end_el(&$output, $page, $depth, $args) {
+ if ( 'list' != $args['style'] )
+ return;
+
+ $output .= " \n";
+ }
+
+}
+
+/**
+ * Create HTML dropdown list of Categories.
+ *
+ * @package WordPress
+ * @since 2.1.0
+ * @uses Walker
+ */
+class Walker_CategoryDropdown extends Walker {
+ /**
+ * @see Walker::$tree_type
+ * @since 2.1.0
+ * @var string
+ */
+ var $tree_type = 'category';
+
+ /**
+ * @see Walker::$db_fields
+ * @since 2.1.0
+ * @todo Decouple this
+ * @var array
+ */
+ var $db_fields = array ('parent' => 'parent', 'id' => 'term_id');
+
+ /**
+ * @see Walker::start_el()
+ * @since 2.1.0
+ *
+ * @param string $output Passed by reference. Used to append additional content.
+ * @param object $category Category data object.
+ * @param int $depth Depth of category. Used for padding.
+ * @param array $args Uses 'selected', 'show_count', and 'show_last_update' keys, if they exist.
+ */
+ function start_el(&$output, $category, $depth, $args) {
+ $pad = str_repeat(' ', $depth * 3);
+
+ $cat_name = apply_filters('list_cats', $category->name, $category);
+ $output .= "\tterm_id."\"";
+ if ( $category->term_id == $args['selected'] )
+ $output .= ' selected="selected"';
+ $output .= '>';
+ $output .= $pad.$cat_name;
+ if ( $args['show_count'] )
+ $output .= ' ('. $category->count .')';
+ if ( $args['show_last_update'] ) {
+ $format = 'Y-m-d';
+ $output .= ' ' . gmdate($format, $category->last_update_timestamp);
+ }
+ $output .= " \n";
+ }
+}
+
//
// Tags
//
@@ -785,28 +970,21 @@ function walk_category_dropdown_tree() {
* Retrieve the link to the tag.
*
* @since 2.3.0
- * @uses apply_filters() Calls 'tag_link' with tag link and tag ID as parameters.
+ * @see get_term_link()
*
- * @param int $tag_id Tag (term) ID.
- * @return string
+ * @param int|object $tag Tag ID or object.
+ * @return string Link on success, empty string if tag does not exist.
*/
-function get_tag_link( $tag_id ) {
- global $wp_rewrite;
- $taglink = $wp_rewrite->get_tag_permastruct();
+function get_tag_link( $tag ) {
+ if ( ! is_object( $tag ) )
+ $tag = (int) $tag;
+
+ $tag = get_term_link( $tag, 'post_tag' );
- $tag = &get_term( $tag_id, 'post_tag' );
if ( is_wp_error( $tag ) )
- return $tag;
- $slug = $tag->slug;
+ return '';
- if ( empty( $taglink ) ) {
- $file = get_option( 'home' ) . '/';
- $taglink = $file . '?tag=' . $slug;
- } else {
- $taglink = str_replace( '%tag%', $slug, $taglink );
- $taglink = get_option( 'home' ) . user_trailingslashit( $taglink, 'category' );
- }
- return apply_filters( 'tag_link', $taglink, $tag_id );
+ return $tag;
}
/**
@@ -875,8 +1053,7 @@ function tag_description( $tag = 0 ) {
*/
function term_description( $term = 0, $taxonomy = 'post_tag' ) {
if ( !$term && ( is_tax() || is_tag() || is_category() ) ) {
- global $wp_query;
- $term = $wp_query->get_queried_object();
+ $term = get_queried_object();
$taxonomy = $term->taxonomy;
$term = $term->term_id;
}
@@ -908,8 +1085,12 @@ function get_the_terms( $id = 0, $taxonomy ) {
}
$terms = get_object_term_cache( $id, $taxonomy );
- if ( false === $terms )
+ if ( false === $terms ) {
$terms = wp_get_object_terms( $id, $taxonomy );
+ wp_cache_add($id, $terms, $taxonomy . '_relationships');
+ }
+
+ $terms = apply_filters( 'get_the_terms', $terms, $id, $taxonomy );
if ( empty( $terms ) )
return false;
@@ -955,14 +1136,14 @@ function get_the_term_list( $id = 0, $taxonomy, $before = '', $sep = '', $after
*
* @since 2.5.0
*
- * @param int $id Term ID.
+ * @param int $id Post ID.
* @param string $taxonomy Taxonomy name.
* @param string $before Optional. Before list.
* @param string $sep Optional. Separate items using this.
* @param string $after Optional. After list.
* @return null|bool False on WordPress error. Returns null when displaying.
*/
-function the_terms( $id, $taxonomy, $before = '', $sep = ', ', $after = '' ) {
+function the_terms( $id = 0, $taxonomy, $before = '', $sep = ', ', $after = '' ) {
$term_list = get_the_term_list( $id, $taxonomy, $before, $sep, $after );
if ( is_wp_error( $term_list ) )
@@ -971,6 +1152,20 @@ function the_terms( $id, $taxonomy, $before = '', $sep = ', ', $after = '' ) {
echo apply_filters('the_terms', $term_list, $taxonomy, $before, $sep, $after);
}
+
+/**
+ * Check if the current post has any of given category.
+ *
+ * @since 3.1.0
+ *
+ * @param string|int|array $tag Optional. The category name/term_id/slug or array of them to check for.
+ * @param int|object $post Optional. Post to check instead of the current post.
+ * @return bool True if the current post has any of the given categories (or any category, if no category specified).
+ */
+function has_category( $category = '', $post = null ) {
+ return has_term( $category, 'category', $post );
+}
+
/**
* Check if the current post has any of given tags.
*
@@ -984,26 +1179,39 @@ function the_terms( $id, $taxonomy, $before = '', $sep = ', ', $after = '' ) {
*
* @since 2.6.0
*
- * @uses is_object_in_term()
- *
* @param string|int|array $tag Optional. The tag name/term_id/slug or array of them to check for.
- * @param int|post object Optional. Post to check instead of the current post. @since 2.7.0
- * @return bool True if the current post has any of the the given tags (or any tag, if no tag specified).
+ * @param int|object $post Optional. Post to check instead of the current post. (since 2.7.0)
+ * @return bool True if the current post has any of the given tags (or any tag, if no tag specified).
*/
-function has_tag( $tag = '', $_post = null ) {
- if ( $_post ) {
- $_post = get_post( $_post );
- } else {
- $_post =& $GLOBALS['post'];
- }
+function has_tag( $tag = '', $post = null ) {
+ return has_term( $tag, 'post_tag', $post );
+}
- if ( !$_post )
+/**
+ * Check if the current post has any of given terms.
+ *
+ * The given terms are checked against the post's terms' term_ids, names and slugs.
+ * Terms given as integers will only be checked against the post's terms' term_ids.
+ * If no terms are given, determines if post has any terms.
+ *
+ * @since 3.1.0
+ *
+ * @param string|int|array $term Optional. The term name/term_id/slug or array of them to check for.
+ * @param string $taxonomy Taxonomy name
+ * @param int|object $post Optional. Post to check instead of the current post.
+ * @return bool True if the current post has any of the given tags (or any tag, if no tag specified).
+ */
+function has_term( $term = '', $taxonomy = '', $post = null ) {
+ $post = get_post($post);
+
+ if ( !$post )
return false;
- $r = is_object_in_term( $_post->ID, 'post_tag', $tag );
+ $r = is_object_in_term( $post->ID, $taxonomy, $term );
if ( is_wp_error( $r ) )
return false;
+
return $r;
}
-?>
\ No newline at end of file
+?>
diff --git a/wp-includes/category.php b/wp-includes/category.php
index 1f665185..4d022774 100644
--- a/wp-includes/category.php
+++ b/wp-includes/category.php
@@ -305,22 +305,6 @@ function &get_tag( $tag, $output = OBJECT, $filter = 'raw' ) {
/* Cache */
-/**
- * Update the categories cache.
- *
- * This function does not appear to be used anymore or does not appear to be
- * needed. It might be a legacy function left over from when there was a need
- * for updating the category cache.
- *
- * @since 1.5.0
- *
- * @return bool Always return True
- */
-function update_category_cache() {
- return true;
-}
-
-
/**
* Remove the category cache data based on ID.
*
diff --git a/wp-includes/class-IXR.php b/wp-includes/class-IXR.php
index 49f80b0c..9d89f0c5 100644
--- a/wp-includes/class-IXR.php
+++ b/wp-includes/class-IXR.php
@@ -1,16 +1,42 @@
data = $data;
if (!$type) {
$type = $this->calculateType();
}
$this->type = $type;
if ($type == 'struct') {
- /* Turn all the values in the array in to new IXR_Value objects */
+ // Turn all the values in the array in to new IXR_Value objects
foreach ($this->data as $key => $value) {
$this->data[$key] = new IXR_Value($value);
}
@@ -42,7 +69,8 @@ class IXR_Value {
}
}
- function calculateType() {
+ function calculateType()
+ {
if ($this->data === true || $this->data === false) {
return 'boolean';
}
@@ -52,6 +80,7 @@ class IXR_Value {
if (is_double($this->data)) {
return 'double';
}
+
// Deal with IXR object types base64 and date
if (is_object($this->data) && is_a($this->data, 'IXR_Date')) {
return 'date';
@@ -59,16 +88,17 @@ class IXR_Value {
if (is_object($this->data) && is_a($this->data, 'IXR_Base64')) {
return 'base64';
}
+
// If it is a normal PHP object convert it in to a struct
if (is_object($this->data)) {
-
$this->data = get_object_vars($this->data);
return 'struct';
}
if (!is_array($this->data)) {
return 'string';
}
- /* We have an array - is it an array or a struct ? */
+
+ // We have an array - is it an array or a struct?
if ($this->isStruct($this->data)) {
return 'struct';
} else {
@@ -76,8 +106,9 @@ class IXR_Value {
}
}
- function getXml() {
- /* Return XML for this value */
+ function getXml()
+ {
+ // Return XML for this value
switch ($this->type) {
case 'boolean':
return ''.(($this->data) ? '1' : '0').' ';
@@ -117,8 +148,14 @@ class IXR_Value {
return false;
}
- function isStruct($array) {
- /* Nasty function to check if an array is a struct or not */
+ /**
+ * Checks whether or not the supplied array is a struct or not
+ *
+ * @param unknown_type $array
+ * @return boolean
+ */
+ function isStruct($array)
+ {
$expected = 0;
foreach ($array as $key => $value) {
if ((string)$key != (string)$expected) {
@@ -131,18 +168,21 @@ class IXR_Value {
}
/**
- * IXR_Message
+ * IXR_MESSAGE
*
* @package IXR
* @since 1.5
+ *
*/
-class IXR_Message {
+class IXR_Message
+{
var $message;
var $messageType; // methodCall / methodResponse / fault
var $faultCode;
var $faultString;
var $methodName;
var $params;
+
// Current variable stacks
var $_arraystructs = array(); // The stack used to keep track of the current array/struct
var $_arraystructstypes = array(); // Stack keeping track of if things are structs or array
@@ -153,44 +193,55 @@ class IXR_Message {
var $_currentTagContents;
// The XML parser
var $_parser;
- function IXR_Message (&$message) {
- $this->message = &$message;
- }
- function parse() {
- // first remove the XML declaration
- // this method avoids the RAM usage of preg_replace on very large messages
- $header = preg_replace( '/<\?xml.*?\?'.'>/', '', substr( $this->message, 0, 100 ), 1 );
- $this->message = substr_replace($this->message, $header, 0, 100);
+
+ function IXR_Message($message)
+ {
+ $this->message =& $message;
+ }
+
+ function parse()
+ {
+ // first remove the XML declaration
+ // merged from WP #10698 - this method avoids the RAM usage of preg_replace on very large messages
+ $header = preg_replace( '/<\?xml.*?\?'.'>/', '', substr($this->message, 0, 100), 1);
+ $this->message = substr_replace($this->message, $header, 0, 100);
if (trim($this->message) == '') {
return false;
- }
+ }
$this->_parser = xml_parser_create();
// Set XML parser to take the case of tags in to account
xml_parser_set_option($this->_parser, XML_OPTION_CASE_FOLDING, false);
// Set XML parser callback functions
xml_set_object($this->_parser, $this);
xml_set_element_handler($this->_parser, 'tag_open', 'tag_close');
- xml_set_character_data_handler($this->_parser, 'cdata');
- $chunk_size = 262144; // 256Kb, parse in chunks to avoid the RAM usage on very large messages
- do {
- if ( strlen($this->message) <= $chunk_size )
- $final=true;
- $part = substr( $this->message, 0, $chunk_size );
- $this->message = substr( $this->message, $chunk_size );
- if ( !xml_parse( $this->_parser, $part, $final ) )
- return false;
- if ( $final )
- break;
- } while ( true );
- xml_parser_free($this->_parser);
+ xml_set_character_data_handler($this->_parser, 'cdata');
+ $chunk_size = 262144; // 256Kb, parse in chunks to avoid the RAM usage on very large messages
+ $final = false;
+ do {
+ if (strlen($this->message) <= $chunk_size) {
+ $final = true;
+ }
+ $part = substr($this->message, 0, $chunk_size);
+ $this->message = substr($this->message, $chunk_size);
+ if (!xml_parse($this->_parser, $part, $final)) {
+ return false;
+ }
+ if ($final) {
+ break;
+ }
+ } while (true);
+ xml_parser_free($this->_parser);
+
// Grab the error messages, if any
if ($this->messageType == 'fault') {
$this->faultCode = $this->params[0]['faultCode'];
$this->faultString = $this->params[0]['faultString'];
- }
+ }
return true;
}
- function tag_open($parser, $tag, $attr) {
+
+ function tag_open($parser, $tag, $attr)
+ {
$this->_currentTagContents = '';
$this->currentTag = $tag;
switch($tag) {
@@ -199,7 +250,7 @@ class IXR_Message {
case 'fault':
$this->messageType = $tag;
break;
- /* Deal with stacks of arrays and structs */
+ /* Deal with stacks of arrays and structs */
case 'data': // data is to all intents and puposes more interesting than array
$this->_arraystructstypes[] = 'array';
$this->_arraystructs[] = array();
@@ -210,28 +261,31 @@ class IXR_Message {
break;
}
}
- function cdata($parser, $cdata) {
+
+ function cdata($parser, $cdata)
+ {
$this->_currentTagContents .= $cdata;
}
- function tag_close($parser, $tag) {
+
+ function tag_close($parser, $tag)
+ {
$valueFlag = false;
switch($tag) {
case 'int':
case 'i4':
- $value = (int) trim($this->_currentTagContents);
+ $value = (int)trim($this->_currentTagContents);
$valueFlag = true;
break;
case 'double':
- $value = (double) trim($this->_currentTagContents);
+ $value = (double)trim($this->_currentTagContents);
$valueFlag = true;
break;
case 'string':
- $value = $this->_currentTagContents;
+ $value = (string)trim($this->_currentTagContents);
$valueFlag = true;
break;
case 'dateTime.iso8601':
$value = new IXR_Date(trim($this->_currentTagContents));
- // $value = $iso->getTimestamp();
$valueFlag = true;
break;
case 'value':
@@ -242,14 +296,14 @@ class IXR_Message {
}
break;
case 'boolean':
- $value = (boolean) trim($this->_currentTagContents);
+ $value = (boolean)trim($this->_currentTagContents);
$valueFlag = true;
break;
case 'base64':
- $value = base64_decode( trim( $this->_currentTagContents ) );
+ $value = base64_decode($this->_currentTagContents);
$valueFlag = true;
break;
- /* Deal with stacks of arrays and structs */
+ /* Deal with stacks of arrays and structs */
case 'data':
case 'struct':
$value = array_pop($this->_arraystructs);
@@ -266,6 +320,7 @@ class IXR_Message {
$this->methodName = trim($this->_currentTagContents);
break;
}
+
if ($valueFlag) {
if (count($this->_arraystructs) > 0) {
// Add value to struct or array
@@ -291,27 +346,40 @@ class IXR_Message {
* @package IXR
* @since 1.5
*/
-class IXR_Server {
+class IXR_Server
+{
var $data;
var $callbacks = array();
var $message;
var $capabilities;
- function IXR_Server($callbacks = false, $data = false) {
+
+ function IXR_Server($callbacks = false, $data = false, $wait = false)
+ {
$this->setCapabilities();
if ($callbacks) {
$this->callbacks = $callbacks;
}
$this->setCallbacks();
- $this->serve($data);
+ if (!$wait) {
+ $this->serve($data);
+ }
}
- function serve($data = false) {
+
+ function serve($data = false)
+ {
if (!$data) {
+ if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] !== 'POST') {
+ header('Content-Type: text/plain'); // merged from WP #9093
+ die('XML-RPC server accepts POST requests only.');
+ }
+
global $HTTP_RAW_POST_DATA;
- if (!$HTTP_RAW_POST_DATA) {
- header( 'Content-Type: text/plain' );
- die('XML-RPC server accepts POST requests only.');
+ if (empty($HTTP_RAW_POST_DATA)) {
+ // workaround for a bug in PHP 5.2.2 - http://bugs.php.net/bug.php?id=41293
+ $data = file_get_contents('php://input');
+ } else {
+ $data =& $HTTP_RAW_POST_DATA;
}
- $data = &$HTTP_RAW_POST_DATA;
}
$this->message = new IXR_Message($data);
if (!$this->message->parse()) {
@@ -321,75 +389,83 @@ class IXR_Server {
$this->error(-32600, 'server error. invalid xml-rpc. not conforming to spec. Request must be a methodCall');
}
$result = $this->call($this->message->methodName, $this->message->params);
+
// Is the result an error?
if (is_a($result, 'IXR_Error')) {
$this->error($result);
}
+
// Encode the result
$r = new IXR_Value($result);
$resultxml = $r->getXml();
+
// Create the XML
$xml = <<
- $resultxml
+ $resultxml
EOD;
- // Send it
- $this->output($xml);
+ // Send it
+ $this->output($xml);
}
- function call($methodname, $args) {
+
+ function call($methodname, $args)
+ {
if (!$this->hasMethod($methodname)) {
- return new IXR_Error(-32601, 'server error. requested method '.
- $methodname.' does not exist.');
+ return new IXR_Error(-32601, 'server error. requested method '.$methodname.' does not exist.');
}
$method = $this->callbacks[$methodname];
+
// Perform the callback and send the response
if (count($args) == 1) {
// If only one paramater just send that instead of the whole array
$args = $args[0];
}
+
// Are we dealing with a function or a method?
- if ( is_string( $method ) && substr($method, 0, 5) == 'this:' ) {
+ if (is_string($method) && substr($method, 0, 5) == 'this:') {
// It's a class method - check it exists
$method = substr($method, 5);
if (!method_exists($this, $method)) {
- return new IXR_Error(-32601, 'server error. requested class method "'.
- $method.'" does not exist.');
+ return new IXR_Error(-32601, 'server error. requested class method "'.$method.'" does not exist.');
}
- // Call the method
+
+ //Call the method
$result = $this->$method($args);
} else {
// It's a function - does it exist?
if (is_array($method)) {
- if (!method_exists($method[0], $method[1])) {
- return new IXR_Error(-32601, 'server error. requested object method "'.
- $method[1].'" does not exist.');
+ if (!is_callable(array($method[0], $method[1]))) {
+ return new IXR_Error(-32601, 'server error. requested object method "'.$method[1].'" does not exist.');
}
} else if (!function_exists($method)) {
- return new IXR_Error(-32601, 'server error. requested function "'.
- $method.'" does not exist.');
+ return new IXR_Error(-32601, 'server error. requested function "'.$method.'" does not exist.');
}
+
// Call the function
$result = call_user_func($method, $args);
}
return $result;
}
- function error($error, $message = false) {
+ function error($error, $message = false)
+ {
// Accepts either an error object or an error code and message
if ($message && !is_object($error)) {
$error = new IXR_Error($error, $message);
}
$this->output($error->getXml());
}
- function output($xml) {
+
+ function output($xml)
+ {
$xml = ''."\n".$xml;
$length = strlen($xml);
header('Connection: close');
@@ -399,40 +475,52 @@ EOD;
echo $xml;
exit;
}
- function hasMethod($method) {
+
+ function hasMethod($method)
+ {
return in_array($method, array_keys($this->callbacks));
}
- function setCapabilities() {
+
+ function setCapabilities()
+ {
// Initialises capabilities array
$this->capabilities = array(
'xmlrpc' => array(
'specUrl' => 'http://www.xmlrpc.com/spec',
'specVersion' => 1
- ),
+ ),
'faults_interop' => array(
'specUrl' => 'http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php',
'specVersion' => 20010516
- ),
+ ),
'system.multicall' => array(
'specUrl' => 'http://www.xmlrpc.com/discuss/msgReader$1208',
'specVersion' => 1
- ),
+ ),
);
}
- function getCapabilities($args) {
+
+ function getCapabilities($args)
+ {
return $this->capabilities;
}
- function setCallbacks() {
+
+ function setCallbacks()
+ {
$this->callbacks['system.getCapabilities'] = 'this:getCapabilities';
$this->callbacks['system.listMethods'] = 'this:listMethods';
$this->callbacks['system.multicall'] = 'this:multiCall';
}
- function listMethods($args) {
+
+ function listMethods($args)
+ {
// Returns a list of methods - uses array_reverse to ensure user defined
// methods are listed before server defined methods
return array_reverse(array_keys($this->callbacks));
}
- function multiCall($methodcalls) {
+
+ function multiCall($methodcalls)
+ {
// See http://www.xmlrpc.com/discuss/msgReader$1208
$return = array();
foreach ($methodcalls as $call) {
@@ -462,11 +550,14 @@ EOD;
* @package IXR
* @since 1.5
*/
-class IXR_Request {
+class IXR_Request
+{
var $method;
var $args;
var $xml;
- function IXR_Request($method, $args) {
+
+ function IXR_Request($method, $args)
+ {
$this->method = $method;
$this->args = $args;
$this->xml = <<xml .= '';
}
- function getLength() {
+
+ function getLength()
+ {
return strlen($this->xml);
}
- function getXml() {
+
+ function getXml()
+ {
return $this->xml;
}
}
@@ -497,26 +592,32 @@ EOD;
*
* @package IXR
* @since 1.5
+ *
*/
-class IXR_Client {
+class IXR_Client
+{
var $server;
var $port;
var $path;
var $useragent;
- var $headers;
var $response;
var $message = false;
var $debug = false;
var $timeout;
+ var $headers = array();
+
// Storage place for an error message
var $error = false;
- function IXR_Client($server, $path = false, $port = 80, $timeout = false) {
+
+ function IXR_Client($server, $path = false, $port = 80, $timeout = 15)
+ {
if (!$path) {
// Assume we have been given a URL instead
$bits = parse_url($server);
$this->server = $bits['host'];
$this->port = isset($bits['port']) ? $bits['port'] : 80;
$this->path = isset($bits['path']) ? $bits['path'] : '/';
+
// Make absolutely sure we have a path
if (!$this->path) {
$this->path = '/';
@@ -529,7 +630,9 @@ class IXR_Client {
$this->useragent = 'The Incutio XML-RPC PHP Library';
$this->timeout = $timeout;
}
- function query() {
+
+ function query()
+ {
$args = func_get_args();
$method = array_shift($args);
$request = new IXR_Request($method, $args);
@@ -538,33 +641,36 @@ class IXR_Client {
$r = "\r\n";
$request = "POST {$this->path} HTTP/1.0$r";
- $this->headers['Host'] = $this->server;
- $this->headers['Content-Type'] = 'text/xml';
- $this->headers['User-Agent'] = $this->useragent;
- $this->headers['Content-Length']= $length;
+ // Merged from WP #8145 - allow custom headers
+ $this->headers['Host'] = $this->server;
+ $this->headers['Content-Type'] = 'text/xml';
+ $this->headers['User-Agent'] = $this->useragent;
+ $this->headers['Content-Length']= $length;
- foreach( $this->headers as $header => $value ) {
- $request .= "{$header}: {$value}{$r}";
- }
- $request .= $r;
+ foreach( $this->headers as $header => $value ) {
+ $request .= "{$header}: {$value}{$r}";
+ }
+ $request .= $r;
$request .= $xml;
+
// Now send the request
if ($this->debug) {
echo ''.htmlspecialchars($request)."\n \n\n";
}
+
if ($this->timeout) {
$fp = @fsockopen($this->server, $this->port, $errno, $errstr, $this->timeout);
} else {
$fp = @fsockopen($this->server, $this->port, $errno, $errstr);
}
if (!$fp) {
- $this->error = new IXR_Error(-32300, "transport error - could not open socket: $errno $errstr");
+ $this->error = new IXR_Error(-32300, 'transport error - could not open socket');
return false;
}
fputs($fp, $request);
$contents = '';
- $debug_contents = '';
+ $debugContents = '';
$gotFirstLine = false;
$gettingHeaders = true;
while (!feof($fp)) {
@@ -572,7 +678,7 @@ class IXR_Client {
if (!$gotFirstLine) {
// Check line for '200'
if (strstr($line, '200') === false) {
- $this->error = new IXR_Error(-32301, 'transport error - HTTP status code was not 200');
+ $this->error = new IXR_Error(-32300, 'transport error - HTTP status code was not 200');
return false;
}
$gotFirstLine = true;
@@ -581,16 +687,17 @@ class IXR_Client {
$gettingHeaders = false;
}
if (!$gettingHeaders) {
- // WP#12559 remove trim so as to not strip newlines from received response.
+ // merged from WP #12559 - remove trim
$contents .= $line;
}
if ($this->debug) {
- $debug_contents .= $line;
+ $debugContents .= $line;
}
}
if ($this->debug) {
- echo ''.htmlspecialchars($debug_contents)."\n \n\n";
+ echo ''.htmlspecialchars($debugContents)."\n \n\n";
}
+
// Now parse what we've got back
$this->message = new IXR_Message($contents);
if (!$this->message->parse()) {
@@ -598,44 +705,59 @@ class IXR_Client {
$this->error = new IXR_Error(-32700, 'parse error. not well formed');
return false;
}
+
// Is the message a fault?
if ($this->message->messageType == 'fault') {
$this->error = new IXR_Error($this->message->faultCode, $this->message->faultString);
return false;
}
+
// Message must be OK
return true;
}
- function getResponse() {
+
+ function getResponse()
+ {
// methodResponses can only have one param - return that
return $this->message->params[0];
}
- function isError() {
+
+ function isError()
+ {
return (is_object($this->error));
}
- function getErrorCode() {
+
+ function getErrorCode()
+ {
return $this->error->code;
}
- function getErrorMessage() {
+
+ function getErrorMessage()
+ {
return $this->error->message;
}
}
+
/**
* IXR_Error
*
* @package IXR
* @since 1.5
*/
-class IXR_Error {
+class IXR_Error
+{
var $code;
var $message;
- function IXR_Error($code, $message) {
+
+ function IXR_Error($code, $message)
+ {
$this->code = $code;
- // WP adds htmlspecialchars(). See #5666
$this->message = htmlspecialchars($message);
}
- function getXml() {
+
+ function getXml()
+ {
$xml = <<
@@ -673,7 +795,9 @@ class IXR_Date {
var $minute;
var $second;
var $timezone;
- function IXR_Date($time) {
+
+ function IXR_Date($time)
+ {
// $time can be a PHP timestamp or an ISO one
if (is_numeric($time)) {
$this->parseTimestamp($time);
@@ -681,34 +805,41 @@ class IXR_Date {
$this->parseIso($time);
}
}
- function parseTimestamp($timestamp) {
+
+ function parseTimestamp($timestamp)
+ {
$this->year = date('Y', $timestamp);
$this->month = date('m', $timestamp);
$this->day = date('d', $timestamp);
$this->hour = date('H', $timestamp);
$this->minute = date('i', $timestamp);
$this->second = date('s', $timestamp);
- // WP adds timezone. See #2036
$this->timezone = '';
}
- function parseIso($iso) {
+
+ function parseIso($iso)
+ {
$this->year = substr($iso, 0, 4);
$this->month = substr($iso, 4, 2);
$this->day = substr($iso, 6, 2);
$this->hour = substr($iso, 9, 2);
$this->minute = substr($iso, 12, 2);
$this->second = substr($iso, 15, 2);
- // WP adds timezone. See #2036
$this->timezone = substr($iso, 17);
}
- function getIso() {
- // WP adds timezone. See #2036
+
+ function getIso()
+ {
return $this->year.$this->month.$this->day.'T'.$this->hour.':'.$this->minute.':'.$this->second.$this->timezone;
}
- function getXml() {
+
+ function getXml()
+ {
return ''.$this->getIso().' ';
}
- function getTimestamp() {
+
+ function getTimestamp()
+ {
return mktime($this->hour, $this->minute, $this->second, $this->month, $this->day, $this->year);
}
}
@@ -719,12 +850,17 @@ class IXR_Date {
* @package IXR
* @since 1.5
*/
-class IXR_Base64 {
+class IXR_Base64
+{
var $data;
- function IXR_Base64($data) {
+
+ function IXR_Base64($data)
+ {
$this->data = $data;
}
- function getXml() {
+
+ function getXml()
+ {
return ''.base64_encode($this->data).' ';
}
}
@@ -735,10 +871,13 @@ class IXR_Base64 {
* @package IXR
* @since 1.5
*/
-class IXR_IntrospectionServer extends IXR_Server {
+class IXR_IntrospectionServer extends IXR_Server
+{
var $signatures;
var $help;
- function IXR_IntrospectionServer() {
+
+ function IXR_IntrospectionServer()
+ {
$this->setCallbacks();
$this->setCapabilities();
$this->capabilities['introspection'] = array(
@@ -770,16 +909,21 @@ class IXR_IntrospectionServer extends IXR_Server {
'Returns a documentation string for the specified method'
);
}
- function addCallback($method, $callback, $args, $help) {
+
+ function addCallback($method, $callback, $args, $help)
+ {
$this->callbacks[$method] = $callback;
$this->signatures[$method] = $args;
$this->help[$method] = $help;
}
- function call($methodname, $args) {
+
+ function call($methodname, $args)
+ {
// Make sure it's in an array
if ($args && !is_array($args)) {
$args = array($args);
}
+
// Over-rides default call method, adds signature check
if (!$this->hasMethod($methodname)) {
return new IXR_Error(-32601, 'server error. requested method "'.$this->message->methodName.'" not specified.');
@@ -787,10 +931,12 @@ class IXR_IntrospectionServer extends IXR_Server {
$method = $this->callbacks[$methodname];
$signature = $this->signatures[$methodname];
$returnType = array_shift($signature);
+
// Check the number of arguments
if (count($args) != count($signature)) {
return new IXR_Error(-32602, 'server error. wrong number of method parameters');
}
+
// Check the argument types
$ok = true;
$argsbackup = $args;
@@ -835,7 +981,9 @@ class IXR_IntrospectionServer extends IXR_Server {
// It passed the test - run the "real" method call
return parent::call($methodname, $argsbackup);
}
- function methodSignature($method) {
+
+ function methodSignature($method)
+ {
if (!$this->hasMethod($method)) {
return new IXR_Error(-32601, 'server error. requested method "'.$method.'" not specified.');
}
@@ -873,7 +1021,9 @@ class IXR_IntrospectionServer extends IXR_Server {
}
return $return;
}
- function methodHelp($method) {
+
+ function methodHelp($method)
+ {
return $this->help[$method];
}
}
@@ -884,13 +1034,18 @@ class IXR_IntrospectionServer extends IXR_Server {
* @package IXR
* @since 1.5
*/
-class IXR_ClientMulticall extends IXR_Client {
+class IXR_ClientMulticall extends IXR_Client
+{
var $calls = array();
- function IXR_ClientMulticall($server, $path = false, $port = 80) {
+
+ function IXR_ClientMulticall($server, $path = false, $port = 80)
+ {
parent::IXR_Client($server, $path, $port);
$this->useragent = 'The Incutio XML-RPC PHP Library (multicall client)';
}
- function addCall() {
+
+ function addCall()
+ {
$args = func_get_args();
$methodName = array_shift($args);
$struct = array(
@@ -899,7 +1054,9 @@ class IXR_ClientMulticall extends IXR_Client {
);
$this->calls[] = $struct;
}
- function query() {
+
+ function query()
+ {
// Prepare multicall, then call the parent::query() method
return parent::query('system.multicall', $this->calls);
}
diff --git a/wp-includes/class-http.php b/wp-includes/class-http.php
index 3e808692..5d7f83d8 100644
--- a/wp-includes/class-http.php
+++ b/wp-includes/class-http.php
@@ -238,39 +238,39 @@ class WP_Http {
if ( false !== $pre )
return $pre;
- $arrURL = parse_url($url);
+ $arrURL = parse_url( $url );
if ( empty( $url ) || empty( $arrURL['scheme'] ) )
return new WP_Error('http_request_failed', __('A valid URL was not provided.'));
if ( $this->block_request( $url ) )
- return new WP_Error('http_request_failed', __('User has blocked requests through HTTP.'));
+ return new WP_Error( 'http_request_failed', __( 'User has blocked requests through HTTP.' ) );
// Determine if this is a https call and pass that on to the transport functions
// so that we can blacklist the transports that do not support ssl verification
$r['ssl'] = $arrURL['scheme'] == 'https' || $arrURL['scheme'] == 'ssl';
// Determine if this request is to OUR install of WordPress
- $homeURL = parse_url( get_bloginfo('url') );
+ $homeURL = parse_url( get_bloginfo( 'url' ) );
$r['local'] = $homeURL['host'] == $arrURL['host'] || 'localhost' == $arrURL['host'];
- unset($homeURL);
+ unset( $homeURL );
if ( is_null( $r['headers'] ) )
$r['headers'] = array();
- if ( ! is_array($r['headers']) ) {
- $processedHeaders = WP_Http::processHeaders($r['headers']);
+ if ( ! is_array( $r['headers'] ) ) {
+ $processedHeaders = WP_Http::processHeaders( $r['headers'] );
$r['headers'] = $processedHeaders['headers'];
}
- if ( isset($r['headers']['User-Agent']) ) {
+ if ( isset( $r['headers']['User-Agent'] ) ) {
$r['user-agent'] = $r['headers']['User-Agent'];
- unset($r['headers']['User-Agent']);
+ unset( $r['headers']['User-Agent'] );
}
- if ( isset($r['headers']['user-agent']) ) {
+ if ( isset( $r['headers']['user-agent'] ) ) {
$r['user-agent'] = $r['headers']['user-agent'];
- unset($r['headers']['user-agent']);
+ unset( $r['headers']['user-agent'] );
}
// Construct Cookie: header if any cookies are set
@@ -280,45 +280,46 @@ class WP_Http {
$r['headers']['Accept-Encoding'] = WP_Http_Encoding::accept_encoding();
if ( empty($r['body']) ) {
+ $r['body'] = null;
// Some servers fail when sending content without the content-length header being set.
// Also, to fix another bug, we only send when doing POST and PUT and the content-length
// header isn't already set.
- if( ($r['method'] == 'POST' || $r['method'] == 'PUT') && ! isset($r['headers']['Content-Length']) )
+ if ( ($r['method'] == 'POST' || $r['method'] == 'PUT') && ! isset( $r['headers']['Content-Length'] ) )
$r['headers']['Content-Length'] = 0;
// The method is ambiguous, because we aren't talking about HTTP methods, the "get" in
// this case is simply that we aren't sending any bodies and to get the transports that
// don't support sending bodies along with those which do.
- $transports = WP_Http::_getTransport($r);
+ $transports = WP_Http::_getTransport( $r );
} else {
if ( is_array( $r['body'] ) || is_object( $r['body'] ) ) {
if ( ! version_compare(phpversion(), '5.1.2', '>=') )
- $r['body'] = _http_build_query($r['body'], null, '&');
+ $r['body'] = _http_build_query( $r['body'], null, '&' );
else
- $r['body'] = http_build_query($r['body'], null, '&');
- $r['headers']['Content-Type'] = 'application/x-www-form-urlencoded; charset=' . get_option('blog_charset');
- $r['headers']['Content-Length'] = strlen($r['body']);
+ $r['body'] = http_build_query( $r['body'], null, '&' );
+ $r['headers']['Content-Type'] = 'application/x-www-form-urlencoded; charset=' . get_option( 'blog_charset' );
+ $r['headers']['Content-Length'] = strlen( $r['body'] );
}
if ( ! isset( $r['headers']['Content-Length'] ) && ! isset( $r['headers']['content-length'] ) )
- $r['headers']['Content-Length'] = strlen($r['body']);
+ $r['headers']['Content-Length'] = strlen( $r['body'] );
// The method is ambiguous, because we aren't talking about HTTP methods, the "post" in
// this case is simply that we are sending HTTP body and to get the transports that do
// support sending the body. Not all do, depending on the limitations of the PHP core
// limitations.
- $transports = WP_Http::_postTransport($r);
+ $transports = WP_Http::_postTransport( $r );
}
do_action( 'http_api_debug', $transports, 'transports_list' );
$response = array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() );
foreach ( (array) $transports as $transport ) {
- $response = $transport->request($url, $r);
+ $response = $transport->request( $url, $r );
- do_action( 'http_api_debug', $response, 'response', get_class($transport) );
+ do_action( 'http_api_debug', $response, 'response', get_class( $transport ) );
- if ( ! is_wp_error($response) )
+ if ( ! is_wp_error( $response ) )
return apply_filters( 'http_response', $response, $r, $url );
}
@@ -453,7 +454,7 @@ class WP_Http {
} else {
$newheaders[$key] = trim( $value );
}
- if ( 'set-cookie' == strtolower( $key ) )
+ if ( 'set-cookie' == $key )
$cookies[] = new WP_Http_Cookie( $value );
}
}
@@ -540,10 +541,12 @@ class WP_Http {
* You block external URL requests by defining WP_HTTP_BLOCK_EXTERNAL as true in your wp-config.php
* file and this will only allow localhost and your blog to make requests. The constant
* WP_ACCESSIBLE_HOSTS will allow additional hosts to go through for requests. The format of the
- * WP_ACCESSIBLE_HOSTS constant is a comma separated list of hostnames to allow.
+ * WP_ACCESSIBLE_HOSTS constant is a comma separated list of hostnames to allow, wildcard domains
+ * are supported, eg *.wordpress.org will allow for all subdomains of wordpress.org to be contacted.
*
* @since 2.8.0
* @link http://core.trac.wordpress.org/ticket/8927 Allow preventing external requests.
+ * @link http://core.trac.wordpress.org/ticket/14636 Allow wildcard domains in WP_ACCESSIBLE_HOSTS
*
* @param string $uri URI of url.
* @return bool True to block, false to allow.
@@ -577,10 +580,25 @@ class WP_Http {
return true;
static $accessible_hosts;
- if ( null == $accessible_hosts )
+ static $wildcard_regex = false;
+ if ( null == $accessible_hosts ) {
$accessible_hosts = preg_split('|,\s*|', WP_ACCESSIBLE_HOSTS);
- return !in_array( $check['host'], $accessible_hosts ); //Inverse logic, If its in the array, then we can't access it.
+ if ( false !== strpos(WP_ACCESSIBLE_HOSTS, '*') ) {
+ $wildcard_regex = array();
+ foreach ( $accessible_hosts as $host )
+ $wildcard_regex[] = str_replace('\*', '[\w.]+?', preg_quote($host, '/'));
+ $wildcard_regex = '/^(' . implode('|', $wildcard_regex) . ')$/i';
+ }
+ }
+
+ if ( !empty($wildcard_regex) )
+ return !preg_match($wildcard_regex, $check['host']);
+ else
+ return !in_array( $check['host'], $accessible_hosts ); //Inverse logic, If its in the array, then we can't access it.
+
+
+
}
}
@@ -621,7 +639,7 @@ class WP_Http_Fsockopen {
if ( isset($r['headers']['User-Agent']) ) {
$r['user-agent'] = $r['headers']['User-Agent'];
unset($r['headers']['User-Agent']);
- } else if( isset($r['headers']['user-agent']) ) {
+ } else if ( isset($r['headers']['user-agent']) ) {
$r['user-agent'] = $r['headers']['user-agent'];
unset($r['headers']['user-agent']);
}
@@ -973,7 +991,7 @@ class WP_Http_Streams {
if ( isset($r['headers']['User-Agent']) ) {
$r['user-agent'] = $r['headers']['User-Agent'];
unset($r['headers']['User-Agent']);
- } else if( isset($r['headers']['user-agent']) ) {
+ } else if ( isset($r['headers']['user-agent']) ) {
$r['user-agent'] = $r['headers']['user-agent'];
unset($r['headers']['user-agent']);
}
@@ -1120,7 +1138,7 @@ class WP_Http_Streams {
* @subpackage HTTP
* @since 2.7.0
*/
-class WP_Http_ExtHTTP {
+class WP_Http_ExtHttp {
/**
* Send a HTTP request to a URI using HTTP extension.
*
@@ -1146,7 +1164,7 @@ class WP_Http_ExtHTTP {
if ( isset($r['headers']['User-Agent']) ) {
$r['user-agent'] = $r['headers']['User-Agent'];
unset($r['headers']['User-Agent']);
- } else if( isset($r['headers']['user-agent']) ) {
+ } else if ( isset($r['headers']['user-agent']) ) {
$r['user-agent'] = $r['headers']['user-agent'];
unset($r['headers']['user-agent']);
}
@@ -1296,7 +1314,7 @@ class WP_Http_Curl {
if ( isset($r['headers']['User-Agent']) ) {
$r['user-agent'] = $r['headers']['User-Agent'];
unset($r['headers']['User-Agent']);
- } else if( isset($r['headers']['user-agent']) ) {
+ } else if ( isset($r['headers']['user-agent']) ) {
$r['user-agent'] = $r['headers']['user-agent'];
unset($r['headers']['user-agent']);
}
@@ -1408,7 +1426,7 @@ class WP_Http_Curl {
$theBody = substr( $theResponse, $headerLength );
else
$theBody = '';
- if ( false !== strrpos($theHeaders, "\r\n\r\n") ) {
+ if ( false !== strpos($theHeaders, "\r\n\r\n") ) {
$headerParts = explode("\r\n\r\n", $theHeaders);
$theHeaders = $headerParts[ count($headerParts) -1 ];
}
@@ -1478,17 +1496,18 @@ class WP_Http_Curl {
* WP_PROXY_PASSWORD - Proxy password, if it requires authentication.
* WP_PROXY_BYPASS_HOSTS - Will prevent the hosts in this list from going through the proxy.
* You do not need to have localhost and the blog host in this list, because they will not be passed
- * through the proxy. The list should be presented in a comma separated list
+ * through the proxy. The list should be presented in a comma separated list, wildcards using * are supported, eg. *.wordpress.org
*
*
* An example can be as seen below.
*
* define('WP_PROXY_HOST', '192.168.84.101');
* define('WP_PROXY_PORT', '8080');
- * define('WP_PROXY_BYPASS_HOSTS', 'localhost, www.example.com');
+ * define('WP_PROXY_BYPASS_HOSTS', 'localhost, www.example.com, *.wordpress.org');
*
*
* @link http://core.trac.wordpress.org/ticket/4011 Proxy support ticket in WordPress.
+ * @link http://core.trac.wordpress.org/ticket/14636 Allow wildcard domains in WP_PROXY_BYPASS_HOSTS
* @since 2.8
*/
class WP_HTTP_Proxy {
@@ -1605,7 +1624,7 @@ class WP_HTTP_Proxy {
* hosts that won't be sent through the proxy.
*
* @uses WP_PROXY_BYPASS_HOSTS
- * @since unknown
+ * @since 2.8.0
*
* @param string $uri URI to check.
* @return bool True, to send through the proxy and false if, the proxy should not be used.
@@ -1628,10 +1647,22 @@ class WP_HTTP_Proxy {
return true;
static $bypass_hosts;
- if ( null == $bypass_hosts )
+ static $wildcard_regex = false;
+ if ( null == $bypass_hosts ) {
$bypass_hosts = preg_split('|,\s*|', WP_PROXY_BYPASS_HOSTS);
- return !in_array( $check['host'], $bypass_hosts );
+ if ( false !== strpos(WP_PROXY_BYPASS_HOSTS, '*') ) {
+ $wildcard_regex = array();
+ foreach ( $bypass_hosts as $host )
+ $wildcard_regex[] = str_replace('\*', '[\w.]+?', preg_quote($host, '/'));
+ $wildcard_regex = '/^(' . implode('|', $wildcard_regex) . ')$/i';
+ }
+ }
+
+ if ( !empty($wildcard_regex) )
+ return !preg_match($wildcard_regex, $check['host']);
+ else
+ return !in_array( $check['host'], $bypass_hosts );
}
}
/**
diff --git a/wp-includes/class-json.php b/wp-includes/class-json.php
index 7582609a..75010df2 100644
--- a/wp-includes/class-json.php
+++ b/wp-includes/class-json.php
@@ -153,7 +153,7 @@ class Services_JSON
return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
}
- $bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
+ $bytes = (ord($utf16[0]) << 8) | ord($utf16[1]);
switch(true) {
case ((0x7F & $bytes) == $bytes):
@@ -206,17 +206,17 @@ class Services_JSON
case 2:
// return a UTF-16 character from a 2-byte UTF-8 char
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- return chr(0x07 & (ord($utf8{0}) >> 2))
- . chr((0xC0 & (ord($utf8{0}) << 6))
- | (0x3F & ord($utf8{1})));
+ return chr(0x07 & (ord($utf8[0]) >> 2))
+ . chr((0xC0 & (ord($utf8[0]) << 6))
+ | (0x3F & ord($utf8[1])));
case 3:
// return a UTF-16 character from a 3-byte UTF-8 char
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- return chr((0xF0 & (ord($utf8{0}) << 4))
- | (0x0F & (ord($utf8{1}) >> 2)))
- . chr((0xC0 & (ord($utf8{1}) << 6))
- | (0x7F & ord($utf8{2})));
+ return chr((0xF0 & (ord($utf8[0]) << 4))
+ | (0x0F & (ord($utf8[1]) >> 2)))
+ . chr((0xC0 & (ord($utf8[1]) << 6))
+ | (0x7F & ord($utf8[2])));
}
// ignoring UTF-32 for now, sorry
@@ -293,7 +293,7 @@ class Services_JSON
*/
for ($c = 0; $c < $strlen_var; ++$c) {
- $ord_var_c = ord($var{$c});
+ $ord_var_c = ord($var[$c]);
switch (true) {
case $ord_var_c == 0x08:
@@ -316,12 +316,12 @@ class Services_JSON
case $ord_var_c == 0x2F:
case $ord_var_c == 0x5C:
// double quote, slash, slosh
- $ascii .= '\\'.$var{$c};
+ $ascii .= '\\'.$var[$c];
break;
case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
// characters U-00000000 - U-0000007F (same as ASCII)
- $ascii .= $var{$c};
+ $ascii .= $var[$c];
break;
case (($ord_var_c & 0xE0) == 0xC0):
@@ -333,7 +333,7 @@ class Services_JSON
break;
}
- $char = pack('C*', $ord_var_c, ord($var{$c + 1}));
+ $char = pack('C*', $ord_var_c, ord($var[$c + 1]));
$c += 1;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
@@ -348,8 +348,8 @@ class Services_JSON
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c,
- @ord($var{$c + 1}),
- @ord($var{$c + 2}));
+ @ord($var[$c + 1]),
+ @ord($var[$c + 2]));
$c += 2;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
@@ -364,9 +364,9 @@ class Services_JSON
// characters U-00010000 - U-001FFFFF, mask 11110XXX
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c,
- ord($var{$c + 1}),
- ord($var{$c + 2}),
- ord($var{$c + 3}));
+ ord($var[$c + 1]),
+ ord($var[$c + 2]),
+ ord($var[$c + 3]));
$c += 3;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
@@ -381,10 +381,10 @@ class Services_JSON
break;
}
$char = pack('C*', $ord_var_c,
- ord($var{$c + 1}),
- ord($var{$c + 2}),
- ord($var{$c + 3}),
- ord($var{$c + 4}));
+ ord($var[$c + 1]),
+ ord($var[$c + 2]),
+ ord($var[$c + 3]),
+ ord($var[$c + 4]));
$c += 4;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
@@ -399,11 +399,11 @@ class Services_JSON
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
$char = pack('C*', $ord_var_c,
- ord($var{$c + 1}),
- ord($var{$c + 2}),
- ord($var{$c + 3}),
- ord($var{$c + 4}),
- ord($var{$c + 5}));
+ ord($var[$c + 1]),
+ ord($var[$c + 2]),
+ ord($var[$c + 3]),
+ ord($var[$c + 4]),
+ ord($var[$c + 5]));
$c += 5;
$utf16 = $this->utf82utf16($char);
$ascii .= sprintf('\u%04s', bin2hex($utf16));
@@ -577,7 +577,7 @@ class Services_JSON
for ($c = 0; $c < $strlen_chrs; ++$c) {
$substr_chrs_c_2 = substr($chrs, $c, 2);
- $ord_chrs_c = ord($chrs{$c});
+ $ord_chrs_c = ord($chrs[$c]);
switch (true) {
case $substr_chrs_c_2 == '\b':
@@ -607,7 +607,7 @@ class Services_JSON
case $substr_chrs_c_2 == '\\/':
if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
($delim == "'" && $substr_chrs_c_2 != '\\"')) {
- $utf8 .= $chrs{++$c};
+ $utf8 .= $chrs[++$c];
}
break;
@@ -620,7 +620,7 @@ class Services_JSON
break;
case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
- $utf8 .= $chrs{$c};
+ $utf8 .= $chrs[$c];
break;
case ($ord_chrs_c & 0xE0) == 0xC0:
@@ -667,7 +667,7 @@ class Services_JSON
} elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
// array, or object notation
- if ($str{0} == '[') {
+ if ($str[0] == '[') {
$stk = array(SERVICES_JSON_IN_ARR);
$arr = array();
} else {
@@ -706,7 +706,7 @@ class Services_JSON
$top = end($stk);
$substr_chrs_c_2 = substr($chrs, $c, 2);
- if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
+ if (($c == $strlen_chrs) || (($chrs[$c] == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
// found a comma that is not inside a string, array, etc.,
// OR we've reached the end of the character list
$slice = substr($chrs, $top['where'], ($c - $top['where']));
@@ -748,12 +748,12 @@ class Services_JSON
}
- } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
+ } elseif ((($chrs[$c] == '"') || ($chrs[$c] == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
// found a quote, and we are not inside a string
- array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
+ array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs[$c]));
//print("Found start of string at {$c}\n");
- } elseif (($chrs{$c} == $top['delim']) &&
+ } elseif (($chrs[$c] == $top['delim']) &&
($top['what'] == SERVICES_JSON_IN_STR) &&
((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) {
// found a quote, we're in a string, and it's not escaped
@@ -762,24 +762,24 @@ class Services_JSON
array_pop($stk);
//print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
- } elseif (($chrs{$c} == '[') &&
+ } elseif (($chrs[$c] == '[') &&
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
// found a left-bracket, and we are in an array, object, or slice
array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
//print("Found start of array at {$c}\n");
- } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
+ } elseif (($chrs[$c] == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
// found a right-bracket, and we're in an array
array_pop($stk);
//print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
- } elseif (($chrs{$c} == '{') &&
+ } elseif (($chrs[$c] == '{') &&
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
// found a left-brace, and we are in an array, object, or slice
array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
//print("Found start of object at {$c}\n");
- } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
+ } elseif (($chrs[$c] == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
// found a right-brace, and we're in an object
array_pop($stk);
//print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
diff --git a/wp-includes/class-oembed.php b/wp-includes/class-oembed.php
index a09b3167..87e59a69 100644
--- a/wp-includes/class-oembed.php
+++ b/wp-includes/class-oembed.php
@@ -242,7 +242,7 @@ class WP_oEmbed {
return false;
$title = ( !empty($data->title) ) ? $data->title : '';
- $return = ' ';
+ $return = ' ';
break;
case 'video':
diff --git a/wp-includes/class-pop3.php b/wp-includes/class-pop3.php
index c11676c4..2bf442f8 100644
--- a/wp-includes/class-pop3.php
+++ b/wp-includes/class-pop3.php
@@ -11,10 +11,11 @@
* An RFC 1939 compliant wrapper class for the POP3 protocol.
*
* Licensed under the GNU GPL. For full terms see the file COPYING.
+ * @license http://opensource.org/licenses/gpl-license.php GNU General Public License
*
* pop3 class
*
- * $Id: class-pop3.php 9503 2008-11-03 23:25:11Z ryan $
+ * $Id: class-pop3.php 17435 2011-02-09 17:35:36Z ryan $
*/
class POP3 {
@@ -367,7 +368,7 @@ class POP3 {
$line = fgets($fp,$buffer);
while ( !ereg("^\.\r\n",$line))
{
- if ( $line{0} == '.' ) { $line = substr($line,1); }
+ if ( $line[0] == '.' ) { $line = substr($line,1); }
$MsgArray[$count] = $line;
$count++;
$line = fgets($fp,$buffer);
diff --git a/wp-includes/class-simplepie.php b/wp-includes/class-simplepie.php
index 98843f03..275033a8 100644
--- a/wp-includes/class-simplepie.php
+++ b/wp-includes/class-simplepie.php
@@ -1831,7 +1831,7 @@ class SimplePie
}
/**
- * Return the error message for the occured error
+ * Return the error message for the occurred error
*
* @access public
* @return string Error message
diff --git a/wp-includes/class-snoopy.php b/wp-includes/class-snoopy.php
index da3d824e..66ff71fc 100644
--- a/wp-includes/class-snoopy.php
+++ b/wp-includes/class-snoopy.php
@@ -719,13 +719,13 @@ class Snoopy
chr(176),
chr(39),
chr(128),
- "ä",
- "ö",
- "ü",
- "Ä",
- "Ö",
- "Ü",
- "ß",
+ chr(0xE4), // ANSI ä
+ chr(0xF6), // ANSI ö
+ chr(0xFC), // ANSI ü
+ chr(0xC4), // ANSI Ä
+ chr(0xD6), // ANSI Ö
+ chr(0xDC), // ANSI Ü
+ chr(0xDF), // ANSI ß
);
$text = preg_replace($search,$replace,$document);
diff --git a/wp-includes/class-wp-admin-bar.php b/wp-includes/class-wp-admin-bar.php
new file mode 100644
index 00000000..549d5ecf
--- /dev/null
+++ b/wp-includes/class-wp-admin-bar.php
@@ -0,0 +1,236 @@
+proto = 'https://';
+
+ $this->user = new stdClass;
+ $this->menu = new stdClass;
+
+ /* Populate settings we need for the menu based on the current user. */
+ $this->user->blogs = get_blogs_of_user( get_current_user_id() );
+ if ( is_multisite() ) {
+ $this->user->active_blog = get_active_blog_for_user( get_current_user_id() );
+ $this->user->domain = empty( $this->user->active_blog ) ? user_admin_url() : trailingslashit( get_home_url( $this->user->active_blog->blog_id ) );
+ $this->user->account_domain = $this->user->domain;
+ } else {
+ $this->user->active_blog = $this->user->blogs[get_current_blog_id()];
+ $this->user->domain = trailingslashit( home_url() );
+ $this->user->account_domain = $this->user->domain;
+ }
+ $this->user->locale = get_locale();
+
+ add_action( 'wp_head', 'wp_admin_bar_header' );
+
+ add_action( 'admin_head', 'wp_admin_bar_header' );
+
+ if ( current_theme_supports( 'admin-bar' ) ) {
+ $admin_bar_args = get_theme_support( 'admin-bar' ); // add_theme_support( 'admin-bar', array( 'callback' => '__return_false') );
+ $header_callback = $admin_bar_args[0]['callback'];
+ }
+
+ if ( empty($header_callback) )
+ $header_callback = '_admin_bar_bump_cb';
+
+ add_action('wp_head', $header_callback);
+
+ wp_enqueue_script( 'admin-bar' );
+ wp_enqueue_style( 'admin-bar' );
+
+ do_action( 'admin_bar_init' );
+ }
+
+ function add_menu( $args = array() ) {
+ $defaults = array(
+ 'title' => false,
+ 'href' => false,
+ 'parent' => false, // false for a root menu, pass the ID value for a submenu of that menu.
+ 'id' => false, // defaults to a sanitized title value.
+ 'meta' => false // array of any of the following options: array( 'html' => '', 'class' => '', 'onclick' => '', target => '', title => '' );
+ );
+
+ $r = wp_parse_args( $args, $defaults );
+ extract( $r, EXTR_SKIP );
+
+ if ( empty( $title ) )
+ return false;
+
+ /* Make sure we have a valid ID */
+ if ( empty( $id ) )
+ $id = esc_attr( sanitize_title( trim( $title ) ) );
+
+ if ( ! empty( $parent ) ) {
+ /* Add the menu to the parent item */
+ $child = array( 'id' => $id, 'title' => $title, 'href' => $href );
+
+ if ( ! empty( $meta ) )
+ $child['meta'] = $meta;
+
+ $this->add_node( $parent, $this->menu, $child );
+ } else {
+ /* Add the menu item */
+ $this->menu->{$id} = array( 'title' => $title, 'href' => $href );
+
+ if ( ! empty( $meta ) )
+ $this->menu->{$id}['meta'] = $meta;
+ }
+ }
+
+ function remove_menu( $id ) {
+ return $this->remove_node( $id, $this->menu );
+ }
+
+ function render() {
+ ?>
+
+
+
+ menu as $id => $menu_item ) : ?>
+ recursive_render( $id, $menu_item ) ?>
+
+
+
+
+
+
+
+
+
+
+
+
+ menu = null;
+ }
+
+ /* Helpers */
+ function recursive_render( $id, &$menu_item ) { ?>
+
+
+ " class="">
+ onclick="" target="" title="">
+
+
+
+ $child_menu_item ) : ?>
+ recursive_render( $child_id, $child_menu_item ); ?>
+
+
+
+
+
+
+
+ $menu_item ) {
+ if ( $parent_id == $id ) {
+ $menu->{$parent_id}['children']->{$child['id']} = $child;
+ $child = null;
+ return true;
+ }
+
+ if ( ! empty( $menu->{$id}['children'] ) )
+ $this->add_node( $parent_id, $menu->{$id}['children'], $child );
+ }
+
+ $child = null;
+
+ return false;
+ }
+
+ function add_menus() {
+ add_action( 'admin_bar_menu', 'wp_admin_bar_my_account_menu', 10 );
+ add_action( 'admin_bar_menu', 'wp_admin_bar_my_sites_menu', 20 );
+ add_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu', 30 );
+ add_action( 'admin_bar_menu', 'wp_admin_bar_shortlink_menu', 80 );
+ add_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu', 70 );
+
+ if ( !is_network_admin() && !is_user_admin() ) {
+ add_action( 'admin_bar_menu', 'wp_admin_bar_new_content_menu', 40 );
+ add_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 50 );
+ add_action( 'admin_bar_menu', 'wp_admin_bar_appearance_menu', 60 );
+ }
+
+ do_action( 'add_admin_bar_menus' );
+ }
+
+ function remove_node( $id, &$menu ) {
+ if ( isset( $menu->$id ) ) {
+ unset( $menu->$id );
+ return true;
+ }
+
+ foreach( $menu as $menu_item_id => $menu_item ) {
+ if ( ! empty( $menu->{$menu_item_id}['children'] ) )
+ $this->remove_node( $id, $menu->{$menu_item_id}['children'] );
+ }
+
+ return false;
+ }
+
+ // TODO: Convert to a core feature for multisite or remove
+ function load_user_locale_translations() {
+ $this->need_to_change_locale = ( get_locale() != $this->user->locale );
+ if ( ! $this->need_to_change_locale )
+ return;
+ /*
+ $this->previous_translations = get_translations_for_domain( 'default' );
+ $this->adminbar_locale_filter = lambda( '$_', '$GLOBALS["wp_admin_bar"]->user->locale;' );
+ unload_textdomain( 'default' );
+ add_filter( 'locale', $this->adminbar_locale_filter );
+ load_default_textdomain();
+ $this->changed_locale = true;
+ */
+ }
+
+ function unload_user_locale_translations() {
+ global $l10n;
+ if ( ! $this->changed_locale )
+ return;
+ /*
+ remove_filter( 'locale', $this->adminbar_locale_filter );
+ $l10n['default'] = &$this->previous_translations;
+ */
+ }
+}
+?>
diff --git a/wp-includes/class-wp-ajax-response.php b/wp-includes/class-wp-ajax-response.php
new file mode 100644
index 00000000..cf64bfbc
--- /dev/null
+++ b/wp-includes/class-wp-ajax-response.php
@@ -0,0 +1,138 @@
+add($args);
+ }
+
+ /**
+ * Append to XML response based on given arguments.
+ *
+ * The arguments that can be passed in the $args parameter are below. It is
+ * also possible to pass a WP_Error object in either the 'id' or 'data'
+ * argument. The parameter isn't actually optional, content should be given
+ * in order to send the correct response.
+ *
+ * 'what' argument is a string that is the XMLRPC response type.
+ * 'action' argument is a boolean or string that acts like a nonce.
+ * 'id' argument can be WP_Error or an integer.
+ * 'old_id' argument is false by default or an integer of the previous ID.
+ * 'position' argument is an integer or a string with -1 = top, 1 = bottom,
+ * html ID = after, -html ID = before.
+ * 'data' argument is a string with the content or message.
+ * 'supplemental' argument is an array of strings that will be children of
+ * the supplemental element.
+ *
+ * @since 2.1.0
+ *
+ * @param string|array $args Override defaults.
+ * @return string XML response.
+ */
+ function add( $args = '' ) {
+ $defaults = array(
+ 'what' => 'object', 'action' => false,
+ 'id' => '0', 'old_id' => false,
+ 'position' => 1,
+ 'data' => '', 'supplemental' => array()
+ );
+
+ $r = wp_parse_args( $args, $defaults );
+ extract( $r, EXTR_SKIP );
+ $position = preg_replace( '/[^a-z0-9:_-]/i', '', $position );
+
+ if ( is_wp_error($id) ) {
+ $data = $id;
+ $id = 0;
+ }
+
+ $response = '';
+ if ( is_wp_error($data) ) {
+ foreach ( (array) $data->get_error_codes() as $code ) {
+ $response .= "get_error_message($code) . "]]> ";
+ if ( !$error_data = $data->get_error_data($code) )
+ continue;
+ $class = '';
+ if ( is_object($error_data) ) {
+ $class = ' class="' . get_class($error_data) . '"';
+ $error_data = get_object_vars($error_data);
+ }
+
+ $response .= "";
+
+ if ( is_scalar($error_data) ) {
+ $response .= "";
+ } elseif ( is_array($error_data) ) {
+ foreach ( $error_data as $k => $v )
+ $response .= "<$k>$k>";
+ }
+
+ $response .= " ";
+ }
+ } else {
+ $response = " ";
+ }
+
+ $s = '';
+ if ( is_array($supplemental) ) {
+ foreach ( $supplemental as $k => $v )
+ $s .= "<$k>$k>";
+ $s = "$s ";
+ }
+
+ if ( false === $action )
+ $action = $_POST['action'];
+
+ $x = '';
+ $x .= ""; // The action attribute in the xml output is formatted like a nonce action
+ $x .= "<$what id='$id' " . ( false === $old_id ? '' : "old_id='$old_id' " ) . "position='$position'>";
+ $x .= $response;
+ $x .= $s;
+ $x .= "$what>";
+ $x .= " ";
+
+ $this->responses[] = $x;
+ return $x;
+ }
+
+ /**
+ * Display XML formatted responses.
+ *
+ * Sets the content type header to text/xml.
+ *
+ * @since 2.1.0
+ */
+ function send() {
+ header('Content-Type: text/xml');
+ echo "";
+ foreach ( (array) $this->responses as $response )
+ echo $response;
+ echo ' ';
+ die();
+ }
+}
+
+?>
diff --git a/wp-includes/class-wp-error.php b/wp-includes/class-wp-error.php
new file mode 100644
index 00000000..16241958
--- /dev/null
+++ b/wp-includes/class-wp-error.php
@@ -0,0 +1,212 @@
+errors[$code][] = $message;
+
+ if ( ! empty($data) )
+ $this->error_data[$code] = $data;
+ }
+
+ /**
+ * Retrieve all error codes.
+ *
+ * @since 2.1.0
+ * @access public
+ *
+ * @return array List of error codes, if avaiable.
+ */
+ function get_error_codes() {
+ if ( empty($this->errors) )
+ return array();
+
+ return array_keys($this->errors);
+ }
+
+ /**
+ * Retrieve first error code available.
+ *
+ * @since 2.1.0
+ * @access public
+ *
+ * @return string|int Empty string, if no error codes.
+ */
+ function get_error_code() {
+ $codes = $this->get_error_codes();
+
+ if ( empty($codes) )
+ return '';
+
+ return $codes[0];
+ }
+
+ /**
+ * Retrieve all error messages or error messages matching code.
+ *
+ * @since 2.1.0
+ *
+ * @param string|int $code Optional. Retrieve messages matching code, if exists.
+ * @return array Error strings on success, or empty array on failure (if using codee parameter).
+ */
+ function get_error_messages($code = '') {
+ // Return all messages if no code specified.
+ if ( empty($code) ) {
+ $all_messages = array();
+ foreach ( (array) $this->errors as $code => $messages )
+ $all_messages = array_merge($all_messages, $messages);
+
+ return $all_messages;
+ }
+
+ if ( isset($this->errors[$code]) )
+ return $this->errors[$code];
+ else
+ return array();
+ }
+
+ /**
+ * Get single error message.
+ *
+ * This will get the first message available for the code. If no code is
+ * given then the first code available will be used.
+ *
+ * @since 2.1.0
+ *
+ * @param string|int $code Optional. Error code to retrieve message.
+ * @return string
+ */
+ function get_error_message($code = '') {
+ if ( empty($code) )
+ $code = $this->get_error_code();
+ $messages = $this->get_error_messages($code);
+ if ( empty($messages) )
+ return '';
+ return $messages[0];
+ }
+
+ /**
+ * Retrieve error data for error code.
+ *
+ * @since 2.1.0
+ *
+ * @param string|int $code Optional. Error code.
+ * @return mixed Null, if no errors.
+ */
+ function get_error_data($code = '') {
+ if ( empty($code) )
+ $code = $this->get_error_code();
+
+ if ( isset($this->error_data[$code]) )
+ return $this->error_data[$code];
+ return null;
+ }
+
+ /**
+ * Append more error messages to list of error messages.
+ *
+ * @since 2.1.0
+ * @access public
+ *
+ * @param string|int $code Error code.
+ * @param string $message Error message.
+ * @param mixed $data Optional. Error data.
+ */
+ function add($code, $message, $data = '') {
+ $this->errors[$code][] = $message;
+ if ( ! empty($data) )
+ $this->error_data[$code] = $data;
+ }
+
+ /**
+ * Add data for error code.
+ *
+ * The error code can only contain one error data.
+ *
+ * @since 2.1.0
+ *
+ * @param mixed $data Error data.
+ * @param string|int $code Error code.
+ */
+ function add_data($data, $code = '') {
+ if ( empty($code) )
+ $code = $this->get_error_code();
+
+ $this->error_data[$code] = $data;
+ }
+}
+
+/**
+ * Check whether variable is a WordPress Error.
+ *
+ * Looks at the object and if a WP_Error class. Does not check to see if the
+ * parent is also WP_Error, so can't inherit WP_Error and still use this
+ * function.
+ *
+ * @since 2.1.0
+ *
+ * @param mixed $thing Check if unknown variable is WordPress Error object.
+ * @return bool True, if WP_Error. False, if not WP_Error.
+ */
+function is_wp_error($thing) {
+ if ( is_object($thing) && is_a($thing, 'WP_Error') )
+ return true;
+ return false;
+}
+
+?>
\ No newline at end of file
diff --git a/wp-includes/class-wp-http-ixr-client.php b/wp-includes/class-wp-http-ixr-client.php
new file mode 100644
index 00000000..4c36334e
--- /dev/null
+++ b/wp-includes/class-wp-http-ixr-client.php
@@ -0,0 +1,91 @@
+scheme = $bits['scheme'];
+ $this->server = $bits['host'];
+ $this->port = isset($bits['port']) ? $bits['port'] : 80;
+ $this->path = !empty($bits['path']) ? $bits['path'] : '/';
+
+ // Make absolutely sure we have a path
+ if ( ! $this->path )
+ $this->path = '/';
+ } else {
+ $this->scheme = 'http';
+ $this->server = $server;
+ $this->path = $path;
+ $this->port = $port;
+ }
+ $this->useragent = 'The Incutio XML-RPC PHP Library';
+ $this->timeout = $timeout;
+ }
+
+ function query() {
+ $args = func_get_args();
+ $method = array_shift($args);
+ $request = new IXR_Request($method, $args);
+ $xml = $request->getXml();
+
+ $url = $this->scheme . '://' . $this->server . ':' . $this->port . $this->path;
+ $args = array(
+ 'headers' => array('Content-Type' => 'text/xml'),
+ 'user-agent' => $this->useragent,
+ 'body' => $xml,
+ );
+
+ // Merge Custom headers ala #8145
+ foreach ( $this->headers as $header => $value )
+ $args['headers'][$header] = $value;
+
+ if ( $this->timeout !== false )
+ $args['timeout'] = $this->timeout;
+
+ // Now send the request
+ if ( $this->debug )
+ echo ' ' . htmlspecialchars($xml) . "\n \n\n";
+
+ $response = wp_remote_post($url, $args);
+
+ if ( is_wp_error($response) ) {
+ $errno = $response->get_error_code();
+ $errorstr = $response->get_error_message();
+ $this->error = new IXR_Error(-32300, "transport error: $errno $errorstr");
+ return false;
+ }
+
+ if ( $response['response']['code'] != 200 ) {
+ $this->error = new IXR_Error(-32301, "transport error - HTTP status code was not 200 ({$response['response']['code']})");
+ return false;
+ }
+
+ if ( $this->debug )
+ echo '' . htmlspecialchars($response['body']) . "\n \n\n";
+
+ // Now parse what we've got back
+ $this->message = new IXR_Message( $response['body'] );
+ if ( ! $this->message->parse() ) {
+ // XML error
+ $this->error = new IXR_Error(-32700, 'parse error. not well formed');
+ return false;
+ }
+
+ // Is the message a fault?
+ if ( $this->message->messageType == 'fault' ) {
+ $this->error = new IXR_Error($this->message->faultCode, $this->message->faultString);
+ return false;
+ }
+
+ // Message must be OK
+ return true;
+ }
+}
+?>
\ No newline at end of file
diff --git a/wp-includes/class-wp-walker.php b/wp-includes/class-wp-walker.php
new file mode 100644
index 00000000..25e04059
--- /dev/null
+++ b/wp-includes/class-wp-walker.php
@@ -0,0 +1,399 @@
+db_fields['id'];
+
+ //display this element
+ if ( is_array( $args[0] ) )
+ $args[0]['has_children'] = ! empty( $children_elements[$element->$id_field] );
+ $cb_args = array_merge( array(&$output, $element, $depth), $args);
+ call_user_func_array(array(&$this, 'start_el'), $cb_args);
+
+ $id = $element->$id_field;
+
+ // descend only when the depth is right and there are childrens for this element
+ if ( ($max_depth == 0 || $max_depth > $depth+1 ) && isset( $children_elements[$id]) ) {
+
+ foreach( $children_elements[ $id ] as $child ){
+
+ if ( !isset($newlevel) ) {
+ $newlevel = true;
+ //start the child delimiter
+ $cb_args = array_merge( array(&$output, $depth), $args);
+ call_user_func_array(array(&$this, 'start_lvl'), $cb_args);
+ }
+ $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output );
+ }
+ unset( $children_elements[ $id ] );
+ }
+
+ if ( isset($newlevel) && $newlevel ){
+ //end the child delimiter
+ $cb_args = array_merge( array(&$output, $depth), $args);
+ call_user_func_array(array(&$this, 'end_lvl'), $cb_args);
+ }
+
+ //end this element
+ $cb_args = array_merge( array(&$output, $element, $depth), $args);
+ call_user_func_array(array(&$this, 'end_el'), $cb_args);
+ }
+
+ /**
+ * Display array of elements hierarchically.
+ *
+ * It is a generic function which does not assume any existing order of
+ * elements. max_depth = -1 means flatly display every element. max_depth =
+ * 0 means display all levels. max_depth > 0 specifies the number of
+ * display levels.
+ *
+ * @since 2.1.0
+ *
+ * @param array $elements
+ * @param int $max_depth
+ * @return string
+ */
+ function walk( $elements, $max_depth) {
+
+ $args = array_slice(func_get_args(), 2);
+ $output = '';
+
+ if ($max_depth < -1) //invalid parameter
+ return $output;
+
+ if (empty($elements)) //nothing to walk
+ return $output;
+
+ $id_field = $this->db_fields['id'];
+ $parent_field = $this->db_fields['parent'];
+
+ // flat display
+ if ( -1 == $max_depth ) {
+ $empty_array = array();
+ foreach ( $elements as $e )
+ $this->display_element( $e, $empty_array, 1, 0, $args, $output );
+ return $output;
+ }
+
+ /*
+ * need to display in hierarchical order
+ * separate elements into two buckets: top level and children elements
+ * children_elements is two dimensional array, eg.
+ * children_elements[10][] contains all sub-elements whose parent is 10.
+ */
+ $top_level_elements = array();
+ $children_elements = array();
+ foreach ( $elements as $e) {
+ if ( 0 == $e->$parent_field )
+ $top_level_elements[] = $e;
+ else
+ $children_elements[ $e->$parent_field ][] = $e;
+ }
+
+ /*
+ * when none of the elements is top level
+ * assume the first one must be root of the sub elements
+ */
+ if ( empty($top_level_elements) ) {
+
+ $first = array_slice( $elements, 0, 1 );
+ $root = $first[0];
+
+ $top_level_elements = array();
+ $children_elements = array();
+ foreach ( $elements as $e) {
+ if ( $root->$parent_field == $e->$parent_field )
+ $top_level_elements[] = $e;
+ else
+ $children_elements[ $e->$parent_field ][] = $e;
+ }
+ }
+
+ foreach ( $top_level_elements as $e )
+ $this->display_element( $e, $children_elements, $max_depth, 0, $args, $output );
+
+ /*
+ * if we are displaying all levels, and remaining children_elements is not empty,
+ * then we got orphans, which should be displayed regardless
+ */
+ if ( ( $max_depth == 0 ) && count( $children_elements ) > 0 ) {
+ $empty_array = array();
+ foreach ( $children_elements as $orphans )
+ foreach( $orphans as $op )
+ $this->display_element( $op, $empty_array, 1, 0, $args, $output );
+ }
+
+ return $output;
+ }
+
+ /**
+ * paged_walk() - produce a page of nested elements
+ *
+ * Given an array of hierarchical elements, the maximum depth, a specific page number,
+ * and number of elements per page, this function first determines all top level root elements
+ * belonging to that page, then lists them and all of their children in hierarchical order.
+ *
+ * @package WordPress
+ * @since 2.7
+ * @param int $max_depth = 0 means display all levels; $max_depth > 0 specifies the number of display levels.
+ * @param int $page_num the specific page number, beginning with 1.
+ * @return XHTML of the specified page of elements
+ */
+ function paged_walk( $elements, $max_depth, $page_num, $per_page ) {
+
+ /* sanity check */
+ if ( empty($elements) || $max_depth < -1 )
+ return '';
+
+ $args = array_slice( func_get_args(), 4 );
+ $output = '';
+
+ $id_field = $this->db_fields['id'];
+ $parent_field = $this->db_fields['parent'];
+
+ $count = -1;
+ if ( -1 == $max_depth )
+ $total_top = count( $elements );
+ if ( $page_num < 1 || $per_page < 0 ) {
+ // No paging
+ $paging = false;
+ $start = 0;
+ if ( -1 == $max_depth )
+ $end = $total_top;
+ $this->max_pages = 1;
+ } else {
+ $paging = true;
+ $start = ( (int)$page_num - 1 ) * (int)$per_page;
+ $end = $start + $per_page;
+ if ( -1 == $max_depth )
+ $this->max_pages = ceil($total_top / $per_page);
+ }
+
+ // flat display
+ if ( -1 == $max_depth ) {
+ if ( !empty($args[0]['reverse_top_level']) ) {
+ $elements = array_reverse( $elements );
+ $oldstart = $start;
+ $start = $total_top - $end;
+ $end = $total_top - $oldstart;
+ }
+
+ $empty_array = array();
+ foreach ( $elements as $e ) {
+ $count++;
+ if ( $count < $start )
+ continue;
+ if ( $count >= $end )
+ break;
+ $this->display_element( $e, $empty_array, 1, 0, $args, $output );
+ }
+ return $output;
+ }
+
+ /*
+ * separate elements into two buckets: top level and children elements
+ * children_elements is two dimensional array, eg.
+ * children_elements[10][] contains all sub-elements whose parent is 10.
+ */
+ $top_level_elements = array();
+ $children_elements = array();
+ foreach ( $elements as $e) {
+ if ( 0 == $e->$parent_field )
+ $top_level_elements[] = $e;
+ else
+ $children_elements[ $e->$parent_field ][] = $e;
+ }
+
+ $total_top = count( $top_level_elements );
+ if ( $paging )
+ $this->max_pages = ceil($total_top / $per_page);
+ else
+ $end = $total_top;
+
+ if ( !empty($args[0]['reverse_top_level']) ) {
+ $top_level_elements = array_reverse( $top_level_elements );
+ $oldstart = $start;
+ $start = $total_top - $end;
+ $end = $total_top - $oldstart;
+ }
+ if ( !empty($args[0]['reverse_children']) ) {
+ foreach ( $children_elements as $parent => $children )
+ $children_elements[$parent] = array_reverse( $children );
+ }
+
+ foreach ( $top_level_elements as $e ) {
+ $count++;
+
+ //for the last page, need to unset earlier children in order to keep track of orphans
+ if ( $end >= $total_top && $count < $start )
+ $this->unset_children( $e, $children_elements );
+
+ if ( $count < $start )
+ continue;
+
+ if ( $count >= $end )
+ break;
+
+ $this->display_element( $e, $children_elements, $max_depth, 0, $args, $output );
+ }
+
+ if ( $end >= $total_top && count( $children_elements ) > 0 ) {
+ $empty_array = array();
+ foreach ( $children_elements as $orphans )
+ foreach( $orphans as $op )
+ $this->display_element( $op, $empty_array, 1, 0, $args, $output );
+ }
+
+ return $output;
+ }
+
+ function get_number_of_root_elements( $elements ){
+
+ $num = 0;
+ $parent_field = $this->db_fields['parent'];
+
+ foreach ( $elements as $e) {
+ if ( 0 == $e->$parent_field )
+ $num++;
+ }
+ return $num;
+ }
+
+ // unset all the children for a given top level element
+ function unset_children( $e, &$children_elements ){
+
+ if ( !$e || !$children_elements )
+ return;
+
+ $id_field = $this->db_fields['id'];
+ $id = $e->$id_field;
+
+ if ( !empty($children_elements[$id]) && is_array($children_elements[$id]) )
+ foreach ( (array) $children_elements[$id] as $child )
+ $this->unset_children( $child, $children_elements );
+
+ if ( isset($children_elements[$id]) )
+ unset( $children_elements[$id] );
+
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/wp-includes/class-wp-xmlrpc-server.php b/wp-includes/class-wp-xmlrpc-server.php
new file mode 100644
index 00000000..5e9bbd49
--- /dev/null
+++ b/wp-includes/class-wp-xmlrpc-server.php
@@ -0,0 +1,3527 @@
+methods = array(
+ // WordPress API
+ 'wp.getUsersBlogs' => 'this:wp_getUsersBlogs',
+ 'wp.getPage' => 'this:wp_getPage',
+ 'wp.getPages' => 'this:wp_getPages',
+ 'wp.newPage' => 'this:wp_newPage',
+ 'wp.deletePage' => 'this:wp_deletePage',
+ 'wp.editPage' => 'this:wp_editPage',
+ 'wp.getPageList' => 'this:wp_getPageList',
+ 'wp.getAuthors' => 'this:wp_getAuthors',
+ 'wp.getCategories' => 'this:mw_getCategories', // Alias
+ 'wp.getTags' => 'this:wp_getTags',
+ 'wp.newCategory' => 'this:wp_newCategory',
+ 'wp.deleteCategory' => 'this:wp_deleteCategory',
+ 'wp.suggestCategories' => 'this:wp_suggestCategories',
+ 'wp.uploadFile' => 'this:mw_newMediaObject', // Alias
+ 'wp.getCommentCount' => 'this:wp_getCommentCount',
+ 'wp.getPostStatusList' => 'this:wp_getPostStatusList',
+ 'wp.getPageStatusList' => 'this:wp_getPageStatusList',
+ 'wp.getPageTemplates' => 'this:wp_getPageTemplates',
+ 'wp.getOptions' => 'this:wp_getOptions',
+ 'wp.setOptions' => 'this:wp_setOptions',
+ 'wp.getComment' => 'this:wp_getComment',
+ 'wp.getComments' => 'this:wp_getComments',
+ 'wp.deleteComment' => 'this:wp_deleteComment',
+ 'wp.editComment' => 'this:wp_editComment',
+ 'wp.newComment' => 'this:wp_newComment',
+ 'wp.getCommentStatusList' => 'this:wp_getCommentStatusList',
+ 'wp.getMediaItem' => 'this:wp_getMediaItem',
+ 'wp.getMediaLibrary' => 'this:wp_getMediaLibrary',
+ 'wp.getPostFormats' => 'this:wp_getPostFormats',
+
+ // Blogger API
+ 'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs',
+ 'blogger.getUserInfo' => 'this:blogger_getUserInfo',
+ 'blogger.getPost' => 'this:blogger_getPost',
+ 'blogger.getRecentPosts' => 'this:blogger_getRecentPosts',
+ 'blogger.getTemplate' => 'this:blogger_getTemplate',
+ 'blogger.setTemplate' => 'this:blogger_setTemplate',
+ 'blogger.newPost' => 'this:blogger_newPost',
+ 'blogger.editPost' => 'this:blogger_editPost',
+ 'blogger.deletePost' => 'this:blogger_deletePost',
+
+ // MetaWeblog API (with MT extensions to structs)
+ 'metaWeblog.newPost' => 'this:mw_newPost',
+ 'metaWeblog.editPost' => 'this:mw_editPost',
+ 'metaWeblog.getPost' => 'this:mw_getPost',
+ 'metaWeblog.getRecentPosts' => 'this:mw_getRecentPosts',
+ 'metaWeblog.getCategories' => 'this:mw_getCategories',
+ 'metaWeblog.newMediaObject' => 'this:mw_newMediaObject',
+
+ // MetaWeblog API aliases for Blogger API
+ // see http://www.xmlrpc.com/stories/storyReader$2460
+ 'metaWeblog.deletePost' => 'this:blogger_deletePost',
+ 'metaWeblog.getTemplate' => 'this:blogger_getTemplate',
+ 'metaWeblog.setTemplate' => 'this:blogger_setTemplate',
+ 'metaWeblog.getUsersBlogs' => 'this:blogger_getUsersBlogs',
+
+ // MovableType API
+ 'mt.getCategoryList' => 'this:mt_getCategoryList',
+ 'mt.getRecentPostTitles' => 'this:mt_getRecentPostTitles',
+ 'mt.getPostCategories' => 'this:mt_getPostCategories',
+ 'mt.setPostCategories' => 'this:mt_setPostCategories',
+ 'mt.supportedMethods' => 'this:mt_supportedMethods',
+ 'mt.supportedTextFilters' => 'this:mt_supportedTextFilters',
+ 'mt.getTrackbackPings' => 'this:mt_getTrackbackPings',
+ 'mt.publishPost' => 'this:mt_publishPost',
+
+ // PingBack
+ 'pingback.ping' => 'this:pingback_ping',
+ 'pingback.extensions.getPingbacks' => 'this:pingback_extensions_getPingbacks',
+
+ 'demo.sayHello' => 'this:sayHello',
+ 'demo.addTwoNumbers' => 'this:addTwoNumbers'
+ );
+
+ $this->initialise_blog_option_info( );
+ $this->methods = apply_filters('xmlrpc_methods', $this->methods);
+ }
+
+ function serve_request() {
+ $this->IXR_Server($this->methods);
+ }
+
+ /**
+ * Test XMLRPC API by saying, "Hello!" to client.
+ *
+ * @since 1.5.0
+ *
+ * @param array $args Method Parameters.
+ * @return string
+ */
+ function sayHello($args) {
+ return 'Hello!';
+ }
+
+ /**
+ * Test XMLRPC API by adding two numbers for client.
+ *
+ * @since 1.5.0
+ *
+ * @param array $args Method Parameters.
+ * @return int
+ */
+ function addTwoNumbers($args) {
+ $number1 = $args[0];
+ $number2 = $args[1];
+ return $number1 + $number2;
+ }
+
+ /**
+ * Check user's credentials.
+ *
+ * @since 1.5.0
+ *
+ * @param string $user_login User's username.
+ * @param string $user_pass User's password.
+ * @return bool Whether authentication passed.
+ * @deprecated use wp_xmlrpc_server::login
+ * @see wp_xmlrpc_server::login
+ */
+ function login_pass_ok($user_login, $user_pass) {
+ if ( !get_option( 'enable_xmlrpc' ) ) {
+ $this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this site. An admin user can enable them at %s'), admin_url('options-writing.php') ) );
+ return false;
+ }
+
+ if (!user_pass_ok($user_login, $user_pass)) {
+ $this->error = new IXR_Error(403, __('Bad login/pass combination.'));
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Log user in.
+ *
+ * @since 2.8
+ *
+ * @param string $username User's username.
+ * @param string $password User's password.
+ * @return mixed WP_User object if authentication passed, false otherwise
+ */
+ function login($username, $password) {
+ if ( !get_option( 'enable_xmlrpc' ) ) {
+ $this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this site. An admin user can enable them at %s'), admin_url('options-writing.php') ) );
+ return false;
+ }
+
+ $user = wp_authenticate($username, $password);
+
+ if (is_wp_error($user)) {
+ $this->error = new IXR_Error(403, __('Bad login/pass combination.'));
+ return false;
+ }
+
+ wp_set_current_user( $user->ID );
+ return $user;
+ }
+
+ /**
+ * Sanitize string or array of strings for database.
+ *
+ * @since 1.5.2
+ *
+ * @param string|array $array Sanitize single string or array of strings.
+ * @return string|array Type matches $array and sanitized for the database.
+ */
+ function escape(&$array) {
+ global $wpdb;
+
+ if (!is_array($array)) {
+ return($wpdb->escape($array));
+ } else {
+ foreach ( (array) $array as $k => $v ) {
+ if ( is_array($v) ) {
+ $this->escape($array[$k]);
+ } else if ( is_object($v) ) {
+ //skip
+ } else {
+ $array[$k] = $wpdb->escape($v);
+ }
+ }
+ }
+ }
+
+ /**
+ * Retrieve custom fields for post.
+ *
+ * @since 2.5.0
+ *
+ * @param int $post_id Post ID.
+ * @return array Custom fields, if exist.
+ */
+ function get_custom_fields($post_id) {
+ $post_id = (int) $post_id;
+
+ $custom_fields = array();
+
+ foreach ( (array) has_meta($post_id) as $meta ) {
+ // Don't expose protected fields.
+ if ( strpos($meta['meta_key'], '_wp_') === 0 ) {
+ continue;
+ }
+
+ $custom_fields[] = array(
+ "id" => $meta['meta_id'],
+ "key" => $meta['meta_key'],
+ "value" => $meta['meta_value']
+ );
+ }
+
+ return $custom_fields;
+ }
+
+ /**
+ * Set custom fields for post.
+ *
+ * @since 2.5.0
+ *
+ * @param int $post_id Post ID.
+ * @param array $fields Custom fields.
+ */
+ function set_custom_fields($post_id, $fields) {
+ $post_id = (int) $post_id;
+
+ foreach ( (array) $fields as $meta ) {
+ if ( isset($meta['id']) ) {
+ $meta['id'] = (int) $meta['id'];
+
+ if ( isset($meta['key']) ) {
+ update_meta($meta['id'], $meta['key'], $meta['value']);
+ }
+ else {
+ delete_meta($meta['id']);
+ }
+ }
+ else {
+ $_POST['metakeyinput'] = $meta['key'];
+ $_POST['metavalue'] = $meta['value'];
+ add_meta($post_id);
+ }
+ }
+ }
+
+ /**
+ * Set up blog options property.
+ *
+ * Passes property through 'xmlrpc_blog_options' filter.
+ *
+ * @since 2.6.0
+ */
+ function initialise_blog_option_info( ) {
+ global $wp_version;
+
+ $this->blog_options = array(
+ // Read only options
+ 'software_name' => array(
+ 'desc' => __( 'Software Name' ),
+ 'readonly' => true,
+ 'value' => 'WordPress'
+ ),
+ 'software_version' => array(
+ 'desc' => __( 'Software Version' ),
+ 'readonly' => true,
+ 'value' => $wp_version
+ ),
+ 'blog_url' => array(
+ 'desc' => __( 'Site URL' ),
+ 'readonly' => true,
+ 'option' => 'siteurl'
+ ),
+
+ // Updatable options
+ 'time_zone' => array(
+ 'desc' => __( 'Time Zone' ),
+ 'readonly' => false,
+ 'option' => 'gmt_offset'
+ ),
+ 'blog_title' => array(
+ 'desc' => __( 'Site Title' ),
+ 'readonly' => false,
+ 'option' => 'blogname'
+ ),
+ 'blog_tagline' => array(
+ 'desc' => __( 'Site Tagline' ),
+ 'readonly' => false,
+ 'option' => 'blogdescription'
+ ),
+ 'date_format' => array(
+ 'desc' => __( 'Date Format' ),
+ 'readonly' => false,
+ 'option' => 'date_format'
+ ),
+ 'time_format' => array(
+ 'desc' => __( 'Time Format' ),
+ 'readonly' => false,
+ 'option' => 'time_format'
+ ),
+ 'users_can_register' => array(
+ 'desc' => __( 'Allow new users to sign up' ),
+ 'readonly' => false,
+ 'option' => 'users_can_register'
+ ),
+ 'thumbnail_size_w' => array(
+ 'desc' => __( 'Thumbnail Width' ),
+ 'readonly' => false,
+ 'option' => 'thumbnail_size_w'
+ ),
+ 'thumbnail_size_h' => array(
+ 'desc' => __( 'Thumbnail Height' ),
+ 'readonly' => false,
+ 'option' => 'thumbnail_size_h'
+ ),
+ 'thumbnail_crop' => array(
+ 'desc' => __( 'Crop thumbnail to exact dimensions' ),
+ 'readonly' => false,
+ 'option' => 'thumbnail_crop'
+ ),
+ 'medium_size_w' => array(
+ 'desc' => __( 'Medium size image width' ),
+ 'readonly' => false,
+ 'option' => 'medium_size_w'
+ ),
+ 'medium_size_h' => array(
+ 'desc' => __( 'Medium size image height' ),
+ 'readonly' => false,
+ 'option' => 'medium_size_h'
+ ),
+ 'large_size_w' => array(
+ 'desc' => __( 'Large size image width' ),
+ 'readonly' => false,
+ 'option' => 'large_size_w'
+ ),
+ 'large_size_h' => array(
+ 'desc' => __( 'Large size image height' ),
+ 'readonly' => false,
+ 'option' => 'large_size_h'
+ )
+ );
+
+ $this->blog_options = apply_filters( 'xmlrpc_blog_options', $this->blog_options );
+ }
+
+ /**
+ * Retrieve the blogs of the user.
+ *
+ * @since 2.6.0
+ *
+ * @param array $args Method parameters.
+ * @return array
+ */
+ function wp_getUsersBlogs( $args ) {
+ global $current_site;
+ // If this isn't on WPMU then just use blogger_getUsersBlogs
+ if ( !is_multisite() ) {
+ array_unshift( $args, 1 );
+ return $this->blogger_getUsersBlogs( $args );
+ }
+
+ $this->escape( $args );
+
+ $username = $args[0];
+ $password = $args[1];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+
+ do_action( 'xmlrpc_call', 'wp.getUsersBlogs' );
+
+ $blogs = (array) get_blogs_of_user( $user->ID );
+ $struct = array( );
+
+ foreach ( $blogs as $blog ) {
+ // Don't include blogs that aren't hosted at this site
+ if ( $blog->site_id != $current_site->id )
+ continue;
+
+ $blog_id = $blog->userblog_id;
+ switch_to_blog($blog_id);
+ $is_admin = current_user_can('manage_options');
+
+ $struct[] = array(
+ 'isAdmin' => $is_admin,
+ 'url' => get_option( 'home' ) . '/',
+ 'blogid' => (string) $blog_id,
+ 'blogName' => get_option( 'blogname' ),
+ 'xmlrpc' => site_url( 'xmlrpc.php' )
+ );
+
+ restore_current_blog( );
+ }
+
+ return $struct;
+ }
+
+ /**
+ * Retrieve page.
+ *
+ * @since 2.2.0
+ *
+ * @param array $args Method parameters.
+ * @return array
+ */
+ function wp_getPage($args) {
+ $this->escape($args);
+
+ $blog_id = (int) $args[0];
+ $page_id = (int) $args[1];
+ $username = $args[2];
+ $password = $args[3];
+
+ if ( !$user = $this->login($username, $password) ) {
+ return $this->error;
+ }
+
+ if ( !current_user_can( 'edit_page', $page_id ) )
+ return new IXR_Error( 401, __( 'Sorry, you cannot edit this page.' ) );
+
+ do_action('xmlrpc_call', 'wp.getPage');
+
+ // Lookup page info.
+ $page = get_page($page_id);
+
+ // If we found the page then format the data.
+ if ( $page->ID && ($page->post_type == "page") ) {
+ // Get all of the page content and link.
+ $full_page = get_extended($page->post_content);
+ $link = post_permalink($page->ID);
+
+ // Get info the page parent if there is one.
+ $parent_title = "";
+ if ( !empty($page->post_parent) ) {
+ $parent = get_page($page->post_parent);
+ $parent_title = $parent->post_title;
+ }
+
+ // Determine comment and ping settings.
+ $allow_comments = comments_open($page->ID) ? 1 : 0;
+ $allow_pings = pings_open($page->ID) ? 1 : 0;
+
+ // Format page date.
+ $page_date = mysql2date("Ymd\TH:i:s", $page->post_date, false);
+ $page_date_gmt = mysql2date("Ymd\TH:i:s", $page->post_date_gmt, false);
+
+ // For drafts use the GMT version of the date
+ if ( $page->post_status == 'draft' )
+ $page_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $page->post_date ), 'Ymd\TH:i:s' );
+
+ // Pull the categories info together.
+ $categories = array();
+ foreach ( wp_get_post_categories($page->ID) as $cat_id ) {
+ $categories[] = get_cat_name($cat_id);
+ }
+
+ // Get the author info.
+ $author = get_userdata($page->post_author);
+
+ $page_template = get_post_meta( $page->ID, '_wp_page_template', true );
+ if ( empty( $page_template ) )
+ $page_template = 'default';
+
+ $page_struct = array(
+ "dateCreated" => new IXR_Date($page_date),
+ "userid" => $page->post_author,
+ "page_id" => $page->ID,
+ "page_status" => $page->post_status,
+ "description" => $full_page["main"],
+ "title" => $page->post_title,
+ "link" => $link,
+ "permaLink" => $link,
+ "categories" => $categories,
+ "excerpt" => $page->post_excerpt,
+ "text_more" => $full_page["extended"],
+ "mt_allow_comments" => $allow_comments,
+ "mt_allow_pings" => $allow_pings,
+ "wp_slug" => $page->post_name,
+ "wp_password" => $page->post_password,
+ "wp_author" => $author->display_name,
+ "wp_page_parent_id" => $page->post_parent,
+ "wp_page_parent_title" => $parent_title,
+ "wp_page_order" => $page->menu_order,
+ "wp_author_id" => $author->ID,
+ "wp_author_display_name" => $author->display_name,
+ "date_created_gmt" => new IXR_Date($page_date_gmt),
+ "custom_fields" => $this->get_custom_fields($page_id),
+ "wp_page_template" => $page_template
+ );
+
+ return($page_struct);
+ }
+ // If the page doesn't exist indicate that.
+ else {
+ return(new IXR_Error(404, __("Sorry, no such page.")));
+ }
+ }
+
+ /**
+ * Retrieve Pages.
+ *
+ * @since 2.2.0
+ *
+ * @param array $args Method parameters.
+ * @return array
+ */
+ function wp_getPages($args) {
+ $this->escape($args);
+
+ $blog_id = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+ $num_pages = isset($args[3]) ? (int) $args[3] : 10;
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ if ( !current_user_can( 'edit_pages' ) )
+ return new IXR_Error( 401, __( 'Sorry, you cannot edit pages.' ) );
+
+ do_action('xmlrpc_call', 'wp.getPages');
+
+ $pages = get_posts( array('post_type' => 'page', 'post_status' => 'any', 'numberposts' => $num_pages) );
+ $num_pages = count($pages);
+
+ // If we have pages, put together their info.
+ if ( $num_pages >= 1 ) {
+ $pages_struct = array();
+
+ for ( $i = 0; $i < $num_pages; $i++ ) {
+ $page = wp_xmlrpc_server::wp_getPage(array(
+ $blog_id, $pages[$i]->ID, $username, $password
+ ));
+ $pages_struct[] = $page;
+ }
+
+ return($pages_struct);
+ }
+ // If no pages were found return an error.
+ else {
+ return(array());
+ }
+ }
+
+ /**
+ * Create new page.
+ *
+ * @since 2.2.0
+ *
+ * @param array $args Method parameters.
+ * @return unknown
+ */
+ function wp_newPage($args) {
+ // Items not escaped here will be escaped in newPost.
+ $username = $this->escape($args[1]);
+ $password = $this->escape($args[2]);
+ $page = $args[3];
+ $publish = $args[4];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ do_action('xmlrpc_call', 'wp.newPage');
+
+ // Make sure the user is allowed to add new pages.
+ if ( !current_user_can("publish_pages") )
+ return(new IXR_Error(401, __("Sorry, you cannot add new pages.")));
+
+ // Mark this as content for a page.
+ $args[3]["post_type"] = "page";
+
+ // Let mw_newPost do all of the heavy lifting.
+ return($this->mw_newPost($args));
+ }
+
+ /**
+ * Delete page.
+ *
+ * @since 2.2.0
+ *
+ * @param array $args Method parameters.
+ * @return bool True, if success.
+ */
+ function wp_deletePage($args) {
+ $this->escape($args);
+
+ $blog_id = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+ $page_id = (int) $args[3];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ do_action('xmlrpc_call', 'wp.deletePage');
+
+ // Get the current page based on the page_id and
+ // make sure it is a page and not a post.
+ $actual_page = wp_get_single_post($page_id, ARRAY_A);
+ if ( !$actual_page || ($actual_page["post_type"] != "page") )
+ return(new IXR_Error(404, __("Sorry, no such page.")));
+
+ // Make sure the user can delete pages.
+ if ( !current_user_can("delete_page", $page_id) )
+ return(new IXR_Error(401, __("Sorry, you do not have the right to delete this page.")));
+
+ // Attempt to delete the page.
+ $result = wp_delete_post($page_id);
+ if ( !$result )
+ return(new IXR_Error(500, __("Failed to delete the page.")));
+
+ return(true);
+ }
+
+ /**
+ * Edit page.
+ *
+ * @since 2.2.0
+ *
+ * @param array $args Method parameters.
+ * @return unknown
+ */
+ function wp_editPage($args) {
+ // Items not escaped here will be escaped in editPost.
+ $blog_id = (int) $args[0];
+ $page_id = (int) $this->escape($args[1]);
+ $username = $this->escape($args[2]);
+ $password = $this->escape($args[3]);
+ $content = $args[4];
+ $publish = $args[5];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ do_action('xmlrpc_call', 'wp.editPage');
+
+ // Get the page data and make sure it is a page.
+ $actual_page = wp_get_single_post($page_id, ARRAY_A);
+ if ( !$actual_page || ($actual_page["post_type"] != "page") )
+ return(new IXR_Error(404, __("Sorry, no such page.")));
+
+ // Make sure the user is allowed to edit pages.
+ if ( !current_user_can("edit_page", $page_id) )
+ return(new IXR_Error(401, __("Sorry, you do not have the right to edit this page.")));
+
+ // Mark this as content for a page.
+ $content["post_type"] = "page";
+
+ // Arrange args in the way mw_editPost understands.
+ $args = array(
+ $page_id,
+ $username,
+ $password,
+ $content,
+ $publish
+ );
+
+ // Let mw_editPost do all of the heavy lifting.
+ return($this->mw_editPost($args));
+ }
+
+ /**
+ * Retrieve page list.
+ *
+ * @since 2.2.0
+ *
+ * @param array $args Method parameters.
+ * @return unknown
+ */
+ function wp_getPageList($args) {
+ global $wpdb;
+
+ $this->escape($args);
+
+ $blog_id = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ if ( !current_user_can( 'edit_pages' ) )
+ return new IXR_Error( 401, __( 'Sorry, you cannot edit pages.' ) );
+
+ do_action('xmlrpc_call', 'wp.getPageList');
+
+ // Get list of pages ids and titles
+ $page_list = $wpdb->get_results("
+ SELECT ID page_id,
+ post_title page_title,
+ post_parent page_parent_id,
+ post_date_gmt,
+ post_date,
+ post_status
+ FROM {$wpdb->posts}
+ WHERE post_type = 'page'
+ ORDER BY ID
+ ");
+
+ // The date needs to be formated properly.
+ $num_pages = count($page_list);
+ for ( $i = 0; $i < $num_pages; $i++ ) {
+ $post_date = mysql2date("Ymd\TH:i:s", $page_list[$i]->post_date, false);
+ $post_date_gmt = mysql2date("Ymd\TH:i:s", $page_list[$i]->post_date_gmt, false);
+
+ $page_list[$i]->dateCreated = new IXR_Date($post_date);
+ $page_list[$i]->date_created_gmt = new IXR_Date($post_date_gmt);
+
+ // For drafts use the GMT version of the date
+ if ( $page_list[$i]->post_status == 'draft' ) {
+ $page_list[$i]->date_created_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $page_list[$i]->post_date ), 'Ymd\TH:i:s' );
+ $page_list[$i]->date_created_gmt = new IXR_Date( $page_list[$i]->date_created_gmt );
+ }
+
+ unset($page_list[$i]->post_date_gmt);
+ unset($page_list[$i]->post_date);
+ unset($page_list[$i]->post_status);
+ }
+
+ return($page_list);
+ }
+
+ /**
+ * Retrieve authors list.
+ *
+ * @since 2.2.0
+ *
+ * @param array $args Method parameters.
+ * @return array
+ */
+ function wp_getAuthors($args) {
+
+ $this->escape($args);
+
+ $blog_id = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ if ( !current_user_can("edit_posts") )
+ return(new IXR_Error(401, __("Sorry, you cannot edit posts on this site.")));
+
+ do_action('xmlrpc_call', 'wp.getAuthors');
+
+ $authors = array();
+ foreach ( get_users( array( 'fields' => array('ID','user_login','display_name') ) ) as $user ) {
+ $authors[] = array(
+ "user_id" => $user->ID,
+ "user_login" => $user->user_login,
+ "display_name" => $user->display_name
+ );
+ }
+
+ return $authors;
+ }
+
+ /**
+ * Get list of all tags
+ *
+ * @since 2.7
+ *
+ * @param array $args Method parameters.
+ * @return array
+ */
+ function wp_getTags( $args ) {
+ $this->escape( $args );
+
+ $blog_id = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ if ( !current_user_can( 'edit_posts' ) )
+ return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view tags.' ) );
+
+ do_action( 'xmlrpc_call', 'wp.getKeywords' );
+
+ $tags = array( );
+
+ if ( $all_tags = get_tags() ) {
+ foreach( (array) $all_tags as $tag ) {
+ $struct['tag_id'] = $tag->term_id;
+ $struct['name'] = $tag->name;
+ $struct['count'] = $tag->count;
+ $struct['slug'] = $tag->slug;
+ $struct['html_url'] = esc_html( get_tag_link( $tag->term_id ) );
+ $struct['rss_url'] = esc_html( get_tag_feed_link( $tag->term_id ) );
+
+ $tags[] = $struct;
+ }
+ }
+
+ return $tags;
+ }
+
+ /**
+ * Create new category.
+ *
+ * @since 2.2.0
+ *
+ * @param array $args Method parameters.
+ * @return int Category ID.
+ */
+ function wp_newCategory($args) {
+ $this->escape($args);
+
+ $blog_id = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+ $category = $args[3];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ do_action('xmlrpc_call', 'wp.newCategory');
+
+ // Make sure the user is allowed to add a category.
+ if ( !current_user_can("manage_categories") )
+ return(new IXR_Error(401, __("Sorry, you do not have the right to add a category.")));
+
+ // If no slug was provided make it empty so that
+ // WordPress will generate one.
+ if ( empty($category["slug"]) )
+ $category["slug"] = "";
+
+ // If no parent_id was provided make it empty
+ // so that it will be a top level page (no parent).
+ if ( !isset($category["parent_id"]) )
+ $category["parent_id"] = "";
+
+ // If no description was provided make it empty.
+ if ( empty($category["description"]) )
+ $category["description"] = "";
+
+ $new_category = array(
+ "cat_name" => $category["name"],
+ "category_nicename" => $category["slug"],
+ "category_parent" => $category["parent_id"],
+ "category_description" => $category["description"]
+ );
+
+ $cat_id = wp_insert_category($new_category, true);
+ if ( is_wp_error( $cat_id ) ) {
+ if ( 'term_exists' == $cat_id->get_error_code() )
+ return (int) $cat_id->get_error_data();
+ else
+ return(new IXR_Error(500, __("Sorry, the new category failed.")));
+ } elseif ( ! $cat_id ) {
+ return(new IXR_Error(500, __("Sorry, the new category failed.")));
+ }
+
+ return($cat_id);
+ }
+
+ /**
+ * Remove category.
+ *
+ * @since 2.5.0
+ *
+ * @param array $args Method parameters.
+ * @return mixed See {@link wp_delete_term()} for return info.
+ */
+ function wp_deleteCategory($args) {
+ $this->escape($args);
+
+ $blog_id = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+ $category_id = (int) $args[3];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ do_action('xmlrpc_call', 'wp.deleteCategory');
+
+ if ( !current_user_can("manage_categories") )
+ return new IXR_Error( 401, __( "Sorry, you do not have the right to delete a category." ) );
+
+ return wp_delete_term( $category_id, 'category' );
+ }
+
+ /**
+ * Retrieve category list.
+ *
+ * @since 2.2.0
+ *
+ * @param array $args Method parameters.
+ * @return array
+ */
+ function wp_suggestCategories($args) {
+ $this->escape($args);
+
+ $blog_id = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+ $category = $args[3];
+ $max_results = (int) $args[4];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ if ( !current_user_can( 'edit_posts' ) )
+ return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts to this site in order to view categories.' ) );
+
+ do_action('xmlrpc_call', 'wp.suggestCategories');
+
+ $category_suggestions = array();
+ $args = array('get' => 'all', 'number' => $max_results, 'name__like' => $category);
+ foreach ( (array) get_categories($args) as $cat ) {
+ $category_suggestions[] = array(
+ "category_id" => $cat->term_id,
+ "category_name" => $cat->name
+ );
+ }
+
+ return($category_suggestions);
+ }
+
+ /**
+ * Retrieve comment.
+ *
+ * @since 2.7.0
+ *
+ * @param array $args Method parameters.
+ * @return array
+ */
+ function wp_getComment($args) {
+ $this->escape($args);
+
+ $blog_id = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+ $comment_id = (int) $args[3];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ if ( !current_user_can( 'moderate_comments' ) )
+ return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
+
+ do_action('xmlrpc_call', 'wp.getComment');
+
+ if ( ! $comment = get_comment($comment_id) )
+ return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
+
+ // Format page date.
+ $comment_date = mysql2date("Ymd\TH:i:s", $comment->comment_date, false);
+ $comment_date_gmt = mysql2date("Ymd\TH:i:s", $comment->comment_date_gmt, false);
+
+ if ( '0' == $comment->comment_approved )
+ $comment_status = 'hold';
+ else if ( 'spam' == $comment->comment_approved )
+ $comment_status = 'spam';
+ else if ( '1' == $comment->comment_approved )
+ $comment_status = 'approve';
+ else
+ $comment_status = $comment->comment_approved;
+
+ $link = get_comment_link($comment);
+
+ $comment_struct = array(
+ "date_created_gmt" => new IXR_Date($comment_date_gmt),
+ "user_id" => $comment->user_id,
+ "comment_id" => $comment->comment_ID,
+ "parent" => $comment->comment_parent,
+ "status" => $comment_status,
+ "content" => $comment->comment_content,
+ "link" => $link,
+ "post_id" => $comment->comment_post_ID,
+ "post_title" => get_the_title($comment->comment_post_ID),
+ "author" => $comment->comment_author,
+ "author_url" => $comment->comment_author_url,
+ "author_email" => $comment->comment_author_email,
+ "author_ip" => $comment->comment_author_IP,
+ "type" => $comment->comment_type,
+ );
+
+ return $comment_struct;
+ }
+
+ /**
+ * Retrieve comments.
+ *
+ * @since 2.7.0
+ *
+ * @param array $args Method parameters.
+ * @return array
+ */
+ function wp_getComments($args) {
+ $raw_args = $args;
+ $this->escape($args);
+
+ $blog_id = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+ $struct = $args[3];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ if ( !current_user_can( 'moderate_comments' ) )
+ return new IXR_Error( 401, __( 'Sorry, you cannot edit comments.' ) );
+
+ do_action('xmlrpc_call', 'wp.getComments');
+
+ if ( isset($struct['status']) )
+ $status = $struct['status'];
+ else
+ $status = '';
+
+ $post_id = '';
+ if ( isset($struct['post_id']) )
+ $post_id = absint($struct['post_id']);
+
+ $offset = 0;
+ if ( isset($struct['offset']) )
+ $offset = absint($struct['offset']);
+
+ $number = 10;
+ if ( isset($struct['number']) )
+ $number = absint($struct['number']);
+
+ $comments = get_comments( array('status' => $status, 'post_id' => $post_id, 'offset' => $offset, 'number' => $number ) );
+ $num_comments = count($comments);
+
+ if ( ! $num_comments )
+ return array();
+
+ $comments_struct = array();
+
+ for ( $i = 0; $i < $num_comments; $i++ ) {
+ $comment = wp_xmlrpc_server::wp_getComment(array(
+ $raw_args[0], $raw_args[1], $raw_args[2], $comments[$i]->comment_ID,
+ ));
+ $comments_struct[] = $comment;
+ }
+
+ return $comments_struct;
+ }
+
+ /**
+ * Remove comment.
+ *
+ * @since 2.7.0
+ *
+ * @param array $args Method parameters.
+ * @return mixed {@link wp_delete_comment()}
+ */
+ function wp_deleteComment($args) {
+ $this->escape($args);
+
+ $blog_id = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+ $comment_ID = (int) $args[3];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ if ( !current_user_can( 'moderate_comments' ) )
+ return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
+
+ if ( !current_user_can( 'edit_comment', $comment_ID ) )
+ return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
+
+ do_action('xmlrpc_call', 'wp.deleteComment');
+
+ if ( ! get_comment($comment_ID) )
+ return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
+
+ return wp_delete_comment($comment_ID);
+ }
+
+ /**
+ * Edit comment.
+ *
+ * @since 2.7.0
+ *
+ * @param array $args Method parameters.
+ * @return bool True, on success.
+ */
+ function wp_editComment($args) {
+ $this->escape($args);
+
+ $blog_id = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+ $comment_ID = (int) $args[3];
+ $content_struct = $args[4];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ if ( !current_user_can( 'moderate_comments' ) )
+ return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
+
+ if ( !current_user_can( 'edit_comment', $comment_ID ) )
+ return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
+
+ do_action('xmlrpc_call', 'wp.editComment');
+
+ if ( ! get_comment($comment_ID) )
+ return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
+
+ if ( isset($content_struct['status']) ) {
+ $statuses = get_comment_statuses();
+ $statuses = array_keys($statuses);
+
+ if ( ! in_array($content_struct['status'], $statuses) )
+ return new IXR_Error( 401, __( 'Invalid comment status.' ) );
+ $comment_approved = $content_struct['status'];
+ }
+
+ // Do some timestamp voodoo
+ if ( !empty( $content_struct['date_created_gmt'] ) ) {
+ $dateCreated = str_replace( 'Z', '', $content_struct['date_created_gmt']->getIso() ) . 'Z'; // We know this is supposed to be GMT, so we're going to slap that Z on there by force
+ $comment_date = get_date_from_gmt(iso8601_to_datetime($dateCreated));
+ $comment_date_gmt = iso8601_to_datetime($dateCreated, 'GMT');
+ }
+
+ if ( isset($content_struct['content']) )
+ $comment_content = $content_struct['content'];
+
+ if ( isset($content_struct['author']) )
+ $comment_author = $content_struct['author'];
+
+ if ( isset($content_struct['author_url']) )
+ $comment_author_url = $content_struct['author_url'];
+
+ if ( isset($content_struct['author_email']) )
+ $comment_author_email = $content_struct['author_email'];
+
+ // We've got all the data -- post it:
+ $comment = compact('comment_ID', 'comment_content', 'comment_approved', 'comment_date', 'comment_date_gmt', 'comment_author', 'comment_author_email', 'comment_author_url');
+
+ $result = wp_update_comment($comment);
+ if ( is_wp_error( $result ) )
+ return new IXR_Error(500, $result->get_error_message());
+
+ if ( !$result )
+ return new IXR_Error(500, __('Sorry, the comment could not be edited. Something wrong happened.'));
+
+ return true;
+ }
+
+ /**
+ * Create new comment.
+ *
+ * @since 2.7.0
+ *
+ * @param array $args Method parameters.
+ * @return mixed {@link wp_new_comment()}
+ */
+ function wp_newComment($args) {
+ global $wpdb;
+
+ $this->escape($args);
+
+ $blog_id = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+ $post = $args[3];
+ $content_struct = $args[4];
+
+ $allow_anon = apply_filters('xmlrpc_allow_anonymous_comments', false);
+
+ $user = $this->login($username, $password);
+
+ if ( !$user ) {
+ $logged_in = false;
+ if ( $allow_anon && get_option('comment_registration') )
+ return new IXR_Error( 403, __( 'You must be registered to comment' ) );
+ else if ( !$allow_anon )
+ return $this->error;
+ } else {
+ $logged_in = true;
+ }
+
+ if ( is_numeric($post) )
+ $post_id = absint($post);
+ else
+ $post_id = url_to_postid($post);
+
+ if ( ! $post_id )
+ return new IXR_Error( 404, __( 'Invalid post ID.' ) );
+
+ if ( ! get_post($post_id) )
+ return new IXR_Error( 404, __( 'Invalid post ID.' ) );
+
+ $comment['comment_post_ID'] = $post_id;
+
+ if ( $logged_in ) {
+ $comment['comment_author'] = $wpdb->escape( $user->display_name );
+ $comment['comment_author_email'] = $wpdb->escape( $user->user_email );
+ $comment['comment_author_url'] = $wpdb->escape( $user->user_url );
+ $comment['user_ID'] = $user->ID;
+ } else {
+ $comment['comment_author'] = '';
+ if ( isset($content_struct['author']) )
+ $comment['comment_author'] = $content_struct['author'];
+
+ $comment['comment_author_email'] = '';
+ if ( isset($content_struct['author_email']) )
+ $comment['comment_author_email'] = $content_struct['author_email'];
+
+ $comment['comment_author_url'] = '';
+ if ( isset($content_struct['author_url']) )
+ $comment['comment_author_url'] = $content_struct['author_url'];
+
+ $comment['user_ID'] = 0;
+
+ if ( get_option('require_name_email') ) {
+ if ( 6 > strlen($comment['comment_author_email']) || '' == $comment['comment_author'] )
+ return new IXR_Error( 403, __( 'Comment author name and email are required' ) );
+ elseif ( !is_email($comment['comment_author_email']) )
+ return new IXR_Error( 403, __( 'A valid email address is required' ) );
+ }
+ }
+
+ $comment['comment_parent'] = isset($content_struct['comment_parent']) ? absint($content_struct['comment_parent']) : 0;
+
+ $comment['comment_content'] = isset($content_struct['content']) ? $content_struct['content'] : null;
+
+ do_action('xmlrpc_call', 'wp.newComment');
+
+ return wp_new_comment($comment);
+ }
+
+ /**
+ * Retrieve all of the comment status.
+ *
+ * @since 2.7.0
+ *
+ * @param array $args Method parameters.
+ * @return array
+ */
+ function wp_getCommentStatusList($args) {
+ $this->escape( $args );
+
+ $blog_id = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ if ( !current_user_can( 'moderate_comments' ) )
+ return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
+
+ do_action('xmlrpc_call', 'wp.getCommentStatusList');
+
+ return get_comment_statuses( );
+ }
+
+ /**
+ * Retrieve comment count.
+ *
+ * @since 2.5.0
+ *
+ * @param array $args Method parameters.
+ * @return array
+ */
+ function wp_getCommentCount( $args ) {
+ $this->escape($args);
+
+ $blog_id = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+ $post_id = (int) $args[3];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ if ( !current_user_can( 'edit_posts' ) )
+ return new IXR_Error( 403, __( 'You are not allowed access to details about comments.' ) );
+
+ do_action('xmlrpc_call', 'wp.getCommentCount');
+
+ $count = wp_count_comments( $post_id );
+ return array(
+ "approved" => $count->approved,
+ "awaiting_moderation" => $count->moderated,
+ "spam" => $count->spam,
+ "total_comments" => $count->total_comments
+ );
+ }
+
+ /**
+ * Retrieve post statuses.
+ *
+ * @since 2.5.0
+ *
+ * @param array $args Method parameters.
+ * @return array
+ */
+ function wp_getPostStatusList( $args ) {
+ $this->escape( $args );
+
+ $blog_id = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ if ( !current_user_can( 'edit_posts' ) )
+ return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
+
+ do_action('xmlrpc_call', 'wp.getPostStatusList');
+
+ return get_post_statuses( );
+ }
+
+ /**
+ * Retrieve page statuses.
+ *
+ * @since 2.5.0
+ *
+ * @param array $args Method parameters.
+ * @return array
+ */
+ function wp_getPageStatusList( $args ) {
+ $this->escape( $args );
+
+ $blog_id = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ if ( !current_user_can( 'edit_pages' ) )
+ return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
+
+ do_action('xmlrpc_call', 'wp.getPageStatusList');
+
+ return get_page_statuses( );
+ }
+
+ /**
+ * Retrieve page templates.
+ *
+ * @since 2.6.0
+ *
+ * @param array $args Method parameters.
+ * @return array
+ */
+ function wp_getPageTemplates( $args ) {
+ $this->escape( $args );
+
+ $blog_id = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ if ( !current_user_can( 'edit_pages' ) )
+ return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
+
+ $templates = get_page_templates( );
+ $templates['Default'] = 'default';
+
+ return $templates;
+ }
+
+ /**
+ * Retrieve blog options.
+ *
+ * @since 2.6.0
+ *
+ * @param array $args Method parameters.
+ * @return array
+ */
+ function wp_getOptions( $args ) {
+ $this->escape( $args );
+
+ $blog_id = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+ $options = isset( $args[3] ) ? (array) $args[3] : array();
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ // If no specific options where asked for, return all of them
+ if ( count( $options ) == 0 )
+ $options = array_keys($this->blog_options);
+
+ return $this->_getOptions($options);
+ }
+
+ /**
+ * Retrieve blog options value from list.
+ *
+ * @since 2.6.0
+ *
+ * @param array $options Options to retrieve.
+ * @return array
+ */
+ function _getOptions($options) {
+ $data = array( );
+ foreach ( $options as $option ) {
+ if ( array_key_exists( $option, $this->blog_options ) ) {
+ $data[$option] = $this->blog_options[$option];
+ //Is the value static or dynamic?
+ if ( isset( $data[$option]['option'] ) ) {
+ $data[$option]['value'] = get_option( $data[$option]['option'] );
+ unset($data[$option]['option']);
+ }
+ }
+ }
+
+ return $data;
+ }
+
+ /**
+ * Update blog options.
+ *
+ * @since 2.6.0
+ *
+ * @param array $args Method parameters.
+ * @return unknown
+ */
+ function wp_setOptions( $args ) {
+ $this->escape( $args );
+
+ $blog_id = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+ $options = (array) $args[3];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ if ( !current_user_can( 'manage_options' ) )
+ return new IXR_Error( 403, __( 'You are not allowed to update options.' ) );
+
+ foreach ( $options as $o_name => $o_value ) {
+ $option_names[] = $o_name;
+ if ( !array_key_exists( $o_name, $this->blog_options ) )
+ continue;
+
+ if ( $this->blog_options[$o_name]['readonly'] == true )
+ continue;
+
+ update_option( $this->blog_options[$o_name]['option'], $o_value );
+ }
+
+ //Now return the updated values
+ return $this->_getOptions($option_names);
+ }
+
+ /**
+ * Retrieve a media item by ID
+ *
+ * @since 3.1.0
+ *
+ * @param array $args Method parameters. Contains:
+ * - blog_id
+ * - username
+ * - password
+ * - attachment_id
+ * @return array. Assocciative array containing:
+ * - 'date_created_gmt'
+ * - 'parent'
+ * - 'link'
+ * - 'thumbnail'
+ * - 'title'
+ * - 'caption'
+ * - 'description'
+ * - 'metadata'
+ */
+ function wp_getMediaItem($args) {
+ $this->escape($args);
+
+ $blog_id = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+ $attachment_id = (int) $args[3];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ if ( !current_user_can( 'upload_files' ) )
+ return new IXR_Error( 403, __( 'You are not allowed to upload files on this site.' ) );
+
+ do_action('xmlrpc_call', 'wp.getMediaItem');
+
+ if ( ! $attachment = get_post($attachment_id) )
+ return new IXR_Error( 404, __( 'Invalid attachment ID.' ) );
+
+ // Format page date.
+ $attachment_date = mysql2date("Ymd\TH:i:s", $attachment->post_date, false);
+ $attachment_date_gmt = mysql2date("Ymd\TH:i:s", $attachment->post_date_gmt, false);
+
+ $link = wp_get_attachment_url($attachment->ID);
+ $thumbnail_link = wp_get_attachment_thumb_url($attachment->ID);
+
+ $attachment_struct = array(
+ "date_created_gmt" => new IXR_Date($attachment_date_gmt),
+ "parent" => $attachment->post_parent,
+ "link" => $link,
+ "thumbnail" => $thumbnail_link,
+ "title" => $attachment->post_title,
+ "caption" => $attachment->post_excerpt,
+ "description" => $attachment->post_content,
+ "metadata" => wp_get_attachment_metadata($attachment->ID),
+ );
+
+ return $attachment_struct;
+ }
+
+ /**
+ * Retrieves a collection of media library items (or attachments)
+ *
+ * Besides the common blog_id, username, and password arguments, it takes a filter
+ * array as last argument.
+ *
+ * Accepted 'filter' keys are 'parent_id', 'mime_type', 'offset', and 'number'.
+ *
+ * The defaults are as follows:
+ * - 'number' - Default is 5. Total number of media items to retrieve.
+ * - 'offset' - Default is 0. See {@link WP_Query::query()} for more.
+ * - 'parent_id' - Default is ''. The post where the media item is attached. Empty string shows all media items. 0 shows unattached media items.
+ * - 'mime_type' - Default is ''. Filter by mime type (e.g., 'image/jpeg', 'application/pdf')
+ *
+ * @since 3.1.0
+ *
+ * @param array $args Method parameters. Contains:
+ * - blog_id
+ * - username
+ * - password
+ * - filter
+ * @return array. Contains a collection of media items. See {@link wp_xmlrpc_server::wp_getMediaItem()} for a description of each item contents
+ */
+ function wp_getMediaLibrary($args) {
+ $raw_args = $args;
+ $this->escape($args);
+
+ $blog_id = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+ $struct = isset( $args[3] ) ? $args[3] : array() ;
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ if ( !current_user_can( 'upload_files' ) )
+ return new IXR_Error( 401, __( 'Sorry, you cannot upload files.' ) );
+
+ do_action('xmlrpc_call', 'wp.getMediaLibrary');
+
+ $parent_id = ( isset($struct['parent_id']) ) ? absint($struct['parent_id']) : '' ;
+ $mime_type = ( isset($struct['mime_type']) ) ? $struct['mime_type'] : '' ;
+ $offset = ( isset($struct['offset']) ) ? absint($struct['offset']) : 0 ;
+ $number = ( isset($struct['number']) ) ? absint($struct['number']) : -1 ;
+
+ $attachments = get_posts( array('post_type' => 'attachment', 'post_parent' => $parent_id, 'offset' => $offset, 'numberposts' => $number, 'post_mime_type' => $mime_type ) );
+ $num_attachments = count($attachments);
+
+ if ( ! $num_attachments )
+ return array();
+
+ $attachments_struct = array();
+
+ foreach ($attachments as $attachment )
+ $attachments_struct[] = $this->wp_getMediaItem( array( $raw_args[0], $raw_args[1], $raw_args[2], $attachment->ID ) );
+
+ return $attachments_struct;
+ }
+
+ /**
+ * Retrives a list of post formats used by the site
+ *
+ * @since 3.1
+ *
+ * @param array $args Method parameters. Contains:
+ * - blog_id
+ * - username
+ * - password
+ * @return array
+ */
+ function wp_getPostFormats( $args ) {
+ $this->escape( $args );
+
+ $blog_id = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+
+ if ( !$user = $this->login( $username, $password ) )
+ return $this->error;
+
+ do_action( 'xmlrpc_call', 'wp.getPostFormats' );
+ return get_post_format_strings();
+ }
+
+ /* Blogger API functions.
+ * specs on http://plant.blogger.com/api and http://groups.yahoo.com/group/bloggerDev/
+ */
+
+ /**
+ * Retrieve blogs that user owns.
+ *
+ * Will make more sense once we support multiple blogs.
+ *
+ * @since 1.5.0
+ *
+ * @param array $args Method parameters.
+ * @return array
+ */
+ function blogger_getUsersBlogs($args) {
+ if ( is_multisite() )
+ return $this->_multisite_getUsersBlogs($args);
+
+ $this->escape($args);
+
+ $username = $args[1];
+ $password = $args[2];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ do_action('xmlrpc_call', 'blogger.getUsersBlogs');
+
+ $is_admin = current_user_can('manage_options');
+
+ $struct = array(
+ 'isAdmin' => $is_admin,
+ 'url' => get_option('home') . '/',
+ 'blogid' => '1',
+ 'blogName' => get_option('blogname'),
+ 'xmlrpc' => site_url( 'xmlrpc.php' )
+ );
+
+ return array($struct);
+ }
+
+ /**
+ * Private function for retrieving a users blogs for multisite setups
+ *
+ * @access protected
+ */
+ function _multisite_getUsersBlogs($args) {
+ global $current_blog;
+ $domain = $current_blog->domain;
+ $path = $current_blog->path . 'xmlrpc.php';
+ $protocol = is_ssl() ? 'https' : 'http';
+
+ $rpc = new IXR_Client("$protocol://{$domain}{$path}");
+ $rpc->query('wp.getUsersBlogs', $args[1], $args[2]);
+ $blogs = $rpc->getResponse();
+
+ if ( isset($blogs['faultCode']) )
+ return new IXR_Error($blogs['faultCode'], $blogs['faultString']);
+
+ if ( $_SERVER['HTTP_HOST'] == $domain && $_SERVER['REQUEST_URI'] == $path ) {
+ return $blogs;
+ } else {
+ foreach ( (array) $blogs as $blog ) {
+ if ( strpos($blog['url'], $_SERVER['HTTP_HOST']) )
+ return array($blog);
+ }
+ return array();
+ }
+ }
+
+ /**
+ * Retrieve user's data.
+ *
+ * Gives your client some info about you, so you don't have to.
+ *
+ * @since 1.5.0
+ *
+ * @param array $args Method parameters.
+ * @return array
+ */
+ function blogger_getUserInfo($args) {
+
+ $this->escape($args);
+
+ $username = $args[1];
+ $password = $args[2];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ if ( !current_user_can( 'edit_posts' ) )
+ return new IXR_Error( 401, __( 'Sorry, you do not have access to user data on this site.' ) );
+
+ do_action('xmlrpc_call', 'blogger.getUserInfo');
+
+ $struct = array(
+ 'nickname' => $user->nickname,
+ 'userid' => $user->ID,
+ 'url' => $user->user_url,
+ 'lastname' => $user->last_name,
+ 'firstname' => $user->first_name
+ );
+
+ return $struct;
+ }
+
+ /**
+ * Retrieve post.
+ *
+ * @since 1.5.0
+ *
+ * @param array $args Method parameters.
+ * @return array
+ */
+ function blogger_getPost($args) {
+
+ $this->escape($args);
+
+ $post_ID = (int) $args[1];
+ $username = $args[2];
+ $password = $args[3];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ if ( !current_user_can( 'edit_post', $post_ID ) )
+ return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
+
+ do_action('xmlrpc_call', 'blogger.getPost');
+
+ $post_data = wp_get_single_post($post_ID, ARRAY_A);
+
+ $categories = implode(',', wp_get_post_categories($post_ID));
+
+ $content = ''.stripslashes($post_data['post_title']).' ';
+ $content .= ''.$categories.' ';
+ $content .= stripslashes($post_data['post_content']);
+
+ $struct = array(
+ 'userid' => $post_data['post_author'],
+ 'dateCreated' => new IXR_Date(mysql2date('Ymd\TH:i:s', $post_data['post_date'], false)),
+ 'content' => $content,
+ 'postid' => (string) $post_data['ID']
+ );
+
+ return $struct;
+ }
+
+ /**
+ * Retrieve list of recent posts.
+ *
+ * @since 1.5.0
+ *
+ * @param array $args Method parameters.
+ * @return array
+ */
+ function blogger_getRecentPosts($args) {
+
+ $this->escape($args);
+
+ // $args[0] = appkey - ignored
+ $blog_ID = (int) $args[1]; /* though we don't use it yet */
+ $username = $args[2];
+ $password = $args[3];
+ if ( isset( $args[4] ) )
+ $query = array( 'numberposts' => absint( $args[4] ) );
+ else
+ $query = array();
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ do_action('xmlrpc_call', 'blogger.getRecentPosts');
+
+ $posts_list = wp_get_recent_posts( $query );
+
+ if ( !$posts_list ) {
+ $this->error = new IXR_Error(500, __('Either there are no posts, or something went wrong.'));
+ return $this->error;
+ }
+
+ foreach ($posts_list as $entry) {
+ if ( !current_user_can( 'edit_post', $entry['ID'] ) )
+ continue;
+
+ $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date'], false);
+ $categories = implode(',', wp_get_post_categories($entry['ID']));
+
+ $content = ''.stripslashes($entry['post_title']).' ';
+ $content .= ''.$categories.' ';
+ $content .= stripslashes($entry['post_content']);
+
+ $struct[] = array(
+ 'userid' => $entry['post_author'],
+ 'dateCreated' => new IXR_Date($post_date),
+ 'content' => $content,
+ 'postid' => (string) $entry['ID'],
+ );
+
+ }
+
+ $recent_posts = array();
+ for ( $j=0; $jescape($args);
+
+ $blog_ID = (int) $args[1];
+ $username = $args[2];
+ $password = $args[3];
+ $template = $args[4]; /* could be 'main' or 'archiveIndex', but we don't use it */
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ do_action('xmlrpc_call', 'blogger.getTemplate');
+
+ if ( !current_user_can('edit_themes') )
+ return new IXR_Error(401, __('Sorry, this user can not edit the template.'));
+
+ /* warning: here we make the assumption that the blog's URL is on the same server */
+ $filename = get_option('home') . '/';
+ $filename = preg_replace('#https?://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename);
+
+ $f = fopen($filename, 'r');
+ $content = fread($f, filesize($filename));
+ fclose($f);
+
+ /* so it is actually editable with a windows/mac client */
+ // FIXME: (or delete me) do we really want to cater to bad clients at the expense of good ones by BEEPing up their line breaks? commented. $content = str_replace("\n", "\r\n", $content);
+
+ return $content;
+ }
+
+ /**
+ * Updates the content of blog_filename.
+ *
+ * @since 1.5.0
+ *
+ * @param array $args Method parameters.
+ * @return bool True when done.
+ */
+ function blogger_setTemplate($args) {
+
+ $this->escape($args);
+
+ $blog_ID = (int) $args[1];
+ $username = $args[2];
+ $password = $args[3];
+ $content = $args[4];
+ $template = $args[5]; /* could be 'main' or 'archiveIndex', but we don't use it */
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ do_action('xmlrpc_call', 'blogger.setTemplate');
+
+ if ( !current_user_can('edit_themes') )
+ return new IXR_Error(401, __('Sorry, this user cannot edit the template.'));
+
+ /* warning: here we make the assumption that the blog's URL is on the same server */
+ $filename = get_option('home') . '/';
+ $filename = preg_replace('#https?://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename);
+
+ if ($f = fopen($filename, 'w+')) {
+ fwrite($f, $content);
+ fclose($f);
+ } else {
+ return new IXR_Error(500, __('Either the file is not writable, or something wrong happened. The file has not been updated.'));
+ }
+
+ return true;
+ }
+
+ /**
+ * Create new post.
+ *
+ * @since 1.5.0
+ *
+ * @param array $args Method parameters.
+ * @return int
+ */
+ function blogger_newPost($args) {
+
+ $this->escape($args);
+
+ $blog_ID = (int) $args[1]; /* though we don't use it yet */
+ $username = $args[2];
+ $password = $args[3];
+ $content = $args[4];
+ $publish = $args[5];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ do_action('xmlrpc_call', 'blogger.newPost');
+
+ $cap = ($publish) ? 'publish_posts' : 'edit_posts';
+ if ( !current_user_can($cap) )
+ return new IXR_Error(401, __('Sorry, you are not allowed to post on this site.'));
+
+ $post_status = ($publish) ? 'publish' : 'draft';
+
+ $post_author = $user->ID;
+
+ $post_title = xmlrpc_getposttitle($content);
+ $post_category = xmlrpc_getpostcategory($content);
+ $post_content = xmlrpc_removepostdata($content);
+
+ $post_date = current_time('mysql');
+ $post_date_gmt = current_time('mysql', 1);
+
+ $post_data = compact('blog_ID', 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status');
+
+ $post_ID = wp_insert_post($post_data);
+ if ( is_wp_error( $post_ID ) )
+ return new IXR_Error(500, $post_ID->get_error_message());
+
+ if ( !$post_ID )
+ return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.'));
+
+ $this->attach_uploads( $post_ID, $post_content );
+
+ logIO('O', "Posted ! ID: $post_ID");
+
+ return $post_ID;
+ }
+
+ /**
+ * Edit a post.
+ *
+ * @since 1.5.0
+ *
+ * @param array $args Method parameters.
+ * @return bool true when done.
+ */
+ function blogger_editPost($args) {
+
+ $this->escape($args);
+
+ $post_ID = (int) $args[1];
+ $username = $args[2];
+ $password = $args[3];
+ $content = $args[4];
+ $publish = $args[5];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ do_action('xmlrpc_call', 'blogger.editPost');
+
+ $actual_post = wp_get_single_post($post_ID,ARRAY_A);
+
+ if ( !$actual_post || $actual_post['post_type'] != 'post' )
+ return new IXR_Error(404, __('Sorry, no such post.'));
+
+ $this->escape($actual_post);
+
+ if ( !current_user_can('edit_post', $post_ID) )
+ return new IXR_Error(401, __('Sorry, you do not have the right to edit this post.'));
+
+ extract($actual_post, EXTR_SKIP);
+
+ if ( ('publish' == $post_status) && !current_user_can('publish_posts') )
+ return new IXR_Error(401, __('Sorry, you do not have the right to publish this post.'));
+
+ $post_title = xmlrpc_getposttitle($content);
+ $post_category = xmlrpc_getpostcategory($content);
+ $post_content = xmlrpc_removepostdata($content);
+
+ $postdata = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt');
+
+ $result = wp_update_post($postdata);
+
+ if ( !$result )
+ return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be edited.'));
+
+ $this->attach_uploads( $ID, $post_content );
+
+ return true;
+ }
+
+ /**
+ * Remove a post.
+ *
+ * @since 1.5.0
+ *
+ * @param array $args Method parameters.
+ * @return bool True when post is deleted.
+ */
+ function blogger_deletePost($args) {
+ $this->escape($args);
+
+ $post_ID = (int) $args[1];
+ $username = $args[2];
+ $password = $args[3];
+ $publish = $args[4];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ do_action('xmlrpc_call', 'blogger.deletePost');
+
+ $actual_post = wp_get_single_post($post_ID,ARRAY_A);
+
+ if ( !$actual_post || $actual_post['post_type'] != 'post' )
+ return new IXR_Error(404, __('Sorry, no such post.'));
+
+ if ( !current_user_can('delete_post', $post_ID) )
+ return new IXR_Error(401, __('Sorry, you do not have the right to delete this post.'));
+
+ $result = wp_delete_post($post_ID);
+
+ if ( !$result )
+ return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be deleted.'));
+
+ return true;
+ }
+
+ /* MetaWeblog API functions
+ * specs on wherever Dave Winer wants them to be
+ */
+
+ /**
+ * Create a new post.
+ *
+ * @since 1.5.0
+ *
+ * @param array $args Method parameters.
+ * @return int
+ */
+ function mw_newPost($args) {
+ $this->escape($args);
+
+ $blog_ID = (int) $args[0]; // we will support this in the near future
+ $username = $args[1];
+ $password = $args[2];
+ $content_struct = $args[3];
+ $publish = isset( $args[4] ) ? $args[4] : 0;
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ do_action('xmlrpc_call', 'metaWeblog.newPost');
+
+ $page_template = '';
+ if ( !empty( $content_struct['post_type'] ) ) {
+ if ( $content_struct['post_type'] == 'page' ) {
+ if ( $publish )
+ $cap = 'publish_pages';
+ elseif ('publish' == $content_struct['page_status'])
+ $cap = 'publish_pages';
+ else
+ $cap = 'edit_pages';
+ $error_message = __( 'Sorry, you are not allowed to publish pages on this site.' );
+ $post_type = 'page';
+ if ( !empty( $content_struct['wp_page_template'] ) )
+ $page_template = $content_struct['wp_page_template'];
+ } elseif ( $content_struct['post_type'] == 'post' ) {
+ if ( $publish )
+ $cap = 'publish_posts';
+ elseif ('publish' == $content_struct['post_status'])
+ $cap = 'publish_posts';
+ else
+ $cap = 'edit_posts';
+ $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' );
+ $post_type = 'post';
+ } else {
+ // No other post_type values are allowed here
+ return new IXR_Error( 401, __( 'Invalid post type.' ) );
+ }
+ } else {
+ if ( $publish )
+ $cap = 'publish_posts';
+ elseif ('publish' == $content_struct['post_status'])
+ $cap = 'publish_posts';
+ else
+ $cap = 'edit_posts';
+ $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' );
+ $post_type = 'post';
+ }
+
+ if ( !current_user_can( $cap ) )
+ return new IXR_Error( 401, $error_message );
+
+ // Check for a valid post format if one was given
+ if ( isset( $content_struct['wp_post_format'] ) ) {
+ $content_struct['wp_post_format'] = sanitize_key( $content_struct['wp_post_format'] );
+ if ( !array_key_exists( $content_struct['wp_post_format'], get_post_format_strings() ) ) {
+ return new IXR_Error( 404, __( 'Invalid post format' ) );
+ }
+ }
+
+ // Let WordPress generate the post_name (slug) unless
+ // one has been provided.
+ $post_name = "";
+ if ( isset($content_struct["wp_slug"]) )
+ $post_name = $content_struct["wp_slug"];
+
+ // Only use a password if one was given.
+ if ( isset($content_struct["wp_password"]) )
+ $post_password = $content_struct["wp_password"];
+
+ // Only set a post parent if one was provided.
+ if ( isset($content_struct["wp_page_parent_id"]) )
+ $post_parent = $content_struct["wp_page_parent_id"];
+
+ // Only set the menu_order if it was provided.
+ if ( isset($content_struct["wp_page_order"]) )
+ $menu_order = $content_struct["wp_page_order"];
+
+ $post_author = $user->ID;
+
+ // If an author id was provided then use it instead.
+ if ( isset($content_struct["wp_author_id"]) && ($user->ID != $content_struct["wp_author_id"]) ) {
+ switch ( $post_type ) {
+ case "post":
+ if ( !current_user_can("edit_others_posts") )
+ return(new IXR_Error(401, __("You are not allowed to post as this user")));
+ break;
+ case "page":
+ if ( !current_user_can("edit_others_pages") )
+ return(new IXR_Error(401, __("You are not allowed to create pages as this user")));
+ break;
+ default:
+ return(new IXR_Error(401, __("Invalid post type.")));
+ break;
+ }
+ $post_author = $content_struct["wp_author_id"];
+ }
+
+ $post_title = isset( $content_struct['title'] ) ? $content_struct['title'] : null;
+ $post_content = isset( $content_struct['description'] ) ? $content_struct['description'] : null;
+
+ $post_status = $publish ? 'publish' : 'draft';
+
+ if ( isset( $content_struct["{$post_type}_status"] ) ) {
+ switch ( $content_struct["{$post_type}_status"] ) {
+ case 'draft':
+ case 'private':
+ case 'publish':
+ $post_status = $content_struct["{$post_type}_status"];
+ break;
+ case 'pending':
+ // Pending is only valid for posts, not pages.
+ if ( $post_type === 'post' )
+ $post_status = $content_struct["{$post_type}_status"];
+ break;
+ default:
+ $post_status = $publish ? 'publish' : 'draft';
+ break;
+ }
+ }
+
+ $post_excerpt = isset($content_struct['mt_excerpt']) ? $content_struct['mt_excerpt'] : null;
+ $post_more = isset($content_struct['mt_text_more']) ? $content_struct['mt_text_more'] : null;
+
+ $tags_input = isset($content_struct['mt_keywords']) ? $content_struct['mt_keywords'] : null;
+
+ if ( isset($content_struct["mt_allow_comments"]) ) {
+ if ( !is_numeric($content_struct["mt_allow_comments"]) ) {
+ switch ( $content_struct["mt_allow_comments"] ) {
+ case "closed":
+ $comment_status = "closed";
+ break;
+ case "open":
+ $comment_status = "open";
+ break;
+ default:
+ $comment_status = get_option("default_comment_status");
+ break;
+ }
+ } else {
+ switch ( (int) $content_struct["mt_allow_comments"] ) {
+ case 0:
+ case 2:
+ $comment_status = "closed";
+ break;
+ case 1:
+ $comment_status = "open";
+ break;
+ default:
+ $comment_status = get_option("default_comment_status");
+ break;
+ }
+ }
+ } else {
+ $comment_status = get_option("default_comment_status");
+ }
+
+ if ( isset($content_struct["mt_allow_pings"]) ) {
+ if ( !is_numeric($content_struct["mt_allow_pings"]) ) {
+ switch ( $content_struct['mt_allow_pings'] ) {
+ case "closed":
+ $ping_status = "closed";
+ break;
+ case "open":
+ $ping_status = "open";
+ break;
+ default:
+ $ping_status = get_option("default_ping_status");
+ break;
+ }
+ } else {
+ switch ( (int) $content_struct["mt_allow_pings"] ) {
+ case 0:
+ $ping_status = "closed";
+ break;
+ case 1:
+ $ping_status = "open";
+ break;
+ default:
+ $ping_status = get_option("default_ping_status");
+ break;
+ }
+ }
+ } else {
+ $ping_status = get_option("default_ping_status");
+ }
+
+ if ( $post_more )
+ $post_content = $post_content . "" . $post_more;
+
+ $to_ping = null;
+ if ( isset( $content_struct['mt_tb_ping_urls'] ) ) {
+ $to_ping = $content_struct['mt_tb_ping_urls'];
+ if ( is_array($to_ping) )
+ $to_ping = implode(' ', $to_ping);
+ }
+
+ // Do some timestamp voodoo
+ if ( !empty( $content_struct['date_created_gmt'] ) )
+ $dateCreated = str_replace( 'Z', '', $content_struct['date_created_gmt']->getIso() ) . 'Z'; // We know this is supposed to be GMT, so we're going to slap that Z on there by force
+ elseif ( !empty( $content_struct['dateCreated']) )
+ $dateCreated = $content_struct['dateCreated']->getIso();
+
+ if ( !empty( $dateCreated ) ) {
+ $post_date = get_date_from_gmt(iso8601_to_datetime($dateCreated));
+ $post_date_gmt = iso8601_to_datetime($dateCreated, 'GMT');
+ } else {
+ $post_date = current_time('mysql');
+ $post_date_gmt = current_time('mysql', 1);
+ }
+
+ $post_category = array();
+ if ( isset( $content_struct['categories'] ) ) {
+ $catnames = $content_struct['categories'];
+ logIO('O', 'Post cats: ' . var_export($catnames,true));
+
+ if ( is_array($catnames) ) {
+ foreach ($catnames as $cat) {
+ $post_category[] = get_cat_ID($cat);
+ }
+ }
+ }
+
+ // We've got all the data -- post it:
+ $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping', 'post_type', 'post_name', 'post_password', 'post_parent', 'menu_order', 'tags_input', 'page_template');
+
+ $post_ID = wp_insert_post($postdata, true);
+ if ( is_wp_error( $post_ID ) )
+ return new IXR_Error(500, $post_ID->get_error_message());
+
+ if ( !$post_ID )
+ return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.'));
+
+ // Only posts can be sticky
+ if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) {
+ if ( $content_struct['sticky'] == true )
+ stick_post( $post_ID );
+ elseif ( $content_struct['sticky'] == false )
+ unstick_post( $post_ID );
+ }
+
+ if ( isset($content_struct['custom_fields']) )
+ $this->set_custom_fields($post_ID, $content_struct['custom_fields']);
+
+ // Handle enclosures
+ $thisEnclosure = isset($content_struct['enclosure']) ? $content_struct['enclosure'] : null;
+ $this->add_enclosure_if_new($post_ID, $thisEnclosure);
+
+ $this->attach_uploads( $post_ID, $post_content );
+
+ // Handle post formats if assigned, value is validated earlier
+ // in this function
+ if ( isset( $content_struct['wp_post_format'] ) )
+ wp_set_post_terms( $post_ID, array( 'post-format-' . $content_struct['wp_post_format'] ), 'post_format' );
+
+ logIO('O', "Posted ! ID: $post_ID");
+
+ return strval($post_ID);
+ }
+
+ function add_enclosure_if_new($post_ID, $enclosure) {
+ if ( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) {
+
+ $encstring = $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type'];
+ $found = false;
+ foreach ( (array) get_post_custom($post_ID) as $key => $val) {
+ if ($key == 'enclosure') {
+ foreach ( (array) $val as $enc ) {
+ if ($enc == $encstring) {
+ $found = true;
+ break 2;
+ }
+ }
+ }
+ }
+ if (!$found)
+ add_post_meta( $post_ID, 'enclosure', $encstring );
+ }
+ }
+
+ /**
+ * Attach upload to a post.
+ *
+ * @since 2.1.0
+ *
+ * @param int $post_ID Post ID.
+ * @param string $post_content Post Content for attachment.
+ */
+ function attach_uploads( $post_ID, $post_content ) {
+ global $wpdb;
+
+ // find any unattached files
+ $attachments = $wpdb->get_results( "SELECT ID, guid FROM {$wpdb->posts} WHERE post_parent = '0' AND post_type = 'attachment'" );
+ if ( is_array( $attachments ) ) {
+ foreach ( $attachments as $file ) {
+ if ( strpos( $post_content, $file->guid ) !== false )
+ $wpdb->update($wpdb->posts, array('post_parent' => $post_ID), array('ID' => $file->ID) );
+ }
+ }
+ }
+
+ /**
+ * Edit a post.
+ *
+ * @since 1.5.0
+ *
+ * @param array $args Method parameters.
+ * @return bool True on success.
+ */
+ function mw_editPost($args) {
+
+ $this->escape($args);
+
+ $post_ID = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+ $content_struct = $args[3];
+ $publish = $args[4];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ do_action('xmlrpc_call', 'metaWeblog.editPost');
+
+ $cap = ( $publish ) ? 'publish_posts' : 'edit_posts';
+ $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' );
+ $post_type = 'post';
+ $page_template = '';
+ if ( !empty( $content_struct['post_type'] ) ) {
+ if ( $content_struct['post_type'] == 'page' ) {
+ if ( $publish || 'publish' == $content_struct['page_status'] )
+ $cap = 'publish_pages';
+ else
+ $cap = 'edit_pages';
+ $error_message = __( 'Sorry, you are not allowed to publish pages on this site.' );
+ $post_type = 'page';
+ if ( !empty( $content_struct['wp_page_template'] ) )
+ $page_template = $content_struct['wp_page_template'];
+ } elseif ( $content_struct['post_type'] == 'post' ) {
+ if ( $publish || 'publish' == $content_struct['post_status'] )
+ $cap = 'publish_posts';
+ else
+ $cap = 'edit_posts';
+ $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' );
+ $post_type = 'post';
+ } else {
+ // No other post_type values are allowed here
+ return new IXR_Error( 401, __( 'Invalid post type.' ) );
+ }
+ } else {
+ if ( $publish || 'publish' == $content_struct['post_status'] )
+ $cap = 'publish_posts';
+ else
+ $cap = 'edit_posts';
+ $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' );
+ $post_type = 'post';
+ }
+
+ if ( !current_user_can( $cap ) )
+ return new IXR_Error( 401, $error_message );
+
+ // Check for a valid post format if one was given
+ if ( isset( $content_struct['wp_post_format'] ) ) {
+ $content_struct['wp_post_format'] = sanitize_key( $content_struct['wp_post_format'] );
+ if ( !array_key_exists( $content_struct['wp_post_format'], get_post_format_strings() ) ) {
+ return new IXR_Error( 404, __( 'Invalid post format' ) );
+ }
+ }
+
+ $postdata = wp_get_single_post($post_ID, ARRAY_A);
+
+ // If there is no post data for the give post id, stop
+ // now and return an error. Other wise a new post will be
+ // created (which was the old behavior).
+ if ( empty($postdata["ID"]) )
+ return(new IXR_Error(404, __("Invalid post ID.")));
+
+ $this->escape($postdata);
+ extract($postdata, EXTR_SKIP);
+
+ // Let WordPress manage slug if none was provided.
+ $post_name = "";
+ if ( isset($content_struct["wp_slug"]) )
+ $post_name = $content_struct["wp_slug"];
+
+ // Only use a password if one was given.
+ if ( isset($content_struct["wp_password"]) )
+ $post_password = $content_struct["wp_password"];
+
+ // Only set a post parent if one was given.
+ if ( isset($content_struct["wp_page_parent_id"]) )
+ $post_parent = $content_struct["wp_page_parent_id"];
+
+ // Only set the menu_order if it was given.
+ if ( isset($content_struct["wp_page_order"]) )
+ $menu_order = $content_struct["wp_page_order"];
+
+ $post_author = $postdata["post_author"];
+
+ // Only set the post_author if one is set.
+ if ( isset($content_struct["wp_author_id"]) && ($user->ID != $content_struct["wp_author_id"]) ) {
+ switch ( $post_type ) {
+ case "post":
+ if ( !current_user_can("edit_others_posts") )
+ return(new IXR_Error(401, __("You are not allowed to change the post author as this user.")));
+ break;
+ case "page":
+ if ( !current_user_can("edit_others_pages") )
+ return(new IXR_Error(401, __("You are not allowed to change the page author as this user.")));
+ break;
+ default:
+ return(new IXR_Error(401, __("Invalid post type.")));
+ break;
+ }
+ $post_author = $content_struct["wp_author_id"];
+ }
+
+ if ( isset($content_struct["mt_allow_comments"]) ) {
+ if ( !is_numeric($content_struct["mt_allow_comments"]) ) {
+ switch ( $content_struct["mt_allow_comments"] ) {
+ case "closed":
+ $comment_status = "closed";
+ break;
+ case "open":
+ $comment_status = "open";
+ break;
+ default:
+ $comment_status = get_option("default_comment_status");
+ break;
+ }
+ } else {
+ switch ( (int) $content_struct["mt_allow_comments"] ) {
+ case 0:
+ case 2:
+ $comment_status = "closed";
+ break;
+ case 1:
+ $comment_status = "open";
+ break;
+ default:
+ $comment_status = get_option("default_comment_status");
+ break;
+ }
+ }
+ }
+
+ if ( isset($content_struct["mt_allow_pings"]) ) {
+ if ( !is_numeric($content_struct["mt_allow_pings"]) ) {
+ switch ( $content_struct["mt_allow_pings"] ) {
+ case "closed":
+ $ping_status = "closed";
+ break;
+ case "open":
+ $ping_status = "open";
+ break;
+ default:
+ $ping_status = get_option("default_ping_status");
+ break;
+ }
+ } else {
+ switch ( (int) $content_struct["mt_allow_pings"] ) {
+ case 0:
+ $ping_status = "closed";
+ break;
+ case 1:
+ $ping_status = "open";
+ break;
+ default:
+ $ping_status = get_option("default_ping_status");
+ break;
+ }
+ }
+ }
+
+ $post_title = isset( $content_struct['title'] ) ? $content_struct['title'] : null;
+ $post_content = isset( $content_struct['description'] ) ? $content_struct['description'] : null;
+
+ $post_category = array();
+ if ( isset( $content_struct['categories'] ) ) {
+ $catnames = $content_struct['categories'];
+ if ( is_array($catnames) ) {
+ foreach ($catnames as $cat) {
+ $post_category[] = get_cat_ID($cat);
+ }
+ }
+ }
+
+ $post_excerpt = isset( $content_struct['mt_excerpt'] ) ? $content_struct['mt_excerpt'] : null;
+ $post_more = isset( $content_struct['mt_text_more'] ) ? $content_struct['mt_text_more'] : null;
+
+ $post_status = $publish ? 'publish' : 'draft';
+ if ( isset( $content_struct["{$post_type}_status"] ) ) {
+ switch( $content_struct["{$post_type}_status"] ) {
+ case 'draft':
+ case 'private':
+ case 'publish':
+ $post_status = $content_struct["{$post_type}_status"];
+ break;
+ case 'pending':
+ // Pending is only valid for posts, not pages.
+ if ( $post_type === 'post' )
+ $post_status = $content_struct["{$post_type}_status"];
+ break;
+ default:
+ $post_status = $publish ? 'publish' : 'draft';
+ break;
+ }
+ }
+
+ $tags_input = isset( $content_struct['mt_keywords'] ) ? $content_struct['mt_keywords'] : null;
+
+ if ( ('publish' == $post_status) ) {
+ if ( ( 'page' == $post_type ) && !current_user_can('publish_pages') )
+ return new IXR_Error(401, __('Sorry, you do not have the right to publish this page.'));
+ else if ( !current_user_can('publish_posts') )
+ return new IXR_Error(401, __('Sorry, you do not have the right to publish this post.'));
+ }
+
+ if ( $post_more )
+ $post_content = $post_content . "" . $post_more;
+
+ $to_ping = null;
+ if ( isset( $content_struct['mt_tb_ping_urls'] ) ) {
+ $to_ping = $content_struct['mt_tb_ping_urls'];
+ if ( is_array($to_ping) )
+ $to_ping = implode(' ', $to_ping);
+ }
+
+ // Do some timestamp voodoo
+ if ( !empty( $content_struct['date_created_gmt'] ) )
+ $dateCreated = str_replace( 'Z', '', $content_struct['date_created_gmt']->getIso() ) . 'Z'; // We know this is supposed to be GMT, so we're going to slap that Z on there by force
+ elseif ( !empty( $content_struct['dateCreated']) )
+ $dateCreated = $content_struct['dateCreated']->getIso();
+
+ if ( !empty( $dateCreated ) ) {
+ $post_date = get_date_from_gmt(iso8601_to_datetime($dateCreated));
+ $post_date_gmt = iso8601_to_datetime($dateCreated, 'GMT');
+ } else {
+ $post_date = $postdata['post_date'];
+ $post_date_gmt = $postdata['post_date_gmt'];
+ }
+
+ // We've got all the data -- post it:
+ $newpost = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'post_date', 'post_date_gmt', 'to_ping', 'post_name', 'post_password', 'post_parent', 'menu_order', 'post_author', 'tags_input', 'page_template');
+
+ $result = wp_update_post($newpost, true);
+ if ( is_wp_error( $result ) )
+ return new IXR_Error(500, $result->get_error_message());
+
+ if ( !$result )
+ return new IXR_Error(500, __('Sorry, your entry could not be edited. Something wrong happened.'));
+
+ // Only posts can be sticky
+ if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) {
+ if ( $content_struct['sticky'] == true )
+ stick_post( $post_ID );
+ elseif ( $content_struct['sticky'] == false )
+ unstick_post( $post_ID );
+ }
+
+ if ( isset($content_struct['custom_fields']) )
+ $this->set_custom_fields($post_ID, $content_struct['custom_fields']);
+
+ // Handle enclosures
+ $thisEnclosure = isset($content_struct['enclosure']) ? $content_struct['enclosure'] : null;
+ $this->add_enclosure_if_new($post_ID, $thisEnclosure);
+
+ $this->attach_uploads( $ID, $post_content );
+
+ // Handle post formats if assigned, validation is handled
+ // earlier in this function
+ if ( isset( $content_struct['wp_post_format'] ) )
+ wp_set_post_terms( $post_ID, array( 'post-format-' . $content_struct['wp_post_format'] ), 'post_format' );
+
+ logIO('O',"(MW) Edited ! ID: $post_ID");
+
+ return true;
+ }
+
+ /**
+ * Retrieve post.
+ *
+ * @since 1.5.0
+ *
+ * @param array $args Method parameters.
+ * @return array
+ */
+ function mw_getPost($args) {
+
+ $this->escape($args);
+
+ $post_ID = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ if ( !current_user_can( 'edit_post', $post_ID ) )
+ return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
+
+ do_action('xmlrpc_call', 'metaWeblog.getPost');
+
+ $postdata = wp_get_single_post($post_ID, ARRAY_A);
+
+ if ($postdata['post_date'] != '') {
+ $post_date = mysql2date('Ymd\TH:i:s', $postdata['post_date'], false);
+ $post_date_gmt = mysql2date('Ymd\TH:i:s', $postdata['post_date_gmt'], false);
+
+ // For drafts use the GMT version of the post date
+ if ( $postdata['post_status'] == 'draft' )
+ $post_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $postdata['post_date'] ), 'Ymd\TH:i:s' );
+
+ $categories = array();
+ $catids = wp_get_post_categories($post_ID);
+ foreach($catids as $catid)
+ $categories[] = get_cat_name($catid);
+
+ $tagnames = array();
+ $tags = wp_get_post_tags( $post_ID );
+ if ( !empty( $tags ) ) {
+ foreach ( $tags as $tag )
+ $tagnames[] = $tag->name;
+ $tagnames = implode( ', ', $tagnames );
+ } else {
+ $tagnames = '';
+ }
+
+ $post = get_extended($postdata['post_content']);
+ $link = post_permalink($postdata['ID']);
+
+ // Get the author info.
+ $author = get_userdata($postdata['post_author']);
+
+ $allow_comments = ('open' == $postdata['comment_status']) ? 1 : 0;
+ $allow_pings = ('open' == $postdata['ping_status']) ? 1 : 0;
+
+ // Consider future posts as published
+ if ( $postdata['post_status'] === 'future' )
+ $postdata['post_status'] = 'publish';
+
+ // Get post format
+ $post_format = get_post_format( $post_ID );
+ if ( empty( $post_format ) )
+ $post_format = 'standard';
+
+ $sticky = false;
+ if ( is_sticky( $post_ID ) )
+ $sticky = true;
+
+ $enclosure = array();
+ foreach ( (array) get_post_custom($post_ID) as $key => $val) {
+ if ($key == 'enclosure') {
+ foreach ( (array) $val as $enc ) {
+ $encdata = split("\n", $enc);
+ $enclosure['url'] = trim(htmlspecialchars($encdata[0]));
+ $enclosure['length'] = (int) trim($encdata[1]);
+ $enclosure['type'] = trim($encdata[2]);
+ break 2;
+ }
+ }
+ }
+
+ $resp = array(
+ 'dateCreated' => new IXR_Date($post_date),
+ 'userid' => $postdata['post_author'],
+ 'postid' => $postdata['ID'],
+ 'description' => $post['main'],
+ 'title' => $postdata['post_title'],
+ 'link' => $link,
+ 'permaLink' => $link,
+ // commented out because no other tool seems to use this
+ // 'content' => $entry['post_content'],
+ 'categories' => $categories,
+ 'mt_excerpt' => $postdata['post_excerpt'],
+ 'mt_text_more' => $post['extended'],
+ 'mt_allow_comments' => $allow_comments,
+ 'mt_allow_pings' => $allow_pings,
+ 'mt_keywords' => $tagnames,
+ 'wp_slug' => $postdata['post_name'],
+ 'wp_password' => $postdata['post_password'],
+ 'wp_author_id' => $author->ID,
+ 'wp_author_display_name' => $author->display_name,
+ 'date_created_gmt' => new IXR_Date($post_date_gmt),
+ 'post_status' => $postdata['post_status'],
+ 'custom_fields' => $this->get_custom_fields($post_ID),
+ 'wp_post_format' => $post_format,
+ 'sticky' => $sticky
+ );
+
+ if ( !empty($enclosure) ) $resp['enclosure'] = $enclosure;
+
+ return $resp;
+ } else {
+ return new IXR_Error(404, __('Sorry, no such post.'));
+ }
+ }
+
+ /**
+ * Retrieve list of recent posts.
+ *
+ * @since 1.5.0
+ *
+ * @param array $args Method parameters.
+ * @return array
+ */
+ function mw_getRecentPosts($args) {
+
+ $this->escape($args);
+
+ $blog_ID = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+ if ( isset( $args[3] ) )
+ $query = array( 'numberposts' => absint( $args[3] ) );
+ else
+ $query = array();
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ do_action('xmlrpc_call', 'metaWeblog.getRecentPosts');
+
+ $posts_list = wp_get_recent_posts( $query );
+
+ if ( !$posts_list )
+ return array( );
+
+ foreach ($posts_list as $entry) {
+ if ( !current_user_can( 'edit_post', $entry['ID'] ) )
+ continue;
+
+ $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date'], false);
+ $post_date_gmt = mysql2date('Ymd\TH:i:s', $entry['post_date_gmt'], false);
+
+ // For drafts use the GMT version of the date
+ if ( $entry['post_status'] == 'draft' )
+ $post_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $entry['post_date'] ), 'Ymd\TH:i:s' );
+
+ $categories = array();
+ $catids = wp_get_post_categories($entry['ID']);
+ foreach( $catids as $catid )
+ $categories[] = get_cat_name($catid);
+
+ $tagnames = array();
+ $tags = wp_get_post_tags( $entry['ID'] );
+ if ( !empty( $tags ) ) {
+ foreach ( $tags as $tag ) {
+ $tagnames[] = $tag->name;
+ }
+ $tagnames = implode( ', ', $tagnames );
+ } else {
+ $tagnames = '';
+ }
+
+ $post = get_extended($entry['post_content']);
+ $link = post_permalink($entry['ID']);
+
+ // Get the post author info.
+ $author = get_userdata($entry['post_author']);
+
+ $allow_comments = ('open' == $entry['comment_status']) ? 1 : 0;
+ $allow_pings = ('open' == $entry['ping_status']) ? 1 : 0;
+
+ // Consider future posts as published
+ if ( $entry['post_status'] === 'future' )
+ $entry['post_status'] = 'publish';
+
+ // Get post format
+ $post_format = get_post_format( $entry['ID'] );
+ if ( empty( $post_format ) )
+ $post_format = 'standard';
+
+ $struct[] = array(
+ 'dateCreated' => new IXR_Date($post_date),
+ 'userid' => $entry['post_author'],
+ 'postid' => (string) $entry['ID'],
+ 'description' => $post['main'],
+ 'title' => $entry['post_title'],
+ 'link' => $link,
+ 'permaLink' => $link,
+ // commented out because no other tool seems to use this
+ // 'content' => $entry['post_content'],
+ 'categories' => $categories,
+ 'mt_excerpt' => $entry['post_excerpt'],
+ 'mt_text_more' => $post['extended'],
+ 'mt_allow_comments' => $allow_comments,
+ 'mt_allow_pings' => $allow_pings,
+ 'mt_keywords' => $tagnames,
+ 'wp_slug' => $entry['post_name'],
+ 'wp_password' => $entry['post_password'],
+ 'wp_author_id' => $author->ID,
+ 'wp_author_display_name' => $author->display_name,
+ 'date_created_gmt' => new IXR_Date($post_date_gmt),
+ 'post_status' => $entry['post_status'],
+ 'custom_fields' => $this->get_custom_fields($entry['ID']),
+ 'wp_post_format' => $post_format
+ );
+
+ }
+
+ $recent_posts = array();
+ for ( $j=0; $jescape($args);
+
+ $blog_ID = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ if ( !current_user_can( 'edit_posts' ) )
+ return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) );
+
+ do_action('xmlrpc_call', 'metaWeblog.getCategories');
+
+ $categories_struct = array();
+
+ if ( $cats = get_categories(array('get' => 'all')) ) {
+ foreach ( $cats as $cat ) {
+ $struct['categoryId'] = $cat->term_id;
+ $struct['parentId'] = $cat->parent;
+ $struct['description'] = $cat->name;
+ $struct['categoryDescription'] = $cat->description;
+ $struct['categoryName'] = $cat->name;
+ $struct['htmlUrl'] = esc_html(get_category_link($cat->term_id));
+ $struct['rssUrl'] = esc_html(get_category_feed_link($cat->term_id, 'rss2'));
+
+ $categories_struct[] = $struct;
+ }
+ }
+
+ return $categories_struct;
+ }
+
+ /**
+ * Uploads a file, following your settings.
+ *
+ * Adapted from a patch by Johann Richard.
+ *
+ * @link http://mycvs.org/archives/2004/06/30/file-upload-to-wordpress-in-ecto/
+ *
+ * @since 1.5.0
+ *
+ * @param array $args Method parameters.
+ * @return array
+ */
+ function mw_newMediaObject($args) {
+ global $wpdb;
+
+ $blog_ID = (int) $args[0];
+ $username = $wpdb->escape($args[1]);
+ $password = $wpdb->escape($args[2]);
+ $data = $args[3];
+
+ $name = sanitize_file_name( $data['name'] );
+ $type = $data['type'];
+ $bits = $data['bits'];
+
+ logIO('O', '(MW) Received '.strlen($bits).' bytes');
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ do_action('xmlrpc_call', 'metaWeblog.newMediaObject');
+
+ if ( !current_user_can('upload_files') ) {
+ logIO('O', '(MW) User does not have upload_files capability');
+ $this->error = new IXR_Error(401, __('You are not allowed to upload files to this site.'));
+ return $this->error;
+ }
+
+ if ( $upload_err = apply_filters( "pre_upload_error", false ) )
+ return new IXR_Error(500, $upload_err);
+
+ if ( !empty($data["overwrite"]) && ($data["overwrite"] == true) ) {
+ // Get postmeta info on the object.
+ $old_file = $wpdb->get_row("
+ SELECT ID
+ FROM {$wpdb->posts}
+ WHERE post_title = '{$name}'
+ AND post_type = 'attachment'
+ ");
+
+ // Delete previous file.
+ wp_delete_attachment($old_file->ID);
+
+ // Make sure the new name is different by pre-pending the
+ // previous post id.
+ $filename = preg_replace("/^wpid\d+-/", "", $name);
+ $name = "wpid{$old_file->ID}-{$filename}";
+ }
+
+ $upload = wp_upload_bits($name, NULL, $bits);
+ if ( ! empty($upload['error']) ) {
+ $errorString = sprintf(__('Could not write file %1$s (%2$s)'), $name, $upload['error']);
+ logIO('O', '(MW) ' . $errorString);
+ return new IXR_Error(500, $errorString);
+ }
+ // Construct the attachment array
+ // attach to post_id 0
+ $post_id = 0;
+ $attachment = array(
+ 'post_title' => $name,
+ 'post_content' => '',
+ 'post_type' => 'attachment',
+ 'post_parent' => $post_id,
+ 'post_mime_type' => $type,
+ 'guid' => $upload[ 'url' ]
+ );
+
+ // Save the data
+ $id = wp_insert_attachment( $attachment, $upload[ 'file' ], $post_id );
+ wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) );
+
+ return apply_filters( 'wp_handle_upload', array( 'file' => $name, 'url' => $upload[ 'url' ], 'type' => $type ), 'upload' );
+ }
+
+ /* MovableType API functions
+ * specs on http://www.movabletype.org/docs/mtmanual_programmatic.html
+ */
+
+ /**
+ * Retrieve the post titles of recent posts.
+ *
+ * @since 1.5.0
+ *
+ * @param array $args Method parameters.
+ * @return array
+ */
+ function mt_getRecentPostTitles($args) {
+
+ $this->escape($args);
+
+ $blog_ID = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+ if ( isset( $args[3] ) )
+ $query = array( 'numberposts' => absint( $args[3] ) );
+ else
+ $query = array();
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ do_action('xmlrpc_call', 'mt.getRecentPostTitles');
+
+ $posts_list = wp_get_recent_posts( $query );
+
+ if ( !$posts_list ) {
+ $this->error = new IXR_Error(500, __('Either there are no posts, or something went wrong.'));
+ return $this->error;
+ }
+
+ foreach ($posts_list as $entry) {
+ if ( !current_user_can( 'edit_post', $entry['ID'] ) )
+ continue;
+
+ $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date'], false);
+ $post_date_gmt = mysql2date('Ymd\TH:i:s', $entry['post_date_gmt'], false);
+
+ // For drafts use the GMT version of the date
+ if ( $entry['post_status'] == 'draft' )
+ $post_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $entry['post_date'] ), 'Ymd\TH:i:s' );
+
+ $struct[] = array(
+ 'dateCreated' => new IXR_Date($post_date),
+ 'userid' => $entry['post_author'],
+ 'postid' => (string) $entry['ID'],
+ 'title' => $entry['post_title'],
+ 'date_created_gmt' => new IXR_Date($post_date_gmt)
+ );
+
+ }
+
+ $recent_posts = array();
+ for ( $j=0; $jescape($args);
+
+ $blog_ID = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ if ( !current_user_can( 'edit_posts' ) )
+ return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) );
+
+ do_action('xmlrpc_call', 'mt.getCategoryList');
+
+ $categories_struct = array();
+
+ if ( $cats = get_categories(array('hide_empty' => 0, 'hierarchical' => 0)) ) {
+ foreach ( $cats as $cat ) {
+ $struct['categoryId'] = $cat->term_id;
+ $struct['categoryName'] = $cat->name;
+
+ $categories_struct[] = $struct;
+ }
+ }
+
+ return $categories_struct;
+ }
+
+ /**
+ * Retrieve post categories.
+ *
+ * @since 1.5.0
+ *
+ * @param array $args Method parameters.
+ * @return array
+ */
+ function mt_getPostCategories($args) {
+
+ $this->escape($args);
+
+ $post_ID = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ if ( !current_user_can( 'edit_post', $post_ID ) )
+ return new IXR_Error( 401, __( 'Sorry, you can not edit this post.' ) );
+
+ do_action('xmlrpc_call', 'mt.getPostCategories');
+
+ $categories = array();
+ $catids = wp_get_post_categories(intval($post_ID));
+ // first listed category will be the primary category
+ $isPrimary = true;
+ foreach ( $catids as $catid ) {
+ $categories[] = array(
+ 'categoryName' => get_cat_name($catid),
+ 'categoryId' => (string) $catid,
+ 'isPrimary' => $isPrimary
+ );
+ $isPrimary = false;
+ }
+
+ return $categories;
+ }
+
+ /**
+ * Sets categories for a post.
+ *
+ * @since 1.5.0
+ *
+ * @param array $args Method parameters.
+ * @return bool True on success.
+ */
+ function mt_setPostCategories($args) {
+
+ $this->escape($args);
+
+ $post_ID = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+ $categories = $args[3];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ do_action('xmlrpc_call', 'mt.setPostCategories');
+
+ if ( !current_user_can('edit_post', $post_ID) )
+ return new IXR_Error(401, __('Sorry, you cannot edit this post.'));
+
+ foreach ( $categories as $cat ) {
+ $catids[] = $cat['categoryId'];
+ }
+
+ wp_set_post_categories($post_ID, $catids);
+
+ return true;
+ }
+
+ /**
+ * Retrieve an array of methods supported by this server.
+ *
+ * @since 1.5.0
+ *
+ * @param array $args Method parameters.
+ * @return array
+ */
+ function mt_supportedMethods($args) {
+
+ do_action('xmlrpc_call', 'mt.supportedMethods');
+
+ $supported_methods = array();
+ foreach ( $this->methods as $key => $value ) {
+ $supported_methods[] = $key;
+ }
+
+ return $supported_methods;
+ }
+
+ /**
+ * Retrieve an empty array because we don't support per-post text filters.
+ *
+ * @since 1.5.0
+ *
+ * @param array $args Method parameters.
+ */
+ function mt_supportedTextFilters($args) {
+ do_action('xmlrpc_call', 'mt.supportedTextFilters');
+ return apply_filters('xmlrpc_text_filters', array());
+ }
+
+ /**
+ * Retrieve trackbacks sent to a given post.
+ *
+ * @since 1.5.0
+ *
+ * @param array $args Method parameters.
+ * @return mixed
+ */
+ function mt_getTrackbackPings($args) {
+
+ global $wpdb;
+
+ $post_ID = intval($args);
+
+ do_action('xmlrpc_call', 'mt.getTrackbackPings');
+
+ $actual_post = wp_get_single_post($post_ID, ARRAY_A);
+
+ if ( !$actual_post )
+ return new IXR_Error(404, __('Sorry, no such post.'));
+
+ $comments = $wpdb->get_results( $wpdb->prepare("SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID) );
+
+ if ( !$comments )
+ return array();
+
+ $trackback_pings = array();
+ foreach ( $comments as $comment ) {
+ if ( 'trackback' == $comment->comment_type ) {
+ $content = $comment->comment_content;
+ $title = substr($content, 8, (strpos($content, '') - 8));
+ $trackback_pings[] = array(
+ 'pingTitle' => $title,
+ 'pingURL' => $comment->comment_author_url,
+ 'pingIP' => $comment->comment_author_IP
+ );
+ }
+ }
+
+ return $trackback_pings;
+ }
+
+ /**
+ * Sets a post's publish status to 'publish'.
+ *
+ * @since 1.5.0
+ *
+ * @param array $args Method parameters.
+ * @return int
+ */
+ function mt_publishPost($args) {
+
+ $this->escape($args);
+
+ $post_ID = (int) $args[0];
+ $username = $args[1];
+ $password = $args[2];
+
+ if ( !$user = $this->login($username, $password) )
+ return $this->error;
+
+ do_action('xmlrpc_call', 'mt.publishPost');
+
+ if ( !current_user_can('publish_posts') || !current_user_can('edit_post', $post_ID) )
+ return new IXR_Error(401, __('Sorry, you cannot publish this post.'));
+
+ $postdata = wp_get_single_post($post_ID,ARRAY_A);
+
+ $postdata['post_status'] = 'publish';
+
+ // retain old cats
+ $cats = wp_get_post_categories($post_ID);
+ $postdata['post_category'] = $cats;
+ $this->escape($postdata);
+
+ $result = wp_update_post($postdata);
+
+ return $result;
+ }
+
+ /* PingBack functions
+ * specs on www.hixie.ch/specs/pingback/pingback
+ */
+
+ /**
+ * Retrieves a pingback and registers it.
+ *
+ * @since 1.5.0
+ *
+ * @param array $args Method parameters.
+ * @return array
+ */
+ function pingback_ping($args) {
+ global $wpdb;
+
+ do_action('xmlrpc_call', 'pingback.ping');
+
+ $this->escape($args);
+
+ $pagelinkedfrom = $args[0];
+ $pagelinkedto = $args[1];
+
+ $title = '';
+
+ $pagelinkedfrom = str_replace('&', '&', $pagelinkedfrom);
+ $pagelinkedto = str_replace('&', '&', $pagelinkedto);
+ $pagelinkedto = str_replace('&', '&', $pagelinkedto);
+
+ // Check if the page linked to is in our site
+ $pos1 = strpos($pagelinkedto, str_replace(array('http://www.','http://','https://www.','https://'), '', get_option('home')));
+ if ( !$pos1 )
+ return new IXR_Error(0, __('Is there no link to us?'));
+
+ // let's find which post is linked to
+ // FIXME: does url_to_postid() cover all these cases already?
+ // if so, then let's use it and drop the old code.
+ $urltest = parse_url($pagelinkedto);
+ if ( $post_ID = url_to_postid($pagelinkedto) ) {
+ $way = 'url_to_postid()';
+ } elseif ( preg_match('#p/[0-9]{1,}#', $urltest['path'], $match) ) {
+ // the path defines the post_ID (archives/p/XXXX)
+ $blah = explode('/', $match[0]);
+ $post_ID = (int) $blah[1];
+ $way = 'from the path';
+ } elseif ( preg_match('#p=[0-9]{1,}#', $urltest['query'], $match) ) {
+ // the querystring defines the post_ID (?p=XXXX)
+ $blah = explode('=', $match[0]);
+ $post_ID = (int) $blah[1];
+ $way = 'from the querystring';
+ } elseif ( isset($urltest['fragment']) ) {
+ // an #anchor is there, it's either...
+ if ( intval($urltest['fragment']) ) {
+ // ...an integer #XXXX (simpliest case)
+ $post_ID = (int) $urltest['fragment'];
+ $way = 'from the fragment (numeric)';
+ } elseif ( preg_match('/post-[0-9]+/',$urltest['fragment']) ) {
+ // ...a post id in the form 'post-###'
+ $post_ID = preg_replace('/[^0-9]+/', '', $urltest['fragment']);
+ $way = 'from the fragment (post-###)';
+ } elseif ( is_string($urltest['fragment']) ) {
+ // ...or a string #title, a little more complicated
+ $title = preg_replace('/[^a-z0-9]/i', '.', $urltest['fragment']);
+ $sql = $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_title RLIKE %s", like_escape( $title ) );
+ if (! ($post_ID = $wpdb->get_var($sql)) ) {
+ // returning unknown error '0' is better than die()ing
+ return new IXR_Error(0, '');
+ }
+ $way = 'from the fragment (title)';
+ }
+ } else {
+ // TODO: Attempt to extract a post ID from the given URL
+ return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn’t exist, or it is not a pingback-enabled resource.'));
+ }
+ $post_ID = (int) $post_ID;
+
+
+ logIO("O","(PB) URL='$pagelinkedto' ID='$post_ID' Found='$way'");
+
+ $post = get_post($post_ID);
+
+ if ( !$post ) // Post_ID not found
+ return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn’t exist, or it is not a pingback-enabled resource.'));
+
+ if ( $post_ID == url_to_postid($pagelinkedfrom) )
+ return new IXR_Error(0, __('The source URL and the target URL cannot both point to the same resource.'));
+
+ // Check if pings are on
+ if ( !pings_open($post) )
+ return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn’t exist, or it is not a pingback-enabled resource.'));
+
+ // Let's check that the remote site didn't already pingback this entry
+ if ( $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_author_url = %s", $post_ID, $pagelinkedfrom) ) )
+ return new IXR_Error( 48, __( 'The pingback has already been registered.' ) );
+
+ // very stupid, but gives time to the 'from' server to publish !
+ sleep(1);
+
+ // Let's check the remote site
+ $linea = wp_remote_fopen( $pagelinkedfrom );
+ if ( !$linea )
+ return new IXR_Error(16, __('The source URL does not exist.'));
+
+ $linea = apply_filters('pre_remote_source', $linea, $pagelinkedto);
+
+ // Work around bug in strip_tags():
+ $linea = str_replace(']*>/", "\n\n", $linea );
+
+ preg_match('|([^<]*?) |is', $linea, $matchtitle);
+ $title = $matchtitle[1];
+ if ( empty( $title ) )
+ return new IXR_Error(32, __('We cannot find a title on that page.'));
+
+ $linea = strip_tags( $linea, '' ); // just keep the tag we need
+
+ $p = explode( "\n\n", $linea );
+
+ $preg_target = preg_quote($pagelinkedto, '|');
+
+ foreach ( $p as $para ) {
+ if ( strpos($para, $pagelinkedto) !== false ) { // it exists, but is it a link?
+ preg_match("| ]+?".$preg_target."[^>]*>([^>]+?) |", $para, $context);
+
+ // If the URL isn't in a link context, keep looking
+ if ( empty($context) )
+ continue;
+
+ // We're going to use this fake tag to mark the context in a bit
+ // the marker is needed in case the link text appears more than once in the paragraph
+ $excerpt = preg_replace('|\?wpcontext\>|', '', $para);
+
+ // prevent really long link text
+ if ( strlen($context[1]) > 100 )
+ $context[1] = substr($context[1], 0, 100) . '...';
+
+ $marker = ''.$context[1].' '; // set up our marker
+ $excerpt= str_replace($context[0], $marker, $excerpt); // swap out the link for our marker
+ $excerpt = strip_tags($excerpt, ''); // strip all tags but our context marker
+ $excerpt = trim($excerpt);
+ $preg_marker = preg_quote($marker, '|');
+ $excerpt = preg_replace("|.*?\s(.{0,100}$preg_marker.{0,100})\s.*|s", '$1', $excerpt);
+ $excerpt = strip_tags($excerpt); // YES, again, to remove the marker wrapper
+ break;
+ }
+ }
+
+ if ( empty($context) ) // Link to target not found
+ return new IXR_Error(17, __('The source URL does not contain a link to the target URL, and so cannot be used as a source.'));
+
+ $pagelinkedfrom = str_replace('&', '&', $pagelinkedfrom);
+
+ $context = '[...] ' . esc_html( $excerpt ) . ' [...]';
+ $pagelinkedfrom = $wpdb->escape( $pagelinkedfrom );
+
+ $comment_post_ID = (int) $post_ID;
+ $comment_author = $title;
+ $comment_author_email = '';
+ $this->escape($comment_author);
+ $comment_author_url = $pagelinkedfrom;
+ $comment_content = $context;
+ $this->escape($comment_content);
+ $comment_type = 'pingback';
+
+ $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_content', 'comment_type');
+
+ $comment_ID = wp_new_comment($commentdata);
+ do_action('pingback_post', $comment_ID);
+
+ return sprintf(__('Pingback from %1$s to %2$s registered. Keep the web talking! :-)'), $pagelinkedfrom, $pagelinkedto);
+ }
+
+ /**
+ * Retrieve array of URLs that pingbacked the given URL.
+ *
+ * Specs on http://www.aquarionics.com/misc/archives/blogite/0198.html
+ *
+ * @since 1.5.0
+ *
+ * @param array $args Method parameters.
+ * @return array
+ */
+ function pingback_extensions_getPingbacks($args) {
+
+ global $wpdb;
+
+ do_action('xmlrpc_call', 'pingback.extensions.getPingbacks');
+
+ $this->escape($args);
+
+ $url = $args;
+
+ $post_ID = url_to_postid($url);
+ if ( !$post_ID ) {
+ // We aren't sure that the resource is available and/or pingback enabled
+ return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn’t exist, or it is not a pingback-enabled resource.'));
+ }
+
+ $actual_post = wp_get_single_post($post_ID, ARRAY_A);
+
+ if ( !$actual_post ) {
+ // No such post = resource not found
+ return new IXR_Error(32, __('The specified target URL does not exist.'));
+ }
+
+ $comments = $wpdb->get_results( $wpdb->prepare("SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID) );
+
+ if ( !$comments )
+ return array();
+
+ $pingbacks = array();
+ foreach ( $comments as $comment ) {
+ if ( 'pingback' == $comment->comment_type )
+ $pingbacks[] = $comment->comment_author_url;
+ }
+
+ return $pingbacks;
+ }
+}
+?>
\ No newline at end of file
diff --git a/wp-includes/class-wp.php b/wp-includes/class-wp.php
new file mode 100644
index 00000000..7ca64697
--- /dev/null
+++ b/wp-includes/class-wp.php
@@ -0,0 +1,611 @@
+public_query_vars) )
+ $this->public_query_vars[] = $qv;
+ }
+
+ /**
+ * Set the value of a query variable.
+ *
+ * @since 2.3.0
+ *
+ * @param string $key Query variable name.
+ * @param mixed $value Query variable value.
+ */
+ function set_query_var($key, $value) {
+ $this->query_vars[$key] = $value;
+ }
+
+ /**
+ * Parse request to find correct WordPress query.
+ *
+ * Sets up the query variables based on the request. There are also many
+ * filters and actions that can be used to further manipulate the result.
+ *
+ * @since 2.0.0
+ *
+ * @param array|string $extra_query_vars Set the extra query variables.
+ */
+ function parse_request($extra_query_vars = '') {
+ global $wp_rewrite;
+
+ $this->query_vars = array();
+ $post_type_query_vars = array();
+
+ if ( is_array($extra_query_vars) )
+ $this->extra_query_vars = & $extra_query_vars;
+ else if (! empty($extra_query_vars))
+ parse_str($extra_query_vars, $this->extra_query_vars);
+
+ // Process PATH_INFO, REQUEST_URI, and 404 for permalinks.
+
+ // Fetch the rewrite rules.
+ $rewrite = $wp_rewrite->wp_rewrite_rules();
+
+ if ( ! empty($rewrite) ) {
+ // If we match a rewrite rule, this will be cleared.
+ $error = '404';
+ $this->did_permalink = true;
+
+ if ( isset($_SERVER['PATH_INFO']) )
+ $pathinfo = $_SERVER['PATH_INFO'];
+ else
+ $pathinfo = '';
+ $pathinfo_array = explode('?', $pathinfo);
+ $pathinfo = str_replace("%", "%25", $pathinfo_array[0]);
+ $req_uri = $_SERVER['REQUEST_URI'];
+ $req_uri_array = explode('?', $req_uri);
+ $req_uri = $req_uri_array[0];
+ $self = $_SERVER['PHP_SELF'];
+ $home_path = parse_url(home_url());
+ if ( isset($home_path['path']) )
+ $home_path = $home_path['path'];
+ else
+ $home_path = '';
+ $home_path = trim($home_path, '/');
+
+ // Trim path info from the end and the leading home path from the
+ // front. For path info requests, this leaves us with the requesting
+ // filename, if any. For 404 requests, this leaves us with the
+ // requested permalink.
+ $req_uri = str_replace($pathinfo, '', $req_uri);
+ $req_uri = trim($req_uri, '/');
+ $req_uri = preg_replace("|^$home_path|", '', $req_uri);
+ $req_uri = trim($req_uri, '/');
+ $pathinfo = trim($pathinfo, '/');
+ $pathinfo = preg_replace("|^$home_path|", '', $pathinfo);
+ $pathinfo = trim($pathinfo, '/');
+ $self = trim($self, '/');
+ $self = preg_replace("|^$home_path|", '', $self);
+ $self = trim($self, '/');
+
+ // The requested permalink is in $pathinfo for path info requests and
+ // $req_uri for other requests.
+ if ( ! empty($pathinfo) && !preg_match('|^.*' . $wp_rewrite->index . '$|', $pathinfo) ) {
+ $request = $pathinfo;
+ } else {
+ // If the request uri is the index, blank it out so that we don't try to match it against a rule.
+ if ( $req_uri == $wp_rewrite->index )
+ $req_uri = '';
+ $request = $req_uri;
+ }
+
+ $this->request = $request;
+
+ // Look for matches.
+ $request_match = $request;
+ foreach ( (array) $rewrite as $match => $query) {
+ // Don't try to match against AtomPub calls
+ if ( $req_uri == 'wp-app.php' )
+ break;
+
+ // If the requesting file is the anchor of the match, prepend it
+ // to the path info.
+ if ( (! empty($req_uri)) && (strpos($match, $req_uri) === 0) && ($req_uri != $request) )
+ $request_match = $req_uri . '/' . $request;
+
+ if ( preg_match("#^$match#", $request_match, $matches) ||
+ preg_match("#^$match#", urldecode($request_match), $matches) ) {
+ // Got a match.
+ $this->matched_rule = $match;
+
+ // Trim the query of everything up to the '?'.
+ $query = preg_replace("!^.+\?!", '', $query);
+
+ // Substitute the substring matches into the query.
+ $query = addslashes(WP_MatchesMapRegex::apply($query, $matches));
+
+ $this->matched_query = $query;
+
+ // Parse the query.
+ parse_str($query, $perma_query_vars);
+
+ // If we're processing a 404 request, clear the error var
+ // since we found something.
+ if ( isset($_GET['error']) )
+ unset($_GET['error']);
+
+ if ( isset($error) )
+ unset($error);
+
+ break;
+ }
+ }
+
+ // If req_uri is empty or if it is a request for ourself, unset error.
+ if ( empty($request) || $req_uri == $self || strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false ) {
+ if ( isset($_GET['error']) )
+ unset($_GET['error']);
+
+ if ( isset($error) )
+ unset($error);
+
+ if ( isset($perma_query_vars) && strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false )
+ unset($perma_query_vars);
+
+ $this->did_permalink = false;
+ }
+ }
+
+ $this->public_query_vars = apply_filters('query_vars', $this->public_query_vars);
+
+ foreach ( $GLOBALS['wp_post_types'] as $post_type => $t )
+ if ( $t->query_var )
+ $post_type_query_vars[$t->query_var] = $post_type;
+
+ foreach ( $this->public_query_vars as $wpvar ) {
+ if ( isset( $this->extra_query_vars[$wpvar] ) )
+ $this->query_vars[$wpvar] = $this->extra_query_vars[$wpvar];
+ elseif ( isset( $_POST[$wpvar] ) )
+ $this->query_vars[$wpvar] = $_POST[$wpvar];
+ elseif ( isset( $_GET[$wpvar] ) )
+ $this->query_vars[$wpvar] = $_GET[$wpvar];
+ elseif ( isset( $perma_query_vars[$wpvar] ) )
+ $this->query_vars[$wpvar] = $perma_query_vars[$wpvar];
+
+ if ( !empty( $this->query_vars[$wpvar] ) ) {
+ if ( ! is_array( $this->query_vars[$wpvar] ) ) {
+ $this->query_vars[$wpvar] = (string) $this->query_vars[$wpvar];
+ } else {
+ foreach ( $this->query_vars[$wpvar] as $vkey => $v ) {
+ if ( !is_object( $v ) ) {
+ $this->query_vars[$wpvar][$vkey] = (string) $v;
+ }
+ }
+ }
+
+ if ( isset($post_type_query_vars[$wpvar] ) ) {
+ $this->query_vars['post_type'] = $post_type_query_vars[$wpvar];
+ $this->query_vars['name'] = $this->query_vars[$wpvar];
+ }
+ }
+ }
+
+ // Convert urldecoded spaces back into +
+ foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t )
+ if ( $t->query_var && isset( $this->query_vars[$t->query_var] ) )
+ $this->query_vars[$t->query_var] = str_replace( ' ', '+', $this->query_vars[$t->query_var] );
+
+ // Limit publicly queried post_types to those that are publicly_queryable
+ if ( isset( $this->query_vars['post_type']) ) {
+ $queryable_post_types = get_post_types( array('publicly_queryable' => true) );
+ if ( ! is_array( $this->query_vars['post_type'] ) ) {
+ if ( ! in_array( $this->query_vars['post_type'], $queryable_post_types ) )
+ unset( $this->query_vars['post_type'] );
+ } else {
+ $this->query_vars['post_type'] = array_intersect( $this->query_vars['post_type'], $queryable_post_types );
+ }
+ }
+
+ foreach ( (array) $this->private_query_vars as $var) {
+ if ( isset($this->extra_query_vars[$var]) )
+ $this->query_vars[$var] = $this->extra_query_vars[$var];
+ }
+
+ if ( isset($error) )
+ $this->query_vars['error'] = $error;
+
+ $this->query_vars = apply_filters('request', $this->query_vars);
+
+ do_action_ref_array('parse_request', array(&$this));
+ }
+
+ /**
+ * Send additional HTTP headers for caching, content type, etc.
+ *
+ * Sets the X-Pingback header, 404 status (if 404), Content-type. If showing
+ * a feed, it will also send last-modified, etag, and 304 status if needed.
+ *
+ * @since 2.0.0
+ */
+ function send_headers() {
+ $headers = array('X-Pingback' => get_bloginfo('pingback_url'));
+ $status = null;
+ $exit_required = false;
+
+ if ( is_user_logged_in() )
+ $headers = array_merge($headers, wp_get_nocache_headers());
+ if ( !empty($this->query_vars['error']) && '404' == $this->query_vars['error'] ) {
+ $status = 404;
+ if ( !is_user_logged_in() )
+ $headers = array_merge($headers, wp_get_nocache_headers());
+ $headers['Content-Type'] = get_option('html_type') . '; charset=' . get_option('blog_charset');
+ } else if ( empty($this->query_vars['feed']) ) {
+ $headers['Content-Type'] = get_option('html_type') . '; charset=' . get_option('blog_charset');
+ } else {
+ // We're showing a feed, so WP is indeed the only thing that last changed
+ if ( !empty($this->query_vars['withcomments'])
+ || ( empty($this->query_vars['withoutcomments'])
+ && ( !empty($this->query_vars['p'])
+ || !empty($this->query_vars['name'])
+ || !empty($this->query_vars['page_id'])
+ || !empty($this->query_vars['pagename'])
+ || !empty($this->query_vars['attachment'])
+ || !empty($this->query_vars['attachment_id'])
+ )
+ )
+ )
+ $wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastcommentmodified('GMT'), 0).' GMT';
+ else
+ $wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0).' GMT';
+ $wp_etag = '"' . md5($wp_last_modified) . '"';
+ $headers['Last-Modified'] = $wp_last_modified;
+ $headers['ETag'] = $wp_etag;
+
+ // Support for Conditional GET
+ if (isset($_SERVER['HTTP_IF_NONE_MATCH']))
+ $client_etag = stripslashes(stripslashes($_SERVER['HTTP_IF_NONE_MATCH']));
+ else $client_etag = false;
+
+ $client_last_modified = empty($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? '' : trim($_SERVER['HTTP_IF_MODIFIED_SINCE']);
+ // If string is empty, return 0. If not, attempt to parse into a timestamp
+ $client_modified_timestamp = $client_last_modified ? strtotime($client_last_modified) : 0;
+
+ // Make a timestamp for our most recent modification...
+ $wp_modified_timestamp = strtotime($wp_last_modified);
+
+ if ( ($client_last_modified && $client_etag) ?
+ (($client_modified_timestamp >= $wp_modified_timestamp) && ($client_etag == $wp_etag)) :
+ (($client_modified_timestamp >= $wp_modified_timestamp) || ($client_etag == $wp_etag)) ) {
+ $status = 304;
+ $exit_required = true;
+ }
+ }
+
+ $headers = apply_filters('wp_headers', $headers, $this);
+
+ if ( ! empty( $status ) )
+ status_header( $status );
+ foreach( (array) $headers as $name => $field_value )
+ @header("{$name}: {$field_value}");
+
+ if ( $exit_required )
+ exit();
+
+ do_action_ref_array('send_headers', array(&$this));
+ }
+
+ /**
+ * Sets the query string property based off of the query variable property.
+ *
+ * The 'query_string' filter is deprecated, but still works. Plugins should
+ * use the 'request' filter instead.
+ *
+ * @since 2.0.0
+ */
+ function build_query_string() {
+ $this->query_string = '';
+ foreach ( (array) array_keys($this->query_vars) as $wpvar) {
+ if ( '' != $this->query_vars[$wpvar] ) {
+ $this->query_string .= (strlen($this->query_string) < 1) ? '' : '&';
+ if ( !is_scalar($this->query_vars[$wpvar]) ) // Discard non-scalars.
+ continue;
+ $this->query_string .= $wpvar . '=' . rawurlencode($this->query_vars[$wpvar]);
+ }
+ }
+
+ // query_string filter deprecated. Use request filter instead.
+ if ( has_filter('query_string') ) { // Don't bother filtering and parsing if no plugins are hooked in.
+ $this->query_string = apply_filters('query_string', $this->query_string);
+ parse_str($this->query_string, $this->query_vars);
+ }
+ }
+
+ /**
+ * Set up the WordPress Globals.
+ *
+ * The query_vars property will be extracted to the GLOBALS. So care should
+ * be taken when naming global variables that might interfere with the
+ * WordPress environment.
+ *
+ * @global string $query_string Query string for the loop.
+ * @global int $more Only set, if single page or post.
+ * @global int $single If single page or post. Only set, if single page or post.
+ *
+ * @since 2.0.0
+ */
+ function register_globals() {
+ global $wp_query;
+ // Extract updated query vars back into global namespace.
+ foreach ( (array) $wp_query->query_vars as $key => $value) {
+ $GLOBALS[$key] = $value;
+ }
+
+ $GLOBALS['query_string'] = $this->query_string;
+ $GLOBALS['posts'] = & $wp_query->posts;
+ $GLOBALS['post'] = (isset($wp_query->post)) ? $wp_query->post : null;
+ $GLOBALS['request'] = $wp_query->request;
+
+ if ( is_single() || is_page() ) {
+ $GLOBALS['more'] = 1;
+ $GLOBALS['single'] = 1;
+ }
+ }
+
+ /**
+ * Set up the current user.
+ *
+ * @since 2.0.0
+ */
+ function init() {
+ wp_get_current_user();
+ }
+
+ /**
+ * Set up the Loop based on the query variables.
+ *
+ * @uses WP::$query_vars
+ * @since 2.0.0
+ */
+ function query_posts() {
+ global $wp_the_query;
+ $this->build_query_string();
+ $wp_the_query->query($this->query_vars);
+ }
+
+ /**
+ * Set the Headers for 404, if nothing is found for requested URL.
+ *
+ * Issue a 404 if a request doesn't match any posts and doesn't match
+ * any object (e.g. an existing-but-empty category, tag, author) and a 404 was not already
+ * issued, and if the request was not a search or the homepage.
+ *
+ * Otherwise, issue a 200.
+ *
+ * @since 2.0.0
+ */
+ function handle_404() {
+ global $wp_query;
+
+ if ( !is_admin() && ( 0 == count( $wp_query->posts ) ) && !is_404() && !is_robots() && !is_search() && !is_home() ) {
+ // Don't 404 for these queries if they matched an object.
+ if ( ( is_tag() || is_category() || is_tax() || is_author() ) && $wp_query->get_queried_object() && !is_paged() ) {
+ if ( !is_404() )
+ status_header( 200 );
+ return;
+ }
+ $wp_query->set_404();
+ status_header( 404 );
+ nocache_headers();
+ } elseif ( !is_404() ) {
+ status_header( 200 );
+ }
+ }
+
+ /**
+ * Sets up all of the variables required by the WordPress environment.
+ *
+ * The action 'wp' has one parameter that references the WP object. It
+ * allows for accessing the properties and methods to further manipulate the
+ * object.
+ *
+ * @since 2.0.0
+ *
+ * @param string|array $query_args Passed to {@link parse_request()}
+ */
+ function main($query_args = '') {
+ $this->init();
+ $this->parse_request($query_args);
+ $this->send_headers();
+ $this->query_posts();
+ $this->handle_404();
+ $this->register_globals();
+ do_action_ref_array('wp', array(&$this));
+ }
+
+ /**
+ * PHP4 Constructor - Does nothing.
+ *
+ * Call main() method when ready to run setup.
+ *
+ * @since 2.0.0
+ *
+ * @return WP
+ */
+ function WP() {
+ // Empty.
+ }
+}
+
+/**
+ * Helper class to remove the need to use eval to replace $matches[] in query strings.
+ *
+ * @since 2.9.0
+ */
+class WP_MatchesMapRegex {
+ /**
+ * store for matches
+ *
+ * @access private
+ * @var array
+ */
+ var $_matches;
+
+ /**
+ * store for mapping result
+ *
+ * @access public
+ * @var string
+ */
+ var $output;
+
+ /**
+ * subject to perform mapping on (query string containing $matches[] references
+ *
+ * @access private
+ * @var string
+ */
+ var $_subject;
+
+ /**
+ * regexp pattern to match $matches[] references
+ *
+ * @var string
+ */
+ var $_pattern = '(\$matches\[[1-9]+[0-9]*\])'; // magic number
+
+ /**
+ * constructor
+ *
+ * @param string $subject subject if regex
+ * @param array $matches data to use in map
+ * @return self
+ */
+ function WP_MatchesMapRegex($subject, $matches) {
+ $this->_subject = $subject;
+ $this->_matches = $matches;
+ $this->output = $this->_map();
+ }
+
+ /**
+ * Substitute substring matches in subject.
+ *
+ * static helper function to ease use
+ *
+ * @access public
+ * @param string $subject subject
+ * @param array $matches data used for subsitution
+ * @return string
+ */
+ function apply($subject, $matches) {
+ $oSelf =& new WP_MatchesMapRegex($subject, $matches);
+ return $oSelf->output;
+ }
+
+ /**
+ * do the actual mapping
+ *
+ * @access private
+ * @return string
+ */
+ function _map() {
+ $callback = array(&$this, 'callback');
+ return preg_replace_callback($this->_pattern, $callback, $this->_subject);
+ }
+
+ /**
+ * preg_replace_callback hook
+ *
+ * @access public
+ * @param array $matches preg_replace regexp matches
+ * @return string
+ */
+ function callback($matches) {
+ $index = intval(substr($matches[0], 9, -1));
+ return ( isset( $this->_matches[$index] ) ? urlencode($this->_matches[$index]) : '' );
+ }
+
+}
+
+?>
diff --git a/wp-includes/class.wp-dependencies.php b/wp-includes/class.wp-dependencies.php
index ea607de2..de3630ad 100644
--- a/wp-includes/class.wp-dependencies.php
+++ b/wp-includes/class.wp-dependencies.php
@@ -37,11 +37,11 @@ class WP_Dependencies {
*
* Process the items passed to it or the queue. Processes all dependencies.
*
- * @param mixed handles (optional) items to be processed. (void) processes queue, (string) process that item, (array of strings) process those items
+ * @param mixed $handles (optional) items to be processed. (void) processes queue, (string) process that item, (array of strings) process those items
* @return array Items that have been processed
*/
function do_items( $handles = false, $group = false ) {
- // Print the queue if nothing is passed. If a string is passed, print that script. If an array is passed, print those scripts.
+ // Print the queue if nothing is passed. If a string is passed, print that script. If an array is passed, print those scripts.
$handles = false === $handles ? $this->queue : (array) $handles;
$this->all_deps( $handles );
@@ -72,9 +72,9 @@ class WP_Dependencies {
*
* Recursively builds array of items to process taking dependencies into account. Does NOT catch infinite loops.
*
-
- * @param mixed handles Accepts (string) dep name or (array of strings) dep names
- * @param bool recursion Used internally when function calls itself
+ *
+ * @param mixed $handles Accepts (string) dep name or (array of strings) dep names
+ * @param bool $recursion Used internally when function calls itself
*/
function all_deps( $handles, $recursion = false, $group = false ) {
if ( !$handles = (array) $handles )
@@ -125,10 +125,10 @@ class WP_Dependencies {
*
* Adds the item only if no item of that name already exists
*
- * @param string handle Script name
- * @param string src Script url
- * @param array deps (optional) Array of script names on which this script depends
- * @param string ver (optional) Script version (used for cache busting)
+ * @param string $handle Script name
+ * @param string $src Script url
+ * @param array $deps (optional) Array of script names on which this script depends
+ * @param string $ver (optional) Script version (used for cache busting)
* @return array Hierarchical array of dependencies
*/
function add( $handle, $src, $deps = array(), $ver = false, $args = null ) {
@@ -143,9 +143,9 @@ class WP_Dependencies {
*
* Adds data only if script has already been added
*
- * @param string handle Script name
- * @param string data_name Name of object in which to store extra data
- * @param array data Array of extra data
+ * @param string $handle Script name
+ * @param string $data_name Name of object in which to store extra data
+ * @param array $data Array of extra data
* @return bool success
*/
function add_data( $handle, $data_name, $data ) {
diff --git a/wp-includes/class.wp-scripts.php b/wp-includes/class.wp-scripts.php
index 45d2e54c..681a8246 100644
--- a/wp-includes/class.wp-scripts.php
+++ b/wp-includes/class.wp-scripts.php
@@ -39,8 +39,8 @@ class WP_Scripts extends WP_Dependencies {
*
* Prints the scripts passed to it or the print queue. Also prints all necessary dependencies.
*
- * @param mixed handles (optional) Scripts to be printed. (void) prints queue, (string) prints that script, (array of strings) prints those scripts.
- * @param int group (optional) If scripts were queued in groups prints this group number.
+ * @param mixed $handles (optional) Scripts to be printed. (void) prints queue, (string) prints that script, (array of strings) prints those scripts.
+ * @param int $group (optional) If scripts were queued in groups prints this group number.
* @return array Scripts that have been printed
*/
function print_scripts( $handles = false, $group = false ) {
@@ -135,9 +135,9 @@ class WP_Scripts extends WP_Dependencies {
*
* 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
+ * @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 ) {
@@ -183,6 +183,9 @@ class WP_Scripts extends WP_Dependencies {
if ( ! $this->default_dirs )
return true;
+ if ( 0 === strpos( $src, '/wp-includes/js/l10n' ) )
+ return false;
+
foreach ( (array) $this->default_dirs as $test ) {
if ( 0 === strpos($src, $test) )
return true;
diff --git a/wp-includes/classes.php b/wp-includes/classes.php
deleted file mode 100644
index f24a6ec2..00000000
--- a/wp-includes/classes.php
+++ /dev/null
@@ -1,1700 +0,0 @@
-public_query_vars) )
- $this->public_query_vars[] = $qv;
- }
-
- /**
- * Set the value of a query variable.
- *
- * @since 2.3.0
- *
- * @param string $key Query variable name.
- * @param mixed $value Query variable value.
- */
- function set_query_var($key, $value) {
- $this->query_vars[$key] = $value;
- }
-
- /**
- * Parse request to find correct WordPress query.
- *
- * Sets up the query variables based on the request. There are also many
- * filters and actions that can be used to further manipulate the result.
- *
- * @since 2.0.0
- *
- * @param array|string $extra_query_vars Set the extra query variables.
- */
- function parse_request($extra_query_vars = '') {
- global $wp_rewrite;
-
- $this->query_vars = array();
- $taxonomy_query_vars = array();
- $post_type_query_vars = array();
-
- if ( is_array($extra_query_vars) )
- $this->extra_query_vars = & $extra_query_vars;
- else if (! empty($extra_query_vars))
- parse_str($extra_query_vars, $this->extra_query_vars);
-
- // Process PATH_INFO, REQUEST_URI, and 404 for permalinks.
-
- // Fetch the rewrite rules.
- $rewrite = $wp_rewrite->wp_rewrite_rules();
-
- if ( ! empty($rewrite) ) {
- // If we match a rewrite rule, this will be cleared.
- $error = '404';
- $this->did_permalink = true;
-
- if ( isset($_SERVER['PATH_INFO']) )
- $pathinfo = $_SERVER['PATH_INFO'];
- else
- $pathinfo = '';
- $pathinfo_array = explode('?', $pathinfo);
- $pathinfo = str_replace("%", "%25", $pathinfo_array[0]);
- $req_uri = $_SERVER['REQUEST_URI'];
- $req_uri_array = explode('?', $req_uri);
- $req_uri = $req_uri_array[0];
- $self = $_SERVER['PHP_SELF'];
- $home_path = parse_url(home_url());
- if ( isset($home_path['path']) )
- $home_path = $home_path['path'];
- else
- $home_path = '';
- $home_path = trim($home_path, '/');
-
- // Trim path info from the end and the leading home path from the
- // front. For path info requests, this leaves us with the requesting
- // filename, if any. For 404 requests, this leaves us with the
- // requested permalink.
- $req_uri = str_replace($pathinfo, '', rawurldecode($req_uri));
- $req_uri = trim($req_uri, '/');
- $req_uri = preg_replace("|^$home_path|", '', $req_uri);
- $req_uri = trim($req_uri, '/');
- $pathinfo = trim($pathinfo, '/');
- $pathinfo = preg_replace("|^$home_path|", '', $pathinfo);
- $pathinfo = trim($pathinfo, '/');
- $self = trim($self, '/');
- $self = preg_replace("|^$home_path|", '', $self);
- $self = trim($self, '/');
-
- // The requested permalink is in $pathinfo for path info requests and
- // $req_uri for other requests.
- if ( ! empty($pathinfo) && !preg_match('|^.*' . $wp_rewrite->index . '$|', $pathinfo) ) {
- $request = $pathinfo;
- } else {
- // If the request uri is the index, blank it out so that we don't try to match it against a rule.
- if ( $req_uri == $wp_rewrite->index )
- $req_uri = '';
- $request = $req_uri;
- }
-
- $this->request = $request;
-
- // Look for matches.
- $request_match = $request;
- foreach ( (array) $rewrite as $match => $query) {
- // Don't try to match against AtomPub calls
- if ( $req_uri == 'wp-app.php' )
- break;
-
- // If the requesting file is the anchor of the match, prepend it
- // to the path info.
- if ( (! empty($req_uri)) && (strpos($match, $req_uri) === 0) && ($req_uri != $request) )
- $request_match = $req_uri . '/' . $request;
-
- if ( preg_match("#^$match#", $request_match, $matches) ||
- preg_match("#^$match#", urldecode($request_match), $matches) ) {
- // Got a match.
- $this->matched_rule = $match;
-
- // Trim the query of everything up to the '?'.
- $query = preg_replace("!^.+\?!", '', $query);
-
- // Substitute the substring matches into the query.
- $query = addslashes(WP_MatchesMapRegex::apply($query, $matches));
-
- $this->matched_query = $query;
-
- // Parse the query.
- parse_str($query, $perma_query_vars);
-
- // If we're processing a 404 request, clear the error var
- // since we found something.
- if ( isset($_GET['error']) )
- unset($_GET['error']);
-
- if ( isset($error) )
- unset($error);
-
- break;
- }
- }
-
- // If req_uri is empty or if it is a request for ourself, unset error.
- if ( empty($request) || $req_uri == $self || strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false ) {
- if ( isset($_GET['error']) )
- unset($_GET['error']);
-
- if ( isset($error) )
- unset($error);
-
- if ( isset($perma_query_vars) && strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false )
- unset($perma_query_vars);
-
- $this->did_permalink = false;
- }
- }
-
- $this->public_query_vars = apply_filters('query_vars', $this->public_query_vars);
-
- foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t )
- if ( $t->query_var )
- $taxonomy_query_vars[$t->query_var] = $taxonomy;
-
- foreach ( $GLOBALS['wp_post_types'] as $post_type => $t )
- if ( $t->query_var )
- $post_type_query_vars[$t->query_var] = $post_type;
-
- for ( $i = 0; $i < count($this->public_query_vars); $i += 1 ) {
- $wpvar = $this->public_query_vars[$i];
- if ( isset($this->extra_query_vars[$wpvar]) )
- $this->query_vars[$wpvar] = $this->extra_query_vars[$wpvar];
- elseif ( isset($GLOBALS[$wpvar]) )
- $this->query_vars[$wpvar] = $GLOBALS[$wpvar];
- elseif ( !empty($_POST[$wpvar]) )
- $this->query_vars[$wpvar] = $_POST[$wpvar];
- elseif ( !empty($_GET[$wpvar]) )
- $this->query_vars[$wpvar] = $_GET[$wpvar];
- elseif ( !empty($perma_query_vars[$wpvar]) )
- $this->query_vars[$wpvar] = $perma_query_vars[$wpvar];
-
- if ( !empty( $this->query_vars[$wpvar] ) ) {
- $this->query_vars[$wpvar] = (string) $this->query_vars[$wpvar];
- if ( isset( $taxonomy_query_vars[$wpvar] ) ) {
- $this->query_vars['taxonomy'] = $taxonomy_query_vars[$wpvar];
- $this->query_vars['term'] = $this->query_vars[$wpvar];
- } elseif ( isset($post_type_query_vars[$wpvar] ) ) {
- $this->query_vars['post_type'] = $post_type_query_vars[$wpvar];
- $this->query_vars['name'] = $this->query_vars[$wpvar];
- }
- }
- }
-
- // Limit publicly queried post_types to those that are publicly_queryable
- if ( isset( $this->query_vars['post_type']) ) {
- $queryable_post_types = get_post_types( array('publicly_queryable' => true) );
- if ( ! in_array( $this->query_vars['post_type'], $queryable_post_types ) )
- unset( $this->query_vars['post_type'] );
- }
-
- foreach ( (array) $this->private_query_vars as $var) {
- if ( isset($this->extra_query_vars[$var]) )
- $this->query_vars[$var] = $this->extra_query_vars[$var];
- elseif ( isset($GLOBALS[$var]) && '' != $GLOBALS[$var] )
- $this->query_vars[$var] = $GLOBALS[$var];
- }
-
- if ( isset($error) )
- $this->query_vars['error'] = $error;
-
- $this->query_vars = apply_filters('request', $this->query_vars);
-
- do_action_ref_array('parse_request', array(&$this));
- }
-
- /**
- * Send additional HTTP headers for caching, content type, etc.
- *
- * Sets the X-Pingback header, 404 status (if 404), Content-type. If showing
- * a feed, it will also send last-modified, etag, and 304 status if needed.
- *
- * @since 2.0.0
- */
- function send_headers() {
- $headers = array('X-Pingback' => get_bloginfo('pingback_url'));
- $status = null;
- $exit_required = false;
-
- if ( is_user_logged_in() )
- $headers = array_merge($headers, wp_get_nocache_headers());
- if ( !empty($this->query_vars['error']) && '404' == $this->query_vars['error'] ) {
- $status = 404;
- if ( !is_user_logged_in() )
- $headers = array_merge($headers, wp_get_nocache_headers());
- $headers['Content-Type'] = get_option('html_type') . '; charset=' . get_option('blog_charset');
- } else if ( empty($this->query_vars['feed']) ) {
- $headers['Content-Type'] = get_option('html_type') . '; charset=' . get_option('blog_charset');
- } else {
- // We're showing a feed, so WP is indeed the only thing that last changed
- if ( !empty($this->query_vars['withcomments'])
- || ( empty($this->query_vars['withoutcomments'])
- && ( !empty($this->query_vars['p'])
- || !empty($this->query_vars['name'])
- || !empty($this->query_vars['page_id'])
- || !empty($this->query_vars['pagename'])
- || !empty($this->query_vars['attachment'])
- || !empty($this->query_vars['attachment_id'])
- )
- )
- )
- $wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastcommentmodified('GMT'), 0).' GMT';
- else
- $wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0).' GMT';
- $wp_etag = '"' . md5($wp_last_modified) . '"';
- $headers['Last-Modified'] = $wp_last_modified;
- $headers['ETag'] = $wp_etag;
-
- // Support for Conditional GET
- if (isset($_SERVER['HTTP_IF_NONE_MATCH']))
- $client_etag = stripslashes(stripslashes($_SERVER['HTTP_IF_NONE_MATCH']));
- else $client_etag = false;
-
- $client_last_modified = empty($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? '' : trim($_SERVER['HTTP_IF_MODIFIED_SINCE']);
- // If string is empty, return 0. If not, attempt to parse into a timestamp
- $client_modified_timestamp = $client_last_modified ? strtotime($client_last_modified) : 0;
-
- // Make a timestamp for our most recent modification...
- $wp_modified_timestamp = strtotime($wp_last_modified);
-
- if ( ($client_last_modified && $client_etag) ?
- (($client_modified_timestamp >= $wp_modified_timestamp) && ($client_etag == $wp_etag)) :
- (($client_modified_timestamp >= $wp_modified_timestamp) || ($client_etag == $wp_etag)) ) {
- $status = 304;
- $exit_required = true;
- }
- }
-
- $headers = apply_filters('wp_headers', $headers, $this);
-
- if ( ! empty( $status ) )
- status_header( $status );
- foreach( (array) $headers as $name => $field_value )
- @header("{$name}: {$field_value}");
-
- if ($exit_required)
- exit();
-
- do_action_ref_array('send_headers', array(&$this));
- }
-
- /**
- * Sets the query string property based off of the query variable property.
- *
- * The 'query_string' filter is deprecated, but still works. Plugins should
- * use the 'request' filter instead.
- *
- * @since 2.0.0
- */
- function build_query_string() {
- $this->query_string = '';
- foreach ( (array) array_keys($this->query_vars) as $wpvar) {
- if ( '' != $this->query_vars[$wpvar] ) {
- $this->query_string .= (strlen($this->query_string) < 1) ? '' : '&';
- if ( !is_scalar($this->query_vars[$wpvar]) ) // Discard non-scalars.
- continue;
- $this->query_string .= $wpvar . '=' . rawurlencode($this->query_vars[$wpvar]);
- }
- }
-
- // query_string filter deprecated. Use request filter instead.
- if ( has_filter('query_string') ) { // Don't bother filtering and parsing if no plugins are hooked in.
- $this->query_string = apply_filters('query_string', $this->query_string);
- parse_str($this->query_string, $this->query_vars);
- }
- }
-
- /**
- * Set up the WordPress Globals.
- *
- * The query_vars property will be extracted to the GLOBALS. So care should
- * be taken when naming global variables that might interfere with the
- * WordPress environment.
- *
- * @global string $query_string Query string for the loop.
- * @global int $more Only set, if single page or post.
- * @global int $single If single page or post. Only set, if single page or post.
- *
- * @since 2.0.0
- */
- function register_globals() {
- global $wp_query;
- // Extract updated query vars back into global namespace.
- foreach ( (array) $wp_query->query_vars as $key => $value) {
- $GLOBALS[$key] = $value;
- }
-
- $GLOBALS['query_string'] = $this->query_string;
- $GLOBALS['posts'] = & $wp_query->posts;
- $GLOBALS['post'] = $wp_query->post;
- $GLOBALS['request'] = $wp_query->request;
-
- if ( is_single() || is_page() ) {
- $GLOBALS['more'] = 1;
- $GLOBALS['single'] = 1;
- }
- }
-
- /**
- * Set up the current user.
- *
- * @since 2.0.0
- */
- function init() {
- wp_get_current_user();
- }
-
- /**
- * Set up the Loop based on the query variables.
- *
- * @uses WP::$query_vars
- * @since 2.0.0
- */
- function query_posts() {
- global $wp_the_query;
- $this->build_query_string();
- $wp_the_query->query($this->query_vars);
- }
-
- /**
- * Set the Headers for 404, if nothing is found for requested URL.
- *
- * Issue a 404 if a request doesn't match any posts and doesn't match
- * any object (e.g. an existing-but-empty category, tag, author) and a 404 was not already
- * issued, and if the request was not a search or the homepage.
- *
- * Otherwise, issue a 200.
- *
- * @since 2.0.0
- */
- function handle_404() {
- global $wp_query;
-
- if ( !is_admin() && ( 0 == count( $wp_query->posts ) ) && !is_404() && !is_robots() && !is_search() && !is_home() ) {
- // Don't 404 for these queries if they matched an object.
- if ( ( is_tag() || is_category() || is_tax() || is_author() ) && $wp_query->get_queried_object() && !is_paged() ) {
- if ( !is_404() )
- status_header( 200 );
- return;
- }
- $wp_query->set_404();
- status_header( 404 );
- nocache_headers();
- } elseif ( !is_404() ) {
- status_header( 200 );
- }
- }
-
- /**
- * Sets up all of the variables required by the WordPress environment.
- *
- * The action 'wp' has one parameter that references the WP object. It
- * allows for accessing the properties and methods to further manipulate the
- * object.
- *
- * @since 2.0.0
- *
- * @param string|array $query_args Passed to {@link parse_request()}
- */
- function main($query_args = '') {
- $this->init();
- $this->parse_request($query_args);
- $this->send_headers();
- $this->query_posts();
- $this->handle_404();
- $this->register_globals();
- do_action_ref_array('wp', array(&$this));
- }
-
- /**
- * PHP4 Constructor - Does nothing.
- *
- * Call main() method when ready to run setup.
- *
- * @since 2.0.0
- *
- * @return WP
- */
- function WP() {
- // Empty.
- }
-}
-
-/**
- * WordPress Error class.
- *
- * Container for checking for WordPress errors and error messages. Return
- * WP_Error and use {@link is_wp_error()} to check if this class is returned.
- * Many core WordPress functions pass this class in the event of an error and
- * if not handled properly will result in code errors.
- *
- * @package WordPress
- * @since 2.1.0
- */
-class WP_Error {
- /**
- * Stores the list of errors.
- *
- * @since 2.1.0
- * @var array
- * @access private
- */
- var $errors = array();
-
- /**
- * Stores the list of data for error codes.
- *
- * @since 2.1.0
- * @var array
- * @access private
- */
- var $error_data = array();
-
- /**
- * PHP4 Constructor - Sets up error message.
- *
- * If code parameter is empty then nothing will be done. It is possible to
- * add multiple messages to the same code, but with other methods in the
- * class.
- *
- * All parameters are optional, but if the code parameter is set, then the
- * data parameter is optional.
- *
- * @since 2.1.0
- *
- * @param string|int $code Error code
- * @param string $message Error message
- * @param mixed $data Optional. Error data.
- * @return WP_Error
- */
- function WP_Error($code = '', $message = '', $data = '') {
- if ( empty($code) )
- return;
-
- $this->errors[$code][] = $message;
-
- if ( ! empty($data) )
- $this->error_data[$code] = $data;
- }
-
- /**
- * Retrieve all error codes.
- *
- * @since 2.1.0
- * @access public
- *
- * @return array List of error codes, if avaiable.
- */
- function get_error_codes() {
- if ( empty($this->errors) )
- return array();
-
- return array_keys($this->errors);
- }
-
- /**
- * Retrieve first error code available.
- *
- * @since 2.1.0
- * @access public
- *
- * @return string|int Empty string, if no error codes.
- */
- function get_error_code() {
- $codes = $this->get_error_codes();
-
- if ( empty($codes) )
- return '';
-
- return $codes[0];
- }
-
- /**
- * Retrieve all error messages or error messages matching code.
- *
- * @since 2.1.0
- *
- * @param string|int $code Optional. Retrieve messages matching code, if exists.
- * @return array Error strings on success, or empty array on failure (if using codee parameter).
- */
- function get_error_messages($code = '') {
- // Return all messages if no code specified.
- if ( empty($code) ) {
- $all_messages = array();
- foreach ( (array) $this->errors as $code => $messages )
- $all_messages = array_merge($all_messages, $messages);
-
- return $all_messages;
- }
-
- if ( isset($this->errors[$code]) )
- return $this->errors[$code];
- else
- return array();
- }
-
- /**
- * Get single error message.
- *
- * This will get the first message available for the code. If no code is
- * given then the first code available will be used.
- *
- * @since 2.1.0
- *
- * @param string|int $code Optional. Error code to retrieve message.
- * @return string
- */
- function get_error_message($code = '') {
- if ( empty($code) )
- $code = $this->get_error_code();
- $messages = $this->get_error_messages($code);
- if ( empty($messages) )
- return '';
- return $messages[0];
- }
-
- /**
- * Retrieve error data for error code.
- *
- * @since 2.1.0
- *
- * @param string|int $code Optional. Error code.
- * @return mixed Null, if no errors.
- */
- function get_error_data($code = '') {
- if ( empty($code) )
- $code = $this->get_error_code();
-
- if ( isset($this->error_data[$code]) )
- return $this->error_data[$code];
- return null;
- }
-
- /**
- * Append more error messages to list of error messages.
- *
- * @since 2.1.0
- * @access public
- *
- * @param string|int $code Error code.
- * @param string $message Error message.
- * @param mixed $data Optional. Error data.
- */
- function add($code, $message, $data = '') {
- $this->errors[$code][] = $message;
- if ( ! empty($data) )
- $this->error_data[$code] = $data;
- }
-
- /**
- * Add data for error code.
- *
- * The error code can only contain one error data.
- *
- * @since 2.1.0
- *
- * @param mixed $data Error data.
- * @param string|int $code Error code.
- */
- function add_data($data, $code = '') {
- if ( empty($code) )
- $code = $this->get_error_code();
-
- $this->error_data[$code] = $data;
- }
-}
-
-/**
- * Check whether variable is a WordPress Error.
- *
- * Looks at the object and if a WP_Error class. Does not check to see if the
- * parent is also WP_Error, so can't inherit WP_Error and still use this
- * function.
- *
- * @since 2.1.0
- *
- * @param mixed $thing Check if unknown variable is WordPress Error object.
- * @return bool True, if WP_Error. False, if not WP_Error.
- */
-function is_wp_error($thing) {
- if ( is_object($thing) && is_a($thing, 'WP_Error') )
- return true;
- return false;
-}
-
-/**
- * A class for displaying various tree-like structures.
- *
- * Extend the Walker class to use it, see examples at the below. Child classes
- * do not need to implement all of the abstract methods in the class. The child
- * only needs to implement the methods that are needed. Also, the methods are
- * not strictly abstract in that the parameter definition needs to be followed.
- * The child classes can have additional parameters.
- *
- * @package WordPress
- * @since 2.1.0
- * @abstract
- */
-class Walker {
- /**
- * What the class handles.
- *
- * @since 2.1.0
- * @var string
- * @access public
- */
- var $tree_type;
-
- /**
- * DB fields to use.
- *
- * @since 2.1.0
- * @var array
- * @access protected
- */
- var $db_fields;
-
- /**
- * Max number of pages walked by the paged walker
- *
- * @since 2.7.0
- * @var int
- * @access protected
- */
- var $max_pages = 1;
-
- /**
- * Starts the list before the elements are added.
- *
- * Additional parameters are used in child classes. The args parameter holds
- * additional values that may be used with the child class methods. This
- * method is called at the start of the output list.
- *
- * @since 2.1.0
- * @abstract
- *
- * @param string $output Passed by reference. Used to append additional content.
- */
- function start_lvl(&$output) {}
-
- /**
- * Ends the list of after the elements are added.
- *
- * Additional parameters are used in child classes. The args parameter holds
- * additional values that may be used with the child class methods. This
- * method finishes the list at the end of output of the elements.
- *
- * @since 2.1.0
- * @abstract
- *
- * @param string $output Passed by reference. Used to append additional content.
- */
- function end_lvl(&$output) {}
-
- /**
- * Start the element output.
- *
- * Additional parameters are used in child classes. The args parameter holds
- * additional values that may be used with the child class methods. Includes
- * the element output also.
- *
- * @since 2.1.0
- * @abstract
- *
- * @param string $output Passed by reference. Used to append additional content.
- */
- function start_el(&$output) {}
-
- /**
- * Ends the element output, if needed.
- *
- * Additional parameters are used in child classes. The args parameter holds
- * additional values that may be used with the child class methods.
- *
- * @since 2.1.0
- * @abstract
- *
- * @param string $output Passed by reference. Used to append additional content.
- */
- function end_el(&$output) {}
-
- /**
- * Traverse elements to create list from elements.
- *
- * Display one element if the element doesn't have any children otherwise,
- * display the element and its children. Will only traverse up to the max
- * depth and no ignore elements under that depth. It is possible to set the
- * max depth to include all depths, see walk() method.
- *
- * This method shouldn't be called directly, use the walk() method instead.
- *
- * @since 2.5.0
- *
- * @param object $element Data object
- * @param array $children_elements List of elements to continue traversing.
- * @param int $max_depth Max depth to traverse.
- * @param int $depth Depth of current element.
- * @param array $args
- * @param string $output Passed by reference. Used to append additional content.
- * @return null Null on failure with no changes to parameters.
- */
- function display_element( $element, &$children_elements, $max_depth, $depth=0, $args, &$output ) {
-
- if ( !$element )
- return;
-
- $id_field = $this->db_fields['id'];
-
- //display this element
- if ( is_array( $args[0] ) )
- $args[0]['has_children'] = ! empty( $children_elements[$element->$id_field] );
- $cb_args = array_merge( array(&$output, $element, $depth), $args);
- call_user_func_array(array(&$this, 'start_el'), $cb_args);
-
- $id = $element->$id_field;
-
- // descend only when the depth is right and there are childrens for this element
- if ( ($max_depth == 0 || $max_depth > $depth+1 ) && isset( $children_elements[$id]) ) {
-
- foreach( $children_elements[ $id ] as $child ){
-
- if ( !isset($newlevel) ) {
- $newlevel = true;
- //start the child delimiter
- $cb_args = array_merge( array(&$output, $depth), $args);
- call_user_func_array(array(&$this, 'start_lvl'), $cb_args);
- }
- $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output );
- }
- unset( $children_elements[ $id ] );
- }
-
- if ( isset($newlevel) && $newlevel ){
- //end the child delimiter
- $cb_args = array_merge( array(&$output, $depth), $args);
- call_user_func_array(array(&$this, 'end_lvl'), $cb_args);
- }
-
- //end this element
- $cb_args = array_merge( array(&$output, $element, $depth), $args);
- call_user_func_array(array(&$this, 'end_el'), $cb_args);
- }
-
- /**
- * Display array of elements hierarchically.
- *
- * It is a generic function which does not assume any existing order of
- * elements. max_depth = -1 means flatly display every element. max_depth =
- * 0 means display all levels. max_depth > 0 specifies the number of
- * display levels.
- *
- * @since 2.1.0
- *
- * @param array $elements
- * @param int $max_depth
- * @return string
- */
- function walk( $elements, $max_depth) {
-
- $args = array_slice(func_get_args(), 2);
- $output = '';
-
- if ($max_depth < -1) //invalid parameter
- return $output;
-
- if (empty($elements)) //nothing to walk
- return $output;
-
- $id_field = $this->db_fields['id'];
- $parent_field = $this->db_fields['parent'];
-
- // flat display
- if ( -1 == $max_depth ) {
- $empty_array = array();
- foreach ( $elements as $e )
- $this->display_element( $e, $empty_array, 1, 0, $args, $output );
- return $output;
- }
-
- /*
- * need to display in hierarchical order
- * separate elements into two buckets: top level and children elements
- * children_elements is two dimensional array, eg.
- * children_elements[10][] contains all sub-elements whose parent is 10.
- */
- $top_level_elements = array();
- $children_elements = array();
- foreach ( $elements as $e) {
- if ( 0 == $e->$parent_field )
- $top_level_elements[] = $e;
- else
- $children_elements[ $e->$parent_field ][] = $e;
- }
-
- /*
- * when none of the elements is top level
- * assume the first one must be root of the sub elements
- */
- if ( empty($top_level_elements) ) {
-
- $first = array_slice( $elements, 0, 1 );
- $root = $first[0];
-
- $top_level_elements = array();
- $children_elements = array();
- foreach ( $elements as $e) {
- if ( $root->$parent_field == $e->$parent_field )
- $top_level_elements[] = $e;
- else
- $children_elements[ $e->$parent_field ][] = $e;
- }
- }
-
- foreach ( $top_level_elements as $e )
- $this->display_element( $e, $children_elements, $max_depth, 0, $args, $output );
-
- /*
- * if we are displaying all levels, and remaining children_elements is not empty,
- * then we got orphans, which should be displayed regardless
- */
- if ( ( $max_depth == 0 ) && count( $children_elements ) > 0 ) {
- $empty_array = array();
- foreach ( $children_elements as $orphans )
- foreach( $orphans as $op )
- $this->display_element( $op, $empty_array, 1, 0, $args, $output );
- }
-
- return $output;
- }
-
- /**
- * paged_walk() - produce a page of nested elements
- *
- * Given an array of hierarchical elements, the maximum depth, a specific page number,
- * and number of elements per page, this function first determines all top level root elements
- * belonging to that page, then lists them and all of their children in hierarchical order.
- *
- * @package WordPress
- * @since 2.7
- * @param $max_depth = 0 means display all levels; $max_depth > 0 specifies the number of display levels.
- * @param $page_num the specific page number, beginning with 1.
- * @return XHTML of the specified page of elements
- */
- function paged_walk( $elements, $max_depth, $page_num, $per_page ) {
-
- /* sanity check */
- if ( empty($elements) || $max_depth < -1 )
- return '';
-
- $args = array_slice( func_get_args(), 4 );
- $output = '';
-
- $id_field = $this->db_fields['id'];
- $parent_field = $this->db_fields['parent'];
-
- $count = -1;
- if ( -1 == $max_depth )
- $total_top = count( $elements );
- if ( $page_num < 1 || $per_page < 0 ) {
- // No paging
- $paging = false;
- $start = 0;
- if ( -1 == $max_depth )
- $end = $total_top;
- $this->max_pages = 1;
- } else {
- $paging = true;
- $start = ( (int)$page_num - 1 ) * (int)$per_page;
- $end = $start + $per_page;
- if ( -1 == $max_depth )
- $this->max_pages = ceil($total_top / $per_page);
- }
-
- // flat display
- if ( -1 == $max_depth ) {
- if ( !empty($args[0]['reverse_top_level']) ) {
- $elements = array_reverse( $elements );
- $oldstart = $start;
- $start = $total_top - $end;
- $end = $total_top - $oldstart;
- }
-
- $empty_array = array();
- foreach ( $elements as $e ) {
- $count++;
- if ( $count < $start )
- continue;
- if ( $count >= $end )
- break;
- $this->display_element( $e, $empty_array, 1, 0, $args, $output );
- }
- return $output;
- }
-
- /*
- * separate elements into two buckets: top level and children elements
- * children_elements is two dimensional array, eg.
- * children_elements[10][] contains all sub-elements whose parent is 10.
- */
- $top_level_elements = array();
- $children_elements = array();
- foreach ( $elements as $e) {
- if ( 0 == $e->$parent_field )
- $top_level_elements[] = $e;
- else
- $children_elements[ $e->$parent_field ][] = $e;
- }
-
- $total_top = count( $top_level_elements );
- if ( $paging )
- $this->max_pages = ceil($total_top / $per_page);
- else
- $end = $total_top;
-
- if ( !empty($args[0]['reverse_top_level']) ) {
- $top_level_elements = array_reverse( $top_level_elements );
- $oldstart = $start;
- $start = $total_top - $end;
- $end = $total_top - $oldstart;
- }
- if ( !empty($args[0]['reverse_children']) ) {
- foreach ( $children_elements as $parent => $children )
- $children_elements[$parent] = array_reverse( $children );
- }
-
- foreach ( $top_level_elements as $e ) {
- $count++;
-
- //for the last page, need to unset earlier children in order to keep track of orphans
- if ( $end >= $total_top && $count < $start )
- $this->unset_children( $e, $children_elements );
-
- if ( $count < $start )
- continue;
-
- if ( $count >= $end )
- break;
-
- $this->display_element( $e, $children_elements, $max_depth, 0, $args, $output );
- }
-
- if ( $end >= $total_top && count( $children_elements ) > 0 ) {
- $empty_array = array();
- foreach ( $children_elements as $orphans )
- foreach( $orphans as $op )
- $this->display_element( $op, $empty_array, 1, 0, $args, $output );
- }
-
- return $output;
- }
-
- function get_number_of_root_elements( $elements ){
-
- $num = 0;
- $parent_field = $this->db_fields['parent'];
-
- foreach ( $elements as $e) {
- if ( 0 == $e->$parent_field )
- $num++;
- }
- return $num;
- }
-
- // unset all the children for a given top level element
- function unset_children( $e, &$children_elements ){
-
- if ( !$e || !$children_elements )
- return;
-
- $id_field = $this->db_fields['id'];
- $id = $e->$id_field;
-
- if ( !empty($children_elements[$id]) && is_array($children_elements[$id]) )
- foreach ( (array) $children_elements[$id] as $child )
- $this->unset_children( $child, $children_elements );
-
- if ( isset($children_elements[$id]) )
- unset( $children_elements[$id] );
-
- }
-}
-
-/**
- * Create HTML list of pages.
- *
- * @package WordPress
- * @since 2.1.0
- * @uses Walker
- */
-class Walker_Page extends Walker {
- /**
- * @see Walker::$tree_type
- * @since 2.1.0
- * @var string
- */
- var $tree_type = 'page';
-
- /**
- * @see Walker::$db_fields
- * @since 2.1.0
- * @todo Decouple this.
- * @var array
- */
- var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID');
-
- /**
- * @see Walker::start_lvl()
- * @since 2.1.0
- *
- * @param string $output Passed by reference. Used to append additional content.
- * @param int $depth Depth of page. Used for padding.
- */
- function start_lvl(&$output, $depth) {
- $indent = str_repeat("\t", $depth);
- $output .= "\n$indent\n";
- }
-
- /**
- * @see Walker::end_lvl()
- * @since 2.1.0
- *
- * @param string $output Passed by reference. Used to append additional content.
- * @param int $depth Depth of page. Used for padding.
- */
- function end_lvl(&$output, $depth) {
- $indent = str_repeat("\t", $depth);
- $output .= "$indent \n";
- }
-
- /**
- * @see Walker::start_el()
- * @since 2.1.0
- *
- * @param string $output Passed by reference. Used to append additional content.
- * @param object $page Page data object.
- * @param int $depth Depth of page. Used for padding.
- * @param int $current_page Page ID.
- * @param array $args
- */
- function start_el(&$output, $page, $depth, $args, $current_page) {
- if ( $depth )
- $indent = str_repeat("\t", $depth);
- else
- $indent = '';
-
- extract($args, EXTR_SKIP);
- $css_class = array('page_item', 'page-item-'.$page->ID);
- if ( !empty($current_page) ) {
- $_current_page = get_page( $current_page );
- if ( isset($_current_page->ancestors) && in_array($page->ID, (array) $_current_page->ancestors) )
- $css_class[] = 'current_page_ancestor';
- if ( $page->ID == $current_page )
- $css_class[] = 'current_page_item';
- elseif ( $_current_page && $page->ID == $_current_page->post_parent )
- $css_class[] = 'current_page_parent';
- } elseif ( $page->ID == get_option('page_for_posts') ) {
- $css_class[] = 'current_page_parent';
- }
-
- $css_class = implode(' ', apply_filters('page_css_class', $css_class, $page));
-
- $output .= $indent . '' . $link_before . apply_filters( 'the_title', $page->post_title, $page->ID ) . $link_after . ' ';
-
- if ( !empty($show_date) ) {
- if ( 'modified' == $show_date )
- $time = $page->post_modified;
- else
- $time = $page->post_date;
-
- $output .= " " . mysql2date($date_format, $time);
- }
- }
-
- /**
- * @see Walker::end_el()
- * @since 2.1.0
- *
- * @param string $output Passed by reference. Used to append additional content.
- * @param object $page Page data object. Not used.
- * @param int $depth Depth of page. Not Used.
- */
- function end_el(&$output, $page, $depth) {
- $output .= " \n";
- }
-
-}
-
-/**
- * Create HTML dropdown list of pages.
- *
- * @package WordPress
- * @since 2.1.0
- * @uses Walker
- */
-class Walker_PageDropdown extends Walker {
- /**
- * @see Walker::$tree_type
- * @since 2.1.0
- * @var string
- */
- var $tree_type = 'page';
-
- /**
- * @see Walker::$db_fields
- * @since 2.1.0
- * @todo Decouple this
- * @var array
- */
- var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID');
-
- /**
- * @see Walker::start_el()
- * @since 2.1.0
- *
- * @param string $output Passed by reference. Used to append additional content.
- * @param object $page Page data object.
- * @param int $depth Depth of page in reference to parent pages. Used for padding.
- * @param array $args Uses 'selected' argument for selected page to set selected HTML attribute for option element.
- */
- function start_el(&$output, $page, $depth, $args) {
- $pad = str_repeat(' ', $depth * 3);
-
- $output .= "\tID\"";
- if ( $page->ID == $args['selected'] )
- $output .= ' selected="selected"';
- $output .= '>';
- $title = esc_html($page->post_title);
- $output .= "$pad$title";
- $output .= " \n";
- }
-}
-
-/**
- * Create HTML list of categories.
- *
- * @package WordPress
- * @since 2.1.0
- * @uses Walker
- */
-class Walker_Category extends Walker {
- /**
- * @see Walker::$tree_type
- * @since 2.1.0
- * @var string
- */
- var $tree_type = 'category';
-
- /**
- * @see Walker::$db_fields
- * @since 2.1.0
- * @todo Decouple this
- * @var array
- */
- var $db_fields = array ('parent' => 'parent', 'id' => 'term_id');
-
- /**
- * @see Walker::start_lvl()
- * @since 2.1.0
- *
- * @param string $output Passed by reference. Used to append additional content.
- * @param int $depth Depth of category. Used for tab indentation.
- * @param array $args Will only append content if style argument value is 'list'.
- */
- function start_lvl(&$output, $depth, $args) {
- if ( 'list' != $args['style'] )
- return;
-
- $indent = str_repeat("\t", $depth);
- $output .= "$indent\n";
- }
-
- /**
- * @see Walker::end_lvl()
- * @since 2.1.0
- *
- * @param string $output Passed by reference. Used to append additional content.
- * @param int $depth Depth of category. Used for tab indentation.
- * @param array $args Will only append content if style argument value is 'list'.
- */
- function end_lvl(&$output, $depth, $args) {
- if ( 'list' != $args['style'] )
- return;
-
- $indent = str_repeat("\t", $depth);
- $output .= "$indent \n";
- }
-
- /**
- * @see Walker::start_el()
- * @since 2.1.0
- *
- * @param string $output Passed by reference. Used to append additional content.
- * @param object $category Category data object.
- * @param int $depth Depth of category in reference to parents.
- * @param array $args
- */
- function start_el(&$output, $category, $depth, $args) {
- extract($args);
-
- $cat_name = esc_attr( $category->name);
- $cat_name = apply_filters( 'list_cats', $cat_name, $category );
- $link = 'description) )
- $link .= 'title="' . sprintf(__( 'View all posts filed under %s' ), $cat_name) . '"';
- else
- $link .= 'title="' . esc_attr( strip_tags( apply_filters( 'category_description', $category->description, $category ) ) ) . '"';
- $link .= '>';
- $link .= $cat_name . ' ';
-
- if ( (! empty($feed_image)) || (! empty($feed)) ) {
- $link .= ' ';
-
- if ( empty($feed_image) )
- $link .= '(';
-
- $link .= ' ';
- $link .= '';
- if ( empty($feed_image) )
- $link .= ')';
- }
-
- if ( isset($show_count) && $show_count )
- $link .= ' (' . intval($category->count) . ')';
-
- if ( isset($show_date) && $show_date ) {
- $link .= ' ' . gmdate('Y-m-d', $category->last_update_timestamp);
- }
-
- if ( isset($current_category) && $current_category )
- $_current_category = get_category( $current_category );
-
- if ( 'list' == $args['style'] ) {
- $output .= "\tterm_id;
- if ( isset($current_category) && $current_category && ($category->term_id == $current_category) )
- $class .= ' current-cat';
- elseif ( isset($_current_category) && $_current_category && ($category->term_id == $_current_category->parent) )
- $class .= ' current-cat-parent';
- $output .= ' class="'.$class.'"';
- $output .= ">$link\n";
- } else {
- $output .= "\t$link \n";
- }
- }
-
- /**
- * @see Walker::end_el()
- * @since 2.1.0
- *
- * @param string $output Passed by reference. Used to append additional content.
- * @param object $page Not used.
- * @param int $depth Depth of category. Not used.
- * @param array $args Only uses 'list' for whether should append to output.
- */
- function end_el(&$output, $page, $depth, $args) {
- if ( 'list' != $args['style'] )
- return;
-
- $output .= " \n";
- }
-
-}
-
-/**
- * Create HTML dropdown list of Categories.
- *
- * @package WordPress
- * @since 2.1.0
- * @uses Walker
- */
-class Walker_CategoryDropdown extends Walker {
- /**
- * @see Walker::$tree_type
- * @since 2.1.0
- * @var string
- */
- var $tree_type = 'category';
-
- /**
- * @see Walker::$db_fields
- * @since 2.1.0
- * @todo Decouple this
- * @var array
- */
- var $db_fields = array ('parent' => 'parent', 'id' => 'term_id');
-
- /**
- * @see Walker::start_el()
- * @since 2.1.0
- *
- * @param string $output Passed by reference. Used to append additional content.
- * @param object $category Category data object.
- * @param int $depth Depth of category. Used for padding.
- * @param array $args Uses 'selected', 'show_count', and 'show_last_update' keys, if they exist.
- */
- function start_el(&$output, $category, $depth, $args) {
- $pad = str_repeat(' ', $depth * 3);
-
- $cat_name = apply_filters('list_cats', $category->name, $category);
- $output .= "\tterm_id."\"";
- if ( $category->term_id == $args['selected'] )
- $output .= ' selected="selected"';
- $output .= '>';
- $output .= $pad.$cat_name;
- if ( $args['show_count'] )
- $output .= ' ('. $category->count .')';
- if ( $args['show_last_update'] ) {
- $format = 'Y-m-d';
- $output .= ' ' . gmdate($format, $category->last_update_timestamp);
- }
- $output .= " \n";
- }
-}
-
-/**
- * Send XML response back to AJAX request.
- *
- * @package WordPress
- * @since 2.1.0
- */
-class WP_Ajax_Response {
- /**
- * Store XML responses to send.
- *
- * @since 2.1.0
- * @var array
- * @access private
- */
- var $responses = array();
-
- /**
- * PHP4 Constructor - Passes args to {@link WP_Ajax_Response::add()}.
- *
- * @since 2.1.0
- * @see WP_Ajax_Response::add()
- *
- * @param string|array $args Optional. Will be passed to add() method.
- * @return WP_Ajax_Response
- */
- function WP_Ajax_Response( $args = '' ) {
- if ( !empty($args) )
- $this->add($args);
- }
-
- /**
- * Append to XML response based on given arguments.
- *
- * The arguments that can be passed in the $args parameter are below. It is
- * also possible to pass a WP_Error object in either the 'id' or 'data'
- * argument. The parameter isn't actually optional, content should be given
- * in order to send the correct response.
- *
- * 'what' argument is a string that is the XMLRPC response type.
- * 'action' argument is a boolean or string that acts like a nonce.
- * 'id' argument can be WP_Error or an integer.
- * 'old_id' argument is false by default or an integer of the previous ID.
- * 'position' argument is an integer or a string with -1 = top, 1 = bottom,
- * html ID = after, -html ID = before.
- * 'data' argument is a string with the content or message.
- * 'supplemental' argument is an array of strings that will be children of
- * the supplemental element.
- *
- * @since 2.1.0
- *
- * @param string|array $args Override defaults.
- * @return string XML response.
- */
- function add( $args = '' ) {
- $defaults = array(
- 'what' => 'object', 'action' => false,
- 'id' => '0', 'old_id' => false,
- 'position' => 1,
- 'data' => '', 'supplemental' => array()
- );
-
- $r = wp_parse_args( $args, $defaults );
- extract( $r, EXTR_SKIP );
- $position = preg_replace( '/[^a-z0-9:_-]/i', '', $position );
-
- if ( is_wp_error($id) ) {
- $data = $id;
- $id = 0;
- }
-
- $response = '';
- if ( is_wp_error($data) ) {
- foreach ( (array) $data->get_error_codes() as $code ) {
- $response .= "get_error_message($code) . "]]> ";
- if ( !$error_data = $data->get_error_data($code) )
- continue;
- $class = '';
- if ( is_object($error_data) ) {
- $class = ' class="' . get_class($error_data) . '"';
- $error_data = get_object_vars($error_data);
- }
-
- $response .= "";
-
- if ( is_scalar($error_data) ) {
- $response .= "";
- } elseif ( is_array($error_data) ) {
- foreach ( $error_data as $k => $v )
- $response .= "<$k>$k>";
- }
-
- $response .= " ";
- }
- } else {
- $response = " ";
- }
-
- $s = '';
- if ( is_array($supplemental) ) {
- foreach ( $supplemental as $k => $v )
- $s .= "<$k>$k>";
- $s = "$s ";
- }
-
- if ( false === $action )
- $action = $_POST['action'];
-
- $x = '';
- $x .= ""; // The action attribute in the xml output is formatted like a nonce action
- $x .= "<$what id='$id' " . ( false === $old_id ? '' : "old_id='$old_id' " ) . "position='$position'>";
- $x .= $response;
- $x .= $s;
- $x .= "$what>";
- $x .= " ";
-
- $this->responses[] = $x;
- return $x;
- }
-
- /**
- * Display XML formatted responses.
- *
- * Sets the content type header to text/xml.
- *
- * @since 2.1.0
- */
- function send() {
- header('Content-Type: text/xml');
- echo "";
- foreach ( (array) $this->responses as $response )
- echo $response;
- echo ' ';
- die();
- }
-}
-
-/**
- * Helper class to remove the need to use eval to replace $matches[] in query strings.
- *
- * @since 2.9.0
- */
-class WP_MatchesMapRegex {
- /**
- * store for matches
- *
- * @access private
- * @var array
- */
- var $_matches;
-
- /**
- * store for mapping result
- *
- * @access public
- * @var string
- */
- var $output;
-
- /**
- * subject to perform mapping on (query string containing $matches[] references
- *
- * @access private
- * @var string
- */
- var $_subject;
-
- /**
- * regexp pattern to match $matches[] references
- *
- * @var string
- */
- var $_pattern = '(\$matches\[[1-9]+[0-9]*\])'; // magic number
-
- /**
- * constructor
- *
- * @param string $subject subject if regex
- * @param array $matches data to use in map
- * @return self
- */
- function WP_MatchesMapRegex($subject, $matches) {
- $this->_subject = $subject;
- $this->_matches = $matches;
- $this->output = $this->_map();
- }
-
- /**
- * Substitute substring matches in subject.
- *
- * static helper function to ease use
- *
- * @access public
- * @param string $subject subject
- * @param array $matches data used for subsitution
- * @return string
- */
- function apply($subject, $matches) {
- $oSelf =& new WP_MatchesMapRegex($subject, $matches);
- return $oSelf->output;
- }
-
- /**
- * do the actual mapping
- *
- * @access private
- * @return string
- */
- function _map() {
- $callback = array(&$this, 'callback');
- return preg_replace_callback($this->_pattern, $callback, $this->_subject);
- }
-
- /**
- * preg_replace_callback hook
- *
- * @access public
- * @param array $matches preg_replace regexp matches
- * @return string
- */
- function callback($matches) {
- $index = intval(substr($matches[0], 9, -1));
- return ( isset( $this->_matches[$index] ) ? urlencode($this->_matches[$index]) : '' );
- }
-
-}
-
-?>
diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php
index d3ee1906..d00c6599 100644
--- a/wp-includes/comment-template.php
+++ b/wp-includes/comment-template.php
@@ -162,7 +162,7 @@ function get_comment_author_link( $comment_ID = 0 ) {
* @since 0.71
* @see get_comment_author_link() Echoes result
*
- * @param int The ID of the comment for which to print the author's link. Optional.
+ * @param int $comment_ID The ID of the comment for which to print the author's link. Optional.
*/
function comment_author_link( $comment_ID = 0 ) {
echo get_comment_author_link( $comment_ID );
@@ -545,11 +545,10 @@ function comments_link( $deprecated = '', $deprecated_2 = '' ) {
* @return int The number of comments a post has
*/
function get_comments_number( $post_id = 0 ) {
- global $id;
- $post_id = (int) $post_id;
+ $post_id = absint( $post_id );
if ( !$post_id )
- $post_id = (int) $id;
+ $post_id = get_the_ID();
$post = get_post($post_id);
if ( ! isset($post->comment_count) )
@@ -564,7 +563,6 @@ function get_comments_number( $post_id = 0 ) {
* Display the language string for the number of comments the current post has.
*
* @since 0.71
- * @uses $id
* @uses apply_filters() Calls the 'comments_number' hook on the output and number of comments respectively.
*
* @param string $zero Text for no comments
@@ -573,12 +571,10 @@ function get_comments_number( $post_id = 0 ) {
* @param string $deprecated Not used.
*/
function comments_number( $zero = false, $one = false, $more = false, $deprecated = '' ) {
- global $id;
-
if ( !empty( $deprecated ) )
_deprecated_argument( __FUNCTION__, '1.3' );
- $number = get_comments_number($id);
+ $number = get_comments_number();
if ( $number > 1 )
$output = str_replace('%', number_format_i18n($number), ( false === $more ) ? __('% Comments') : $more);
@@ -601,7 +597,7 @@ function comments_number( $zero = false, $one = false, $more = false, $deprecate
*/
function get_comment_text( $comment_ID = 0 ) {
$comment = get_comment( $comment_ID );
- return apply_filters('get_comment_text', $comment->comment_content);
+ return apply_filters( 'get_comment_text', $comment->comment_content, $comment );
}
/**
@@ -614,7 +610,8 @@ function get_comment_text( $comment_ID = 0 ) {
* @param int $comment_ID The ID of the comment for which to print the text. Optional.
*/
function comment_text( $comment_ID = 0 ) {
- echo apply_filters('comment_text', get_comment_text() );
+ $comment = get_comment( $comment_ID );
+ echo apply_filters( 'comment_text', get_comment_text( $comment_ID ), $comment );
}
/**
@@ -678,9 +675,9 @@ function get_comment_type( $comment_ID = 0 ) {
* @param string $pingbacktxt The string to display for pingback type
*/
function comment_type($commenttxt = false, $trackbacktxt = false, $pingbacktxt = false) {
- if ( false === $commenttxt ) $commenttxt = _x( 'Comment', 'noun' );
- if ( false === $trackbacktxt ) $trackbacktxt = __( 'Trackback' );
- if ( false === $pingbacktxt ) $pingbacktxt = __( 'Pingback' );
+ if ( false === $commenttxt ) $commenttxt = _x( 'Comment', 'noun' );
+ if ( false === $trackbacktxt ) $trackbacktxt = __( 'Trackback' );
+ if ( false === $pingbacktxt ) $pingbacktxt = __( 'Pingback' );
$type = get_comment_type();
switch( $type ) {
case 'trackback' :
@@ -703,16 +700,14 @@ function comment_type($commenttxt = false, $trackbacktxt = false, $pingbacktxt =
*
* @since 1.5.0
* @uses apply_filters() Calls 'trackback_url' on the resulting trackback URL
- * @uses $id
*
* @return string The trackback URL after being filtered
*/
function get_trackback_url() {
- global $id;
if ( '' != get_option('permalink_structure') ) {
$tb_url = trailingslashit(get_permalink()) . user_trailingslashit('trackback', 'single_trackback');
} else {
- $tb_url = get_option('siteurl') . '/wp-trackback.php?p=' . $id;
+ $tb_url = get_option('siteurl') . '/wp-trackback.php?p=' . get_the_ID();
}
return apply_filters('trackback_url', $tb_url);
}
@@ -748,6 +743,9 @@ function trackback_rdf( $deprecated = '' ) {
if ( !empty( $deprecated ) )
_deprecated_argument( __FUNCTION__, '2.5' );
+ if ( false !== stripos($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator') )
+ return;
+
echo '
@@ -841,7 +839,6 @@ function wp_comment_form_unfiltered_html_nonce() {
* @since 1.5.0
* @global array $comment List of comment objects for the current post
* @uses $wpdb
- * @uses $id
* @uses $post
* @uses $withcomments Will not try to get the comments if the post has none.
*
@@ -958,7 +955,6 @@ function comments_popup_script($width=400, $height=400, $file='') {
* lists of posts
*
* @since 0.71
- * @uses $id
* @uses $wpcommentspopupfile
* @uses $wpcommentsjavascript
* @uses $post
@@ -971,12 +967,14 @@ function comments_popup_script($width=400, $height=400, $file='') {
* @return null Returns null on single posts and pages.
*/
function comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) {
- global $id, $wpcommentspopupfile, $wpcommentsjavascript;
+ global $wpcommentspopupfile, $wpcommentsjavascript;
+
+ $id = get_the_ID();
- if ( false === $zero ) $zero = __( 'No Comments' );
- if ( false === $one ) $one = __( '1 Comment' );
- if ( false === $more ) $more = __( '% Comments' );
- if ( false === $none ) $none = __( 'Comments Off' );
+ if ( false === $zero ) $zero = __( 'No Comments' );
+ if ( false === $one ) $one = __( '1 Comment' );
+ if ( false === $more ) $more = __( '% Comments' );
+ if ( false === $none ) $none = __( 'Comments Off' );
$number = get_comments_number( $id );
@@ -1061,7 +1059,7 @@ function get_comment_reply_link($args = array(), $comment = null, $post = null)
if ( get_option('comment_registration') && !$user_ID )
$link = '';
else
- $link = "";
+ $link = "";
return apply_filters('comment_reply_link', $before . $link . $after, $args, $comment, $post);
}
@@ -1165,7 +1163,7 @@ function cancel_comment_reply_link($text = '') {
* @return string Hidden input HTML for replying to comments
*/
function get_comment_id_fields() {
- global $id;
+ $id = get_the_ID();
$replytoid = isset($_GET['replytocom']) ? (int) $_GET['replytocom'] : 0;
$result = "\n";
@@ -1214,26 +1212,26 @@ function comment_form_title( $noreplytext = false, $replytext = false, $linktopa
*
* @package WordPress
* @uses Walker
- * @since unknown
+ * @since 2.7.0
*/
class Walker_Comment extends Walker {
/**
* @see Walker::$tree_type
- * @since unknown
+ * @since 2.7.0
* @var string
*/
var $tree_type = 'comment';
/**
* @see Walker::$db_fields
- * @since unknown
+ * @since 2.7.0
* @var array
*/
var $db_fields = array ('parent' => 'comment_parent', 'id' => 'comment_ID');
/**
* @see Walker::start_lvl()
- * @since unknown
+ * @since 2.7.0
*
* @param string $output Passed by reference. Used to append additional content.
* @param int $depth Depth of comment.
@@ -1257,7 +1255,7 @@ class Walker_Comment extends Walker {
/**
* @see Walker::end_lvl()
- * @since unknown
+ * @since 2.7.0
*
* @param string $output Passed by reference. Used to append additional content.
* @param int $depth Depth of comment.
@@ -1320,7 +1318,7 @@ class Walker_Comment extends Walker {
/**
* @see Walker::start_el()
- * @since unknown
+ * @since 2.7.0
*
* @param string $output Passed by reference. Used to append additional content.
* @param object $comment Comment data object.
@@ -1356,7 +1354,7 @@ class Walker_Comment extends Walker {
%s says: '), get_comment_author_link()) ?>
comment_approved == '0') : ?>
-
+
@@ -1380,7 +1378,7 @@ class Walker_Comment extends Walker {
/**
* @see Walker::end_el()
- * @since unknown
+ * @since 2.7.0
*
* @param string $output Passed by reference. Used to append additional content.
* @param object $comment
diff --git a/wp-includes/comment.php b/wp-includes/comment.php
index 517cb9a7..c0c17566 100644
--- a/wp-includes/comment.php
+++ b/wp-includes/comment.php
@@ -44,9 +44,11 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $
if ( 1 == get_option('comment_moderation') )
return false; // If moderation is set to manual
+ $comment = apply_filters( 'comment_text', $comment );
+
// Check # of external links
if ( $max_links = get_option( 'comment_max_links' ) ) {
- $num_links = preg_match_all( '/]*href/i', apply_filters( 'comment_text', $comment ), $out );
+ $num_links = preg_match_all( '/ ]*href/i', $comment, $out );
$num_links = apply_filters( 'comment_max_links_url', $num_links, $url ); // provide for counting of $url as a link
if ( $num_links >= $max_links )
return false;
@@ -178,116 +180,182 @@ function &get_comment(&$comment, $output = OBJECT) {
* @return array List of comments.
*/
function get_comments( $args = '' ) {
- global $wpdb;
+ $query = new WP_Comment_Query;
+ return $query->query( $args );
+}
- $defaults = array(
- 'author_email' => '',
- 'ID' => '',
- 'karma' => '',
- 'number' => '',
- 'offset' => '',
- 'orderby' => '',
- 'order' => 'DESC',
- 'parent' => '',
- 'post_ID' => '',
- 'post_id' => 0,
- 'status' => '',
- 'type' => '',
- 'user_id' => '',
- );
+/**
+ * WordPress Comment Query class.
+ *
+ * @since 3.1.0
+ */
+class WP_Comment_Query {
+
+ /**
+ * Execute the query
+ *
+ * @since 3.1.0
+ *
+ * @param string|array $query_vars
+ * @return int|array
+ */
+ function query( $query_vars ) {
+ global $wpdb;
+
+ $defaults = array(
+ 'author_email' => '',
+ 'ID' => '',
+ 'karma' => '',
+ 'number' => '',
+ 'offset' => '',
+ 'orderby' => '',
+ 'order' => 'DESC',
+ 'parent' => '',
+ 'post_ID' => '',
+ 'post_id' => 0,
+ 'status' => '',
+ 'type' => '',
+ 'user_id' => '',
+ 'search' => '',
+ 'count' => false
+ );
- $args = wp_parse_args( $args, $defaults );
- extract( $args, EXTR_SKIP );
-
- // $args can be whatever, only use the args defined in defaults to compute the key
- $key = md5( serialize( compact(array_keys($defaults)) ) );
- $last_changed = wp_cache_get('last_changed', 'comment');
- if ( !$last_changed ) {
- $last_changed = time();
- wp_cache_set('last_changed', $last_changed, 'comment');
- }
- $cache_key = "get_comments:$key:$last_changed";
+ $this->query_vars = wp_parse_args( $query_vars, $defaults );
+ do_action_ref_array( 'pre_get_comments', array( &$this ) );
+ extract( $this->query_vars, EXTR_SKIP );
- if ( $cache = wp_cache_get( $cache_key, 'comment' ) ) {
- return $cache;
- }
+ // $args can be whatever, only use the args defined in defaults to compute the key
+ $key = md5( serialize( compact(array_keys($defaults)) ) );
+ $last_changed = wp_cache_get('last_changed', 'comment');
+ if ( !$last_changed ) {
+ $last_changed = time();
+ wp_cache_set('last_changed', $last_changed, 'comment');
+ }
+ $cache_key = "get_comments:$key:$last_changed";
- $post_id = absint($post_id);
+ if ( $cache = wp_cache_get( $cache_key, 'comment' ) ) {
+ return $cache;
+ }
- if ( 'hold' == $status )
- $approved = "comment_approved = '0'";
- elseif ( 'approve' == $status )
- $approved = "comment_approved = '1'";
- elseif ( 'spam' == $status )
- $approved = "comment_approved = 'spam'";
- elseif ( 'trash' == $status )
- $approved = "comment_approved = 'trash'";
- else
- $approved = "( comment_approved = '0' OR comment_approved = '1' )";
-
- $order = ( 'ASC' == $order ) ? 'ASC' : 'DESC';
-
- if ( ! empty( $orderby ) ) {
- $ordersby = is_array($orderby) ? $orderby : preg_split('/[,\s]/', $orderby);
- $ordersby = array_intersect(
- $ordersby,
- array(
- 'comment_agent',
- 'comment_approved',
- 'comment_author',
- 'comment_author_email',
- 'comment_author_IP',
- 'comment_author_url',
- 'comment_content',
- 'comment_date',
- 'comment_date_gmt',
- 'comment_ID',
- 'comment_karma',
- 'comment_parent',
- 'comment_post_ID',
- 'comment_type',
- 'user_id',
- )
- );
- $orderby = empty( $ordersby ) ? 'comment_date_gmt' : implode(', ', $ordersby);
- } else {
- $orderby = 'comment_date_gmt';
- }
+ $post_id = absint($post_id);
+
+ if ( 'hold' == $status )
+ $approved = "comment_approved = '0'";
+ elseif ( 'approve' == $status )
+ $approved = "comment_approved = '1'";
+ elseif ( 'spam' == $status )
+ $approved = "comment_approved = 'spam'";
+ elseif ( 'trash' == $status )
+ $approved = "comment_approved = 'trash'";
+ else
+ $approved = "( comment_approved = '0' OR comment_approved = '1' )";
+
+ $order = ( 'ASC' == strtoupper($order) ) ? 'ASC' : 'DESC';
+
+ if ( ! empty( $orderby ) ) {
+ $ordersby = is_array($orderby) ? $orderby : preg_split('/[,\s]/', $orderby);
+ $ordersby = array_intersect(
+ $ordersby,
+ array(
+ 'comment_agent',
+ 'comment_approved',
+ 'comment_author',
+ 'comment_author_email',
+ 'comment_author_IP',
+ 'comment_author_url',
+ 'comment_content',
+ 'comment_date',
+ 'comment_date_gmt',
+ 'comment_ID',
+ 'comment_karma',
+ 'comment_parent',
+ 'comment_post_ID',
+ 'comment_type',
+ 'user_id',
+ )
+ );
+ $orderby = empty( $ordersby ) ? 'comment_date_gmt' : implode(', ', $ordersby);
+ } else {
+ $orderby = 'comment_date_gmt';
+ }
- $number = absint($number);
- $offset = absint($offset);
+ $number = absint($number);
+ $offset = absint($offset);
- if ( !empty($number) ) {
- if ( $offset )
- $number = 'LIMIT ' . $offset . ',' . $number;
+ if ( !empty($number) ) {
+ if ( $offset )
+ $limits = 'LIMIT ' . $offset . ',' . $number;
+ else
+ $limits = 'LIMIT ' . $number;
+ } else {
+ $limits = '';
+ }
+
+ if ( $count )
+ $fields = 'COUNT(*)';
else
- $number = 'LIMIT ' . $number;
+ $fields = '*';
+
+ $join = '';
+ $where = $approved;
+
+ if ( ! empty($post_id) )
+ $where .= $wpdb->prepare( ' AND comment_post_ID = %d', $post_id );
+ if ( '' !== $author_email )
+ $where .= $wpdb->prepare( ' AND comment_author_email = %s', $author_email );
+ if ( '' !== $karma )
+ $where .= $wpdb->prepare( ' AND comment_karma = %d', $karma );
+ if ( 'comment' == $type ) {
+ $where .= " AND comment_type = ''";
+ } elseif( 'pings' == $type ) {
+ $where .= ' AND comment_type IN ("pingback", "trackback")';
+ } elseif ( ! empty( $type ) ) {
+ $where .= $wpdb->prepare( ' AND comment_type = %s', $type );
+ }
+ if ( '' !== $parent )
+ $where .= $wpdb->prepare( ' AND comment_parent = %d', $parent );
+ if ( '' !== $user_id )
+ $where .= $wpdb->prepare( ' AND user_id = %d', $user_id );
+ if ( '' !== $search )
+ $where .= $this->get_search_sql( $search, array( 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_author_IP', 'comment_content' ) );
- } else {
- $number = '';
+ $pieces = array( 'fields', 'join', 'where', 'orderby', 'order', 'limits' );
+ $clauses = apply_filters_ref_array( 'comments_clauses', array( compact( $pieces ), &$this ) );
+ foreach ( $pieces as $piece )
+ $$piece = isset( $clauses[ $piece ] ) ? $clauses[ $piece ] : '';
+
+ $query = "SELECT $fields FROM $wpdb->comments $join WHERE $where ORDER BY $orderby $order $limits";
+
+ if ( $count )
+ return $wpdb->get_var( $query );
+
+ $comments = $wpdb->get_results( $query );
+ $comments = apply_filters_ref_array( 'the_comments', array( $comments, &$this ) );
+
+ wp_cache_add( $cache_key, $comments, 'comment' );
+
+ return $comments;
}
- $post_where = '';
-
- if ( ! empty($post_id) )
- $post_where .= $wpdb->prepare( 'comment_post_ID = %d AND ', $post_id );
- if ( '' !== $author_email )
- $post_where .= $wpdb->prepare( 'comment_author_email = %s AND ', $author_email );
- if ( '' !== $karma )
- $post_where .= $wpdb->prepare( 'comment_karma = %d AND ', $karma );
- if ( 'comment' == $type )
- $post_where .= "comment_type = '' AND ";
- elseif ( ! empty( $type ) )
- $post_where .= $wpdb->prepare( 'comment_type = %s AND ', $type );
- if ( '' !== $parent )
- $post_where .= $wpdb->prepare( 'comment_parent = %d AND ', $parent );
- if ( '' !== $user_id )
- $post_where .= $wpdb->prepare( 'user_id = %d AND ', $user_id );
-
- $comments = $wpdb->get_results( "SELECT * FROM $wpdb->comments WHERE $post_where $approved ORDER BY $orderby $order $number" );
- wp_cache_add( $cache_key, $comments, 'comment' );
-
- return $comments;
+ /*
+ * Used internally to generate an SQL string for searching across multiple columns
+ *
+ * @access protected
+ * @since 3.1.0
+ *
+ * @param string $string
+ * @param array $cols
+ * @return string
+ */
+ function get_search_sql( $string, $cols ) {
+ $string = esc_sql( like_escape( $string ) );
+
+ $searches = array();
+ foreach ( $cols as $col )
+ $searches[] = "$col LIKE '%$string%'";
+
+ return ' AND (' . implode(' OR ', $searches) . ')';
+ }
}
/**
@@ -422,8 +490,8 @@ function get_comment_count( $post_id = 0 ) {
* @link http://codex.wordpress.org/Function_Reference/add_comment_meta
*
* @param int $comment_id Comment ID.
- * @param string $key Metadata name.
- * @param mixed $value Metadata value.
+ * @param string $meta_key Metadata name.
+ * @param mixed $meta_value Metadata value.
* @param bool $unique Optional, default is false. Whether the same key should not be added.
* @return bool False for failure. True for success.
*/
@@ -481,8 +549,8 @@ function get_comment_meta($comment_id, $key, $single = false) {
* @link http://codex.wordpress.org/Function_Reference/update_comment_meta
*
* @param int $comment_id Comment ID.
- * @param string $key Metadata key.
- * @param mixed $value Metadata value.
+ * @param string $meta_key Metadata key.
+ * @param mixed $meta_value Metadata value.
* @param mixed $prev_value Optional. Previous value to check before removing.
* @return bool False on failure, true if success.
*/
@@ -571,7 +639,7 @@ function wp_allow_comment($commentdata) {
$approved = 'spam';
}
- $approved = apply_filters('pre_comment_approved', $approved);
+ $approved = apply_filters( 'pre_comment_approved', $approved, $commentdata );
return $approved;
}
@@ -1086,9 +1154,9 @@ function wp_transition_comment_status($new_status, $old_status, $comment) {
// Call the hooks
if ( $new_status != $old_status ) {
do_action('transition_comment_status', $new_status, $old_status, $comment);
- do_action("comment_${old_status}_to_$new_status", $comment);
+ do_action("comment_{$old_status}_to_{$new_status}", $comment);
}
- do_action("comment_${new_status}_$comment->comment_type", $comment->comment_ID, $comment);
+ do_action("comment_{$new_status}_{$comment->comment_type}", $comment->comment_ID, $comment);
}
/**
@@ -1118,7 +1186,7 @@ function wp_get_current_commenter() {
if ( isset($_COOKIE['comment_author_url_'.COOKIEHASH]) )
$comment_author_url = $_COOKIE['comment_author_url_'.COOKIEHASH];
- return compact('comment_author', 'comment_author_email', 'comment_author_url');
+ return apply_filters('wp_get_current_commenter', compact('comment_author', 'comment_author_email', 'comment_author_url'));
}
/**
@@ -1228,6 +1296,10 @@ function wp_throttle_comment_flood($block, $time_lastcomment, $time_newcomment)
* and whether comment is approved by WordPress. Also has 'preprocess_comment'
* filter for processing the comment data before the function handles it.
*
+ * We use REMOTE_ADDR here directly. If you are behind a proxy, you should ensure
+ * that it is properly set, such as in wp-config.php, for your environment.
+ * See {@link http://core.trac.wordpress.org/ticket/9235}
+ *
* @since 1.5.0
* @uses apply_filters() Calls 'preprocess_comment' hook on $commentdata parameter array before processing
* @uses do_action() Calls 'comment_post' hook on $comment_ID returned from adding the comment and if the comment was approved.
@@ -1272,7 +1344,7 @@ function wp_new_comment( $commentdata ) {
$post = &get_post($commentdata['comment_post_ID']); // Don't notify if it's your own comment
if ( get_option('comments_notify') && $commentdata['comment_approved'] && ( ! isset( $commentdata['user_id'] ) || $post->post_author != $commentdata['user_id'] ) )
- wp_notify_postauthor($comment_ID, empty( $commentdata['comment_type'] ) ? $commentdata['comment_type'] : '' );
+ wp_notify_postauthor($comment_ID, isset( $commentdata['comment_type'] ) ? $commentdata['comment_type'] : '' );
}
return $comment_ID;
@@ -1684,6 +1756,7 @@ function generic_ping($post_id = 0) {
function pingback($content, $post_ID) {
global $wp_version;
include_once(ABSPATH . WPINC . '/class-IXR.php');
+ include_once(ABSPATH . WPINC . '/class-wp-http-ixr-client.php');
// original code by Mort (http://mort.mine.nu:8080)
$post_links = array();
@@ -1717,7 +1790,7 @@ function pingback($content, $post_ID) {
if ( $test = @parse_url($link_test) ) {
if ( isset($test['query']) )
$post_links[] = $link_test;
- elseif ( ($test['path'] != '/') && ($test['path'] != '') )
+ elseif ( isset( $test['path'] ) && ( $test['path'] != '/' ) && ( $test['path'] != '' ) )
$post_links[] = $link_test;
}
endif;
@@ -1726,7 +1799,7 @@ function pingback($content, $post_ID) {
do_action_ref_array('pre_ping', array(&$post_links, &$pung));
foreach ( (array) $post_links as $pagelinkedto ) {
- $pingback_server_url = discover_pingback_server_uri($pagelinkedto, 2048);
+ $pingback_server_url = discover_pingback_server_uri( $pagelinkedto );
if ( $pingback_server_url ) {
@ set_time_limit( 60 );
@@ -1734,7 +1807,7 @@ function pingback($content, $post_ID) {
$pagelinkedfrom = get_permalink($post_ID);
// using a timeout of 3 seconds should be enough to cover slow servers
- $client = new IXR_Client($pingback_server_url);
+ $client = new WP_HTTP_IXR_Client($pingback_server_url);
$client->timeout = 3;
$client->useragent = apply_filters( 'pingback_useragent', $client->useragent . ' -- WordPress/' . $wp_version, $client->useragent, $pingback_server_url, $pagelinkedto, $pagelinkedfrom);
// when set to true, this outputs debug messages by itself
@@ -1795,9 +1868,8 @@ function trackback($trackback_url, $title, $excerpt, $ID) {
if ( is_wp_error( $response ) )
return;
- $tb_url = addslashes( $trackback_url );
- $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET pinged = CONCAT(pinged, '\n', '$tb_url') WHERE ID = %d", $ID) );
- return $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, '$tb_url', '')) WHERE ID = %d", $ID) );
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET pinged = CONCAT(pinged, '\n', %s) WHERE ID = %d", $trackback_url, $ID) );
+ return $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, %s, '')) WHERE ID = %d", $trackback_url, $ID) );
}
/**
@@ -1813,9 +1885,10 @@ function trackback($trackback_url, $title, $excerpt, $ID) {
function weblog_ping($server = '', $path = '') {
global $wp_version;
include_once(ABSPATH . WPINC . '/class-IXR.php');
+ include_once(ABSPATH . WPINC . '/class-wp-http-ixr-client.php');
// using a timeout of 3 seconds should be enough to cover slow servers
- $client = new IXR_Client($server, ((!strlen(trim($path)) || ('/' == $path)) ? false : $path));
+ $client = new WP_HTTP_IXR_Client($server, ((!strlen(trim($path)) || ('/' == $path)) ? false : $path));
$client->timeout = 3;
$client->useragent .= ' -- WordPress/'.$wp_version;
@@ -1837,11 +1910,13 @@ function weblog_ping($server = '', $path = '') {
* @package WordPress
* @subpackage Cache
*
- * @param int|array $id Comment ID or array of comment IDs to remove from cache
+ * @param int|array $ids Comment ID or array of comment IDs to remove from cache
*/
function clean_comment_cache($ids) {
foreach ( (array) $ids as $id )
wp_cache_delete($id, 'comment');
+
+ wp_cache_set('last_changed', time(), 'comment');
}
/**
diff --git a/wp-includes/cron.php b/wp-includes/cron.php
index 921f8c86..b7d04f2a 100644
--- a/wp-includes/cron.php
+++ b/wp-includes/cron.php
@@ -26,8 +26,16 @@ function wp_schedule_single_event( $timestamp, $hook, $args = array()) {
return;
$crons = _get_cron_array();
- $key = md5(serialize($args));
- $crons[$timestamp][$hook][$key] = array( 'schedule' => false, 'args' => $args );
+ $event = (object) array( 'hook' => $hook, 'timestamp' => $timestamp, 'schedule' => false, 'args' => $args );
+ $event = apply_filters('schedule_event', $event);
+
+ // A plugin disallowed this event
+ if ( ! $event )
+ return false;
+
+ $key = md5(serialize($event->args));
+
+ $crons[$event->timestamp][$event->hook][$key] = array( 'schedule' => $event->schedule, 'args' => $event->args );
uksort( $crons, "strnatcasecmp" );
_set_cron_array( $crons );
}
@@ -42,6 +50,8 @@ function wp_schedule_single_event( $timestamp, $hook, $args = array()) {
* Valid values for the recurrence are hourly, daily and twicedaily. These can
* be extended using the cron_schedules filter in wp_get_schedules().
*
+ * Use wp_next_scheduled() to prevent duplicates
+ *
* @since 2.1.0
*
* @param int $timestamp Timestamp for when to run the event.
@@ -53,10 +63,20 @@ function wp_schedule_single_event( $timestamp, $hook, $args = array()) {
function wp_schedule_event( $timestamp, $recurrence, $hook, $args = array()) {
$crons = _get_cron_array();
$schedules = wp_get_schedules();
- $key = md5(serialize($args));
+
if ( !isset( $schedules[$recurrence] ) )
return false;
- $crons[$timestamp][$hook][$key] = array( 'schedule' => $recurrence, 'args' => $args, 'interval' => $schedules[$recurrence]['interval'] );
+
+ $event = (object) array( 'hook' => $hook, 'timestamp' => $timestamp, 'schedule' => $recurrence, 'args' => $args, 'interval' => $schedules[$recurrence]['interval'] );
+ $event = apply_filters('schedule_event', $event);
+
+ // A plugin disallowed this event
+ if ( ! $event )
+ return false;
+
+ $key = md5(serialize($event->args));
+
+ $crons[$event->timestamp][$event->hook][$key] = array( 'schedule' => $event->schedule, 'args' => $event->args, 'interval' => $event->interval );
uksort( $crons, "strnatcasecmp" );
_set_cron_array( $crons );
}
@@ -90,10 +110,10 @@ function wp_reschedule_event( $timestamp, $recurrence, $hook, $args = array()) {
$now = time();
- if ( $timestamp >= $now )
- $timestamp = $now + $interval;
- else
- $timestamp = $now + ($interval - (($now - $timestamp) % $interval));
+ if ( $timestamp >= $now )
+ $timestamp = $now + $interval;
+ else
+ $timestamp = $now + ($interval - (($now - $timestamp) % $interval));
wp_schedule_event( $timestamp, $recurrence, $hook, $args );
}
@@ -136,7 +156,7 @@ function wp_clear_scheduled_hook( $hook, $args = array() ) {
// Backward compatibility
// Previously this function took the arguments as discrete vars rather than an array like the rest of the API
if ( !is_array($args) ) {
- _deprecated_argument( __FUNCTION__, '3.0.0', __('This argument has changed to an array to match the behavior of the other cron functions.') );
+ _deprecated_argument( __FUNCTION__, '3.0', __('This argument has changed to an array to match the behavior of the other cron functions.') );
$args = array_slice( func_get_args(), 1 );
}
@@ -180,14 +200,6 @@ function spawn_cron( $local_time = 0 ) {
if ( defined('DOING_CRON') || isset($_GET['doing_wp_cron']) )
return;
- /*
- * do not even start the cron if local server timer has drifted
- * such as due to power failure, or misconfiguration
- */
- $timer_accurate = check_server_timer( $local_time );
- if ( !$timer_accurate )
- return;
-
/*
* multiple processes on multiple web servers can run this code concurrently
* try to make this as atomic as possible by setting doing_cron switch
@@ -393,8 +405,3 @@ function _upgrade_cron_array($cron) {
update_option( 'cron', $new_cron );
return $new_cron;
}
-
-// stub for checking server timer accuracy, using outside standard time sources
-function check_server_timer( $local_time ) {
- return true;
-}
diff --git a/wp-includes/css/admin-bar-rtl.css b/wp-includes/css/admin-bar-rtl.css
new file mode 100644
index 00000000..5684c095
--- /dev/null
+++ b/wp-includes/css/admin-bar-rtl.css
@@ -0,0 +1 @@
+#wpadminbar{direction:rtl;font-family:Tahoma,Arial,sans-serif;right:0;left:auto;}#wpadminbar .quicklinks ul{text-align:right;}#wpadminbar .quicklinks ul li{float:right;}#wpadminbar .quicklinks>ul>li>a{border-left:1px solid #686868;border-right:1px solid #808080;}#wpadminbar .quicklinks>ul>li:last-child>a{border-left:none;border-right:1px solid #808080;}#wpadminbar .quicklinks>ul>li:hover>a{border-right-color:#707070;border-left-color:#686868;}#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar a img{margin:-2px -5px 0 23px;}#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar ul{left:auto;right:30px;}#wpadminbar .quicklinks .menupop li:hover>ul,#wpadminbar .quicklinks .menupop li.hover>ul{margin-right:100%;margin-left:0;}#wpadminbar .quicklinks .menupop a>span{background:url(../images/admin-bar-sprite-rtl.png?d=11122010) left -58px no-repeat;padding-right:0;padding-left:.8em;}#wpadminbar .quicklinks .menupop ul li a>span{background:url(../images/admin-bar-sprite-rtl.png?d=11122010) left -29px no-repeat;padding-right:0;padding-left:1.5em;}#wpadminbar .quicklinks a{font-family:Tahoma,Arial,Helvetica,sans-serif;}#wpadminbar .quicklinks .menupop li a img.blavatar{margin-right:0;margin-left:8px;}#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar>a{background:url(../images/admin-bar-sprite-rtl.png?d=11122010) top right no-repeat;}#wpadminbar .quicklinks li#wp-admin-bar-my-account>a,#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar>a{border-right:none;border-left:1px solid #686868;}#wpadminbar #adminbarsearch{float:left;}#wpadminbar #adminbarsearch .adminbar-input{float:right;font-family:Tahoma,Arial,Helvetica,sans-serif;margin-right:0;margin-left:3px;-moz-box-shadow:inset 2px -2px 1px #cdcdcd;-webkit-box-shadow:inset -2px 2px 1px #cdcdcd;box-shadow:inset 2px -2px 1px #cdcdcd;}#wpadminbar #adminbarsearch .adminbar-button{float:right;font-family:Tahoma,Arial,Helvetica,sans-serif;}
\ No newline at end of file
diff --git a/wp-includes/css/admin-bar-rtl.dev.css b/wp-includes/css/admin-bar-rtl.dev.css
new file mode 100644
index 00000000..acfe0452
--- /dev/null
+++ b/wp-includes/css/admin-bar-rtl.dev.css
@@ -0,0 +1,94 @@
+#wpadminbar {
+ direction: rtl;
+ font-family: Tahoma, Arial ,sans-serif;
+ right: 0;
+ left: auto;
+}
+
+#wpadminbar .quicklinks ul {
+ text-align: right;
+}
+
+#wpadminbar .quicklinks ul li {
+ float: right;
+}
+
+#wpadminbar .quicklinks > ul > li > a {
+ border-left: 1px solid #686868;
+ border-right: 1px solid #808080;
+}
+
+#wpadminbar .quicklinks > ul > li:last-child > a {
+ border-left: none;
+ border-right: 1px solid #808080;
+}
+
+#wpadminbar .quicklinks > ul > li:hover > a {
+ border-right-color: #707070;
+ border-left-color: #686868;
+}
+
+#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar a img {
+ margin: -2px -5px 0 23px;
+}
+
+#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar ul {
+ left: auto;
+ right: 30px;
+}
+
+#wpadminbar .quicklinks .menupop li:hover > ul,
+#wpadminbar .quicklinks .menupop li.hover > ul {
+ margin-right: 100%;
+ margin-left: 0;
+}
+
+#wpadminbar .quicklinks .menupop a > span {
+ background: url(../images/admin-bar-sprite-rtl.png?d=11122010) left -58px no-repeat;
+ padding-right: 0;
+ padding-left: .8em;
+}
+
+#wpadminbar .quicklinks .menupop ul li a > span {
+ background: url(../images/admin-bar-sprite-rtl.png?d=11122010) left -29px no-repeat;
+ padding-right: 0;
+ padding-left: 1.5em;
+}
+
+#wpadminbar .quicklinks a {
+ font-family: Tahoma, Arial, Helvetica, sans-serif;
+}
+
+#wpadminbar .quicklinks .menupop li a img.blavatar {
+ margin-right: 0;
+ margin-left: 8px;
+}
+
+#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar > a {
+ background: url(../images/admin-bar-sprite-rtl.png?d=11122010) top right no-repeat;
+}
+
+#wpadminbar .quicklinks li#wp-admin-bar-my-account > a,
+#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar > a {
+ border-right: none;
+ border-left: 1px solid #686868;
+}
+
+#wpadminbar #adminbarsearch {
+ float: left;
+}
+
+#wpadminbar #adminbarsearch .adminbar-input {
+ float: right;
+ font-family: Tahoma, Arial, Helvetica, sans-serif;
+ margin-right: 0;
+ margin-left: 3px;
+ -moz-box-shadow: inset 2px -2px 1px #cdcdcd;
+ -webkit-box-shadow: inset -2px 2px 1px #cdcdcd;
+ box-shadow: inset 2px -2px 1px #cdcdcd;
+}
+
+#wpadminbar #adminbarsearch .adminbar-button {
+ float: right;
+ font-family: Tahoma, Arial, Helvetica, sans-serif;
+}
diff --git a/wp-includes/css/admin-bar.css b/wp-includes/css/admin-bar.css
new file mode 100644
index 00000000..2de4f4d9
--- /dev/null
+++ b/wp-includes/css/admin-bar.css
@@ -0,0 +1 @@
+#wpadminbar *{height:auto;width:auto;margin:0;padding:0;position:static;text-transform:none;letter-spacing:normal;line-height:1;}#wpadminbar :before,#wpadminbar :after{content:normal;}#wpadminbar a,#wpadminbar a:hover,#wpadminbar a img,#wpadminbar a img:hover{outline:none;border:none;text-decoration:none;background:none;}#wpadminbar{direction:ltr;background-color:#777;background-image:-moz-linear-gradient(bottom,#666,#7f7f7f);background-image:-webkit-gradient(linear,left bottom,left top,from(#666),to(#7f7f7f));color:#ddd;font:normal 12px/28px Arial,Helvetica,sans-serif;height:28px;position:fixed;top:0;left:0;width:100%;z-index:99999;min-width:960px;}#wpadminbar ul,#wpadminbar ul li{background:none;list-style:none;margin:0;padding:0;position:relative;z-index:99999;}#wpadminbar .quicklinks ul{text-align:left;}#wpadminbar .quicklinks ul li{float:left;}#wpadminbar .quicklinks>ul>li>a{border-right:1px solid #686868;border-left:1px solid #808080;}#wpadminbar .quicklinks>ul>li:last-child>a{border-right:none;}#wpadminbar .quicklinks>ul>li:hover>a{border-left-color:#707070;}#wpadminbar .quicklinks a,#wpadminbar .shortlink-input{color:#ddd;height:28px;text-shadow:#555 0 -1px 0;display:block;font:normal 13px/28px Arial,Helvetica,sans-serif;padding:0 .85em;margin:0;}#wpadminbar .quicklinks a>span{line-height:28px;}#wpadminbar .quicklinks .menupop ul,#wpadminbar .shortlink-input{-moz-box-shadow:0 4px 8px rgba(0,0,0,0.1);-webkit-box-shadow:0 4px 8px rgba(0,0,0,0.1);box-shadow:0 4px 8px rgba(0,0,0,0.1);background:#fff;background:rgba(255,255,255,0.97);display:none;position:absolute;border:1px solid #dfdfdf;border-top:none;float:none;}#wpadminbar .selected .shortlink-input{display:block;}#wpadminbar .quicklinks .menupop ul li{float:none;}#wpadminbar .quicklinks .menupop ul li a,#wpadminbar .shortlink-input{color:#555;text-shadow:none;white-space:nowrap;min-width:140px;}#wpadminbar .shortlink-input{width:200px;}#wpadminbar .quicklinks .menupop ul li:hover>a{color:#fff;text-shadow:#666 0 -1px 0;}#wpadminbar .quicklinks li:hover>ul,#wpadminbar .quicklinks li.hover>ul{display:block;}#wpadminbar .quicklinks .menupop li:hover>ul,#wpadminbar .quicklinks .menupop li.hover>ul{margin-left:100%;margin-top:-28px;}#wpadminbar .quicklinks li:hover,#wpadminbar .quicklinks .selected{background:#555;background:-moz-linear-gradient(bottom,#555,#3e3e3e);background:-webkit-gradient(linear,left bottom,left top,from(#555),to(#3e3e3e));}#wpadminbar .quicklinks .menupop li:hover{background:#888;background:-moz-linear-gradient(bottom,#888,#9d9d9d);background:-webkit-gradient(linear,left bottom,left top,from(#888),to(#9d9d9d));}#wpadminbar .quicklinks .menupop a>span{display:inline;background:url(../images/admin-bar-sprite.png?d=11122010) right -58px no-repeat;padding-right:.8em;}#wpadminbar .quicklinks .menupop ul li a>span{display:block;background:url(../images/admin-bar-sprite.png?d=11122010) right -29px no-repeat;padding-right:1.5em;}#wpadminbar .quicklinks a span#ab-awaiting-mod,#wpadminbar .quicklinks a span#ab-updates{background:#eee;color:#333;text-shadow:none;display:inline;padding:2px 5px;font-size:10px;font-weight:bold;-moz-border-radius:10px;-khtml-border-radius:10px;-webkit-border-radius:10px;border-radius:10px;}#wpadminbar .quicklinks a:hover span#ab-awaiting-mod,#wpadminbar .quicklinks a:hover span#ab-updates{background:#fff;color:#000;}#wpadminbar .quicklinks li#wp-admin-bar-my-account>a{border-left:none;}#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar>a{border-left:none;background:url(../images/admin-bar-sprite.png?d=11122010) top left no-repeat;}#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar>a img{display:inline;border:1px solid #999;vertical-align:middle;margin:-2px 23px 0 -5px;padding:0;background:#eee;float:none;}#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar ul{left:30px;}#wpadminbar .quicklinks .menupop li a img.blavatar{vertical-align:middle;margin:0 8px 0 0;padding:0;}#wpadminbar #adminbarsearch{float:right;height:18px;padding:3px;margin:0;}#wpadminbar #adminbarsearch .adminbar-input{width:140px;height:auto;float:left;font:12px Arial,Helvetica,sans-serif;color:#555;text-shadow:0 1px 0 #fff;border:1px solid #626262;padding:2px 3px;margin:0 3px 0 0;background:#ddd;-moz-box-shadow:inset 2px 2px 1px #cdcdcd;-webkit-box-shadow:inset 2px 2px 1px #cdcdcd;box-shadow:inset 2px 2px 1px #cdcdcd;-webkit-border-radius:0;-khtml-border-radius:0;-moz-border-radius:0;border-radius:0;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box;outline:none;}#wpadminbar #adminbarsearch .adminbar-button{font:bold 12px Arial,Helvetica,sans-serif;color:#444;text-shadow:0 1px 0 #eee;cursor:pointer;float:left;background:#aaa;background:-moz-linear-gradient(bottom,#aaa,#cecece);background:-webkit-gradient(linear,left bottom,left top,from(#aaa),to(#cecece));-webkit-border-radius:10px;-khtml-border-radius:10px;-moz-border-radius:10px;border-radius:10px;border:1px solid #626262;padding:2px 13px;margin:0;width:auto;height:auto;}#wpadminbar #adminbarsearch .adminbar-button:active{background:#a0a0a0;background:-moz-linear-gradient(bottom,#a0a0a0,#c1c1c1);background:-webkit-gradient(linear,left bottom,left top,from(#a0a0a0),to(#c1c1c1));-moz-box-shadow:inset 1px 1px 1px #9b9b9b;-webkit-box-shadow:inset 1px 1px 1px #9b9b9b;box-shadow:inset 1px 1px 1px #9b9b9b;}#wpadminbar #adminbarsearch .adminbar-button:hover{color:#000;}#wpadminbar #adminbarsearch .adminbar-button::-moz-focus-inner{border:none;}* html #wpadminbar{overflow:hidden;position:absolute;}* html #wpadminbar .quicklinks ul li a{float:left;}* html #wpadminbar .menupop a span{background-image:none;}
\ No newline at end of file
diff --git a/wp-includes/css/admin-bar.dev.css b/wp-includes/css/admin-bar.dev.css
new file mode 100644
index 00000000..865f4d66
--- /dev/null
+++ b/wp-includes/css/admin-bar.dev.css
@@ -0,0 +1,298 @@
+#wpadminbar * {
+ height: auto;
+ width: auto;
+ margin: 0;
+ padding: 0;
+ position: static;
+ text-transform: none;
+ letter-spacing: normal;
+ line-height: 1;
+}
+
+#wpadminbar :before,
+#wpadminbar :after {
+ content: normal;
+}
+
+#wpadminbar a,
+#wpadminbar a:hover,
+#wpadminbar a img,
+#wpadminbar a img:hover {
+ outline: none;
+ border: none;
+ text-decoration: none;
+ background: none;
+}
+
+#wpadminbar {
+ direction: ltr;
+ background-color: #777;
+ background-image: -moz-linear-gradient(bottom, #666, #7f7f7f);
+ background-image: -webkit-gradient(linear, left bottom, left top, from(#666), to(#7f7f7f));
+ color: #ddd;
+ font: normal 12px/28px Arial, Helvetica, sans-serif;
+ height: 28px;
+ position: fixed;
+ top: 0;
+ left: 0;
+ width: 100%;
+ z-index: 99999;
+ min-width: 960px;
+}
+
+#wpadminbar ul,
+#wpadminbar ul li {
+ background: none;
+ list-style: none;
+ margin: 0;
+ padding: 0;
+ position: relative;
+ z-index: 99999;
+}
+
+#wpadminbar .quicklinks ul {
+ text-align: left;
+}
+
+#wpadminbar .quicklinks ul li {
+ float: left;
+}
+
+#wpadminbar .quicklinks > ul > li > a {
+ border-right: 1px solid #686868;
+ border-left: 1px solid #808080;
+}
+
+#wpadminbar .quicklinks > ul > li:last-child > a {
+ border-right: none;
+}
+
+#wpadminbar .quicklinks > ul > li:hover > a {
+ border-left-color: #707070;
+}
+
+#wpadminbar .quicklinks a,
+#wpadminbar .shortlink-input {
+ color: #ddd;
+ height: 28px;
+ text-shadow: #555 0px -1px 0px;
+ display: block;
+ font: normal 13px/28px Arial, Helvetica, sans-serif;
+ padding: 0 0.85em;
+ margin: 0;
+}
+
+#wpadminbar .quicklinks a > span {
+ line-height: 28px;
+}
+
+#wpadminbar .quicklinks .menupop ul,
+#wpadminbar .shortlink-input {
+ -moz-box-shadow: 0 4px 8px rgba(0,0,0,0.1);
+ -webkit-box-shadow: 0 4px 8px rgba(0,0,0,0.1);
+ box-shadow: 0 4px 8px rgba(0,0,0,0.1);
+ background: #fff;
+ background: rgba(255,255,255,0.97);
+ display: none;
+ position: absolute;
+ border: 1px solid #dfdfdf;
+ border-top: none;
+ float: none;
+}
+
+#wpadminbar .selected .shortlink-input {
+ display: block;
+}
+
+#wpadminbar .quicklinks .menupop ul li {
+ float: none;
+}
+
+#wpadminbar .quicklinks .menupop ul li a,
+#wpadminbar .shortlink-input {
+ color: #555;
+ text-shadow: none;
+ white-space: nowrap;
+ min-width: 140px;
+}
+
+#wpadminbar .shortlink-input {
+ width: 200px;
+}
+
+#wpadminbar .quicklinks .menupop ul li:hover > a {
+ color: #fff;
+ text-shadow: #666 0px -1px 0px;
+}
+
+#wpadminbar .quicklinks li:hover > ul,
+#wpadminbar .quicklinks li.hover > ul {
+ display: block;
+}
+
+#wpadminbar .quicklinks .menupop li:hover > ul,
+#wpadminbar .quicklinks .menupop li.hover > ul {
+ margin-left: 100%;
+ margin-top: -28px;
+}
+
+#wpadminbar .quicklinks li:hover,
+#wpadminbar .quicklinks .selected {
+ background: #555;
+ background: -moz-linear-gradient(bottom, #555, #3e3e3e);
+ background: -webkit-gradient(linear, left bottom, left top, from(#555), to(#3e3e3e));
+}
+
+#wpadminbar .quicklinks .menupop li:hover {
+ background: #888;
+ background: -moz-linear-gradient(bottom, #888, #9d9d9d);
+ background: -webkit-gradient(linear, left bottom, left top, from(#888), to(#9d9d9d));
+}
+
+#wpadminbar .quicklinks .menupop a > span {
+ display: inline;
+ background: url(../images/admin-bar-sprite.png?d=11122010) right -58px no-repeat;
+ padding-right: .8em;
+}
+
+#wpadminbar .quicklinks .menupop ul li a > span {
+ display: block;
+ background: url(../images/admin-bar-sprite.png?d=11122010) right -29px no-repeat;
+ padding-right: 1.5em;
+}
+
+#wpadminbar .quicklinks a span#ab-awaiting-mod,
+#wpadminbar .quicklinks a span#ab-updates {
+ background: #eee;
+ color: #333;
+ text-shadow: none;
+ display: inline;
+ padding: 2px 5px;
+ font-size: 10px;
+ font-weight: bold;
+ -moz-border-radius: 10px;
+ -khtml-border-radius: 10px;
+ -webkit-border-radius: 10px;
+ border-radius: 10px;
+}
+
+#wpadminbar .quicklinks a:hover span#ab-awaiting-mod,
+#wpadminbar .quicklinks a:hover span#ab-updates {
+ background: #fff;
+ color: #000;
+}
+
+#wpadminbar .quicklinks li#wp-admin-bar-my-account > a {
+ border-left: none;
+}
+
+#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar > a {
+ border-left: none;
+ background: url(../images/admin-bar-sprite.png?d=11122010) top left no-repeat;
+}
+
+#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar > a img {
+ display: inline;
+ border: 1px solid #999;
+ vertical-align: middle;
+ margin: -2px 23px 0 -5px;
+ padding: 0;
+ background: #eee;
+ float: none;
+}
+
+#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar ul {
+ left: 30px;
+}
+
+#wpadminbar .quicklinks .menupop li a img.blavatar {
+ vertical-align: middle;
+ margin: 0 8px 0 0;
+ padding: 0;
+}
+
+#wpadminbar #adminbarsearch {
+ float: right;
+ height: 18px;
+ padding: 3px;
+ margin: 0;
+}
+
+#wpadminbar #adminbarsearch .adminbar-input {
+ width: 140px;
+ height: auto;
+ float: left;
+ font: 12px Arial, Helvetica, sans-serif;
+ color: #555;
+ text-shadow: 0 1px 0 #fff;
+ border: 1px solid #626262;
+ padding: 2px 3px;
+ margin: 0 3px 0 0;
+ background: #ddd;
+ -moz-box-shadow: inset 2px 2px 1px #cdcdcd;
+ -webkit-box-shadow: inset 2px 2px 1px #cdcdcd;
+ box-shadow: inset 2px 2px 1px #cdcdcd;
+ -webkit-border-radius: 0;
+ -khtml-border-radius: 0;
+ -moz-border-radius: 0;
+ border-radius: 0;
+ -moz-box-sizing: border-box;
+ -webkit-box-sizing: border-box;
+ -ms-box-sizing: border-box;
+ box-sizing: border-box;
+ outline: none;
+}
+
+#wpadminbar #adminbarsearch .adminbar-button {
+ font: bold 12px Arial, Helvetica, sans-serif;
+ color: #444;
+ text-shadow: 0px 1px 0px #eee;
+ cursor: pointer;
+ float: left;
+ background: #aaa;
+ background: -moz-linear-gradient(bottom, #aaa, #cecece);
+ background: -webkit-gradient(linear, left bottom, left top, from(#aaa), to(#cecece));
+ -webkit-border-radius: 10px;
+ -khtml-border-radius: 10px;
+ -moz-border-radius: 10px;
+ border-radius: 10px;
+ border: 1px solid #626262;
+ padding: 2px 13px;
+ margin: 0;
+ width: auto;
+ height: auto;
+}
+
+#wpadminbar #adminbarsearch .adminbar-button:active {
+ background: #a0a0a0;
+ background:-moz-linear-gradient(bottom, #a0a0a0, #c1c1c1);
+ background:-webkit-gradient(linear, left bottom, left top, from(#a0a0a0), to(#c1c1c1));
+ -moz-box-shadow: inset 1px 1px 1px #9b9b9b;
+ -webkit-box-shadow: inset 1px 1px 1px #9b9b9b;
+ box-shadow: inset 1px 1px 1px #9b9b9b;
+}
+
+#wpadminbar #adminbarsearch .adminbar-button:hover {
+ color: #000;
+}
+
+#wpadminbar #adminbarsearch .adminbar-button::-moz-focus-inner {
+ border: none;
+}
+
+
+/**
+ * IE 6-targeted rules
+ */
+* html #wpadminbar {
+ overflow: hidden;
+ position: absolute;
+}
+
+* html #wpadminbar .quicklinks ul li a {
+ float: left;
+}
+
+* html #wpadminbar .menupop a span {
+ background-image: none;
+}
diff --git a/wp-includes/css/jquery-ui-dialog.css b/wp-includes/css/jquery-ui-dialog.css
new file mode 100644
index 00000000..fa51cfbd
--- /dev/null
+++ b/wp-includes/css/jquery-ui-dialog.css
@@ -0,0 +1 @@
+.ui-helper-hidden{display:none;}.ui-helper-hidden-accessible{position:absolute;left:-99999999px;}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none;}.ui-helper-clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden;}.ui-helper-clearfix{display:inline-block;}/* required comment for clearfix to work in Opera \*/ * html .ui-helper-clearfix{height:1%;}.ui-helper-clearfix{display:block;}/* end clearfix */ .ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0);}.ui-state-disabled{cursor:default!important;}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat;}.ui-widget-overlay{position:absolute;top:0;left:0;width:100%;height:100%;}.ui-resizable{position:relative;}.ui-resizable-handle{position:absolute;font-size:.1px;z-index:99999;display:block;}.ui-resizable-disabled .ui-resizable-handle,.ui-resizable-autohide .ui-resizable-handle{display:none;}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0;}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0;}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%;}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%;}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px;}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px;}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px;}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px;}.wp-dialog{position:absolute;width:300px;overflow:hidden;}.wp-dialog .ui-dialog-titlebar{position:relative;}.wp-dialog .ui-dialog-titlebar-close span{display:block;margin:1px;}.wp-dialog .ui-dialog-content{position:relative;border:0;padding:0;background:none;overflow:auto;zoom:1;}.wp-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin:.5em 0 0 0;padding:.3em 1em .5em .4em;}.wp-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right;}.wp-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer;}.wp-dialog .ui-resizable-se{width:14px;height:14px;right:3px;bottom:3px;}.ui-draggable .ui-dialog-titlebar{cursor:move;}.wp-dialog{border:1px solid #999;-moz-box-shadow:0 0 16px rgba(0,0,0,0.3);-webkit-box-shadow:0 0 16px rgba(0,0,0,0.3);box-shadow:0 0 16px rgba(0,0,0,0.3);}.wp-dialog .ui-dialog-title{display:block;text-align:center;padding:1px 0 2px;}.wp-dialog .ui-dialog-titlebar{padding:0 1em;background-color:#444;font-weight:bold;font-size:11px;line-height:18px;color:#e5e5e5;}.wp-dialog{-moz-border-radius-topleft:4px;-webkit-border-top-left-radius:4px;-khtml-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-topright:4px;-webkit-border-top-right-radius:4px;-khtml-border-top-right-radius:4px;border-top-right-radius:4px;}.wp-dialog .ui-dialog-titlebar{-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-radius-topright:3px;-webkit-border-top-right-radius:3px;-khtml-border-top-right-radius:3px;border-top-right-radius:3px;}.wp-dialog .ui-dialog-titlebar-close{position:absolute;width:29px;height:16px;top:2px;right:6px;background:url('../js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif') no-repeat -87px -16px;padding:0;}.wp-dialog .ui-dialog-titlebar-close:hover,.wp-dialog .ui-dialog-titlebar-close:focus{background-position:-87px -32px;}.ui-widget-overlay{background-color:#000;opacity:.6;filter:alpha(opacity=60);}
\ No newline at end of file
diff --git a/wp-includes/css/jquery-ui-dialog.dev.css b/wp-includes/css/jquery-ui-dialog.dev.css
new file mode 100644
index 00000000..b5a0675b
--- /dev/null
+++ b/wp-includes/css/jquery-ui-dialog.dev.css
@@ -0,0 +1,143 @@
+/*
+ * jQuery UI CSS Framework @VERSION
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Theming/API
+ */
+
+/* Layout helpers
+----------------------------------*/
+.ui-helper-hidden { display: none; }
+.ui-helper-hidden-accessible { position: absolute; left: -99999999px; }
+.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
+.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
+.ui-helper-clearfix { display: inline-block; }
+/* required comment for clearfix to work in Opera \*/
+* html .ui-helper-clearfix { height:1%; }
+.ui-helper-clearfix { display:block; }
+/* end clearfix */
+.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
+
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-disabled { cursor: default !important; }
+
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Overlays */
+.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
+
+/*
+ * jQuery UI Resizable
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Resizable#theming
+ */
+.ui-resizable { position: relative;}
+.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;}
+.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
+.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
+.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
+.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
+.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
+.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
+.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
+.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
+.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}
+
+/*
+ * jQuery UI Dialog
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Dialog#theming
+ */
+.wp-dialog { position: absolute; width: 300px; overflow: hidden; }
+.wp-dialog .ui-dialog-titlebar { position: relative; }
+.wp-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
+.wp-dialog .ui-dialog-content { position: relative; border: 0; padding: 0; background: none; overflow: auto; zoom: 1; }
+.wp-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
+.wp-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
+.wp-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
+.wp-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
+.ui-draggable .ui-dialog-titlebar { cursor: move; }
+
+
+
+/* WP jQuery Dialog Theme */
+.wp-dialog {
+ border: 1px solid #999;
+ -moz-box-shadow: 0px 0px 16px rgba( 0,0,0,0.3 );
+ -webkit-box-shadow: 0px 0px 16px rgba( 0,0,0,0.3 );
+ box-shadow: 0px 0px 16px rgba( 0,0,0,0.3 );
+}
+.wp-dialog .ui-dialog-title {
+ display: block;
+ text-align: center;
+ padding: 1px 0 2px;
+}
+.wp-dialog .ui-dialog-titlebar {
+ padding: 0 1em;
+ background-color: #444;
+ font-weight: bold;
+ font-size: 11px;
+ line-height: 18px;
+ color: #e5e5e5;
+}
+.wp-dialog {
+ -moz-border-radius-topleft: 4px;
+ -webkit-border-top-left-radius: 4px;
+ -khtml-border-top-left-radius: 4px;
+ border-top-left-radius: 4px;
+ -moz-border-radius-topright: 4px;
+ -webkit-border-top-right-radius: 4px;
+ -khtml-border-top-right-radius: 4px;
+ border-top-right-radius: 4px;
+}
+.wp-dialog .ui-dialog-titlebar {
+ -moz-border-radius-topleft: 3px;
+ -webkit-border-top-left-radius: 3px;
+ -khtml-border-top-left-radius: 3px;
+ border-top-left-radius: 3px;
+ -moz-border-radius-topright: 3px;
+ -webkit-border-top-right-radius: 3px;
+ -khtml-border-top-right-radius: 3px;
+ border-top-right-radius: 3px;
+}
+
+.wp-dialog .ui-dialog-titlebar-close {
+ position: absolute;
+ width: 29px;
+ height: 16px;
+ top: 2px;
+ right: 6px;
+ background: url('../js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif') no-repeat -87px -16px;
+ padding: 0;
+}
+.wp-dialog .ui-dialog-titlebar-close:hover,
+.wp-dialog .ui-dialog-titlebar-close:focus {
+ background-position: -87px -32px;
+}
+.ui-widget-overlay {
+ background-color: #000;
+ opacity: 0.6;
+ filter: alpha(opacity=60);
+}
\ No newline at end of file
diff --git a/wp-includes/default-embeds.php b/wp-includes/default-embeds.php
index 1283c1e2..ca599445 100644
--- a/wp-includes/default-embeds.php
+++ b/wp-includes/default-embeds.php
@@ -28,7 +28,7 @@ function wp_embed_handler_googlevideo( $matches, $attr, $url, $rawattr ) {
list( $width, $height ) = wp_expand_dimensions( 425, 344, $attr['width'], $attr['height'] );
}
- return apply_filters( 'embed_googlevideo', ' ', $matches, $attr, $url, $rawattr );
+ return apply_filters( 'embed_googlevideo', ' ', $matches, $attr, $url, $rawattr );
}
wp_embed_register_handler( 'googlevideo', '#http://video\.google\.([A-Za-z.]{2,5})/videoplay\?docid=([\d-]+)(.*?)#i', 'wp_embed_handler_googlevideo' );
diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php
index 8898864e..4822e2ea 100644
--- a/wp-includes/default-filters.php
+++ b/wp-includes/default-filters.php
@@ -21,8 +21,11 @@ foreach ( array( 'pre_term_name', 'pre_comment_author_name', 'pre_link_name', 'p
// Strip, kses, special chars for string display
foreach ( array( 'term_name', 'comment_author_name', 'link_name', 'link_target', 'link_rel', 'user_display_name', 'user_first_name', 'user_last_name', 'user_nickname' ) as $filter ) {
- add_filter( $filter, 'sanitize_text_field' );
- add_filter( $filter, 'wp_kses_data' );
+ if ( is_admin() ) {
+ // These are expensive. Run only on admin pages for defense in depth.
+ add_filter( $filter, 'sanitize_text_field' );
+ add_filter( $filter, 'wp_kses_data' );
+ }
add_filter( $filter, '_wp_specialchars', 30 );
}
@@ -32,11 +35,12 @@ foreach ( array( 'pre_term_description', 'pre_link_description', 'pre_link_notes
}
// Kses only for textarea admin displays
-foreach ( array( 'term_description', 'link_description', 'link_notes', 'user_description' ) as $filter ) {
- add_filter( $filter, 'wp_kses_data' );
-}
-if ( is_admin() )
+if ( is_admin() ) {
+ foreach ( array( 'term_description', 'link_description', 'link_notes', 'user_description' ) as $filter ) {
+ add_filter( $filter, 'wp_kses_data' );
+ }
add_filter( 'comment_text', 'wp_kses_post' );
+}
// Email saves
foreach ( array( 'pre_comment_author_email', 'pre_user_email' ) as $filter ) {
@@ -45,10 +49,11 @@ foreach ( array( 'pre_comment_author_email', 'pre_user_email' ) as $filter ) {
add_filter( $filter, 'wp_filter_kses' );
}
-// Email display
+// Email admin display
foreach ( array( 'comment_author_email', 'user_email' ) as $filter ) {
add_filter( $filter, 'sanitize_email' );
- add_filter( $filter, 'wp_kses_data' );
+ if ( is_admin() )
+ add_filter( $filter, 'wp_kses_data' );
}
// Save URL
@@ -61,9 +66,11 @@ foreach ( array( 'pre_comment_author_url', 'pre_user_url', 'pre_link_url', 'pre_
// Display URL
foreach ( array( 'user_url', 'link_url', 'link_image', 'link_rss', 'comment_url' ) as $filter ) {
- add_filter( $filter, 'wp_strip_all_tags' );
+ if ( is_admin() )
+ add_filter( $filter, 'wp_strip_all_tags' );
add_filter( $filter, 'esc_url' );
- add_filter( $filter, 'wp_kses_data' );
+ if ( is_admin() )
+ add_filter( $filter, 'wp_kses_data' );
}
// Slugs
@@ -92,8 +99,9 @@ foreach ( array( 'comment_author', 'term_name', 'link_name', 'link_description',
}
// Format WordPress
-foreach ( array( 'the_content', 'the_title', 'comment_text' ) as $filter )
+foreach ( array( 'the_content', 'the_title' ) as $filter )
add_filter( $filter, 'capital_P_dangit', 11 );
+add_filter( 'comment_text', 'capital_P_dangit', 31 );
// Format titles
foreach ( array( 'single_post_title', 'single_cat_title', 'single_tag_title', 'single_month_title', 'nav_menu_attr_title', 'nav_menu_description' ) as $filter ) {
@@ -114,6 +122,10 @@ foreach ( array( 'term_name_rss' ) as $filter ) {
add_filter( $filter, 'convert_chars' );
}
+// Pre save hierarchy
+add_filter( 'wp_insert_post_parent', 'wp_check_post_hierarchy_for_loops', 10, 2 );
+add_filter( 'wp_update_term_parent', 'wp_check_term_hierarchy_for_loops', 10, 3 );
+
// Display filters
add_filter( 'the_title', 'wptexturize' );
add_filter( 'the_title', 'convert_chars' );
@@ -143,7 +155,6 @@ add_filter( 'comment_text', 'wpautop', 30 );
add_filter( 'comment_excerpt', 'convert_chars' );
add_filter( 'list_cats', 'wptexturize' );
-add_filter( 'single_post_title', 'wptexturize' );
add_filter( 'wp_sprintf', 'wp_sprintf_l', 10, 2 );
@@ -204,6 +215,10 @@ add_action( 'wp_footer', 'wp_print_footer_scripts' );
add_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 );
add_action( 'template_redirect', 'wp_shortlink_header', 11, 0 );
+// Login actions
+add_action( 'login_head', 'wp_print_head_scripts', 9 );
+add_action( 'login_footer', 'wp_print_footer_scripts' );
+
// Feed Generator Tags
foreach ( array( 'rss2_head', 'commentsrss2_head', 'rss_head', 'rdf_header', 'atom_head', 'comments_atom_head', 'opml_head', 'app_head' ) as $action ) {
add_action( $action, 'the_generator' );
@@ -258,4 +273,6 @@ add_filter( 'pre_option_gmt_offset','wp_timezone_override_offset' );
add_action( 'admin_init', 'register_admin_color_schemes', 1);
add_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );
+unset($filter, $action);
+
?>
diff --git a/wp-includes/default-widgets.php b/wp-includes/default-widgets.php
index 2c9ec067..a3699051 100644
--- a/wp-includes/default-widgets.php
+++ b/wp-includes/default-widgets.php
@@ -1,5 +1,4 @@
+ id="get_field_id('dropdown'); ?>" name="get_field_name('dropdown'); ?>" />
+
id="get_field_id('count'); ?>" name="get_field_name('count'); ?>" />
-
- id="get_field_id('dropdown'); ?>" name="get_field_name('dropdown'); ?>" />
'', 'text' => '' ) );
$title = strip_tags($instance['title']);
- $text = format_to_edit($instance['text']);
+ $text = esc_textarea($instance['text']);
?>
@@ -491,7 +490,7 @@ class WP_Widget_Categories extends WP_Widget {
/>
-
+
/>
@@ -535,14 +534,10 @@ class WP_Widget_Recent_Posts extends WP_Widget {
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Posts') : $instance['title'], $instance, $this->id_base);
- if ( !$number = (int) $instance['number'] )
- $number = 10;
- else if ( $number < 1 )
- $number = 1;
- else if ( $number > 15 )
- $number = 15;
-
- $r = new WP_Query(array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'caller_get_posts' => 1));
+ if ( ! $number = absint( $instance['number'] ) )
+ $number = 10;
+
+ $r = new WP_Query(array('posts_per_page' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => true));
if ($r->have_posts()) :
?>
@@ -582,8 +577,7 @@ class WP_Widget_Recent_Posts extends WP_Widget {
function form( $instance ) {
$title = isset($instance['title']) ? esc_attr($instance['title']) : '';
- if ( !isset($instance['number']) || !$number = (int) $instance['number'] )
- $number = 5;
+ $number = isset($instance['number']) ? absint($instance['number']) : 5;
?>
@@ -613,7 +607,11 @@ class WP_Widget_Recent_Comments extends WP_Widget {
add_action( 'transition_comment_status', array(&$this, 'flush_widget_cache') );
}
- function recent_comments_style() { ?>
+ function recent_comments_style() {
+ if ( ! current_theme_supports( 'widgets' ) // Temp hack #14876
+ || ! apply_filters( 'show_recent_comments_widget_style', true, $this->id_base ) )
+ return;
+ ?>
$number, 'status' => 'approve' ) );
$output .= $before_widget;
@@ -666,7 +662,7 @@ class WP_Widget_Recent_Comments extends WP_Widget {
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
- $instance['number'] = (int) $new_instance['number'];
+ $instance['number'] = absint( $new_instance['number'] );
$this->flush_widget_cache();
$alloptions = wp_cache_get( 'alloptions', 'options' );
@@ -716,6 +712,10 @@ class WP_Widget_RSS extends WP_Widget {
if ( empty($url) )
return;
+ // self-url destruction sequence
+ if ( $url == site_url() || $url == home_url() )
+ return;
+
$rss = fetch_feed($url);
$title = $instance['title'];
$desc = '';
@@ -836,13 +836,10 @@ function wp_widget_rss_output( $rss, $args = array() ) {
$date = '';
if ( $show_date ) {
- $date = $item->get_date();
+ $date = $item->get_date( 'U' );
if ( $date ) {
- if ( $date_stamp = strtotime( $date ) )
- $date = ' ';
- else
- $date = '';
+ $date = ' ';
}
}
@@ -1011,7 +1008,7 @@ class WP_Widget_Tag_Cloud extends WP_Widget {
echo $before_widget;
if ( $title )
echo $before_title . $title . $after_title;
- echo '';
+ echo '
';
wp_tag_cloud( apply_filters('widget_tag_cloud_args', array('taxonomy' => $current_taxonomy) ) );
echo "
\n";
echo $after_widget;
diff --git a/wp-includes/deprecated.php b/wp-includes/deprecated.php
index c32a288c..2300572e 100644
--- a/wp-includes/deprecated.php
+++ b/wp-includes/deprecated.php
@@ -164,10 +164,10 @@ function previous_post($format='%', $previous='previous post: ', $title='yes', $
* @see next_post_link()
*
* @param string $format
- * @param string $previous
+ * @param string $next
* @param string $title
* @param string $in_same_cat
- * @param int $limitprev
+ * @param int $limitnext
* @param string $excluded_categories
*/
function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') {
@@ -430,7 +430,7 @@ function get_linksbyname($cat_name = "noname", $before = '', $after = '
',
* @return bool|null
*/
function wp_get_linksbyname($category, $args = '') {
- _deprecated_function(__FUNCTION__, '0.0', 'wp_list_bookmarks()');
+ _deprecated_function(__FUNCTION__, '2.1', 'wp_list_bookmarks()');
$defaults = array(
'after' => '
',
@@ -872,10 +872,10 @@ function permalink_link() {
* @deprecated Use the_permalink_rss()
* @see the_permalink_rss()
*
- * @param string $file
+ * @param string $deprecated
*/
function permalink_single_rss($deprecated = '') {
- _deprecated_function( __FUNCTION__, '0.0', 'the_permalink_rss()' );
+ _deprecated_function( __FUNCTION__, '2.3', 'the_permalink_rss()' );
the_permalink_rss();
}
@@ -892,7 +892,7 @@ function permalink_single_rss($deprecated = '') {
* @return null|string
*/
function wp_get_links($args = '') {
- _deprecated_function( __FUNCTION__, '0.0', 'wp_list_bookmarks()' );
+ _deprecated_function( __FUNCTION__, '2.1', 'wp_list_bookmarks()' );
if ( strpos( $args, '=' ) === false ) {
$cat_id = $args;
@@ -2035,7 +2035,7 @@ function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false)
return apply_filters('attachment_innerHTML', $innerHTML, $post->ID);
}
-/*
+/**
* Retrieve bookmark data based on ID.
*
* @since 2.0.0
@@ -2296,7 +2296,8 @@ function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) {
else
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
- wp_cache_delete($user_id, 'users');
+ clean_user_cache( $user_id );
+ wp_cache_delete( $user_id, 'user_meta' );
if ( $cur && $cur->umeta_id )
do_action( 'deleted_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
@@ -2403,7 +2404,8 @@ function update_usermeta( $user_id, $meta_key, $meta_value ) {
else
return false;
- wp_cache_delete($user_id, 'users');
+ clean_user_cache( $user_id );
+ wp_cache_delete( $user_id, 'user_meta' );
if ( !$cur )
do_action( 'added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value );
@@ -2413,6 +2415,31 @@ function update_usermeta( $user_id, $meta_key, $meta_value ) {
return true;
}
+/**
+ * Get users for the blog.
+ *
+ * For setups that use the multi-blog feature. Can be used outside of the
+ * multi-blog feature.
+ *
+ * @since 2.2.0
+ * @deprecated 3.1.0
+ * @uses $wpdb WordPress database object for queries
+ * @uses $blog_id The Blog id of the blog for those that use more than one blog
+ *
+ * @param int $id Blog ID.
+ * @return array List of users that are part of that Blog ID
+ */
+function get_users_of_blog( $id = '' ) {
+ _deprecated_function( __FUNCTION__, '3.1', 'get_users()' );
+
+ global $wpdb, $blog_id;
+ if ( empty($id) )
+ $id = (int) $blog_id;
+ $blog_prefix = $wpdb->get_blog_prefix($id);
+ $users = $wpdb->get_results( "SELECT user_id, user_id AS ID, user_login, display_name, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE {$wpdb->users}.ID = {$wpdb->usermeta}.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY {$wpdb->usermeta}.user_id" );
+ return $users;
+}
+
/**
* Enable/disable automatic general feed link outputting.
*
@@ -2534,3 +2561,44 @@ function is_term( $term, $taxonomy = '', $parent = 0 ) {
_deprecated_function( __FUNCTION__, '3.0', 'term_exists()' );
return term_exists( $term, $taxonomy, $parent );
}
+
+/**
+ * Is the current admin page generated by a plugin?
+ *
+ * @since 1.5.0
+ * @deprecated 3.1
+ * @deprecated Use global $plugin_page and/or get_plugin_page_hookname() hooks.
+ *
+ * @global $plugin_page
+ *
+ * @return bool
+ */
+function is_plugin_page() {
+ _deprecated_function( __FUNCTION__, '3.1' );
+
+ global $plugin_page;
+
+ if ( isset($plugin_page) )
+ return true;
+
+ return false;
+}
+
+/**
+ * Update the categories cache.
+ *
+ * This function does not appear to be used anymore or does not appear to be
+ * needed. It might be a legacy function left over from when there was a need
+ * for updating the category cache.
+ *
+ * @since 1.5.0
+ * @deprecated 3.1
+ *
+ * @return bool Always return True
+ */
+function update_category_cache() {
+ _deprecated_function( __FUNCTION__, '3.1' );
+
+ return true;
+}
+
diff --git a/wp-includes/feed-rss2.php b/wp-includes/feed-rss2.php
index 538f96b7..5bf67f2f 100644
--- a/wp-includes/feed-rss2.php
+++ b/wp-includes/feed-rss2.php
@@ -37,7 +37,7 @@ echo ''; ?>
-
+
diff --git a/wp-includes/feed.php b/wp-includes/feed.php
index 1be12a45..b94e3476 100644
--- a/wp-includes/feed.php
+++ b/wp-includes/feed.php
@@ -161,7 +161,7 @@ function get_the_content_feed($feed_type = null) {
* @param string $feed_type The type of feed. rss2 | atom | rss | rdf
*/
function the_content_feed($feed_type = null) {
- echo get_the_content_feed();
+ echo get_the_content_feed($feed_type);
}
/**
@@ -204,7 +204,7 @@ function comments_link_feed() {
*
* @package WordPress
* @subpackage Feed
- * @since unknown
+ * @since 2.5.0
*
* @param int|object $comment_id Optional comment object or id. Defaults to global comment object.
*/
@@ -217,7 +217,7 @@ function comment_guid($comment_id = null) {
*
* @package WordPress
* @subpackage Feed
- * @since unknown
+ * @since 2.5.0
*
* @param int|object $comment_id Optional comment object or id. Defaults to global comment object.
* @return bool|string false on failure or guid for comment on success.
diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php
index 3d203e6f..be2669c1 100644
--- a/wp-includes/formatting.php
+++ b/wp-includes/formatting.php
@@ -56,7 +56,7 @@ function wptexturize($text) {
$static_characters = array_merge(array('---', ' -- ', '--', ' - ', 'xn–', '...', '``', '\'\'', ' (tm)'), $cockney);
$static_replacements = array_merge(array('—', ' — ', '–', ' – ', 'xn--', '…', $opening_quote, $closing_quote, ' ™'), $cockneyreplace);
- $dynamic_characters = array('/\'(\d\d(?:’|\')?s)/', '/\'(\d+)/', '/(\s|\A|[([{<]|")\'/', '/(\d+)"/', '/(\d+)\'/', '/(\S)\'([^\'\s])/', '/(\s|\A|[([{<])"(?!\s)/', '/"(\s|\S|\Z)/', '/\'([\s.]|\Z)/', '/\b(\d+)x(\d+)\b/');
+ $dynamic_characters = array('/\'(\d\d(?:’|\')?s)/', '/\'(\d)/', '/(\s|\A|[([{<]|")\'/', '/(\d)"/', '/(\d)\'/', '/(\S)\'([^\'\s])/', '/(\s|\A|[([{<])"(?!\s)/', '/"(\s|\S|\Z)/', '/\'([\s.]|\Z)/', '/\b(\d+)x(\d+)\b/');
$dynamic_replacements = array('’$1','’$1', '$1‘', '$1″', '$1′', '$1’$2', '$1' . $opening_quote . '$2', $closing_quote . '$1', '’$1', '$1×$2');
$static_setup = true;
@@ -73,7 +73,7 @@ function wptexturize($text) {
for ( $i = 0; $i < $stop; $i++ ) {
$curl = $textarr[$i];
- if ( !empty($curl) && '<' != $curl{0} && '[' != $curl{0}
+ if ( !empty($curl) && '<' != $curl[0] && '[' != $curl[0]
&& empty($no_texturize_shortcodes_stack) && empty($no_texturize_tags_stack)) {
// This is not a tag, nor is the texturization disabled
// static strings
@@ -85,9 +85,9 @@ function wptexturize($text) {
* Only call _wptexturize_pushpop_element if first char is correct
* tag opening
*/
- if ('<' == $curl{0})
+ if ('<' == $curl[0])
_wptexturize_pushpop_element($curl, $no_texturize_tags_stack, $no_texturize_tags, '<', '>');
- elseif ('[' == $curl{0})
+ elseif ('[' == $curl[0])
_wptexturize_pushpop_element($curl, $no_texturize_shortcodes_stack, $no_texturize_shortcodes, '[', ']');
}
@@ -208,7 +208,7 @@ function wpautop($pee, $br = 1) {
$pee = preg_replace('!
\s*(?' . $allblocks . '[^>]*>)!', "$1", $pee);
$pee = preg_replace('!(?' . $allblocks . '[^>]*>)\s*
!', "$1", $pee);
if ($br) {
- $pee = preg_replace_callback('/<(script|style).*?<\/\\1>/s', create_function('$matches', 'return str_replace("\n", "
", $matches[0]);'), $pee);
+ $pee = preg_replace_callback('/<(script|style).*?<\/\\1>/s', '_autop_newline_preservation_helper', $pee);
$pee = preg_replace('|(?)\s*\n|', "
\n", $pee); // optionally make line breaks
$pee = str_replace('
', "\n", $pee);
}
@@ -221,6 +221,18 @@ function wpautop($pee, $br = 1) {
return $pee;
}
+/**
+ * Newline preservation help function for wpautop
+ *
+ * @since 3.1.0
+ * @access private
+ * @param array $matches preg_replace_callback matches array
+ * @returns string
+ */
+function _autop_newline_preservation_helper( $matches ) {
+ return str_replace("\n", "
", $matches[0]);
+}
+
/**
* Don't auto-p wrap shortcodes that stand alone
*
@@ -538,30 +550,33 @@ function remove_accents($string) {
chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',
chr(195).chr(132) => 'A', chr(195).chr(133) => 'A',
- chr(195).chr(135) => 'C', chr(195).chr(136) => 'E',
- chr(195).chr(137) => 'E', chr(195).chr(138) => 'E',
- chr(195).chr(139) => 'E', chr(195).chr(140) => 'I',
- chr(195).chr(141) => 'I', chr(195).chr(142) => 'I',
- chr(195).chr(143) => 'I', chr(195).chr(145) => 'N',
+ chr(195).chr(134) => 'AE',chr(195).chr(135) => 'C',
+ chr(195).chr(136) => 'E', chr(195).chr(137) => 'E',
+ chr(195).chr(138) => 'E', chr(195).chr(139) => 'E',
+ chr(195).chr(140) => 'I', chr(195).chr(141) => 'I',
+ chr(195).chr(142) => 'I', chr(195).chr(143) => 'I',
+ chr(195).chr(144) => 'D', chr(195).chr(145) => 'N',
chr(195).chr(146) => 'O', chr(195).chr(147) => 'O',
chr(195).chr(148) => 'O', chr(195).chr(149) => 'O',
chr(195).chr(150) => 'O', chr(195).chr(153) => 'U',
chr(195).chr(154) => 'U', chr(195).chr(155) => 'U',
chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y',
- chr(195).chr(159) => 's', chr(195).chr(160) => 'a',
- chr(195).chr(161) => 'a', chr(195).chr(162) => 'a',
- chr(195).chr(163) => 'a', chr(195).chr(164) => 'a',
- chr(195).chr(165) => 'a', chr(195).chr(167) => 'c',
+ chr(195).chr(158) => 'TH',chr(195).chr(159) => 's',
+ chr(195).chr(160) => 'a', chr(195).chr(161) => 'a',
+ chr(195).chr(162) => 'a', chr(195).chr(163) => 'a',
+ chr(195).chr(164) => 'a', chr(195).chr(165) => 'a',
+ chr(195).chr(166) => 'ae',chr(195).chr(167) => 'c',
chr(195).chr(168) => 'e', chr(195).chr(169) => 'e',
chr(195).chr(170) => 'e', chr(195).chr(171) => 'e',
chr(195).chr(172) => 'i', chr(195).chr(173) => 'i',
chr(195).chr(174) => 'i', chr(195).chr(175) => 'i',
- chr(195).chr(177) => 'n', chr(195).chr(178) => 'o',
- chr(195).chr(179) => 'o', chr(195).chr(180) => 'o',
- chr(195).chr(181) => 'o', chr(195).chr(182) => 'o',
- chr(195).chr(182) => 'o', chr(195).chr(185) => 'u',
- chr(195).chr(186) => 'u', chr(195).chr(187) => 'u',
- chr(195).chr(188) => 'u', chr(195).chr(189) => 'y',
+ chr(195).chr(176) => 'd', chr(195).chr(177) => 'n',
+ chr(195).chr(178) => 'o', chr(195).chr(179) => 'o',
+ chr(195).chr(180) => 'o', chr(195).chr(181) => 'o',
+ chr(195).chr(182) => 'o', chr(195).chr(182) => 'o',
+ chr(195).chr(185) => 'u', chr(195).chr(186) => 'u',
+ chr(195).chr(187) => 'u', chr(195).chr(188) => 'u',
+ chr(195).chr(189) => 'y', chr(195).chr(190) => 'th',
chr(195).chr(191) => 'y',
// Decompositions for Latin Extended-A
chr(196).chr(128) => 'A', chr(196).chr(129) => 'a',
@@ -628,6 +643,9 @@ function remove_accents($string) {
chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z',
chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z',
chr(197).chr(190) => 'z', chr(197).chr(191) => 's',
+ // Decompositions for Latin Extended-B
+ chr(200).chr(152) => 'S', chr(200).chr(153) => 's',
+ chr(200).chr(154) => 'T', chr(200).chr(155) => 't',
// Euro Sign
chr(226).chr(130).chr(172) => 'E',
// GBP (Pound) Sign
@@ -718,12 +736,10 @@ function sanitize_file_name( $filename ) {
/**
* Sanitize username stripping out unsafe characters.
*
- * If $strict is true, only alphanumeric characters (as well as _, space, ., -,
- * @) are returned.
- * Removes tags, octets, entities, and if strict is enabled, will remove all
- * non-ASCII characters. After sanitizing, it passes the username, raw username
- * (the username in the parameter), and the strict parameter as parameters for
- * the filter.
+ * Removes tags, octets, entities, and if strict is enabled, will only keep
+ * alphanumeric, _, space, ., -, @. After sanitizing, it passes the username,
+ * raw username (the username in the parameter), and the value of $strict as
+ * parameters for the 'sanitize_user' filter.
*
* @since 2.0.0
* @uses apply_filters() Calls 'sanitize_user' hook on username, raw username,
@@ -745,6 +761,7 @@ function sanitize_user( $username, $strict = false ) {
if ( $strict )
$username = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $username );
+ $username = trim( $username );
// Consolidate contiguous whitespace
$username = preg_replace( '|\s+|', ' ', $username );
@@ -754,7 +771,7 @@ function sanitize_user( $username, $strict = false ) {
/**
* Sanitize a string key.
*
- * Keys are used as internal identifiers. They should be lowercase ASCII. Dashes and underscores are allowed.
+ * Keys are used as internal identifiers. Lowercase alphanumeric characters, dashes and underscores are allowed.
*
* @since 3.0.0
*
@@ -763,17 +780,9 @@ function sanitize_user( $username, $strict = false ) {
*/
function sanitize_key( $key ) {
$raw_key = $key;
- $key = wp_strip_all_tags($key);
- // Kill octets
- $key = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '', $key);
- $key = preg_replace('/&.+?;/', '', $key); // Kill entities
-
- $key = preg_replace('|[^a-z0-9 _.\-@]|i', '', $key);
-
- // Consolidate contiguous whitespace
- $key = preg_replace('|\s+|', ' ', $key);
-
- return apply_filters('sanitize_key', $key, $raw_key);
+ $key = strtolower( $key );
+ $key = preg_replace( '/[^a-z0-9_\-]/', '', $key );
+ return apply_filters( 'sanitize_key', $key, $raw_key );
}
/**
@@ -787,12 +796,16 @@ function sanitize_key( $key ) {
*
* @param string $title The string to be sanitized.
* @param string $fallback_title Optional. A title to use if $title is empty.
+ * @param string $context Optional. The operation for which the string is sanitized
* @return string The sanitized string.
*/
-function sanitize_title($title, $fallback_title = '') {
+function sanitize_title($title, $fallback_title = '', $context = 'save') {
$raw_title = $title;
- $title = strip_tags($title);
- $title = apply_filters('sanitize_title', $title, $raw_title);
+
+ if ( 'save' == $context )
+ $title = remove_accents($title);
+
+ $title = apply_filters('sanitize_title', $title, $raw_title, $context);
if ( '' === $title || false === $title )
$title = $fallback_title;
@@ -800,6 +813,10 @@ function sanitize_title($title, $fallback_title = '') {
return $title;
}
+function sanitize_title_for_query($title) {
+ return sanitize_title($title, '', 'query');
+}
+
/**
* Sanitizes title, replacing whitespace with dashes.
*
@@ -820,7 +837,6 @@ function sanitize_title_with_dashes($title) {
// Restore octets.
$title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title);
- $title = remove_accents($title);
if (seems_utf8($title)) {
if (function_exists('mb_strtolower')) {
$title = mb_strtolower($title, 'UTF-8');
@@ -980,7 +996,7 @@ function balanceTags( $text, $force = false ) {
* @since 2.0.4
*
* @author Leonard Lin
- * @license GPL v2.0
+ * @license GPL
* @copyright November 4, 2001
* @version 1.1
* @todo Make better - change loop condition to $text in 1.2
@@ -1098,8 +1114,8 @@ function force_balance_tags( $text ) {
* Acts on text which is about to be edited.
*
* Unless $richedit is set, it is simply a holder for the 'format_to_edit'
- * filter. If $richedit is set true htmlspecialchars() will be run on the
- * content, converting special characters to HTMl entities.
+ * filter. If $richedit is set true htmlspecialchars(), through esc_textarea(),
+ * will be run on the content, converting special characters to HTML entities.
*
* @since 0.71
*
@@ -1107,10 +1123,10 @@ function force_balance_tags( $text ) {
* @param bool $richedit Whether the $content should pass through htmlspecialchars(). Default false.
* @return string The text after the filter (and possibly htmlspecialchars()) has been run.
*/
-function format_to_edit($content, $richedit = false) {
- $content = apply_filters('format_to_edit', $content);
- if (! $richedit )
- $content = htmlspecialchars($content);
+function format_to_edit( $content, $richedit = false ) {
+ $content = apply_filters( 'format_to_edit', $content );
+ if ( ! $richedit )
+ $content = esc_textarea( $content );
return $content;
}
@@ -1296,12 +1312,19 @@ function antispambot($emailaddy, $mailto=0) {
*/
function _make_url_clickable_cb($matches) {
$url = $matches[2];
+ $suffix = '';
+
+ /** Include parentheses in the URL only if paired **/
+ while ( substr_count( $url, '(' ) < substr_count( $url, ')' ) ) {
+ $suffix = strrchr( $url, ')' ) . $suffix;
+ $url = substr( $url, 0, strrpos( $url, ')' ) );
+ }
$url = esc_url($url);
if ( empty($url) )
return $matches[0];
- return $matches[1] . "$url ";
+ return $matches[1] . "$url " . $suffix;
}
/**
@@ -1363,7 +1386,7 @@ function _make_email_clickable_cb($matches) {
function make_clickable($ret) {
$ret = ' ' . $ret;
// in testing, using arrays here was found to be faster
- $ret = preg_replace_callback('#(?<=[\s>])(\()?([\w]+?://(?:[\w\\x80-\\xff\#$%&~/=?@\[\](+-]|[.,;:](?![\s<]|(\))?([\s]|$))|(?(1)\)(?![\s<.,;:]|$)|\)))+)#is', '_make_url_clickable_cb', $ret);
+ $ret = preg_replace_callback('#(?])(\()?([\w]+?://(?:[\w\\x80-\\xff\#%~/?@\[\]-]|[\'*(+.,;:!=&$](?![\b\)]|(\))?([\s]|$))|(?(1)\)(?![\s<.,;:]|$)|\)))+)#is', '_make_url_clickable_cb', $ret);
$ret = preg_replace_callback('#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret);
$ret = preg_replace_callback('#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret);
// this one is not in an array because we need it to run last, for cleanup of accidental links within links
@@ -1424,13 +1447,11 @@ function translate_smiley($smiley) {
return '';
}
- $siteurl = get_option( 'siteurl' );
-
$smiley = trim(reset($smiley));
$img = $wpsmiliestrans[$smiley];
$smiley_masked = esc_attr($smiley);
- $srcurl = apply_filters('smilies_src', "$siteurl/wp-includes/images/smilies/$img", $img, $siteurl);
+ $srcurl = apply_filters('smilies_src', includes_url("images/smilies/$img"), $img, site_url());
return " ";
}
@@ -1456,7 +1477,7 @@ function convert_smilies($text) {
$stop = count($textarr);// loop stuff
for ($i = 0; $i < $stop; $i++) {
$content = $textarr[$i];
- if ((strlen($content) > 0) && ('<' != $content{0})) { // If it's not a tag
+ if ((strlen($content) > 0) && ('<' != $content[0])) { // If it's not a tag
$content = preg_replace_callback($wp_smiliessearch, 'translate_smiley', $content);
}
$output .= $content;
@@ -1476,7 +1497,7 @@ function convert_smilies($text) {
* @since 0.71
*
* @param string $email Email address to verify.
- * @param boolean $deprecated. Deprecated.
+ * @param boolean $deprecated Deprecated.
* @return string|bool Either false or the valid email address.
*/
function is_email( $email, $deprecated = false ) {
@@ -1553,11 +1574,22 @@ function wp_iso_descrambler($string) {
return $string;
} else {
$subject = str_replace('_', ' ', $matches[2]);
- $subject = preg_replace_callback('#\=([0-9a-f]{2})#i', create_function('$match', 'return chr(hexdec(strtolower($match[1])));'), $subject);
+ $subject = preg_replace_callback('#\=([0-9a-f]{2})#i', '_wp_iso_convert', $subject);
return $subject;
}
}
+/**
+ * Helper function to convert hex encoded chars to ascii
+ *
+ * @since 3.1.0
+ * @access private
+ * @param array $match the preg_replace_callback matches array
+ */
+function _wp_iso_convert( $match ) {
+ return chr( hexdec( strtolower( $match[1] ) ) );
+}
+
/**
* Returns a date in the GMT equivalent.
*
@@ -1743,7 +1775,7 @@ function sanitize_email( $email ) {
$sub = trim( $sub, " \t\n\r\0\x0B-" );
// Test for invalid characters
- $sub = preg_replace( '/^[^a-z0-9-]+$/i', '', $sub );
+ $sub = preg_replace( '/[^a-z0-9-]+/i', '', $sub );
// If there's anything left, add it to the valid subs
if ( '' !== $sub ) {
@@ -2328,6 +2360,19 @@ function esc_attr( $text ) {
return apply_filters( 'attribute_escape', $safe_text, $text );
}
+/**
+ * Escaping for textarea values.
+ *
+ * @since 3.1
+ *
+ * @param string $text
+ * @return string
+ */
+function esc_textarea( $text ) {
+ $safe_text = htmlspecialchars( $text, ENT_QUOTES );
+ return apply_filters( 'esc_textarea', $safe_text, $text );
+}
+
/**
* Escape a HTML tag name.
*
@@ -2580,7 +2625,7 @@ function wp_sprintf( $pattern ) {
$fragment = substr($pattern, $start, $end - $start);
// Fragment has a specifier
- if ( $pattern{$start} == '%' ) {
+ if ( $pattern[$start] == '%' ) {
// Find numbered arguments or take the next one in order
if ( preg_match('/^%(\d+)\$/', $fragment, $matches) ) {
$arg = isset($args[$matches[1]]) ? $args[$matches[1]] : '';
@@ -2689,10 +2734,10 @@ function wp_html_excerpt( $str, $count ) {
* @return string The processed content.
*/
function links_add_base_url( $content, $base, $attrs = array('src', 'href') ) {
+ global $_links_add_base;
+ $_links_add_base = $base;
$attrs = implode('|', (array)$attrs);
- return preg_replace_callback("!($attrs)=(['\"])(.+?)\\2!i",
- create_function('$m', 'return _links_add_base($m, "' . $base . '");'),
- $content);
+ return preg_replace_callback( "!($attrs)=(['\"])(.+?)\\2!i", '_links_add_base', $content );
}
/**
@@ -2702,14 +2747,14 @@ function links_add_base_url( $content, $base, $attrs = array('src', 'href') ) {
* @access private
*
* @param string $m The matched link.
- * @param string $base The base URL to prefix to links.
* @return string The processed link.
*/
-function _links_add_base($m, $base) {
+function _links_add_base($m) {
+ global $_links_add_base;
//1 = attribute name 2 = quotation mark 3 = URL
return $m[1] . '=' . $m[2] .
(strpos($m[3], 'http://') === false ?
- path_join($base, $m[3]) :
+ path_join($_links_add_base, $m[3]) :
$m[3])
. $m[2];
}
@@ -2730,10 +2775,10 @@ function _links_add_base($m, $base) {
* @return string The processed content.
*/
function links_add_target( $content, $target = '_blank', $tags = array('a') ) {
+ global $_links_add_target;
+ $_links_add_target = $target;
$tags = implode('|', (array)$tags);
- return preg_replace_callback("!<($tags)(.+?)>!i",
- create_function('$m', 'return _links_add_target($m, "' . $target . '");'),
- $content);
+ return preg_replace_callback( "!<($tags)(.+?)>!i", '_links_add_target', $content );
}
/**
@@ -2743,13 +2788,13 @@ function links_add_target( $content, $target = '_blank', $tags = array('a') ) {
* @access private
*
* @param string $m The matched link.
- * @param string $target The Target to add to the links.
* @return string The processed link.
*/
-function _links_add_target( $m, $target ) {
+function _links_add_target( $m ) {
+ global $_links_add_target;
$tag = $m[1];
$link = preg_replace('|(target=[\'"](.*?)[\'"])|i', '', $m[2]);
- return '<' . $tag . $link . ' target="' . $target . '">';
+ return '<' . $tag . $link . ' target="' . esc_attr( $_links_add_target ) . '">';
}
// normalize EOL characters and strip duplicate whitespace
@@ -2819,6 +2864,19 @@ function sanitize_text_field($str) {
return apply_filters('sanitize_text_field', $filtered, $str);
}
+/**
+ * i18n friendly version of basename()
+ *
+ * @since 3.1.0
+ *
+ * @param string $path A path.
+ * @param string $suffix If the filename ends in suffix this will also be cut off.
+ * @return string
+ */
+function wp_basename( $path, $suffix = '' ) {
+ return urldecode( basename( str_replace( '%2F', '/', urlencode( $path ) ), $suffix ) );
+}
+
/**
* Forever eliminate "Wordpress" from the planet (or at least the little bit we can influence).
*
@@ -2826,7 +2884,6 @@ function sanitize_text_field($str) {
*
* @since 3.0.0
*/
-
function capital_P_dangit( $text ) {
// Simple replacement for titles
if ( 'the_title' === current_filter() )
diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index 8cd9ba79..65ee33ea 100644
--- a/wp-includes/functions.php
+++ b/wp-includes/functions.php
@@ -27,19 +27,18 @@ function mysql2date( $dateformatstring, $mysqlstring, $translate = true ) {
if ( empty( $m ) )
return false;
- if ( 'G' == $dateformatstring ) {
+ if ( 'G' == $dateformatstring )
return strtotime( $m . ' +0000' );
- }
$i = strtotime( $m );
if ( 'U' == $dateformatstring )
return $i;
- if ( $translate)
- return date_i18n( $dateformatstring, $i );
+ if ( $translate )
+ return date_i18n( $dateformatstring, $i );
else
- return date( $dateformatstring, $i );
+ return date( $dateformatstring, $i );
}
/**
@@ -119,6 +118,23 @@ function date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) {
$dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) -1 );
}
+ $timezone_formats = array( 'P', 'I', 'O', 'T', 'Z', 'e' );
+ $timezone_formats_re = implode( '|', $timezone_formats );
+ if ( preg_match( "/$timezone_formats_re/", $dateformatstring ) && wp_timezone_supported() ) {
+ $timezone_string = get_option( 'timezone_string' );
+ if ( $timezone_string ) {
+ $timezone_object = timezone_open( $timezone_string );
+ $date_object = date_create( null, $timezone_object );
+ foreach( $timezone_formats as $timezone_format ) {
+ if ( false !== strpos( $dateformatstring, $timezone_format ) ) {
+ $formatted = date_format( $date_object, $timezone_format );
+ $dateformatstring = ' '.$dateformatstring;
+ $dateformatstring = preg_replace( "/([^\\\])$timezone_format/", "\\1" . backslashit( $formatted ), $dateformatstring );
+ $dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) -1 );
+ }
+ }
+ }
+ }
$j = @$datefunc( $dateformatstring, $i );
// allow plugins to redo this entirely for languages with untypical grammars
$j = apply_filters('date_i18n', $j, $req_format, $i, $gmt);
@@ -230,26 +246,31 @@ function maybe_unserialize( $original ) {
*/
function is_serialized( $data ) {
// if it isn't a string, it isn't serialized
- if ( !is_string( $data ) )
+ if ( ! is_string( $data ) )
return false;
$data = trim( $data );
- if ( 'N;' == $data )
+ if ( 'N;' == $data )
return true;
- if ( !preg_match( '/^([adObis]):/', $data, $badions ) )
+ $length = strlen( $data );
+ if ( $length < 4 )
+ return false;
+ if ( ':' !== $data[1] )
+ return false;
+ $lastc = $data[$length-1];
+ if ( ';' !== $lastc && '}' !== $lastc )
return false;
- switch ( $badions[1] ) {
+ $token = $data[0];
+ switch ( $token ) {
+ case 's' :
+ if ( '"' !== $data[$length-2] )
+ return false;
case 'a' :
case 'O' :
- case 's' :
- if ( preg_match( "/^{$badions[1]}:[0-9]+:.*[;}]\$/s", $data ) )
- return true;
- break;
+ return (bool) preg_match( "/^{$token}:[0-9]+:/s", $data );
case 'b' :
case 'i' :
case 'd' :
- if ( preg_match( "/^{$badions[1]}:[0-9.E-]+;\$/", $data ) )
- return true;
- break;
+ return (bool) preg_match( "/^{$token}:[0-9.E-]+;\$/", $data );
}
return false;
}
@@ -412,10 +433,11 @@ function wp_load_alloptions() {
$alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" );
$wpdb->suppress_errors($suppress);
$alloptions = array();
- foreach ( (array) $alloptions_db as $o )
+ foreach ( (array) $alloptions_db as $o ) {
$alloptions[$o->option_name] = $o->option_value;
- if ( !defined( 'WP_INSTALLING' ) || !is_multisite() )
- wp_cache_add( 'alloptions', $alloptions, 'options' );
+ }
+ if ( !defined( 'WP_INSTALLING' ) || !is_multisite() )
+ wp_cache_add( 'alloptions', $alloptions, 'options' );
}
return $alloptions;
@@ -439,7 +461,7 @@ function wp_load_core_site_options( $site_id = null ) {
if ( empty($site_id) )
$site_id = $wpdb->siteid;
- $core_options = array('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'dashboard_blog', 'can_compress_scripts', 'global_terms_enabled' );
+ $core_options = array('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts', 'global_terms_enabled' );
$core_options_in = "'" . implode("', '", $core_options) . "'";
$options = $wpdb->get_results( $wpdb->prepare("SELECT meta_key, meta_value FROM $wpdb->sitemeta WHERE meta_key IN ($core_options_in) AND site_id = %d", $site_id) );
@@ -546,7 +568,6 @@ function update_option( $option, $newvalue ) {
* @package WordPress
* @subpackage Option
* @since 1.0.0
- * @link http://alex.vort-x.net/blog/ Thanks Alex Stapleton
*
* @uses do_action() Calls 'add_option' hook before adding the option.
* @uses do_action() Calls 'add_option_$option' and 'added_option' hooks on success.
@@ -670,7 +691,7 @@ function delete_option( $option ) {
function delete_transient( $transient ) {
global $_wp_using_ext_object_cache;
- do_action( 'delete_transient_' . $transient, $transient );
+ do_action( 'delete_transient_' . $transient, $transient );
if ( $_wp_using_ext_object_cache ) {
$result = wp_cache_delete( $transient, 'transient' );
@@ -758,7 +779,7 @@ function get_transient( $transient ) {
function set_transient( $transient, $value, $expiration = 0 ) {
global $_wp_using_ext_object_cache;
- $value = apply_filters( 'pre_set_transient_' . $transient, $value );
+ $value = apply_filters( 'pre_set_transient_' . $transient, $value );
if ( $_wp_using_ext_object_cache ) {
$result = wp_cache_set( $transient, $value, 'transient', $expiration );
@@ -1163,6 +1184,8 @@ function debug_fclose( $fp ) {
*/
function do_enclose( $content, $post_ID ) {
global $wpdb;
+
+ //TODO: Tidy this ghetto code up and make the debug code optional
include_once( ABSPATH . WPINC . '/class-IXR.php' );
$log = debug_fopen( ABSPATH . 'enclosures.log', 'a' );
@@ -1183,7 +1206,7 @@ function do_enclose( $content, $post_ID ) {
foreach ( $pung as $link_test ) {
if ( !in_array( $link_test, $post_links_temp[0] ) ) { // link no longer in post
- $mid = $wpdb->get_col( $wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE (%s)", $post_ID, $link_test . '%') );
+ $mid = $wpdb->get_col( $wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE (%s)", $post_ID, like_escape( $link_test ) . '%') );
do_action( 'delete_postmeta', $mid );
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_id IN(%s)", implode( ',', $mid ) ) );
do_action( 'deleted_postmeta', $mid );
@@ -1197,13 +1220,13 @@ function do_enclose( $content, $post_ID ) {
continue;
if ( isset( $test['query'] ) )
$post_links[] = $link_test;
- elseif ( $test['path'] != '/' && $test['path'] != '' )
+ elseif ( isset($test['path']) && ( $test['path'] != '/' ) && ($test['path'] != '' ) )
$post_links[] = $link_test;
}
}
foreach ( (array) $post_links as $url ) {
- if ( $url != '' && !$wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE (%s)", $post_ID, $url . '%' ) ) ) {
+ if ( $url != '' && !$wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE (%s)", $post_ID, like_escape( $url ) . '%' ) ) ) {
if ( $headers = wp_get_http_headers( $url) ) {
$len = (int) $headers['content-length'];
@@ -1321,8 +1344,8 @@ function wp_get_http_headers( $url, $deprecated = false ) {
* @return int 1 when new day, 0 if not a new day.
*/
function is_new_day() {
- global $day, $previousday;
- if ( $day != $previousday )
+ global $currentday, $previousday;
+ if ( $currentday != $previousday )
return 1;
else
return 0;
@@ -1619,7 +1642,7 @@ function status_header( $header ) {
* The several different headers cover the different ways cache prevention is handled
* by different browsers
*
- * @since 2.8
+ * @since 2.8.0
*
* @uses apply_filters()
* @return array The associative array of header names and field values.
@@ -1633,7 +1656,7 @@ function wp_get_nocache_headers() {
);
if ( function_exists('apply_filters') ) {
- $headers = apply_filters('nocache_headers', $headers);
+ $headers = (array) apply_filters('nocache_headers', $headers);
}
return $headers;
}
@@ -1649,7 +1672,7 @@ function wp_get_nocache_headers() {
*/
function nocache_headers() {
$headers = wp_get_nocache_headers();
- foreach( (array) $headers as $name => $field_value )
+ foreach( $headers as $name => $field_value )
@header("{$name}: {$field_value}");
}
@@ -2058,7 +2081,7 @@ function path_is_absolute( $path ) {
if ( realpath($path) == $path )
return true;
- if ( strlen($path) == 0 || $path{0} == '.' )
+ if ( strlen($path) == 0 || $path[0] == '.' )
return false;
// windows allows absolute paths like this
@@ -2190,14 +2213,14 @@ function wp_upload_dir( $time = null ) {
* before the extension, and will continue adding numbers until the filename is
* unique.
*
- * The callback must accept two parameters, the first one is the directory and
- * the second is the filename. The callback must be a function.
+ * The callback is passed three parameters, the first one is the directory, the
+ * second is the filename, and the third is the extension.
*
- * @since 2.5
+ * @since 2.5.0
*
* @param string $dir
* @param string $filename
- * @param string $unique_filename_callback Function name, must be a function.
+ * @param mixed $unique_filename_callback Callback.
* @return string New filename, if given wasn't unique.
*/
function wp_unique_filename( $dir, $filename, $unique_filename_callback = null ) {
@@ -2213,9 +2236,9 @@ function wp_unique_filename( $dir, $filename, $unique_filename_callback = null )
if ( $name === $ext )
$name = '';
- // Increment the file number until we have a unique file to save in $dir. Use $override['unique_filename_callback'] if supplied.
+ // Increment the file number until we have a unique file to save in $dir. Use callback if supplied.
if ( $unique_filename_callback && is_callable( $unique_filename_callback ) ) {
- $filename = $unique_filename_callback( $dir, $name );
+ $filename = call_user_func( $unique_filename_callback, $dir, $name, $ext );
} else {
$number = '';
@@ -2573,7 +2596,7 @@ function wp_explain_nonce( $action ) {
$trans['edit']['plugin'] = array( __( 'Your attempt to edit this plugin file: “%s” has failed.' ), 'use_id' );
$trans['activate']['plugin'] = array( __( 'Your attempt to activate this plugin: “%s” has failed.' ), 'use_id' );
$trans['deactivate']['plugin'] = array( __( 'Your attempt to deactivate this plugin: “%s” has failed.' ), 'use_id' );
- $trans['upgrade']['plugin'] = array( __( 'Your attempt to upgrade this plugin: “%s” has failed.' ), 'use_id' );
+ $trans['upgrade']['plugin'] = array( __( 'Your attempt to update this plugin: “%s” has failed.' ), 'use_id' );
$trans['add']['post'] = array( __( 'Your attempt to add this post has failed.' ), false );
$trans['delete']['post'] = array( __( 'Your attempt to delete this post: “%s” has failed.' ), 'get_the_title' );
@@ -2657,9 +2680,12 @@ function wp_nonce_ays( $action ) {
* @param string|array $args Optional arguements to control behaviour.
*/
function wp_die( $message, $title = '', $args = array() ) {
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
+ die('-1');
+
if ( function_exists( 'apply_filters' ) ) {
$function = apply_filters( 'wp_die_handler', '_default_wp_die_handler');
- }else {
+ } else {
$function = '_default_wp_die_handler';
}
@@ -2739,7 +2765,7 @@ function _default_wp_die_handler( $message, $title = '', $args = array() ) {
?>
->
+>
@@ -2977,6 +3003,24 @@ function wp_parse_id_list( $list ) {
return array_unique(array_map('absint', $list));
}
+/**
+ * Extract a slice of an array, given a list of keys
+ *
+ * @since 3.1.0
+ *
+ * @param array $array The original array
+ * @param array $keys The list of keys
+ * @return array The array slice
+ */
+function wp_array_slice_assoc( $array, $keys ) {
+ $slice = array();
+ foreach ( $keys as $key )
+ if ( isset( $array[ $key ] ) )
+ $slice[ $key ] = $array[ $key ];
+
+ return $slice;
+}
+
/**
* Filters a list of objects, based on a set of key => value arguments
*
@@ -2990,32 +3034,72 @@ function wp_parse_id_list( $list ) {
* @return array A list of objects or object fields
*/
function wp_filter_object_list( $list, $args = array(), $operator = 'and', $field = false ) {
- if ( !is_array($list) )
+ if ( ! is_array( $list ) )
return array();
- if ( empty($args) )
- $args = array();
+ $list = wp_list_filter( $list, $args, $operator );
- if ( empty($args) && !$field )
- return $list; // nothing to do
+ if ( $field )
+ $list = wp_list_pluck( $list, $field );
- $count = count($args);
+ return $list;
+}
+/**
+ * Filters a list of objects, based on a set of key => value arguments
+ *
+ * @since 3.1.0
+ *
+ * @param array $list An array of objects to filter
+ * @param array $args An array of key => value arguments to match against each object
+ * @param string $operator The logical operation to perform:
+ * 'AND' means all elements from the array must match;
+ * 'OR' means only one element needs to match;
+ * 'NOT' means no elements may match.
+ * The default is 'AND'.
+ * @return array
+ */
+function wp_list_filter( $list, $args = array(), $operator = 'AND' ) {
+ if ( ! is_array( $list ) )
+ return array();
+
+ if ( empty( $args ) )
+ return $list;
+
+ $operator = strtoupper( $operator );
+ $count = count( $args );
$filtered = array();
foreach ( $list as $key => $obj ) {
- $matched = count(array_intersect_assoc(get_object_vars($obj), $args));
- if ( ('and' == $operator && $matched == $count) || ('or' == $operator && $matched <= $count) ) {
- if ( $field )
- $filtered[] = $obj->$field;
- else
- $filtered[$key] = $obj;
+ $matched = count( array_intersect_assoc( (array) $obj, $args ) );
+ if ( ( 'AND' == $operator && $matched == $count )
+ || ( 'OR' == $operator && $matched <= $count )
+ || ( 'NOT' == $operator && 0 == $matched ) ) {
+ $filtered[$key] = $obj;
}
}
return $filtered;
}
+/**
+ * Pluck a certain field out of each object in a list
+ *
+ * @since 3.1.0
+ *
+ * @param array $list A list of objects or arrays
+ * @param int|string $field A field from the object to place instead of the entire object
+ * @return array
+ */
+function wp_list_pluck( $list, $field ) {
+ foreach ( $list as $key => $value ) {
+ $value = (array) $value;
+ $list[ $key ] = $value[ $field ];
+ }
+
+ return $list;
+}
+
/**
* Determines if default embed handlers should be loaded.
*
@@ -3071,24 +3155,6 @@ function wp_ob_end_flush_all() {
ob_end_flush();
}
-/**
- * Load the correct database class file.
- *
- * This function is used to load the database class file either at runtime or by
- * wp-admin/setup-config.php We must globalise $wpdb to ensure that it is
- * defined globally by the inline code in wp-db.php.
- *
- * @since 2.5.0
- * @global $wpdb WordPress Database Object
- */
-function require_wp_db() {
- global $wpdb;
- if ( file_exists( WP_CONTENT_DIR . '/db.php' ) )
- require_once( WP_CONTENT_DIR . '/db.php' );
- else
- require_once( ABSPATH . WPINC . '/wp-db.php' );
-}
-
/**
* Load custom DB error or display WordPress DB error.
*
@@ -3209,9 +3275,9 @@ function atom_service_url_filter($url)
* to get the backtrace up to what file and function called the deprecated
* function.
*
- * The current behavior is to trigger an user error if WP_DEBUG is true.
+ * The current behavior is to trigger a user error if WP_DEBUG is true.
*
- * This function is to be used in every function in depreceated.php
+ * This function is to be used in every function that is deprecated.
*
* @package WordPress
* @subpackage Debug
@@ -3247,9 +3313,9 @@ function _deprecated_function( $function, $version, $replacement=null ) {
* to get the backtrace up to what file and function included the deprecated
* file.
*
- * The current behavior is to trigger an user error if WP_DEBUG is true.
+ * The current behavior is to trigger a user error if WP_DEBUG is true.
*
- * This function is to be used in every file that is depreceated
+ * This function is to be used in every file that is deprecated.
*
* @package WordPress
* @subpackage Debug
@@ -3295,7 +3361,7 @@ function _deprecated_file( $file, $version, $replacement = null, $message = '' )
* to get the backtrace up to what file and function used the deprecated
* argument.
*
- * The current behavior is to trigger an user error if WP_DEBUG is true.
+ * The current behavior is to trigger a user error if WP_DEBUG is true.
*
* @package WordPress
* @subpackage Debug
@@ -3324,6 +3390,39 @@ function _deprecated_argument( $function, $version, $message = null ) {
}
}
+/**
+ * Marks something as being incorrectly called.
+ *
+ * There is a hook doing_it_wrong_run that will be called that can be used
+ * to get the backtrace up to what file and function called the deprecated
+ * function.
+ *
+ * The current behavior is to trigger a user error if WP_DEBUG is true.
+ *
+ * @package WordPress
+ * @subpackage Debug
+ * @since 3.1.0
+ * @access private
+ *
+ * @uses do_action() Calls 'doing_it_wrong_run' and passes the function arguments.
+ * @uses apply_filters() Calls 'doing_it_wrong_trigger_error' and expects boolean value of true to do
+ * trigger or false to not trigger error.
+ *
+ * @param string $function The function that was called.
+ * @param string $message A message explaining what has been done incorrectly.
+ * @param string $version The version of WordPress where the message was added.
+ */
+function _doing_it_wrong( $function, $message, $version ) {
+
+ do_action( 'doing_it_wrong_run', $function, $message, $version );
+
+ // Allow plugin to filter the output error trigger
+ if ( WP_DEBUG && apply_filters( 'doing_it_wrong_trigger_error', true ) ) {
+ $version = is_null( $version ) ? '' : sprintf( __( '(This message was added in version %s.)' ), $version );
+ trigger_error( sprintf( __( '%1$s was called incorrectly . %2$s %3$s' ), $function, $message, $version ) );
+ }
+}
+
/**
* Is the server running earlier than 1.5.0 version of lighttpd
*
@@ -3366,6 +3465,34 @@ function apache_mod_loaded($mod, $default = false) {
return $default;
}
+/**
+ * Check if IIS 7 supports pretty permalinks
+ *
+ * @since 2.8.0
+ *
+ * @return bool
+ */
+function iis7_supports_permalinks() {
+ global $is_iis7;
+
+ $supports_permalinks = false;
+ if ( $is_iis7 ) {
+ /* First we check if the DOMDocument class exists. If it does not exist,
+ * which is the case for PHP 4.X, then we cannot easily update the xml configuration file,
+ * hence we just bail out and tell user that pretty permalinks cannot be used.
+ * This is not a big issue because PHP 4.X is going to be depricated and for IIS it
+ * is recommended to use PHP 5.X NTS.
+ * Next we check if the URL Rewrite Module 1.1 is loaded and enabled for the web site. When
+ * URL Rewrite 1.1 is loaded it always sets a server variable called 'IIS_UrlRewriteModule'.
+ * Lastly we make sure that PHP is running via FastCGI. This is important because if it runs
+ * via ISAPI then pretty permalinks will not work.
+ */
+ $supports_permalinks = class_exists('DOMDocument') && isset($_SERVER['IIS_UrlRewriteModule']) && ( php_sapi_name() == 'cgi-fcgi' );
+ }
+
+ return apply_filters('iis7_supports_permalinks', $supports_permalinks);
+}
+
/**
* File validates against allowed set of defined rules.
*
@@ -3472,7 +3599,7 @@ function wp_guess_url() {
$schema = is_ssl() ? 'https://' : 'http://';
$url = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
}
- return $url;
+ return rtrim($url, '/');
}
/**
@@ -3785,7 +3912,7 @@ function get_site_transient( $transient ) {
function set_site_transient( $transient, $value, $expiration = 0 ) {
global $_wp_using_ext_object_cache;
- $value = apply_filters( 'pre_set_site_transient_' . $transient, $value );
+ $value = apply_filters( 'pre_set_site_transient_' . $transient, $value );
if ( $_wp_using_ext_object_cache ) {
$result = wp_cache_set( $transient, $value, 'site-transient', $expiration );
@@ -4136,29 +4263,21 @@ function wp_scheduled_delete() {
}
/**
- * Parse the file contents to retrieve its metadata.
- *
- * Searches for metadata for a file, such as a plugin or theme. Each piece of
- * metadata must be on its own line. For a field spanning multple lines, it
- * must not have any newlines or only parts of it will be displayed.
+ * Retrieve metadata from a file.
*
- * Some users have issues with opening large files and manipulating the contents
- * for want is usually the first 1kiB or 2kiB. This function stops pulling in
- * the file contents when it has all of the required data.
+ * Searches for metadata in the first 8kiB of a file, such as a plugin or theme.
+ * Each piece of metadata must be on its own line. Fields can not span multple
+ * lines, the value will get cut at the end of the first line.
*
- * The first 8kiB of the file will be pulled in and if the file data is not
- * within that first 8kiB, then the author should correct their plugin file
- * and move the data headers to the top.
+ * If the file data is not within that first 8kiB, then the author should correct
+ * their plugin file and move the data headers to the top.
*
- * The file is assumed to have permissions to allow for scripts to read
- * the file. This is not checked however and the file is only opened for
- * reading.
+ * @see http://codex.wordpress.org/File_Header
*
* @since 2.9.0
- *
* @param string $file Path to the file
- * @param bool $markup If the returned data should have HTML markup applied
- * @param string $context If specified adds filter hook "extra_<$context>_headers"
+ * @param array $default_headers List of headers, in the format array('HeaderKey' => 'Header Name')
+ * @param string $context If specified adds filter hook "extra_{$context}_headers"
*/
function get_file_data( $file, $default_headers, $context = '' ) {
// We don't need to write to the file, so just open for reading.
@@ -4171,20 +4290,19 @@ function get_file_data( $file, $default_headers, $context = '' ) {
fclose( $fp );
if ( $context != '' ) {
- $extra_headers = apply_filters( "extra_$context".'_headers', array() );
+ $extra_headers = apply_filters( "extra_{$context}_headers", array() );
$extra_headers = array_flip( $extra_headers );
foreach( $extra_headers as $key=>$value ) {
$extra_headers[$key] = $key;
}
- $all_headers = array_merge($extra_headers, $default_headers);
+ $all_headers = array_merge( $extra_headers, (array) $default_headers );
} else {
$all_headers = $default_headers;
}
-
foreach ( $all_headers as $field => $regex ) {
- preg_match( '/' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, ${$field});
+ preg_match( '/^[ \t\/*#]*' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, ${$field});
if ( !empty( ${$field} ) )
${$field} = _cleanup_header_comment( ${$field}[1] );
else
@@ -4195,7 +4313,8 @@ function get_file_data( $file, $default_headers, $context = '' ) {
return $file_data;
}
-/*
+
+/**
* Used internally to tidy up the search terms
*
* @access private
@@ -4297,4 +4416,70 @@ function _wp_mysql_week( $column ) {
}
}
+/**
+ * Finds hierarchy loops using a callback function that maps object IDs to parent IDs.
+ *
+ * @since 3.1.0
+ * @access private
+ *
+ * @param callback $callback function that accepts ( ID, $callback_args ) and outputs parent_ID
+ * @param int $start The ID to start the loop check at
+ * @param int $start_parent the parent_ID of $start to use instead of calling $callback( $start ). Use null to always use $callback
+ * @param array $callback_args optional additional arguments to send to $callback
+ * @return array IDs of all members of loop
+ */
+function wp_find_hierarchy_loop( $callback, $start, $start_parent, $callback_args = array() ) {
+ $override = is_null( $start_parent ) ? array() : array( $start => $start_parent );
+
+ if ( !$arbitrary_loop_member = wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override, $callback_args ) )
+ return array();
+
+ return wp_find_hierarchy_loop_tortoise_hare( $callback, $arbitrary_loop_member, $override, $callback_args, true );
+}
+
+/**
+ * Uses the "The Tortoise and the Hare" algorithm to detect loops.
+ *
+ * For every step of the algorithm, the hare takes two steps and the tortoise one.
+ * If the hare ever laps the tortoise, there must be a loop.
+ *
+ * @since 3.1.0
+ * @access private
+ *
+ * @param callback $callback function that accupts ( ID, callback_arg, ... ) and outputs parent_ID
+ * @param int $start The ID to start the loop check at
+ * @param array $override an array of ( ID => parent_ID, ... ) to use instead of $callback
+ * @param array $callback_args optional additional arguments to send to $callback
+ * @param bool $_return_loop Return loop members or just detect presence of loop?
+ * Only set to true if you already know the given $start is part of a loop
+ * (otherwise the returned array might include branches)
+ * @return mixed scalar ID of some arbitrary member of the loop, or array of IDs of all members of loop if $_return_loop
+ */
+function wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override = array(), $callback_args = array(), $_return_loop = false ) {
+ $tortoise = $hare = $evanescent_hare = $start;
+ $return = array();
+
+ // Set evanescent_hare to one past hare
+ // Increment hare two steps
+ while (
+ $tortoise
+ &&
+ ( $evanescent_hare = isset( $override[$hare] ) ? $override[$hare] : call_user_func_array( $callback, array_merge( array( $hare ), $callback_args ) ) )
+ &&
+ ( $hare = isset( $override[$evanescent_hare] ) ? $override[$evanescent_hare] : call_user_func_array( $callback, array_merge( array( $evanescent_hare ), $callback_args ) ) )
+ ) {
+ if ( $_return_loop )
+ $return[$tortoise] = $return[$evanescent_hare] = $return[$hare] = true;
+
+ // tortoise got lapped - must be a loop
+ if ( $tortoise == $evanescent_hare || $tortoise == $hare )
+ return $_return_loop ? $return : $tortoise;
+
+ // Increment tortoise by one step
+ $tortoise = isset( $override[$tortoise] ) ? $override[$tortoise] : call_user_func_array( $callback, array_merge( array( $tortoise ), $callback_args ) );
+ }
+
+ return false;
+}
+
?>
diff --git a/wp-includes/functions.wp-scripts.php b/wp-includes/functions.wp-scripts.php
index f284435e..af2055d3 100644
--- a/wp-includes/functions.wp-scripts.php
+++ b/wp-includes/functions.wp-scripts.php
@@ -42,7 +42,7 @@ function wp_print_scripts( $handles = false ) {
* @param string $src Script url
* @param array $deps (optional) Array of script names on which this script depends
* @param string|bool $ver (optional) Script version (used for cache busting), set to NULL to disable
- * @param bool (optional) Wether to enqueue the script before or before
+ * @param bool $in_footer (optional) Whether to enqueue the script before or before
* @return null
*/
function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_footer = false ) {
@@ -107,6 +107,20 @@ function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = false
$wp_scripts->enqueue( $handle );
}
+/**
+ * Remove an enqueued script.
+ *
+ * @since WP 3.1
+ * @see WP_Scripts::dequeue() For parameter information.
+ */
+function wp_dequeue_script( $handle ) {
+ global $wp_scripts;
+ if ( !is_a($wp_scripts, 'WP_Scripts') )
+ $wp_scripts = new WP_Scripts();
+
+ $wp_scripts->dequeue( $handle );
+}
+
/**
* Check whether script has been added to WordPress Scripts.
*
diff --git a/wp-includes/functions.wp-styles.php b/wp-includes/functions.wp-styles.php
index df4bd5ac..630a112d 100644
--- a/wp-includes/functions.wp-styles.php
+++ b/wp-includes/functions.wp-styles.php
@@ -105,6 +105,20 @@ function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false,
$wp_styles->enqueue( $handle );
}
+/**
+ * Remove an enqueued style.
+ *
+ * @since WP 3.1
+ * @see WP_Styles::dequeue() For parameter information.
+ */
+function wp_dequeue_style( $handle ) {
+ global $wp_styles;
+ if ( !is_a($wp_styles, 'WP_Styles') )
+ $wp_styles = new WP_Styles();
+
+ $wp_styles->dequeue( $handle );
+}
+
/**
* Check whether style has been added to WordPress Styles.
*
diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php
index 333d2642..19194f2f 100644
--- a/wp-includes/general-template.php
+++ b/wp-includes/general-template.php
@@ -151,7 +151,7 @@ function get_template_part( $slug, $name = null ) {
function get_search_form($echo = true) {
do_action( 'get_search_form' );
- $search_form_template = locate_template(array('searchform.php'));
+ $search_form_template = locate_template('searchform.php');
if ( '' != $search_form_template ) {
require($search_form_template);
return;
@@ -199,7 +199,7 @@ function wp_loginout($redirect = '', $echo = true) {
*
* Returns the URL that allows the user to log out of the site
*
- * @since 2.7
+ * @since 2.7.0
* @uses wp_nonce_url() To protect against CSRF
* @uses site_url() To generate the log in URL
* @uses apply_filters() calls 'logout_url' hook on final logout url
@@ -223,7 +223,7 @@ function wp_logout_url($redirect = '') {
*
* Returns the URL that allows the user to log in to the site
*
- * @since 2.7
+ * @since 2.7.0
* @uses site_url() To generate the log in URL
* @uses apply_filters() calls 'login_url' hook on final login url
*
@@ -271,7 +271,7 @@ function wp_login_form( $args = array() ) {
$form = '
- ' . apply_filters( 'login_form_top', '' ) . '
+ ' . apply_filters( 'login_form_top', '', $args ) . '
' . esc_html( $args['label_username'] ) . '
@@ -280,13 +280,13 @@ function wp_login_form( $args = array() ) {
' . esc_html( $args['label_password'] ) . '
- ' . apply_filters( 'login_form_middle', '' ) . '
+ ' . apply_filters( 'login_form_middle', '', $args ) . '
' . ( $args['remember'] ? ' ' . esc_html( $args['label_remember'] ) . '
' : '' ) . '
- ' . apply_filters( 'login_form_bottom', '' ) . '
+ ' . apply_filters( 'login_form_bottom', '', $args ) . '
';
if ( $args['echo'] )
@@ -381,7 +381,7 @@ function bloginfo( $show='' ) {
*
* The possible values for the 'show' parameter are listed below.
*
- * url - Blog URI to homepage.
+ * url - Blog URI to homepage.
* wpurl - Blog URI path to WordPress.
* description - Secondary title
*
@@ -491,6 +491,18 @@ function get_bloginfo( $show = '', $filter = 'raw' ) {
return $output;
}
+/**
+ * Retrieve the current blog id
+ *
+ * @since 3.1.0
+ *
+ * @return int Blog id
+ */
+function get_current_blog_id() {
+ global $blog_id;
+ return absint($blog_id);
+}
+
/**
* Display or retrieve page title for all areas of blog.
*
@@ -514,13 +526,8 @@ function get_bloginfo( $show = '', $filter = 'raw' ) {
* @return string|null String on retrieve, null when displaying.
*/
function wp_title($sep = '»', $display = true, $seplocation = '') {
- global $wpdb, $wp_locale, $wp_query;
+ global $wpdb, $wp_locale;
- $cat = get_query_var('cat');
- $tag = get_query_var('tag_id');
- $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');
@@ -530,51 +537,43 @@ function wp_title($sep = '»', $display = true, $seplocation = '') {
$t_sep = '%WP_TITILE_SEP%'; // Temporary separator, for accurate flipping, if necessary
- // If there's a category
- if ( !empty($cat) ) {
- // category exclusion
- if ( !stristr($cat,'-') )
- $title = apply_filters('single_cat_title', get_the_category_by_ID($cat));
- } elseif ( !empty($category_name) ) {
- if ( stristr($category_name,'/') ) {
- $category_name = explode('/',$category_name);
- if ( $category_name[count($category_name)-1] )
- $category_name = $category_name[count($category_name)-1]; // no trailing slash
- else
- $category_name = $category_name[count($category_name)-2]; // there was a trailling slash
- }
- $cat = get_term_by('slug', $category_name, 'category', OBJECT, 'display');
- if ( $cat )
- $title = apply_filters('single_cat_title', $cat->name);
+ // If there is a post
+ if ( is_single() || ( is_home() && !is_front_page() ) || ( is_page() && !is_front_page() ) ) {
+ $title = single_post_title( '', false );
}
- if ( !empty($tag) ) {
- $tag = get_term($tag, 'post_tag', OBJECT, 'display');
- if ( is_wp_error( $tag ) )
- return $tag;
- if ( ! empty($tag->name) )
- $title = apply_filters('single_tag_title', $tag->name);
+ // If there's a category or tag
+ if ( is_category() || is_tag() ) {
+ $title = single_term_title( '', false );
}
- // If there's an author
- if ( !empty($author) ) {
- $title = get_userdata($author);
- $title = $title->display_name;
+ // If there's a taxonomy
+ if ( is_tax() ) {
+ $term = get_queried_object();
+ $tax = get_taxonomy( $term->taxonomy );
+ $title = single_term_title( $tax->labels->name . $t_sep, false );
}
- if ( !empty($author_name) ) {
- // We do a direct query here because we don't cache by nicename.
- $title = $wpdb->get_var($wpdb->prepare("SELECT display_name FROM $wpdb->users WHERE user_nicename = %s", $author_name));
+
+ // If there's an author
+ if ( is_author() ) {
+ $author = get_queried_object();
+ $title = $author->display_name;
}
+ // If there's a post type archive
+ if ( is_post_type_archive() )
+ $title = post_type_archive_title( '', false );
+
// If there's a month
- if ( !empty($m) ) {
+ if ( is_archive() && !empty($m) ) {
$my_year = substr($m, 0, 4);
$my_month = $wp_locale->get_month(substr($m, 4, 2));
$my_day = intval(substr($m, 6, 2));
$title = $my_year . ($my_month ? $t_sep . $my_month : "") . ($my_day ? $t_sep . $my_day : "");
}
- if ( !empty($year) ) {
+ // If there's a year
+ if ( is_archive() && !empty($year) ) {
$title = $year;
if ( !empty($monthnum) )
$title .= $t_sep . $wp_locale->get_month($monthnum);
@@ -582,27 +581,13 @@ function wp_title($sep = '»', $display = true, $seplocation = '') {
$title .= $t_sep . zeroise($day, 2);
}
- // If there is a post
- if ( is_single() || ( is_home() && !is_front_page() ) || ( is_page() && !is_front_page() ) ) {
- $post = $wp_query->get_queried_object();
- $title = apply_filters( 'single_post_title', $post->post_title );
- }
-
- // If there's a taxonomy
- if ( is_tax() ) {
- $taxonomy = get_query_var( 'taxonomy' );
- $tax = get_taxonomy( $taxonomy );
- $term = $wp_query->get_queried_object();
- $term = $term->name;
- $title = $tax->labels->name . $t_sep . $term;
- }
-
- //If it's a search
+ // If it's a search
if ( is_search() ) {
/* translators: 1: separator, 2: search phrase */
$title = sprintf(__('Search Results %1$s %2$s'), $t_sep, strip_tags($search));
}
+ // If it's a 404 page
if ( is_404() ) {
$title = __('Page not found');
}
@@ -635,7 +620,6 @@ function wp_title($sep = '»', $display = true, $seplocation = '') {
* Display or retrieve page title for post.
*
* This is optimized for single.php template file for displaying the post title.
- * Only useful for posts, does not support pages for example.
*
* It does not support placing the separator after the title, but by leaving the
* prefix parameter empty, you can set the title separator manually. The prefix
@@ -643,19 +627,13 @@ function wp_title($sep = '»', $display = true, $seplocation = '') {
* be a space, the parameter value will need to have it at the end.
*
* @since 0.71
- * @uses $wpdb
*
* @param string $prefix Optional. What to display before the title.
* @param bool $display Optional, default is true. Whether to display or retrieve title.
* @return string|null Title when retrieving, null when displaying or failure.
*/
function single_post_title($prefix = '', $display = true) {
- global $wp_query, $post;
-
- if ( ! $post )
- $_post = $wp_query->get_queried_object();
- else
- $_post = $post;
+ $_post = get_queried_object();
if ( !isset($_post->post_title) )
return;
@@ -667,6 +645,31 @@ function single_post_title($prefix = '', $display = true) {
return $title;
}
+/**
+ * Display or retrieve title for a post type archive.
+ *
+ * This is optimized for archive.php and archive-{$post_type}.php template files
+ * for displaying the title of the post type.
+ *
+ * @since 3.1.0
+ *
+ * @param string $prefix Optional. What to display before the title.
+ * @param bool $display Optional, default is true. Whether to display or retrieve title.
+ * @return string|null Title when retrieving, null when displaying or failure.
+ */
+function post_type_archive_title( $prefix = '', $display = true ) {
+ if ( ! is_post_type_archive() )
+ return;
+
+ $post_type_obj = get_queried_object();
+ $title = apply_filters('post_type_archive_title', $post_type_obj->labels->name );
+
+ if ( $display )
+ echo $prefix . $title;
+ else
+ return $title;
+}
+
/**
* Display or retrieve page title for category archive.
*
@@ -684,23 +687,8 @@ function single_post_title($prefix = '', $display = true) {
* @param bool $display Optional, default is true. Whether to display or retrieve title.
* @return string|null Title when retrieving, null when displaying or failure.
*/
-function single_cat_title($prefix = '', $display = true ) {
- global $wp_query;
-
- if ( is_tag() )
- return single_tag_title($prefix, $display);
-
- if ( !is_category() )
- return;
-
- $cat = $wp_query->get_queried_object();
- $my_cat_name = apply_filters('single_cat_title', $cat->name);
- if ( !empty($my_cat_name) ) {
- if ( $display )
- echo $prefix . $my_cat_name;
- else
- return $my_cat_name;
- }
+function single_cat_title( $prefix = '', $display = true ) {
+ return single_term_title( $prefix, $display );
}
/**
@@ -720,23 +708,49 @@ function single_cat_title($prefix = '', $display = true ) {
* @param bool $display Optional, default is true. Whether to display or retrieve title.
* @return string|null Title when retrieving, null when displaying or failure.
*/
-function single_tag_title($prefix = '', $display = true ) {
- global $wp_query;
- if ( !is_tag() )
+function single_tag_title( $prefix = '', $display = true ) {
+ return single_term_title( $prefix, $display );
+}
+
+/**
+ * Display or retrieve page title for taxonomy term archive.
+ *
+ * Useful for taxonomy term template files for displaying the taxonomy term page title.
+ * It has less overhead than {@link wp_title()}, because of its limited implementation.
+ *
+ * It does not support placing the separator after the title, but by leaving the
+ * prefix parameter empty, you can set the title separator manually. The prefix
+ * does not automatically place a space between the prefix, so if there should
+ * be a space, the parameter value will need to have it at the end.
+ *
+ * @since 3.1.0
+ *
+ * @param string $prefix Optional. What to display before the title.
+ * @param bool $display Optional, default is true. Whether to display or retrieve title.
+ * @return string|null Title when retrieving, null when displaying or failure.
+ */
+function single_term_title( $prefix = '', $display = true ) {
+ $term = get_queried_object();
+
+ if ( !$term )
return;
- $tag = $wp_query->get_queried_object();
+ if ( is_category() )
+ $term_name = apply_filters( 'single_cat_title', $term->name );
+ elseif ( is_tag() )
+ $term_name = apply_filters( 'single_tag_title', $term->name );
+ elseif ( is_tax() )
+ $term_name = apply_filters( 'single_term_title', $term->name );
+ else
+ return;
- if ( ! $tag )
+ if ( empty( $term_name ) )
return;
- $my_tag_name = apply_filters('single_tag_title', $tag->name);
- if ( !empty($my_tag_name) ) {
- if ( $display )
- echo $prefix . $my_tag_name;
- else
- return $my_tag_name;
- }
+ if ( $display )
+ echo $prefix . $term_name;
+ else
+ return $term_name;
}
/**
@@ -1101,7 +1115,7 @@ function get_calendar($initial = true, $echo = true) {
// We need to get the month from MySQL
$thisyear = ''.intval(substr($m, 0, 4));
$d = (($w - 1) * 7) + 6; //it seems MySQL's weeks disagree with PHP's
- $thismonth = $wpdb->get_var("SELECT DATE_FORMAT((DATE_ADD('${thisyear}0101', INTERVAL $d DAY) ), '%m')");
+ $thismonth = $wpdb->get_var("SELECT DATE_FORMAT((DATE_ADD('{$thisyear}0101', INTERVAL $d DAY) ), '%m')");
} elseif ( !empty($m) ) {
$thisyear = ''.intval(substr($m, 0, 4));
if ( strlen($m) < 6 )
@@ -1114,20 +1128,20 @@ function get_calendar($initial = true, $echo = true) {
}
$unixmonth = mktime(0, 0 , 0, $thismonth, 1, $thisyear);
+ $last_day = date('t', $unixmonth);
// Get the next and previous month and year with at least one post
- $previous = $wpdb->get_row("SELECT DISTINCT MONTH(post_date) AS month, YEAR(post_date) AS year
+ $previous = $wpdb->get_row("SELECT MONTH(post_date) AS month, YEAR(post_date) AS year
FROM $wpdb->posts
WHERE post_date < '$thisyear-$thismonth-01'
AND post_type = 'post' AND post_status = 'publish'
ORDER BY post_date DESC
LIMIT 1");
- $next = $wpdb->get_row("SELECT DISTINCT MONTH(post_date) AS month, YEAR(post_date) AS year
+ $next = $wpdb->get_row("SELECT MONTH(post_date) AS month, YEAR(post_date) AS year
FROM $wpdb->posts
- WHERE post_date > '$thisyear-$thismonth-01'
- AND MONTH( post_date ) != MONTH( '$thisyear-$thismonth-01' )
+ WHERE post_date > '$thisyear-$thismonth-{$last_day} 23:59:59'
AND post_type = 'post' AND post_status = 'publish'
- ORDER BY post_date ASC
+ ORDER BY post_date ASC
LIMIT 1");
/* translators: Calendar caption: 1: month name, 2: 4-digit year */
@@ -1157,7 +1171,7 @@ function get_calendar($initial = true, $echo = true) {
';
if ( $previous ) {
- $calendar_output .= "\n\t\t".'« ' . $wp_locale->get_month_abbrev($wp_locale->get_month($previous->month)) . ' ';
+ $calendar_output .= "\n\t\t".'« ' . $wp_locale->get_month_abbrev($wp_locale->get_month($previous->month)) . ' ';
} else {
$calendar_output .= "\n\t\t".' ';
}
@@ -1179,10 +1193,9 @@ function get_calendar($initial = true, $echo = true) {
// Get days with posts
$dayswithposts = $wpdb->get_results("SELECT DISTINCT DAYOFMONTH(post_date)
- FROM $wpdb->posts WHERE MONTH(post_date) = '$thismonth'
- AND YEAR(post_date) = '$thisyear'
+ FROM $wpdb->posts WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00'
AND post_type = 'post' AND post_status = 'publish'
- AND post_date < '" . current_time('mysql') . '\'', ARRAY_N);
+ AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59'", ARRAY_N);
if ( $dayswithposts ) {
foreach ( (array) $dayswithposts as $daywith ) {
$daywithpost[] = $daywith[0];
@@ -1199,9 +1212,8 @@ function get_calendar($initial = true, $echo = true) {
$ak_titles_for_day = array();
$ak_post_titles = $wpdb->get_results("SELECT ID, post_title, DAYOFMONTH(post_date) as dom "
."FROM $wpdb->posts "
- ."WHERE YEAR(post_date) = '$thisyear' "
- ."AND MONTH(post_date) = '$thismonth' "
- ."AND post_date < '".current_time('mysql')."' "
+ ."WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00' "
+ ."AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59' "
."AND post_type = 'post' AND post_status = 'publish'"
);
if ( $ak_post_titles ) {
@@ -1318,7 +1330,7 @@ function the_date_xml() {
*
* Will only output the date if the current post's date is different from the
* previous one output.
-
+ *
* i.e. Only one date listing will show per day worth of posts shown in the loop, even if the
* function is called several times for each post.
*
@@ -1334,13 +1346,13 @@ function the_date_xml() {
* @return string|null Null if displaying, string if retrieving.
*/
function the_date( $d = '', $before = '', $after = '', $echo = true ) {
- global $day, $previousday;
+ global $currentday, $previousday;
$the_date = '';
- if ( $day != $previousday ) {
+ if ( $currentday != $previousday ) {
$the_date .= $before;
$the_date .= get_the_date( $d );
$the_date .= $after;
- $previousday = $day;
+ $previousday = $currentday;
$the_date = apply_filters('the_date', $the_date, $d, $before, $after);
@@ -1542,15 +1554,15 @@ function the_weekday() {
*
* @param string $before Optional Output before the date.
* @param string $after Optional Output after the date.
- */
+ */
function the_weekday_date($before='',$after='') {
global $wp_locale, $post, $day, $previousweekday;
$the_weekday_date = '';
- if ( $day != $previousweekday ) {
+ if ( $currentday != $previousweekday ) {
$the_weekday_date .= $before;
$the_weekday_date .= $wp_locale->get_weekday(mysql2date('w', $post->post_date, false));
$the_weekday_date .= $after;
- $previousweekday = $day;
+ $previousweekday = $currentday;
}
$the_weekday_date = apply_filters('the_weekday_date', $the_weekday_date, $before, $after);
echo $the_weekday_date;
@@ -1635,16 +1647,15 @@ function feed_links_extra( $args = array() ) {
$href = get_post_comments_feed_link( $post->ID );
}
} elseif ( is_category() ) {
- $cat_id = intval( get_query_var('cat') );
+ $term = get_queried_object();
- $title = esc_attr(sprintf( $args['cattitle'], get_bloginfo('name'), $args['separator'], get_cat_name( $cat_id ) ));
- $href = get_category_feed_link( $cat_id );
+ $title = esc_attr(sprintf( $args['cattitle'], get_bloginfo('name'), $args['separator'], $term->name ));
+ $href = get_category_feed_link( $term->term_id );
} elseif ( is_tag() ) {
- $tag_id = intval( get_query_var('tag_id') );
- $tag = get_tag( $tag_id );
+ $term = get_queried_object();
- $title = esc_attr(sprintf( $args['tagtitle'], get_bloginfo('name'), $args['separator'], $tag->name ));
- $href = get_tag_feed_link( $tag_id );
+ $title = esc_attr(sprintf( $args['tagtitle'], get_bloginfo('name'), $args['separator'], $term->name ));
+ $href = get_tag_feed_link( $term->term_id );
} elseif ( is_author() ) {
$author_id = intval( get_query_var('author') );
@@ -2039,7 +2050,7 @@ function paginate_links( $args = '' ) {
* @param string $key The unique key for this theme.
* @param string $name The name of the theme.
* @param string $url The url of the css file containing the colour scheme.
- * @param array @colors Optional An array of CSS color definitions which are used to give the user a feel for the theme.
+ * @param array $colors Optional An array of CSS color definitions which are used to give the user a feel for the theme.
*/
function wp_admin_css_color($key, $name, $url, $colors = array()) {
global $_wp_admin_css_colors;
@@ -2056,8 +2067,11 @@ function wp_admin_css_color($key, $name, $url, $colors = array()) {
* @since 3.0.0
*/
function register_admin_color_schemes() {
- wp_admin_css_color('classic', __('Blue'), admin_url("css/colors-classic.css"), array('#073447', '#21759B', '#EAF3FA', '#BBD8E7'));
- wp_admin_css_color('fresh', __('Gray'), admin_url("css/colors-fresh.css"), array('#464646', '#6D6D6D', '#F1F1F1', '#DFDFDF'));}
+ wp_admin_css_color( 'classic', __( 'Blue' ), admin_url( 'css/colors-classic.css' ),
+ array( '#5589aa', '#cfdfe9', '#d1e5ee', '#eff8ff' ) );
+ wp_admin_css_color( 'fresh', __( 'Gray' ), admin_url( 'css/colors-fresh.css' ),
+ array( '#7c7976', '#c6c6c6', '#e0e0e0', '#f1f1f1' ) );
+}
/**
* Display the URL of a WordPress admin CSS file.
@@ -2097,7 +2111,8 @@ function wp_admin_css_uri( $file = 'wp-admin' ) {
* @since 2.3.0
* @uses $wp_styles WordPress Styles Object
*
- * @param string $file Style handle name or file name (without ".css" extension) relative to wp-admin/
+ * @param string $file Optional. Style handle name or file name (without ".css" extension) relative
+ * to wp-admin/. Defaults to 'wp-admin'.
* @param bool $force_echo Optional. Force the stylesheet link to be printed rather than enqueued.
*/
function wp_admin_css( $file = 'wp-admin', $force_echo = false ) {
@@ -2133,6 +2148,9 @@ function wp_admin_css( $file = 'wp-admin', $force_echo = false ) {
function add_thickbox() {
wp_enqueue_script( 'thickbox' );
wp_enqueue_style( 'thickbox' );
+
+ if ( is_network_admin() )
+ add_action( 'admin_head', '_thickbox_path_admin_subfolder' );
}
/**
@@ -2219,7 +2237,7 @@ function get_the_generator( $type = '' ) {
$gen = '';
break;
case 'export':
- $gen = '';
+ $gen = '';
break;
}
return apply_filters( "get_the_generator_{$type}", $gen, $type );
@@ -2230,7 +2248,7 @@ function get_the_generator( $type = '' ) {
*
* Compares the first two arguments and if identical marks as checked
*
- * @since 1.0
+ * @since 1.0.0
*
* @param mixed $checked One of the values to compare
* @param mixed $current (true) The other value to compare if not just true
@@ -2246,9 +2264,9 @@ function checked( $checked, $current = true, $echo = true ) {
*
* Compares the first two arguments and if identical marks as selected
*
- * @since 1.0
+ * @since 1.0.0
*
- * @param mixed selected One of the values to compare
+ * @param mixed $selected One of the values to compare
* @param mixed $current (true) The other value to compare if not just true
* @param bool $echo Whether to echo or just return the string
* @return string html attribute or empty string
@@ -2278,7 +2296,7 @@ function disabled( $disabled, $current = true, $echo = true ) {
*
* Compares the first two arguments and if identical marks as $type
*
- * @since 2.8
+ * @since 2.8.0
* @access private
*
* @param any $helper One of the values to compare
diff --git a/wp-includes/images/admin-bar-sprite-rtl.png b/wp-includes/images/admin-bar-sprite-rtl.png
new file mode 100644
index 0000000000000000000000000000000000000000..f49aae7a01741631161df6df5e3175afeea69406
GIT binary patch
literal 732
zcmV<20wev2P)mLPTr32Bbtv|ALaF?MwUqcl-G
z(ywy;cDX*LQBxHFz&B2d#R5?C`TRDzMC)C1dkq~?K?uNVHk$zoi)m~(HaVJ?)^qD<
ztq3)lOu%S5oq|0#9`(68pFY$Rp~mAej7Fn7**?Z}9#_xxq!OW|1fxiHTCGB@Rs$SOY|Hqx&Yp8V?MZ#tp3&p0R4P%@9wpDt*?AgE
zbDuqKUvzE*2_O!P`yd>oq))E|TvRTX@5K3LGds5H>|9(Ay7unnSt^xoNsNtbkIPGv
zYAK-caAbdG3WWmLDi({8sBdzvSXw9b##sD8=9>9#^ynIz6QT0?JfN_M#&qOrsklCp
z9)fZKNT6{*T)h)2m&_%%ZYDK+1=bsi`&4w}xVg*cJP|6J
z&BC+7#;>dwp^}tBDU?DfltL-ge+RW(E+ehiYgBr(+58TI;QKp3rB>@DB1HA-d^mZFrGZ|pqKO+J#B6=2zEUZr;~ns
z0bZ}nZ3fTk=p_zyz4z^}x0=*jKwZHyc-=B{eI+QALMfC&DU?F}J^cYm?HP(~ver%j
O0000hl^Y&TDOJs!F8-D0Jv3*+wp(+f=SK%osmD
z+T14I$ObF{xj=c{*Na{*mjT7^%EalsH1b;N+j>axn@>WiREj6eNQE&fTU-*&mFj5h
z?&Dc37NJlm#6p|;lFU4>lWblm&53_A(t^G)kL0SsnDq}ipU;C$SS;DDJnHk2+ul&N
z1#Do_!mgX}g39G`;3I58M^}z-zeG?z0KPZj($l|G(#6dqa^-kKNex^J`}z`~6)Ky}
z!tV+jKT~govQ4C^02QDDRDcRl0V+WK&Bc{^+ithZ&1UnerB$dbKQO*@ZEgH%pcb<}T*4%`BNe6J0dK
zFh~cw0i`ieDg8CpgV1)grBK>)_I^h$%ue#0obUaf=Q;2DeecWJ&-CGcPcz{o!d}9b
zwb%qL}N`Q_PZT$+iPaJ`)(=mR5nQb
zw+VT{xa%!u@Rg(5@XD2s4_nV)9X1a>3}YdagRB4?$0LfYI^|7O6aZfZ+Quu9^QpoGy`NsSrGUV=cTzuuo!*W=N7Fb&f(1G~Gf+CCDRM|2^B
z7PAq$GA%ek1J6txilSiOCJP+~k60?J8Vm>K(6phlfj(>1BB>@$)U3n6^b=?V9($V1
zfFi?IrBwxO^(K@H3f5O>5t&aTG?#?Hb8Jgs2GK`SB4{<~;fW;a
^AYD;R&AqV)85)n>v(AcEhA
z{sH^f8(SQ3+AJ6to5G$}E0~7DcbP%&ZC}XUUSIjhT2&5DIH9Kf$?I+SJ2Z!2VhPD?
z4x6nT@GP5$QLn>+t*w5hA=)Ko;G?_$`TgFTnKS#EGV#S_S$7w^56InmdjCC!ga%dgEu&y19sJNEU}*vV~{KtTqkrA6qC>rrE=gOrn5OQOSW
z3LO9TW`uD`bCwC!SzyETQ}=c>oc&H6rh`tK_ucju-A>2LHb(LUo`ioHonE}{3%l7c
z1uuMf@%ZHj&xeWi4xya&3&B|7-0iAxbsiB7CRZVyu&5(jQTe!#dN!G!9J-eF4Np>t
gwPcEr`A>iW0C727`Ns`5r2qf`07*qoM6N<$f0)){autosave()}if(tinyMCE.activeEditor&&!tinyMCE.activeEditor.isHidden()&&a){c.preventDefault();a=false;tinyMCE.activeEditor.focus();return false}}})}if("1"==b("#auto_draft").val()){b("#title").blur(function(){if(!this.value||b("#auto_draft").val()!="1"){return}delayed_autosave()})}});function autosave_parse_response(c){var e=wpAjax.parseAjaxResponse(c,"autosave"),f="",a,b,d;if(e&&e.responses&&e.responses.length){f=e.responses[0].data;if(e.responses[0].supplemental){b=e.responses[0].supplemental;if("disable"==b.disable_autosave){autosave=function(){};e={errors:true}}if(b.session_expired&&(d=b.session_expired)){if(!interimLogin||interimLogin.closed){interimLogin=window.open(d,"login","width=600,height=450,resizable=yes,scrollbars=yes,status=yes");interimLogin.focus()}delete b.session_expired}jQuery.each(b,function(g,h){if(g.match(/^replace-/)){jQuery("#"+g.replace("replace-","")).val(h)}})}if(!e.errors){a=parseInt(e.responses[0].id,10);if(!isNaN(a)&&a>0){autosave_update_slug(a)}}}if(f){jQuery("#autosave").html(f)}else{if(autosaveOldMessage&&e){jQuery("#autosave").html(autosaveOldMessage)}}return e}function autosave_saved(a){blockSave=false;autosave_parse_response(a);autosave_enable_buttons()}function autosave_saved_new(b){blockSave=false;var d=autosave_parse_response(b),c,a;if(d&&d.responses.length&&!d.errors){a=parseInt(d.responses[0].id,10);if(!isNaN(a)&&a>0){notSaved=false;jQuery("#auto_draft").val("0")}autosave_enable_buttons();if(autosaveDelayPreview){autosaveDelayPreview=false;doPreview()}}else{autosave_enable_buttons()}}function autosave_update_slug(a){if("undefined"!=makeSlugeditClickable&&jQuery.isFunction(makeSlugeditClickable)&&!jQuery("#edit-slug-box > *").size()){jQuery.post(ajaxurl,{action:"sample-permalink",post_id:a,new_title:jQuery("#title").val(),samplepermalinknonce:jQuery("#samplepermalinknonce").val()},function(b){jQuery("#edit-slug-box").html(b);makeSlugeditClickable()})}}function autosave_loading(){jQuery("#autosave").html(autosaveL10n.savingText)}function autosave_enable_buttons(){setTimeout(function(){jQuery(":button, :submit","#submitpost").removeAttr("disabled");jQuery("#ajax-loading").css("visibility","hidden")},500)}function autosave_disable_buttons(){jQuery(":button, :submit","#submitpost").attr("disabled","disabled");setTimeout(autosave_enable_buttons,5000)}function delayed_autosave(){setTimeout(function(){if(blockSave){return}autosave()},200)}autosave=function(){blockSave=true;var c=(typeof tinyMCE!="undefined")&&tinyMCE.activeEditor&&!tinyMCE.activeEditor.isHidden(),d,f,b,e,a;autosave_disable_buttons();d={action:"autosave",post_ID:jQuery("#post_ID").val()||0,post_title:jQuery("#title").val()||"",autosavenonce:jQuery("#autosavenonce").val(),post_type:jQuery("#post_type").val()||"",autosave:1};jQuery(".tags-input").each(function(){d[this.name]=this.value});f=true;if(jQuery("#TB_window").css("display")=="block"){f=false}if(c&&f){b=tinyMCE.activeEditor;if(b.plugins.spellchecker&&b.plugins.spellchecker.active){f=false}else{if("mce_fullscreen"==b.id){tinyMCE.get("content").setContent(b.getContent({format:"raw"}),{format:"raw"})}tinyMCE.get("content").save()}}d.content=jQuery("#content").val();if(jQuery("#post_name").val()){d.post_name=jQuery("#post_name").val()}if((d.post_title.length==0&&d.content.length==0)||d.post_title+d.content==autosaveLast){f=false}e=jQuery("#original_post_status").val();goodcats=([]);jQuery("[name='post_category[]']:checked").each(function(g){goodcats.push(this.value)});d.catslist=goodcats.join(",");if(jQuery("#comment_status").attr("checked")){d.comment_status="open"}if(jQuery("#ping_status").attr("checked")){d.ping_status="open"}if(jQuery("#excerpt").size()){d.excerpt=jQuery("#excerpt").val()}if(jQuery("#post_author").size()){d.post_author=jQuery("#post_author").val()}if(jQuery("#parent_id").val()){d.parent_id=jQuery("#parent_id").val()}d.user_ID=jQuery("#user-id").val();if(jQuery("#auto_draft").val()=="1"){d.auto_draft="1"}if(f){autosaveLast=jQuery("#title").val()+jQuery("#content").val()}else{d.autosave=0}if(d.auto_draft=="1"){a=autosave_saved_new}else{a=autosave_saved}autosaveOldMessage=jQuery("#autosave").html();jQuery.ajax({data:d,beforeSend:f?autosave_loading:null,type:"POST",url:autosaveL10n.requestFile,success:a})};
\ No newline at end of file
+var autosave,autosaveLast="",autosavePeriodical,autosaveOldMessage="",autosaveDelayPreview=false,notSaved=true,blockSave=false,interimLogin=false;jQuery(document).ready(function(b){var a=true;autosaveLast=b("#post #title").val()+b("#post #content").val();autosavePeriodical=b.schedule({time:autosaveL10n.autosaveInterval*1000,func:function(){autosave()},repeat:true,protect:true});b("#post").submit(function(){b.cancel(autosavePeriodical)});b('input[type="submit"], a.submitdelete',"#submitpost").click(function(){blockSave=true;window.onbeforeunload=null;b(":button, :submit","#submitpost").each(function(){var c=b(this);if(c.hasClass("button-primary")){c.addClass("button-primary-disabled")}else{c.addClass("button-disabled")}});if(b(this).attr("id")=="publish"){b("#ajax-loading").css("visibility","visible")}else{b("#draft-ajax-loading").css("visibility","visible")}});window.onbeforeunload=function(){var c=typeof(tinyMCE)!="undefined"?tinyMCE.activeEditor:false,e,d;if(c&&!c.isHidden()){if(c.isDirty()){return autosaveL10n.saveAlert}}else{e=b("#post #title").val(),d=b("#post #content").val();if((e||d)&&e+d!=autosaveLast){return autosaveL10n.saveAlert}}};b("#post-preview").click(function(){if(b("#auto_draft").val()=="1"&¬Saved){autosaveDelayPreview=true;autosave();return false}doPreview();return false});doPreview=function(){b("input#wp-preview").val("dopreview");b("form#post").attr("target","wp-preview").submit().attr("target","");b("input#wp-preview").val("")};if(typeof tinyMCE!="undefined"){b("#title")[b.browser.opera?"keypress":"keydown"](function(c){if(c.which==9&&!c.shiftKey&&!c.controlKey&&!c.altKey){if((b("#auto_draft").val()=="1")&&(b("#title").val().length>0)){autosave()}if(tinyMCE.activeEditor&&!tinyMCE.activeEditor.isHidden()&&a){c.preventDefault();a=false;tinyMCE.activeEditor.focus();return false}}})}if("1"==b("#auto_draft").val()){b("#title").blur(function(){if(!this.value||b("#auto_draft").val()!="1"){return}delayed_autosave()})}});function autosave_parse_response(c){var e=wpAjax.parseAjaxResponse(c,"autosave"),f="",a,b,d;if(e&&e.responses&&e.responses.length){f=e.responses[0].data;if(e.responses[0].supplemental){b=e.responses[0].supplemental;if("disable"==b.disable_autosave){autosave=function(){};e={errors:true}}if(b.session_expired&&(d=b.session_expired)){if(!interimLogin||interimLogin.closed){interimLogin=window.open(d,"login","width=600,height=450,resizable=yes,scrollbars=yes,status=yes");interimLogin.focus()}delete b.session_expired}jQuery.each(b,function(g,h){if(g.match(/^replace-/)){jQuery("#"+g.replace("replace-","")).val(h)}})}if(!e.errors){a=parseInt(e.responses[0].id,10);if(!isNaN(a)&&a>0){autosave_update_slug(a)}}}if(f){jQuery("#autosave").html(f)}else{if(autosaveOldMessage&&e){jQuery("#autosave").html(autosaveOldMessage)}}return e}function autosave_saved(a){blockSave=false;autosave_parse_response(a);autosave_enable_buttons()}function autosave_saved_new(b){blockSave=false;var d=autosave_parse_response(b),c,a;if(d&&d.responses.length&&!d.errors){a=parseInt(d.responses[0].id,10);if(!isNaN(a)&&a>0){notSaved=false;jQuery("#auto_draft").val("0")}autosave_enable_buttons();if(autosaveDelayPreview){autosaveDelayPreview=false;doPreview()}}else{autosave_enable_buttons()}}function autosave_update_slug(a){if("undefined"!=makeSlugeditClickable&&jQuery.isFunction(makeSlugeditClickable)&&!jQuery("#edit-slug-box > *").size()){jQuery.post(ajaxurl,{action:"sample-permalink",post_id:a,new_title:jQuery("#title").val(),samplepermalinknonce:jQuery("#samplepermalinknonce").val()},function(b){jQuery("#edit-slug-box").html(b);makeSlugeditClickable()})}}function autosave_loading(){jQuery("#autosave").html(autosaveL10n.savingText)}function autosave_enable_buttons(){setTimeout(function(){jQuery(":button, :submit","#submitpost").removeAttr("disabled");jQuery(".ajax-loading").css("visibility","hidden")},500)}function autosave_disable_buttons(){jQuery(":button, :submit","#submitpost").attr("disabled","disabled");setTimeout(autosave_enable_buttons,5000)}function delayed_autosave(){setTimeout(function(){if(blockSave){return}autosave()},200)}autosave=function(){blockSave=true;var c=(typeof tinyMCE!="undefined")&&tinyMCE.activeEditor&&!tinyMCE.activeEditor.isHidden(),d,f,b,e,a;autosave_disable_buttons();d={action:"autosave",post_ID:jQuery("#post_ID").val()||0,post_title:jQuery("#title").val()||"",autosavenonce:jQuery("#autosavenonce").val(),post_type:jQuery("#post_type").val()||"",autosave:1};jQuery(".tags-input").each(function(){d[this.name]=this.value});f=true;if(jQuery("#TB_window").css("display")=="block"){f=false}if(c&&f){b=tinyMCE.activeEditor;if(b.plugins.spellchecker&&b.plugins.spellchecker.active){f=false}else{if("mce_fullscreen"==b.id){tinyMCE.get("content").setContent(b.getContent({format:"raw"}),{format:"raw"})}tinyMCE.get("content").save()}}d.content=jQuery("#content").val();if(jQuery("#post_name").val()){d.post_name=jQuery("#post_name").val()}if((d.post_title.length==0&&d.content.length==0)||d.post_title+d.content==autosaveLast){f=false}e=jQuery("#original_post_status").val();goodcats=([]);jQuery("[name='post_category[]']:checked").each(function(g){goodcats.push(this.value)});d.catslist=goodcats.join(",");if(jQuery("#comment_status").attr("checked")){d.comment_status="open"}if(jQuery("#ping_status").attr("checked")){d.ping_status="open"}if(jQuery("#excerpt").size()){d.excerpt=jQuery("#excerpt").val()}if(jQuery("#post_author").size()){d.post_author=jQuery("#post_author").val()}if(jQuery("#parent_id").val()){d.parent_id=jQuery("#parent_id").val()}d.user_ID=jQuery("#user-id").val();if(jQuery("#auto_draft").val()=="1"){d.auto_draft="1"}if(f){autosaveLast=jQuery("#title").val()+jQuery("#content").val()}else{d.autosave=0}if(d.auto_draft=="1"){a=autosave_saved_new}else{a=autosave_saved}autosaveOldMessage=jQuery("#autosave").html();jQuery.ajax({data:d,beforeSend:f?autosave_loading:null,type:"POST",url:autosaveL10n.requestFile,success:a})};
\ No newline at end of file
diff --git a/wp-includes/js/imgareaselect/jquery.imgareaselect.js b/wp-includes/js/imgareaselect/jquery.imgareaselect.js
index aabbcca1..9f2aee24 100644
--- a/wp-includes/js/imgareaselect/jquery.imgareaselect.js
+++ b/wp-includes/js/imgareaselect/jquery.imgareaselect.js
@@ -1 +1 @@
-(function($){var abs=Math.abs,max=Math.max,min=Math.min,round=Math.round;function div(){return $('
')}$.imgAreaSelect=function(img,options){var $img=$(img),imgLoaded,$box=div(),$area=div(),$border=div().add(div()).add(div()).add(div()),$outer=div().add(div()).add(div()).add(div()),$handles=$([]),$areaOpera,left,top,imgOfs,imgWidth,imgHeight,$parent,parOfs,zIndex=0,position='absolute',startX,startY,scaleX,scaleY,resizeMargin=10,resize,aspectRatio,shown,x1,y1,x2,y2,selection={x1:0,y1:0,x2:0,y2:0,width:0,height:0},$p,d,i,o,w,h,adjusted;function viewX(x){return x+imgOfs.left-parOfs.left}function viewY(y){return y+imgOfs.top-parOfs.top}function selX(x){return x-imgOfs.left+parOfs.left}function selY(y){return y-imgOfs.top+parOfs.top}function evX(event){return event.pageX-parOfs.left}function evY(event){return event.pageY-parOfs.top}function getSelection(noScale){var sx=noScale||scaleX,sy=noScale||scaleY;return{x1:round(selection.x1*sx),y1:round(selection.y1*sy),x2:round(selection.x2*sx),y2:round(selection.y2*sy),width:round(selection.x2*sx)-round(selection.x1*sx),height:round(selection.y2*sy)-round(selection.y1*sy)}}function setSelection(x1,y1,x2,y2,noScale){var sx=noScale||scaleX,sy=noScale||scaleY;selection={x1:round(x1/sx),y1:round(y1/sy),x2:round(x2/sx),y2:round(y2/sy)};selection.width=(x2=viewX(selection.x2))-(x1=viewX(selection.x1));selection.height=(y2=viewX(selection.y2))-(y1=viewX(selection.y1))}function adjust(){if(!$img.width())return;imgOfs={left:round($img.offset().left),top:round($img.offset().top)};imgWidth=$img.width();imgHeight=$img.height();if($().jquery=='1.3.2'&&$.browser.safari&&position=='fixed'){imgOfs.top+=max(document.documentElement.scrollTop,$('body').scrollTop());imgOfs.left+=max(document.documentElement.scrollLeft,$('body').scrollLeft())}parOfs=$.inArray($parent.css('position'),['absolute','relative'])+1?{left:round($parent.offset().left)-$parent.scrollLeft(),top:round($parent.offset().top)-$parent.scrollTop()}:position=='fixed'?{left:$(document).scrollLeft(),top:$(document).scrollTop()}:{left:0,top:0};left=viewX(0);top=viewY(0)}function update(resetKeyPress){if(!shown)return;$box.css({left:viewX(selection.x1),top:viewY(selection.y1)}).add($area).width(w=selection.width).height(h=selection.height);$area.add($border).add($handles).css({left:0,top:0});$border.width(max(w-$border.outerWidth()+$border.innerWidth(),0)).height(max(h-$border.outerHeight()+$border.innerHeight(),0));$($outer[0]).css({left:left,top:top,width:selection.x1,height:imgHeight});$($outer[1]).css({left:left+selection.x1,top:top,width:w,height:selection.y1});$($outer[2]).css({left:left+selection.x2,top:top,width:imgWidth-selection.x2,height:imgHeight});$($outer[3]).css({left:left+selection.x1,top:top+selection.y2,width:w,height:imgHeight-selection.y2});w-=$handles.outerWidth();h-=$handles.outerHeight();switch($handles.length){case 8:$($handles[4]).css({left:w/2});$($handles[5]).css({left:w,top:h/2});$($handles[6]).css({left:w/2,top:h});$($handles[7]).css({top:h/2});case 4:$handles.slice(1,3).css({left:w});$handles.slice(2,4).css({top:h})}if(resetKeyPress!==false){if($.imgAreaSelect.keyPress!=docKeyPress)$(document).unbind($.imgAreaSelect.keyPress,$.imgAreaSelect.onKeyPress);if(options.keys)$(document)[$.imgAreaSelect.keyPress]($.imgAreaSelect.onKeyPress=docKeyPress)}if($.browser.msie&&$border.outerWidth()-$border.innerWidth()==2){$border.css('margin',0);setTimeout(function(){$border.css('margin','auto')},0)}}function doUpdate(resetKeyPress){adjust();update(resetKeyPress);x1=viewX(selection.x1);y1=viewY(selection.y1);x2=viewX(selection.x2);y2=viewY(selection.y2)}function hide($elem,fn){options.fadeSpeed?$elem.fadeOut(options.fadeSpeed,fn):$elem.hide()}function areaMouseMove(event){var x=selX(evX(event))-selection.x1,y=selY(evY(event))-selection.y1;if(!adjusted){adjust();adjusted=true;$box.one('mouseout',function(){adjusted=false})}resize='';if(options.resizable){if(y<=resizeMargin)resize='n';else if(y>=selection.height-resizeMargin)resize='s';if(x<=resizeMargin)resize+='w';else if(x>=selection.width-resizeMargin)resize+='e'}$box.css('cursor',resize?resize+'-resize':options.movable?'move':'');if($areaOpera)$areaOpera.toggle()}function docMouseUp(event){$('body').css('cursor','');if(options.autoHide||selection.width*selection.height==0)hide($box.add($outer),function(){$(this).hide()});options.onSelectEnd(img,getSelection());$(document).unbind('mousemove',selectingMouseMove);$box.mousemove(areaMouseMove)}function areaMouseDown(event){if(event.which!=1)return false;adjust();if(resize){$('body').css('cursor',resize+'-resize');x1=viewX(selection[/w/.test(resize)?'x2':'x1']);y1=viewY(selection[/n/.test(resize)?'y2':'y1']);$(document).mousemove(selectingMouseMove).one('mouseup',docMouseUp);$box.unbind('mousemove',areaMouseMove)}else if(options.movable){startX=left+selection.x1-evX(event);startY=top+selection.y1-evY(event);$box.unbind('mousemove',areaMouseMove);$(document).mousemove(movingMouseMove).one('mouseup',function(){options.onSelectEnd(img,getSelection());$(document).unbind('mousemove',movingMouseMove);$box.mousemove(areaMouseMove)})}else $img.mousedown(event);return false}function aspectRatioXY(){x2=max(left,min(left+imgWidth,x1+abs(y2-y1)*aspectRatio*(x2>x1||-1)));y2=round(max(top,min(top+imgHeight,y1+abs(x2-x1)/aspectRatio*(y2>y1||-1))));x2=round(x2)}function aspectRatioYX(){y2=max(top,min(top+imgHeight,y1+abs(x2-x1)/aspectRatio*(y2>y1||-1)));x2=round(max(left,min(left+imgWidth,x1+abs(y2-y1)*aspectRatio*(x2>x1||-1))));y2=round(y2)}function doResize(){if(abs(x2-x1)left+imgWidth)x1=left+imgWidth-options.minWidth}if(abs(y2-y1)top+imgHeight)y1=top+imgHeight-options.minHeight}x2=max(left,min(x2,left+imgWidth));y2=max(top,min(y2,top+imgHeight));if(aspectRatio)if(abs(x2-x1)/aspectRatio>abs(y2-y1))aspectRatioYX();else aspectRatioXY();if(abs(x2-x1)>options.maxWidth){x2=x1-options.maxWidth*(x2options.maxHeight){y2=y1-options.maxHeight*(y2zIndex)zIndex=$p.css('z-index');if($p.css('position')=='fixed')position='fixed';$p=$p.parent()}if(!isNaN(options.zIndex))zIndex=options.zIndex;if($.browser.msie)$img.attr('unselectable','on');$.imgAreaSelect.keyPress=$.browser.msie||$.browser.safari?'keydown':'keypress';if($.browser.opera)$areaOpera=div().css({width:'100%',height:'100%',position:'absolute',zIndex:zIndex+2||2});$box.add($outer).css({visibility:'hidden',position:position,overflow:'hidden',zIndex:zIndex||'0'});$box.css({zIndex:zIndex+2||2});$area.add($border).css({position:'absolute'});img.complete||img.readyState=='complete'||!$img.is('img')?imgLoad():$img.one('load',imgLoad)};$.fn.imgAreaSelect=function(options){options=options||{};this.each(function(){if($(this).data('imgAreaSelect'))$(this).data('imgAreaSelect').setOptions(options);else{if(options.enable===undefined&&options.disable===undefined)options.enable=true;$(this).data('imgAreaSelect',new $.imgAreaSelect(this,options))}});if(options.instance)return $(this).data('imgAreaSelect');return this}})(jQuery);
\ No newline at end of file
+(function(e){var b=Math.abs,a=Math.max,d=Math.min,c=Math.round;function f(){return e("
")}e.imgAreaSelect=function(q,S){var aw=e(q),U,ar=f(),af=f(),H=f().add(f()).add(f()).add(f()),Y=f().add(f()).add(f()).add(f()),L=e([]),R,n,p,az,N,j,A,M,B=0,ad="absolute",Q,P,aa,Z,V=10,I,T,K,y,aA,x,ay,v={x1:0,y1:0,x2:0,y2:0,width:0,height:0},l,aq,am,ag,ac,an,u;function G(h){return h+az.left-M.left}function F(h){return h+az.top-M.top}function E(h){return h-az.left+M.left}function z(h){return h-az.top+M.top}function ak(h){return h.pageX-M.left}function ai(h){return h.pageY-M.top}function D(h){var o=h||aa,i=h||Z;return{x1:c(v.x1*o),y1:c(v.y1*i),x2:c(v.x2*o),y2:c(v.y2*i),width:c(v.x2*o)-c(v.x1*o),height:c(v.y2*i)-c(v.y1*i)}}function ae(i,w,h,o,aB){var aD=aB||aa,aC=aB||Z;v={x1:c(i/aD),y1:c(w/aC),x2:c(h/aD),y2:c(o/aC)};v.width=(h=G(v.x2))-(i=G(v.x1));v.height=(o=G(v.y2))-(w=G(v.y1))}function ao(){if(!aw.width()){return}az={left:c(aw.offset().left),top:c(aw.offset().top)};N=aw.width();j=aw.height();if(e().jquery=="1.3.2"&&e.browser.safari&&ad=="fixed"){az.top+=a(document.documentElement.scrollTop,e("body").scrollTop());az.left+=a(document.documentElement.scrollLeft,e("body").scrollLeft())}M=e.inArray(A.css("position"),["absolute","relative"])+1?{left:c(A.offset().left)-A.scrollLeft(),top:c(A.offset().top)-A.scrollTop()}:ad=="fixed"?{left:e(document).scrollLeft(),top:e(document).scrollTop()}:{left:0,top:0};n=G(0);p=F(0)}function X(h){if(!K){return}ar.css({left:G(v.x1),top:F(v.y1)}).add(af).width(ac=v.width).height(an=v.height);af.add(H).add(L).css({left:0,top:0});H.width(a(ac-H.outerWidth()+H.innerWidth(),0)).height(a(an-H.outerHeight()+H.innerHeight(),0));e(Y[0]).css({left:n,top:p,width:v.x1,height:j});e(Y[1]).css({left:n+v.x1,top:p,width:ac,height:v.y1});e(Y[2]).css({left:n+v.x2,top:p,width:N-v.x2,height:j});e(Y[3]).css({left:n+v.x1,top:p+v.y2,width:ac,height:j-v.y2});ac-=L.outerWidth();an-=L.outerHeight();switch(L.length){case 8:e(L[4]).css({left:ac/2});e(L[5]).css({left:ac,top:an/2});e(L[6]).css({left:ac/2,top:an});e(L[7]).css({top:an/2});case 4:L.slice(1,3).css({left:ac});L.slice(2,4).css({top:an})}if(h!==false){if(e.imgAreaSelect.keyPress!=at){e(document).unbind(e.imgAreaSelect.keyPress,e.imgAreaSelect.onKeyPress)}if(S.keys){e(document)[e.imgAreaSelect.keyPress](e.imgAreaSelect.onKeyPress=at)}}if(e.browser.msie&&H.outerWidth()-H.innerWidth()==2){H.css("margin",0);setTimeout(function(){H.css("margin","auto")},0)}}function t(h){ao();X(h);y=G(v.x1);aA=F(v.y1);x=G(v.x2);ay=F(v.y2)}function ah(h,i){S.fadeSpeed?h.fadeOut(S.fadeSpeed,i):h.hide()}function C(i){var h=E(ak(i))-v.x1,o=z(ai(i))-v.y1;if(!u){ao();u=true;ar.one("mouseout",function(){u=false})}I="";if(S.resizable){if(o<=V){I="n"}else{if(o>=v.height-V){I="s"}}if(h<=V){I+="w"}else{if(h>=v.width-V){I+="e"}}}ar.css("cursor",I?I+"-resize":S.movable?"move":"");if(R){R.toggle()}}function aj(h){e("body").css("cursor","");if(S.autoHide||v.width*v.height==0){ah(ar.add(Y),function(){e(this).hide()})}S.onSelectEnd(q,D());e(document).unbind("mousemove",ab);ar.mousemove(C)}function s(h){if(h.which!=1){return false}ao();if(I){e("body").css("cursor",I+"-resize");y=G(v[/w/.test(I)?"x2":"x1"]);aA=F(v[/n/.test(I)?"y2":"y1"]);e(document).mousemove(ab).one("mouseup",aj);ar.unbind("mousemove",C)}else{if(S.movable){Q=n+v.x1-ak(h);P=p+v.y1-ai(h);ar.unbind("mousemove",C);e(document).mousemove(g).one("mouseup",function(){S.onSelectEnd(q,D());e(document).unbind("mousemove",g);ar.mousemove(C)})}else{aw.mousedown(h)}}return false}function r(){x=a(n,d(n+N,y+b(ay-aA)*T*(x>y||-1)));ay=c(a(p,d(p+j,aA+b(x-y)/T*(ay>aA||-1))));x=c(x)}function al(){ay=a(p,d(p+j,aA+b(x-y)/T*(ay>aA||-1)));x=c(a(n,d(n+N,y+b(ay-aA)*T*(x>y||-1))));ay=c(ay)}function av(){if(b(x-y)n+N){y=n+N-S.minWidth}}}if(b(ay-aA)p+j){aA=p+j-S.minHeight}}}x=a(n,d(x,n+N));ay=a(p,d(ay,p+j));if(T){if(b(x-y)/T>b(ay-aA)){al()}else{r()}}if(b(x-y)>S.maxWidth){x=y-S.maxWidth*(xS.maxHeight){ay=aA-S.maxHeight*(ayB){B=l.css("z-index")}if(l.css("position")=="fixed"){ad="fixed"}l=l.parent()}if(!isNaN(S.zIndex)){B=S.zIndex}if(e.browser.msie){aw.attr("unselectable","on")}e.imgAreaSelect.keyPress=e.browser.msie||e.browser.safari?"keydown":"keypress";if(e.browser.opera){R=f().css({width:"100%",height:"100%",position:"absolute",zIndex:B+2||2})}ar.add(Y).css({visibility:"hidden",position:ad,overflow:"hidden",zIndex:B||"0"});ar.css({zIndex:B+2||2});af.add(H).css({position:"absolute"});q.complete||q.readyState=="complete"||!aw.is("img")?au():aw.one("load",au)};e.fn.imgAreaSelect=function(g){g=g||{};this.each(function(){if(e(this).data("imgAreaSelect")){e(this).data("imgAreaSelect").setOptions(g)}else{if(g.enable===undefined&&g.disable===undefined){g.enable=true}e(this).data("imgAreaSelect",new e.imgAreaSelect(this,g))}});if(g.instance){return e(this).data("imgAreaSelect")}return this}})(jQuery);
\ No newline at end of file
diff --git a/wp-includes/js/jcrop/jquery.Jcrop.js b/wp-includes/js/jcrop/jquery.Jcrop.js
index 9002b978..70b55053 100644
--- a/wp-includes/js/jcrop/jquery.Jcrop.js
+++ b/wp-includes/js/jcrop/jquery.Jcrop.js
@@ -1,163 +1 @@
-/**
- * Jcrop v.0.9.8 (minimized)
- * (c) 2008 Kelly Hallman and DeepLiquid.com
- * More information: http://deepliquid.com/content/Jcrop.html
- * Released under MIT License - this header must remain with code
- */
-
-
-(function($){$.Jcrop=function(obj,opt)
-{var obj=obj,opt=opt;if(typeof(obj)!=='object')obj=$(obj)[0];if(typeof(opt)!=='object')opt={};if(!('trackDocument'in opt))
-{opt.trackDocument=$.browser.msie?false:true;if($.browser.msie&&$.browser.version.split('.')[0]=='8')
-opt.trackDocument=true;}
-if(!('keySupport'in opt))
-opt.keySupport=$.browser.msie?false:true;var defaults={trackDocument:false,baseClass:'jcrop',addClass:null,bgColor:'black',bgOpacity:.6,borderOpacity:.4,handleOpacity:.5,handlePad:5,handleSize:9,handleOffset:5,edgeMargin:14,aspectRatio:0,keySupport:true,cornerHandles:true,sideHandles:true,drawBorders:true,dragEdges:true,boxWidth:0,boxHeight:0,boundary:8,animationDelay:20,swingSpeed:3,allowSelect:true,allowMove:true,allowResize:true,minSelect:[0,0],maxSize:[0,0],minSize:[0,0],onChange:function(){},onSelect:function(){}};var options=defaults;setOptions(opt);var $origimg=$(obj);var $img=$origimg.clone().removeAttr('id').css({position:'absolute'});$img.width($origimg.width());$img.height($origimg.height());$origimg.after($img).hide();presize($img,options.boxWidth,options.boxHeight);var boundx=$img.width(),boundy=$img.height(),$div=$('
').width(boundx).height(boundy).addClass(cssClass('holder')).css({position:'relative',backgroundColor:options.bgColor}).insertAfter($origimg).append($img);;if(options.addClass)$div.addClass(options.addClass);var $img2=$(' ').attr('src',$img.attr('src')).css('position','absolute').width(boundx).height(boundy);var $img_holder=$('
').width(pct(100)).height(pct(100)).css({zIndex:310,position:'absolute',overflow:'hidden'}).append($img2);var $hdl_holder=$('
').width(pct(100)).height(pct(100)).css('zIndex',320);var $sel=$('
').css({position:'absolute',zIndex:300}).insertBefore($img).append($img_holder,$hdl_holder);var bound=options.boundary;var $trk=newTracker().width(boundx+(bound*2)).height(boundy+(bound*2)).css({position:'absolute',top:px(-bound),left:px(-bound),zIndex:290}).mousedown(newSelection);var xlimit,ylimit,xmin,ymin;var xscale,yscale,enabled=true;var docOffset=getPos($img),btndown,lastcurs,dimmed,animating,shift_down;var Coords=function()
-{var x1=0,y1=0,x2=0,y2=0,ox,oy;function setPressed(pos)
-{var pos=rebound(pos);x2=x1=pos[0];y2=y1=pos[1];};function setCurrent(pos)
-{var pos=rebound(pos);ox=pos[0]-x2;oy=pos[1]-y2;x2=pos[0];y2=pos[1];};function getOffset()
-{return[ox,oy];};function moveOffset(offset)
-{var ox=offset[0],oy=offset[1];if(0>x1+ox)ox-=ox+x1;if(0>y1+oy)oy-=oy+y1;if(boundyboundx)
-{xx=boundx;h=Math.abs((xx-x1)/aspect);yy=rh<0?y1-h:h+y1;}}
-else
-{xx=x2;h=rwa/aspect;yy=rh<0?y1-h:y1+h;if(yy<0)
-{yy=0;w=Math.abs((yy-y1)*aspect);xx=rw<0?x1-w:w+x1;}
-else if(yy>boundy)
-{yy=boundy;w=Math.abs(yy-y1)*aspect;xx=rw<0?x1-w:w+x1;}}
-if(xx>x1){if(xx-x1max_x){xx=x1+max_x;}
-if(yy>y1){yy=y1+(xx-x1)/aspect;}else{yy=y1-(xx-x1)/aspect;}}else if(xxmax_x){xx=x1-max_x;}
-if(yy>y1){yy=y1+(x1-xx)/aspect;}else{yy=y1-(x1-xx)/aspect;}}
-if(xx<0){x1-=xx;xx=0;}else if(xx>boundx){x1-=xx-boundx;xx=boundx;}
-if(yy<0){y1-=yy;yy=0;}else if(yy>boundy){y1-=yy-boundy;yy=boundy;}
-return last=makeObj(flipCoords(x1,y1,xx,yy));};function rebound(p)
-{if(p[0]<0)p[0]=0;if(p[1]<0)p[1]=0;if(p[0]>boundx)p[0]=boundx;if(p[1]>boundy)p[1]=boundy;return[p[0],p[1]];};function flipCoords(x1,y1,x2,y2)
-{var xa=x1,xb=x2,ya=y1,yb=y2;if(x2xlimit))
-x2=(xsize>0)?(x1+xlimit):(x1-xlimit);if(ylimit&&(Math.abs(ysize)>ylimit))
-y2=(ysize>0)?(y1+ylimit):(y1-ylimit);if(ymin&&(Math.abs(ysize)0)?(y1+ymin):(y1-ymin);if(xmin&&(Math.abs(xsize)0)?(x1+xmin):(x1-xmin);if(x1<0){x2-=x1;x1-=x1;}
-if(y1<0){y2-=y1;y1-=y1;}
-if(x2<0){x1-=x2;x2-=x2;}
-if(y2<0){y1-=y2;y2-=y2;}
-if(x2>boundx){var delta=x2-boundx;x1-=delta;x2-=delta;}
-if(y2>boundy){var delta=y2-boundy;y1-=delta;y2-=delta;}
-if(x1>boundx){var delta=x1-boundy;y2-=delta;y1-=delta;}
-if(y1>boundy){var delta=y1-boundy;y2-=delta;y1-=delta;}
-return makeObj(flipCoords(x1,y1,x2,y2));};function makeObj(a)
-{return{x:a[0],y:a[1],x2:a[2],y2:a[3],w:a[2]-a[0],h:a[3]-a[1]};};return{flipCoords:flipCoords,setPressed:setPressed,setCurrent:setCurrent,getOffset:getOffset,moveOffset:moveOffset,getCorner:getCorner,getFixed:getFixed};}();var Selection=function()
-{var start,end,dragmode,awake,hdep=370;var borders={};var handle={};var seehandles=false;var hhs=options.handleOffset;if(options.drawBorders){borders={top:insertBorder('hline').css('top',$.browser.msie?px(-1):px(0)),bottom:insertBorder('hline'),left:insertBorder('vline'),right:insertBorder('vline')};}
-if(options.dragEdges){handle.t=insertDragbar('n');handle.b=insertDragbar('s');handle.r=insertDragbar('e');handle.l=insertDragbar('w');}
-options.sideHandles&&createHandles(['n','s','e','w']);options.cornerHandles&&createHandles(['sw','nw','ne','se']);function insertBorder(type)
-{var jq=$('
').css({position:'absolute',opacity:options.borderOpacity}).addClass(cssClass(type));$img_holder.append(jq);return jq;};function dragDiv(ord,zi)
-{var jq=$('
').mousedown(createDragger(ord)).css({cursor:ord+'-resize',position:'absolute',zIndex:zi});$hdl_holder.append(jq);return jq;};function insertHandle(ord)
-{return dragDiv(ord,hdep++).css({top:px(-hhs+1),left:px(-hhs+1),opacity:options.handleOpacity}).addClass(cssClass('handle'));};function insertDragbar(ord)
-{var s=options.handleSize,o=hhs,h=s,w=s,t=o,l=o;switch(ord)
-{case'n':case's':w=pct(100);break;case'e':case'w':h=pct(100);break;}
-return dragDiv(ord,hdep++).width(w).height(h).css({top:px(-t+1),left:px(-l+1)});};function createHandles(li)
-{for(i in li)handle[li[i]]=insertHandle(li[i]);};function moveHandles(c)
-{var midvert=Math.round((c.h/2)-hhs),midhoriz=Math.round((c.w/2)-hhs),north=west=-hhs+1,east=c.w-hhs,south=c.h-hhs,x,y;'e'in handle&&handle.e.css({top:px(midvert),left:px(east)})&&handle.w.css({top:px(midvert)})&&handle.s.css({top:px(south),left:px(midhoriz)})&&handle.n.css({left:px(midhoriz)});'ne'in handle&&handle.ne.css({left:px(east)})&&handle.se.css({top:px(south),left:px(east)})&&handle.sw.css({top:px(south)});'b'in handle&&handle.b.css({top:px(south)})&&handle.r.css({left:px(east)});};function moveto(x,y)
-{$img2.css({top:px(-y),left:px(-x)});$sel.css({top:px(y),left:px(x)});};function resize(w,h)
-{$sel.width(w).height(h);};function refresh()
-{var c=Coords.getFixed();Coords.setPressed([c.x,c.y]);Coords.setCurrent([c.x2,c.y2]);updateVisible();};function updateVisible()
-{if(awake)return update();};function update()
-{var c=Coords.getFixed();resize(c.w,c.h);moveto(c.x,c.y);options.drawBorders&&borders['right'].css({left:px(c.w-1)})&&borders['bottom'].css({top:px(c.h-1)});seehandles&&moveHandles(c);awake||show();options.onChange(unscale(c));};function show()
-{$sel.show();$img.css('opacity',options.bgOpacity);awake=true;};function release()
-{disableHandles();$sel.hide();$img.css('opacity',1);awake=false;};function showHandles()
-{if(seehandles)
-{moveHandles(Coords.getFixed());$hdl_holder.show();}};function enableHandles()
-{seehandles=true;if(options.allowResize)
-{moveHandles(Coords.getFixed());$hdl_holder.show();return true;}};function disableHandles()
-{seehandles=false;$hdl_holder.hide();};function animMode(v)
-{(animating=v)?disableHandles():enableHandles();};function done()
-{animMode(false);refresh();};var $track=newTracker().mousedown(createDragger('move')).css({cursor:'move',position:'absolute',zIndex:360})
-$img_holder.append($track);disableHandles();return{updateVisible:updateVisible,update:update,release:release,refresh:refresh,setCursor:function(cursor){$track.css('cursor',cursor);},enableHandles:enableHandles,enableOnly:function(){seehandles=true;},showHandles:showHandles,disableHandles:disableHandles,animMode:animMode,done:done};}();var Tracker=function()
-{var onMove=function(){},onDone=function(){},trackDoc=options.trackDocument;if(!trackDoc)
-{$trk.mousemove(trackMove).mouseup(trackUp).mouseout(trackUp);}
-function toFront()
-{$trk.css({zIndex:450});if(trackDoc)
-{$(document).mousemove(trackMove).mouseup(trackUp);}}
-function toBack()
-{$trk.css({zIndex:290});if(trackDoc)
-{$(document).unbind('mousemove',trackMove).unbind('mouseup',trackUp);}}
-function trackMove(e)
-{onMove(mouseAbs(e));};function trackUp(e)
-{e.preventDefault();e.stopPropagation();if(btndown)
-{btndown=false;onDone(mouseAbs(e));options.onSelect(unscale(Coords.getFixed()));toBack();onMove=function(){};onDone=function(){};}
-return false;};function activateHandlers(move,done)
-{btndown=true;onMove=move;onDone=done;toFront();return false;};function setCursor(t){$trk.css('cursor',t);};$img.before($trk);return{activateHandlers:activateHandlers,setCursor:setCursor};}();var KeyManager=function()
-{var $keymgr=$(' ').css({position:'absolute',left:'-30px'}).keypress(parseKey).blur(onBlur),$keywrap=$('
').css({position:'absolute',overflow:'hidden'}).append($keymgr);function watchKeys()
-{if(options.keySupport)
-{$keymgr.show();$keymgr.focus();}};function onBlur(e)
-{$keymgr.hide();};function doNudge(e,x,y)
-{if(options.allowMove){Coords.moveOffset([x,y]);Selection.updateVisible();};e.preventDefault();e.stopPropagation();};function parseKey(e)
-{if(e.ctrlKey)return true;shift_down=e.shiftKey?true:false;var nudge=shift_down?10:1;switch(e.keyCode)
-{case 37:doNudge(e,-nudge,0);break;case 39:doNudge(e,nudge,0);break;case 38:doNudge(e,0,-nudge);break;case 40:doNudge(e,0,nudge);break;case 27:Selection.release();break;case 9:return true;}
-return nothing(e);};if(options.keySupport)$keywrap.insertBefore($img);return{watchKeys:watchKeys};}();function px(n){return''+parseInt(n)+'px';};function pct(n){return''+parseInt(n)+'%';};function cssClass(cl){return options.baseClass+'-'+cl;};function getPos(obj)
-{var pos=$(obj).offset();return[pos.left,pos.top];};function mouseAbs(e)
-{return[(e.pageX-docOffset[0]),(e.pageY-docOffset[1])];};function myCursor(type)
-{if(type!=lastcurs)
-{Tracker.setCursor(type);lastcurs=type;}};function startDragMode(mode,pos)
-{docOffset=getPos($img);Tracker.setCursor(mode=='move'?mode:mode+'-resize');if(mode=='move')
-return Tracker.activateHandlers(createMover(pos),doneSelect);var fc=Coords.getFixed();var opp=oppLockCorner(mode);var opc=Coords.getCorner(oppLockCorner(opp));Coords.setPressed(Coords.getCorner(opp));Coords.setCurrent(opc);Tracker.activateHandlers(dragmodeHandler(mode,fc),doneSelect);};function dragmodeHandler(mode,f)
-{return function(pos){if(!options.aspectRatio)switch(mode)
-{case'e':pos[1]=f.y2;break;case'w':pos[1]=f.y2;break;case'n':pos[0]=f.x2;break;case's':pos[0]=f.x2;break;}
-else switch(mode)
-{case'e':pos[1]=f.y+1;break;case'w':pos[1]=f.y+1;break;case'n':pos[0]=f.x+1;break;case's':pos[0]=f.x+1;break;}
-Coords.setCurrent(pos);Selection.update();};};function createMover(pos)
-{var lloc=pos;KeyManager.watchKeys();return function(pos)
-{Coords.moveOffset([pos[0]-lloc[0],pos[1]-lloc[1]]);lloc=pos;Selection.update();};};function oppLockCorner(ord)
-{switch(ord)
-{case'n':return'sw';case's':return'nw';case'e':return'nw';case'w':return'ne';case'ne':return'sw';case'nw':return'se';case'se':return'nw';case'sw':return'ne';};};function createDragger(ord)
-{return function(e){if(options.disabled)return false;if((ord=='move')&&!options.allowMove)return false;btndown=true;startDragMode(ord,mouseAbs(e));e.stopPropagation();e.preventDefault();return false;};};function presize($obj,w,h)
-{var nw=$obj.width(),nh=$obj.height();if((nw>w)&&w>0)
-{nw=w;nh=(w/$obj.width())*$obj.height();}
-if((nh>h)&&h>0)
-{nh=h;nw=(h/$obj.height())*$obj.width();}
-xscale=$obj.width()/nw;yscale=$obj.height()/nh;$obj.width(nw).height(nh);};function unscale(c)
-{return{x:parseInt(c.x*xscale),y:parseInt(c.y*yscale),x2:parseInt(c.x2*xscale),y2:parseInt(c.y2*yscale),w:parseInt(c.w*xscale),h:parseInt(c.h*yscale)};};function doneSelect(pos)
-{var c=Coords.getFixed();if(c.w>options.minSelect[0]&&c.h>options.minSelect[1])
-{Selection.enableHandles();Selection.done();}
-else
-{Selection.release();}
-Tracker.setCursor(options.allowSelect?'crosshair':'default');};function newSelection(e)
-{if(options.disabled)return false;if(!options.allowSelect)return false;btndown=true;docOffset=getPos($img);Selection.disableHandles();myCursor('crosshair');var pos=mouseAbs(e);Coords.setPressed(pos);Tracker.activateHandlers(selectDrag,doneSelect);KeyManager.watchKeys();Selection.update();e.stopPropagation();e.preventDefault();return false;};function selectDrag(pos)
-{Coords.setCurrent(pos);Selection.update();};function newTracker()
-{var trk=$('
').addClass(cssClass('tracker'));$.browser.msie&&trk.css({opacity:0,backgroundColor:'white'});return trk;};function animateTo(a)
-{var x1=a[0]/xscale,y1=a[1]/yscale,x2=a[2]/xscale,y2=a[3]/yscale;if(animating)return;var animto=Coords.flipCoords(x1,y1,x2,y2);var c=Coords.getFixed();var animat=initcr=[c.x,c.y,c.x2,c.y2];var interv=options.animationDelay;var x=animat[0];var y=animat[1];var x2=animat[2];var y2=animat[3];var ix1=animto[0]-initcr[0];var iy1=animto[1]-initcr[1];var ix2=animto[2]-initcr[2];var iy2=animto[3]-initcr[3];var pcent=0;var velocity=options.swingSpeed;Selection.animMode(true);var animator=function()
-{return function()
-{pcent+=(100-pcent)/velocity;animat[0]=x+((pcent/100)*ix1);animat[1]=y+((pcent/100)*iy1);animat[2]=x2+((pcent/100)*ix2);animat[3]=y2+((pcent/100)*iy2);if(pcent<100)animateStart();else Selection.done();if(pcent>=99.8)pcent=100;setSelectRaw(animat);};}();function animateStart()
-{window.setTimeout(animator,interv);};animateStart();};function setSelect(rect)
-{setSelectRaw([rect[0]/xscale,rect[1]/yscale,rect[2]/xscale,rect[3]/yscale]);};function setSelectRaw(l)
-{Coords.setPressed([l[0],l[1]]);Coords.setCurrent([l[2],l[3]]);Selection.update();};function setOptions(opt)
-{if(typeof(opt)!='object')opt={};options=$.extend(options,opt);if(typeof(options.onChange)!=='function')
-options.onChange=function(){};if(typeof(options.onSelect)!=='function')
-options.onSelect=function(){};};function tellSelect()
-{return unscale(Coords.getFixed());};function tellScaled()
-{return Coords.getFixed();};function setOptionsNew(opt)
-{setOptions(opt);interfaceUpdate();};function disableCrop()
-{options.disabled=true;Selection.disableHandles();Selection.setCursor('default');Tracker.setCursor('default');};function enableCrop()
-{options.disabled=false;interfaceUpdate();};function cancelCrop()
-{Selection.done();Tracker.activateHandlers(null,null);};function destroy()
-{$div.remove();$origimg.show();};function interfaceUpdate(alt)
-{options.allowResize?alt?Selection.enableOnly():Selection.enableHandles():Selection.disableHandles();Tracker.setCursor(options.allowSelect?'crosshair':'default');Selection.setCursor(options.allowMove?'move':'default');$div.css('backgroundColor',options.bgColor);if('setSelect'in options){setSelect(opt.setSelect);Selection.done();delete(options.setSelect);}
-if('trueSize'in options){xscale=options.trueSize[0]/boundx;yscale=options.trueSize[1]/boundy;}
-xlimit=options.maxSize[0]||0;ylimit=options.maxSize[1]||0;xmin=options.minSize[0]||0;ymin=options.minSize[1]||0;if('outerImage'in options)
-{$img.attr('src',options.outerImage);delete(options.outerImage);}
-Selection.refresh();};$hdl_holder.hide();interfaceUpdate(true);var api={animateTo:animateTo,setSelect:setSelect,setOptions:setOptionsNew,tellSelect:tellSelect,tellScaled:tellScaled,disable:disableCrop,enable:enableCrop,cancel:cancelCrop,focus:KeyManager.watchKeys,getBounds:function(){return[boundx*xscale,boundy*yscale];},getWidgetSize:function(){return[boundx,boundy];},release:Selection.release,destroy:destroy};$origimg.data('Jcrop',api);return api;};$.fn.Jcrop=function(options)
-{function attachWhenDone(from)
-{var loadsrc=options.useImg||from.src;var img=new Image();img.onload=function(){$.Jcrop(from,options);};img.src=loadsrc;};if(typeof(options)!=='object')options={};this.each(function()
-{if($(this).data('Jcrop'))
-{if(options=='api')return $(this).data('Jcrop');else $(this).data('Jcrop').setOptions(options);}
-else attachWhenDone(this);});return this;};})(jQuery);
\ No newline at end of file
+(function(a){a.Jcrop=function(d,A){var d=d,A=A;if(typeof(d)!=="object"){d=a(d)[0]}if(typeof(A)!=="object"){A={}}if(!("trackDocument" in A)){A.trackDocument=a.browser.msie?false:true;if(a.browser.msie&&a.browser.version.split(".")[0]=="8"){A.trackDocument=true}}if(!("keySupport" in A)){A.keySupport=a.browser.msie?false:true}var U={trackDocument:false,baseClass:"jcrop",addClass:null,bgColor:"black",bgOpacity:0.6,borderOpacity:0.4,handleOpacity:0.5,handlePad:5,handleSize:9,handleOffset:5,edgeMargin:14,aspectRatio:0,keySupport:true,cornerHandles:true,sideHandles:true,drawBorders:true,dragEdges:true,boxWidth:0,boxHeight:0,boundary:8,animationDelay:20,swingSpeed:3,allowSelect:true,allowMove:true,allowResize:true,minSelect:[0,0],maxSize:[0,0],minSize:[0,0],onChange:function(){},onSelect:function(){}};var H=U;z(A);var W=a(d);var al=W.clone().removeAttr("id").css({position:"absolute"});al.width(W.width());al.height(W.height());W.after(al).hide();T(al,H.boxWidth,H.boxHeight);var Q=al.width(),O=al.height(),Z=a("
").width(Q).height(O).addClass(C("holder")).css({position:"relative",backgroundColor:H.bgColor}).insertAfter(W).append(al);if(H.addClass){Z.addClass(H.addClass)}var I=a(" ").attr("src",al.attr("src")).css("position","absolute").width(Q).height(O);var k=a("
").width(K(100)).height(K(100)).css({zIndex:310,position:"absolute",overflow:"hidden"}).append(I);var L=a("
").width(K(100)).height(K(100)).css("zIndex",320);var y=a("
").css({position:"absolute",zIndex:300}).insertBefore(al).append(k,L);var t=H.boundary;var b=ae().width(Q+(t*2)).height(O+(t*2)).css({position:"absolute",top:l(-t),left:l(-t),zIndex:290}).mousedown(ac);var x,ah,p,S;var M,e,n=true;var ad=D(al),r,an,am,B,ab;var aa=function(){var aq=0,aC=0,ap=0,aB=0,au,ar;function aw(aF){var aF=at(aF);ap=aq=aF[0];aB=aC=aF[1]}function av(aF){var aF=at(aF);au=aF[0]-ap;ar=aF[1]-aB;ap=aF[0];aB=aF[1]}function aE(){return[au,ar]}function ao(aH){var aG=aH[0],aF=aH[1];if(0>aq+aG){aG-=aG+aq}if(0>aC+aF){aF-=aF+aC}if(OQ){aF=Q;h=Math.abs((aF-aq)/aH);aM=aP<0?aC-h:h+aC}}}else{aF=ap;h=aJ/aH;aM=aP<0?aC-h:aC+h;if(aM<0){aM=0;w=Math.abs((aM-aC)*aH);aF=aI<0?aq-w:w+aq}else{if(aM>O){aM=O;w=Math.abs(aM-aC)*aH;aF=aI<0?aq-w:w+aq}}}if(aF>aq){if(aF-aqaG){aF=aq+aG}}if(aM>aC){aM=aC+(aF-aq)/aH}else{aM=aC-(aF-aq)/aH}}else{if(aFaG){aF=aq-aG}}if(aM>aC){aM=aC+(aq-aF)/aH}else{aM=aC-(aq-aF)/aH}}}if(aF<0){aq-=aF;aF=0}else{if(aF>Q){aq-=aF-Q;aF=Q}}if(aM<0){aC-=aM;aM=0}else{if(aM>O){aC-=aM-O;aM=O}}return last=az(ay(aq,aC,aF,aM))}function at(aF){if(aF[0]<0){aF[0]=0}if(aF[1]<0){aF[1]=0}if(aF[0]>Q){aF[0]=Q}if(aF[1]>O){aF[1]=O}return[aF[0],aF[1]]}function ay(aI,aK,aH,aJ){var aM=aI,aL=aH,aG=aK,aF=aJ;if(aHx)){ap=(aG>0)?(aq+x):(aq-x)}if(ah&&(Math.abs(aF)>ah)){aB=(aF>0)?(aC+ah):(aC-ah)}if(S&&(Math.abs(aF)0)?(aC+S):(aC-S)}if(p&&(Math.abs(aG) 0)?(aq+p):(aq-p)}if(aq<0){ap-=aq;aq-=aq}if(aC<0){aB-=aC;aC-=aC}if(ap<0){aq-=ap;ap-=ap}if(aB<0){aC-=aB;aB-=aB}if(ap>Q){var aH=ap-Q;aq-=aH;ap-=aH}if(aB>O){var aH=aB-O;aC-=aH;aB-=aH}if(aq>Q){var aH=aq-O;aB-=aH;aC-=aH}if(aC>O){var aH=aC-O;aB-=aH;aC-=aH}return az(ay(aq,aC,ap,aB))}function az(aF){return{x:aF[0],y:aF[1],x2:aF[2],y2:aF[3],w:aF[2]-aF[0],h:aF[3]-aF[1]}}return{flipCoords:ay,setPressed:aw,setCurrent:av,getOffset:aE,moveOffset:ao,getCorner:ax,getFixed:aD}}();var X=function(){var aw,ar,aC,aB,aK=370;var av={};var aO={};var aq=false;var aA=H.handleOffset;if(H.drawBorders){av={top:ax("hline").css("top",a.browser.msie?l(-1):l(0)),bottom:ax("hline"),left:ax("vline"),right:ax("vline")}}if(H.dragEdges){aO.t=aJ("n");aO.b=aJ("s");aO.r=aJ("e");aO.l=aJ("w")}H.sideHandles&&aF(["n","s","e","w"]);H.cornerHandles&&aF(["sw","nw","ne","se"]);function ax(aR){var aS=a("
").css({position:"absolute",opacity:H.borderOpacity}).addClass(C(aR));k.append(aS);return aS}function ap(aR,aS){var aT=a("
").mousedown(c(aR)).css({cursor:aR+"-resize",position:"absolute",zIndex:aS});L.append(aT);return aT}function aD(aR){return ap(aR,aK++).css({top:l(-aA+1),left:l(-aA+1),opacity:H.handleOpacity}).addClass(C("handle"))}function aJ(aT){var aW=H.handleSize,aX=aA,aV=aW,aS=aW,aU=aX,aR=aX;switch(aT){case"n":case"s":aS=K(100);break;case"e":case"w":aV=K(100);break}return ap(aT,aK++).width(aS).height(aV).css({top:l(-aU+1),left:l(-aR+1)})}function aF(aR){for(i in aR){aO[aR[i]]=aD(aR[i])}}function aH(aY){var aT=Math.round((aY.h/2)-aA),aS=Math.round((aY.w/2)-aA),aW=west=-aA+1,aV=aY.w-aA,aU=aY.h-aA,aR,aX;"e" in aO&&aO.e.css({top:l(aT),left:l(aV)})&&aO.w.css({top:l(aT)})&&aO.s.css({top:l(aU),left:l(aS)})&&aO.n.css({left:l(aS)});"ne" in aO&&aO.ne.css({left:l(aV)})&&aO.se.css({top:l(aU),left:l(aV)})&&aO.sw.css({top:l(aU)});"b" in aO&&aO.b.css({top:l(aU)})&&aO.r.css({left:l(aV)})}function az(aR,aS){I.css({top:l(-aS),left:l(-aR)});y.css({top:l(aS),left:l(aR)})}function aQ(aR,aS){y.width(aR).height(aS)}function at(){var aR=aa.getFixed();aa.setPressed([aR.x,aR.y]);aa.setCurrent([aR.x2,aR.y2]);aN()}function aN(){if(aB){return ay()}}function ay(){var aR=aa.getFixed();aQ(aR.w,aR.h);az(aR.x,aR.y);H.drawBorders&&av.right.css({left:l(aR.w-1)})&&av.bottom.css({top:l(aR.h-1)});aq&&aH(aR);aB||aP();H.onChange(Y(aR))}function aP(){y.show();al.css("opacity",H.bgOpacity);aB=true}function aL(){aM();y.hide();al.css("opacity",1);aB=false}function ao(){if(aq){aH(aa.getFixed());L.show()}}function aG(){aq=true;if(H.allowResize){aH(aa.getFixed());L.show();return true}}function aM(){aq=false;L.hide()}function aI(aR){(B=aR)?aM():aG()}function aE(){aI(false);at()}var au=ae().mousedown(c("move")).css({cursor:"move",position:"absolute",zIndex:360});k.append(au);aM();return{updateVisible:aN,update:ay,release:aL,refresh:at,setCursor:function(aR){au.css("cursor",aR)},enableHandles:aG,enableOnly:function(){aq=true},showHandles:ao,disableHandles:aM,animMode:aI,done:aE}}();var P=function(){var ap=function(){},ar=function(){},aq=H.trackDocument;if(!aq){b.mousemove(ao).mouseup(at).mouseout(at)}function ax(){b.css({zIndex:450});if(aq){a(document).mousemove(ao).mouseup(at)}}function aw(){b.css({zIndex:290});if(aq){a(document).unbind("mousemove",ao).unbind("mouseup",at)}}function ao(ay){ap(F(ay))}function at(ay){ay.preventDefault();ay.stopPropagation();if(r){r=false;ar(F(ay));H.onSelect(Y(aa.getFixed()));aw();ap=function(){};ar=function(){}}return false}function au(az,ay){r=true;ap=az;ar=ay;ax();return false}function av(ay){b.css("cursor",ay)}al.before(b);return{activateHandlers:au,setCursor:av}}();var ak=function(){var ar=a(' ').css({position:"absolute",left:"-30px"}).keypress(ao).blur(at),au=a("
").css({position:"absolute",overflow:"hidden"}).append(ar);function ap(){if(H.keySupport){ar.show();ar.focus()}}function at(av){ar.hide()}function aq(aw,av,ax){if(H.allowMove){aa.moveOffset([av,ax]);X.updateVisible()}aw.preventDefault();aw.stopPropagation()}function ao(aw){if(aw.ctrlKey){return true}ab=aw.shiftKey?true:false;var av=ab?10:1;switch(aw.keyCode){case 37:aq(aw,-av,0);break;case 39:aq(aw,av,0);break;case 38:aq(aw,0,-av);break;case 40:aq(aw,0,av);break;case 27:X.release();break;case 9:return true}return nothing(aw)}if(H.keySupport){au.insertBefore(al)}return{watchKeys:ap}}();function l(ao){return""+parseInt(ao)+"px"}function K(ao){return""+parseInt(ao)+"%"}function C(ao){return H.baseClass+"-"+ao}function D(ao){var ap=a(ao).offset();return[ap.left,ap.top]}function F(ao){return[(ao.pageX-ad[0]),(ao.pageY-ad[1])]}function E(ao){if(ao!=an){P.setCursor(ao);an=ao}}function f(aq,at){ad=D(al);P.setCursor(aq=="move"?aq:aq+"-resize");if(aq=="move"){return P.activateHandlers(R(at),o)}var ao=aa.getFixed();var ap=q(aq);var ar=aa.getCorner(q(ap));aa.setPressed(aa.getCorner(ap));aa.setCurrent(ar);P.activateHandlers(G(aq,ao),o)}function G(ap,ao){return function(aq){if(!H.aspectRatio){switch(ap){case"e":aq[1]=ao.y2;break;case"w":aq[1]=ao.y2;break;case"n":aq[0]=ao.x2;break;case"s":aq[0]=ao.x2;break}}else{switch(ap){case"e":aq[1]=ao.y+1;break;case"w":aq[1]=ao.y+1;break;case"n":aq[0]=ao.x+1;break;case"s":aq[0]=ao.x+1;break}}aa.setCurrent(aq);X.update()}}function R(ap){var ao=ap;ak.watchKeys();return function(aq){aa.moveOffset([aq[0]-ao[0],aq[1]-ao[1]]);ao=aq;X.update()}}function q(ao){switch(ao){case"n":return"sw";case"s":return"nw";case"e":return"nw";case"w":return"ne";case"ne":return"sw";case"nw":return"se";case"se":return"nw";case"sw":return"ne"}}function c(ao){return function(ap){if(H.disabled){return false}if((ao=="move")&&!H.allowMove){return false}r=true;f(ao,F(ap));ap.stopPropagation();ap.preventDefault();return false}}function T(at,ap,ar){var ao=at.width(),aq=at.height();if((ao>ap)&&ap>0){ao=ap;aq=(ap/at.width())*at.height()}if((aq>ar)&&ar>0){aq=ar;ao=(ar/at.height())*at.width()}M=at.width()/ao;e=at.height()/aq;at.width(ao).height(aq)}function Y(ao){return{x:parseInt(ao.x*M),y:parseInt(ao.y*e),x2:parseInt(ao.x2*M),y2:parseInt(ao.y2*e),w:parseInt(ao.w*M),h:parseInt(ao.h*e)}}function o(ap){var ao=aa.getFixed();if(ao.w>H.minSelect[0]&&ao.h>H.minSelect[1]){X.enableHandles();X.done()}else{X.release()}P.setCursor(H.allowSelect?"crosshair":"default")}function ac(ao){if(H.disabled){return false}if(!H.allowSelect){return false}r=true;ad=D(al);X.disableHandles();E("crosshair");var ap=F(ao);aa.setPressed(ap);P.activateHandlers(aj,o);ak.watchKeys();X.update();ao.stopPropagation();ao.preventDefault();return false}function aj(ao){aa.setCurrent(ao);X.update()}function ae(){var ao=a("
").addClass(C("tracker"));a.browser.msie&&ao.css({opacity:0,backgroundColor:"white"});return ao}function s(aG){var aB=aG[0]/M,ap=aG[1]/e,aA=aG[2]/M,ao=aG[3]/e;if(B){return}var az=aa.flipCoords(aB,ap,aA,ao);var aE=aa.getFixed();var ar=initcr=[aE.x,aE.y,aE.x2,aE.y2];var aq=H.animationDelay;var ax=ar[0];var aw=ar[1];var aA=ar[2];var ao=ar[3];var aD=az[0]-initcr[0];var au=az[1]-initcr[1];var aC=az[2]-initcr[2];var at=az[3]-initcr[3];var ay=0;var av=H.swingSpeed;X.animMode(true);var aF=function(){return function(){ay+=(100-ay)/av;ar[0]=ax+((ay/100)*aD);ar[1]=aw+((ay/100)*au);ar[2]=aA+((ay/100)*aC);ar[3]=ao+((ay/100)*at);if(ay<100){aH()}else{X.done()}if(ay>=99.8){ay=100}ai(ar)}}();function aH(){window.setTimeout(aF,aq)}aH()}function J(ao){ai([ao[0]/M,ao[1]/e,ao[2]/M,ao[3]/e])}function ai(ao){aa.setPressed([ao[0],ao[1]]);aa.setCurrent([ao[2],ao[3]]);X.update()}function z(ao){if(typeof(ao)!="object"){ao={}}H=a.extend(H,ao);if(typeof(H.onChange)!=="function"){H.onChange=function(){}}if(typeof(H.onSelect)!=="function"){H.onSelect=function(){}}}function j(){return Y(aa.getFixed())}function ag(){return aa.getFixed()}function u(ao){z(ao);N()}function v(){H.disabled=true;X.disableHandles();X.setCursor("default");P.setCursor("default")}function V(){H.disabled=false;N()}function m(){X.done();P.activateHandlers(null,null)}function af(){Z.remove();W.show()}function N(ao){H.allowResize?ao?X.enableOnly():X.enableHandles():X.disableHandles();P.setCursor(H.allowSelect?"crosshair":"default");X.setCursor(H.allowMove?"move":"default");Z.css("backgroundColor",H.bgColor);if("setSelect" in H){J(A.setSelect);X.done();delete (H.setSelect)}if("trueSize" in H){M=H.trueSize[0]/Q;e=H.trueSize[1]/O}x=H.maxSize[0]||0;ah=H.maxSize[1]||0;p=H.minSize[0]||0;S=H.minSize[1]||0;if("outerImage" in H){al.attr("src",H.outerImage);delete (H.outerImage)}X.refresh()}L.hide();N(true);var g={animateTo:s,setSelect:J,setOptions:u,tellSelect:j,tellScaled:ag,disable:v,enable:V,cancel:m,focus:ak.watchKeys,getBounds:function(){return[Q*M,O*e]},getWidgetSize:function(){return[Q,O]},release:X.release,destroy:af};W.data("Jcrop",g);return g};a.fn.Jcrop=function(c){function b(f){var e=c.useImg||f.src;var d=new Image();d.onload=function(){a.Jcrop(f,c)};d.src=e}if(typeof(c)!=="object"){c={}}this.each(function(){if(a(this).data("Jcrop")){if(c=="api"){return a(this).data("Jcrop")}else{a(this).data("Jcrop").setOptions(c)}}else{b(this)}});return this}})(jQuery);
\ No newline at end of file
diff --git a/wp-includes/js/jquery/jquery.js b/wp-includes/js/jquery/jquery.js
index 00999f68..53e8e8be 100644
--- a/wp-includes/js/jquery/jquery.js
+++ b/wp-includes/js/jquery/jquery.js
@@ -1,5 +1,5 @@
/*!
- * jQuery JavaScript Library v1.4.2
+ * jQuery JavaScript Library v1.4.4
* http://jquery.com/
*
* Copyright 2010, John Resig
@@ -11,144 +11,157 @@
* Copyright 2010, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
*
- * Date: Sat Feb 13 22:33:48 2010 -0500
+ * Date: Thu Nov 11 19:04:53 2010 -0500
*/
-(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/,
-Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&&
-(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this,
-a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b===
-"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,
-function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;ba ";
-var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected,
-parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent=
-false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML=" ";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n=
-s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true,
-applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando];
-else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,
-a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===
-w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i,
-cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected=
-c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");
-a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g,
-function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split(".");
-k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a),
-C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B=0){a.type=
-e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&&
-f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;
-if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",
-e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,
-"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a,
-d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
-e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift();
-t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D||
-g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},
-CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m,
-g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},
-text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},
-setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return hl[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h=
-h[3];l=0;for(m=h.length;l=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m===
-"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g,
-h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l ";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&&
-q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML=" ";
-if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="
";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}();
-(function(){var g=s.createElement("div");g.innerHTML="
";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}:
-function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f0)for(var j=d;j0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j=
-{},i;if(f&&a.length){e=0;for(var o=a.length;e-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a===
-"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",
-d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?
-a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType===
-1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/"+d+">"},F={option:[1,""," "],legend:[1,""," "],thead:[1,""],tr:[2,""],td:[3,""],col:[2,""],area:[1,""," "],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div","
"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=
-c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},
+(function(E,B){function ka(a,b,d){if(d===B&&a.nodeType===1){d=a.getAttribute("data-"+b);if(typeof d==="string"){try{d=d==="true"?true:d==="false"?false:d==="null"?null:!c.isNaN(d)?parseFloat(d):Ja.test(d)?c.parseJSON(d):d}catch(e){}c.data(a,b,d)}else d=B}return d}function U(){return false}function ca(){return true}function la(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function Ka(a){var b,d,e,f,h,l,k,o,x,r,A,C=[];f=[];h=c.data(this,this.nodeType?"events":"__events__");if(typeof h==="function")h=
+h.events;if(!(a.liveFired===this||!h||!h.live||a.button&&a.type==="click")){if(a.namespace)A=RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)");a.liveFired=this;var J=h.live.slice(0);for(k=0;kd)break;a.currentTarget=f.elem;a.data=f.handleObj.data;a.handleObj=f.handleObj;A=f.handleObj.origHandler.apply(f.elem,arguments);if(A===false||a.isPropagationStopped()){d=f.level;if(A===false)b=false;if(a.isImmediatePropagationStopped())break}}return b}}function Y(a,b){return(a&&a!=="*"?a+".":"")+b.replace(La,
+"`").replace(Ma,"&")}function ma(a,b,d){if(c.isFunction(b))return c.grep(a,function(f,h){return!!b.call(f,h,f)===d});else if(b.nodeType)return c.grep(a,function(f){return f===b===d});else if(typeof b==="string"){var e=c.grep(a,function(f){return f.nodeType===1});if(Na.test(b))return c.filter(b,e,!d);else b=c.filter(b,e)}return c.grep(a,function(f){return c.inArray(f,b)>=0===d})}function na(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var e=c.data(a[d++]),f=c.data(this,
+e);if(e=e&&e.events){delete f.handle;f.events={};for(var h in e)for(var l in e[h])c.event.add(this,h,e[h][l],e[h][l].data)}}})}function Oa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function oa(a,b,d){var e=b==="width"?a.offsetWidth:a.offsetHeight;if(d==="border")return e;c.each(b==="width"?Pa:Qa,function(){d||(e-=parseFloat(c.css(a,"padding"+this))||0);if(d==="margin")e+=parseFloat(c.css(a,
+"margin"+this))||0;else e-=parseFloat(c.css(a,"border"+this+"Width"))||0});return e}function da(a,b,d,e){if(c.isArray(b)&&b.length)c.each(b,function(f,h){d||Ra.test(a)?e(a,h):da(a+"["+(typeof h==="object"||c.isArray(h)?f:"")+"]",h,d,e)});else if(!d&&b!=null&&typeof b==="object")c.isEmptyObject(b)?e(a,""):c.each(b,function(f,h){da(a+"["+f+"]",h,d,e)});else e(a,b)}function S(a,b){var d={};c.each(pa.concat.apply([],pa.slice(0,b)),function(){d[this]=a});return d}function qa(a){if(!ea[a]){var b=c("<"+
+a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d==="")d="block";ea[a]=d}return ea[a]}function fa(a){return c.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var t=E.document,c=function(){function a(){if(!b.isReady){try{t.documentElement.doScroll("left")}catch(j){setTimeout(a,1);return}b.ready()}}var b=function(j,s){return new b.fn.init(j,s)},d=E.jQuery,e=E.$,f,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,l=/\S/,k=/^\s+/,o=/\s+$/,x=/\W/,r=/\d/,A=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,
+C=/^[\],:{}\s]*$/,J=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,w=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,I=/(?:^|:|,)(?:\s*\[)+/g,L=/(webkit)[ \/]([\w.]+)/,g=/(opera)(?:.*version)?[ \/]([\w.]+)/,i=/(msie) ([\w.]+)/,n=/(mozilla)(?:.*? rv:([\w.]+))?/,m=navigator.userAgent,p=false,q=[],u,y=Object.prototype.toString,F=Object.prototype.hasOwnProperty,M=Array.prototype.push,N=Array.prototype.slice,O=String.prototype.trim,D=Array.prototype.indexOf,R={};b.fn=b.prototype={init:function(j,
+s){var v,z,H;if(!j)return this;if(j.nodeType){this.context=this[0]=j;this.length=1;return this}if(j==="body"&&!s&&t.body){this.context=t;this[0]=t.body;this.selector="body";this.length=1;return this}if(typeof j==="string")if((v=h.exec(j))&&(v[1]||!s))if(v[1]){H=s?s.ownerDocument||s:t;if(z=A.exec(j))if(b.isPlainObject(s)){j=[t.createElement(z[1])];b.fn.attr.call(j,s,true)}else j=[H.createElement(z[1])];else{z=b.buildFragment([v[1]],[H]);j=(z.cacheable?z.fragment.cloneNode(true):z.fragment).childNodes}return b.merge(this,
+j)}else{if((z=t.getElementById(v[2]))&&z.parentNode){if(z.id!==v[2])return f.find(j);this.length=1;this[0]=z}this.context=t;this.selector=j;return this}else if(!s&&!x.test(j)){this.selector=j;this.context=t;j=t.getElementsByTagName(j);return b.merge(this,j)}else return!s||s.jquery?(s||f).find(j):b(s).find(j);else if(b.isFunction(j))return f.ready(j);if(j.selector!==B){this.selector=j.selector;this.context=j.context}return b.makeArray(j,this)},selector:"",jquery:"1.4.4",length:0,size:function(){return this.length},
+toArray:function(){return N.call(this,0)},get:function(j){return j==null?this.toArray():j<0?this.slice(j)[0]:this[j]},pushStack:function(j,s,v){var z=b();b.isArray(j)?M.apply(z,j):b.merge(z,j);z.prevObject=this;z.context=this.context;if(s==="find")z.selector=this.selector+(this.selector?" ":"")+v;else if(s)z.selector=this.selector+"."+s+"("+v+")";return z},each:function(j,s){return b.each(this,j,s)},ready:function(j){b.bindReady();if(b.isReady)j.call(t,b);else q&&q.push(j);return this},eq:function(j){return j===
+-1?this.slice(j):this.slice(j,+j+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(N.apply(this,arguments),"slice",N.call(arguments).join(","))},map:function(j){return this.pushStack(b.map(this,function(s,v){return j.call(s,v,s)}))},end:function(){return this.prevObject||b(null)},push:M,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var j,s,v,z,H,G=arguments[0]||{},K=1,Q=arguments.length,ga=false;
+if(typeof G==="boolean"){ga=G;G=arguments[1]||{};K=2}if(typeof G!=="object"&&!b.isFunction(G))G={};if(Q===K){G=this;--K}for(;K0))if(q){var s=0,v=q;for(q=null;j=v[s++];)j.call(t,b);b.fn.trigger&&b(t).trigger("ready").unbind("ready")}}},bindReady:function(){if(!p){p=true;if(t.readyState==="complete")return setTimeout(b.ready,1);if(t.addEventListener){t.addEventListener("DOMContentLoaded",u,false);E.addEventListener("load",b.ready,false)}else if(t.attachEvent){t.attachEvent("onreadystatechange",u);E.attachEvent("onload",
+b.ready);var j=false;try{j=E.frameElement==null}catch(s){}t.documentElement.doScroll&&j&&a()}}},isFunction:function(j){return b.type(j)==="function"},isArray:Array.isArray||function(j){return b.type(j)==="array"},isWindow:function(j){return j&&typeof j==="object"&&"setInterval"in j},isNaN:function(j){return j==null||!r.test(j)||isNaN(j)},type:function(j){return j==null?String(j):R[y.call(j)]||"object"},isPlainObject:function(j){if(!j||b.type(j)!=="object"||j.nodeType||b.isWindow(j))return false;if(j.constructor&&
+!F.call(j,"constructor")&&!F.call(j.constructor.prototype,"isPrototypeOf"))return false;for(var s in j);return s===B||F.call(j,s)},isEmptyObject:function(j){for(var s in j)return false;return true},error:function(j){throw j;},parseJSON:function(j){if(typeof j!=="string"||!j)return null;j=b.trim(j);if(C.test(j.replace(J,"@").replace(w,"]").replace(I,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(j):(new Function("return "+j))();else b.error("Invalid JSON: "+j)},noop:function(){},globalEval:function(j){if(j&&
+l.test(j)){var s=t.getElementsByTagName("head")[0]||t.documentElement,v=t.createElement("script");v.type="text/javascript";if(b.support.scriptEval)v.appendChild(t.createTextNode(j));else v.text=j;s.insertBefore(v,s.firstChild);s.removeChild(v)}},nodeName:function(j,s){return j.nodeName&&j.nodeName.toUpperCase()===s.toUpperCase()},each:function(j,s,v){var z,H=0,G=j.length,K=G===B||b.isFunction(j);if(v)if(K)for(z in j){if(s.apply(j[z],v)===false)break}else for(;Ha ";var f=d.getElementsByTagName("*"),h=d.getElementsByTagName("a")[0],l=t.createElement("select"),
+k=l.appendChild(t.createElement("option"));if(!(!f||!f.length||!h)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(h.getAttribute("style")),hrefNormalized:h.getAttribute("href")==="/a",opacity:/^0.55$/.test(h.style.opacity),cssFloat:!!h.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:k.selected,deleteExpando:true,optDisabled:false,checkClone:false,
+scriptEval:false,noCloneEvent:true,boxModel:null,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableHiddenOffsets:true};l.disabled=true;c.support.optDisabled=!k.disabled;b.type="text/javascript";try{b.appendChild(t.createTextNode("window."+e+"=1;"))}catch(o){}a.insertBefore(b,a.firstChild);if(E[e]){c.support.scriptEval=true;delete E[e]}try{delete b.test}catch(x){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function r(){c.support.noCloneEvent=
+false;d.detachEvent("onclick",r)});d.cloneNode(true).fireEvent("onclick")}d=t.createElement("div");d.innerHTML=" ";a=t.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var r=t.createElement("div");r.style.width=r.style.paddingLeft="1px";t.body.appendChild(r);c.boxModel=c.support.boxModel=r.offsetWidth===2;if("zoom"in r.style){r.style.display="inline";r.style.zoom=
+1;c.support.inlineBlockNeedsLayout=r.offsetWidth===2;r.style.display="";r.innerHTML="
";c.support.shrinkWrapBlocks=r.offsetWidth!==2}r.innerHTML="";var A=r.getElementsByTagName("td");c.support.reliableHiddenOffsets=A[0].offsetHeight===0;A[0].style.display="";A[1].style.display="none";c.support.reliableHiddenOffsets=c.support.reliableHiddenOffsets&&A[0].offsetHeight===0;r.innerHTML="";t.body.removeChild(r).style.display=
+"none"});a=function(r){var A=t.createElement("div");r="on"+r;var C=r in A;if(!C){A.setAttribute(r,"return;");C=typeof A[r]==="function"}return C};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=f=h=null}})();var ra={},Ja=/^(?:\{.*\}|\[.*\])$/;c.extend({cache:{},uuid:0,expando:"jQuery"+c.now(),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},data:function(a,b,d){if(c.acceptData(a)){a=a==E?ra:a;var e=a.nodeType,f=e?a[c.expando]:null,h=
+c.cache;if(!(e&&!f&&typeof b==="string"&&d===B)){if(e)f||(a[c.expando]=f=++c.uuid);else h=a;if(typeof b==="object")if(e)h[f]=c.extend(h[f],b);else c.extend(h,b);else if(e&&!h[f])h[f]={};a=e?h[f]:h;if(d!==B)a[b]=d;return typeof b==="string"?a[b]:a}}},removeData:function(a,b){if(c.acceptData(a)){a=a==E?ra:a;var d=a.nodeType,e=d?a[c.expando]:a,f=c.cache,h=d?f[e]:e;if(b){if(h){delete h[b];d&&c.isEmptyObject(h)&&c.removeData(a)}}else if(d&&c.support.deleteExpando)delete a[c.expando];else if(a.removeAttribute)a.removeAttribute(c.expando);
+else if(d)delete f[e];else for(var l in a)delete a[l]}},acceptData:function(a){if(a.nodeName){var b=c.noData[a.nodeName.toLowerCase()];if(b)return!(b===true||a.getAttribute("classid")!==b)}return true}});c.fn.extend({data:function(a,b){var d=null;if(typeof a==="undefined"){if(this.length){var e=this[0].attributes,f;d=c.data(this[0]);for(var h=0,l=e.length;h-1)return true;return false},val:function(a){if(!arguments.length){var b=this[0];if(b){if(c.nodeName(b,"option")){var d=b.attributes.value;return!d||d.specified?b.value:b.text}if(c.nodeName(b,"select")){var e=b.selectedIndex;d=[];var f=b.options;b=b.type==="select-one";
+if(e<0)return null;var h=b?e:0;for(e=b?e+1:f.length;h=0;else if(c.nodeName(this,"select")){var A=c.makeArray(r);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),A)>=0});if(!A.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},
+attr:function(a,b,d,e){if(!a||a.nodeType===3||a.nodeType===8)return B;if(e&&b in c.attrFn)return c(a)[b](d);e=a.nodeType!==1||!c.isXMLDoc(a);var f=d!==B;b=e&&c.props[b]||b;var h=Ta.test(b);if((b in a||a[b]!==B)&&e&&!h){if(f){b==="type"&&Ua.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");if(d===null)a.nodeType===1&&a.removeAttribute(b);else a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&
+b.specified?b.value:Va.test(a.nodeName)||Wa.test(a.nodeName)&&a.href?0:B;return a[b]}if(!c.support.style&&e&&b==="style"){if(f)a.style.cssText=""+d;return a.style.cssText}f&&a.setAttribute(b,""+d);if(!a.attributes[b]&&a.hasAttribute&&!a.hasAttribute(b))return B;a=!c.support.hrefNormalized&&e&&h?a.getAttribute(b,2):a.getAttribute(b);return a===null?B:a}});var X=/\.(.*)$/,ia=/^(?:textarea|input|select)$/i,La=/\./g,Ma=/ /g,Xa=/[^\w\s.|`]/g,Ya=function(a){return a.replace(Xa,"\\$&")},ua={focusin:0,focusout:0};
+c.event={add:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(c.isWindow(a)&&a!==E&&!a.frameElement)a=E;if(d===false)d=U;else if(!d)return;var f,h;if(d.handler){f=d;d=f.handler}if(!d.guid)d.guid=c.guid++;if(h=c.data(a)){var l=a.nodeType?"events":"__events__",k=h[l],o=h.handle;if(typeof k==="function"){o=k.handle;k=k.events}else if(!k){a.nodeType||(h[l]=h=function(){});h.events=k={}}if(!o)h.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,
+arguments):B};o.elem=a;b=b.split(" ");for(var x=0,r;l=b[x++];){h=f?c.extend({},f):{handler:d,data:e};if(l.indexOf(".")>-1){r=l.split(".");l=r.shift();h.namespace=r.slice(0).sort().join(".")}else{r=[];h.namespace=""}h.type=l;if(!h.guid)h.guid=d.guid;var A=k[l],C=c.event.special[l]||{};if(!A){A=k[l]=[];if(!C.setup||C.setup.call(a,e,r,o)===false)if(a.addEventListener)a.addEventListener(l,o,false);else a.attachEvent&&a.attachEvent("on"+l,o)}if(C.add){C.add.call(a,h);if(!h.handler.guid)h.handler.guid=
+d.guid}A.push(h);c.event.global[l]=true}a=null}}},global:{},remove:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(d===false)d=U;var f,h,l=0,k,o,x,r,A,C,J=a.nodeType?"events":"__events__",w=c.data(a),I=w&&w[J];if(w&&I){if(typeof I==="function"){w=I;I=I.events}if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(f in I)c.event.remove(a,f+b)}else{for(b=b.split(" ");f=b[l++];){r=f;k=f.indexOf(".")<0;o=[];if(!k){o=f.split(".");f=o.shift();x=RegExp("(^|\\.)"+
+c.map(o.slice(0).sort(),Ya).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(A=I[f])if(d){r=c.event.special[f]||{};for(h=e||0;h=0){a.type=f=f.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[f]&&c.each(c.cache,function(){this.events&&this.events[f]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===
+8)return B;a.result=B;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(e=d.nodeType?c.data(d,"handle"):(c.data(d,"__events__")||{}).handle)&&e.apply(d,b);e=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+f]&&d["on"+f].apply(d,b)===false){a.result=false;a.preventDefault()}}catch(h){}if(!a.isPropagationStopped()&&e)c.event.trigger(a,b,e,true);else if(!a.isDefaultPrevented()){var l;e=a.target;var k=f.replace(X,""),o=c.nodeName(e,"a")&&k===
+"click",x=c.event.special[k]||{};if((!x._default||x._default.call(d,a)===false)&&!o&&!(e&&e.nodeName&&c.noData[e.nodeName.toLowerCase()])){try{if(e[k]){if(l=e["on"+k])e["on"+k]=null;c.event.triggered=true;e[k]()}}catch(r){}if(l)e["on"+k]=l;c.event.triggered=false}}},handle:function(a){var b,d,e,f;d=[];var h=c.makeArray(arguments);a=h[0]=c.event.fix(a||E.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){e=a.type.split(".");a.type=e.shift();d=e.slice(0).sort();e=RegExp("(^|\\.)"+
+d.join("\\.(?:.*\\.)?")+"(\\.|$)")}a.namespace=a.namespace||d.join(".");f=c.data(this,this.nodeType?"events":"__events__");if(typeof f==="function")f=f.events;d=(f||{})[a.type];if(f&&d){d=d.slice(0);f=0;for(var l=d.length;f-1?c.map(a.options,function(e){return e.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},Z=function(a,b){var d=a.target,e,f;if(!(!ia.test(d.nodeName)||d.readOnly)){e=c.data(d,"_change_data");f=xa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",f);if(!(e===B||f===e))if(e!=null||f){a.type="change";a.liveFired=
+B;return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:Z,beforedeactivate:Z,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return Z.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return Z.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,"_change_data",xa(a))}},setup:function(){if(this.type===
+"file")return false;for(var a in V)c.event.add(this,a+".specialChange",V[a]);return ia.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return ia.test(this.nodeName)}};V=c.event.special.change.filters;V.focus=V.beforeactivate}t.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.trigger(e,null,e.target)}c.event.special[b]={setup:function(){ua[b]++===0&&t.addEventListener(a,d,true)},teardown:function(){--ua[b]===
+0&&t.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,e,f){if(typeof d==="object"){for(var h in d)this[b](h,e,d[h],f);return this}if(c.isFunction(e)||e===false){f=e;e=B}var l=b==="one"?c.proxy(f,function(o){c(this).unbind(o,l);return f.apply(this,arguments)}):f;if(d==="unload"&&b!=="one")this.one(d,e,f);else{h=0;for(var k=this.length;h0?this.bind(b,d,e):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});E.attachEvent&&!E.addEventListener&&c(E).bind("unload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});
+(function(){function a(g,i,n,m,p,q){p=0;for(var u=m.length;p0){F=y;break}}y=y[g]}m[p]=F}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,h=false,l=true;[0,0].sort(function(){l=false;return 0});var k=function(g,i,n,m){n=n||[];var p=i=i||t;if(i.nodeType!==1&&i.nodeType!==9)return[];if(!g||typeof g!=="string")return n;var q,u,y,F,M,N=true,O=k.isXML(i),D=[],R=g;do{d.exec("");if(q=d.exec(R)){R=q[3];D.push(q[1]);if(q[2]){F=q[3];
+break}}}while(q);if(D.length>1&&x.exec(g))if(D.length===2&&o.relative[D[0]])u=L(D[0]+D[1],i);else for(u=o.relative[D[0]]?[i]:k(D.shift(),i);D.length;){g=D.shift();if(o.relative[g])g+=D.shift();u=L(g,u)}else{if(!m&&D.length>1&&i.nodeType===9&&!O&&o.match.ID.test(D[0])&&!o.match.ID.test(D[D.length-1])){q=k.find(D.shift(),i,O);i=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]}if(i){q=m?{expr:D.pop(),set:C(m)}:k.find(D.pop(),D.length===1&&(D[0]==="~"||D[0]==="+")&&i.parentNode?i.parentNode:i,O);u=q.expr?k.filter(q.expr,
+q.set):q.set;if(D.length>0)y=C(u);else N=false;for(;D.length;){q=M=D.pop();if(o.relative[M])q=D.pop();else M="";if(q==null)q=i;o.relative[M](y,q,O)}}else y=[]}y||(y=u);y||k.error(M||g);if(f.call(y)==="[object Array]")if(N)if(i&&i.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&k.contains(i,y[g])))n.push(u[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&n.push(u[g]);else n.push.apply(n,y);else C(y,n);if(F){k(F,p,n,m);k.uniqueSort(n)}return n};k.uniqueSort=function(g){if(w){h=
+l;g.sort(w);if(h)for(var i=1;i0};k.find=function(g,i,n){var m;if(!g)return[];for(var p=0,q=o.order.length;p":function(g,i){var n,m=typeof i==="string",p=0,q=g.length;if(m&&!/\W/.test(i))for(i=i.toLowerCase();p=0))n||m.push(u);else if(n)i[q]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var i=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=i[1]+(i[2]||1)-0;g[3]=i[3]-0}g[0]=e++;return g},ATTR:function(g,i,n,
+m,p,q){i=g[1].replace(/\\/g,"");if(!q&&o.attrMap[i])g[1]=o.attrMap[i];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,i,n,m,p){if(g[1]==="not")if((d.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,i);else{g=k.filter(g[3],i,n,true^p);n||m.push.apply(m,g);return false}else if(o.match.POS.test(g[0])||o.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===
+true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,i,n){return!!k(n[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===
+g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,i){return i===0},last:function(g,i,n,m){return i===m.length-1},even:function(g,i){return i%2===0},odd:function(g,i){return i%2===1},lt:function(g,i,n){return in[3]-0},nth:function(g,i,n){return n[3]-
+0===i},eq:function(g,i,n){return n[3]-0===i}},filter:{PSEUDO:function(g,i,n,m){var p=i[1],q=o.filters[p];if(q)return q(g,n,i,m);else if(p==="contains")return(g.textContent||g.innerText||k.getText([g])||"").indexOf(i[3])>=0;else if(p==="not"){i=i[3];n=0;for(m=i.length;n=0}},ID:function(g,i){return g.nodeType===1&&g.getAttribute("id")===i},TAG:function(g,i){return i==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===
+i},CLASS:function(g,i){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(i)>-1},ATTR:function(g,i){var n=i[1];n=o.attrHandle[n]?o.attrHandle[n](g):g[n]!=null?g[n]:g.getAttribute(n);var m=n+"",p=i[2],q=i[4];return n==null?p==="!=":p==="="?m===q:p==="*="?m.indexOf(q)>=0:p==="~="?(" "+m+" ").indexOf(q)>=0:!q?m&&n!==false:p==="!="?m!==q:p==="^="?m.indexOf(q)===0:p==="$="?m.substr(m.length-q.length)===q:p==="|="?m===q||m.substr(0,q.length+1)===q+"-":false},POS:function(g,i,n,m){var p=o.setFilters[i[2]];
+if(p)return p(g,n,i,m)}}},x=o.match.POS,r=function(g,i){return"\\"+(i-0+1)},A;for(A in o.match){o.match[A]=RegExp(o.match[A].source+/(?![^\[]*\])(?![^\(]*\))/.source);o.leftMatch[A]=RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[A].source.replace(/\\(\d+)/g,r))}var C=function(g,i){g=Array.prototype.slice.call(g,0);if(i){i.push.apply(i,g);return i}return g};try{Array.prototype.slice.call(t.documentElement.childNodes,0)}catch(J){C=function(g,i){var n=0,m=i||[];if(f.call(g)==="[object Array]")Array.prototype.push.apply(m,
+g);else if(typeof g.length==="number")for(var p=g.length;n
";n.insertBefore(g,n.firstChild);if(t.getElementById(i)){o.find.ID=function(m,p,q){if(typeof p.getElementById!=="undefined"&&!q)return(p=p.getElementById(m[1]))?p.id===m[1]||typeof p.getAttributeNode!=="undefined"&&p.getAttributeNode("id").nodeValue===m[1]?[p]:B:[]};o.filter.ID=function(m,p){var q=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&q&&q.nodeValue===p}}n.removeChild(g);
+n=g=null})();(function(){var g=t.createElement("div");g.appendChild(t.createComment(""));if(g.getElementsByTagName("*").length>0)o.find.TAG=function(i,n){var m=n.getElementsByTagName(i[1]);if(i[1]==="*"){for(var p=[],q=0;m[q];q++)m[q].nodeType===1&&p.push(m[q]);m=p}return m};g.innerHTML=" ";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")o.attrHandle.href=function(i){return i.getAttribute("href",2)};g=null})();t.querySelectorAll&&
+function(){var g=k,i=t.createElement("div");i.innerHTML="
";if(!(i.querySelectorAll&&i.querySelectorAll(".TEST").length===0)){k=function(m,p,q,u){p=p||t;m=m.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!u&&!k.isXML(p))if(p.nodeType===9)try{return C(p.querySelectorAll(m),q)}catch(y){}else if(p.nodeType===1&&p.nodeName.toLowerCase()!=="object"){var F=p.getAttribute("id"),M=F||"__sizzle__";F||p.setAttribute("id",M);try{return C(p.querySelectorAll("#"+M+" "+m),q)}catch(N){}finally{F||
+p.removeAttribute("id")}}return g(m,p,q,u)};for(var n in g)k[n]=g[n];i=null}}();(function(){var g=t.documentElement,i=g.matchesSelector||g.mozMatchesSelector||g.webkitMatchesSelector||g.msMatchesSelector,n=false;try{i.call(t.documentElement,"[test!='']:sizzle")}catch(m){n=true}if(i)k.matchesSelector=function(p,q){q=q.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(p))try{if(n||!o.match.PSEUDO.test(q)&&!/!=/.test(q))return i.call(p,q)}catch(u){}return k(q,null,null,[p]).length>0}})();(function(){var g=
+t.createElement("div");g.innerHTML="
";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){o.order.splice(1,0,"CLASS");o.find.CLASS=function(i,n,m){if(typeof n.getElementsByClassName!=="undefined"&&!m)return n.getElementsByClassName(i[1])};g=null}}})();k.contains=t.documentElement.contains?function(g,i){return g!==i&&(g.contains?g.contains(i):true)}:t.documentElement.compareDocumentPosition?
+function(g,i){return!!(g.compareDocumentPosition(i)&16)}:function(){return false};k.isXML=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false};var L=function(g,i){for(var n,m=[],p="",q=i.nodeType?[i]:i;n=o.match.PSEUDO.exec(g);){p+=n[0];g=g.replace(o.match.PSEUDO,"")}g=o.relative[g]?g+"*":g;n=0;for(var u=q.length;n0)for(var h=d;h0},closest:function(a,b){var d=[],e,f,h=this[0];if(c.isArray(a)){var l,k={},o=1;if(h&&a.length){e=0;for(f=a.length;e-1:c(h).is(e))d.push({selector:l,elem:h,level:o})}h=
+h.parentNode;o++}}return d}l=cb.test(a)?c(a,b||this.context):null;e=0;for(f=this.length;e-1:c.find.matchesSelector(h,a)){d.push(h);break}else{h=h.parentNode;if(!h||!h.ownerDocument||h===b)break}d=d.length>1?c.unique(d):d;return this.pushStack(d,"closest",a)},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var d=typeof a==="string"?c(a,b||this.context):
+c.makeArray(a),e=c.merge(this.get(),d);return this.pushStack(!d[0]||!d[0].parentNode||d[0].parentNode.nodeType===11||!e[0]||!e[0].parentNode||e[0].parentNode.nodeType===11?e:c.unique(e))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,
+2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,
+b){c.fn[a]=function(d,e){var f=c.map(this,b,d);Za.test(a)||(e=d);if(e&&typeof e==="string")f=c.filter(e,f);f=this.length>1?c.unique(f):f;if((this.length>1||ab.test(e))&&$a.test(a))f=f.reverse();return this.pushStack(f,a,bb.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return b.length===1?c.find.matchesSelector(b[0],a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,d){var e=[];for(a=a[b];a&&a.nodeType!==9&&(d===B||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&&
+e.push(a);a=a[b]}return e},nth:function(a,b,d){b=b||1;for(var e=0;a;a=a[d])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var za=/ jQuery\d+="(?:\d+|null)"/g,$=/^\s+/,Aa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Ba=/<([\w:]+)/,db=/\s]+\/)>/g,P={option:[1,
+""," "],legend:[1,""," "],thead:[1,""],tr:[2,""],td:[3,""],col:[2,""],area:[1,""," "],_default:[0,"",""]};P.optgroup=P.option;P.tbody=P.tfoot=P.colgroup=P.caption=P.thead;P.th=P.td;if(!c.support.htmlSerialize)P._default=[1,"div","
"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=
+c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==B)return this.empty().append((this[0]&&this[0].ownerDocument||t).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},
wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},
prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,
-this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);
-return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja,
-""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]);
-return this}else{e=0;for(var j=d.length;e0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["",
-""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]===""&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e=
-c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]?
-c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja=
-function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter=
-Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a,
-"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f=
-a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=
-a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=/
+
');
-
-function init() {
- var pl = "", f, val;
- var type = "flash", fe, i;
-
- ed = tinyMCEPopup.editor;
-
- tinyMCEPopup.resizeToInnerSize();
- f = document.forms[0]
-
- fe = ed.selection.getNode();
- if (/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(ed.dom.getAttrib(fe, 'class'))) {
- pl = fe.title;
-
- switch (ed.dom.getAttrib(fe, 'class')) {
- case 'mceItemFlash':
- type = 'flash';
- break;
-
- case 'mceItemFlashVideo':
- type = 'flv';
- break;
-
- case 'mceItemShockWave':
- type = 'shockwave';
- break;
-
- case 'mceItemWindowsMedia':
- type = 'wmp';
- break;
-
- case 'mceItemQuickTime':
- type = 'qt';
- break;
-
- case 'mceItemRealMedia':
- type = 'rmp';
- break;
- }
-
- document.forms[0].insert.value = ed.getLang('update', 'Insert', true);
- }
-
- document.getElementById('filebrowsercontainer').innerHTML = getBrowserHTML('filebrowser','src','media','media');
- document.getElementById('qtsrcfilebrowsercontainer').innerHTML = getBrowserHTML('qtsrcfilebrowser','qt_qtsrc','media','media');
- document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
-
- var html = getMediaListHTML('medialist','src','media','media');
- if (html == "")
- document.getElementById("linklistrow").style.display = 'none';
- else
- document.getElementById("linklistcontainer").innerHTML = html;
-
- // Resize some elements
- if (isVisible('filebrowser'))
- document.getElementById('src').style.width = '230px';
-
- // Setup form
- if (pl != "") {
- pl = tinyMCEPopup.editor.plugins.media._parse(pl);
-
- switch (type) {
- case "flash":
- setBool(pl, 'flash', 'play');
- setBool(pl, 'flash', 'loop');
- setBool(pl, 'flash', 'menu');
- setBool(pl, 'flash', 'swliveconnect');
- setStr(pl, 'flash', 'quality');
- setStr(pl, 'flash', 'scale');
- setStr(pl, 'flash', 'salign');
- setStr(pl, 'flash', 'wmode');
- setStr(pl, 'flash', 'base');
- setStr(pl, 'flash', 'flashvars');
- break;
-
- case "qt":
- setBool(pl, 'qt', 'loop');
- setBool(pl, 'qt', 'autoplay');
- setBool(pl, 'qt', 'cache');
- setBool(pl, 'qt', 'controller');
- setBool(pl, 'qt', 'correction');
- setBool(pl, 'qt', 'enablejavascript');
- setBool(pl, 'qt', 'kioskmode');
- setBool(pl, 'qt', 'autohref');
- setBool(pl, 'qt', 'playeveryframe');
- setBool(pl, 'qt', 'tarsetcache');
- setStr(pl, 'qt', 'scale');
- setStr(pl, 'qt', 'starttime');
- setStr(pl, 'qt', 'endtime');
- setStr(pl, 'qt', 'tarset');
- setStr(pl, 'qt', 'qtsrcchokespeed');
- setStr(pl, 'qt', 'volume');
- setStr(pl, 'qt', 'qtsrc');
- break;
-
- case "shockwave":
- setBool(pl, 'shockwave', 'sound');
- setBool(pl, 'shockwave', 'progress');
- setBool(pl, 'shockwave', 'autostart');
- setBool(pl, 'shockwave', 'swliveconnect');
- setStr(pl, 'shockwave', 'swvolume');
- setStr(pl, 'shockwave', 'swstretchstyle');
- setStr(pl, 'shockwave', 'swstretchhalign');
- setStr(pl, 'shockwave', 'swstretchvalign');
- break;
-
- case "wmp":
- setBool(pl, 'wmp', 'autostart');
- setBool(pl, 'wmp', 'enabled');
- setBool(pl, 'wmp', 'enablecontextmenu');
- setBool(pl, 'wmp', 'fullscreen');
- setBool(pl, 'wmp', 'invokeurls');
- setBool(pl, 'wmp', 'mute');
- setBool(pl, 'wmp', 'stretchtofit');
- setBool(pl, 'wmp', 'windowlessvideo');
- setStr(pl, 'wmp', 'balance');
- setStr(pl, 'wmp', 'baseurl');
- setStr(pl, 'wmp', 'captioningid');
- setStr(pl, 'wmp', 'currentmarker');
- setStr(pl, 'wmp', 'currentposition');
- setStr(pl, 'wmp', 'defaultframe');
- setStr(pl, 'wmp', 'playcount');
- setStr(pl, 'wmp', 'rate');
- setStr(pl, 'wmp', 'uimode');
- setStr(pl, 'wmp', 'volume');
- break;
-
- case "rmp":
- setBool(pl, 'rmp', 'autostart');
- setBool(pl, 'rmp', 'loop');
- setBool(pl, 'rmp', 'autogotourl');
- setBool(pl, 'rmp', 'center');
- setBool(pl, 'rmp', 'imagestatus');
- setBool(pl, 'rmp', 'maintainaspect');
- setBool(pl, 'rmp', 'nojava');
- setBool(pl, 'rmp', 'prefetch');
- setBool(pl, 'rmp', 'shuffle');
- setStr(pl, 'rmp', 'console');
- setStr(pl, 'rmp', 'controls');
- setStr(pl, 'rmp', 'numloop');
- setStr(pl, 'rmp', 'scriptcallbacks');
- break;
- }
-
- setStr(pl, null, 'src');
- setStr(pl, null, 'id');
- setStr(pl, null, 'name');
- setStr(pl, null, 'vspace');
- setStr(pl, null, 'hspace');
- setStr(pl, null, 'bgcolor');
- setStr(pl, null, 'align');
- setStr(pl, null, 'width');
- setStr(pl, null, 'height');
-
- if ((val = ed.dom.getAttrib(fe, "width")) != "")
- pl.width = f.width.value = val;
-
- if ((val = ed.dom.getAttrib(fe, "height")) != "")
- pl.height = f.height.value = val;
-
- oldWidth = pl.width ? parseInt(pl.width) : 0;
- oldHeight = pl.height ? parseInt(pl.height) : 0;
- } else
- oldWidth = oldHeight = 0;
-
- selectByValue(f, 'media_type', type);
- changedType(type);
- updateColor('bgcolor_pick', 'bgcolor');
-
- TinyMCE_EditableSelects.init();
- generatePreview();
-}
-
-function insertMedia() {
- var fe, f = document.forms[0], h;
-
- tinyMCEPopup.restoreSelection();
-
- if (!AutoValidator.validate(f)) {
- tinyMCEPopup.alert(ed.getLang('invalid_data'));
- return false;
- }
-
- f.width.value = f.width.value == "" ? 100 : f.width.value;
- f.height.value = f.height.value == "" ? 100 : f.height.value;
-
- fe = ed.selection.getNode();
- if (fe != null && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(ed.dom.getAttrib(fe, 'class'))) {
- switch (f.media_type.options[f.media_type.selectedIndex].value) {
- case "flash":
- fe.className = "mceItemFlash";
- break;
-
- case "flv":
- fe.className = "mceItemFlashVideo";
- break;
-
- case "shockwave":
- fe.className = "mceItemShockWave";
- break;
-
- case "qt":
- fe.className = "mceItemQuickTime";
- break;
-
- case "wmp":
- fe.className = "mceItemWindowsMedia";
- break;
-
- case "rmp":
- fe.className = "mceItemRealMedia";
- break;
- }
-
- if (fe.width != f.width.value || fe.height != f.height.value)
- ed.execCommand('mceRepaint');
-
- fe.title = serializeParameters();
- fe.width = f.width.value;
- fe.height = f.height.value;
- fe.style.width = f.width.value + (f.width.value.indexOf('%') == -1 ? 'px' : '');
- fe.style.height = f.height.value + (f.height.value.indexOf('%') == -1 ? 'px' : '');
- fe.align = f.align.options[f.align.selectedIndex].value;
- } else {
- h = ' ';
-
- ed.execCommand('mceInsertContent', false, h);
- }
-
- tinyMCEPopup.close();
-}
-
-function updatePreview() {
- var f = document.forms[0], type;
-
- f.width.value = f.width.value || '320';
- f.height.value = f.height.value || '240';
-
- type = getType(f.src.value);
- selectByValue(f, 'media_type', type);
- changedType(type);
- generatePreview();
-}
-
-function getMediaListHTML() {
- if (typeof(tinyMCEMediaList) != "undefined" && tinyMCEMediaList.length > 0) {
- var html = "";
-
- html += '';
- html += '--- ';
-
- for (var i=0; i' + tinyMCEMediaList[i][0] + '';
-
- html += ' ';
-
- return html;
- }
-
- return "";
-}
-
-function getType(v) {
- var fo, i, c, el, x, f = document.forms[0];
-
- fo = ed.getParam("media_types", "flash=swf;flv=flv;shockwave=dcr;qt=mov,qt,mpg,mp3,mp4,mpeg;shockwave=dcr;wmp=avi,wmv,wm,asf,asx,wmx,wvx;rmp=rm,ra,ram").split(';');
-
- // YouTube
- if (v.match(/watch\?v=(.+)(.*)/)) {
- f.width.value = '425';
- f.height.value = '350';
- f.src.value = 'http://www.youtube.com/v/' + v.match(/v=(.*)(.*)/)[0].split('=')[1];
- return 'flash';
- }
-
- // Google video
- if (v.indexOf('http://video.google.com/videoplay?docid=') == 0) {
- f.width.value = '425';
- f.height.value = '326';
- f.src.value = 'http://video.google.com/googleplayer.swf?docId=' + v.substring('http://video.google.com/videoplay?docid='.length) + '&hl=en';
- return 'flash';
- }
-
- for (i=0; i 0 ? s.substring(0, s.length - 1) : s;
-
- return s;
-}
-
-function setBool(pl, p, n) {
- if (typeof(pl[n]) == "undefined")
- return;
-
- document.forms[0].elements[p + "_" + n].checked = pl[n] != 'false';
-}
-
-function setStr(pl, p, n) {
- var f = document.forms[0], e = f.elements[(p != null ? p + "_" : '') + n];
-
- if (typeof(pl[n]) == "undefined")
- return;
-
- if (e.type == "text")
- e.value = pl[n];
- else
- selectByValue(f, (p != null ? p + "_" : '') + n, pl[n]);
-}
-
-function getBool(p, n, d, tv, fv) {
- var v = document.forms[0].elements[p + "_" + n].checked;
-
- tv = typeof(tv) == 'undefined' ? 'true' : "'" + jsEncode(tv) + "'";
- fv = typeof(fv) == 'undefined' ? 'false' : "'" + jsEncode(fv) + "'";
-
- return (v == d) ? '' : n + (v ? ':' + tv + ',' : ":\'" + fv + "\',");
-}
-
-function getStr(p, n, d) {
- var e = document.forms[0].elements[(p != null ? p + "_" : "") + n];
- var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value;
-
- if (n == 'src')
- v = tinyMCEPopup.editor.convertURL(v, 'src', null);
-
- return ((n == d || v == '') ? '' : n + ":'" + jsEncode(v) + "',");
-}
-
-function getInt(p, n, d) {
- var e = document.forms[0].elements[(p != null ? p + "_" : "") + n];
- var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value;
-
- return ((n == d || v == '') ? '' : n + ":" + v.replace(/[^0-9]+/g, '') + ",");
-}
-
-function jsEncode(s) {
- s = s.replace(new RegExp('\\\\', 'g'), '\\\\');
- s = s.replace(new RegExp('"', 'g'), '\\"');
- s = s.replace(new RegExp("'", 'g'), "\\'");
-
- return s;
-}
-
-function generatePreview(c) {
- var f = document.forms[0], p = document.getElementById('prev'), h = '', cls, pl, n, type, codebase, wp, hp, nw, nh;
-
- p.innerHTML = '';
-
- nw = parseInt(f.width.value);
- nh = parseInt(f.height.value);
-
- if (f.width.value != "" && f.height.value != "") {
- if (f.constrain.checked) {
- if (c == 'width' && oldWidth != 0) {
- wp = nw / oldWidth;
- nh = Math.round(wp * nh);
- f.height.value = nh;
- } else if (c == 'height' && oldHeight != 0) {
- hp = nh / oldHeight;
- nw = Math.round(hp * nw);
- f.width.value = nw;
- }
- }
- }
-
- if (f.width.value != "")
- oldWidth = nw;
-
- if (f.height.value != "")
- oldHeight = nh;
-
- // After constrain
- pl = serializeParameters();
-
- switch (f.media_type.options[f.media_type.selectedIndex].value) {
- case "flash":
- cls = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
- codebase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';
- type = 'application/x-shockwave-flash';
- break;
-
- case "shockwave":
- cls = 'clsid:166B1BCA-3F9C-11CF-8075-444553540000';
- codebase = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';
- type = 'application/x-director';
- break;
-
- case "qt":
- cls = 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B';
- codebase = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';
- type = 'video/quicktime';
- break;
-
- case "wmp":
- cls = ed.getParam('media_wmp6_compatible') ? 'clsid:05589FA1-C356-11CE-BF01-00AA0055595A' : 'clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6';
- codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';
- type = 'application/x-mplayer2';
- break;
-
- case "rmp":
- cls = 'clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA';
- codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';
- type = 'audio/x-pn-realaudio-plugin';
- break;
- }
-
- if (pl == '') {
- p.innerHTML = '';
- return;
- }
-
- pl = tinyMCEPopup.editor.plugins.media._parse(pl);
-
- if (!pl.src) {
- p.innerHTML = '';
- return;
- }
-
- pl.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(pl.src);
- pl.width = !pl.width ? 100 : pl.width;
- pl.height = !pl.height ? 100 : pl.height;
- pl.id = !pl.id ? 'obj' : pl.id;
- pl.name = !pl.name ? 'eobj' : pl.name;
- pl.align = !pl.align ? '' : pl.align;
-
- // Avoid annoying warning about insecure items
- if (!tinymce.isIE || document.location.protocol != 'https:') {
- h += '';
-
- for (n in pl) {
- h += ' ';
-
- // Add extra url parameter if it's an absolute URL
- if (n == 'src' && pl[n].indexOf('://') != -1)
- h += ' ';
- }
- }
-
- h += ' ';
-
- // Avoid annoying warning about insecure items
- if (!tinymce.isIE || document.location.protocol != 'https:')
- h += ' ';
-
- p.innerHTML = "" + h;
-}
-
-tinyMCEPopup.onInit.add(init);
diff --git a/wp-includes/js/tinymce/plugins/media/media.htm b/wp-includes/js/tinymce/plugins/media/media.htm
deleted file mode 100644
index 0ab7ba64..00000000
--- a/wp-includes/js/tinymce/plugins/media/media.htm
+++ /dev/null
@@ -1,822 +0,0 @@
-
-
-
- {#media_dlg.title}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {#media_dlg.general}
-
-
-
- {#media_dlg.type}
-
-
- Flash
-
- Quicktime
- Shockwave
- Windows Media
- Real Media
-
-
-
-
- {#media_dlg.file}
-
-
-
-
-
- {#media_dlg.list}
-
-
-
- {#media_dlg.size}
-
-
-
-
-
-
-
-
- {#media_dlg.preview}
-
-
-
-
-
-
- {#media_dlg.advanced}
-
-
-
-
-
- {#media_dlg.flash_options}
-
-
-
- {#media_dlg.quality}
-
-
- {#not_set}
- high
- low
- autolow
- autohigh
- best
-
-
-
- {#media_dlg.scale}
-
-
- {#not_set}
- showall
- noborder
- exactfit
- noscale
-
-
-
-
-
- {#media_dlg.wmode}
-
-
- {#not_set}
- window
- opaque
- transparent
-
-
-
- {#media_dlg.salign}
-
-
- {#not_set}
- {#media_dlg.align_left}
- {#media_dlg.align_top}
- {#media_dlg.align_right}
- {#media_dlg.align_bottom}
- {#media_dlg.align_top_left}
- {#media_dlg.align_top_right}
- {#media_dlg.align_bottom_left}
- {#media_dlg.align_bottom_right}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {#media_dlg.menu}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {#media_dlg.flv_options}
-
-
-
-
-
- {#media_dlg.qt_options}
-
-
-
-
-
- {#media_dlg.wmp_options}
-
-
-
-
-
- {#media_dlg.rmp_options}
-
-
-
-
-
- {#media_dlg.shockwave_options}
-
-
-
-
-
-
-
-
-
-
diff --git a/wp-includes/js/tinymce/plugins/paste/editor_plugin.js b/wp-includes/js/tinymce/plugins/paste/editor_plugin.js
index 7b2bbd9b..55205957 100644
--- a/wp-includes/js/tinymce/plugins/paste/editor_plugin.js
+++ b/wp-includes/js/tinymce/plugins/paste/editor_plugin.js
@@ -1 +1 @@
-(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.PastePlugin",{init:function(c,d){var e=this,b;e.editor=c;e.url=d;e.onPreProcess=new tinymce.util.Dispatcher(e);e.onPostProcess=new tinymce.util.Dispatcher(e);e.onPreProcess.add(e._preProcess);e.onPostProcess.add(e._postProcess);e.onPreProcess.add(function(h,i){c.execCallback("paste_preprocess",h,i)});e.onPostProcess.add(function(h,i){c.execCallback("paste_postprocess",h,i)});function g(i){var h=c.dom;e.onPreProcess.dispatch(e,i);i.node=h.create("div",0,i.content);e.onPostProcess.dispatch(e,i);i.content=c.serializer.serialize(i.node,{getInner:1});if(/<(p|h[1-6]|ul|ol)/.test(i.content)){e._insertBlockContent(c,h,i.content)}else{e._insert(i.content)}}c.addCommand("mceInsertClipboardContent",function(h,i){g(i)});function f(l){var p,k,i,j=c.selection,o=c.dom,h=c.getBody(),m;if(o.get("_mcePaste")){return}p=o.add(h,"div",{id:"_mcePaste"},"\uFEFF");if(h!=c.getDoc().body){m=o.getPos(c.selection.getStart(),h).y}else{m=h.scrollTop}o.setStyles(p,{position:"absolute",left:-10000,top:m,width:1,height:1,overflow:"hidden"});if(tinymce.isIE){i=o.doc.body.createTextRange();i.moveToElementText(p);i.execCommand("Paste");o.remove(p);if(p.innerHTML==="\uFEFF"){c.execCommand("mcePasteWord");l.preventDefault();return}g({content:p.innerHTML});return tinymce.dom.Event.cancel(l)}else{k=c.selection.getRng();p=p.firstChild;i=c.getDoc().createRange();i.setStart(p,0);i.setEnd(p,1);j.setRng(i);window.setTimeout(function(){var q="",n=o.select("div[id=_mcePaste]");a(n,function(r){q+=(o.select("> span.Apple-style-span div",r)[0]||o.select("> span.Apple-style-span",r)[0]||r).innerHTML});a(n,function(r){o.remove(r)});if(k){j.setRng(k)}g({content:q})},0)}}if(c.getParam("paste_auto_cleanup_on_paste",true)){if(tinymce.isOpera||/Firefox\/2/.test(navigator.userAgent)){c.onKeyDown.add(function(h,i){if(((tinymce.isMac?i.metaKey:i.ctrlKey)&&i.keyCode==86)||(i.shiftKey&&i.keyCode==45)){f(i)}})}else{c.onPaste.addToTop(function(h,i){return f(i)})}}if(c.getParam("paste_block_drop")){c.onInit.add(function(){c.dom.bind(c.getBody(),["dragend","dragover","draggesture","dragdrop","drop","drag"],function(h){h.preventDefault();h.stopPropagation();return false})})}e._legacySupport()},getInfo:function(){return{longname:"Paste text/word",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_preProcess:function(d,i){var b=this.editor,c=i.content,g,f;function g(h){a(h,function(j){if(j.constructor==RegExp){c=c.replace(j,"")}else{c=c.replace(j[0],j[1])}})}if(/(class=\"?Mso|style=\"[^\"]*\bmso\-|w:WordDocument)/.test(c)||i.wordContent){i.wordContent=true;g([/^\s*( )+/g,/( | ]*>)+\s*$/g]);if(b.getParam("paste_convert_middot_lists",true)){g([[//gi,"$&__MCE_ITEM__"],[/(]+:\s*symbol[^>]+>)/gi,"$1__MCE_ITEM__"],[/(]+mso-list:[^>]+>)/gi,"$1__MCE_ITEM__"]])}g([//gi,/<\/?(img|font|meta|link|style|div|v:\w+)[^>]*>/gi,/<\\?\?xml[^>]*>/gi,/<\/?o:[^>]*>/gi,/ (id|name|language|type|on\w+|v:\w+)=\"([^\"]*)\"/gi,/ (id|name|language|type|on\w+|v:\w+)=(\w+)/gi,[/<(\/?)s>/gi,"<$1strike>"],/
-
+
+
diff --git a/wp-includes/js/tinymce/plugins/paste/pasteword.htm b/wp-includes/js/tinymce/plugins/paste/pasteword.htm
index 68dab3ec..7b42d8ca 100644
--- a/wp-includes/js/tinymce/plugins/paste/pasteword.htm
+++ b/wp-includes/js/tinymce/plugins/paste/pasteword.htm
@@ -1,9 +1,8 @@
-
{#paste.paste_word_desc}
-
-
+
+
diff --git a/wp-includes/js/tinymce/plugins/safari/blank.htm b/wp-includes/js/tinymce/plugins/safari/blank.htm
deleted file mode 100644
index 266808ce..00000000
--- a/wp-includes/js/tinymce/plugins/safari/blank.htm
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/wp-includes/js/tinymce/plugins/safari/editor_plugin.js b/wp-includes/js/tinymce/plugins/safari/editor_plugin.js
deleted file mode 100644
index 794477c9..00000000
--- a/wp-includes/js/tinymce/plugins/safari/editor_plugin.js
+++ /dev/null
@@ -1 +0,0 @@
-(function(){var a=tinymce.dom.Event,c=tinymce.grep,d=tinymce.each,b=tinymce.inArray;function e(j,i,h){var g,k;g=j.createTreeWalker(i,NodeFilter.SHOW_ALL,null,false);while(k=g.nextNode()){if(h){if(!h(k)){return false}}if(k.nodeType==3&&k.nodeValue&&/[^\s\u00a0]+/.test(k.nodeValue)){return false}if(k.nodeType==1&&/^(HR|IMG|TABLE)$/.test(k.nodeName)){return false}}return true}tinymce.create("tinymce.plugins.Safari",{init:function(f){var g=this,h;if(!tinymce.isWebKit){return}g.editor=f;g.webKitFontSizes=["x-small","small","medium","large","x-large","xx-large","-webkit-xxx-large"];g.namedFontSizes=["xx-small","x-small","small","medium","large","x-large","xx-large"];f.addCommand("CreateLink",function(k,j){var m=f.selection.getNode(),l=f.dom,i;if(m&&(/^(left|right)$/i.test(l.getStyle(m,"float",1))||/^(left|right)$/i.test(l.getAttrib(m,"align")))){i=l.create("a",{href:j},m.cloneNode());m.parentNode.replaceChild(i,m);f.selection.select(i)}else{f.getDoc().execCommand("CreateLink",false,j)}});f.onKeyUp.add(function(j,o){var l,i,m,p,k;if(o.keyCode==46||o.keyCode==8){i=j.getBody();l=i.innerHTML;k=j.selection;if(i.childNodes.length==1&&!/<(img|hr)/.test(l)&&tinymce.trim(l.replace(/<[^>]+>/g,"")).length==0){j.setContent('
',{format:"raw"});p=i.firstChild;m=k.getRng();m.setStart(p,0);m.setEnd(p,0);k.setRng(m)}}});f.addCommand("FormatBlock",function(j,i){var l=f.dom,k=l.getParent(f.selection.getNode(),l.isBlock);if(k){l.replace(l.create(i),k,1)}else{f.getDoc().execCommand("FormatBlock",false,i)}});f.addCommand("mceInsertContent",function(j,i){f.getDoc().execCommand("InsertText",false,"mce_marker");f.getBody().innerHTML=f.getBody().innerHTML.replace(/mce_marker/g,f.dom.processHTML(i)+'XX ');f.selection.select(f.dom.get("_mce_tmp"));f.getDoc().execCommand("Delete",false," ")});f.onKeyPress.add(function(o,p){var q,v,r,l,j,k,i,u,m,t,s;if(p.keyCode==13){i=o.selection;q=i.getNode();if(p.shiftKey||o.settings.force_br_newlines&&q.nodeName!="LI"){g._insertBR(o);a.cancel(p)}if(v=h.getParent(q,"LI")){r=h.getParent(v,"OL,UL");u=o.getDoc();s=h.create("p");h.add(s,"br",{mce_bogus:"1"});if(e(u,v)){if(k=h.getParent(r.parentNode,"LI,OL,UL")){return}k=h.getParent(r,"p,h1,h2,h3,h4,h5,h6,div")||r;l=u.createRange();l.setStartBefore(k);l.setEndBefore(v);j=u.createRange();j.setStartAfter(v);j.setEndAfter(k);m=l.cloneContents();t=j.cloneContents();if(!e(u,t)){h.insertAfter(t,k)}h.insertAfter(s,k);if(!e(u,m)){h.insertAfter(m,k)}h.remove(k);k=s.firstChild;l=u.createRange();l.setStartBefore(k);l.setEndBefore(k);i.setRng(l);return a.cancel(p)}}}});f.onExecCommand.add(function(i,k){var j,m,n,l;if(k=="InsertUnorderedList"||k=="InsertOrderedList"){j=i.selection;m=i.dom;if(n=m.getParent(j.getNode(),function(o){return/^(H[1-6]|P|ADDRESS|PRE)$/.test(o.nodeName)})){l=j.getBookmark();m.remove(n,1);j.moveToBookmark(l)}}});f.onClick.add(function(i,j){j=j.target;if(j.nodeName=="IMG"){g.selElm=j;i.selection.select(j)}else{g.selElm=null}});f.onInit.add(function(){g._fixWebKitSpans()});f.onSetContent.add(function(){h=f.dom;d(["strong","b","em","u","strike","sub","sup","a"],function(i){d(c(h.select(i)).reverse(),function(l){var k=l.nodeName.toLowerCase(),j;if(k=="a"){if(l.name){h.replace(h.create("img",{mce_name:"a",name:l.name,"class":"mceItemAnchor"}),l)}return}switch(k){case"b":case"strong":if(k=="b"){k="strong"}j="font-weight: bold;";break;case"em":j="font-style: italic;";break;case"u":j="text-decoration: underline;";break;case"sub":j="vertical-align: sub;";break;case"sup":j="vertical-align: super;";break;case"strike":j="text-decoration: line-through;";break}h.replace(h.create("span",{mce_name:k,style:j,"class":"Apple-style-span"}),l,1)})})});f.onPreProcess.add(function(i,j){h=i.dom;d(c(j.node.getElementsByTagName("span")).reverse(),function(m){var k,l;if(j.get){if(h.hasClass(m,"Apple-style-span")){l=m.style.backgroundColor;switch(h.getAttrib(m,"mce_name")){case"font":if(!i.settings.convert_fonts_to_spans){h.setAttrib(m,"style","")}break;case"strong":case"em":case"sub":case"sup":h.setAttrib(m,"style","");break;case"strike":case"u":if(!i.settings.inline_styles){h.setAttrib(m,"style","")}else{h.setAttrib(m,"mce_name","")}break;default:if(!i.settings.inline_styles){h.setAttrib(m,"style","")}}if(l){m.style.backgroundColor=l}}}if(h.hasClass(m,"mceItemRemoved")){h.remove(m,1)}})});f.onPostProcess.add(function(i,j){j.content=j.content.replace(/ <\/(h[1-6]|div|p|address|pre)>/g,"$1>");j.content=j.content.replace(/ id=\"undefined\"/g,"")})},getInfo:function(){return{longname:"Safari compatibility",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/safari",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_fixWebKitSpans:function(){var g=this,f=g.editor;a.add(f.getDoc(),"DOMNodeInserted",function(h){h=h.target;if(h&&h.nodeType==1){g._fixAppleSpan(h)}})},_fixAppleSpan:function(l){var g=this.editor,m=g.dom,i=this.webKitFontSizes,f=this.namedFontSizes,j=g.settings,h,k;if(m.getAttrib(l,"mce_fixed")){return}if(l.nodeName=="SPAN"&&l.className=="Apple-style-span"){h=l.style;if(!j.convert_fonts_to_spans){if(h.fontSize){m.setAttrib(l,"mce_name","font");m.setAttrib(l,"size",b(i,h.fontSize)+1)}if(h.fontFamily){m.setAttrib(l,"mce_name","font");m.setAttrib(l,"face",h.fontFamily)}if(h.color){m.setAttrib(l,"mce_name","font");m.setAttrib(l,"color",m.toHex(h.color))}if(h.backgroundColor){m.setAttrib(l,"mce_name","font");m.setStyle(l,"background-color",h.backgroundColor)}}else{if(h.fontSize){m.setStyle(l,"fontSize",f[b(i,h.fontSize)])}}if(h.fontWeight=="bold"){m.setAttrib(l,"mce_name","strong")}if(h.fontStyle=="italic"){m.setAttrib(l,"mce_name","em")}if(h.textDecoration=="underline"){m.setAttrib(l,"mce_name","u")}if(h.textDecoration=="line-through"){m.setAttrib(l,"mce_name","strike")}if(h.verticalAlign=="super"){m.setAttrib(l,"mce_name","sup")}if(h.verticalAlign=="sub"){m.setAttrib(l,"mce_name","sub")}m.setAttrib(l,"mce_fixed","1")}},_insertBR:function(f){var j=f.dom,h=f.selection,i=h.getRng(),g;i.insertNode(g=j.create("br"));i.setStartAfter(g);i.setEndAfter(g);h.setRng(i);if(h.getSel().focusNode==g.previousSibling){h.select(j.insertAfter(j.doc.createTextNode("\u00a0"),g));h.collapse(1)}f.getWin().scrollTo(0,j.getPos(h.getRng().startContainer).y)}});tinymce.PluginManager.add("safari",tinymce.plugins.Safari)})();
\ No newline at end of file
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/JSON.php b/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/JSON.php
index 1c461167..1f2b92ca 100644
--- a/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/JSON.php
+++ b/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/JSON.php
@@ -532,15 +532,15 @@ class Moxiecode_JSON {
$i += 2;
$output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char)));
} if (($byte & 0xF8) == 0xF0) {
- $char = pack('C*', $byte, ord($input[$i + 1]), ord($input[$i + 2], ord($input[$i + 3])));
+ $char = pack('C*', $byte, ord($input[$i + 1]), ord($input[$i + 2]), ord($input[$i + 3]));
$i += 3;
$output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char)));
} if (($byte & 0xFC) == 0xF8) {
- $char = pack('C*', $byte, ord($input[$i + 1]), ord($input[$i + 2], ord($input[$i + 3]), ord($input[$i + 4])));
+ $char = pack('C*', $byte, ord($input[$i + 1]), ord($input[$i + 2]), ord($input[$i + 3]), ord($input[$i + 4]));
$i += 4;
$output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char)));
} if (($byte & 0xFE) == 0xFC) {
- $char = pack('C*', $byte, ord($input[$i + 1]), ord($input[$i + 2], ord($input[$i + 3]), ord($input[$i + 4]), ord($input[$i + 5])));
+ $char = pack('C*', $byte, ord($input[$i + 1]), ord($input[$i + 2]), ord($input[$i + 3]), ord($input[$i + 4]), ord($input[$i + 5]));
$i += 5;
$output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char)));
} else if ($byte < 128)
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/config.php b/wp-includes/js/tinymce/plugins/spellchecker/config.php
index fb15b809..795495a6 100644
--- a/wp-includes/js/tinymce/plugins/spellchecker/config.php
+++ b/wp-includes/js/tinymce/plugins/spellchecker/config.php
@@ -1,9 +1,8 @@
0) {
- t.active = 1;
- t._markWords(r);
- ed.setProgressState(0);
- ed.nodeChanged();
- } else {
- ed.setProgressState(0);
- ed.windowManager.alert('spellchecker.no_mpell');
- }
- });
- } else
- t._done();
- });
-
- ed.onInit.add(function() {
- if (ed.settings.content_css !== false)
- ed.dom.loadCSS(url + '/css/content.css');
- });
-
- ed.onClick.add(t._showMenu, t);
- ed.onContextMenu.add(t._showMenu, t);
- ed.onBeforeGetContent.add(function() {
- if (t.active)
- t._removeWords();
- });
-
- ed.onNodeChange.add(function(ed, cm) {
- cm.setActive('spellchecker', t.active);
- });
-
- ed.onSetContent.add(function() {
- t._done();
- });
-
- ed.onBeforeGetContent.add(function() {
- t._done();
- });
-
- ed.onBeforeExecCommand.add(function(ed, cmd) {
- if (cmd == 'mceFullScreen')
- t._done();
- });
-
- // Find selected language
- t.languages = {};
- each(ed.getParam('spellchecker_languages', '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv', 'hash'), function(v, k) {
- if (k.indexOf('+') === 0) {
- k = k.substring(1);
- t.selectedLang = v;
- }
-
- t.languages[k] = v;
- });
- },
-
- createControl : function(n, cm) {
- var t = this, c, ed = t.editor;
-
- if (n == 'spellchecker') {
- c = cm.createSplitButton(n, {title : 'spellchecker.desc', cmd : 'mceSpellCheck', scope : t});
-
- c.onRenderMenu.add(function(c, m) {
- m.add({title : 'spellchecker.langs', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
- each(t.languages, function(v, k) {
- var o = {icon : 1}, mi;
-
- o.onclick = function() {
- mi.setSelected(1);
- t.selectedItem.setSelected(0);
- t.selectedItem = mi;
- t.selectedLang = v;
- };
-
- o.title = k;
- mi = m.add(o);
- mi.setSelected(v == t.selectedLang);
-
- if (v == t.selectedLang)
- t.selectedItem = mi;
- })
- });
-
- return c;
- }
- },
-
- // Internal functions
-
- _walk : function(n, f) {
- var d = this.editor.getDoc(), w;
-
- if (d.createTreeWalker) {
- w = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false);
-
- while ((n = w.nextNode()) != null)
- f.call(this, n);
- } else
- tinymce.walk(n, f, 'childNodes');
- },
-
- _getSeparators : function() {
- var re = '', i, str = this.editor.getParam('spellchecker_word_separator_chars', '\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}§©«®±¶·¸»¼½¾¿×÷¤\u201d\u201c');
-
- // Build word separator regexp
- for (i=0; i$1 $2');
- v = v.replace(r3, '$1 $2');
-
- dom.replace(dom.create('span', {'class' : 'mceItemHidden'}, v), n);
- }
- }
- });
-
- se.moveToBookmark(b);
- },
-
- _showMenu : function(ed, e) {
- var t = this, ed = t.editor, m = t._menu, p1, dom = ed.dom, vp = dom.getViewPort(ed.getWin());
-
- if (!m) {
- p1 = DOM.getPos(ed.getContentAreaContainer());
- //p2 = DOM.getPos(ed.getContainer());
-
- m = ed.controlManager.createDropMenu('spellcheckermenu', {
- offset_x : p1.x,
- offset_y : p1.y,
- 'class' : 'mceNoIcons'
- });
-
- t._menu = m;
- }
-
- if (dom.hasClass(e.target, 'mceItemHiddenSpellWord')) {
- m.removeAll();
- m.add({title : 'spellchecker.wait', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
-
- t._sendRPC('getSuggestions', [t.selectedLang, dom.decode(e.target.innerHTML)], function(r) {
- m.removeAll();
-
- if (r.length > 0) {
- m.add({title : 'spellchecker.sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
- each(r, function(v) {
- m.add({title : v, onclick : function() {
- dom.replace(ed.getDoc().createTextNode(v), e.target);
- t._checkDone();
- }});
- });
-
- m.addSeparator();
- } else
- m.add({title : 'spellchecker.no_sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
-
- m.add({
- title : 'spellchecker.ignore_word',
- onclick : function() {
- dom.remove(e.target, 1);
- t._checkDone();
- }
- });
-
- m.add({
- title : 'spellchecker.ignore_words',
- onclick : function() {
- t._removeWords(dom.decode(e.target.innerHTML));
- t._checkDone();
- }
- });
-
- m.update();
- });
-
- ed.selection.select(e.target);
- p1 = dom.getPos(e.target);
- m.showMenu(p1.x, p1.y + e.target.offsetHeight - vp.y);
-
- return tinymce.dom.Event.cancel(e);
- } else
- m.hideMenu();
- },
-
- _checkDone : function() {
- var t = this, ed = t.editor, dom = ed.dom, o;
-
- each(dom.select('span'), function(n) {
- if (n && dom.hasClass(n, 'mceItemHiddenSpellWord')) {
- o = true;
- return false;
- }
- });
-
- if (!o)
- t._done();
- },
-
- _done : function() {
- var t = this, la = t.active;
-
- if (t.active) {
- t.active = 0;
- t._removeWords();
-
- if (t._menu)
- t._menu.hideMenu();
-
- if (la)
- t.editor.nodeChanged();
- }
- },
-
- _sendRPC : function(m, p, cb) {
- var t = this, url = t.editor.getParam("spellchecker_rpc_url", this.url+'/rpc.php');
-
- if (url == '{backend}') {
- t.editor.setProgressState(0);
- alert('Please specify: spellchecker_rpc_url');
- return;
- }
-
- JSONRequest.sendRPC({
- url : url,
- method : m,
- params : p,
- success : cb,
- error : function(e, x) {
- t.editor.setProgressState(0);
- t.editor.windowManager.alert(e.errstr || ('Error response: ' + x.responseText));
- }
- });
- }
- });
-
- // Register plugin
- tinymce.PluginManager.add('spellchecker', tinymce.plugins.SpellcheckerPlugin);
-})();
\ No newline at end of file
+(function(){var a=tinymce.util.JSONRequest,c=tinymce.each,b=tinymce.DOM;tinymce.create("tinymce.plugins.SpellcheckerPlugin",{getInfo:function(){return{longname:"Spellchecker",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker",version:tinymce.majorVersion+"."+tinymce.minorVersion}},init:function(e,f){var g=this,d;g.url=f;g.editor=e;g.rpcUrl=e.getParam("spellchecker_rpc_url",this.url+'/rpc.php');if(g.rpcUrl=="{backend}"){if(tinymce.isIE){return}g.hasSupport=true;e.onContextMenu.addToTop(function(h,i){if(g.active){return false}})}e.addCommand("mceSpellCheck",function(){if(g.rpcUrl=="{backend}"){g.editor.getBody().spellcheck=g.active=!g.active;return}if(!g.active){e.setProgressState(1);g._sendRPC("checkWords",[g.selectedLang,g._getWords()],function(h){if(h.length>0){g.active=1;g._markWords(h);e.setProgressState(0);e.nodeChanged()}else{e.setProgressState(0);if(e.getParam("spellchecker_report_no_misspellings",true)){e.windowManager.alert("spellchecker.no_mpell")}}})}else{g._done()}});e.onInit.add(function(){if(e.settings.content_css!==false){e.dom.loadCSS(f+"/css/content.css")}});e.onClick.add(g._showMenu,g);e.onContextMenu.add(g._showMenu,g);e.onBeforeGetContent.add(function(){if(g.active){g._removeWords()}});e.onNodeChange.add(function(i,h){h.setActive("spellchecker",g.active)});e.onSetContent.add(function(){g._done()});e.onBeforeGetContent.add(function(){g._done()});e.onBeforeExecCommand.add(function(h,i){if(i=="mceFullScreen"){g._done()}});g.languages={};c(e.getParam("spellchecker_languages","+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv","hash"),function(i,h){if(h.indexOf("+")===0){h=h.substring(1);g.selectedLang=i}g.languages[h]=i})},createControl:function(h,d){var f=this,g,e=f.editor;if(h=="spellchecker"){if(f.rpcUrl=="{backend}"){if(f.hasSupport){g=d.createButton(h,{title:"spellchecker.desc",cmd:"mceSpellCheck",scope:f})}return g}g=d.createSplitButton(h,{title:"spellchecker.desc",cmd:"mceSpellCheck",scope:f});g.onRenderMenu.add(function(j,i){i.add({title:"spellchecker.langs","class":"mceMenuItemTitle"}).setDisabled(1);c(f.languages,function(n,m){var p={icon:1},l;p.onclick=function(){l.setSelected(1);f.selectedItem.setSelected(0);f.selectedItem=l;f.selectedLang=n};p.title=m;l=i.add(p);l.setSelected(n==f.selectedLang);if(n==f.selectedLang){f.selectedItem=l}})});return g}},_walk:function(i,g){var h=this.editor.getDoc(),e;if(h.createTreeWalker){e=h.createTreeWalker(i,NodeFilter.SHOW_TEXT,null,false);while((i=e.nextNode())!=null){g.call(this,i)}}else{tinymce.walk(i,g,"childNodes")}},_getSeparators:function(){var e="",d,f=this.editor.getParam("spellchecker_word_separator_chars",'\\s!"#$%&()*+,-./:;<=>?@[]^_{|}§©«®±¶·¸»¼½¾¿×÷¤\u201d\u201c');for(d=0;d$1 $2');q=q.replace(g,'$1 $2');j.replace(j.create("span",{"class":"mceItemHidden"},q),r)}}});l.moveToBookmark(m)},_showMenu:function(g,i){var h=this,g=h.editor,d=h._menu,k,j=g.dom,f=j.getViewPort(g.getWin());if(!d){k=b.getPos(g.getContentAreaContainer());d=g.controlManager.createDropMenu("spellcheckermenu",{offset_x:k.x,offset_y:k.y,"class":"mceNoIcons"});h._menu=d}if(j.hasClass(i.target,"mceItemHiddenSpellWord")){d.removeAll();d.add({title:"spellchecker.wait","class":"mceMenuItemTitle"}).setDisabled(1);h._sendRPC("getSuggestions",[h.selectedLang,j.decode(i.target.innerHTML)],function(l){var e;d.removeAll();if(l.length>0){d.add({title:"spellchecker.sug","class":"mceMenuItemTitle"}).setDisabled(1);c(l,function(m){d.add({title:m,onclick:function(){j.replace(g.getDoc().createTextNode(m),i.target);h._checkDone()}})});d.addSeparator()}else{d.add({title:"spellchecker.no_sug","class":"mceMenuItemTitle"}).setDisabled(1)}e=h.editor.getParam("spellchecker_enable_ignore_rpc","");d.add({title:"spellchecker.ignore_word",onclick:function(){var m=i.target.innerHTML;j.remove(i.target,1);h._checkDone();if(ignore_rpc){g.setProgressState(1);h._sendRPC("ignoreWord",[h.selectedLang,m],function(n){g.setProgressState(0)})}}});d.add({title:"spellchecker.ignore_words",onclick:function(){var m=i.target.innerHTML;h._removeWords(j.decode(m));h._checkDone();if(ignore_rpc){g.setProgressState(1);h._sendRPC("ignoreWords",[h.selectedLang,m],function(n){g.setProgressState(0)})}}});if(h.editor.getParam("spellchecker_enable_learn_rpc")){d.add({title:"spellchecker.learn_word",onclick:function(){var m=i.target.innerHTML;j.remove(i.target,1);h._checkDone();g.setProgressState(1);h._sendRPC("learnWord",[h.selectedLang,m],function(n){g.setProgressState(0)})}})}d.update()});g.selection.select(i.target);k=j.getPos(i.target);d.showMenu(k.x,k.y+i.target.offsetHeight-f.y);return tinymce.dom.Event.cancel(i)}else{d.hideMenu()}},_checkDone:function(){var e=this,d=e.editor,g=d.dom,f;c(g.select("span"),function(h){if(h&&g.hasClass(h,"mceItemHiddenSpellWord")){f=true;return false}});if(!f){e._done()}},_done:function(){var d=this,e=d.active;if(d.active){d.active=0;d._removeWords();if(d._menu){d._menu.hideMenu()}if(e){d.editor.nodeChanged()}}},_sendRPC:function(e,g,d){var f=this;a.sendRPC({url:f.rpcUrl,method:e,params:g,success:d,error:function(i,h){f.editor.setProgressState(0);f.editor.windowManager.alert(i.errstr||("Error response: "+h.responseText))}})}});tinymce.PluginManager.add("spellchecker",tinymce.plugins.SpellcheckerPlugin)})();
\ No newline at end of file
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/includes/general.php b/wp-includes/js/tinymce/plugins/spellchecker/includes/general.php
index 9a121456..ffea3a0c 100644
--- a/wp-includes/js/tinymce/plugins/spellchecker/includes/general.php
+++ b/wp-includes/js/tinymce/plugins/spellchecker/includes/general.php
@@ -25,7 +25,7 @@ if (isset($config['general.engine']))
* @param String $default_value Default value to return if value not found.
* @return String request value by name without magic quoting or default value.
*/
-function getRequestParam($name, $default_value = false, $sanitize = false) {
+function getRequestParam($name, $default_value = false) {
if (!isset($_REQUEST[$name]))
return $default_value;
@@ -33,12 +33,12 @@ function getRequestParam($name, $default_value = false, $sanitize = false) {
$newarray = array();
foreach ($_REQUEST[$name] as $name => $value)
- $newarray[formatParam($name, $sanitize)] = formatParam($value, $sanitize);
+ $newarray[$name] = $value;
return $newarray;
}
- return formatParam($_REQUEST[$name], $sanitize);
+ return $_REQUEST[$name];
}
function &getLogger() {
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/rpc.php b/wp-includes/js/tinymce/plugins/spellchecker/rpc.php
index d996c5dd..6a567348 100644
--- a/wp-includes/js/tinymce/plugins/spellchecker/rpc.php
+++ b/wp-includes/js/tinymce/plugins/spellchecker/rpc.php
@@ -1,6 +1,6 @@
encode($output);
-?>
\ No newline at end of file
+?>
diff --git a/wp-includes/js/tinymce/plugins/tabfocus/editor_plugin.js b/wp-includes/js/tinymce/plugins/tabfocus/editor_plugin.js
index 7f1fe261..27d24402 100644
--- a/wp-includes/js/tinymce/plugins/tabfocus/editor_plugin.js
+++ b/wp-includes/js/tinymce/plugins/tabfocus/editor_plugin.js
@@ -1 +1 @@
-(function(){var c=tinymce.DOM,a=tinymce.dom.Event,d=tinymce.each,b=tinymce.explode;tinymce.create("tinymce.plugins.TabFocusPlugin",{init:function(f,g){function e(i,j){if(j.keyCode===9){return a.cancel(j)}}function h(l,p){var j,m,o,n,k;function q(i){o=c.getParent(l.id,"form");n=o.elements;if(o){d(n,function(s,r){if(s.id==l.id){j=r;return false}});if(i>0){for(m=j+1;m=0;m--){if(n[m].type!="hidden"){return n[m]}}}}return null}if(p.keyCode===9){k=b(l.getParam("tab_focus",l.getParam("tabfocus_elements",":prev,:next")));if(k.length==1){k[1]=k[0];k[0]=":prev"}if(p.shiftKey){if(k[0]==":prev"){n=q(-1)}else{n=c.get(k[0])}}else{if(k[1]==":next"){n=q(1)}else{n=c.get(k[1])}}if(n){if(l=tinymce.EditorManager.get(n.id||n.name)){l.focus()}else{window.setTimeout(function(){window.focus();n.focus()},10)}return a.cancel(p)}}}f.onKeyUp.add(e);if(tinymce.isGecko){f.onKeyPress.add(h);f.onKeyDown.add(e)}else{f.onKeyDown.add(h)}f.onInit.add(function(){d(c.select("a:first,a:last",f.getContainer()),function(i){a.add(i,"focus",function(){f.focus()})})})},getInfo:function(){return{longname:"Tabfocus",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("tabfocus",tinymce.plugins.TabFocusPlugin)})();
\ No newline at end of file
+(function(){var c=tinymce.DOM,a=tinymce.dom.Event,d=tinymce.each,b=tinymce.explode;tinymce.create("tinymce.plugins.TabFocusPlugin",{init:function(f,g){function e(i,j){if(j.keyCode===9){return a.cancel(j)}}function h(l,p){var j,m,o,n,k;function q(i){o=c.getParent(l.id,"form");n=o.elements;if(o){d(n,function(s,r){if(s.id==l.id){j=r;return false}});if(i>0){for(m=j+1;m=0;m--){if(n[m].type!="hidden"){return n[m]}}}}return null}if(p.keyCode===9){k=b(l.getParam("tab_focus",l.getParam("tabfocus_elements",":prev,:next")));if(k.length==1){k[1]=k[0];k[0]=":prev"}if(p.shiftKey){if(k[0]==":prev"){n=q(-1)}else{n=c.get(k[0])}}else{if(k[1]==":next"){n=q(1)}else{n=c.get(k[1])}}if(n){if(l=tinymce.get(n.id||n.name)){l.focus()}else{window.setTimeout(function(){window.focus();n.focus()},10)}return a.cancel(p)}}}f.onKeyUp.add(e);if(tinymce.isGecko){f.onKeyPress.add(h);f.onKeyDown.add(e)}else{f.onKeyDown.add(h)}f.onInit.add(function(){d(c.select("a:first,a:last",f.getContainer()),function(i){a.add(i,"focus",function(){f.focus()})})})},getInfo:function(){return{longname:"Tabfocus",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("tabfocus",tinymce.plugins.TabFocusPlugin)})();
\ No newline at end of file
diff --git a/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.dev.js b/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.dev.js
index 0cc2bab9..f8998688 100644
--- a/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.dev.js
+++ b/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.dev.js
@@ -35,13 +35,13 @@
});
ed.addCommand('WP_Help', function() {
- ed.windowManager.open({
- url : tinymce.baseURL + '/wp-mce-help.php',
- width : 450,
- height : 420,
- inline : 1
- });
+ ed.windowManager.open({
+ url : tinymce.baseURL + '/wp-mce-help.php',
+ width : 450,
+ height : 420,
+ inline : 1
});
+ });
ed.addCommand('WP_Adv', function() {
var cm = ed.controlManager, id = cm.get(tbId).id;
@@ -126,37 +126,76 @@
}
});
- // Add Media buttons to fullscreen
- ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) {
- var DOM = tinymce.DOM;
- if ( 'mceFullScreen' != cmd ) return;
- if ( 'mce_fullscreen' != ed.id && DOM.get('add_audio') && DOM.get('add_video') && DOM.get('add_image') && DOM.get('add_media') )
- ed.settings.theme_advanced_buttons1 += ',|,add_image,add_video,add_audio,add_media';
- });
-
- // Add class "alignleft", "alignright" and "aligncenter" when selecting align for images.
- ed.addCommand('JustifyLeft', function() {
- var n = ed.selection.getNode();
-
- if ( n.nodeName != 'IMG' )
- ed.editorCommands.mceJustify('JustifyLeft', 'left');
- else ed.plugins.wordpress.do_align(n, 'alignleft');
- });
-
- ed.addCommand('JustifyRight', function() {
- var n = ed.selection.getNode();
+ // Add Media buttons to fullscreen and handle align buttons for image captions
+ ed.onBeforeExecCommand.add(function(ed, cmd, ui, val, o) {
+ var DOM = tinymce.DOM, n, DL, DIV, cls, a, align;
+ if ( 'mceFullScreen' == cmd ) {
+ if ( 'mce_fullscreen' != ed.id && DOM.get('add_audio') && DOM.get('add_video') && DOM.get('add_image') && DOM.get('add_media') )
+ ed.settings.theme_advanced_buttons1 += ',|,add_image,add_video,add_audio,add_media';
+ }
- if ( n.nodeName != 'IMG' )
- ed.editorCommands.mceJustify('JustifyRight', 'right');
- else ed.plugins.wordpress.do_align(n, 'alignright');
+ if ( 'JustifyLeft' == cmd || 'JustifyRight' == cmd || 'JustifyCenter' == cmd ) {
+ n = ed.selection.getNode();
+
+ if ( n.nodeName == 'IMG' ) {
+ align = cmd.substr(7).toLowerCase();
+ a = 'align' + align;
+ DL = ed.dom.getParent(n, 'dl.wp-caption');
+ DIV = ed.dom.getParent(n, 'div.mceTemp');
+
+ if ( DL && DIV ) {
+ cls = ed.dom.hasClass(DL, a) ? 'alignnone' : a;
+ DL.className = DL.className.replace(/align[^ '"]+\s?/g, '');
+ ed.dom.addClass(DL, cls);
+
+ if (cls == 'aligncenter')
+ ed.dom.addClass(DIV, 'mceIEcenter');
+ else
+ ed.dom.removeClass(DIV, 'mceIEcenter');
+
+ o.terminate = true;
+ ed.execCommand('mceRepaint');
+ } else {
+ if ( ed.dom.hasClass(n, a) )
+ ed.dom.addClass(n, 'alignnone');
+ else
+ ed.dom.removeClass(n, 'alignnone');
+ }
+ }
+ }
});
+
+ ed.onInit.add(function(ed) {
+ // make sure these run last
+ ed.onNodeChange.add( function(ed, cm, e) {
+ var DL;
+
+ if ( e.nodeName == 'IMG' ) {
+ DL = ed.dom.getParent(e, 'dl.wp-caption');
+ } else if ( e.nodeName == 'DIV' && ed.dom.hasClass(e, 'mceTemp') ) {
+ DL = e.firstChild;
+
+ if ( ! ed.dom.hasClass(DL, 'wp-caption') )
+ DL = false;
+ }
+
+ if ( DL ) {
+ if ( ed.dom.hasClass(DL, 'alignleft') )
+ cm.setActive('justifyleft', 1);
+ else if ( ed.dom.hasClass(DL, 'alignright') )
+ cm.setActive('justifyright', 1);
+ else if ( ed.dom.hasClass(DL, 'aligncenter') )
+ cm.setActive('justifycenter', 1);
+ }
+ });
- ed.addCommand('JustifyCenter', function() {
- var n = ed.selection.getNode(), P = ed.dom.getParent(n, 'p'), DL = ed.dom.getParent(n, 'dl');
-
- if ( n.nodeName == 'IMG' && ( P || DL ) )
- ed.plugins.wordpress.do_align(n, 'aligncenter');
- else ed.editorCommands.mceJustify('JustifyCenter', 'center');
+ // remove invalid parent paragraphs when pasting HTML and/or switching to the HTML editor and back
+ ed.onBeforeSetContent.add(function(ed, o) {
+ if ( o.content ) {
+ o.content = o.content.replace(/\s*<(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)( [^>]*)?>/gi, '<$1$2>');
+ o.content = o.content.replace(/<\/(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)>\s*<\/p>/gi, '$1>');
+ }
+ });
});
// Word count if script is loaded
@@ -303,34 +342,6 @@
this.mceTout = 0;
},
- do_align : function(n, a) {
- var P, DL, DIV, cls, c, ed = tinyMCE.activeEditor;
-
- if ( /^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className) )
- return;
-
- P = ed.dom.getParent(n, 'p');
- DL = ed.dom.getParent(n, 'dl');
- DIV = ed.dom.getParent(n, 'div');
-
- if ( DL && DIV ) {
- cls = ed.dom.hasClass(DL, a) ? 'alignnone' : a;
- DL.className = DL.className.replace(/align[^ '"]+\s?/g, '');
- ed.dom.addClass(DL, cls);
- c = (cls == 'aligncenter') ? ed.dom.addClass(DIV, 'mceIEcenter') : ed.dom.removeClass(DIV, 'mceIEcenter');
- } else if ( P ) {
- cls = ed.dom.hasClass(n, a) ? 'alignnone' : a;
- n.className = n.className.replace(/align[^ '"]+\s?/g, '');
- ed.dom.addClass(n, cls);
- if ( cls == 'aligncenter' )
- ed.dom.setStyle(P, 'textAlign', 'center');
- else if (P.style && P.style.textAlign == 'center')
- ed.dom.setStyle(P, 'textAlign', '');
- }
-
- ed.execCommand('mceRepaint');
- },
-
// Resizes the iframe by a relative height value
_resizeIframe : function(ed, tb_id, dy) {
var ifr = ed.getContentAreaContainer().firstChild;
@@ -367,8 +378,10 @@
// Replace morebreak with images
ed.onBeforeSetContent.add(function(ed, o) {
- o.content = o.content.replace(//g, moreHTML);
- o.content = o.content.replace(//g, nextpageHTML);
+ if ( o.content ) {
+ o.content = o.content.replace(//g, moreHTML);
+ o.content = o.content.replace(//g, nextpageHTML);
+ }
});
// Replace images with morebreak
diff --git a/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js b/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js
index ec97912d..3d215bd8 100644
--- a/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js
+++ b/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js
@@ -1 +1 @@
-(function(){var a=tinymce.DOM;tinymce.create("tinymce.plugins.WordPress",{mceTout:0,init:function(c,d){var e=this,h=c.getParam("wordpress_adv_toolbar","toolbar2"),g=0,f,b;f=' ';b=' ';if(getUserSetting("hidetb","0")=="1"){c.settings.wordpress_adv_hidden=0}c.onPostRender.add(function(){var i=c.controlManager.get(h);if(c.getParam("wordpress_adv_hidden",1)&&i){a.hide(i.id);e._resizeIframe(c,h,28)}});c.addCommand("WP_More",function(){c.execCommand("mceInsertContent",0,f)});c.addCommand("WP_Page",function(){c.execCommand("mceInsertContent",0,b)});c.addCommand("WP_Help",function(){c.windowManager.open({url:tinymce.baseURL+"/wp-mce-help.php",width:450,height:420,inline:1})});c.addCommand("WP_Adv",function(){var i=c.controlManager,j=i.get(h).id;if("undefined"==j){return}if(a.isHidden(j)){i.setActive("wp_adv",1);a.show(j);e._resizeIframe(c,h,-28);c.settings.wordpress_adv_hidden=0;setUserSetting("hidetb","1")}else{i.setActive("wp_adv",0);a.hide(j);e._resizeIframe(c,h,28);c.settings.wordpress_adv_hidden=1;setUserSetting("hidetb","0")}});c.addButton("wp_more",{title:"wordpress.wp_more_desc",image:d+"/img/more.gif",cmd:"WP_More"});c.addButton("wp_page",{title:"wordpress.wp_page_desc",image:d+"/img/page.gif",cmd:"WP_Page"});c.addButton("wp_help",{title:"wordpress.wp_help_desc",image:d+"/img/help.gif",cmd:"WP_Help"});c.addButton("wp_adv",{title:"wordpress.wp_adv_desc",image:d+"/img/toolbars.gif",cmd:"WP_Adv"});c.addButton("add_media",{title:"wordpress.add_media",image:d+"/img/media.gif",onclick:function(){tb_show("",tinymce.DOM.get("add_media").href);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")}});c.addButton("add_image",{title:"wordpress.add_image",image:d+"/img/image.gif",onclick:function(){tb_show("",tinymce.DOM.get("add_image").href);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")}});c.addButton("add_video",{title:"wordpress.add_video",image:d+"/img/video.gif",onclick:function(){tb_show("",tinymce.DOM.get("add_video").href);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")}});c.addButton("add_audio",{title:"wordpress.add_audio",image:d+"/img/audio.gif",onclick:function(){tb_show("",tinymce.DOM.get("add_audio").href);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")}});c.onBeforeExecCommand.add(function(i,l,k,m){var j=tinymce.DOM;if("mceFullScreen"!=l){return}if("mce_fullscreen"!=i.id&&j.get("add_audio")&&j.get("add_video")&&j.get("add_image")&&j.get("add_media")){i.settings.theme_advanced_buttons1+=",|,add_image,add_video,add_audio,add_media"}});c.addCommand("JustifyLeft",function(){var i=c.selection.getNode();if(i.nodeName!="IMG"){c.editorCommands.mceJustify("JustifyLeft","left")}else{c.plugins.wordpress.do_align(i,"alignleft")}});c.addCommand("JustifyRight",function(){var i=c.selection.getNode();if(i.nodeName!="IMG"){c.editorCommands.mceJustify("JustifyRight","right")}else{c.plugins.wordpress.do_align(i,"alignright")}});c.addCommand("JustifyCenter",function(){var k=c.selection.getNode(),j=c.dom.getParent(k,"p"),i=c.dom.getParent(k,"dl");if(k.nodeName=="IMG"&&(j||i)){c.plugins.wordpress.do_align(k,"aligncenter")}else{c.editorCommands.mceJustify("JustifyCenter","center")}});if("undefined"!=typeof wpWordCount){c.onKeyUp.add(function(i,j){if(j.keyCode==g){return}if(13==j.keyCode||8==g||46==g){wpWordCount.wc(i.getContent({format:"raw"}))}g=j.keyCode})}c.onSaveContent.add(function(i,j){if(typeof(switchEditors)=="object"){if(i.isHidden()){j.content=j.element.value}else{j.content=switchEditors.pre_wpautop(j.content)}}});e._handleMoreBreak(c,d);c.addShortcut("alt+shift+c",c.getLang("justifycenter_desc"),"JustifyCenter");c.addShortcut("alt+shift+r",c.getLang("justifyright_desc"),"JustifyRight");c.addShortcut("alt+shift+l",c.getLang("justifyleft_desc"),"JustifyLeft");c.addShortcut("alt+shift+j",c.getLang("justifyfull_desc"),"JustifyFull");c.addShortcut("alt+shift+q",c.getLang("blockquote_desc"),"mceBlockQuote");c.addShortcut("alt+shift+u",c.getLang("bullist_desc"),"InsertUnorderedList");c.addShortcut("alt+shift+o",c.getLang("numlist_desc"),"InsertOrderedList");c.addShortcut("alt+shift+d",c.getLang("striketrough_desc"),"Strikethrough");c.addShortcut("alt+shift+n",c.getLang("spellchecker.desc"),"mceSpellCheck");c.addShortcut("alt+shift+a",c.getLang("link_desc"),"mceLink");c.addShortcut("alt+shift+s",c.getLang("unlink_desc"),"unlink");c.addShortcut("alt+shift+m",c.getLang("image_desc"),"mceImage");c.addShortcut("alt+shift+g",c.getLang("fullscreen.desc"),"mceFullScreen");c.addShortcut("alt+shift+z",c.getLang("wp_adv_desc"),"WP_Adv");c.addShortcut("alt+shift+h",c.getLang("help_desc"),"WP_Help");c.addShortcut("alt+shift+t",c.getLang("wp_more_desc"),"WP_More");c.addShortcut("alt+shift+p",c.getLang("wp_page_desc"),"WP_Page");c.addShortcut("ctrl+s",c.getLang("save_desc"),function(){if("function"==typeof autosave){autosave()}});if(tinymce.isWebKit){c.addShortcut("alt+shift+b",c.getLang("bold_desc"),"Bold");c.addShortcut("alt+shift+i",c.getLang("italic_desc"),"Italic")}c.onInit.add(function(i){tinymce.dom.Event.add(i.getWin(),"scroll",function(j){i.plugins.wordpress._hideButtons()});tinymce.dom.Event.add(i.getBody(),"dragstart",function(j){i.plugins.wordpress._hideButtons()})});c.onBeforeExecCommand.add(function(i,k,j,l){i.plugins.wordpress._hideButtons()});c.onSaveContent.add(function(i,j){i.plugins.wordpress._hideButtons()});c.onMouseDown.add(function(i,j){if(j.target.nodeName!="IMG"){i.plugins.wordpress._hideButtons()}})},getInfo:function(){return{longname:"WordPress Plugin",author:"WordPress",authorurl:"http://wordpress.org",infourl:"http://wordpress.org",version:"3.0"}},_setEmbed:function(b){return b.replace(/\[embed\]([\s\S]+?)\[\/embed\][\s\u00a0]*/g,function(d,c){return' '})},_getEmbed:function(b){return b.replace(/ ]+>/g,function(c){if(c.indexOf('class="wp-oembed')!=-1){var d=c.match(/alt="([^\"]+)"/);if(d[1]){c="[embed]"+d[1]+"[/embed]"}}return c})},_showButtons:function(f,d){var g=tinyMCE.activeEditor,i,h,b,j=tinymce.DOM,e,c;b=g.dom.getViewPort(g.getWin());i=j.getPos(g.getContentAreaContainer());h=g.dom.getPos(f);e=Math.max(h.x-b.x,0)+i.x;c=Math.max(h.y-b.y,0)+i.y;j.setStyles(d,{top:c+5+"px",left:e+5+"px",display:"block"});if(this.mceTout){clearTimeout(this.mceTout)}this.mceTout=setTimeout(function(){g.plugins.wordpress._hideButtons()},5000)},_hideButtons:function(){if(!this.mceTout){return}if(document.getElementById("wp_editbtns")){tinymce.DOM.hide("wp_editbtns")}if(document.getElementById("wp_gallerybtns")){tinymce.DOM.hide("wp_gallerybtns")}clearTimeout(this.mceTout);this.mceTout=0},do_align:function(j,d){var h,f,g,b,i,e=tinyMCE.activeEditor;if(/^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(j.className)){return}h=e.dom.getParent(j,"p");f=e.dom.getParent(j,"dl");g=e.dom.getParent(j,"div");if(f&&g){b=e.dom.hasClass(f,d)?"alignnone":d;f.className=f.className.replace(/align[^ '"]+\s?/g,"");e.dom.addClass(f,b);i=(b=="aligncenter")?e.dom.addClass(g,"mceIEcenter"):e.dom.removeClass(g,"mceIEcenter")}else{if(h){b=e.dom.hasClass(j,d)?"alignnone":d;j.className=j.className.replace(/align[^ '"]+\s?/g,"");e.dom.addClass(j,b);if(b=="aligncenter"){e.dom.setStyle(h,"textAlign","center")}else{if(h.style&&h.style.textAlign=="center"){e.dom.setStyle(h,"textAlign","")}}}}e.execCommand("mceRepaint")},_resizeIframe:function(c,e,b){var d=c.getContentAreaContainer().firstChild;a.setStyle(d,"height",d.clientHeight+b);c.theme.deltaHeight+=b},_handleMoreBreak:function(c,d){var e,b;e=' ';b=' ';c.onInit.add(function(){c.dom.loadCSS(d+"/css/content.css")});c.onPostRender.add(function(){if(c.theme.onResolveName){c.theme.onResolveName.add(function(f,g){if(g.node.nodeName=="IMG"){if(c.dom.hasClass(g.node,"mceWPmore")){g.name="wpmore"}if(c.dom.hasClass(g.node,"mceWPnextpage")){g.name="wppage"}}})}});c.onBeforeSetContent.add(function(f,g){g.content=g.content.replace(//g,e);g.content=g.content.replace(//g,b)});c.onPostProcess.add(function(f,g){if(g.get){g.content=g.content.replace(/ ]+>/g,function(i){if(i.indexOf('class="mceWPmore')!==-1){var h,j=(h=i.match(/alt="(.*?)"/))?h[1]:"";i=""}if(i.indexOf('class="mceWPnextpage')!==-1){i=""}return i})}});c.onNodeChange.add(function(g,f,h){f.setActive("wp_page",h.nodeName==="IMG"&&g.dom.hasClass(h,"mceWPnextpage"));f.setActive("wp_more",h.nodeName==="IMG"&&g.dom.hasClass(h,"mceWPmore"))})}});tinymce.PluginManager.add("wordpress",tinymce.plugins.WordPress)})();
\ No newline at end of file
+(function(){var a=tinymce.DOM;tinymce.create("tinymce.plugins.WordPress",{mceTout:0,init:function(c,d){var e=this,h=c.getParam("wordpress_adv_toolbar","toolbar2"),g=0,f,b;f=' ';b=' ';if(getUserSetting("hidetb","0")=="1"){c.settings.wordpress_adv_hidden=0}c.onPostRender.add(function(){var i=c.controlManager.get(h);if(c.getParam("wordpress_adv_hidden",1)&&i){a.hide(i.id);e._resizeIframe(c,h,28)}});c.addCommand("WP_More",function(){c.execCommand("mceInsertContent",0,f)});c.addCommand("WP_Page",function(){c.execCommand("mceInsertContent",0,b)});c.addCommand("WP_Help",function(){c.windowManager.open({url:tinymce.baseURL+"/wp-mce-help.php",width:450,height:420,inline:1})});c.addCommand("WP_Adv",function(){var i=c.controlManager,j=i.get(h).id;if("undefined"==j){return}if(a.isHidden(j)){i.setActive("wp_adv",1);a.show(j);e._resizeIframe(c,h,-28);c.settings.wordpress_adv_hidden=0;setUserSetting("hidetb","1")}else{i.setActive("wp_adv",0);a.hide(j);e._resizeIframe(c,h,28);c.settings.wordpress_adv_hidden=1;setUserSetting("hidetb","0")}});c.addButton("wp_more",{title:"wordpress.wp_more_desc",image:d+"/img/more.gif",cmd:"WP_More"});c.addButton("wp_page",{title:"wordpress.wp_page_desc",image:d+"/img/page.gif",cmd:"WP_Page"});c.addButton("wp_help",{title:"wordpress.wp_help_desc",image:d+"/img/help.gif",cmd:"WP_Help"});c.addButton("wp_adv",{title:"wordpress.wp_adv_desc",image:d+"/img/toolbars.gif",cmd:"WP_Adv"});c.addButton("add_media",{title:"wordpress.add_media",image:d+"/img/media.gif",onclick:function(){tb_show("",tinymce.DOM.get("add_media").href);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")}});c.addButton("add_image",{title:"wordpress.add_image",image:d+"/img/image.gif",onclick:function(){tb_show("",tinymce.DOM.get("add_image").href);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")}});c.addButton("add_video",{title:"wordpress.add_video",image:d+"/img/video.gif",onclick:function(){tb_show("",tinymce.DOM.get("add_video").href);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")}});c.addButton("add_audio",{title:"wordpress.add_audio",image:d+"/img/audio.gif",onclick:function(){tb_show("",tinymce.DOM.get("add_audio").href);tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")}});c.onBeforeExecCommand.add(function(p,m,s,l,j){var v=tinymce.DOM,k,i,r,u,t,q;if("mceFullScreen"==m){if("mce_fullscreen"!=p.id&&v.get("add_audio")&&v.get("add_video")&&v.get("add_image")&&v.get("add_media")){p.settings.theme_advanced_buttons1+=",|,add_image,add_video,add_audio,add_media"}}if("JustifyLeft"==m||"JustifyRight"==m||"JustifyCenter"==m){k=p.selection.getNode();if(k.nodeName=="IMG"){q=m.substr(7).toLowerCase();t="align"+q;i=p.dom.getParent(k,"dl.wp-caption");r=p.dom.getParent(k,"div.mceTemp");if(i&&r){u=p.dom.hasClass(i,t)?"alignnone":t;i.className=i.className.replace(/align[^ '"]+\s?/g,"");p.dom.addClass(i,u);if(u=="aligncenter"){p.dom.addClass(r,"mceIEcenter")}else{p.dom.removeClass(r,"mceIEcenter")}j.terminate=true;p.execCommand("mceRepaint")}else{if(p.dom.hasClass(k,t)){p.dom.addClass(k,"alignnone")}else{p.dom.removeClass(k,"alignnone")}}}}});c.onInit.add(function(i){i.onNodeChange.add(function(k,j,m){var l;if(m.nodeName=="IMG"){l=k.dom.getParent(m,"dl.wp-caption")}else{if(m.nodeName=="DIV"&&k.dom.hasClass(m,"mceTemp")){l=m.firstChild;if(!k.dom.hasClass(l,"wp-caption")){l=false}}}if(l){if(k.dom.hasClass(l,"alignleft")){j.setActive("justifyleft",1)}else{if(k.dom.hasClass(l,"alignright")){j.setActive("justifyright",1)}else{if(k.dom.hasClass(l,"aligncenter")){j.setActive("justifycenter",1)}}}}});i.onBeforeSetContent.add(function(j,k){if(k.content){k.content=k.content.replace(/
\s*<(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)( [^>]*)?>/gi,"<$1$2>");k.content=k.content.replace(/<\/(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)>\s*<\/p>/gi,"$1>")}})});if("undefined"!=typeof wpWordCount){c.onKeyUp.add(function(i,j){if(j.keyCode==g){return}if(13==j.keyCode||8==g||46==g){wpWordCount.wc(i.getContent({format:"raw"}))}g=j.keyCode})}c.onSaveContent.add(function(i,j){if(typeof(switchEditors)=="object"){if(i.isHidden()){j.content=j.element.value}else{j.content=switchEditors.pre_wpautop(j.content)}}});e._handleMoreBreak(c,d);c.addShortcut("alt+shift+c",c.getLang("justifycenter_desc"),"JustifyCenter");c.addShortcut("alt+shift+r",c.getLang("justifyright_desc"),"JustifyRight");c.addShortcut("alt+shift+l",c.getLang("justifyleft_desc"),"JustifyLeft");c.addShortcut("alt+shift+j",c.getLang("justifyfull_desc"),"JustifyFull");c.addShortcut("alt+shift+q",c.getLang("blockquote_desc"),"mceBlockQuote");c.addShortcut("alt+shift+u",c.getLang("bullist_desc"),"InsertUnorderedList");c.addShortcut("alt+shift+o",c.getLang("numlist_desc"),"InsertOrderedList");c.addShortcut("alt+shift+d",c.getLang("striketrough_desc"),"Strikethrough");c.addShortcut("alt+shift+n",c.getLang("spellchecker.desc"),"mceSpellCheck");c.addShortcut("alt+shift+a",c.getLang("link_desc"),"mceLink");c.addShortcut("alt+shift+s",c.getLang("unlink_desc"),"unlink");c.addShortcut("alt+shift+m",c.getLang("image_desc"),"mceImage");c.addShortcut("alt+shift+g",c.getLang("fullscreen.desc"),"mceFullScreen");c.addShortcut("alt+shift+z",c.getLang("wp_adv_desc"),"WP_Adv");c.addShortcut("alt+shift+h",c.getLang("help_desc"),"WP_Help");c.addShortcut("alt+shift+t",c.getLang("wp_more_desc"),"WP_More");c.addShortcut("alt+shift+p",c.getLang("wp_page_desc"),"WP_Page");c.addShortcut("ctrl+s",c.getLang("save_desc"),function(){if("function"==typeof autosave){autosave()}});if(tinymce.isWebKit){c.addShortcut("alt+shift+b",c.getLang("bold_desc"),"Bold");c.addShortcut("alt+shift+i",c.getLang("italic_desc"),"Italic")}c.onInit.add(function(i){tinymce.dom.Event.add(i.getWin(),"scroll",function(j){i.plugins.wordpress._hideButtons()});tinymce.dom.Event.add(i.getBody(),"dragstart",function(j){i.plugins.wordpress._hideButtons()})});c.onBeforeExecCommand.add(function(i,k,j,l){i.plugins.wordpress._hideButtons()});c.onSaveContent.add(function(i,j){i.plugins.wordpress._hideButtons()});c.onMouseDown.add(function(i,j){if(j.target.nodeName!="IMG"){i.plugins.wordpress._hideButtons()}})},getInfo:function(){return{longname:"WordPress Plugin",author:"WordPress",authorurl:"http://wordpress.org",infourl:"http://wordpress.org",version:"3.0"}},_setEmbed:function(b){return b.replace(/\[embed\]([\s\S]+?)\[\/embed\][\s\u00a0]*/g,function(d,c){return' '})},_getEmbed:function(b){return b.replace(/ ]+>/g,function(c){if(c.indexOf('class="wp-oembed')!=-1){var d=c.match(/alt="([^\"]+)"/);if(d[1]){c="[embed]"+d[1]+"[/embed]"}}return c})},_showButtons:function(f,d){var g=tinyMCE.activeEditor,i,h,b,j=tinymce.DOM,e,c;b=g.dom.getViewPort(g.getWin());i=j.getPos(g.getContentAreaContainer());h=g.dom.getPos(f);e=Math.max(h.x-b.x,0)+i.x;c=Math.max(h.y-b.y,0)+i.y;j.setStyles(d,{top:c+5+"px",left:e+5+"px",display:"block"});if(this.mceTout){clearTimeout(this.mceTout)}this.mceTout=setTimeout(function(){g.plugins.wordpress._hideButtons()},5000)},_hideButtons:function(){if(!this.mceTout){return}if(document.getElementById("wp_editbtns")){tinymce.DOM.hide("wp_editbtns")}if(document.getElementById("wp_gallerybtns")){tinymce.DOM.hide("wp_gallerybtns")}clearTimeout(this.mceTout);this.mceTout=0},_resizeIframe:function(c,e,b){var d=c.getContentAreaContainer().firstChild;a.setStyle(d,"height",d.clientHeight+b);c.theme.deltaHeight+=b},_handleMoreBreak:function(c,d){var e,b;e=' ';b=' ';c.onInit.add(function(){c.dom.loadCSS(d+"/css/content.css")});c.onPostRender.add(function(){if(c.theme.onResolveName){c.theme.onResolveName.add(function(f,g){if(g.node.nodeName=="IMG"){if(c.dom.hasClass(g.node,"mceWPmore")){g.name="wpmore"}if(c.dom.hasClass(g.node,"mceWPnextpage")){g.name="wppage"}}})}});c.onBeforeSetContent.add(function(f,g){if(g.content){g.content=g.content.replace(//g,e);g.content=g.content.replace(//g,b)}});c.onPostProcess.add(function(f,g){if(g.get){g.content=g.content.replace(/ ]+>/g,function(i){if(i.indexOf('class="mceWPmore')!==-1){var h,j=(h=i.match(/alt="(.*?)"/))?h[1]:"";i=""}if(i.indexOf('class="mceWPnextpage')!==-1){i=""}return i})}});c.onNodeChange.add(function(g,f,h){f.setActive("wp_page",h.nodeName==="IMG"&&g.dom.hasClass(h,"mceWPnextpage"));f.setActive("wp_more",h.nodeName==="IMG"&&g.dom.hasClass(h,"mceWPmore"))})}});tinymce.PluginManager.add("wordpress",tinymce.plugins.WordPress)})();
\ No newline at end of file
diff --git a/wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.dev.js b/wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.dev.js
new file mode 100644
index 00000000..bdc63ddc
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.dev.js
@@ -0,0 +1,97 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function($) {
+ var wpDialogFn = function( fn ) {
+ return function() {
+ if ( this.features.wpDialog )
+ return fn.apply( this, arguments );
+ else
+ return this.parent.apply( this, arguments );
+ };
+ };
+
+ tinymce.create('tinymce.plugins.WPDialogs', {
+ init : function(ed, url) {
+ // Replace window manager
+ ed.onBeforeRenderUI.add(function() {
+ ed.windowManager = new tinymce.WPWindowManager(ed);
+ });
+ },
+
+ getInfo : function() {
+ return {
+ longname : 'WPDialogs',
+ author : 'WordPress',
+ authorurl : 'http://wordpress.org',
+ infourl : 'http://wordpress.org',
+ version : '0.1'
+ };
+ }
+ });
+
+ $(document).ready(function() {
+ $.widget("wp.wpdialog", $.ui.dialog, {
+ open: function() {
+ // Initialize tinyMCEPopup if it exists.
+ if ( tinyMCEPopup )
+ tinyMCEPopup.init();
+ // Open the dialog.
+ $.ui.dialog.prototype.open.apply( this, arguments );
+ // WebKit leaves focus in the TinyMCE editor unless we shift focus.
+ this.element.focus();
+ this._trigger('refresh');
+ }
+ });
+ });
+
+ tinymce.create('tinymce.WPWindowManager:tinymce.InlineWindowManager', {
+ WPWindowManager : function(ed) {
+ this.parent(ed);
+ },
+
+ open : function(f, p) {
+ var t = this, element;
+ // Can't use wpDialogFn here; this.features isn't set yet.
+ if ( ! f.wpDialog )
+ return this.parent( f, p );
+ else if ( ! f.id )
+ return;
+
+ element = $('#' + f.id);
+ if ( ! element.length )
+ return;
+
+ t.features = f;
+ t.params = p;
+ t.onOpen.dispatch(t, f, p);
+ t.element = t.windows[ f.id ] = element;
+
+ // Store selection
+ t.bookmark = t.editor.selection.getBookmark(1);
+
+ element.wpdialog({
+ title: f.title,
+ width: f.width,
+ height: f.height,
+ modal: true,
+ dialogClass: 'wp-dialog',
+ zIndex: 300000
+ });
+ },
+ close : wpDialogFn(function() {
+ this.element.wpdialog('close');
+ })
+ });
+
+ // Register plugin
+ tinymce.PluginManager.add('wpdialogs', tinymce.plugins.WPDialogs);
+})(jQuery);
+
diff --git a/wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.js b/wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.js
new file mode 100644
index 00000000..fc621f13
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.js
@@ -0,0 +1 @@
+(function(b){var a=function(c){return function(){if(this.features.wpDialog){return c.apply(this,arguments)}else{return this.parent.apply(this,arguments)}}};tinymce.create("tinymce.plugins.WPDialogs",{init:function(c,d){c.onBeforeRenderUI.add(function(){c.windowManager=new tinymce.WPWindowManager(c)})},getInfo:function(){return{longname:"WPDialogs",author:"WordPress",authorurl:"http://wordpress.org",infourl:"http://wordpress.org",version:"0.1"}}});b(document).ready(function(){b.widget("wp.wpdialog",b.ui.dialog,{open:function(){if(tinyMCEPopup){tinyMCEPopup.init()}b.ui.dialog.prototype.open.apply(this,arguments);this.element.focus();this._trigger("refresh")}})});tinymce.create("tinymce.WPWindowManager:tinymce.InlineWindowManager",{WPWindowManager:function(c){this.parent(c)},open:function(e,g){var d=this,c;if(!e.wpDialog){return this.parent(e,g)}else{if(!e.id){return}}c=b("#"+e.id);if(!c.length){return}d.features=e;d.params=g;d.onOpen.dispatch(d,e,g);d.element=d.windows[e.id]=c;d.bookmark=d.editor.selection.getBookmark(1);c.wpdialog({title:e.title,width:e.width,height:e.height,modal:true,dialogClass:"wp-dialog",zIndex:300000})},close:a(function(){this.element.wpdialog("close")})});tinymce.PluginManager.add("wpdialogs",tinymce.plugins.WPDialogs)})(jQuery);
\ No newline at end of file
diff --git a/wp-includes/js/tinymce/plugins/wpdialogs/js/popup.dev.js b/wp-includes/js/tinymce/plugins/wpdialogs/js/popup.dev.js
new file mode 100644
index 00000000..3f79a257
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/wpdialogs/js/popup.dev.js
@@ -0,0 +1,432 @@
+/**
+ * popup.js
+ *
+ * An altered version of tinyMCEPopup to work in the same window as tinymce.
+ *
+ * ------------------------------------------------------------------
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+// Some global instances
+
+/**
+ * TinyMCE popup/dialog helper class. This gives you easy access to the
+ * parent editor instance and a bunch of other things. It's higly recommended
+ * that you load this script into your dialogs.
+ *
+ * @static
+ * @class tinyMCEPopup
+ */
+var tinyMCEPopup = {
+ /**
+ * Initializes the popup this will be called automatically.
+ *
+ * @method init
+ */
+ init : function() {
+ var t = this, w, ti;
+
+ // Find window & API
+ w = t.getWin();
+ tinymce = w.tinymce;
+ tinyMCE = w.tinyMCE;
+ t.editor = tinymce.EditorManager.activeEditor;
+ t.params = t.editor.windowManager.params;
+ t.features = t.editor.windowManager.features;
+ t.dom = tinymce.dom;
+
+ // Setup on init listeners
+ t.listeners = [];
+ t.onInit = {
+ add : function(f, s) {
+ t.listeners.push({func : f, scope : s});
+ }
+ };
+
+ t.isWindow = false;
+ t.id = t.features.id;
+ t.editor.windowManager.onOpen.dispatch(t.editor.windowManager, window);
+ },
+
+ /**
+ * Returns the reference to the parent window that opened the dialog.
+ *
+ * @method getWin
+ * @return {Window} Reference to the parent window that opened the dialog.
+ */
+ getWin : function() {
+ return window;
+ },
+
+ /**
+ * Returns a window argument/parameter by name.
+ *
+ * @method getWindowArg
+ * @param {String} n Name of the window argument to retrive.
+ * @param {String} dv Optional default value to return.
+ * @return {String} Argument value or default value if it wasn't found.
+ */
+ getWindowArg : function(n, dv) {
+ var v = this.params[n];
+
+ return tinymce.is(v) ? v : dv;
+ },
+
+ /**
+ * Returns a editor parameter/config option value.
+ *
+ * @method getParam
+ * @param {String} n Name of the editor config option to retrive.
+ * @param {String} dv Optional default value to return.
+ * @return {String} Parameter value or default value if it wasn't found.
+ */
+ getParam : function(n, dv) {
+ return this.editor.getParam(n, dv);
+ },
+
+ /**
+ * Returns a language item by key.
+ *
+ * @method getLang
+ * @param {String} n Language item like mydialog.something.
+ * @param {String} dv Optional default value to return.
+ * @return {String} Language value for the item like "my string" or the default value if it wasn't found.
+ */
+ getLang : function(n, dv) {
+ return this.editor.getLang(n, dv);
+ },
+
+ /**
+ * Executed a command on editor that opened the dialog/popup.
+ *
+ * @method execCommand
+ * @param {String} cmd Command to execute.
+ * @param {Boolean} ui Optional boolean value if the UI for the command should be presented or not.
+ * @param {Object} val Optional value to pass with the comman like an URL.
+ * @param {Object} a Optional arguments object.
+ */
+ execCommand : function(cmd, ui, val, a) {
+ a = a || {};
+ a.skip_focus = 1;
+
+ this.restoreSelection();
+ return this.editor.execCommand(cmd, ui, val, a);
+ },
+
+ /**
+ * Resizes the dialog to the inner size of the window. This is needed since various browsers
+ * have different border sizes on windows.
+ *
+ * @method resizeToInnerSize
+ */
+ resizeToInnerSize : function() {
+ var t = this;
+
+ // Detach it to workaround a Chrome specific bug
+ // https://sourceforge.net/tracker/?func=detail&atid=635682&aid=2926339&group_id=103281
+ setTimeout(function() {
+ var vp = t.dom.getViewPort(window);
+
+ t.editor.windowManager.resizeBy(
+ t.getWindowArg('mce_width') - vp.w,
+ t.getWindowArg('mce_height') - vp.h,
+ t.id || window
+ );
+ }, 0);
+ },
+
+ /**
+ * Will executed the specified string when the page has been loaded. This function
+ * was added for compatibility with the 2.x branch.
+ *
+ * @method executeOnLoad
+ * @param {String} s String to evalutate on init.
+ */
+ executeOnLoad : function(s) {
+ this.onInit.add(function() {
+ eval(s);
+ });
+ },
+
+ /**
+ * Stores the current editor selection for later restoration. This can be useful since some browsers
+ * looses it's selection if a control element is selected/focused inside the dialogs.
+ *
+ * @method storeSelection
+ */
+ storeSelection : function() {
+ this.editor.windowManager.bookmark = tinyMCEPopup.editor.selection.getBookmark(1);
+ },
+
+ /**
+ * Restores any stored selection. This can be useful since some browsers
+ * looses it's selection if a control element is selected/focused inside the dialogs.
+ *
+ * @method restoreSelection
+ */
+ restoreSelection : function() {
+ var t = tinyMCEPopup;
+
+ if (!t.isWindow && tinymce.isIE)
+ t.editor.selection.moveToBookmark(t.editor.windowManager.bookmark);
+ },
+
+ /**
+ * Loads a specific dialog language pack. If you pass in plugin_url as a arugment
+ * when you open the window it will load the /langs/_dlg.js lang pack file.
+ *
+ * @method requireLangPack
+ */
+ requireLangPack : function() {
+ var t = this, u = t.getWindowArg('plugin_url') || t.getWindowArg('theme_url');
+
+ if (u && t.editor.settings.language && t.features.translate_i18n !== false) {
+ u += '/langs/' + t.editor.settings.language + '_dlg.js';
+
+ if (!tinymce.ScriptLoader.isDone(u)) {
+ document.write('');
+ tinymce.ScriptLoader.markDone(u);
+ }
+ }
+ },
+
+ /**
+ * Executes a color picker on the specified element id. When the user
+ * then selects a color it will be set as the value of the specified element.
+ *
+ * @method pickColor
+ * @param {DOMEvent} e DOM event object.
+ * @param {string} element_id Element id to be filled with the color value from the picker.
+ */
+ pickColor : function(e, element_id) {
+ this.execCommand('mceColorPicker', true, {
+ color : document.getElementById(element_id).value,
+ func : function(c) {
+ document.getElementById(element_id).value = c;
+
+ try {
+ document.getElementById(element_id).onchange();
+ } catch (ex) {
+ // Try fire event, ignore errors
+ }
+ }
+ });
+ },
+
+ /**
+ * Opens a filebrowser/imagebrowser this will set the output value from
+ * the browser as a value on the specified element.
+ *
+ * @method openBrowser
+ * @param {string} element_id Id of the element to set value in.
+ * @param {string} type Type of browser to open image/file/flash.
+ * @param {string} option Option name to get the file_broswer_callback function name from.
+ */
+ openBrowser : function(element_id, type, option) {
+ tinyMCEPopup.restoreSelection();
+ this.editor.execCallback('file_browser_callback', element_id, document.getElementById(element_id).value, type, window);
+ },
+
+ /**
+ * Creates a confirm dialog. Please don't use the blocking behavior of this
+ * native version use the callback method instead then it can be extended.
+ *
+ * @method confirm
+ * @param {String} t Title for the new confirm dialog.
+ * @param {function} cb Callback function to be executed after the user has selected ok or cancel.
+ * @param {Object} s Optional scope to execute the callback in.
+ */
+ confirm : function(t, cb, s) {
+ this.editor.windowManager.confirm(t, cb, s, window);
+ },
+
+ /**
+ * Creates a alert dialog. Please don't use the blocking behavior of this
+ * native version use the callback method instead then it can be extended.
+ *
+ * @method alert
+ * @param {String} t Title for the new alert dialog.
+ * @param {function} cb Callback function to be executed after the user has selected ok.
+ * @param {Object} s Optional scope to execute the callback in.
+ */
+ alert : function(tx, cb, s) {
+ this.editor.windowManager.alert(tx, cb, s, window);
+ },
+
+ /**
+ * Closes the current window.
+ *
+ * @method close
+ */
+ close : function() {
+ var t = this;
+
+ // To avoid domain relaxing issue in Opera
+ function close() {
+ t.editor.windowManager.close(window);
+ t.editor = null;
+ };
+
+ if (tinymce.isOpera)
+ t.getWin().setTimeout(close, 0);
+ else
+ close();
+ },
+
+ // Internal functions
+
+ _restoreSelection : function() {
+ var e = window.event.srcElement;
+
+ if (e.nodeName == 'INPUT' && (e.type == 'submit' || e.type == 'button'))
+ tinyMCEPopup.restoreSelection();
+ },
+
+/* _restoreSelection : function() {
+ var e = window.event.srcElement;
+
+ // If user focus a non text input or textarea
+ if ((e.nodeName != 'INPUT' && e.nodeName != 'TEXTAREA') || e.type != 'text')
+ tinyMCEPopup.restoreSelection();
+ },*/
+
+ _onDOMLoaded : function() {
+ var t = tinyMCEPopup, ti = document.title, bm, h, nv;
+
+ if (t.domLoaded)
+ return;
+
+ t.domLoaded = 1;
+
+ tinyMCEPopup.init();
+
+ // Translate page
+ if (t.features.translate_i18n !== false) {
+ h = document.body.innerHTML;
+
+ // Replace a=x with a="x" in IE
+ if (tinymce.isIE)
+ h = h.replace(/ (value|title|alt)=([^"][^\s>]+)/gi, ' $1="$2"')
+
+ document.dir = t.editor.getParam('directionality','');
+
+ if ((nv = t.editor.translate(h)) && nv != h)
+ document.body.innerHTML = nv;
+
+ if ((nv = t.editor.translate(ti)) && nv != ti)
+ document.title = ti = nv;
+ }
+
+ document.body.style.display = '';
+
+ // Restore selection in IE when focus is placed on a non textarea or input element of the type text
+ if (tinymce.isIE) {
+ document.attachEvent('onmouseup', tinyMCEPopup._restoreSelection);
+
+ // Add base target element for it since it would fail with modal dialogs
+ t.dom.add(t.dom.select('head')[0], 'base', {target : '_self'});
+ }
+
+ t.restoreSelection();
+
+ // Set inline title
+ if (!t.isWindow)
+ t.editor.windowManager.setTitle(window, ti);
+ else
+ window.focus();
+
+ if (!tinymce.isIE && !t.isWindow) {
+ tinymce.dom.Event._add(document, 'focus', function() {
+ t.editor.windowManager.focus(t.id);
+ });
+ }
+
+ // Patch for accessibility
+ tinymce.each(t.dom.select('select'), function(e) {
+ e.onkeydown = tinyMCEPopup._accessHandler;
+ });
+
+ // Call onInit
+ // Init must be called before focus so the selection won't get lost by the focus call
+ tinymce.each(t.listeners, function(o) {
+ o.func.call(o.scope, t.editor);
+ });
+
+ // Move focus to window
+ if (t.getWindowArg('mce_auto_focus', true)) {
+ window.focus();
+
+ // Focus element with mceFocus class
+ tinymce.each(document.forms, function(f) {
+ tinymce.each(f.elements, function(e) {
+ if (t.dom.hasClass(e, 'mceFocus') && !e.disabled) {
+ e.focus();
+ return false; // Break loop
+ }
+ });
+ });
+ }
+
+ document.onkeyup = tinyMCEPopup._closeWinKeyHandler;
+ },
+
+ _accessHandler : function(e) {
+ e = e || window.event;
+
+ if (e.keyCode == 13 || e.keyCode == 32) {
+ e = e.target || e.srcElement;
+
+ if (e.onchange)
+ e.onchange();
+
+ return tinymce.dom.Event.cancel(e);
+ }
+ },
+
+ _closeWinKeyHandler : function(e) {
+ e = e || window.event;
+
+ if (e.keyCode == 27)
+ tinyMCEPopup.close();
+ },
+
+ _wait : function() {
+ // Use IE method
+ if (document.attachEvent) {
+ document.attachEvent("onreadystatechange", function() {
+ if (document.readyState === "complete") {
+ document.detachEvent("onreadystatechange", arguments.callee);
+ tinyMCEPopup._onDOMLoaded();
+ }
+ });
+
+ if (document.documentElement.doScroll && window == window.top) {
+ (function() {
+ if (tinyMCEPopup.domLoaded)
+ return;
+
+ try {
+ // If IE is used, use the trick by Diego Perini
+ // http://javascript.nwbox.com/IEContentLoaded/
+ document.documentElement.doScroll("left");
+ } catch (ex) {
+ setTimeout(arguments.callee, 0);
+ return;
+ }
+
+ tinyMCEPopup._onDOMLoaded();
+ })();
+ }
+
+ document.attachEvent('onload', tinyMCEPopup._onDOMLoaded);
+ } else if (document.addEventListener) {
+ window.addEventListener('DOMContentLoaded', tinyMCEPopup._onDOMLoaded, false);
+ window.addEventListener('load', tinyMCEPopup._onDOMLoaded, false);
+ }
+ }
+};
diff --git a/wp-includes/js/tinymce/plugins/wpdialogs/js/popup.js b/wp-includes/js/tinymce/plugins/wpdialogs/js/popup.js
new file mode 100644
index 00000000..abacbd3a
--- /dev/null
+++ b/wp-includes/js/tinymce/plugins/wpdialogs/js/popup.js
@@ -0,0 +1 @@
+var tinyMCEPopup={init:function(){var b=this,a,c;a=b.getWin();tinymce=a.tinymce;tinyMCE=a.tinyMCE;b.editor=tinymce.EditorManager.activeEditor;b.params=b.editor.windowManager.params;b.features=b.editor.windowManager.features;b.dom=tinymce.dom;b.listeners=[];b.onInit={add:function(e,d){b.listeners.push({func:e,scope:d})}};b.isWindow=false;b.id=b.features.id;b.editor.windowManager.onOpen.dispatch(b.editor.windowManager,window)},getWin:function(){return window},getWindowArg:function(c,b){var a=this.params[c];return tinymce.is(a)?a:b},getParam:function(b,a){return this.editor.getParam(b,a)},getLang:function(b,a){return this.editor.getLang(b,a)},execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restoreSelection();return this.editor.execCommand(d,c,e,b)},resizeToInnerSize:function(){var a=this;setTimeout(function(){var b=a.dom.getViewPort(window);a.editor.windowManager.resizeBy(a.getWindowArg("mce_width")-b.w,a.getWindowArg("mce_height")-b.h,a.id||window)},0)},executeOnLoad:function(s){this.onInit.add(function(){eval(s)})},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark(1)},restoreSelection:function(){var a=tinyMCEPopup;if(!a.isWindow&&tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}},requireLangPack:function(){var b=this,a=b.getWindowArg("plugin_url")||b.getWindowArg("theme_url");if(a&&b.editor.settings.language&&b.features.translate_i18n!==false){a+="/langs/"+b.editor.settings.language+"_dlg.js";if(!tinymce.ScriptLoader.isDone(a)){document.write('
-
-
+
+
+
@@ -49,7 +49,7 @@
diff --git a/wp-includes/js/tinymce/themes/advanced/anchor.htm b/wp-includes/js/tinymce/themes/advanced/anchor.htm
index 820f9ab4..b7bbe95c 100644
--- a/wp-includes/js/tinymce/themes/advanced/anchor.htm
+++ b/wp-includes/js/tinymce/themes/advanced/anchor.htm
@@ -2,8 +2,8 @@
{#advanced_dlg.anchor_title}
-
-
+
+
diff --git a/wp-includes/js/tinymce/themes/advanced/charmap.htm b/wp-includes/js/tinymce/themes/advanced/charmap.htm
index 2e98030a..7a5ac7e1 100644
--- a/wp-includes/js/tinymce/themes/advanced/charmap.htm
+++ b/wp-includes/js/tinymce/themes/advanced/charmap.htm
@@ -2,9 +2,8 @@
{#advanced_dlg.charmap_title}
-
-
-
+
+
diff --git a/wp-includes/js/tinymce/themes/advanced/color_picker.htm b/wp-includes/js/tinymce/themes/advanced/color_picker.htm
index 5a56e214..2d00cd5c 100644
--- a/wp-includes/js/tinymce/themes/advanced/color_picker.htm
+++ b/wp-includes/js/tinymce/themes/advanced/color_picker.htm
@@ -2,9 +2,9 @@
{#advanced_dlg.colorpicker_title}
-
-
-
+
+
+
diff --git a/wp-includes/js/tinymce/themes/advanced/editor_template.js b/wp-includes/js/tinymce/themes/advanced/editor_template.js
index 628c793c..c5a1719a 100644
--- a/wp-includes/js/tinymce/themes/advanced/editor_template.js
+++ b/wp-includes/js/tinymce/themes/advanced/editor_template.js
@@ -1 +1 @@
-(function(e){var d=e.DOM,b=e.dom.Event,h=e.extend,f=e.each,a=e.util.Cookie,g,c=e.explode;e.ThemeManager.requireLangPack("advanced");e.create("tinymce.themes.AdvancedTheme",{sizes:[8,10,12,14,18,24,36],controls:{bold:["bold_desc","Bold"],italic:["italic_desc","Italic"],underline:["underline_desc","Underline"],strikethrough:["striketrough_desc","Strikethrough"],justifyleft:["justifyleft_desc","JustifyLeft"],justifycenter:["justifycenter_desc","JustifyCenter"],justifyright:["justifyright_desc","JustifyRight"],justifyfull:["justifyfull_desc","JustifyFull"],bullist:["bullist_desc","InsertUnorderedList"],numlist:["numlist_desc","InsertOrderedList"],outdent:["outdent_desc","Outdent"],indent:["indent_desc","Indent"],cut:["cut_desc","Cut"],copy:["copy_desc","Copy"],paste:["paste_desc","Paste"],undo:["undo_desc","Undo"],redo:["redo_desc","Redo"],link:["link_desc","mceLink"],unlink:["unlink_desc","unlink"],image:["image_desc","mceImage"],cleanup:["cleanup_desc","mceCleanup"],help:["help_desc","mceHelp"],code:["code_desc","mceCodeEditor"],hr:["hr_desc","InsertHorizontalRule"],removeformat:["removeformat_desc","RemoveFormat"],sub:["sub_desc","subscript"],sup:["sup_desc","superscript"],forecolor:["forecolor_desc","ForeColor"],forecolorpicker:["forecolor_desc","mceForeColor"],backcolor:["backcolor_desc","HiliteColor"],backcolorpicker:["backcolor_desc","mceBackColor"],charmap:["charmap_desc","mceCharMap"],visualaid:["visualaid_desc","mceToggleVisualAid"],anchor:["anchor_desc","mceInsertAnchor"],newdocument:["newdocument_desc","mceNewDocument"],blockquote:["blockquote_desc","mceBlockQuote"]},stateControls:["bold","italic","underline","strikethrough","bullist","numlist","justifyleft","justifycenter","justifyright","justifyfull","sub","sup","blockquote"],init:function(j,k){var l=this,m,i,n;l.editor=j;l.url=k;l.onResolveName=new e.util.Dispatcher(this);l.settings=m=h({theme_advanced_path:true,theme_advanced_toolbar_location:"bottom",theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,|,sub,sup,|,charmap",theme_advanced_blockformats:"p,address,pre,h1,h2,h3,h4,h5,h6",theme_advanced_toolbar_align:"center",theme_advanced_fonts:"Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",theme_advanced_more_colors:1,theme_advanced_row_height:23,theme_advanced_resize_horizontal:1,theme_advanced_resizing_use_cookie:1,theme_advanced_font_sizes:"1,2,3,4,5,6,7",readonly:j.settings.readonly},j.settings);if(!m.font_size_style_values){m.font_size_style_values="8pt,10pt,12pt,14pt,18pt,24pt,36pt"}if(e.is(m.theme_advanced_font_sizes,"string")){m.font_size_style_values=e.explode(m.font_size_style_values);m.font_size_classes=e.explode(m.font_size_classes||"");n={};j.settings.theme_advanced_font_sizes=m.theme_advanced_font_sizes;f(j.getParam("theme_advanced_font_sizes","","hash"),function(q,p){var o;if(p==q&&q>=1&&q<=7){p=q+" ("+l.sizes[q-1]+"pt)";if(j.settings.convert_fonts_to_spans){o=m.font_size_classes[q-1];q=m.font_size_style_values[q-1]||(l.sizes[q-1]+"pt")}}if(/^\s*\./.test(q)){o=q.replace(/\./g,"")}n[p]=o?{"class":o}:{fontSize:q}});m.theme_advanced_font_sizes=n}if((i=m.theme_advanced_path_location)&&i!="none"){m.theme_advanced_statusbar_location=m.theme_advanced_path_location}if(m.theme_advanced_statusbar_location=="none"){m.theme_advanced_statusbar_location=0}j.onInit.add(function(){j.onNodeChange.add(l._nodeChanged,l);if(j.settings.content_css!==false){j.dom.loadCSS(j.baseURI.toAbsolute("themes/advanced/skins/"+j.settings.skin+"/content.css"))}});j.onSetProgressState.add(function(q,o,r){var s,t=q.id,p;if(o){l.progressTimer=setTimeout(function(){s=q.getContainer();s=s.insertBefore(d.create("DIV",{style:"position:relative"}),s.firstChild);p=d.get(q.id+"_tbl");d.add(s,"div",{id:t+"_blocker","class":"mceBlocker",style:{width:p.clientWidth+2,height:p.clientHeight+2}});d.add(s,"div",{id:t+"_progress","class":"mceProgress",style:{left:p.clientWidth/2,top:p.clientHeight/2}})},r||0)}else{d.remove(t+"_blocker");d.remove(t+"_progress");clearTimeout(l.progressTimer)}});d.loadCSS(m.editor_css?j.documentBaseURI.toAbsolute(m.editor_css):k+"/skins/"+j.settings.skin+"/ui.css");if(m.skin_variant){d.loadCSS(k+"/skins/"+j.settings.skin+"/ui_"+m.skin_variant+".css")}},createControl:function(l,i){var j,k;if(k=i.createControl(l)){return k}switch(l){case"styleselect":return this._createStyleSelect();case"formatselect":return this._createBlockFormats();case"fontselect":return this._createFontSelect();case"fontsizeselect":return this._createFontSizeSelect();case"forecolor":return this._createForeColorMenu();case"backcolor":return this._createBackColorMenu()}if((j=this.controls[l])){return i.createButton(l,{title:"advanced."+j[0],cmd:j[1],ui:j[2],value:j[3]})}},execCommand:function(k,j,l){var i=this["_"+k];if(i){i.call(this,j,l);return true}return false},_importClasses:function(j){var i=this.editor,k=i.controlManager.get("styleselect");if(k.getLength()==0){f(i.dom.getClasses(),function(l){k.add(l["class"],l["class"])})}},_createStyleSelect:function(m){var j=this,i=j.editor,k=i.controlManager,l=k.createListBox("styleselect",{title:"advanced.style_select",onselect:function(n){if(l.selectedValue===n){i.execCommand("mceSetStyleInfo",0,{command:"removeformat"});l.select();return false}else{i.execCommand("mceSetCSSClass",0,n)}}});if(l){f(i.getParam("theme_advanced_styles","","hash"),function(o,n){if(o){l.add(j.editor.translate(n),o)}});l.onPostRender.add(function(o,p){if(!l.NativeListBox){b.add(p.id+"_text","focus",j._importClasses,j);b.add(p.id+"_text","mousedown",j._importClasses,j);b.add(p.id+"_open","focus",j._importClasses,j);b.add(p.id+"_open","mousedown",j._importClasses,j)}else{b.add(p.id,"focus",j._importClasses,j)}})}return l},_createFontSelect:function(){var k,j=this,i=j.editor;k=i.controlManager.createListBox("fontselect",{title:"advanced.fontdefault",cmd:"FontName"});if(k){f(i.getParam("theme_advanced_fonts",j.settings.theme_advanced_fonts,"hash"),function(m,l){k.add(i.translate(l),m,{style:m.indexOf("dings")==-1?"font-family:"+m:""})})}return k},_createFontSizeSelect:function(){var m=this,k=m.editor,n,l=0,j=[];n=k.controlManager.createListBox("fontsizeselect",{title:"advanced.font_size",onselect:function(i){if(i.fontSize){k.execCommand("FontSize",false,i.fontSize)}else{f(m.settings.theme_advanced_font_sizes,function(p,o){if(p["class"]){j.push(p["class"])}});k.editorCommands._applyInlineStyle("span",{"class":i["class"]},{check_classes:j})}}});if(n){f(m.settings.theme_advanced_font_sizes,function(o,i){var p=o.fontSize;if(p>=1&&p<=7){p=m.sizes[parseInt(p)-1]+"pt"}n.add(i,o,{style:"font-size:"+p,"class":"mceFontSize"+(l++)+(" "+(o["class"]||""))})})}return n},_createBlockFormats:function(){var k,i={p:"advanced.paragraph",address:"advanced.address",pre:"advanced.pre",h1:"advanced.h1",h2:"advanced.h2",h3:"advanced.h3",h4:"advanced.h4",h5:"advanced.h5",h6:"advanced.h6",div:"advanced.div",blockquote:"advanced.blockquote",code:"advanced.code",dt:"advanced.dt",dd:"advanced.dd",samp:"advanced.samp"},j=this;k=j.editor.controlManager.createListBox("formatselect",{title:"advanced.block",cmd:"FormatBlock"});if(k){f(j.editor.getParam("theme_advanced_blockformats",j.settings.theme_advanced_blockformats,"hash"),function(m,l){k.add(j.editor.translate(l!=m?l:i[m]),m,{"class":"mce_formatPreview mce_"+m})})}return k},_createForeColorMenu:function(){var m,j=this,k=j.settings,l={},i;if(k.theme_advanced_more_colors){l.more_colors_func=function(){j._mceColorPicker(0,{color:m.value,func:function(n){m.setColor(n)}})}}if(i=k.theme_advanced_text_colors){l.colors=i}if(k.theme_advanced_default_foreground_color){l.default_color=k.theme_advanced_default_foreground_color}l.title="advanced.forecolor_desc";l.cmd="ForeColor";l.scope=this;m=j.editor.controlManager.createColorSplitButton("forecolor",l);return m},_createBackColorMenu:function(){var m,j=this,k=j.settings,l={},i;if(k.theme_advanced_more_colors){l.more_colors_func=function(){j._mceColorPicker(0,{color:m.value,func:function(n){m.setColor(n)}})}}if(i=k.theme_advanced_background_colors){l.colors=i}if(k.theme_advanced_default_background_color){l.default_color=k.theme_advanced_default_background_color}l.title="advanced.backcolor_desc";l.cmd="HiliteColor";l.scope=this;m=j.editor.controlManager.createColorSplitButton("backcolor",l);return m},renderUI:function(k){var m,l,q,v=this,r=v.editor,w=v.settings,u,j,i;m=j=d.create("span",{id:r.id+"_parent","class":"mceEditor "+r.settings.skin+"Skin"+(w.skin_variant?" "+r.settings.skin+"Skin"+v._ufirst(w.skin_variant):"")});if(!d.boxModel){m=d.add(m,"div",{"class":"mceOldBoxModel"})}m=u=d.add(m,"table",{id:r.id+"_tbl","class":"mceLayout",cellSpacing:0,cellPadding:0});m=q=d.add(m,"tbody");switch((w.theme_advanced_layout_manager||"").toLowerCase()){case"rowlayout":l=v._rowLayout(w,q,k);break;case"customlayout":l=r.execCallback("theme_advanced_custom_layout",w,q,k,j);break;default:l=v._simpleLayout(w,q,k,j)}m=k.targetNode;i=d.stdMode?u.getElementsByTagName("tr"):u.rows;d.addClass(i[0],"mceFirst");d.addClass(i[i.length-1],"mceLast");f(d.select("tr",q),function(o){d.addClass(o.firstChild,"mceFirst");d.addClass(o.childNodes[o.childNodes.length-1],"mceLast")});if(d.get(w.theme_advanced_toolbar_container)){d.get(w.theme_advanced_toolbar_container).appendChild(j)}else{d.insertAfter(j,m)}b.add(r.id+"_path_row","click",function(n){n=n.target;if(n.nodeName=="A"){v._sel(n.className.replace(/^.*mcePath_([0-9]+).*$/,"$1"));return b.cancel(n)}});if(!r.getParam("accessibility_focus")){b.add(d.add(j,"a",{href:"#"},""),"focus",function(){tinyMCE.get(r.id).focus()})}if(w.theme_advanced_toolbar_location=="external"){k.deltaHeight=0}v.deltaHeight=k.deltaHeight;k.targetNode=null;return{iframeContainer:l,editorContainer:r.id+"_parent",sizeContainer:u,deltaHeight:k.deltaHeight}},getInfo:function(){return{longname:"Advanced theme",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",version:e.majorVersion+"."+e.minorVersion}},resizeBy:function(i,j){var k=d.get(this.editor.id+"_tbl");this.resizeTo(k.clientWidth+i,k.clientHeight+j)},resizeTo:function(i,l){var j=this.editor,k=j.settings,n=d.get(j.id+"_tbl"),o=d.get(j.id+"_ifr"),m;i=Math.max(k.theme_advanced_resizing_min_width||100,i);l=Math.max(k.theme_advanced_resizing_min_height||100,l);i=Math.min(k.theme_advanced_resizing_max_width||65535,i);l=Math.min(k.theme_advanced_resizing_max_height||65535,l);m=n.clientHeight-o.clientHeight;d.setStyle(o,"height",l-m);d.setStyles(n,{width:i,height:l})},destroy:function(){var i=this.editor.id;b.clear(i+"_resize");b.clear(i+"_path_row");b.clear(i+"_external_close")},_simpleLayout:function(y,r,k,i){var x=this,u=x.editor,v=y.theme_advanced_toolbar_location,m=y.theme_advanced_statusbar_location,l,j,q,w;if(y.readonly){l=d.add(r,"tr");l=j=d.add(l,"td",{"class":"mceIframeContainer"});return j}if(v=="top"){x._addToolbars(r,k)}if(v=="external"){l=w=d.create("div",{style:"position:relative"});l=d.add(l,"div",{id:u.id+"_external","class":"mceExternalToolbar"});d.add(l,"a",{id:u.id+"_external_close",href:"javascript:;","class":"mceExternalClose"});l=d.add(l,"table",{id:u.id+"_tblext",cellSpacing:0,cellPadding:0});q=d.add(l,"tbody");if(i.firstChild.className=="mceOldBoxModel"){i.firstChild.appendChild(w)}else{i.insertBefore(w,i.firstChild)}x._addToolbars(q,k);u.onMouseUp.add(function(){var o=d.get(u.id+"_external");d.show(o);d.hide(g);var n=b.add(u.id+"_external_close","click",function(){d.hide(u.id+"_external");b.remove(u.id+"_external_close","click",n)});d.show(o);d.setStyle(o,"top",0-d.getRect(u.id+"_tblext").h-1);d.hide(o);d.show(o);o.style.filter="";g=u.id+"_external";o=null})}if(m=="top"){x._addStatusBar(r,k)}if(!y.theme_advanced_toolbar_container){l=d.add(r,"tr");l=j=d.add(l,"td",{"class":"mceIframeContainer"})}if(v=="bottom"){x._addToolbars(r,k)}if(m=="bottom"){x._addStatusBar(r,k)}return j},_rowLayout:function(w,m,k){var v=this,p=v.editor,u,x,i=p.controlManager,l,j,r,q;u=w.theme_advanced_containers_default_class||"";x=w.theme_advanced_containers_default_align||"center";f(c(w.theme_advanced_containers||""),function(s,o){var n=w["theme_advanced_container_"+s]||"";switch(n.toLowerCase()){case"mceeditor":l=d.add(m,"tr");l=j=d.add(l,"td",{"class":"mceIframeContainer"});break;case"mceelementpath":v._addStatusBar(m,k);break;default:q=(w["theme_advanced_container_"+s+"_align"]||x).toLowerCase();q="mce"+v._ufirst(q);l=d.add(d.add(m,"tr"),"td",{"class":"mceToolbar "+(w["theme_advanced_container_"+s+"_class"]||u)+" "+q||x});r=i.createToolbar("toolbar"+o);v._addControls(n,r);d.setHTML(l,r.renderHTML());k.deltaHeight-=w.theme_advanced_row_height}});return j},_addControls:function(j,i){var k=this,l=k.settings,m,n=k.editor.controlManager;if(l.theme_advanced_disable&&!k._disabled){m={};f(c(l.theme_advanced_disable),function(o){m[o]=1});k._disabled=m}else{m=k._disabled}f(c(j),function(p){var o;if(m&&m[p]){return}if(p=="tablecontrols"){f(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"],function(q){q=k.createControl(q,n);if(q){i.add(q)}});return}o=k.createControl(p,n);if(o){i.add(o)}})},_addToolbars:function(w,k){var z=this,p,m,r=z.editor,A=z.settings,y,j=r.controlManager,u,l,q=[],x;x=A.theme_advanced_toolbar_align.toLowerCase();x="mce"+z._ufirst(x);l=d.add(d.add(w,"tr"),"td",{"class":"mceToolbar "+x});if(!r.getParam("accessibility_focus")){q.push(d.createHTML("a",{href:"#",onfocus:"tinyMCE.get('"+r.id+"').focus();"},""))}q.push(d.createHTML("a",{href:"#",accesskey:"q",title:r.getLang("advanced.toolbar_focus")},""));for(p=1;(y=A["theme_advanced_buttons"+p]);p++){m=j.createToolbar("toolbar"+p,{"class":"mceToolbarRow"+p});if(A["theme_advanced_buttons"+p+"_add"]){y+=","+A["theme_advanced_buttons"+p+"_add"]}if(A["theme_advanced_buttons"+p+"_add_before"]){y=A["theme_advanced_buttons"+p+"_add_before"]+","+y}z._addControls(y,m);q.push(m.renderHTML());k.deltaHeight-=A.theme_advanced_row_height}q.push(d.createHTML("a",{href:"#",accesskey:"z",title:r.getLang("advanced.toolbar_focus"),onfocus:"tinyMCE.getInstanceById('"+r.id+"').focus();"},""));d.setHTML(l,q.join(""))},_addStatusBar:function(m,j){var k,v=this,p=v.editor,w=v.settings,i,q,u,l;k=d.add(m,"tr");k=l=d.add(k,"td",{"class":"mceStatusbar"});k=d.add(k,"div",{id:p.id+"_path_row"},w.theme_advanced_path?p.translate("advanced.path")+": ":" ");d.add(k,"a",{href:"#",accesskey:"x"});if(w.theme_advanced_resizing){d.add(l,"a",{id:p.id+"_resize",href:"javascript:;",onclick:"return false;","class":"mceResize"});if(w.theme_advanced_resizing_use_cookie){p.onPostRender.add(function(){var n=a.getHash("TinyMCE_"+p.id+"_size"),r=d.get(p.id+"_tbl");if(!n){return}if(w.theme_advanced_resize_horizontal){r.style.width=Math.max(10,n.cw)+"px"}r.style.height=Math.max(10,n.ch)+"px";d.get(p.id+"_ifr").style.height=Math.max(10,parseInt(n.ch)+v.deltaHeight)+"px"})}p.onPostRender.add(function(){b.add(p.id+"_resize","mousedown",function(x){var z,t,o,s,y,r;z=d.get(p.id+"_tbl");o=z.clientWidth;s=z.clientHeight;miw=w.theme_advanced_resizing_min_width||100;mih=w.theme_advanced_resizing_min_height||100;maw=w.theme_advanced_resizing_max_width||65535;mah=w.theme_advanced_resizing_max_height||65535;t=d.add(d.get(p.id+"_parent"),"div",{"class":"mcePlaceHolder"});d.setStyles(t,{width:o,height:s});d.hide(z);d.show(t);i={x:x.screenX,y:x.screenY,w:o,h:s,dx:null,dy:null};q=b.add(d.doc,"mousemove",function(B){var n,A;i.dx=B.screenX-i.x;i.dy=B.screenY-i.y;n=Math.max(miw,i.w+i.dx);A=Math.max(mih,i.h+i.dy);n=Math.min(maw,n);A=Math.min(mah,A);if(w.theme_advanced_resize_horizontal){t.style.width=n+"px"}t.style.height=A+"px";return b.cancel(B)});u=b.add(d.doc,"mouseup",function(n){var A;b.remove(d.doc,"mousemove",q);b.remove(d.doc,"mouseup",u);z.style.display="";d.remove(t);if(i.dx===null){return}A=d.get(p.id+"_ifr");if(w.theme_advanced_resize_horizontal){z.style.width=Math.max(10,i.w+i.dx)+"px"}z.style.height=Math.max(10,i.h+i.dy)+"px";A.style.height=Math.max(10,A.clientHeight+i.dy)+"px";if(w.theme_advanced_resizing_use_cookie){a.setHash("TinyMCE_"+p.id+"_size",{cw:i.w+i.dx,ch:i.h+i.dy})}});return b.cancel(x)})})}j.deltaHeight-=21;k=m=null},_nodeChanged:function(l,u,k,q){var y=this,i,r=0,x,m,z=y.settings,w,j,o;if(z.readonly){return}e.each(y.stateControls,function(n){u.setActive(n,l.queryCommandState(y.controls[n][1]))});u.setActive("visualaid",l.hasVisual);u.setDisabled("undo",!l.undoManager.hasUndo()&&!l.typing);u.setDisabled("redo",!l.undoManager.hasRedo());u.setDisabled("outdent",!l.queryCommandState("Outdent"));i=d.getParent(k,"A");if(m=u.get("link")){if(!i||!i.name){m.setDisabled(!i&&q);m.setActive(!!i)}}if(m=u.get("unlink")){m.setDisabled(!i&&q);m.setActive(!!i&&!i.name)}if(m=u.get("anchor")){m.setActive(!!i&&i.name);if(e.isWebKit){i=d.getParent(k,"IMG");m.setActive(!!i&&d.getAttrib(i,"mce_name")=="a")}}i=d.getParent(k,"IMG");if(m=u.get("image")){m.setActive(!!i&&k.className.indexOf("mceItem")==-1)}if(m=u.get("styleselect")){if(k.className){y._importClasses();m.select(k.className)}else{m.select()}}if(m=u.get("formatselect")){i=d.getParent(k,d.isBlock);if(i){m.select(i.nodeName.toLowerCase())}}if(l.settings.convert_fonts_to_spans){l.dom.getParent(k,function(p){if(p.nodeName==="SPAN"){if(!w&&p.className){w=p.className}if(!j&&p.style.fontSize){j=p.style.fontSize}if(!o&&p.style.fontFamily){o=p.style.fontFamily.replace(/[\"\']+/g,"").replace(/^([^,]+).*/,"$1").toLowerCase()}}return false});if(m=u.get("fontselect")){m.select(function(n){return n.replace(/^([^,]+).*/,"$1").toLowerCase()==o})}if(m=u.get("fontsizeselect")){m.select(function(n){if(n.fontSize&&n.fontSize===j){return true}if(n["class"]&&n["class"]===w){return true}})}}else{if(m=u.get("fontselect")){m.select(l.queryCommandValue("FontName"))}if(m=u.get("fontsizeselect")){x=l.queryCommandValue("FontSize");m.select(function(n){return n.fontSize==x})}}if(z.theme_advanced_path&&z.theme_advanced_statusbar_location){i=d.get(l.id+"_path")||d.add(l.id+"_path_row","span",{id:l.id+"_path"});d.setHTML(i,"");l.dom.getParent(k,function(A){var p=A.nodeName.toLowerCase(),s,v,t="";if(A.nodeType!=1||A.nodeName==="BR"||(d.hasClass(A,"mceItemHidden")||d.hasClass(A,"mceItemRemoved"))){return}if(x=d.getAttrib(A,"mce_name")){p=x}if(e.isIE&&A.scopeName!=="HTML"){p=A.scopeName+":"+p}p=p.replace(/mce\:/g,"");switch(p){case"b":p="strong";break;case"i":p="em";break;case"img":if(x=d.getAttrib(A,"src")){t+="src: "+x+" "}break;case"a":if(x=d.getAttrib(A,"name")){t+="name: "+x+" ";p+="#"+x}if(x=d.getAttrib(A,"href")){t+="href: "+x+" "}break;case"font":if(z.convert_fonts_to_spans){p="span"}if(x=d.getAttrib(A,"face")){t+="font: "+x+" "}if(x=d.getAttrib(A,"size")){t+="size: "+x+" "}if(x=d.getAttrib(A,"color")){t+="color: "+x+" "}break;case"span":if(x=d.getAttrib(A,"style")){t+="style: "+x+" "}break}if(x=d.getAttrib(A,"id")){t+="id: "+x+" "}if(x=A.className){x=x.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g,"");if(x&&x.indexOf("mceItem")==-1){t+="class: "+x+" ";if(d.isBlock(A)||p=="img"||p=="span"){p+="."+x}}}p=p.replace(/(html:)/g,"");p={name:p,node:A,title:t};y.onResolveName.dispatch(y,p);t=p.title;p=p.name;v=d.create("a",{href:"javascript:;",onmousedown:"return false;",title:t,"class":"mcePath_"+(r++)},p);if(i.hasChildNodes()){i.insertBefore(d.doc.createTextNode(" \u00bb "),i.firstChild);i.insertBefore(v,i.firstChild)}else{i.appendChild(v)}},l.getBody())}},_sel:function(i){this.editor.execCommand("mceSelectNodeDepth",false,i)},_mceInsertAnchor:function(k,j){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/anchor.htm",width:320+parseInt(i.getLang("advanced.anchor_delta_width",0)),height:90+parseInt(i.getLang("advanced.anchor_delta_height",0)),inline:true},{theme_url:this.url})},_mceCharMap:function(){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/charmap.htm",width:550+parseInt(i.getLang("advanced.charmap_delta_width",0)),height:250+parseInt(i.getLang("advanced.charmap_delta_height",0)),inline:true},{theme_url:this.url})},_mceHelp:function(){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/about.htm",width:480,height:380,inline:true},{theme_url:this.url})},_mceColorPicker:function(k,j){var i=this.editor;j=j||{};i.windowManager.open({url:e.baseURL+"/themes/advanced/color_picker.htm",width:375+parseInt(i.getLang("advanced.colorpicker_delta_width",0)),height:250+parseInt(i.getLang("advanced.colorpicker_delta_height",0)),close_previous:false,inline:true},{input_color:j.color,func:j.func,theme_url:this.url})},_mceCodeEditor:function(j,k){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/source_editor.htm",width:parseInt(i.getParam("theme_advanced_source_editor_width",720)),height:parseInt(i.getParam("theme_advanced_source_editor_height",580)),inline:true,resizable:true,maximizable:true},{theme_url:this.url})},_mceImage:function(j,k){var i=this.editor;if(i.dom.getAttrib(i.selection.getNode(),"class").indexOf("mceItem")!=-1){return}i.windowManager.open({url:e.baseURL+"/themes/advanced/image.htm",width:355+parseInt(i.getLang("advanced.image_delta_width",0)),height:275+parseInt(i.getLang("advanced.image_delta_height",0)),inline:true},{theme_url:this.url})},_mceLink:function(j,k){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/link.htm",width:310+parseInt(i.getLang("advanced.link_delta_width",0)),height:200+parseInt(i.getLang("advanced.link_delta_height",0)),inline:true},{theme_url:this.url})},_mceNewDocument:function(){var i=this.editor;i.windowManager.confirm("advanced.newdocument",function(j){if(j){i.execCommand("mceSetContent",false,"")}})},_mceForeColor:function(){var i=this;this._mceColorPicker(0,{color:i.fgColor,func:function(j){i.fgColor=j;i.editor.execCommand("ForeColor",false,j)}})},_mceBackColor:function(){var i=this;this._mceColorPicker(0,{color:i.bgColor,func:function(j){i.bgColor=j;i.editor.execCommand("HiliteColor",false,j)}})},_ufirst:function(i){return i.substring(0,1).toUpperCase()+i.substring(1)}});e.ThemeManager.add("advanced",e.themes.AdvancedTheme)}(tinymce));
\ No newline at end of file
+(function(e){var d=e.DOM,b=e.dom.Event,h=e.extend,f=e.each,a=e.util.Cookie,g,c=e.explode;e.ThemeManager.requireLangPack("advanced");e.create("tinymce.themes.AdvancedTheme",{sizes:[8,10,12,14,18,24,36],controls:{bold:["bold_desc","Bold"],italic:["italic_desc","Italic"],underline:["underline_desc","Underline"],strikethrough:["striketrough_desc","Strikethrough"],justifyleft:["justifyleft_desc","JustifyLeft"],justifycenter:["justifycenter_desc","JustifyCenter"],justifyright:["justifyright_desc","JustifyRight"],justifyfull:["justifyfull_desc","JustifyFull"],bullist:["bullist_desc","InsertUnorderedList"],numlist:["numlist_desc","InsertOrderedList"],outdent:["outdent_desc","Outdent"],indent:["indent_desc","Indent"],cut:["cut_desc","Cut"],copy:["copy_desc","Copy"],paste:["paste_desc","Paste"],undo:["undo_desc","Undo"],redo:["redo_desc","Redo"],link:["link_desc","mceLink"],unlink:["unlink_desc","unlink"],image:["image_desc","mceImage"],cleanup:["cleanup_desc","mceCleanup"],help:["help_desc","mceHelp"],code:["code_desc","mceCodeEditor"],hr:["hr_desc","InsertHorizontalRule"],removeformat:["removeformat_desc","RemoveFormat"],sub:["sub_desc","subscript"],sup:["sup_desc","superscript"],forecolor:["forecolor_desc","ForeColor"],forecolorpicker:["forecolor_desc","mceForeColor"],backcolor:["backcolor_desc","HiliteColor"],backcolorpicker:["backcolor_desc","mceBackColor"],charmap:["charmap_desc","mceCharMap"],visualaid:["visualaid_desc","mceToggleVisualAid"],anchor:["anchor_desc","mceInsertAnchor"],newdocument:["newdocument_desc","mceNewDocument"],blockquote:["blockquote_desc","mceBlockQuote"]},stateControls:["bold","italic","underline","strikethrough","bullist","numlist","justifyleft","justifycenter","justifyright","justifyfull","sub","sup","blockquote"],init:function(j,k){var l=this,m,i,n;l.editor=j;l.url=k;l.onResolveName=new e.util.Dispatcher(this);l.settings=m=h({theme_advanced_path:true,theme_advanced_toolbar_location:"bottom",theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,|,sub,sup,|,charmap",theme_advanced_blockformats:"p,address,pre,h1,h2,h3,h4,h5,h6",theme_advanced_toolbar_align:"center",theme_advanced_fonts:"Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",theme_advanced_more_colors:1,theme_advanced_row_height:23,theme_advanced_resize_horizontal:1,theme_advanced_resizing_use_cookie:1,theme_advanced_font_sizes:"1,2,3,4,5,6,7",readonly:j.settings.readonly},j.settings);if(!m.font_size_style_values){m.font_size_style_values="8pt,10pt,12pt,14pt,18pt,24pt,36pt"}if(e.is(m.theme_advanced_font_sizes,"string")){m.font_size_style_values=e.explode(m.font_size_style_values);m.font_size_classes=e.explode(m.font_size_classes||"");n={};j.settings.theme_advanced_font_sizes=m.theme_advanced_font_sizes;f(j.getParam("theme_advanced_font_sizes","","hash"),function(q,p){var o;if(p==q&&q>=1&&q<=7){p=q+" ("+l.sizes[q-1]+"pt)";o=m.font_size_classes[q-1];q=m.font_size_style_values[q-1]||(l.sizes[q-1]+"pt")}if(/^\s*\./.test(q)){o=q.replace(/\./g,"")}n[p]=o?{"class":o}:{fontSize:q}});m.theme_advanced_font_sizes=n}if((i=m.theme_advanced_path_location)&&i!="none"){m.theme_advanced_statusbar_location=m.theme_advanced_path_location}if(m.theme_advanced_statusbar_location=="none"){m.theme_advanced_statusbar_location=0}j.onInit.add(function(){if(!j.settings.readonly){j.onNodeChange.add(l._nodeChanged,l)}if(j.settings.content_css!==false){j.dom.loadCSS(j.baseURI.toAbsolute(k+"/skins/"+j.settings.skin+"/content.css"))}});j.onSetProgressState.add(function(q,o,r){var s,t=q.id,p;if(o){l.progressTimer=setTimeout(function(){s=q.getContainer();s=s.insertBefore(d.create("DIV",{style:"position:relative"}),s.firstChild);p=d.get(q.id+"_tbl");d.add(s,"div",{id:t+"_blocker","class":"mceBlocker",style:{width:p.clientWidth+2,height:p.clientHeight+2}});d.add(s,"div",{id:t+"_progress","class":"mceProgress",style:{left:p.clientWidth/2,top:p.clientHeight/2}})},r||0)}else{d.remove(t+"_blocker");d.remove(t+"_progress");clearTimeout(l.progressTimer)}});d.loadCSS(m.editor_css?j.documentBaseURI.toAbsolute(m.editor_css):k+"/skins/"+j.settings.skin+"/ui.css");if(m.skin_variant){d.loadCSS(k+"/skins/"+j.settings.skin+"/ui_"+m.skin_variant+".css")}},createControl:function(l,i){var j,k;if(k=i.createControl(l)){return k}switch(l){case"styleselect":return this._createStyleSelect();case"formatselect":return this._createBlockFormats();case"fontselect":return this._createFontSelect();case"fontsizeselect":return this._createFontSizeSelect();case"forecolor":return this._createForeColorMenu();case"backcolor":return this._createBackColorMenu()}if((j=this.controls[l])){return i.createButton(l,{title:"advanced."+j[0],cmd:j[1],ui:j[2],value:j[3]})}},execCommand:function(k,j,l){var i=this["_"+k];if(i){i.call(this,j,l);return true}return false},_importClasses:function(k){var i=this.editor,j=i.controlManager.get("styleselect");if(j.getLength()==0){f(i.dom.getClasses(),function(n,l){var m="style_"+l;i.formatter.register(m,{inline:"span",attributes:{"class":n["class"]},selector:"*"});j.add(n["class"],m)})}},_createStyleSelect:function(m){var k=this,i=k.editor,j=i.controlManager,l;l=j.createListBox("styleselect",{title:"advanced.style_select",onselect:function(o){var p,n=[];f(l.items,function(q){n.push(q.value)});i.focus();i.undoManager.add();p=i.formatter.matchAll(n);if(!o||p[0]==o){i.formatter.remove(p[0])}else{i.formatter.apply(o)}i.undoManager.add();i.nodeChanged();return false}});i.onInit.add(function(){var o=0,n=i.getParam("style_formats");if(n){f(n,function(p){var q,r=0;f(p,function(){r++});if(r>1){q=p.name=p.name||"style_"+(o++);i.formatter.register(q,p);l.add(p.title,q)}else{l.add(p.title)}})}else{f(i.getParam("theme_advanced_styles","","hash"),function(r,q){var p;if(r){p="style_"+(o++);i.formatter.register(p,{inline:"span",classes:r,selector:"*"});l.add(k.editor.translate(q),p)}})}});if(l.getLength()==0){l.onPostRender.add(function(o,p){if(!l.NativeListBox){b.add(p.id+"_text","focus",k._importClasses,k);b.add(p.id+"_text","mousedown",k._importClasses,k);b.add(p.id+"_open","focus",k._importClasses,k);b.add(p.id+"_open","mousedown",k._importClasses,k)}else{b.add(p.id,"focus",k._importClasses,k)}})}return l},_createFontSelect:function(){var k,j=this,i=j.editor;k=i.controlManager.createListBox("fontselect",{title:"advanced.fontdefault",onselect:function(l){var m=k.items[k.selectedIndex];if(!l&&m){i.execCommand("FontName",false,m.value);return}i.execCommand("FontName",false,l);k.select(function(n){return l==n});return false}});if(k){f(i.getParam("theme_advanced_fonts",j.settings.theme_advanced_fonts,"hash"),function(m,l){k.add(i.translate(l),m,{style:m.indexOf("dings")==-1?"font-family:"+m:""})})}return k},_createFontSizeSelect:function(){var m=this,k=m.editor,n,l=0,j=[];n=k.controlManager.createListBox("fontsizeselect",{title:"advanced.font_size",onselect:function(i){var o=n.items[n.selectedIndex];if(!i&&o){o=o.value;if(o["class"]){k.formatter.toggle("fontsize_class",{value:o["class"]});k.undoManager.add();k.nodeChanged()}else{k.execCommand("FontSize",false,o.fontSize)}return}if(i["class"]){k.focus();k.undoManager.add();k.formatter.toggle("fontsize_class",{value:i["class"]});k.undoManager.add();k.nodeChanged()}else{k.execCommand("FontSize",false,i.fontSize)}n.select(function(p){return i==p});return false}});if(n){f(m.settings.theme_advanced_font_sizes,function(o,i){var p=o.fontSize;if(p>=1&&p<=7){p=m.sizes[parseInt(p)-1]+"pt"}n.add(i,o,{style:"font-size:"+p,"class":"mceFontSize"+(l++)+(" "+(o["class"]||""))})})}return n},_createBlockFormats:function(){var k,i={p:"advanced.paragraph",address:"advanced.address",pre:"advanced.pre",h1:"advanced.h1",h2:"advanced.h2",h3:"advanced.h3",h4:"advanced.h4",h5:"advanced.h5",h6:"advanced.h6",div:"advanced.div",blockquote:"advanced.blockquote",code:"advanced.code",dt:"advanced.dt",dd:"advanced.dd",samp:"advanced.samp"},j=this;k=j.editor.controlManager.createListBox("formatselect",{title:"advanced.block",cmd:"FormatBlock"});if(k){f(j.editor.getParam("theme_advanced_blockformats",j.settings.theme_advanced_blockformats,"hash"),function(m,l){k.add(j.editor.translate(l!=m?l:i[m]),m,{"class":"mce_formatPreview mce_"+m})})}return k},_createForeColorMenu:function(){var m,j=this,k=j.settings,l={},i;if(k.theme_advanced_more_colors){l.more_colors_func=function(){j._mceColorPicker(0,{color:m.value,func:function(n){m.setColor(n)}})}}if(i=k.theme_advanced_text_colors){l.colors=i}if(k.theme_advanced_default_foreground_color){l.default_color=k.theme_advanced_default_foreground_color}l.title="advanced.forecolor_desc";l.cmd="ForeColor";l.scope=this;m=j.editor.controlManager.createColorSplitButton("forecolor",l);return m},_createBackColorMenu:function(){var m,j=this,k=j.settings,l={},i;if(k.theme_advanced_more_colors){l.more_colors_func=function(){j._mceColorPicker(0,{color:m.value,func:function(n){m.setColor(n)}})}}if(i=k.theme_advanced_background_colors){l.colors=i}if(k.theme_advanced_default_background_color){l.default_color=k.theme_advanced_default_background_color}l.title="advanced.backcolor_desc";l.cmd="HiliteColor";l.scope=this;m=j.editor.controlManager.createColorSplitButton("backcolor",l);return m},renderUI:function(k){var m,l,q,v=this,r=v.editor,w=v.settings,u,j,i;m=j=d.create("span",{id:r.id+"_parent","class":"mceEditor "+r.settings.skin+"Skin"+(w.skin_variant?" "+r.settings.skin+"Skin"+v._ufirst(w.skin_variant):"")});if(!d.boxModel){m=d.add(m,"div",{"class":"mceOldBoxModel"})}m=u=d.add(m,"table",{id:r.id+"_tbl","class":"mceLayout",cellSpacing:0,cellPadding:0});m=q=d.add(m,"tbody");switch((w.theme_advanced_layout_manager||"").toLowerCase()){case"rowlayout":l=v._rowLayout(w,q,k);break;case"customlayout":l=r.execCallback("theme_advanced_custom_layout",w,q,k,j);break;default:l=v._simpleLayout(w,q,k,j)}m=k.targetNode;i=d.stdMode?u.getElementsByTagName("tr"):u.rows;d.addClass(i[0],"mceFirst");d.addClass(i[i.length-1],"mceLast");f(d.select("tr",q),function(o){d.addClass(o.firstChild,"mceFirst");d.addClass(o.childNodes[o.childNodes.length-1],"mceLast")});if(d.get(w.theme_advanced_toolbar_container)){d.get(w.theme_advanced_toolbar_container).appendChild(j)}else{d.insertAfter(j,m)}b.add(r.id+"_path_row","click",function(n){n=n.target;if(n.nodeName=="A"){v._sel(n.className.replace(/^.*mcePath_([0-9]+).*$/,"$1"));return b.cancel(n)}});if(!r.getParam("accessibility_focus")){b.add(d.add(j,"a",{href:"#"},""),"focus",function(){tinyMCE.get(r.id).focus()})}if(w.theme_advanced_toolbar_location=="external"){k.deltaHeight=0}v.deltaHeight=k.deltaHeight;k.targetNode=null;return{iframeContainer:l,editorContainer:r.id+"_parent",sizeContainer:u,deltaHeight:k.deltaHeight}},getInfo:function(){return{longname:"Advanced theme",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",version:e.majorVersion+"."+e.minorVersion}},resizeBy:function(i,j){var k=d.get(this.editor.id+"_tbl");this.resizeTo(k.clientWidth+i,k.clientHeight+j)},resizeTo:function(i,m,k){var j=this.editor,l=this.settings,n=d.get(j.id+"_tbl"),o=d.get(j.id+"_ifr");i=Math.max(l.theme_advanced_resizing_min_width||100,i);m=Math.max(l.theme_advanced_resizing_min_height||100,m);i=Math.min(l.theme_advanced_resizing_max_width||65535,i);m=Math.min(l.theme_advanced_resizing_max_height||65535,m);d.setStyle(n,"height","");d.setStyle(o,"height",m);if(l.theme_advanced_resize_horizontal){d.setStyle(n,"width","");d.setStyle(o,"width",i);if(i"))}q.push(d.createHTML("a",{href:"#",accesskey:"q",title:r.getLang("advanced.toolbar_focus")},""));for(p=1;(y=A["theme_advanced_buttons"+p]);p++){m=j.createToolbar("toolbar"+p,{"class":"mceToolbarRow"+p});if(A["theme_advanced_buttons"+p+"_add"]){y+=","+A["theme_advanced_buttons"+p+"_add"]}if(A["theme_advanced_buttons"+p+"_add_before"]){y=A["theme_advanced_buttons"+p+"_add_before"]+","+y}z._addControls(y,m);q.push(m.renderHTML());k.deltaHeight-=A.theme_advanced_row_height}q.push(d.createHTML("a",{href:"#",accesskey:"z",title:r.getLang("advanced.toolbar_focus"),onfocus:"tinyMCE.getInstanceById('"+r.id+"').focus();"},""));d.setHTML(l,q.join(""))},_addStatusBar:function(m,j){var k,v=this,p=v.editor,w=v.settings,i,q,u,l;k=d.add(m,"tr");k=l=d.add(k,"td",{"class":"mceStatusbar"});k=d.add(k,"div",{id:p.id+"_path_row"},w.theme_advanced_path?p.translate("advanced.path")+": ":" ");d.add(k,"a",{href:"#",accesskey:"x"});if(w.theme_advanced_resizing){d.add(l,"a",{id:p.id+"_resize",href:"javascript:;",onclick:"return false;","class":"mceResize"});if(w.theme_advanced_resizing_use_cookie){p.onPostRender.add(function(){var n=a.getHash("TinyMCE_"+p.id+"_size"),r=d.get(p.id+"_tbl");if(!n){return}v.resizeTo(n.cw,n.ch)})}p.onPostRender.add(function(){b.add(p.id+"_resize","click",function(n){n.preventDefault()});b.add(p.id+"_resize","mousedown",function(D){var t,r,s,o,C,z,A,F,n,E,x;function y(G){G.preventDefault();n=A+(G.screenX-C);E=F+(G.screenY-z);v.resizeTo(n,E)}function B(G){b.remove(d.doc,"mousemove",t);b.remove(p.getDoc(),"mousemove",r);b.remove(d.doc,"mouseup",s);b.remove(p.getDoc(),"mouseup",o);n=A+(G.screenX-C);E=F+(G.screenY-z);v.resizeTo(n,E,true)}D.preventDefault();C=D.screenX;z=D.screenY;x=d.get(v.editor.id+"_ifr");A=n=x.clientWidth;F=E=x.clientHeight;t=b.add(d.doc,"mousemove",y);r=b.add(p.getDoc(),"mousemove",y);s=b.add(d.doc,"mouseup",B);o=b.add(p.getDoc(),"mouseup",B)})})}j.deltaHeight-=21;k=m=null},_nodeChanged:function(r,z,l,x,j){var C=this,i,y=0,B,u,D=C.settings,A,k,w,m,q;e.each(C.stateControls,function(n){z.setActive(n,r.queryCommandState(C.controls[n][1]))});function o(p){var s,n=j.parents,t=p;if(typeof(p)=="string"){t=function(v){return v.nodeName==p}}for(s=0;s
{#advanced_dlg.image_title}
-
-
-
-
+
+
+
+
diff --git a/wp-includes/js/tinymce/themes/advanced/img/icons.gif b/wp-includes/js/tinymce/themes/advanced/img/icons.gif
index ccac36f54d983cc33a0a6e45134e3dabf1820367..e46de5333082869b9bdab2576a554a2f9d01a966 100644
GIT binary patch
delta 556
zcmV+{0@MBRS(03^@+*J4nMj91K!6CCg;~%|ckg$9|95~7c!3}ITCag#i1+#^_l8J<
zMz{hi-~mn`f&WkNUxKfAi@$h`&v=cmcm(hTgr^UBX9yQ4ge$;@S9v2sc!Q7Jc$RN@
zmw$PfkNI8?cZ4VRnMi^w;DBhrhc`+RN=Se=h;o@9dZI6Sqd$Lor0*6Nojs;s`lY}5
zD*y%?AcQ30fmnctx}x}`-+Hd^dawU_qECWAD1>z20BE=b8{mXb!1_C|f>=NVu#bDW
zpL@Em`(u{{S@;LM$9uis`@ZLUzCVa0SOOTmgjL`H5`YKAhX)~m2gb8|$d7!eJ7C-QRuh-Zy%KS7+c?_=Av3*=JNnJy~rK`rcoD=5K!I_jd%qhmU`NkWb!Nz)#vo
z{#n5N=kI>+|9GLPhphAZdEo$^A(xgh4GHvPh&Zm*sx;9k}YfYEZVec*RpNv_AT7Fa_7>mYxgeRym~JN1OPj2L>nUj
delta 265
zcmV+k0rviqT=7}3@+*HkcdvJQzju7kcYWXYVXuK+i1+#^cYYsuf-iW3KX`;s`0DTl
zfTs_7S9pkzc+QERc#5z1V-I(LCwGhAc#iLQkN#4PkEJJd6sW^
zmw$Pfk9nD&d1sdeS@;K=w|Sh;`JLB!ou_%A4|<^=dZI6Sqd$Loq)&RKPxg{;dXt~M
zrH^{4pL(i?d4E@DtQYvI-+Hd^daoaN1i*)ee}ISodb2-!v`>3%$M|^Hc(s3fxQ~0e
zA9i?eczh`PxzBsO-+R74bblXvt?zrmAAG_u{BA)2hHrShH+;r#e8+!$$d7!
{#advanced_dlg.link_title}
-
-
-
-
-
+
+
+
+
+
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/default/content.css b/wp-includes/js/tinymce/themes/advanced/skins/default/content.css
index cb7604e7..dd8fb95e 100644
--- a/wp-includes/js/tinymce/themes/advanced/skins/default/content.css
+++ b/wp-includes/js/tinymce/themes/advanced/skins/default/content.css
@@ -8,8 +8,9 @@ h4 {font-size: 1em}
h5 {font-size: .83em}
h6 {font-size: .75em}
.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;}
-a.mceItemAnchor {width:12px; line-height:6px; overflow:hidden; padding-left:12px; background:url(img/items.gif) no-repeat bottom left;}
-img.mceItemAnchor {width:12px; height:12px; background:url(img/items.gif) no-repeat;}
+a.mceItemAnchor {display:inline-block; width:11px !important; height:11px !important; background:url(img/items.gif) no-repeat 0 0;}
+span.mceItemNbsp {background: #DDD}
+td.mceSelected, th.mceSelected {background-color:#3399ff !important}
img {border:0;}
table {cursor:default}
table td, table th {cursor:text}
@@ -17,7 +18,7 @@ ins {border-bottom:1px solid green; text-decoration: none; color:green}
del {color:red; text-decoration:line-through}
cite {border-bottom:1px dashed blue}
acronym {border-bottom:1px dotted #CCC; cursor:help}
-abbr, html\:abbr {border-bottom:1px dashed #CCC; cursor:help}
+abbr {border-bottom:1px dashed #CCC; cursor:help}
/* IE */
* html body {
@@ -30,3 +31,6 @@ scrollbar-highlight-color:#F0F0EE;
scrollbar-shadow-color:#F0F0EE;
scrollbar-track-color:#F5F5F5;
}
+
+img:-moz-broken {-moz-force-broken-image-icon:1; width:24px; height:24px}
+font[face=mceinline] {font-family:inherit !important}
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/default/dialog.css b/wp-includes/js/tinymce/themes/advanced/skins/default/dialog.css
index fa2df254..1f5598c6 100644
--- a/wp-includes/js/tinymce/themes/advanced/skins/default/dialog.css
+++ b/wp-includes/js/tinymce/themes/advanced/skins/default/dialog.css
@@ -42,10 +42,11 @@ width:94px; height:26px;
background:url(img/buttons.png) 0 -26px;
cursor:pointer;
padding-bottom:2px;
+float:left;
}
-#insert {background:url(img/buttons.png) 0 -52px;}
-#cancel {background:url(img/buttons.png) 0 0;}
+#insert {background:url(img/buttons.png) 0 -52px}
+#cancel {background:url(img/buttons.png) 0 0; float:right}
/* Browse */
a.pickcolor, a.browse {text-decoration:none}
@@ -113,4 +114,4 @@ h3 {font-size:14px;}
#colorpicker #namedcolors {width:150px;}
#colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;}
#colorpicker #colornamecontainer {margin-top:5px;}
-#colorpicker #picker_panel fieldset {margin:auto;width:325px;}
\ No newline at end of file
+#colorpicker #picker_panel fieldset {margin:auto;width:325px;}
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/default/ui.css b/wp-includes/js/tinymce/themes/advanced/skins/default/ui.css
index 2c90d498..7f6cf5fd 100644
--- a/wp-includes/js/tinymce/themes/advanced/skins/default/ui.css
+++ b/wp-includes/js/tinymce/themes/advanced/skins/default/ui.css
@@ -4,7 +4,7 @@
.defaultSkin table td {vertical-align:middle}
/* Containers */
-.defaultSkin table {background:#F0F0EE}
+.defaultSkin table {direction:ltr; background:#F0F0EE}
.defaultSkin iframe {display:block; background:#FFF}
.defaultSkin .mceToolbar {height:26px}
.defaultSkin .mceLeft {text-align:left}
@@ -24,7 +24,7 @@
.defaultSkin .mceIframeContainer {border-top:1px solid #CCC; border-bottom:1px solid #CCC}
.defaultSkin .mceStatusbar {font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; color:#000; display:block; height:20px}
.defaultSkin .mceStatusbar div {float:left; margin:2px}
-.defaultSkin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize}
+.defaultSkin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize; outline:0}
.defaultSkin .mceStatusbar a:hover {text-decoration:underline}
.defaultSkin table.mceToolbar {margin-left:3px}
.defaultSkin span.mceIcon, .defaultSkin img.mceIcon {display:block; width:20px; height:20px}
@@ -47,7 +47,6 @@
.defaultSkin .mceSeparator {display:block; background:url(../../img/icons.gif) -180px 0; width:2px; height:20px; margin:2px 2px 0 4px}
/* ListBox */
-.defaultSkin .mceListBox {direction:ltr}
.defaultSkin .mceListBox, .defaultSkin .mceListBox a {display:block}
.defaultSkin .mceListBox .mceText {padding-left:4px; width:70px; text-align:left; border:1px solid #CCC; border-right:0; background:#FFF; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; height:20px; line-height:20px; overflow:hidden}
.defaultSkin .mceListBox .mceOpen {width:9px; height:20px; background:url(../../img/icons.gif) -741px 0; margin-right:2px; border:1px solid #CCC;}
@@ -63,7 +62,7 @@
.defaultSkin .mceSplitButton {width:32px; height:20px; direction:ltr}
.defaultSkin .mceSplitButton a, .defaultSkin .mceSplitButton span {height:20px; display:block}
.defaultSkin .mceSplitButton a.mceAction {width:20px; border:1px solid #F0F0EE; border-right:0;}
-.defaultSkin .mceSplitButton span.mceAction {width:20px; background:url(../../img/icons.gif) 20px 20px;}
+.defaultSkin .mceSplitButton span.mceAction {width:20px; background-image:url(../../img/icons.gif);}
.defaultSkin .mceSplitButton a.mceOpen {width:9px; background:url(../../img/icons.gif) -741px 0; border:1px solid #F0F0EE;}
.defaultSkin .mceSplitButton span.mceOpen {display:none}
.defaultSkin table.mceSplitButtonEnabled:hover a.mceAction, .defaultSkin .mceSplitButtonHover a.mceAction, .defaultSkin .mceSplitButtonSelected a.mceAction {border:1px solid #0A246A; border-right:0; background-color:#B2BBD0}
@@ -108,7 +107,6 @@
/* Progress,Resize */
.defaultSkin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=50)'; filter:alpha(opacity=50); background:#FFF}
.defaultSkin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px}
-.defaultSkin .mcePlaceHolder {border:1px dotted gray}
/* Formats */
.defaultSkin .mce_formatPreview a {font-size:10px}
@@ -211,4 +209,5 @@
.defaultSkin span.mce_del {background-position:-940px -20px}
.defaultSkin span.mce_ins {background-position:-960px -20px}
.defaultSkin span.mce_pagebreak {background-position:0 -40px}
-.defaultSkin .mce_spellchecker span.mceAction {background-position:-540px -20px}
+.defaultSkin span.mce_restoredraft {background-position:-20px -40px}
+.defaultSkin span.mce_spellchecker {background-position:-540px -20px}
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/o2k7/content.css b/wp-includes/js/tinymce/themes/advanced/skins/o2k7/content.css
index a4049317..500fa0de 100644
--- a/wp-includes/js/tinymce/themes/advanced/skins/o2k7/content.css
+++ b/wp-includes/js/tinymce/themes/advanced/skins/o2k7/content.css
@@ -8,8 +8,9 @@ h4 {font-size: 1em}
h5 {font-size: .83em}
h6 {font-size: .75em}
.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;}
-a.mceItemAnchor {width:12px; line-height:6px; overflow:hidden; padding-left:12px; background:url(../default/img/items.gif) no-repeat bottom left;}
-img.mceItemAnchor {width:12px; height:12px; background:url(../default/img/items.gif) no-repeat;}
+a.mceItemAnchor {display:inline-block; width:11px !important; height:11px !important; background:url(../default/img/items.gif) no-repeat 0 0;}
+span.mceItemNbsp {background: #DDD}
+td.mceSelected, th.mceSelected {background-color:#3399ff !important}
img {border:0;}
table {cursor:default}
table td, table th {cursor:text}
@@ -17,7 +18,7 @@ ins {border-bottom:1px solid green; text-decoration: none; color:green}
del {color:red; text-decoration:line-through}
cite {border-bottom:1px dashed blue}
acronym {border-bottom:1px dotted #CCC; cursor:help}
-abbr, html\:abbr {border-bottom:1px dashed #CCC; cursor:help}
+abbr {border-bottom:1px dashed #CCC; cursor:help}
/* IE */
* html body {
@@ -30,3 +31,6 @@ scrollbar-highlight-color:#F0F0EE;
scrollbar-shadow-color:#F0F0EE;
scrollbar-track-color:#F5F5F5;
}
+
+img:-moz-broken {-moz-force-broken-image-icon:1; width:24px; height:24px}
+font[face=mceinline] {font-family:inherit !important}
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/o2k7/dialog.css b/wp-includes/js/tinymce/themes/advanced/skins/o2k7/dialog.css
index 6b278b64..3b0760a6 100644
--- a/wp-includes/js/tinymce/themes/advanced/skins/o2k7/dialog.css
+++ b/wp-includes/js/tinymce/themes/advanced/skins/o2k7/dialog.css
@@ -42,10 +42,11 @@ width:94px; height:26px;
background:url(../default/img/buttons.png) 0 -26px;
cursor:pointer;
padding-bottom:2px;
+float:left;
}
-#insert {background:url(../default/img/buttons.png) 0 -52px;}
-#cancel {background:url(../default/img/buttons.png) 0 0;}
+#insert {background:url(../default/img/buttons.png) 0 -52px}
+#cancel {background:url(../default/img/buttons.png) 0 0; float:right}
/* Browse */
a.pickcolor, a.browse {text-decoration:none}
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui.css b/wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui.css
index 0f8d5c24..52f5760f 100644
--- a/wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui.css
+++ b/wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui.css
@@ -21,7 +21,7 @@
.o2k7Skin .mceIframeContainer {border-top:1px solid #ABC6DD; border-bottom:1px solid #ABC6DD}
.o2k7Skin .mceStatusbar {display:block; font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; color:#000; height:20px}
.o2k7Skin .mceStatusbar div {float:left; padding:2px}
-.o2k7Skin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize}
+.o2k7Skin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize; outline:0}
.o2k7Skin .mceStatusbar a:hover {text-decoration:underline}
.o2k7Skin table.mceToolbar {margin-left:3px}
.o2k7Skin .mceToolbar .mceToolbarStart span {display:block; background:url(img/button_bg.png) -22px 0; width:1px; height:22px; margin-left:3px;}
@@ -65,7 +65,7 @@
.o2k7Skin .mceSplitButton, .o2k7Skin .mceSplitButton a, .o2k7Skin .mceSplitButton span {display:block; height:22px}
.o2k7Skin .mceSplitButton {background:url(img/button_bg.png)}
.o2k7Skin .mceSplitButton a.mceAction {width:22px}
-.o2k7Skin .mceSplitButton span.mceAction {width:22px; background:url(../../img/icons.gif) 20px 20px}
+.o2k7Skin .mceSplitButton span.mceAction {width:22px; background-image:url(../../img/icons.gif)}
.o2k7Skin .mceSplitButton a.mceOpen {width:10px; background:url(img/button_bg.png) -44px 0}
.o2k7Skin .mceSplitButton span.mceOpen {display:none}
.o2k7Skin table.mceSplitButtonEnabled:hover a.mceAction, .o2k7Skin .mceSplitButtonHover a.mceAction, .o2k7Skin .mceSplitButtonSelected {background:url(img/button_bg.png) 0 -22px}
@@ -109,7 +109,6 @@
/* Progress,Resize */
.o2k7Skin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=50); background:#FFF}
.o2k7Skin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(../default/img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px}
-.o2k7Skin .mcePlaceHolder {border:1px dotted gray}
/* Formats */
.o2k7Skin .mce_formatPreview a {font-size:10px}
@@ -212,4 +211,5 @@
.o2k7Skin span.mce_del {background-position:-940px -20px}
.o2k7Skin span.mce_ins {background-position:-960px -20px}
.o2k7Skin span.mce_pagebreak {background-position:0 -40px}
-.o2k7Skin .mce_spellchecker span.mceAction {background-position:-540px -20px}
+.o2k7Skin span.mce_restoredraft {background-position:-20px -40px}
+.o2k7Skin span.mce_spellchecker {background-position:-540px -20px}
diff --git a/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css b/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css
index 1cd2771a..f4b1fe44 100644
--- a/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css
+++ b/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css
@@ -152,7 +152,9 @@ border:0; margin:0; padding:0; white-space:nowrap; text-decoration:none; font-we
padding: 1px 2px;
}
.wp_themeSkin .mceSplitButton span.mceAction {
- background: url(../../img/icons.gif) 20px 20px;
+ background-image: url(../../img/icons.gif);
+ background-repeat: no-repeat;
+ background-color: transparent;
width:20px;
}
.wp_themeSkin .mceSplitButton a.mceOpen {
@@ -346,7 +348,7 @@ border:0; margin:0; padding:0; white-space:nowrap; text-decoration:none; font-we
.wp_themeSkin span.mce_del {background-position:-940px -20px}
.wp_themeSkin span.mce_ins {background-position:-960px -20px}
.wp_themeSkin span.mce_pagebreak {background-position:0 -40px}
-.wp_themeSkin .mce_spellchecker span.mceAction {background-position:-540px -20px}
+.wp_themeSkin span.mce_spellchecker {background-position:-540px -20px}
/* border */
.wp_themeSkin .mceExternalToolbar,
diff --git a/wp-includes/js/tinymce/themes/advanced/source_editor.htm b/wp-includes/js/tinymce/themes/advanced/source_editor.htm
index 1c4225d8..b0db4ba6 100644
--- a/wp-includes/js/tinymce/themes/advanced/source_editor.htm
+++ b/wp-includes/js/tinymce/themes/advanced/source_editor.htm
@@ -1,9 +1,8 @@
-
{#advanced_dlg.code_title}
-
-
+
+
diff --git a/wp-includes/js/tinymce/tiny_mce.js b/wp-includes/js/tinymce/tiny_mce.js
index 73ad8b89..2fee4a03 100644
--- a/wp-includes/js/tinymce/tiny_mce.js
+++ b/wp-includes/js/tinymce/tiny_mce.js
@@ -1 +1 @@
-var tinymce={majorVersion:"3",minorVersion:"2.7",releaseDate:"2009-09-22",_init:function(){var o=this,k=document,l=window,j=navigator,b=j.userAgent,h,a,g,f,e,m;o.isOpera=l.opera&&opera.buildNumber;o.isWebKit=/WebKit/.test(b);o.isIE=!o.isWebKit&&!o.isOpera&&(/MSIE/gi).test(b)&&(/Explorer/gi).test(j.appName);o.isIE6=o.isIE&&/MSIE [56]/.test(b);o.isGecko=!o.isWebKit&&/Gecko/.test(b);o.isMac=b.indexOf("Mac")!=-1;o.isAir=/adobeair/i.test(b);if(l.tinyMCEPreInit){o.suffix=tinyMCEPreInit.suffix;o.baseURL=tinyMCEPreInit.base;o.query=tinyMCEPreInit.query;return}o.suffix="";a=k.getElementsByTagName("base");for(h=0;h=c.length){for(e=0,b=g.length;e=c.length||g[e]!=c[e]){f=e+1;break}}}if(g.length=g.length||g[e]!=c[e]){f=e+1;break}}}if(f==1){return h}for(e=0,b=g.length-(f-1);e=0;c--){if(f[c].length==0||f[c]=="."){continue}if(f[c]==".."){b++;continue}if(b>0){b--;continue}h.push(f[c])}c=e.length-b;if(c<=0){g=h.reverse().join("/")}else{g=e.slice(0,c).join("/")+"/"+h.reverse().join("/")}if(g.indexOf("/")!==0){g="/"+g}if(d&&g.lastIndexOf("/")!==g.length-1){g+=d}return g},getURI:function(d){var c,b=this;if(!b.source||d){c="";if(!d){if(b.protocol){c+=b.protocol+"://"}if(b.userInfo){c+=b.userInfo+"@"}if(b.host){c+=b.host}if(b.port){c+=":"+b.port}}if(b.path){c+=b.path}if(b.query){c+="?"+b.query}if(b.anchor){c+="#"+b.anchor}b.source=c}return b.source}})})();(function(){var a=tinymce.each;tinymce.create("static tinymce.util.Cookie",{getHash:function(d){var b=this.get(d),c;if(b){a(b.split("&"),function(e){e=e.split("=");c=c||{};c[unescape(e[0])]=unescape(e[1])})}return c},setHash:function(j,b,g,f,i,c){var h="";a(b,function(e,d){h+=(!h?"":"&")+escape(d)+"="+escape(e)});this.set(j,h,g,f,i,c)},get:function(i){var h=document.cookie,g,f=i+"=",d;if(!h){return}d=h.indexOf("; "+f);if(d==-1){d=h.indexOf(f);if(d!=0){return null}}else{d+=2}g=h.indexOf(";",d);if(g==-1){g=h.length}return unescape(h.substring(d+f.length,g))},set:function(i,b,g,f,h,c){document.cookie=i+"="+escape(b)+((g)?"; expires="+g.toGMTString():"")+((f)?"; path="+escape(f):"")+((h)?"; domain="+h:"")+((c)?"; secure":"")},remove:function(e,b){var c=new Date();c.setTime(c.getTime()-1000);this.set(e,"",c,b,c)}})})();tinymce.create("static tinymce.util.JSON",{serialize:function(e){var c,a,d=tinymce.util.JSON.serialize,b;if(e==null){return"null"}b=typeof e;if(b=="string"){a="\bb\tt\nn\ff\rr\"\"''\\\\";return'"'+e.replace(/([\u0080-\uFFFF\x00-\x1f\"])/g,function(g,f){c=a.indexOf(f);if(c+1){return"\\"+a.charAt(c+1)}g=f.charCodeAt().toString(16);return"\\u"+"0000".substring(g.length)+g})+'"'}if(b=="object"){if(e.hasOwnProperty&&e instanceof Array){for(c=0,a="[";c0?",":"")+d(e[c])}return a+"]"}a="{";for(c in e){a+=typeof e[c]!="function"?(a.length>1?',"':'"')+c+'":'+d(e[c]):""}return a+"}"}return""+e},parse:function(s){try{return eval("("+s+")")}catch(ex){}}});tinymce.create("static tinymce.util.XHR",{send:function(g){var a,e,b=window,h=0;g.scope=g.scope||this;g.success_scope=g.success_scope||g.scope;g.error_scope=g.error_scope||g.scope;g.async=g.async===false?false:true;g.data=g.data||"";function d(i){a=0;try{a=new ActiveXObject(i)}catch(c){}return a}a=b.XMLHttpRequest?new XMLHttpRequest():d("Microsoft.XMLHTTP")||d("Msxml2.XMLHTTP");if(a){if(a.overrideMimeType){a.overrideMimeType(g.content_type)}a.open(g.type||(g.data?"POST":"GET"),g.url,g.async);if(g.content_type){a.setRequestHeader("Content-Type",g.content_type)}a.setRequestHeader("X-Requested-With","XMLHttpRequest");a.send(g.data);function f(){if(!g.async||a.readyState==4||h++>10000){if(g.success&&h<10000&&a.status==200){g.success.call(g.success_scope,""+a.responseText,a,g)}else{if(g.error){g.error.call(g.error_scope,h>10000?"TIMED_OUT":"GENERAL",a,g)}}a=null}else{b.setTimeout(f,10)}}if(!g.async){return f()}e=b.setTimeout(f,10)}}});(function(){var c=tinymce.extend,b=tinymce.util.JSON,a=tinymce.util.XHR;tinymce.create("tinymce.util.JSONRequest",{JSONRequest:function(d){this.settings=c({},d);this.count=0},send:function(f){var e=f.error,d=f.success;f=c(this.settings,f);f.success=function(h,g){h=b.parse(h);if(typeof(h)=="undefined"){h={error:"JSON Parse error."}}if(h.error){e.call(f.error_scope||f.scope,h.error,g)}else{d.call(f.success_scope||f.scope,h.result)}};f.error=function(h,g){e.call(f.error_scope||f.scope,h,g)};f.data=b.serialize({id:f.id||"c"+(this.count++),method:f.method,params:f.params});f.content_type="application/json";a.send(f)},"static":{sendRPC:function(d){return new tinymce.util.JSONRequest().send(d)}}})}());(function(c){var e=c.each,b=c.is;var d=c.isWebKit,a=c.isIE;c.create("tinymce.dom.DOMUtils",{doc:null,root:null,files:null,pixelStyles:/^(top|left|bottom|right|width|height|borderWidth)$/,props:{"for":"htmlFor","class":"className",className:"className",checked:"checked",disabled:"disabled",maxlength:"maxLength",readonly:"readOnly",selected:"selected",value:"value",id:"id",name:"name",type:"type"},DOMUtils:function(i,g){var f=this;f.doc=i;f.win=window;f.files={};f.cssFlicker=false;f.counter=0;f.boxModel=!c.isIE||i.compatMode=="CSS1Compat";f.stdMode=i.documentMode===8;f.settings=g=c.extend({keep_values:false,hex_colors:1,process_html:1},g);if(c.isIE6){try{i.execCommand("BackgroundImageCache",false,true)}catch(h){f.cssFlicker=true}}c.addUnload(f.destroy,f)},getRoot:function(){var f=this,g=f.settings;return(g&&f.get(g.root_element))||f.doc.body},getViewPort:function(g){var h,f;g=!g?this.win:g;h=g.document;f=this.boxModel?h.documentElement:h.body;return{x:g.pageXOffset||f.scrollLeft,y:g.pageYOffset||f.scrollTop,w:g.innerWidth||f.clientWidth,h:g.innerHeight||f.clientHeight}},getRect:function(i){var h,f=this,g;i=f.get(i);h=f.getPos(i);g=f.getSize(i);return{x:h.x,y:h.y,w:g.w,h:g.h}},getSize:function(j){var g=this,f,i;j=g.get(j);f=g.getStyle(j,"width");i=g.getStyle(j,"height");if(f.indexOf("px")===-1){f=0}if(i.indexOf("px")===-1){i=0}return{w:parseInt(f)||j.offsetWidth||j.clientWidth,h:parseInt(i)||j.offsetHeight||j.clientHeight}},getParent:function(i,h,g){return this.getParents(i,h,g,false)},getParents:function(p,k,i,m){var h=this,g,j=h.settings,l=[];p=h.get(p);m=m===undefined;if(j.strict_root){i=i||h.getRoot()}if(b(k,"string")){g=k;if(k==="*"){k=function(f){return f.nodeType==1}}else{k=function(f){return h.is(f,g)}}}while(p){if(p==i||!p.nodeType||p.nodeType===9){break}if(!k||k(p)){if(m){l.push(p)}else{return p}}p=p.parentNode}return m?l:null},get:function(f){var g;if(f&&this.doc&&typeof(f)=="string"){g=f;f=this.doc.getElementById(f);if(f&&f.id!==g){return this.doc.getElementsByName(g)[1]}}return f},getNext:function(g,f){return this._findSib(g,f,"nextSibling")},getPrev:function(g,f){return this._findSib(g,f,"previousSibling")},select:function(h,g){var f=this;return c.dom.Sizzle(h,f.get(g)||f.get(f.settings.root_element)||f.doc,[])},is:function(g,f){return c.dom.Sizzle.matches(f,g.nodeType?[g]:g).length>0},add:function(j,l,f,i,k){var g=this;return this.run(j,function(n){var m,h;m=b(l,"string")?g.doc.createElement(l):l;g.setAttribs(m,f);if(i){if(i.nodeType){m.appendChild(i)}else{g.setHTML(m,i)}}return !k?n.appendChild(m):m})},create:function(i,f,g){return this.add(this.doc.createElement(i),i,f,g,1)},createHTML:function(m,f,j){var l="",i=this,g;l+="<"+m;for(g in f){if(f.hasOwnProperty(g)){l+=" "+g+'="'+i.encode(f[g])+'"'}}if(c.is(j)){return l+">"+j+""+m+">"}return l+" />"},remove:function(h,f){var g=this;return this.run(h,function(m){var l,k,j;l=m.parentNode;if(!l){return null}if(f){for(j=m.childNodes.length-1;j>=0;j--){g.insertAfter(m.childNodes[j],m)}}if(g.fixPsuedoLeaks){l=m.cloneNode(true);f="IELeakGarbageBin";k=g.get(f)||g.add(g.doc.body,"div",{id:f,style:"display:none"});k.appendChild(m);k.innerHTML="";return l}return l.removeChild(m)})},setStyle:function(i,f,g){var h=this;return h.run(i,function(l){var k,j;k=l.style;f=f.replace(/-(\D)/g,function(n,m){return m.toUpperCase()});if(h.pixelStyles.test(f)&&(c.is(g,"number")||/^[\-0-9\.]+$/.test(g))){g+="px"}switch(f){case"opacity":if(a){k.filter=g===""?"":"alpha(opacity="+(g*100)+")";if(!i.currentStyle||!i.currentStyle.hasLayout){k.display="inline-block"}}k[f]=k["-moz-opacity"]=k["-khtml-opacity"]=g||"";break;case"float":a?k.styleFloat=g:k.cssFloat=g;break;default:k[f]=g||""}if(h.settings.update_styles){h.setAttrib(l,"mce_style")}})},getStyle:function(i,f,h){i=this.get(i);if(!i){return false}if(this.doc.defaultView&&h){f=f.replace(/[A-Z]/g,function(j){return"-"+j});try{return this.doc.defaultView.getComputedStyle(i,null).getPropertyValue(f)}catch(g){return null}}f=f.replace(/-(\D)/g,function(k,j){return j.toUpperCase()});if(f=="float"){f=a?"styleFloat":"cssFloat"}if(i.currentStyle&&h){return i.currentStyle[f]}return i.style[f]},setStyles:function(i,j){var g=this,h=g.settings,f;f=h.update_styles;h.update_styles=0;e(j,function(k,l){g.setStyle(i,l,k)});h.update_styles=f;if(h.update_styles){g.setAttrib(i,h.cssText)}},setAttrib:function(h,i,f){var g=this;if(!h||!i){return}if(g.settings.strict){i=i.toLowerCase()}return this.run(h,function(k){var j=g.settings;switch(i){case"style":if(!b(f,"string")){e(f,function(l,m){g.setStyle(k,m,l)});return}if(j.keep_values){if(f&&!g._isRes(f)){k.setAttribute("mce_style",f,2)}else{k.removeAttribute("mce_style",2)}}k.style.cssText=f;break;case"class":k.className=f||"";break;case"src":case"href":if(j.keep_values){if(j.url_converter){f=j.url_converter.call(j.url_converter_scope||g,f,i,k)}g.setAttrib(k,"mce_"+i,f,2)}break;case"shape":k.setAttribute("mce_style",f);break}if(b(f)&&f!==null&&f.length!==0){k.setAttribute(i,""+f,2)}else{k.removeAttribute(i,2)}})},setAttribs:function(g,h){var f=this;return this.run(g,function(i){e(h,function(j,k){f.setAttrib(i,k,j)})})},getAttrib:function(i,j,h){var f,g=this;i=g.get(i);if(!i||i.nodeType!==1){return false}if(!b(h)){h=""}if(/^(src|href|style|coords|shape)$/.test(j)){f=i.getAttribute("mce_"+j);if(f){return f}}if(a&&g.props[j]){f=i[g.props[j]];f=f&&f.nodeValue?f.nodeValue:f}if(!f){f=i.getAttribute(j,2)}if(/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)$/.test(j)){if(i[g.props[j]]===true&&f===""){return j}return f?j:""}if(i.nodeName==="FORM"&&i.getAttributeNode(j)){return i.getAttributeNode(j).nodeValue}if(j==="style"){f=f||i.style.cssText;if(f){f=g.serializeStyle(g.parseStyle(f));if(g.settings.keep_values&&!g._isRes(f)){i.setAttribute("mce_style",f)}}}if(d&&j==="class"&&f){f=f.replace(/(apple|webkit)\-[a-z\-]+/gi,"")}if(a){switch(j){case"rowspan":case"colspan":if(f===1){f=""}break;case"size":if(f==="+0"||f===20||f===0){f=""}break;case"width":case"height":case"vspace":case"checked":case"disabled":case"readonly":if(f===0){f=""}break;case"hspace":if(f===-1){f=""}break;case"maxlength":case"tabindex":if(f===32768||f===2147483647||f==="32768"){f=""}break;case"multiple":case"compact":case"noshade":case"nowrap":if(f===65535){return j}return h;case"shape":f=f.toLowerCase();break;default:if(j.indexOf("on")===0&&f){f=(""+f).replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/,"$1")}}}return(f!==undefined&&f!==null&&f!=="")?""+f:h},getPos:function(m,i){var g=this,f=0,l=0,j,k=g.doc,h;m=g.get(m);i=i||k.body;if(m){if(a&&!g.stdMode){m=m.getBoundingClientRect();j=g.boxModel?k.documentElement:k.body;f=g.getStyle(g.select("html")[0],"borderWidth");f=(f=="medium"||g.boxModel&&!g.isIE6)&&2||f;m.top+=g.win.self!=g.win.top?2:0;return{x:m.left+j.scrollLeft-f,y:m.top+j.scrollTop-f}}h=m;while(h&&h!=i&&h.nodeType){f+=h.offsetLeft||0;l+=h.offsetTop||0;h=h.offsetParent}h=m.parentNode;while(h&&h!=i&&h.nodeType){f-=h.scrollLeft||0;l-=h.scrollTop||0;h=h.parentNode}}return{x:f,y:l}},parseStyle:function(h){var i=this,j=i.settings,k={};if(!h){return k}function f(w,q,v){var o,u,m,n;o=k[w+"-top"+q];if(!o){return}u=k[w+"-right"+q];if(o!=u){return}m=k[w+"-bottom"+q];if(u!=m){return}n=k[w+"-left"+q];if(m!=n){return}k[v]=n;delete k[w+"-top"+q];delete k[w+"-right"+q];delete k[w+"-bottom"+q];delete k[w+"-left"+q]}function g(n,m,l,p){var o;o=k[m];if(!o){return}o=k[l];if(!o){return}o=k[p];if(!o){return}k[n]=k[m]+" "+k[l]+" "+k[p];delete k[m];delete k[l];delete k[p]}h=h.replace(/&(#?[a-z0-9]+);/g,"&$1_MCE_SEMI_");e(h.split(";"),function(m){var l,n=[];if(m){m=m.replace(/_MCE_SEMI_/g,";");m=m.replace(/url\([^\)]+\)/g,function(o){n.push(o);return"url("+n.length+")"});m=m.split(":");l=c.trim(m[1]);l=l.replace(/url\(([^\)]+)\)/g,function(p,o){return n[parseInt(o)-1]});l=l.replace(/rgb\([^\)]+\)/g,function(o){return i.toHex(o)});if(j.url_converter){l=l.replace(/url\([\'\"]?([^\)\'\"]+)[\'\"]?\)/g,function(o,p){return"url("+j.url_converter.call(j.url_converter_scope||i,i.decode(p),"style",null)+")"})}k[c.trim(m[0]).toLowerCase()]=l}});f("border","","border");f("border","-width","border-width");f("border","-color","border-color");f("border","-style","border-style");f("padding","","padding");f("margin","","margin");g("border","border-width","border-style","border-color");if(a){if(k.border=="medium none"){k.border=""}}return k},serializeStyle:function(g){var f="";e(g,function(i,h){if(h&&i){if(c.isGecko&&h.indexOf("-moz-")===0){return}switch(h){case"color":case"background-color":i=i.toLowerCase();break}f+=(f?" ":"")+h+": "+i+";"}});return f},loadCSS:function(f){var h=this,i=h.doc,g;if(!f){f=""}g=h.select("head")[0];e(f.split(","),function(j){var k;if(h.files[j]){return}h.files[j]=true;k=h.create("link",{rel:"stylesheet",href:c._addVer(j)});if(a&&i.documentMode){k.onload=function(){i.recalc();k.onload=null}}g.appendChild(k)})},addClass:function(f,g){return this.run(f,function(h){var i;if(!g){return 0}if(this.hasClass(h,g)){return h.className}i=this.removeClass(h,g);return h.className=(i!=""?(i+" "):"")+g})},removeClass:function(h,i){var f=this,g;return f.run(h,function(k){var j;if(f.hasClass(k,i)){if(!g){g=new RegExp("(^|\\s+)"+i+"(\\s+|$)","g")}j=k.className.replace(g," ");return k.className=c.trim(j!=" "?j:"")}return k.className})},hasClass:function(g,f){g=this.get(g);if(!g||!f){return false}return(" "+g.className+" ").indexOf(" "+f+" ")!==-1},show:function(f){return this.setStyle(f,"display","block")},hide:function(f){return this.setStyle(f,"display","none")},isHidden:function(f){f=this.get(f);return !f||f.style.display=="none"||this.getStyle(f,"display")=="none"},uniqueId:function(f){return(!f?"mce_":f)+(this.counter++)},setHTML:function(i,g){var f=this;return this.run(i,function(m){var h,k,j,q,l,h;g=f.processHTML(g);if(a){function o(){try{m.innerHTML=" "+g;m.removeChild(m.firstChild)}catch(n){while(m.firstChild){m.firstChild.removeNode()}h=f.create("div");h.innerHTML=" "+g;e(h.childNodes,function(r,p){if(p){m.appendChild(r)}})}}if(f.settings.fix_ie_paragraphs){g=g.replace(/<\/p>|
]+)><\/p>|
/gi,'
')}o();if(f.settings.fix_ie_paragraphs){j=m.getElementsByTagName("p");for(k=j.length-1,h=0;k>=0;k--){q=j[k];if(!q.hasChildNodes()){if(!q.mce_keep){h=1;break}q.removeAttribute("mce_keep")}}}if(h){g=g.replace(/]+)>|
/ig,'
');g=g.replace(/<\/p>/g,"
");o();if(f.settings.fix_ie_paragraphs){j=m.getElementsByTagName("DIV");for(k=j.length-1;k>=0;k--){q=j[k];if(q.mce_tmp){l=f.doc.createElement("p");q.cloneNode(false).outerHTML.replace(/([a-z0-9\-_]+)=/gi,function(p,n){var r;if(n!=="mce_tmp"){r=q.getAttribute(n);if(!r&&n==="class"){r=q.className}l.setAttribute(n,r)}});for(h=0;h|]+)>/gi,"<$1b$2>");j=j.replace(/<(\/?)em>|]+)>/gi,"<$1i$2>")}else{if(a){j=j.replace(/'/g,"'");j=j.replace(/\s+(disabled|checked|readonly|selected)\s*=\s*[\"\']?(false|0)[\"\']?/gi,"")}}j=j.replace(/]+)\/>| /gi," ");if(i.keep_values){if(/
+
+
+
+
+
+update($wpdb->users, array('user_activation_key' => $key), array('user_login' => $user_login));
}
- $message = __('Someone has asked to reset the password for the following site and username.') . "\r\n\r\n";
+ $message = __('Someone requested that the password be reset for the following account:') . "\r\n\r\n";
$message .= network_site_url() . "\r\n\r\n";
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
- $message .= __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . "\r\n\r\n";
- $message .= network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . "\r\n";
+ $message .= __('If this was a mistake, just ignore this email and nothing will happen.') . "\r\n\r\n";
+ $message .= __('To reset your password, visit the following address:') . "\r\n\r\n";
+ $message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . ">\r\n";
if ( is_multisite() )
$blogname = $GLOBALS['current_site']->site_name;
@@ -211,14 +238,16 @@ function retrieve_password() {
}
/**
- * Handles resetting the user's password.
+ * Retrieves a user row based on password reset key and login
*
* @uses $wpdb WordPress Database object
*
* @param string $key Hash to validate sending user's password
- * @return bool|WP_Error
+ * @param string $login The user login
+ *
+ * @return object|WP_Error
*/
-function reset_password($key, $login) {
+function check_password_reset_key($key, $login) {
global $wpdb;
$key = preg_replace('/[^a-z0-9]/i', '', $key);
@@ -230,38 +259,26 @@ function reset_password($key, $login) {
return new WP_Error('invalid_key', __('Invalid key'));
$user = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->users WHERE user_activation_key = %s AND user_login = %s", $key, $login));
+
if ( empty( $user ) )
return new WP_Error('invalid_key', __('Invalid key'));
- // Generate something random for a password...
- $new_pass = wp_generate_password();
+ return $user;
+}
+/**
+ * Handles resetting the user's password.
+ *
+ * @uses $wpdb WordPress Database object
+ *
+ * @param string $key Hash to validate sending user's password
+ */
+function reset_password($user, $new_pass) {
do_action('password_reset', $user, $new_pass);
wp_set_password($new_pass, $user->ID);
- update_user_option($user->ID, 'default_password_nag', true, true); //Set up the Password change nag.
- $message = sprintf(__('Username: %s'), $user->user_login) . "\r\n";
- $message .= sprintf(__('Password: %s'), $new_pass) . "\r\n";
- $message .= site_url('wp-login.php', 'login') . "\r\n";
-
- if ( is_multisite() )
- $blogname = $GLOBALS['current_site']->site_name;
- else
- // The blogname option is escaped with esc_html on the way into the database in sanitize_option
- // we want to reverse this for the plain text arena of emails.
- $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
-
- $title = sprintf( __('[%s] Your new password'), $blogname );
-
- $title = apply_filters('password_reset_title', $title);
- $message = apply_filters('password_reset_message', $message, $new_pass);
-
- if ( $message && !wp_mail($user->user_email, $title, $message) )
- wp_die( __('The e-mail could not be sent.') . " \n" . __('Possible reason: your host may have disabled the mail() function...') );
wp_password_change_notification($user);
-
- return true;
}
/**
@@ -304,7 +321,7 @@ function register_new_user( $user_login, $user_email ) {
if ( $errors->get_error_code() )
return $errors;
- $user_pass = wp_generate_password();
+ $user_pass = wp_generate_password( 12, false);
$user_id = wp_create_user( $sanitized_user_login, $user_pass, $user_email );
if ( ! $user_id ) {
$errors->add( 'registerfail', sprintf( __( 'ERROR : Couldn’t register you... please contact the webmaster !' ), get_option( 'admin_email' ) ) );
@@ -368,6 +385,7 @@ break;
case 'lostpassword' :
case 'retrievepassword' :
+
if ( $http_post ) {
$errors = retrieve_password();
if ( !is_wp_error($errors) ) {
@@ -381,7 +399,7 @@ case 'retrievepassword' :
$redirect_to = apply_filters( 'lostpassword_redirect', !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '' );
do_action('lost_password');
- login_header(__('Lost Password'), '' . __('Please enter your username or e-mail address. You will receive a new password via e-mail.') . '
', $errors);
+ login_header(__('Lost Password'), '' . __('Please enter your username or email address. You will receive a link to create a new password via email.') . '
', $errors);
$user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : '';
@@ -398,58 +416,87 @@ case 'retrievepassword' :
-
- |
-
-
+
+ |
-
-
-
-
-
-
-
' . __('Your password has been reset.') . ' ' . __('Log in') . ' ');
+ login_footer();
+ exit;
+ }
+ wp_enqueue_script('utils');
+ wp_enqueue_script('user-profile');
+
+ login_header(__('Reset Password'), '' . __('Enter your new password below.') . '
', $errors );
+
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+
+" title="">
-
-
-
-
-
-
-
has_cap('edit_posts') && ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url() ) )
- $redirect_to = admin_url('profile.php');
+
+ if ( ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url() ) ) {
+ // If the user doesn't belong to a blog, send them to user admin. If the user can't edit posts, send them to their profile.
+ if ( is_multisite() && !get_active_blog_for_user($user->id) )
+ $redirect_to = user_admin_url();
+ elseif ( is_multisite() && !$user->has_cap('read') )
+ $redirect_to = get_dashboard_url( $user->id );
+ elseif ( !$user->has_cap('edit_posts') )
+ $redirect_to = admin_url('profile.php');
+ }
wp_safe_redirect($redirect_to);
exit();
}
@@ -619,7 +664,7 @@ default:
-
+
@@ -629,11 +674,17 @@ function wp_attempt_focus(){
setTimeout( function(){ try{
d = document.getElementById('user_pass');
+d.value = '';
d = document.getElementById('user_login');
-
+get_error_code() ) { ?>
+if( d.value != '' )
d.value = '';
+
d.focus();
+d.select();
} catch(e){}
}, 200);
}
@@ -643,6 +694,7 @@ wp_attempt_focus();
if(typeof wpOnload=='function')wpOnload();
+
\ No newline at end of file
+exit;
+?>
diff --git a/wp-rdf.php b/wp-rdf.php
index 3c8f005f..cc94ad06 100644
--- a/wp-rdf.php
+++ b/wp-rdf.php
@@ -8,5 +8,5 @@
require( './wp-load.php' );
wp_redirect( get_bloginfo( 'rdf_url' ), 301 );
-
-?>
\ No newline at end of file
+exit;
+?>
diff --git a/wp-register.php b/wp-register.php
index caad4f2b..0b1a7697 100644
--- a/wp-register.php
+++ b/wp-register.php
@@ -10,6 +10,6 @@
*/
require('./wp-load.php');
-wp_redirect('wp-login.php?action=register');
-
-?>
\ No newline at end of file
+wp_redirect( site_url('wp-login.php?action=register') );
+exit;
+?>
diff --git a/wp-rss.php b/wp-rss.php
index 0ae63a23..af2427ad 100644
--- a/wp-rss.php
+++ b/wp-rss.php
@@ -8,5 +8,5 @@
require( './wp-load.php' );
wp_redirect( get_bloginfo( 'rss_url' ), 301 );
-
-?>
\ No newline at end of file
+exit;
+?>
diff --git a/wp-rss2.php b/wp-rss2.php
index 78daa6d2..de75c239 100644
--- a/wp-rss2.php
+++ b/wp-rss2.php
@@ -8,5 +8,5 @@
require( './wp-load.php' );
wp_redirect( get_bloginfo( 'rss2_url' ), 301 );
-
-?>
\ No newline at end of file
+exit;
+?>
diff --git a/wp-settings.php b/wp-settings.php
index 473f2c6c..2cd12c1c 100644
--- a/wp-settings.php
+++ b/wp-settings.php
@@ -35,7 +35,7 @@ if ( function_exists( 'date_default_timezone_set' ) )
wp_unregister_GLOBALS();
// Ensure these global variables do not exist so they do not interfere with WordPress.
-unset( $wp_filter, $cache_lastcommentmodified, $cache_lastpostdate );
+unset( $wp_filter, $cache_lastcommentmodified );
// Standardize $_SERVER variables across setups.
wp_fix_server_vars();
@@ -65,9 +65,11 @@ wp_set_lang_dir();
// Load early WordPress files.
require( ABSPATH . WPINC . '/compat.php' );
require( ABSPATH . WPINC . '/functions.php' );
-require( ABSPATH . WPINC . '/classes.php' );
+require( ABSPATH . WPINC . '/class-wp.php' );
+require( ABSPATH . WPINC . '/class-wp-error.php' );
+require( ABSPATH . WPINC . '/plugin.php' );
-// Include the wpdb class, or a db.php database drop-in if present.
+// Include the wpdb class and, if present, a db.php database drop-in.
require_wp_db();
// Set the database table prefix and the format specifiers for database table columns.
@@ -77,7 +79,6 @@ wp_set_wpdb_vars();
wp_start_object_cache();
// Load early WordPress files.
-require( ABSPATH . WPINC . '/plugin.php' );
require( ABSPATH . WPINC . '/default-filters.php' );
require( ABSPATH . WPINC . '/pomo/mo.php' );
@@ -100,6 +101,8 @@ require( ABSPATH . WPINC . '/l10n.php' );
wp_not_installed();
// Load most of WordPress.
+require( ABSPATH . WPINC . '/class-wp-walker.php' );
+require( ABSPATH . WPINC . '/class-wp-ajax-response.php' );
require( ABSPATH . WPINC . '/formatting.php' );
require( ABSPATH . WPINC . '/capabilities.php' );
require( ABSPATH . WPINC . '/query.php' );
@@ -133,6 +136,7 @@ require( ABSPATH . WPINC . '/class-http.php' );
require( ABSPATH . WPINC . '/widgets.php' );
require( ABSPATH . WPINC . '/nav-menu.php' );
require( ABSPATH . WPINC . '/nav-menu-template.php' );
+require( ABSPATH . WPINC . '/admin-bar.php' );
// Load multisite-specific files.
if ( is_multisite() ) {
@@ -151,6 +155,14 @@ foreach ( wp_get_mu_plugins() as $mu_plugin ) {
}
unset( $mu_plugin );
+// Load network activated plugins.
+if ( is_multisite() ) {
+ foreach( wp_get_active_network_plugins() as $network_plugin ) {
+ include_once( $network_plugin );
+ }
+ unset( $network_plugin );
+}
+
do_action( 'muplugins_loaded' );
if ( is_multisite() )
@@ -170,6 +182,9 @@ require( ABSPATH . WPINC . '/vars.php' );
create_initial_taxonomies();
create_initial_post_types();
+// Register the default theme directory root
+register_theme_directory( get_theme_root() );
+
// Load active plugins.
foreach ( wp_get_active_and_valid_plugins() as $plugin )
include_once( $plugin );
diff --git a/wp-signup.php b/wp-signup.php
index 28b561a9..c2ab566b 100644
--- a/wp-signup.php
+++ b/wp-signup.php
@@ -6,7 +6,6 @@ require( dirname(__FILE__) . '/wp-load.php' );
add_action( 'wp_head', 'signuppageheaders' ) ;
require( './wp-blog-header.php' );
-require_once( ABSPATH . WPINC . '/registration.php' );
if ( is_array( get_site_option( 'illegal_names' )) && isset( $_GET[ 'new' ] ) && in_array( $_GET[ 'new' ], get_site_option( 'illegal_names' ) ) == true ) {
wp_redirect( network_home_url() );
@@ -23,7 +22,7 @@ function signuppageheaders() {
}
if ( !is_multisite() ) {
- wp_redirect( get_option( 'siteurl' ) . "/wp-login.php?action=register" );
+ wp_redirect( site_url('wp-login.php?action=register') );
die();
}
@@ -81,12 +80,11 @@ function show_blog_form($blogname = '', $blog_title = '', $errors = '') {
echo '.' . ( $site_domain = preg_replace( '|^www\.|', '', $current_site->domain ) ) . ' ';
if ( !is_user_logged_in() ) {
- print '(' . __( 'Your address will be ' );
if ( !is_subdomain_install() )
- print $current_site->domain . $current_site->path . __( 'sitename' );
+ $site = $current_site->domain . $current_site->path . __( 'sitename' );
else
- print __( 'domain.' ) . $site_domain . $current_site->path;
- echo '. ) ' . __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed, so choose carefully!' ) . '';
+ $site = __( 'domain' ) . '.' . $site_domain . $current_site->path;
+ echo '(' . sprintf( __('Your address will be %s.'), $site ) . ' ) ' . __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed, so choose carefully!' ) . '
';
}
// Blog Title
@@ -393,7 +391,7 @@ $i18n_signup['blog'] = _x('blog', 'Multisite active signup type');
$i18n_signup['user'] = _x('user', 'Multisite active signup type');
if ( is_super_admin() )
- echo '' . sprintf( __( 'Greetings Site Administrator! You are currently allowing “%s” registrations. To change or disable registration go to your
Options page .' ), $i18n_signup[$active_signup], esc_url( network_admin_url( 'ms-options.php' ) ) ) . '
';
+ echo '' . sprintf( __( 'Greetings Site Administrator! You are currently allowing “%s” registrations. To change or disable registration go to your
Options page .' ), $i18n_signup[$active_signup], esc_url( network_admin_url( 'settings.php' ) ) ) . '
';
$newblogname = isset($_GET['new']) ? strtolower(preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'])) : null;
diff --git a/xmlrpc.php b/xmlrpc.php
index 5ec072b0..85171776 100644
--- a/xmlrpc.php
+++ b/xmlrpc.php
@@ -2,7 +2,6 @@
/**
* XML-RPC protocol support for WordPress
*
- * @license GPL v2 <./license.txt>
* @package WordPress
*/
@@ -53,6 +52,7 @@ exit;
include_once(ABSPATH . 'wp-admin/includes/admin.php');
include_once(ABSPATH . WPINC . '/class-IXR.php');
+include_once(ABSPATH . WPINC . '/class-wp-xmlrpc-server.php');
// Turn off all warnings and errors.
// error_reporting(0);
@@ -98,3278 +98,10 @@ function logIO($io,$msg) {
if ( isset($HTTP_RAW_POST_DATA) )
logIO("I", $HTTP_RAW_POST_DATA);
-/**
- * WordPress XMLRPC server implementation.
- *
- * Implements compatability for Blogger API, MetaWeblog API, MovableType, and
- * pingback. Additional WordPress API for managing comments, pages, posts,
- * options, etc.
- *
- * Since WordPress 2.6.0, WordPress XMLRPC server can be disabled in the
- * administration panels.
- *
- * @package WordPress
- * @subpackage Publishing
- * @since 1.5.0
- */
-class wp_xmlrpc_server extends IXR_Server {
-
- /**
- * Register all of the XMLRPC methods that XMLRPC server understands.
- *
- * PHP4 constructor and sets up server and method property. Passes XMLRPC
- * methods through the 'xmlrpc_methods' filter to allow plugins to extend
- * or replace XMLRPC methods.
- *
- * @since 1.5.0
- *
- * @return wp_xmlrpc_server
- */
- function wp_xmlrpc_server() {
- $this->methods = array(
- // WordPress API
- 'wp.getUsersBlogs' => 'this:wp_getUsersBlogs',
- 'wp.getPage' => 'this:wp_getPage',
- 'wp.getPages' => 'this:wp_getPages',
- 'wp.newPage' => 'this:wp_newPage',
- 'wp.deletePage' => 'this:wp_deletePage',
- 'wp.editPage' => 'this:wp_editPage',
- 'wp.getPageList' => 'this:wp_getPageList',
- 'wp.getAuthors' => 'this:wp_getAuthors',
- 'wp.getCategories' => 'this:mw_getCategories', // Alias
- 'wp.getTags' => 'this:wp_getTags',
- 'wp.newCategory' => 'this:wp_newCategory',
- 'wp.deleteCategory' => 'this:wp_deleteCategory',
- 'wp.suggestCategories' => 'this:wp_suggestCategories',
- 'wp.uploadFile' => 'this:mw_newMediaObject', // Alias
- 'wp.getCommentCount' => 'this:wp_getCommentCount',
- 'wp.getPostStatusList' => 'this:wp_getPostStatusList',
- 'wp.getPageStatusList' => 'this:wp_getPageStatusList',
- 'wp.getPageTemplates' => 'this:wp_getPageTemplates',
- 'wp.getOptions' => 'this:wp_getOptions',
- 'wp.setOptions' => 'this:wp_setOptions',
- 'wp.getComment' => 'this:wp_getComment',
- 'wp.getComments' => 'this:wp_getComments',
- 'wp.deleteComment' => 'this:wp_deleteComment',
- 'wp.editComment' => 'this:wp_editComment',
- 'wp.newComment' => 'this:wp_newComment',
- 'wp.getCommentStatusList' => 'this:wp_getCommentStatusList',
-
- // Blogger API
- 'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs',
- 'blogger.getUserInfo' => 'this:blogger_getUserInfo',
- 'blogger.getPost' => 'this:blogger_getPost',
- 'blogger.getRecentPosts' => 'this:blogger_getRecentPosts',
- 'blogger.getTemplate' => 'this:blogger_getTemplate',
- 'blogger.setTemplate' => 'this:blogger_setTemplate',
- 'blogger.newPost' => 'this:blogger_newPost',
- 'blogger.editPost' => 'this:blogger_editPost',
- 'blogger.deletePost' => 'this:blogger_deletePost',
-
- // MetaWeblog API (with MT extensions to structs)
- 'metaWeblog.newPost' => 'this:mw_newPost',
- 'metaWeblog.editPost' => 'this:mw_editPost',
- 'metaWeblog.getPost' => 'this:mw_getPost',
- 'metaWeblog.getRecentPosts' => 'this:mw_getRecentPosts',
- 'metaWeblog.getCategories' => 'this:mw_getCategories',
- 'metaWeblog.newMediaObject' => 'this:mw_newMediaObject',
-
- // MetaWeblog API aliases for Blogger API
- // see http://www.xmlrpc.com/stories/storyReader$2460
- 'metaWeblog.deletePost' => 'this:blogger_deletePost',
- 'metaWeblog.getTemplate' => 'this:blogger_getTemplate',
- 'metaWeblog.setTemplate' => 'this:blogger_setTemplate',
- 'metaWeblog.getUsersBlogs' => 'this:blogger_getUsersBlogs',
-
- // MovableType API
- 'mt.getCategoryList' => 'this:mt_getCategoryList',
- 'mt.getRecentPostTitles' => 'this:mt_getRecentPostTitles',
- 'mt.getPostCategories' => 'this:mt_getPostCategories',
- 'mt.setPostCategories' => 'this:mt_setPostCategories',
- 'mt.supportedMethods' => 'this:mt_supportedMethods',
- 'mt.supportedTextFilters' => 'this:mt_supportedTextFilters',
- 'mt.getTrackbackPings' => 'this:mt_getTrackbackPings',
- 'mt.publishPost' => 'this:mt_publishPost',
-
- // PingBack
- 'pingback.ping' => 'this:pingback_ping',
- 'pingback.extensions.getPingbacks' => 'this:pingback_extensions_getPingbacks',
-
- 'demo.sayHello' => 'this:sayHello',
- 'demo.addTwoNumbers' => 'this:addTwoNumbers'
- );
-
- $this->initialise_blog_option_info( );
- $this->methods = apply_filters('xmlrpc_methods', $this->methods);
- }
-
- function serve_request() {
- $this->IXR_Server($this->methods);
- }
-
- /**
- * Test XMLRPC API by saying, "Hello!" to client.
- *
- * @since 1.5.0
- *
- * @param array $args Method Parameters.
- * @return string
- */
- function sayHello($args) {
- return 'Hello!';
- }
-
- /**
- * Test XMLRPC API by adding two numbers for client.
- *
- * @since 1.5.0
- *
- * @param array $args Method Parameters.
- * @return int
- */
- function addTwoNumbers($args) {
- $number1 = $args[0];
- $number2 = $args[1];
- return $number1 + $number2;
- }
-
- /**
- * Check user's credentials.
- *
- * @since 1.5.0
- *
- * @param string $user_login User's username.
- * @param string $user_pass User's password.
- * @return bool Whether authentication passed.
- * @deprecated use wp_xmlrpc_server::login
- * @see wp_xmlrpc_server::login
- */
- function login_pass_ok($user_login, $user_pass) {
- if ( !get_option( 'enable_xmlrpc' ) ) {
- $this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this site. An admin user can enable them at %s'), admin_url('options-writing.php') ) );
- return false;
- }
-
- if (!user_pass_ok($user_login, $user_pass)) {
- $this->error = new IXR_Error(403, __('Bad login/pass combination.'));
- return false;
- }
- return true;
- }
-
- /**
- * Log user in.
- *
- * @since 2.8
- *
- * @param string $username User's username.
- * @param string $password User's password.
- * @return mixed WP_User object if authentication passed, false otherwise
- */
- function login($username, $password) {
- if ( !get_option( 'enable_xmlrpc' ) ) {
- $this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this site. An admin user can enable them at %s'), admin_url('options-writing.php') ) );
- return false;
- }
-
- $user = wp_authenticate($username, $password);
-
- if (is_wp_error($user)) {
- $this->error = new IXR_Error(403, __('Bad login/pass combination.'));
- return false;
- }
-
- wp_set_current_user( $user->ID );
- return $user;
- }
-
- /**
- * Sanitize string or array of strings for database.
- *
- * @since 1.5.2
- *
- * @param string|array $array Sanitize single string or array of strings.
- * @return string|array Type matches $array and sanitized for the database.
- */
- function escape(&$array) {
- global $wpdb;
-
- if (!is_array($array)) {
- return($wpdb->escape($array));
- } else {
- foreach ( (array) $array as $k => $v ) {
- if ( is_array($v) ) {
- $this->escape($array[$k]);
- } else if ( is_object($v) ) {
- //skip
- } else {
- $array[$k] = $wpdb->escape($v);
- }
- }
- }
- }
-
- /**
- * Retrieve custom fields for post.
- *
- * @since 2.5.0
- *
- * @param int $post_id Post ID.
- * @return array Custom fields, if exist.
- */
- function get_custom_fields($post_id) {
- $post_id = (int) $post_id;
-
- $custom_fields = array();
-
- foreach ( (array) has_meta($post_id) as $meta ) {
- // Don't expose protected fields.
- if ( strpos($meta['meta_key'], '_wp_') === 0 ) {
- continue;
- }
-
- $custom_fields[] = array(
- "id" => $meta['meta_id'],
- "key" => $meta['meta_key'],
- "value" => $meta['meta_value']
- );
- }
-
- return $custom_fields;
- }
-
- /**
- * Set custom fields for post.
- *
- * @since 2.5.0
- *
- * @param int $post_id Post ID.
- * @param array $fields Custom fields.
- */
- function set_custom_fields($post_id, $fields) {
- $post_id = (int) $post_id;
-
- foreach ( (array) $fields as $meta ) {
- if ( isset($meta['id']) ) {
- $meta['id'] = (int) $meta['id'];
-
- if ( isset($meta['key']) ) {
- update_meta($meta['id'], $meta['key'], $meta['value']);
- }
- else {
- delete_meta($meta['id']);
- }
- }
- else {
- $_POST['metakeyinput'] = $meta['key'];
- $_POST['metavalue'] = $meta['value'];
- add_meta($post_id);
- }
- }
- }
-
- /**
- * Set up blog options property.
- *
- * Passes property through 'xmlrpc_blog_options' filter.
- *
- * @since 2.6.0
- */
- function initialise_blog_option_info( ) {
- global $wp_version;
-
- $this->blog_options = array(
- // Read only options
- 'software_name' => array(
- 'desc' => __( 'Software Name' ),
- 'readonly' => true,
- 'value' => 'WordPress'
- ),
- 'software_version' => array(
- 'desc' => __( 'Software Version' ),
- 'readonly' => true,
- 'value' => $wp_version
- ),
- 'blog_url' => array(
- 'desc' => __( 'Site URL' ),
- 'readonly' => true,
- 'option' => 'siteurl'
- ),
-
- // Updatable options
- 'time_zone' => array(
- 'desc' => __( 'Time Zone' ),
- 'readonly' => false,
- 'option' => 'gmt_offset'
- ),
- 'blog_title' => array(
- 'desc' => __( 'Site Title' ),
- 'readonly' => false,
- 'option' => 'blogname'
- ),
- 'blog_tagline' => array(
- 'desc' => __( 'Site Tagline' ),
- 'readonly' => false,
- 'option' => 'blogdescription'
- ),
- 'date_format' => array(
- 'desc' => __( 'Date Format' ),
- 'readonly' => false,
- 'option' => 'date_format'
- ),
- 'time_format' => array(
- 'desc' => __( 'Time Format' ),
- 'readonly' => false,
- 'option' => 'time_format'
- ),
- 'users_can_register' => array(
- 'desc' => __( 'Allow new users to sign up' ),
- 'readonly' => false,
- 'option' => 'users_can_register'
- )
- );
-
- $this->blog_options = apply_filters( 'xmlrpc_blog_options', $this->blog_options );
- }
-
- /**
- * Retrieve the blogs of the user.
- *
- * @since 2.6.0
- *
- * @param array $args Method parameters.
- * @return array
- */
- function wp_getUsersBlogs( $args ) {
- global $current_site;
- // If this isn't on WPMU then just use blogger_getUsersBlogs
- if ( !is_multisite() ) {
- array_unshift( $args, 1 );
- return $this->blogger_getUsersBlogs( $args );
- }
-
- $this->escape( $args );
-
- $username = $args[0];
- $password = $args[1];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
-
- do_action( 'xmlrpc_call', 'wp.getUsersBlogs' );
-
- $blogs = (array) get_blogs_of_user( $user->ID );
- $struct = array( );
-
- foreach ( $blogs as $blog ) {
- // Don't include blogs that aren't hosted at this site
- if ( $blog->site_id != $current_site->id )
- continue;
-
- $blog_id = $blog->userblog_id;
- switch_to_blog($blog_id);
- $is_admin = current_user_can('manage_options');
-
- $struct[] = array(
- 'isAdmin' => $is_admin,
- 'url' => get_option( 'home' ) . '/',
- 'blogid' => $blog_id,
- 'blogName' => get_option( 'blogname' ),
- 'xmlrpc' => site_url( 'xmlrpc.php' )
- );
-
- restore_current_blog( );
- }
-
- return $struct;
- }
-
- /**
- * Retrieve page.
- *
- * @since 2.2.0
- *
- * @param array $args Method parameters.
- * @return array
- */
- function wp_getPage($args) {
- $this->escape($args);
-
- $blog_id = (int) $args[0];
- $page_id = (int) $args[1];
- $username = $args[2];
- $password = $args[3];
-
- if ( !$user = $this->login($username, $password) ) {
- return $this->error;
- }
-
- if ( !current_user_can( 'edit_page', $page_id ) )
- return new IXR_Error( 401, __( 'Sorry, you cannot edit this page.' ) );
-
- do_action('xmlrpc_call', 'wp.getPage');
-
- // Lookup page info.
- $page = get_page($page_id);
-
- // If we found the page then format the data.
- if ( $page->ID && ($page->post_type == "page") ) {
- // Get all of the page content and link.
- $full_page = get_extended($page->post_content);
- $link = post_permalink($page->ID);
-
- // Get info the page parent if there is one.
- $parent_title = "";
- if ( !empty($page->post_parent) ) {
- $parent = get_page($page->post_parent);
- $parent_title = $parent->post_title;
- }
-
- // Determine comment and ping settings.
- $allow_comments = comments_open($page->ID) ? 1 : 0;
- $allow_pings = pings_open($page->ID) ? 1 : 0;
-
- // Format page date.
- $page_date = mysql2date("Ymd\TH:i:s", $page->post_date, false);
- $page_date_gmt = mysql2date("Ymd\TH:i:s", $page->post_date_gmt, false);
-
- // For drafts use the GMT version of the date
- if ( $page->post_status == 'draft' )
- $page_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $page->post_date ), 'Ymd\TH:i:s' );
-
- // Pull the categories info together.
- $categories = array();
- foreach ( wp_get_post_categories($page->ID) as $cat_id ) {
- $categories[] = get_cat_name($cat_id);
- }
-
- // Get the author info.
- $author = get_userdata($page->post_author);
-
- $page_template = get_post_meta( $page->ID, '_wp_page_template', true );
- if ( empty( $page_template ) )
- $page_template = 'default';
-
- $page_struct = array(
- "dateCreated" => new IXR_Date($page_date),
- "userid" => $page->post_author,
- "page_id" => $page->ID,
- "page_status" => $page->post_status,
- "description" => $full_page["main"],
- "title" => $page->post_title,
- "link" => $link,
- "permaLink" => $link,
- "categories" => $categories,
- "excerpt" => $page->post_excerpt,
- "text_more" => $full_page["extended"],
- "mt_allow_comments" => $allow_comments,
- "mt_allow_pings" => $allow_pings,
- "wp_slug" => $page->post_name,
- "wp_password" => $page->post_password,
- "wp_author" => $author->display_name,
- "wp_page_parent_id" => $page->post_parent,
- "wp_page_parent_title" => $parent_title,
- "wp_page_order" => $page->menu_order,
- "wp_author_id" => $author->ID,
- "wp_author_display_name" => $author->display_name,
- "date_created_gmt" => new IXR_Date($page_date_gmt),
- "custom_fields" => $this->get_custom_fields($page_id),
- "wp_page_template" => $page_template
- );
-
- return($page_struct);
- }
- // If the page doesn't exist indicate that.
- else {
- return(new IXR_Error(404, __("Sorry, no such page.")));
- }
- }
-
- /**
- * Retrieve Pages.
- *
- * @since 2.2.0
- *
- * @param array $args Method parameters.
- * @return array
- */
- function wp_getPages($args) {
- $this->escape($args);
-
- $blog_id = (int) $args[0];
- $username = $args[1];
- $password = $args[2];
- $num_pages = isset($args[3]) ? (int) $args[3] : 10;
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- if ( !current_user_can( 'edit_pages' ) )
- return new IXR_Error( 401, __( 'Sorry, you cannot edit pages.' ) );
-
- do_action('xmlrpc_call', 'wp.getPages');
-
- $pages = get_posts( array('post_type' => 'page', 'post_status' => 'any', 'numberposts' => $num_pages) );
- $num_pages = count($pages);
-
- // If we have pages, put together their info.
- if ( $num_pages >= 1 ) {
- $pages_struct = array();
-
- for ( $i = 0; $i < $num_pages; $i++ ) {
- $page = wp_xmlrpc_server::wp_getPage(array(
- $blog_id, $pages[$i]->ID, $username, $password
- ));
- $pages_struct[] = $page;
- }
-
- return($pages_struct);
- }
- // If no pages were found return an error.
- else {
- return(array());
- }
- }
-
- /**
- * Create new page.
- *
- * @since 2.2.0
- *
- * @param array $args Method parameters.
- * @return unknown
- */
- function wp_newPage($args) {
- // Items not escaped here will be escaped in newPost.
- $username = $this->escape($args[1]);
- $password = $this->escape($args[2]);
- $page = $args[3];
- $publish = $args[4];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- do_action('xmlrpc_call', 'wp.newPage');
-
- // Make sure the user is allowed to add new pages.
- if ( !current_user_can("publish_pages") )
- return(new IXR_Error(401, __("Sorry, you cannot add new pages.")));
-
- // Mark this as content for a page.
- $args[3]["post_type"] = "page";
-
- // Let mw_newPost do all of the heavy lifting.
- return($this->mw_newPost($args));
- }
-
- /**
- * Delete page.
- *
- * @since 2.2.0
- *
- * @param array $args Method parameters.
- * @return bool True, if success.
- */
- function wp_deletePage($args) {
- $this->escape($args);
-
- $blog_id = (int) $args[0];
- $username = $args[1];
- $password = $args[2];
- $page_id = (int) $args[3];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- do_action('xmlrpc_call', 'wp.deletePage');
-
- // Get the current page based on the page_id and
- // make sure it is a page and not a post.
- $actual_page = wp_get_single_post($page_id, ARRAY_A);
- if ( !$actual_page || ($actual_page["post_type"] != "page") )
- return(new IXR_Error(404, __("Sorry, no such page.")));
-
- // Make sure the user can delete pages.
- if ( !current_user_can("delete_page", $page_id) )
- return(new IXR_Error(401, __("Sorry, you do not have the right to delete this page.")));
-
- // Attempt to delete the page.
- $result = wp_delete_post($page_id);
- if ( !$result )
- return(new IXR_Error(500, __("Failed to delete the page.")));
-
- return(true);
- }
-
- /**
- * Edit page.
- *
- * @since 2.2.0
- *
- * @param array $args Method parameters.
- * @return unknown
- */
- function wp_editPage($args) {
- // Items not escaped here will be escaped in editPost.
- $blog_id = (int) $args[0];
- $page_id = (int) $this->escape($args[1]);
- $username = $this->escape($args[2]);
- $password = $this->escape($args[3]);
- $content = $args[4];
- $publish = $args[5];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- do_action('xmlrpc_call', 'wp.editPage');
-
- // Get the page data and make sure it is a page.
- $actual_page = wp_get_single_post($page_id, ARRAY_A);
- if ( !$actual_page || ($actual_page["post_type"] != "page") )
- return(new IXR_Error(404, __("Sorry, no such page.")));
-
- // Make sure the user is allowed to edit pages.
- if ( !current_user_can("edit_page", $page_id) )
- return(new IXR_Error(401, __("Sorry, you do not have the right to edit this page.")));
-
- // Mark this as content for a page.
- $content["post_type"] = "page";
-
- // Arrange args in the way mw_editPost understands.
- $args = array(
- $page_id,
- $username,
- $password,
- $content,
- $publish
- );
-
- // Let mw_editPost do all of the heavy lifting.
- return($this->mw_editPost($args));
- }
-
- /**
- * Retrieve page list.
- *
- * @since 2.2.0
- *
- * @param array $args Method parameters.
- * @return unknown
- */
- function wp_getPageList($args) {
- global $wpdb;
-
- $this->escape($args);
-
- $blog_id = (int) $args[0];
- $username = $args[1];
- $password = $args[2];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- if ( !current_user_can( 'edit_pages' ) )
- return new IXR_Error( 401, __( 'Sorry, you cannot edit pages.' ) );
-
- do_action('xmlrpc_call', 'wp.getPageList');
-
- // Get list of pages ids and titles
- $page_list = $wpdb->get_results("
- SELECT ID page_id,
- post_title page_title,
- post_parent page_parent_id,
- post_date_gmt,
- post_date,
- post_status
- FROM {$wpdb->posts}
- WHERE post_type = 'page'
- ORDER BY ID
- ");
-
- // The date needs to be formated properly.
- $num_pages = count($page_list);
- for ( $i = 0; $i < $num_pages; $i++ ) {
- $post_date = mysql2date("Ymd\TH:i:s", $page_list[$i]->post_date, false);
- $post_date_gmt = mysql2date("Ymd\TH:i:s", $page_list[$i]->post_date_gmt, false);
-
- $page_list[$i]->dateCreated = new IXR_Date($post_date);
- $page_list[$i]->date_created_gmt = new IXR_Date($post_date_gmt);
-
- // For drafts use the GMT version of the date
- if ( $page_list[$i]->post_status == 'draft' ) {
- $page_list[$i]->date_created_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $page_list[$i]->post_date ), 'Ymd\TH:i:s' );
- $page_list[$i]->date_created_gmt = new IXR_Date( $page_list[$i]->date_created_gmt );
- }
-
- unset($page_list[$i]->post_date_gmt);
- unset($page_list[$i]->post_date);
- unset($page_list[$i]->post_status);
- }
-
- return($page_list);
- }
-
- /**
- * Retrieve authors list.
- *
- * @since 2.2.0
- *
- * @param array $args Method parameters.
- * @return array
- */
- function wp_getAuthors($args) {
-
- $this->escape($args);
-
- $blog_id = (int) $args[0];
- $username = $args[1];
- $password = $args[2];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- if ( !current_user_can("edit_posts") )
- return(new IXR_Error(401, __("Sorry, you cannot edit posts on this site.")));
-
- do_action('xmlrpc_call', 'wp.getAuthors');
-
- $authors = array();
- foreach ( (array) get_users_of_blog() as $row ) {
- $authors[] = array(
- "user_id" => $row->user_id,
- "user_login" => $row->user_login,
- "display_name" => $row->display_name
- );
- }
-
- return($authors);
- }
-
- /**
- * Get list of all tags
- *
- * @since 2.7
- *
- * @param array $args Method parameters.
- * @return array
- */
- function wp_getTags( $args ) {
- $this->escape( $args );
-
- $blog_id = (int) $args[0];
- $username = $args[1];
- $password = $args[2];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- if ( !current_user_can( 'edit_posts' ) )
- return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view tags.' ) );
-
- do_action( 'xmlrpc_call', 'wp.getKeywords' );
-
- $tags = array( );
-
- if ( $all_tags = get_tags() ) {
- foreach( (array) $all_tags as $tag ) {
- $struct['tag_id'] = $tag->term_id;
- $struct['name'] = $tag->name;
- $struct['count'] = $tag->count;
- $struct['slug'] = $tag->slug;
- $struct['html_url'] = esc_html( get_tag_link( $tag->term_id ) );
- $struct['rss_url'] = esc_html( get_tag_feed_link( $tag->term_id ) );
-
- $tags[] = $struct;
- }
- }
-
- return $tags;
- }
-
- /**
- * Create new category.
- *
- * @since 2.2.0
- *
- * @param array $args Method parameters.
- * @return int Category ID.
- */
- function wp_newCategory($args) {
- $this->escape($args);
-
- $blog_id = (int) $args[0];
- $username = $args[1];
- $password = $args[2];
- $category = $args[3];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- do_action('xmlrpc_call', 'wp.newCategory');
-
- // Make sure the user is allowed to add a category.
- if ( !current_user_can("manage_categories") )
- return(new IXR_Error(401, __("Sorry, you do not have the right to add a category.")));
-
- // If no slug was provided make it empty so that
- // WordPress will generate one.
- if ( empty($category["slug"]) )
- $category["slug"] = "";
-
- // If no parent_id was provided make it empty
- // so that it will be a top level page (no parent).
- if ( !isset($category["parent_id"]) )
- $category["parent_id"] = "";
-
- // If no description was provided make it empty.
- if ( empty($category["description"]) )
- $category["description"] = "";
-
- $new_category = array(
- "cat_name" => $category["name"],
- "category_nicename" => $category["slug"],
- "category_parent" => $category["parent_id"],
- "category_description" => $category["description"]
- );
-
- $cat_id = wp_insert_category($new_category, true);
- if ( is_wp_error( $cat_id ) ) {
- if ( 'term_exists' == $cat_id->get_error_code() )
- return (int) $cat_id->get_error_data();
- else
- return(new IXR_Error(500, __("Sorry, the new category failed.")));
- } elseif ( ! $cat_id ) {
- return(new IXR_Error(500, __("Sorry, the new category failed.")));
- }
-
- return($cat_id);
- }
-
- /**
- * Remove category.
- *
- * @since 2.5.0
- *
- * @param array $args Method parameters.
- * @return mixed See {@link wp_delete_category()} for return info.
- */
- function wp_deleteCategory($args) {
- $this->escape($args);
-
- $blog_id = (int) $args[0];
- $username = $args[1];
- $password = $args[2];
- $category_id = (int) $args[3];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- do_action('xmlrpc_call', 'wp.deleteCategory');
-
- if ( !current_user_can("manage_categories") )
- return new IXR_Error( 401, __( "Sorry, you do not have the right to delete a category." ) );
-
- return wp_delete_category( $category_id );
- }
-
- /**
- * Retrieve category list.
- *
- * @since 2.2.0
- *
- * @param array $args Method parameters.
- * @return array
- */
- function wp_suggestCategories($args) {
- $this->escape($args);
-
- $blog_id = (int) $args[0];
- $username = $args[1];
- $password = $args[2];
- $category = $args[3];
- $max_results = (int) $args[4];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- if ( !current_user_can( 'edit_posts' ) )
- return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts to this site in order to view categories.' ) );
-
- do_action('xmlrpc_call', 'wp.suggestCategories');
-
- $category_suggestions = array();
- $args = array('get' => 'all', 'number' => $max_results, 'name__like' => $category);
- foreach ( (array) get_categories($args) as $cat ) {
- $category_suggestions[] = array(
- "category_id" => $cat->cat_ID,
- "category_name" => $cat->cat_name
- );
- }
-
- return($category_suggestions);
- }
-
- /**
- * Retrieve comment.
- *
- * @since 2.7.0
- *
- * @param array $args Method parameters.
- * @return array
- */
- function wp_getComment($args) {
- $this->escape($args);
-
- $blog_id = (int) $args[0];
- $username = $args[1];
- $password = $args[2];
- $comment_id = (int) $args[3];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- if ( !current_user_can( 'moderate_comments' ) )
- return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
-
- do_action('xmlrpc_call', 'wp.getComment');
-
- if ( ! $comment = get_comment($comment_id) )
- return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
-
- // Format page date.
- $comment_date = mysql2date("Ymd\TH:i:s", $comment->comment_date, false);
- $comment_date_gmt = mysql2date("Ymd\TH:i:s", $comment->comment_date_gmt, false);
-
- if ( '0' == $comment->comment_approved )
- $comment_status = 'hold';
- else if ( 'spam' == $comment->comment_approved )
- $comment_status = 'spam';
- else if ( '1' == $comment->comment_approved )
- $comment_status = 'approve';
- else
- $comment_status = $comment->comment_approved;
-
- $link = get_comment_link($comment);
-
- $comment_struct = array(
- "date_created_gmt" => new IXR_Date($comment_date_gmt),
- "user_id" => $comment->user_id,
- "comment_id" => $comment->comment_ID,
- "parent" => $comment->comment_parent,
- "status" => $comment_status,
- "content" => $comment->comment_content,
- "link" => $link,
- "post_id" => $comment->comment_post_ID,
- "post_title" => get_the_title($comment->comment_post_ID),
- "author" => $comment->comment_author,
- "author_url" => $comment->comment_author_url,
- "author_email" => $comment->comment_author_email,
- "author_ip" => $comment->comment_author_IP,
- "type" => $comment->comment_type,
- );
-
- return $comment_struct;
- }
-
- /**
- * Retrieve comments.
- *
- * @since 2.7.0
- *
- * @param array $args Method parameters.
- * @return array
- */
- function wp_getComments($args) {
- $raw_args = $args;
- $this->escape($args);
-
- $blog_id = (int) $args[0];
- $username = $args[1];
- $password = $args[2];
- $struct = $args[3];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- if ( !current_user_can( 'moderate_comments' ) )
- return new IXR_Error( 401, __( 'Sorry, you cannot edit comments.' ) );
-
- do_action('xmlrpc_call', 'wp.getComments');
-
- if ( isset($struct['status']) )
- $status = $struct['status'];
- else
- $status = '';
-
- $post_id = '';
- if ( isset($struct['post_id']) )
- $post_id = absint($struct['post_id']);
-
- $offset = 0;
- if ( isset($struct['offset']) )
- $offset = absint($struct['offset']);
-
- $number = 10;
- if ( isset($struct['number']) )
- $number = absint($struct['number']);
-
- $comments = get_comments( array('status' => $status, 'post_id' => $post_id, 'offset' => $offset, 'number' => $number ) );
- $num_comments = count($comments);
-
- if ( ! $num_comments )
- return array();
-
- $comments_struct = array();
-
- for ( $i = 0; $i < $num_comments; $i++ ) {
- $comment = wp_xmlrpc_server::wp_getComment(array(
- $raw_args[0], $raw_args[1], $raw_args[2], $comments[$i]->comment_ID,
- ));
- $comments_struct[] = $comment;
- }
-
- return $comments_struct;
- }
-
- /**
- * Remove comment.
- *
- * @since 2.7.0
- *
- * @param array $args Method parameters.
- * @return mixed {@link wp_delete_comment()}
- */
- function wp_deleteComment($args) {
- $this->escape($args);
-
- $blog_id = (int) $args[0];
- $username = $args[1];
- $password = $args[2];
- $comment_ID = (int) $args[3];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- if ( !current_user_can( 'moderate_comments' ) )
- return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
-
- do_action('xmlrpc_call', 'wp.deleteComment');
-
- if ( !$comment = get_comment( $comment_ID ) )
- return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
-
- if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
- return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
-
- return wp_delete_comment($comment_ID);
- }
-
- /**
- * Edit comment.
- *
- * @since 2.7.0
- *
- * @param array $args Method parameters.
- * @return bool True, on success.
- */
- function wp_editComment($args) {
- $this->escape($args);
-
- $blog_id = (int) $args[0];
- $username = $args[1];
- $password = $args[2];
- $comment_ID = (int) $args[3];
- $content_struct = $args[4];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- if ( !current_user_can( 'moderate_comments' ) )
- return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
-
- if ( !$comment = get_comment( $comment_ID ) )
- return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
-
- if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
- return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
-
- do_action('xmlrpc_call', 'wp.editComment');
-
- if ( isset($content_struct['status']) ) {
- $statuses = get_comment_statuses();
- $statuses = array_keys($statuses);
-
- if ( ! in_array($content_struct['status'], $statuses) )
- return new IXR_Error( 401, __( 'Invalid comment status.' ) );
- $comment_approved = $content_struct['status'];
- }
-
- // Do some timestamp voodoo
- if ( !empty( $content_struct['date_created_gmt'] ) ) {
- $dateCreated = str_replace( 'Z', '', $content_struct['date_created_gmt']->getIso() ) . 'Z'; // We know this is supposed to be GMT, so we're going to slap that Z on there by force
- $comment_date = get_date_from_gmt(iso8601_to_datetime($dateCreated));
- $comment_date_gmt = iso8601_to_datetime($dateCreated, GMT);
- }
-
- if ( isset($content_struct['content']) )
- $comment_content = $content_struct['content'];
-
- if ( isset($content_struct['author']) )
- $comment_author = $content_struct['author'];
-
- if ( isset($content_struct['author_url']) )
- $comment_author_url = $content_struct['author_url'];
-
- if ( isset($content_struct['author_email']) )
- $comment_author_email = $content_struct['author_email'];
-
- // We've got all the data -- post it:
- $comment = compact('comment_ID', 'comment_content', 'comment_approved', 'comment_date', 'comment_date_gmt', 'comment_author', 'comment_author_email', 'comment_author_url');
-
- $result = wp_update_comment($comment);
- if ( is_wp_error( $result ) )
- return new IXR_Error(500, $result->get_error_message());
-
- if ( !$result )
- return new IXR_Error(500, __('Sorry, the comment could not be edited. Something wrong happened.'));
-
- return true;
- }
-
- /**
- * Create new comment.
- *
- * @since 2.7.0
- *
- * @param array $args Method parameters.
- * @return mixed {@link wp_new_comment()}
- */
- function wp_newComment($args) {
- global $wpdb;
-
- $this->escape($args);
-
- $blog_id = (int) $args[0];
- $username = $args[1];
- $password = $args[2];
- $post = $args[3];
- $content_struct = $args[4];
-
- $allow_anon = apply_filters('xmlrpc_allow_anonymous_comments', false);
-
- $user = $this->login($username, $password);
-
- if ( !$user ) {
- $logged_in = false;
- if ( $allow_anon && get_option('comment_registration') )
- return new IXR_Error( 403, __( 'You must be registered to comment' ) );
- else if ( !$allow_anon )
- return $this->error;
- } else {
- $logged_in = true;
- }
-
- if ( is_numeric($post) )
- $post_id = absint($post);
- else
- $post_id = url_to_postid($post);
-
- if ( ! $post_id )
- return new IXR_Error( 404, __( 'Invalid post ID.' ) );
-
- if ( ! get_post($post_id) )
- return new IXR_Error( 404, __( 'Invalid post ID.' ) );
-
- $comment['comment_post_ID'] = $post_id;
-
- if ( $logged_in ) {
- $comment['comment_author'] = $wpdb->escape( $user->display_name );
- $comment['comment_author_email'] = $wpdb->escape( $user->user_email );
- $comment['comment_author_url'] = $wpdb->escape( $user->user_url );
- $comment['user_ID'] = $user->ID;
- } else {
- $comment['comment_author'] = '';
- if ( isset($content_struct['author']) )
- $comment['comment_author'] = $content_struct['author'];
-
- $comment['comment_author_email'] = '';
- if ( isset($content_struct['author_email']) )
- $comment['comment_author_email'] = $content_struct['author_email'];
-
- $comment['comment_author_url'] = '';
- if ( isset($content_struct['author_url']) )
- $comment['comment_author_url'] = $content_struct['author_url'];
-
- $comment['user_ID'] = 0;
-
- if ( get_option('require_name_email') ) {
- if ( 6 > strlen($comment['comment_author_email']) || '' == $comment['comment_author'] )
- return new IXR_Error( 403, __( 'Comment author name and email are required' ) );
- elseif ( !is_email($comment['comment_author_email']) )
- return new IXR_Error( 403, __( 'A valid email address is required' ) );
- }
- }
-
- $comment['comment_parent'] = isset($content_struct['comment_parent']) ? absint($content_struct['comment_parent']) : 0;
-
- $comment['comment_content'] = $content_struct['content'];
-
- do_action('xmlrpc_call', 'wp.newComment');
-
- return wp_new_comment($comment);
- }
-
- /**
- * Retrieve all of the comment status.
- *
- * @since 2.7.0
- *
- * @param array $args Method parameters.
- * @return array
- */
- function wp_getCommentStatusList($args) {
- $this->escape( $args );
-
- $blog_id = (int) $args[0];
- $username = $args[1];
- $password = $args[2];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- if ( !current_user_can( 'moderate_comments' ) )
- return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
-
- do_action('xmlrpc_call', 'wp.getCommentStatusList');
-
- return get_comment_statuses( );
- }
-
- /**
- * Retrieve comment count.
- *
- * @since 2.5.0
- *
- * @param array $args Method parameters.
- * @return array
- */
- function wp_getCommentCount( $args ) {
- $this->escape($args);
-
- $blog_id = (int) $args[0];
- $username = $args[1];
- $password = $args[2];
- $post_id = (int) $args[3];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- if ( !current_user_can( 'edit_posts' ) )
- return new IXR_Error( 403, __( 'You are not allowed access to details about comments.' ) );
-
- do_action('xmlrpc_call', 'wp.getCommentCount');
-
- $count = wp_count_comments( $post_id );
- return array(
- "approved" => $count->approved,
- "awaiting_moderation" => $count->moderated,
- "spam" => $count->spam,
- "total_comments" => $count->total_comments
- );
- }
-
- /**
- * Retrieve post statuses.
- *
- * @since 2.5.0
- *
- * @param array $args Method parameters.
- * @return array
- */
- function wp_getPostStatusList( $args ) {
- $this->escape( $args );
-
- $blog_id = (int) $args[0];
- $username = $args[1];
- $password = $args[2];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- if ( !current_user_can( 'edit_posts' ) )
- return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
-
- do_action('xmlrpc_call', 'wp.getPostStatusList');
-
- return get_post_statuses( );
- }
-
- /**
- * Retrieve page statuses.
- *
- * @since 2.5.0
- *
- * @param array $args Method parameters.
- * @return array
- */
- function wp_getPageStatusList( $args ) {
- $this->escape( $args );
-
- $blog_id = (int) $args[0];
- $username = $args[1];
- $password = $args[2];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- if ( !current_user_can( 'edit_pages' ) )
- return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
-
- do_action('xmlrpc_call', 'wp.getPageStatusList');
-
- return get_page_statuses( );
- }
-
- /**
- * Retrieve page templates.
- *
- * @since 2.6.0
- *
- * @param array $args Method parameters.
- * @return array
- */
- function wp_getPageTemplates( $args ) {
- $this->escape( $args );
-
- $blog_id = (int) $args[0];
- $username = $args[1];
- $password = $args[2];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- if ( !current_user_can( 'edit_pages' ) )
- return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
-
- $templates = get_page_templates( );
- $templates['Default'] = 'default';
-
- return $templates;
- }
-
- /**
- * Retrieve blog options.
- *
- * @since 2.6.0
- *
- * @param array $args Method parameters.
- * @return array
- */
- function wp_getOptions( $args ) {
- $this->escape( $args );
-
- $blog_id = (int) $args[0];
- $username = $args[1];
- $password = $args[2];
- $options = (array) $args[3];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- // If no specific options where asked for, return all of them
- if ( count( $options ) == 0 )
- $options = array_keys($this->blog_options);
-
- return $this->_getOptions($options);
- }
-
- /**
- * Retrieve blog options value from list.
- *
- * @since 2.6.0
- *
- * @param array $options Options to retrieve.
- * @return array
- */
- function _getOptions($options) {
- $data = array( );
- foreach ( $options as $option ) {
- if ( array_key_exists( $option, $this->blog_options ) ) {
- $data[$option] = $this->blog_options[$option];
- //Is the value static or dynamic?
- if ( isset( $data[$option]['option'] ) ) {
- $data[$option]['value'] = get_option( $data[$option]['option'] );
- unset($data[$option]['option']);
- }
- }
- }
-
- return $data;
- }
-
- /**
- * Update blog options.
- *
- * @since 2.6.0
- *
- * @param array $args Method parameters.
- * @return unknown
- */
- function wp_setOptions( $args ) {
- $this->escape( $args );
-
- $blog_id = (int) $args[0];
- $username = $args[1];
- $password = $args[2];
- $options = (array) $args[3];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- if ( !current_user_can( 'manage_options' ) )
- return new IXR_Error( 403, __( 'You are not allowed to update options.' ) );
-
- foreach ( $options as $o_name => $o_value ) {
- $option_names[] = $o_name;
- if ( !array_key_exists( $o_name, $this->blog_options ) )
- continue;
-
- if ( $this->blog_options[$o_name]['readonly'] == true )
- continue;
-
- update_option( $this->blog_options[$o_name]['option'], $o_value );
- }
-
- //Now return the updated values
- return $this->_getOptions($option_names);
- }
-
- /* Blogger API functions.
- * specs on http://plant.blogger.com/api and http://groups.yahoo.com/group/bloggerDev/
- */
-
- /**
- * Retrieve blogs that user owns.
- *
- * Will make more sense once we support multiple blogs.
- *
- * @since 1.5.0
- *
- * @param array $args Method parameters.
- * @return array
- */
- function blogger_getUsersBlogs($args) {
- if ( is_multisite() )
- return $this->_multisite_getUsersBlogs($args);
-
- $this->escape($args);
-
- $username = $args[1];
- $password = $args[2];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- do_action('xmlrpc_call', 'blogger.getUsersBlogs');
-
- $is_admin = current_user_can('manage_options');
-
- $struct = array(
- 'isAdmin' => $is_admin,
- 'url' => get_option('home') . '/',
- 'blogid' => '1',
- 'blogName' => get_option('blogname'),
- 'xmlrpc' => site_url( 'xmlrpc.php' )
- );
-
- return array($struct);
- }
-
- /**
- * Private function for retrieving a users blogs for multisite setups
- *
- * @access protected
- */
- function _multisite_getUsersBlogs($args) {
- global $current_blog;
- $domain = $current_blog->domain;
- $path = $current_blog->path . 'xmlrpc.php';
- $protocol = is_ssl() ? 'https' : 'http';
-
- $rpc = new IXR_Client("$protocol://{$domain}{$path}");
- $rpc->query('wp.getUsersBlogs', $args[1], $args[2]);
- $blogs = $rpc->getResponse();
-
- if ( isset($blogs['faultCode']) )
- return new IXR_Error($blogs['faultCode'], $blogs['faultString']);
-
- if ( $_SERVER['HTTP_HOST'] == $domain && $_SERVER['REQUEST_URI'] == $path ) {
- return $blogs;
- } else {
- foreach ( (array) $blogs as $blog ) {
- if ( strpos($blog['url'], $_SERVER['HTTP_HOST']) )
- return array($blog);
- }
- return array();
- }
- }
-
- /**
- * Retrieve user's data.
- *
- * Gives your client some info about you, so you don't have to.
- *
- * @since 1.5.0
- *
- * @param array $args Method parameters.
- * @return array
- */
- function blogger_getUserInfo($args) {
-
- $this->escape($args);
-
- $username = $args[1];
- $password = $args[2];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- if ( !current_user_can( 'edit_posts' ) )
- return new IXR_Error( 401, __( 'Sorry, you do not have access to user data on this site.' ) );
-
- do_action('xmlrpc_call', 'blogger.getUserInfo');
-
- $struct = array(
- 'nickname' => $user->nickname,
- 'userid' => $user->ID,
- 'url' => $user->user_url,
- 'lastname' => $user->last_name,
- 'firstname' => $user->first_name
- );
-
- return $struct;
- }
-
- /**
- * Retrieve post.
- *
- * @since 1.5.0
- *
- * @param array $args Method parameters.
- * @return array
- */
- function blogger_getPost($args) {
-
- $this->escape($args);
-
- $post_ID = (int) $args[1];
- $username = $args[2];
- $password = $args[3];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- if ( !current_user_can( 'edit_post', $post_ID ) )
- return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
-
- do_action('xmlrpc_call', 'blogger.getPost');
-
- $post_data = wp_get_single_post($post_ID, ARRAY_A);
-
- $categories = implode(',', wp_get_post_categories($post_ID));
-
- $content = ''.stripslashes($post_data['post_title']).' ';
- $content .= ''.$categories.' ';
- $content .= stripslashes($post_data['post_content']);
-
- $struct = array(
- 'userid' => $post_data['post_author'],
- 'dateCreated' => new IXR_Date(mysql2date('Ymd\TH:i:s', $post_data['post_date'], false)),
- 'content' => $content,
- 'postid' => $post_data['ID']
- );
-
- return $struct;
- }
-
- /**
- * Retrieve list of recent posts.
- *
- * @since 1.5.0
- *
- * @param array $args Method parameters.
- * @return array
- */
- function blogger_getRecentPosts($args) {
-
- $this->escape($args);
-
- $blog_ID = (int) $args[1]; /* though we don't use it yet */
- $username = $args[2];
- $password = $args[3];
- $num_posts = $args[4];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- do_action('xmlrpc_call', 'blogger.getRecentPosts');
-
- $posts_list = wp_get_recent_posts($num_posts);
-
- if ( !$posts_list ) {
- $this->error = new IXR_Error(500, __('Either there are no posts, or something went wrong.'));
- return $this->error;
- }
-
- foreach ($posts_list as $entry) {
- if ( !current_user_can( 'edit_post', $entry['ID'] ) )
- continue;
-
- $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date'], false);
- $categories = implode(',', wp_get_post_categories($entry['ID']));
-
- $content = ''.stripslashes($entry['post_title']).' ';
- $content .= ''.$categories.' ';
- $content .= stripslashes($entry['post_content']);
-
- $struct[] = array(
- 'userid' => $entry['post_author'],
- 'dateCreated' => new IXR_Date($post_date),
- 'content' => $content,
- 'postid' => $entry['ID'],
- );
-
- }
-
- $recent_posts = array();
- for ( $j=0; $jescape($args);
-
- $blog_ID = (int) $args[1];
- $username = $args[2];
- $password = $args[3];
- $template = $args[4]; /* could be 'main' or 'archiveIndex', but we don't use it */
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- do_action('xmlrpc_call', 'blogger.getTemplate');
-
- if ( !current_user_can('edit_themes') )
- return new IXR_Error(401, __('Sorry, this user can not edit the template.'));
-
- /* warning: here we make the assumption that the blog's URL is on the same server */
- $filename = get_option('home') . '/';
- $filename = preg_replace('#https?://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename);
-
- $f = fopen($filename, 'r');
- $content = fread($f, filesize($filename));
- fclose($f);
-
- /* so it is actually editable with a windows/mac client */
- // FIXME: (or delete me) do we really want to cater to bad clients at the expense of good ones by BEEPing up their line breaks? commented. $content = str_replace("\n", "\r\n", $content);
-
- return $content;
- }
-
- /**
- * Updates the content of blog_filename.
- *
- * @since 1.5.0
- *
- * @param array $args Method parameters.
- * @return bool True when done.
- */
- function blogger_setTemplate($args) {
-
- $this->escape($args);
-
- $blog_ID = (int) $args[1];
- $username = $args[2];
- $password = $args[3];
- $content = $args[4];
- $template = $args[5]; /* could be 'main' or 'archiveIndex', but we don't use it */
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- do_action('xmlrpc_call', 'blogger.setTemplate');
-
- if ( !current_user_can('edit_themes') )
- return new IXR_Error(401, __('Sorry, this user cannot edit the template.'));
-
- /* warning: here we make the assumption that the blog's URL is on the same server */
- $filename = get_option('home') . '/';
- $filename = preg_replace('#https?://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename);
-
- if ($f = fopen($filename, 'w+')) {
- fwrite($f, $content);
- fclose($f);
- } else {
- return new IXR_Error(500, __('Either the file is not writable, or something wrong happened. The file has not been updated.'));
- }
-
- return true;
- }
-
- /**
- * Create new post.
- *
- * @since 1.5.0
- *
- * @param array $args Method parameters.
- * @return int
- */
- function blogger_newPost($args) {
-
- $this->escape($args);
-
- $blog_ID = (int) $args[1]; /* though we don't use it yet */
- $username = $args[2];
- $password = $args[3];
- $content = $args[4];
- $publish = $args[5];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- do_action('xmlrpc_call', 'blogger.newPost');
-
- $cap = ($publish) ? 'publish_posts' : 'edit_posts';
- if ( !current_user_can($cap) )
- return new IXR_Error(401, __('Sorry, you are not allowed to post on this site.'));
-
- $post_status = ($publish) ? 'publish' : 'draft';
-
- $post_author = $user->ID;
-
- $post_title = xmlrpc_getposttitle($content);
- $post_category = xmlrpc_getpostcategory($content);
- $post_content = xmlrpc_removepostdata($content);
-
- $post_date = current_time('mysql');
- $post_date_gmt = current_time('mysql', 1);
-
- $post_data = compact('blog_ID', 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status');
-
- $post_ID = wp_insert_post($post_data);
- if ( is_wp_error( $post_ID ) )
- return new IXR_Error(500, $post_ID->get_error_message());
-
- if ( !$post_ID )
- return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.'));
-
- $this->attach_uploads( $post_ID, $post_content );
-
- logIO('O', "Posted ! ID: $post_ID");
-
- return $post_ID;
- }
-
- /**
- * Edit a post.
- *
- * @since 1.5.0
- *
- * @param array $args Method parameters.
- * @return bool true when done.
- */
- function blogger_editPost($args) {
-
- $this->escape($args);
-
- $post_ID = (int) $args[1];
- $username = $args[2];
- $password = $args[3];
- $content = $args[4];
- $publish = $args[5];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- do_action('xmlrpc_call', 'blogger.editPost');
-
- $actual_post = wp_get_single_post($post_ID,ARRAY_A);
-
- if ( !$actual_post || $actual_post['post_type'] != 'post' )
- return new IXR_Error(404, __('Sorry, no such post.'));
-
- $this->escape($actual_post);
-
- if ( !current_user_can('edit_post', $post_ID) )
- return new IXR_Error(401, __('Sorry, you do not have the right to edit this post.'));
-
- extract($actual_post, EXTR_SKIP);
-
- if ( ('publish' == $post_status) && !current_user_can('publish_posts') )
- return new IXR_Error(401, __('Sorry, you do not have the right to publish this post.'));
-
- $post_title = xmlrpc_getposttitle($content);
- $post_category = xmlrpc_getpostcategory($content);
- $post_content = xmlrpc_removepostdata($content);
-
- $postdata = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt');
-
- $result = wp_update_post($postdata);
-
- if ( !$result )
- return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be edited.'));
-
- $this->attach_uploads( $ID, $post_content );
-
- return true;
- }
-
- /**
- * Remove a post.
- *
- * @since 1.5.0
- *
- * @param array $args Method parameters.
- * @return bool True when post is deleted.
- */
- function blogger_deletePost($args) {
- $this->escape($args);
-
- $post_ID = (int) $args[1];
- $username = $args[2];
- $password = $args[3];
- $publish = $args[4];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- do_action('xmlrpc_call', 'blogger.deletePost');
-
- $actual_post = wp_get_single_post($post_ID,ARRAY_A);
-
- if ( !$actual_post || $actual_post['post_type'] != 'post' )
- return new IXR_Error(404, __('Sorry, no such post.'));
-
- if ( !current_user_can('delete_post', $post_ID) )
- return new IXR_Error(401, __('Sorry, you do not have the right to delete this post.'));
-
- $result = wp_delete_post($post_ID);
-
- if ( !$result )
- return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be deleted.'));
-
- return true;
- }
-
- /* MetaWeblog API functions
- * specs on wherever Dave Winer wants them to be
- */
-
- /**
- * Create a new post.
- *
- * @since 1.5.0
- *
- * @param array $args Method parameters.
- * @return int
- */
- function mw_newPost($args) {
- $this->escape($args);
-
- $blog_ID = (int) $args[0]; // we will support this in the near future
- $username = $args[1];
- $password = $args[2];
- $content_struct = $args[3];
- $publish = isset( $args[4] ) ? $args[4] : 0;
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- do_action('xmlrpc_call', 'metaWeblog.newPost');
-
- $page_template = '';
- if ( !empty( $content_struct['post_type'] ) ) {
- if ( $content_struct['post_type'] == 'page' ) {
- if ( $publish || 'publish' == $content_struct['page_status'])
- $cap = 'publish_pages';
- else
- $cap = 'edit_pages';
- $error_message = __( 'Sorry, you are not allowed to publish pages on this site.' );
- $post_type = 'page';
- if ( !empty( $content_struct['wp_page_template'] ) )
- $page_template = $content_struct['wp_page_template'];
- } elseif ( $content_struct['post_type'] == 'post' ) {
- if ( $publish || 'publish' == $content_struct['post_status'])
- $cap = 'publish_posts';
- else
- $cap = 'edit_posts';
- $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' );
- $post_type = 'post';
- } else {
- // No other post_type values are allowed here
- return new IXR_Error( 401, __( 'Invalid post type.' ) );
- }
- } else {
- if ( $publish || 'publish' == $content_struct['post_status'])
- $cap = 'publish_posts';
- else
- $cap = 'edit_posts';
- $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' );
- $post_type = 'post';
- }
-
- if ( !current_user_can( $cap ) )
- return new IXR_Error( 401, $error_message );
-
- // Let WordPress generate the post_name (slug) unless
- // one has been provided.
- $post_name = "";
- if ( isset($content_struct["wp_slug"]) )
- $post_name = $content_struct["wp_slug"];
-
- // Only use a password if one was given.
- if ( isset($content_struct["wp_password"]) )
- $post_password = $content_struct["wp_password"];
-
- // Only set a post parent if one was provided.
- if ( isset($content_struct["wp_page_parent_id"]) )
- $post_parent = $content_struct["wp_page_parent_id"];
-
- // Only set the menu_order if it was provided.
- if ( isset($content_struct["wp_page_order"]) )
- $menu_order = $content_struct["wp_page_order"];
-
- $post_author = $user->ID;
-
- // If an author id was provided then use it instead.
- if ( isset($content_struct["wp_author_id"]) && ($user->ID != $content_struct["wp_author_id"]) ) {
- switch ( $post_type ) {
- case "post":
- if ( !current_user_can("edit_others_posts") )
- return(new IXR_Error(401, __("You are not allowed to post as this user")));
- break;
- case "page":
- if ( !current_user_can("edit_others_pages") )
- return(new IXR_Error(401, __("You are not allowed to create pages as this user")));
- break;
- default:
- return(new IXR_Error(401, __("Invalid post type.")));
- break;
- }
- $post_author = $content_struct["wp_author_id"];
- }
-
- $post_title = $content_struct['title'];
- $post_content = $content_struct['description'];
-
- $post_status = $publish ? 'publish' : 'draft';
-
- if ( isset( $content_struct["{$post_type}_status"] ) ) {
- switch ( $content_struct["{$post_type}_status"] ) {
- case 'draft':
- case 'private':
- case 'publish':
- $post_status = $content_struct["{$post_type}_status"];
- break;
- case 'pending':
- // Pending is only valid for posts, not pages.
- if ( $post_type === 'post' )
- $post_status = $content_struct["{$post_type}_status"];
- break;
- default:
- $post_status = $publish ? 'publish' : 'draft';
- break;
- }
- }
-
- $post_excerpt = $content_struct['mt_excerpt'];
- $post_more = $content_struct['mt_text_more'];
-
- $tags_input = $content_struct['mt_keywords'];
-
- if ( isset($content_struct["mt_allow_comments"]) ) {
- if ( !is_numeric($content_struct["mt_allow_comments"]) ) {
- switch ( $content_struct["mt_allow_comments"] ) {
- case "closed":
- $comment_status = "closed";
- break;
- case "open":
- $comment_status = "open";
- break;
- default:
- $comment_status = get_option("default_comment_status");
- break;
- }
- } else {
- switch ( (int) $content_struct["mt_allow_comments"] ) {
- case 0:
- case 2:
- $comment_status = "closed";
- break;
- case 1:
- $comment_status = "open";
- break;
- default:
- $comment_status = get_option("default_comment_status");
- break;
- }
- }
- } else {
- $comment_status = get_option("default_comment_status");
- }
-
- if ( isset($content_struct["mt_allow_pings"]) ) {
- if ( !is_numeric($content_struct["mt_allow_pings"]) ) {
- switch ( $content_struct['mt_allow_pings'] ) {
- case "closed":
- $ping_status = "closed";
- break;
- case "open":
- $ping_status = "open";
- break;
- default:
- $ping_status = get_option("default_ping_status");
- break;
- }
- } else {
- switch ( (int) $content_struct["mt_allow_pings"] ) {
- case 0:
- $ping_status = "closed";
- break;
- case 1:
- $ping_status = "open";
- break;
- default:
- $ping_status = get_option("default_ping_status");
- break;
- }
- }
- } else {
- $ping_status = get_option("default_ping_status");
- }
-
- if ( $post_more )
- $post_content = $post_content . "" . $post_more;
-
- $to_ping = $content_struct['mt_tb_ping_urls'];
- if ( is_array($to_ping) )
- $to_ping = implode(' ', $to_ping);
-
- // Do some timestamp voodoo
- if ( !empty( $content_struct['date_created_gmt'] ) )
- $dateCreated = str_replace( 'Z', '', $content_struct['date_created_gmt']->getIso() ) . 'Z'; // We know this is supposed to be GMT, so we're going to slap that Z on there by force
- elseif ( !empty( $content_struct['dateCreated']) )
- $dateCreated = $content_struct['dateCreated']->getIso();
-
- if ( !empty( $dateCreated ) ) {
- $post_date = get_date_from_gmt(iso8601_to_datetime($dateCreated));
- $post_date_gmt = iso8601_to_datetime($dateCreated, GMT);
- } else {
- $post_date = current_time('mysql');
- $post_date_gmt = current_time('mysql', 1);
- }
-
- $catnames = $content_struct['categories'];
- logIO('O', 'Post cats: ' . var_export($catnames,true));
- $post_category = array();
-
- if ( is_array($catnames) ) {
- foreach ($catnames as $cat) {
- $post_category[] = get_cat_ID($cat);
- }
- }
-
- // We've got all the data -- post it:
- $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping', 'post_type', 'post_name', 'post_password', 'post_parent', 'menu_order', 'tags_input', 'page_template');
-
- $post_ID = wp_insert_post($postdata, true);
- if ( is_wp_error( $post_ID ) )
- return new IXR_Error(500, $post_ID->get_error_message());
-
- if ( !$post_ID )
- return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.'));
-
- // Only posts can be sticky
- if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) {
- if ( $content_struct['sticky'] == true )
- stick_post( $post_ID );
- elseif ( $content_struct['sticky'] == false )
- unstick_post( $post_ID );
- }
-
- if ( isset($content_struct['custom_fields']) )
- $this->set_custom_fields($post_ID, $content_struct['custom_fields']);
-
- // Handle enclosures
- $this->add_enclosure_if_new($post_ID, $content_struct['enclosure']);
-
- $this->attach_uploads( $post_ID, $post_content );
-
- logIO('O', "Posted ! ID: $post_ID");
-
- return strval($post_ID);
- }
-
- function add_enclosure_if_new($post_ID, $enclosure) {
- if ( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) {
-
- $encstring = $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type'];
- $found = false;
- foreach ( (array) get_post_custom($post_ID) as $key => $val) {
- if ($key == 'enclosure') {
- foreach ( (array) $val as $enc ) {
- if ($enc == $encstring) {
- $found = true;
- break 2;
- }
- }
- }
- }
- if (!$found)
- add_post_meta( $post_ID, 'enclosure', $encstring );
- }
- }
-
- /**
- * Attach upload to a post.
- *
- * @since 2.1.0
- *
- * @param int $post_ID Post ID.
- * @param string $post_content Post Content for attachment.
- */
- function attach_uploads( $post_ID, $post_content ) {
- global $wpdb;
-
- // find any unattached files
- $attachments = $wpdb->get_results( "SELECT ID, guid FROM {$wpdb->posts} WHERE post_parent = '0' AND post_type = 'attachment'" );
- if ( is_array( $attachments ) ) {
- foreach ( $attachments as $file ) {
- if ( strpos( $post_content, $file->guid ) !== false )
- $wpdb->update($wpdb->posts, array('post_parent' => $post_ID), array('ID' => $file->ID) );
- }
- }
- }
-
- /**
- * Edit a post.
- *
- * @since 1.5.0
- *
- * @param array $args Method parameters.
- * @return bool True on success.
- */
- function mw_editPost($args) {
-
- $this->escape($args);
-
- $post_ID = (int) $args[0];
- $username = $args[1];
- $password = $args[2];
- $content_struct = $args[3];
- $publish = $args[4];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- do_action('xmlrpc_call', 'metaWeblog.editPost');
-
- $cap = ( $publish ) ? 'publish_posts' : 'edit_posts';
- $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' );
- $post_type = 'post';
- $page_template = '';
- if ( !empty( $content_struct['post_type'] ) ) {
- if ( $content_struct['post_type'] == 'page' ) {
- if ( $publish || 'publish' == $content_struct['page_status'] )
- $cap = 'publish_pages';
- else
- $cap = 'edit_pages';
- $error_message = __( 'Sorry, you are not allowed to publish pages on this site.' );
- $post_type = 'page';
- if ( !empty( $content_struct['wp_page_template'] ) )
- $page_template = $content_struct['wp_page_template'];
- } elseif ( $content_struct['post_type'] == 'post' ) {
- if ( $publish || 'publish' == $content_struct['post_status'] )
- $cap = 'publish_posts';
- else
- $cap = 'edit_posts';
- $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' );
- $post_type = 'post';
- } else {
- // No other post_type values are allowed here
- return new IXR_Error( 401, __( 'Invalid post type.' ) );
- }
- } else {
- if ( $publish || 'publish' == $content_struct['post_status'] )
- $cap = 'publish_posts';
- else
- $cap = 'edit_posts';
- $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' );
- $post_type = 'post';
- }
-
- if ( !current_user_can( $cap ) )
- return new IXR_Error( 401, $error_message );
-
- $postdata = wp_get_single_post($post_ID, ARRAY_A);
-
- // If there is no post data for the give post id, stop
- // now and return an error. Other wise a new post will be
- // created (which was the old behavior).
- if ( empty($postdata["ID"]) )
- return(new IXR_Error(404, __("Invalid post ID.")));
-
- $this->escape($postdata);
- extract($postdata, EXTR_SKIP);
-
- // Let WordPress manage slug if none was provided.
- $post_name = "";
- if ( isset($content_struct["wp_slug"]) )
- $post_name = $content_struct["wp_slug"];
-
- // Only use a password if one was given.
- if ( isset($content_struct["wp_password"]) )
- $post_password = $content_struct["wp_password"];
-
- // Only set a post parent if one was given.
- if ( isset($content_struct["wp_page_parent_id"]) )
- $post_parent = $content_struct["wp_page_parent_id"];
-
- // Only set the menu_order if it was given.
- if ( isset($content_struct["wp_page_order"]) )
- $menu_order = $content_struct["wp_page_order"];
-
- $post_author = $postdata["post_author"];
-
- // Only set the post_author if one is set.
- if ( isset($content_struct["wp_author_id"]) && ($user->ID != $content_struct["wp_author_id"]) ) {
- switch ( $post_type ) {
- case "post":
- if ( !current_user_can("edit_others_posts") )
- return(new IXR_Error(401, __("You are not allowed to change the post author as this user.")));
- break;
- case "page":
- if ( !current_user_can("edit_others_pages") )
- return(new IXR_Error(401, __("You are not allowed to change the page author as this user.")));
- break;
- default:
- return(new IXR_Error(401, __("Invalid post type.")));
- break;
- }
- $post_author = $content_struct["wp_author_id"];
- }
-
- if ( isset($content_struct["mt_allow_comments"]) ) {
- if ( !is_numeric($content_struct["mt_allow_comments"]) ) {
- switch ( $content_struct["mt_allow_comments"] ) {
- case "closed":
- $comment_status = "closed";
- break;
- case "open":
- $comment_status = "open";
- break;
- default:
- $comment_status = get_option("default_comment_status");
- break;
- }
- } else {
- switch ( (int) $content_struct["mt_allow_comments"] ) {
- case 0:
- case 2:
- $comment_status = "closed";
- break;
- case 1:
- $comment_status = "open";
- break;
- default:
- $comment_status = get_option("default_comment_status");
- break;
- }
- }
- }
-
- if ( isset($content_struct["mt_allow_pings"]) ) {
- if ( !is_numeric($content_struct["mt_allow_pings"]) ) {
- switch ( $content_struct["mt_allow_pings"] ) {
- case "closed":
- $ping_status = "closed";
- break;
- case "open":
- $ping_status = "open";
- break;
- default:
- $ping_status = get_option("default_ping_status");
- break;
- }
- } else {
- switch ( (int) $content_struct["mt_allow_pings"] ) {
- case 0:
- $ping_status = "closed";
- break;
- case 1:
- $ping_status = "open";
- break;
- default:
- $ping_status = get_option("default_ping_status");
- break;
- }
- }
- }
-
- $post_title = $content_struct['title'];
- $post_content = $content_struct['description'];
- $catnames = $content_struct['categories'];
-
- $post_category = array();
-
- if ( is_array($catnames) ) {
- foreach ($catnames as $cat) {
- $post_category[] = get_cat_ID($cat);
- }
- }
-
- $post_excerpt = $content_struct['mt_excerpt'];
- $post_more = $content_struct['mt_text_more'];
-
- $post_status = $publish ? 'publish' : 'draft';
- if ( isset( $content_struct["{$post_type}_status"] ) ) {
- switch( $content_struct["{$post_type}_status"] ) {
- case 'draft':
- case 'private':
- case 'publish':
- $post_status = $content_struct["{$post_type}_status"];
- break;
- case 'pending':
- // Pending is only valid for posts, not pages.
- if ( $post_type === 'post' )
- $post_status = $content_struct["{$post_type}_status"];
- break;
- default:
- $post_status = $publish ? 'publish' : 'draft';
- break;
- }
- }
-
- $tags_input = $content_struct['mt_keywords'];
-
- if ( ('publish' == $post_status) ) {
- if ( ( 'page' == $post_type ) && !current_user_can('publish_pages') )
- return new IXR_Error(401, __('Sorry, you do not have the right to publish this page.'));
- else if ( !current_user_can('publish_posts') )
- return new IXR_Error(401, __('Sorry, you do not have the right to publish this post.'));
- }
-
- if ( $post_more )
- $post_content = $post_content . "" . $post_more;
-
- $to_ping = $content_struct['mt_tb_ping_urls'];
- if ( is_array($to_ping) )
- $to_ping = implode(' ', $to_ping);
-
- // Do some timestamp voodoo
- if ( !empty( $content_struct['date_created_gmt'] ) )
- $dateCreated = str_replace( 'Z', '', $content_struct['date_created_gmt']->getIso() ) . 'Z'; // We know this is supposed to be GMT, so we're going to slap that Z on there by force
- elseif ( !empty( $content_struct['dateCreated']) )
- $dateCreated = $content_struct['dateCreated']->getIso();
-
- if ( !empty( $dateCreated ) ) {
- $post_date = get_date_from_gmt(iso8601_to_datetime($dateCreated));
- $post_date_gmt = iso8601_to_datetime($dateCreated, GMT);
- } else {
- $post_date = $postdata['post_date'];
- $post_date_gmt = $postdata['post_date_gmt'];
- }
-
- // We've got all the data -- post it:
- $newpost = compact('ID', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'post_date', 'post_date_gmt', 'to_ping', 'post_name', 'post_password', 'post_parent', 'menu_order', 'post_author', 'tags_input', 'page_template');
-
- $result = wp_update_post($newpost, true);
- if ( is_wp_error( $result ) )
- return new IXR_Error(500, $result->get_error_message());
-
- if ( !$result )
- return new IXR_Error(500, __('Sorry, your entry could not be edited. Something wrong happened.'));
-
- // Only posts can be sticky
- if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) {
- if ( $content_struct['sticky'] == true )
- stick_post( $post_ID );
- elseif ( $content_struct['sticky'] == false )
- unstick_post( $post_ID );
- }
-
- if ( isset($content_struct['custom_fields']) )
- $this->set_custom_fields($post_ID, $content_struct['custom_fields']);
-
- // Handle enclosures
- $this->add_enclosure_if_new($post_ID, $content_struct['enclosure']);
-
- $this->attach_uploads( $ID, $post_content );
-
- logIO('O',"(MW) Edited ! ID: $post_ID");
-
- return true;
- }
-
- /**
- * Retrieve post.
- *
- * @since 1.5.0
- *
- * @param array $args Method parameters.
- * @return array
- */
- function mw_getPost($args) {
-
- $this->escape($args);
-
- $post_ID = (int) $args[0];
- $username = $args[1];
- $password = $args[2];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- if ( !current_user_can( 'edit_post', $post_ID ) )
- return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
-
- do_action('xmlrpc_call', 'metaWeblog.getPost');
-
- $postdata = wp_get_single_post($post_ID, ARRAY_A);
-
- if ($postdata['post_date'] != '') {
- $post_date = mysql2date('Ymd\TH:i:s', $postdata['post_date'], false);
- $post_date_gmt = mysql2date('Ymd\TH:i:s', $postdata['post_date_gmt'], false);
-
- // For drafts use the GMT version of the post date
- if ( $postdata['post_status'] == 'draft' )
- $post_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $postdata['post_date'] ), 'Ymd\TH:i:s' );
-
- $categories = array();
- $catids = wp_get_post_categories($post_ID);
- foreach($catids as $catid)
- $categories[] = get_cat_name($catid);
-
- $tagnames = array();
- $tags = wp_get_post_tags( $post_ID );
- if ( !empty( $tags ) ) {
- foreach ( $tags as $tag )
- $tagnames[] = $tag->name;
- $tagnames = implode( ', ', $tagnames );
- } else {
- $tagnames = '';
- }
-
- $post = get_extended($postdata['post_content']);
- $link = post_permalink($postdata['ID']);
-
- // Get the author info.
- $author = get_userdata($postdata['post_author']);
-
- $allow_comments = ('open' == $postdata['comment_status']) ? 1 : 0;
- $allow_pings = ('open' == $postdata['ping_status']) ? 1 : 0;
-
- // Consider future posts as published
- if ( $postdata['post_status'] === 'future' )
- $postdata['post_status'] = 'publish';
-
- $sticky = false;
- if ( is_sticky( $post_ID ) )
- $sticky = true;
-
- $enclosure = array();
- foreach ( (array) get_post_custom($post_ID) as $key => $val) {
- if ($key == 'enclosure') {
- foreach ( (array) $val as $enc ) {
- $encdata = split("\n", $enc);
- $enclosure['url'] = trim(htmlspecialchars($encdata[0]));
- $enclosure['length'] = (int) trim($encdata[1]);
- $enclosure['type'] = trim($encdata[2]);
- break 2;
- }
- }
- }
-
- $resp = array(
- 'dateCreated' => new IXR_Date($post_date),
- 'userid' => $postdata['post_author'],
- 'postid' => $postdata['ID'],
- 'description' => $post['main'],
- 'title' => $postdata['post_title'],
- 'link' => $link,
- 'permaLink' => $link,
- // commented out because no other tool seems to use this
- // 'content' => $entry['post_content'],
- 'categories' => $categories,
- 'mt_excerpt' => $postdata['post_excerpt'],
- 'mt_text_more' => $post['extended'],
- 'mt_allow_comments' => $allow_comments,
- 'mt_allow_pings' => $allow_pings,
- 'mt_keywords' => $tagnames,
- 'wp_slug' => $postdata['post_name'],
- 'wp_password' => $postdata['post_password'],
- 'wp_author_id' => $author->ID,
- 'wp_author_display_name' => $author->display_name,
- 'date_created_gmt' => new IXR_Date($post_date_gmt),
- 'post_status' => $postdata['post_status'],
- 'custom_fields' => $this->get_custom_fields($post_ID),
- 'sticky' => $sticky
- );
-
- if ( !empty($enclosure) ) $resp['enclosure'] = $enclosure;
-
- return $resp;
- } else {
- return new IXR_Error(404, __('Sorry, no such post.'));
- }
- }
-
- /**
- * Retrieve list of recent posts.
- *
- * @since 1.5.0
- *
- * @param array $args Method parameters.
- * @return array
- */
- function mw_getRecentPosts($args) {
-
- $this->escape($args);
-
- $blog_ID = (int) $args[0];
- $username = $args[1];
- $password = $args[2];
- $num_posts = (int) $args[3];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- do_action('xmlrpc_call', 'metaWeblog.getRecentPosts');
-
- $posts_list = wp_get_recent_posts($num_posts);
-
- if ( !$posts_list )
- return array( );
-
- foreach ($posts_list as $entry) {
- if ( !current_user_can( 'edit_post', $entry['ID'] ) )
- continue;
-
- $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date'], false);
- $post_date_gmt = mysql2date('Ymd\TH:i:s', $entry['post_date_gmt'], false);
-
- // For drafts use the GMT version of the date
- if ( $entry['post_status'] == 'draft' )
- $post_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $entry['post_date'] ), 'Ymd\TH:i:s' );
-
- $categories = array();
- $catids = wp_get_post_categories($entry['ID']);
- foreach( $catids as $catid )
- $categories[] = get_cat_name($catid);
-
- $tagnames = array();
- $tags = wp_get_post_tags( $entry['ID'] );
- if ( !empty( $tags ) ) {
- foreach ( $tags as $tag ) {
- $tagnames[] = $tag->name;
- }
- $tagnames = implode( ', ', $tagnames );
- } else {
- $tagnames = '';
- }
-
- $post = get_extended($entry['post_content']);
- $link = post_permalink($entry['ID']);
-
- // Get the post author info.
- $author = get_userdata($entry['post_author']);
-
- $allow_comments = ('open' == $entry['comment_status']) ? 1 : 0;
- $allow_pings = ('open' == $entry['ping_status']) ? 1 : 0;
-
- // Consider future posts as published
- if ( $entry['post_status'] === 'future' )
- $entry['post_status'] = 'publish';
-
- $struct[] = array(
- 'dateCreated' => new IXR_Date($post_date),
- 'userid' => $entry['post_author'],
- 'postid' => $entry['ID'],
- 'description' => $post['main'],
- 'title' => $entry['post_title'],
- 'link' => $link,
- 'permaLink' => $link,
- // commented out because no other tool seems to use this
- // 'content' => $entry['post_content'],
- 'categories' => $categories,
- 'mt_excerpt' => $entry['post_excerpt'],
- 'mt_text_more' => $post['extended'],
- 'mt_allow_comments' => $allow_comments,
- 'mt_allow_pings' => $allow_pings,
- 'mt_keywords' => $tagnames,
- 'wp_slug' => $entry['post_name'],
- 'wp_password' => $entry['post_password'],
- 'wp_author_id' => $author->ID,
- 'wp_author_display_name' => $author->display_name,
- 'date_created_gmt' => new IXR_Date($post_date_gmt),
- 'post_status' => $entry['post_status'],
- 'custom_fields' => $this->get_custom_fields($entry['ID'])
- );
-
- }
-
- $recent_posts = array();
- for ( $j=0; $jescape($args);
-
- $blog_ID = (int) $args[0];
- $username = $args[1];
- $password = $args[2];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- if ( !current_user_can( 'edit_posts' ) )
- return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) );
-
- do_action('xmlrpc_call', 'metaWeblog.getCategories');
-
- $categories_struct = array();
-
- if ( $cats = get_categories(array('get' => 'all')) ) {
- foreach ( $cats as $cat ) {
- $struct['categoryId'] = $cat->term_id;
- $struct['parentId'] = $cat->parent;
- $struct['description'] = $cat->name;
- $struct['categoryDescription'] = $cat->description;
- $struct['categoryName'] = $cat->name;
- $struct['htmlUrl'] = esc_html(get_category_link($cat->term_id));
- $struct['rssUrl'] = esc_html(get_category_feed_link($cat->term_id, 'rss2'));
-
- $categories_struct[] = $struct;
- }
- }
-
- return $categories_struct;
- }
-
- /**
- * Uploads a file, following your settings.
- *
- * Adapted from a patch by Johann Richard.
- *
- * @link http://mycvs.org/archives/2004/06/30/file-upload-to-wordpress-in-ecto/
- *
- * @since 1.5.0
- *
- * @param array $args Method parameters.
- * @return array
- */
- function mw_newMediaObject($args) {
- global $wpdb;
-
- $blog_ID = (int) $args[0];
- $username = $wpdb->escape($args[1]);
- $password = $wpdb->escape($args[2]);
- $data = $args[3];
-
- $name = sanitize_file_name( $data['name'] );
- $type = $data['type'];
- $bits = $data['bits'];
-
- logIO('O', '(MW) Received '.strlen($bits).' bytes');
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- do_action('xmlrpc_call', 'metaWeblog.newMediaObject');
-
- if ( !current_user_can('upload_files') ) {
- logIO('O', '(MW) User does not have upload_files capability');
- $this->error = new IXR_Error(401, __('You are not allowed to upload files to this site.'));
- return $this->error;
- }
-
- if ( $upload_err = apply_filters( "pre_upload_error", false ) )
- return new IXR_Error(500, $upload_err);
-
- if ( !empty($data["overwrite"]) && ($data["overwrite"] == true) ) {
- // Get postmeta info on the object.
- $old_file = $wpdb->get_row("
- SELECT ID
- FROM {$wpdb->posts}
- WHERE post_title = '{$name}'
- AND post_type = 'attachment'
- ");
-
- // Delete previous file.
- wp_delete_attachment($old_file->ID);
-
- // Make sure the new name is different by pre-pending the
- // previous post id.
- $filename = preg_replace("/^wpid\d+-/", "", $name);
- $name = "wpid{$old_file->ID}-{$filename}";
- }
-
- $upload = wp_upload_bits($name, $type, $bits);
- if ( ! empty($upload['error']) ) {
- $errorString = sprintf(__('Could not write file %1$s (%2$s)'), $name, $upload['error']);
- logIO('O', '(MW) ' . $errorString);
- return new IXR_Error(500, $errorString);
- }
- // Construct the attachment array
- // attach to post_id 0
- $post_id = 0;
- $attachment = array(
- 'post_title' => $name,
- 'post_content' => '',
- 'post_type' => 'attachment',
- 'post_parent' => $post_id,
- 'post_mime_type' => $type,
- 'guid' => $upload[ 'url' ]
- );
-
- // Save the data
- $id = wp_insert_attachment( $attachment, $upload[ 'file' ], $post_id );
- wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) );
-
- return apply_filters( 'wp_handle_upload', array( 'file' => $name, 'url' => $upload[ 'url' ], 'type' => $type ), 'upload' );
- }
-
- /* MovableType API functions
- * specs on http://www.movabletype.org/docs/mtmanual_programmatic.html
- */
-
- /**
- * Retrieve the post titles of recent posts.
- *
- * @since 1.5.0
- *
- * @param array $args Method parameters.
- * @return array
- */
- function mt_getRecentPostTitles($args) {
-
- $this->escape($args);
-
- $blog_ID = (int) $args[0];
- $username = $args[1];
- $password = $args[2];
- $num_posts = (int) $args[3];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- do_action('xmlrpc_call', 'mt.getRecentPostTitles');
-
- $posts_list = wp_get_recent_posts($num_posts);
-
- if ( !$posts_list ) {
- $this->error = new IXR_Error(500, __('Either there are no posts, or something went wrong.'));
- return $this->error;
- }
-
- foreach ($posts_list as $entry) {
- if ( !current_user_can( 'edit_post', $entry['ID'] ) )
- continue;
-
- $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date'], false);
- $post_date_gmt = mysql2date('Ymd\TH:i:s', $entry['post_date_gmt'], false);
-
- // For drafts use the GMT version of the date
- if ( $entry['post_status'] == 'draft' )
- $post_date_gmt = get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $entry['post_date'] ), 'Ymd\TH:i:s' );
-
- $struct[] = array(
- 'dateCreated' => new IXR_Date($post_date),
- 'userid' => $entry['post_author'],
- 'postid' => $entry['ID'],
- 'title' => $entry['post_title'],
- 'date_created_gmt' => new IXR_Date($post_date_gmt)
- );
-
- }
-
- $recent_posts = array();
- for ( $j=0; $jescape($args);
-
- $blog_ID = (int) $args[0];
- $username = $args[1];
- $password = $args[2];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- if ( !current_user_can( 'edit_posts' ) )
- return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) );
-
- do_action('xmlrpc_call', 'mt.getCategoryList');
-
- $categories_struct = array();
-
- if ( $cats = get_categories(array('hide_empty' => 0, 'hierarchical' => 0)) ) {
- foreach ( $cats as $cat ) {
- $struct['categoryId'] = $cat->term_id;
- $struct['categoryName'] = $cat->name;
-
- $categories_struct[] = $struct;
- }
- }
-
- return $categories_struct;
- }
-
- /**
- * Retrieve post categories.
- *
- * @since 1.5.0
- *
- * @param array $args Method parameters.
- * @return array
- */
- function mt_getPostCategories($args) {
-
- $this->escape($args);
-
- $post_ID = (int) $args[0];
- $username = $args[1];
- $password = $args[2];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- if ( !current_user_can( 'edit_post', $post_ID ) )
- return new IXR_Error( 401, __( 'Sorry, you can not edit this post.' ) );
-
- do_action('xmlrpc_call', 'mt.getPostCategories');
-
- $categories = array();
- $catids = wp_get_post_categories(intval($post_ID));
- // first listed category will be the primary category
- $isPrimary = true;
- foreach ( $catids as $catid ) {
- $categories[] = array(
- 'categoryName' => get_cat_name($catid),
- 'categoryId' => (string) $catid,
- 'isPrimary' => $isPrimary
- );
- $isPrimary = false;
- }
-
- return $categories;
- }
-
- /**
- * Sets categories for a post.
- *
- * @since 1.5.0
- *
- * @param array $args Method parameters.
- * @return bool True on success.
- */
- function mt_setPostCategories($args) {
-
- $this->escape($args);
-
- $post_ID = (int) $args[0];
- $username = $args[1];
- $password = $args[2];
- $categories = $args[3];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- do_action('xmlrpc_call', 'mt.setPostCategories');
-
- if ( !current_user_can('edit_post', $post_ID) )
- return new IXR_Error(401, __('Sorry, you cannot edit this post.'));
-
- foreach ( $categories as $cat ) {
- $catids[] = $cat['categoryId'];
- }
-
- wp_set_post_categories($post_ID, $catids);
-
- return true;
- }
-
- /**
- * Retrieve an array of methods supported by this server.
- *
- * @since 1.5.0
- *
- * @param array $args Method parameters.
- * @return array
- */
- function mt_supportedMethods($args) {
-
- do_action('xmlrpc_call', 'mt.supportedMethods');
-
- $supported_methods = array();
- foreach ( $this->methods as $key => $value ) {
- $supported_methods[] = $key;
- }
-
- return $supported_methods;
- }
-
- /**
- * Retrieve an empty array because we don't support per-post text filters.
- *
- * @since 1.5.0
- *
- * @param array $args Method parameters.
- */
- function mt_supportedTextFilters($args) {
- do_action('xmlrpc_call', 'mt.supportedTextFilters');
- return apply_filters('xmlrpc_text_filters', array());
- }
-
- /**
- * Retrieve trackbacks sent to a given post.
- *
- * @since 1.5.0
- *
- * @param array $args Method parameters.
- * @return mixed
- */
- function mt_getTrackbackPings($args) {
-
- global $wpdb;
-
- $post_ID = intval($args);
-
- do_action('xmlrpc_call', 'mt.getTrackbackPings');
-
- $actual_post = wp_get_single_post($post_ID, ARRAY_A);
-
- if ( !$actual_post )
- return new IXR_Error(404, __('Sorry, no such post.'));
-
- $comments = $wpdb->get_results( $wpdb->prepare("SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID) );
-
- if ( !$comments )
- return array();
-
- $trackback_pings = array();
- foreach ( $comments as $comment ) {
- if ( 'trackback' == $comment->comment_type ) {
- $content = $comment->comment_content;
- $title = substr($content, 8, (strpos($content, '') - 8));
- $trackback_pings[] = array(
- 'pingTitle' => $title,
- 'pingURL' => $comment->comment_author_url,
- 'pingIP' => $comment->comment_author_IP
- );
- }
- }
-
- return $trackback_pings;
- }
-
- /**
- * Sets a post's publish status to 'publish'.
- *
- * @since 1.5.0
- *
- * @param array $args Method parameters.
- * @return int
- */
- function mt_publishPost($args) {
-
- $this->escape($args);
-
- $post_ID = (int) $args[0];
- $username = $args[1];
- $password = $args[2];
-
- if ( !$user = $this->login($username, $password) )
- return $this->error;
-
- do_action('xmlrpc_call', 'mt.publishPost');
-
- if ( !current_user_can('publish_posts') || !current_user_can('edit_post', $post_ID) )
- return new IXR_Error(401, __('Sorry, you cannot edit this post.'));
-
- $postdata = wp_get_single_post($post_ID,ARRAY_A);
-
- $postdata['post_status'] = 'publish';
-
- // retain old cats
- $cats = wp_get_post_categories($post_ID);
- $postdata['post_category'] = $cats;
- $this->escape($postdata);
-
- $result = wp_update_post($postdata);
-
- return $result;
- }
-
- /* PingBack functions
- * specs on www.hixie.ch/specs/pingback/pingback
- */
-
- /**
- * Retrieves a pingback and registers it.
- *
- * @since 1.5.0
- *
- * @param array $args Method parameters.
- * @return array
- */
- function pingback_ping($args) {
- global $wpdb;
-
- do_action('xmlrpc_call', 'pingback.ping');
-
- $this->escape($args);
-
- $pagelinkedfrom = $args[0];
- $pagelinkedto = $args[1];
-
- $title = '';
-
- $pagelinkedfrom = str_replace('&', '&', $pagelinkedfrom);
- $pagelinkedto = str_replace('&', '&', $pagelinkedto);
- $pagelinkedto = str_replace('&', '&', $pagelinkedto);
-
- // Check if the page linked to is in our site
- $pos1 = strpos($pagelinkedto, str_replace(array('http://www.','http://','https://www.','https://'), '', get_option('home')));
- if ( !$pos1 )
- return new IXR_Error(0, __('Is there no link to us?'));
-
- // let's find which post is linked to
- // FIXME: does url_to_postid() cover all these cases already?
- // if so, then let's use it and drop the old code.
- $urltest = parse_url($pagelinkedto);
- if ( $post_ID = url_to_postid($pagelinkedto) ) {
- $way = 'url_to_postid()';
- } elseif ( preg_match('#p/[0-9]{1,}#', $urltest['path'], $match) ) {
- // the path defines the post_ID (archives/p/XXXX)
- $blah = explode('/', $match[0]);
- $post_ID = (int) $blah[1];
- $way = 'from the path';
- } elseif ( preg_match('#p=[0-9]{1,}#', $urltest['query'], $match) ) {
- // the querystring defines the post_ID (?p=XXXX)
- $blah = explode('=', $match[0]);
- $post_ID = (int) $blah[1];
- $way = 'from the querystring';
- } elseif ( isset($urltest['fragment']) ) {
- // an #anchor is there, it's either...
- if ( intval($urltest['fragment']) ) {
- // ...an integer #XXXX (simpliest case)
- $post_ID = (int) $urltest['fragment'];
- $way = 'from the fragment (numeric)';
- } elseif ( preg_match('/post-[0-9]+/',$urltest['fragment']) ) {
- // ...a post id in the form 'post-###'
- $post_ID = preg_replace('/[^0-9]+/', '', $urltest['fragment']);
- $way = 'from the fragment (post-###)';
- } elseif ( is_string($urltest['fragment']) ) {
- // ...or a string #title, a little more complicated
- $title = preg_replace('/[^a-z0-9]/i', '.', $urltest['fragment']);
- $sql = $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_title RLIKE %s", $title);
- if (! ($post_ID = $wpdb->get_var($sql)) ) {
- // returning unknown error '0' is better than die()ing
- return new IXR_Error(0, '');
- }
- $way = 'from the fragment (title)';
- }
- } else {
- // TODO: Attempt to extract a post ID from the given URL
- return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn’t exist, or it is not a pingback-enabled resource.'));
- }
- $post_ID = (int) $post_ID;
-
-
- logIO("O","(PB) URL='$pagelinkedto' ID='$post_ID' Found='$way'");
-
- $post = get_post($post_ID);
-
- if ( !$post ) // Post_ID not found
- return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn’t exist, or it is not a pingback-enabled resource.'));
-
- if ( $post_ID == url_to_postid($pagelinkedfrom) )
- return new IXR_Error(0, __('The source URL and the target URL cannot both point to the same resource.'));
-
- // Check if pings are on
- if ( !pings_open($post) )
- return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn’t exist, or it is not a pingback-enabled resource.'));
-
- // Let's check that the remote site didn't already pingback this entry
- if ( $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_author_url = %s", $post_ID, $pagelinkedfrom) ) )
- return new IXR_Error( 48, __( 'The pingback has already been registered.' ) );
-
- // very stupid, but gives time to the 'from' server to publish !
- sleep(1);
-
- // Let's check the remote site
- $linea = wp_remote_fopen( $pagelinkedfrom );
- if ( !$linea )
- return new IXR_Error(16, __('The source URL does not exist.'));
-
- $linea = apply_filters('pre_remote_source', $linea, $pagelinkedto);
-
- // Work around bug in strip_tags():
- $linea = str_replace(']*>/", "\n\n", $linea );
-
- preg_match('|([^<]*?) |is', $linea, $matchtitle);
- $title = $matchtitle[1];
- if ( empty( $title ) )
- return new IXR_Error(32, __('We cannot find a title on that page.'));
-
- $linea = strip_tags( $linea, '' ); // just keep the tag we need
-
- $p = explode( "\n\n", $linea );
-
- $preg_target = preg_quote($pagelinkedto, '|');
-
- foreach ( $p as $para ) {
- if ( strpos($para, $pagelinkedto) !== false ) { // it exists, but is it a link?
- preg_match("| ]+?".$preg_target."[^>]*>([^>]+?) |", $para, $context);
-
- // If the URL isn't in a link context, keep looking
- if ( empty($context) )
- continue;
-
- // We're going to use this fake tag to mark the context in a bit
- // the marker is needed in case the link text appears more than once in the paragraph
- $excerpt = preg_replace('|\?wpcontext\>|', '', $para);
-
- // prevent really long link text
- if ( strlen($context[1]) > 100 )
- $context[1] = substr($context[1], 0, 100) . '...';
-
- $marker = ''.$context[1].' '; // set up our marker
- $excerpt= str_replace($context[0], $marker, $excerpt); // swap out the link for our marker
- $excerpt = strip_tags($excerpt, ''); // strip all tags but our context marker
- $excerpt = trim($excerpt);
- $preg_marker = preg_quote($marker, '|');
- $excerpt = preg_replace("|.*?\s(.{0,100}$preg_marker.{0,100})\s.*|s", '$1', $excerpt);
- $excerpt = strip_tags($excerpt); // YES, again, to remove the marker wrapper
- break;
- }
- }
-
- if ( empty($context) ) // Link to target not found
- return new IXR_Error(17, __('The source URL does not contain a link to the target URL, and so cannot be used as a source.'));
-
- $pagelinkedfrom = str_replace('&', '&', $pagelinkedfrom);
-
- $context = '[...] ' . esc_html( $excerpt ) . ' [...]';
- $pagelinkedfrom = $wpdb->escape( $pagelinkedfrom );
-
- $comment_post_ID = (int) $post_ID;
- $comment_author = $title;
- $this->escape($comment_author);
- $comment_author_url = $pagelinkedfrom;
- $comment_content = $context;
- $this->escape($comment_content);
- $comment_type = 'pingback';
-
- $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_content', 'comment_type');
-
- $comment_ID = wp_new_comment($commentdata);
- do_action('pingback_post', $comment_ID);
-
- return sprintf(__('Pingback from %1$s to %2$s registered. Keep the web talking! :-)'), $pagelinkedfrom, $pagelinkedto);
- }
-
- /**
- * Retrieve array of URLs that pingbacked the given URL.
- *
- * Specs on http://www.aquarionics.com/misc/archives/blogite/0198.html
- *
- * @since 1.5.0
- *
- * @param array $args Method parameters.
- * @return array
- */
- function pingback_extensions_getPingbacks($args) {
-
- global $wpdb;
-
- do_action('xmlrpc_call', 'pingback.extensions.getPingbacks');
-
- $this->escape($args);
-
- $url = $args;
-
- $post_ID = url_to_postid($url);
- if ( !$post_ID ) {
- // We aren't sure that the resource is available and/or pingback enabled
- return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn’t exist, or it is not a pingback-enabled resource.'));
- }
-
- $actual_post = wp_get_single_post($post_ID, ARRAY_A);
-
- if ( !$actual_post ) {
- // No such post = resource not found
- return new IXR_Error(32, __('The specified target URL does not exist.'));
- }
-
- $comments = $wpdb->get_results( $wpdb->prepare("SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID) );
-
- if ( !$comments )
- return array();
-
- $pingbacks = array();
- foreach ( $comments as $comment ) {
- if ( 'pingback' == $comment->comment_type )
- $pingbacks[] = $comment->comment_author_url;
- }
-
- return $pingbacks;
- }
-}
+// Allow for a plugin to insert a different class to handle requests.
+$wp_xmlrpc_server_class = apply_filters('wp_xmlrpc_server_class', 'wp_xmlrpc_server');
+$wp_xmlrpc_server = new $wp_xmlrpc_server_class;
-$wp_xmlrpc_server = new wp_xmlrpc_server();
+// Fire off the request
$wp_xmlrpc_server->serve_request();
?>
\ No newline at end of file
--
2.45.2