Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu...
File: class-wp-xmlrpc-server.php
}
[2000] Fix | Delete
} else {
[2001] Fix | Delete
$post_type = get_post_type_object( 'post' );
[2002] Fix | Delete
}
[2003] Fix | Delete
[2004] Fix | Delete
if ( ! current_user_can( $post_type->cap->edit_posts ) ) {
[2005] Fix | Delete
return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts in this post type.' ) );
[2006] Fix | Delete
}
[2007] Fix | Delete
[2008] Fix | Delete
$query['post_type'] = $post_type->name;
[2009] Fix | Delete
[2010] Fix | Delete
if ( isset( $filter['post_status'] ) ) {
[2011] Fix | Delete
$query['post_status'] = $filter['post_status'];
[2012] Fix | Delete
}
[2013] Fix | Delete
[2014] Fix | Delete
if ( isset( $filter['number'] ) ) {
[2015] Fix | Delete
$query['numberposts'] = absint( $filter['number'] );
[2016] Fix | Delete
}
[2017] Fix | Delete
[2018] Fix | Delete
if ( isset( $filter['offset'] ) ) {
[2019] Fix | Delete
$query['offset'] = absint( $filter['offset'] );
[2020] Fix | Delete
}
[2021] Fix | Delete
[2022] Fix | Delete
if ( isset( $filter['orderby'] ) ) {
[2023] Fix | Delete
$query['orderby'] = $filter['orderby'];
[2024] Fix | Delete
[2025] Fix | Delete
if ( isset( $filter['order'] ) ) {
[2026] Fix | Delete
$query['order'] = $filter['order'];
[2027] Fix | Delete
}
[2028] Fix | Delete
}
[2029] Fix | Delete
[2030] Fix | Delete
if ( isset( $filter['s'] ) ) {
[2031] Fix | Delete
$query['s'] = $filter['s'];
[2032] Fix | Delete
}
[2033] Fix | Delete
[2034] Fix | Delete
$posts_list = wp_get_recent_posts( $query );
[2035] Fix | Delete
[2036] Fix | Delete
if ( ! $posts_list ) {
[2037] Fix | Delete
return array();
[2038] Fix | Delete
}
[2039] Fix | Delete
[2040] Fix | Delete
// Holds all the posts data.
[2041] Fix | Delete
$struct = array();
[2042] Fix | Delete
[2043] Fix | Delete
foreach ( $posts_list as $post ) {
[2044] Fix | Delete
if ( ! current_user_can( 'edit_post', $post['ID'] ) ) {
[2045] Fix | Delete
continue;
[2046] Fix | Delete
}
[2047] Fix | Delete
[2048] Fix | Delete
$struct[] = $this->_prepare_post( $post, $fields );
[2049] Fix | Delete
}
[2050] Fix | Delete
[2051] Fix | Delete
return $struct;
[2052] Fix | Delete
}
[2053] Fix | Delete
[2054] Fix | Delete
/**
[2055] Fix | Delete
* Creates a new term.
[2056] Fix | Delete
*
[2057] Fix | Delete
* @since 3.4.0
[2058] Fix | Delete
*
[2059] Fix | Delete
* @see wp_insert_term()
[2060] Fix | Delete
*
[2061] Fix | Delete
* @param array $args {
[2062] Fix | Delete
* Method arguments. Note: arguments must be ordered as documented.
[2063] Fix | Delete
*
[2064] Fix | Delete
* @type int $0 Blog ID (unused).
[2065] Fix | Delete
* @type string $1 Username.
[2066] Fix | Delete
* @type string $2 Password.
[2067] Fix | Delete
* @type array $3 Content struct for adding a new term. The struct must contain
[2068] Fix | Delete
* the term 'name' and 'taxonomy'. Optional accepted values include
[2069] Fix | Delete
* 'parent', 'description', and 'slug'.
[2070] Fix | Delete
* }
[2071] Fix | Delete
* @return int|IXR_Error The term ID on success, or an IXR_Error object on failure.
[2072] Fix | Delete
*/
[2073] Fix | Delete
public function wp_newTerm( $args ) {
[2074] Fix | Delete
if ( ! $this->minimum_args( $args, 4 ) ) {
[2075] Fix | Delete
return $this->error;
[2076] Fix | Delete
}
[2077] Fix | Delete
[2078] Fix | Delete
$this->escape( $args );
[2079] Fix | Delete
[2080] Fix | Delete
$username = $args[1];
[2081] Fix | Delete
$password = $args[2];
[2082] Fix | Delete
$content_struct = $args[3];
[2083] Fix | Delete
[2084] Fix | Delete
$user = $this->login( $username, $password );
[2085] Fix | Delete
if ( ! $user ) {
[2086] Fix | Delete
return $this->error;
[2087] Fix | Delete
}
[2088] Fix | Delete
[2089] Fix | Delete
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
[2090] Fix | Delete
do_action( 'xmlrpc_call', 'wp.newTerm', $args, $this );
[2091] Fix | Delete
[2092] Fix | Delete
if ( ! taxonomy_exists( $content_struct['taxonomy'] ) ) {
[2093] Fix | Delete
return new IXR_Error( 403, __( 'Invalid taxonomy.' ) );
[2094] Fix | Delete
}
[2095] Fix | Delete
[2096] Fix | Delete
$taxonomy = get_taxonomy( $content_struct['taxonomy'] );
[2097] Fix | Delete
[2098] Fix | Delete
if ( ! current_user_can( $taxonomy->cap->edit_terms ) ) {
[2099] Fix | Delete
return new IXR_Error( 401, __( 'Sorry, you are not allowed to create terms in this taxonomy.' ) );
[2100] Fix | Delete
}
[2101] Fix | Delete
[2102] Fix | Delete
$taxonomy = (array) $taxonomy;
[2103] Fix | Delete
[2104] Fix | Delete
// Hold the data of the term.
[2105] Fix | Delete
$term_data = array();
[2106] Fix | Delete
[2107] Fix | Delete
$term_data['name'] = trim( $content_struct['name'] );
[2108] Fix | Delete
if ( empty( $term_data['name'] ) ) {
[2109] Fix | Delete
return new IXR_Error( 403, __( 'The term name cannot be empty.' ) );
[2110] Fix | Delete
}
[2111] Fix | Delete
[2112] Fix | Delete
if ( isset( $content_struct['parent'] ) ) {
[2113] Fix | Delete
if ( ! $taxonomy['hierarchical'] ) {
[2114] Fix | Delete
return new IXR_Error( 403, __( 'This taxonomy is not hierarchical.' ) );
[2115] Fix | Delete
}
[2116] Fix | Delete
[2117] Fix | Delete
$parent_term_id = (int) $content_struct['parent'];
[2118] Fix | Delete
$parent_term = get_term( $parent_term_id, $taxonomy['name'] );
[2119] Fix | Delete
[2120] Fix | Delete
if ( is_wp_error( $parent_term ) ) {
[2121] Fix | Delete
return new IXR_Error( 500, $parent_term->get_error_message() );
[2122] Fix | Delete
}
[2123] Fix | Delete
[2124] Fix | Delete
if ( ! $parent_term ) {
[2125] Fix | Delete
return new IXR_Error( 403, __( 'Parent term does not exist.' ) );
[2126] Fix | Delete
}
[2127] Fix | Delete
[2128] Fix | Delete
$term_data['parent'] = $content_struct['parent'];
[2129] Fix | Delete
}
[2130] Fix | Delete
[2131] Fix | Delete
if ( isset( $content_struct['description'] ) ) {
[2132] Fix | Delete
$term_data['description'] = $content_struct['description'];
[2133] Fix | Delete
}
[2134] Fix | Delete
[2135] Fix | Delete
if ( isset( $content_struct['slug'] ) ) {
[2136] Fix | Delete
$term_data['slug'] = $content_struct['slug'];
[2137] Fix | Delete
}
[2138] Fix | Delete
[2139] Fix | Delete
$term = wp_insert_term( $term_data['name'], $taxonomy['name'], $term_data );
[2140] Fix | Delete
[2141] Fix | Delete
if ( is_wp_error( $term ) ) {
[2142] Fix | Delete
return new IXR_Error( 500, $term->get_error_message() );
[2143] Fix | Delete
}
[2144] Fix | Delete
[2145] Fix | Delete
if ( ! $term ) {
[2146] Fix | Delete
return new IXR_Error( 500, __( 'Sorry, the term could not be created.' ) );
[2147] Fix | Delete
}
[2148] Fix | Delete
[2149] Fix | Delete
// Add term meta.
[2150] Fix | Delete
if ( isset( $content_struct['custom_fields'] ) ) {
[2151] Fix | Delete
$this->set_term_custom_fields( $term['term_id'], $content_struct['custom_fields'] );
[2152] Fix | Delete
}
[2153] Fix | Delete
[2154] Fix | Delete
return (string) $term['term_id'];
[2155] Fix | Delete
}
[2156] Fix | Delete
[2157] Fix | Delete
/**
[2158] Fix | Delete
* Edits a term.
[2159] Fix | Delete
*
[2160] Fix | Delete
* @since 3.4.0
[2161] Fix | Delete
*
[2162] Fix | Delete
* @see wp_update_term()
[2163] Fix | Delete
*
[2164] Fix | Delete
* @param array $args {
[2165] Fix | Delete
* Method arguments. Note: arguments must be ordered as documented.
[2166] Fix | Delete
*
[2167] Fix | Delete
* @type int $0 Blog ID (unused).
[2168] Fix | Delete
* @type string $1 Username.
[2169] Fix | Delete
* @type string $2 Password.
[2170] Fix | Delete
* @type int $3 Term ID.
[2171] Fix | Delete
* @type array $4 Content struct for editing a term. The struct must contain the
[2172] Fix | Delete
* term 'taxonomy'. Optional accepted values include 'name', 'parent',
[2173] Fix | Delete
* 'description', and 'slug'.
[2174] Fix | Delete
* }
[2175] Fix | Delete
* @return true|IXR_Error True on success, IXR_Error instance on failure.
[2176] Fix | Delete
*/
[2177] Fix | Delete
public function wp_editTerm( $args ) {
[2178] Fix | Delete
if ( ! $this->minimum_args( $args, 5 ) ) {
[2179] Fix | Delete
return $this->error;
[2180] Fix | Delete
}
[2181] Fix | Delete
[2182] Fix | Delete
$this->escape( $args );
[2183] Fix | Delete
[2184] Fix | Delete
$username = $args[1];
[2185] Fix | Delete
$password = $args[2];
[2186] Fix | Delete
$term_id = (int) $args[3];
[2187] Fix | Delete
$content_struct = $args[4];
[2188] Fix | Delete
[2189] Fix | Delete
$user = $this->login( $username, $password );
[2190] Fix | Delete
if ( ! $user ) {
[2191] Fix | Delete
return $this->error;
[2192] Fix | Delete
}
[2193] Fix | Delete
[2194] Fix | Delete
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
[2195] Fix | Delete
do_action( 'xmlrpc_call', 'wp.editTerm', $args, $this );
[2196] Fix | Delete
[2197] Fix | Delete
if ( ! taxonomy_exists( $content_struct['taxonomy'] ) ) {
[2198] Fix | Delete
return new IXR_Error( 403, __( 'Invalid taxonomy.' ) );
[2199] Fix | Delete
}
[2200] Fix | Delete
[2201] Fix | Delete
$taxonomy = get_taxonomy( $content_struct['taxonomy'] );
[2202] Fix | Delete
[2203] Fix | Delete
$taxonomy = (array) $taxonomy;
[2204] Fix | Delete
[2205] Fix | Delete
// Hold the data of the term.
[2206] Fix | Delete
$term_data = array();
[2207] Fix | Delete
[2208] Fix | Delete
$term = get_term( $term_id, $content_struct['taxonomy'] );
[2209] Fix | Delete
[2210] Fix | Delete
if ( is_wp_error( $term ) ) {
[2211] Fix | Delete
return new IXR_Error( 500, $term->get_error_message() );
[2212] Fix | Delete
}
[2213] Fix | Delete
[2214] Fix | Delete
if ( ! $term ) {
[2215] Fix | Delete
return new IXR_Error( 404, __( 'Invalid term ID.' ) );
[2216] Fix | Delete
}
[2217] Fix | Delete
[2218] Fix | Delete
if ( ! current_user_can( 'edit_term', $term_id ) ) {
[2219] Fix | Delete
return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this term.' ) );
[2220] Fix | Delete
}
[2221] Fix | Delete
[2222] Fix | Delete
if ( isset( $content_struct['name'] ) ) {
[2223] Fix | Delete
$term_data['name'] = trim( $content_struct['name'] );
[2224] Fix | Delete
[2225] Fix | Delete
if ( empty( $term_data['name'] ) ) {
[2226] Fix | Delete
return new IXR_Error( 403, __( 'The term name cannot be empty.' ) );
[2227] Fix | Delete
}
[2228] Fix | Delete
}
[2229] Fix | Delete
[2230] Fix | Delete
if ( ! empty( $content_struct['parent'] ) ) {
[2231] Fix | Delete
if ( ! $taxonomy['hierarchical'] ) {
[2232] Fix | Delete
return new IXR_Error( 403, __( 'Cannot set parent term, taxonomy is not hierarchical.' ) );
[2233] Fix | Delete
}
[2234] Fix | Delete
[2235] Fix | Delete
$parent_term_id = (int) $content_struct['parent'];
[2236] Fix | Delete
$parent_term = get_term( $parent_term_id, $taxonomy['name'] );
[2237] Fix | Delete
[2238] Fix | Delete
if ( is_wp_error( $parent_term ) ) {
[2239] Fix | Delete
return new IXR_Error( 500, $parent_term->get_error_message() );
[2240] Fix | Delete
}
[2241] Fix | Delete
[2242] Fix | Delete
if ( ! $parent_term ) {
[2243] Fix | Delete
return new IXR_Error( 403, __( 'Parent term does not exist.' ) );
[2244] Fix | Delete
}
[2245] Fix | Delete
[2246] Fix | Delete
$term_data['parent'] = $content_struct['parent'];
[2247] Fix | Delete
}
[2248] Fix | Delete
[2249] Fix | Delete
if ( isset( $content_struct['description'] ) ) {
[2250] Fix | Delete
$term_data['description'] = $content_struct['description'];
[2251] Fix | Delete
}
[2252] Fix | Delete
[2253] Fix | Delete
if ( isset( $content_struct['slug'] ) ) {
[2254] Fix | Delete
$term_data['slug'] = $content_struct['slug'];
[2255] Fix | Delete
}
[2256] Fix | Delete
[2257] Fix | Delete
$term = wp_update_term( $term_id, $taxonomy['name'], $term_data );
[2258] Fix | Delete
[2259] Fix | Delete
if ( is_wp_error( $term ) ) {
[2260] Fix | Delete
return new IXR_Error( 500, $term->get_error_message() );
[2261] Fix | Delete
}
[2262] Fix | Delete
[2263] Fix | Delete
if ( ! $term ) {
[2264] Fix | Delete
return new IXR_Error( 500, __( 'Sorry, editing the term failed.' ) );
[2265] Fix | Delete
}
[2266] Fix | Delete
[2267] Fix | Delete
// Update term meta.
[2268] Fix | Delete
if ( isset( $content_struct['custom_fields'] ) ) {
[2269] Fix | Delete
$this->set_term_custom_fields( $term_id, $content_struct['custom_fields'] );
[2270] Fix | Delete
}
[2271] Fix | Delete
[2272] Fix | Delete
return true;
[2273] Fix | Delete
}
[2274] Fix | Delete
[2275] Fix | Delete
/**
[2276] Fix | Delete
* Deletes a term.
[2277] Fix | Delete
*
[2278] Fix | Delete
* @since 3.4.0
[2279] Fix | Delete
*
[2280] Fix | Delete
* @see wp_delete_term()
[2281] Fix | Delete
*
[2282] Fix | Delete
* @param array $args {
[2283] Fix | Delete
* Method arguments. Note: arguments must be ordered as documented.
[2284] Fix | Delete
*
[2285] Fix | Delete
* @type int $0 Blog ID (unused).
[2286] Fix | Delete
* @type string $1 Username.
[2287] Fix | Delete
* @type string $2 Password.
[2288] Fix | Delete
* @type string $3 Taxonomy name.
[2289] Fix | Delete
* @type int $4 Term ID.
[2290] Fix | Delete
* }
[2291] Fix | Delete
* @return true|IXR_Error True on success, IXR_Error instance on failure.
[2292] Fix | Delete
*/
[2293] Fix | Delete
public function wp_deleteTerm( $args ) {
[2294] Fix | Delete
if ( ! $this->minimum_args( $args, 5 ) ) {
[2295] Fix | Delete
return $this->error;
[2296] Fix | Delete
}
[2297] Fix | Delete
[2298] Fix | Delete
$this->escape( $args );
[2299] Fix | Delete
[2300] Fix | Delete
$username = $args[1];
[2301] Fix | Delete
$password = $args[2];
[2302] Fix | Delete
$taxonomy = $args[3];
[2303] Fix | Delete
$term_id = (int) $args[4];
[2304] Fix | Delete
[2305] Fix | Delete
$user = $this->login( $username, $password );
[2306] Fix | Delete
if ( ! $user ) {
[2307] Fix | Delete
return $this->error;
[2308] Fix | Delete
}
[2309] Fix | Delete
[2310] Fix | Delete
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
[2311] Fix | Delete
do_action( 'xmlrpc_call', 'wp.deleteTerm', $args, $this );
[2312] Fix | Delete
[2313] Fix | Delete
if ( ! taxonomy_exists( $taxonomy ) ) {
[2314] Fix | Delete
return new IXR_Error( 403, __( 'Invalid taxonomy.' ) );
[2315] Fix | Delete
}
[2316] Fix | Delete
[2317] Fix | Delete
$taxonomy = get_taxonomy( $taxonomy );
[2318] Fix | Delete
$term = get_term( $term_id, $taxonomy->name );
[2319] Fix | Delete
[2320] Fix | Delete
if ( is_wp_error( $term ) ) {
[2321] Fix | Delete
return new IXR_Error( 500, $term->get_error_message() );
[2322] Fix | Delete
}
[2323] Fix | Delete
[2324] Fix | Delete
if ( ! $term ) {
[2325] Fix | Delete
return new IXR_Error( 404, __( 'Invalid term ID.' ) );
[2326] Fix | Delete
}
[2327] Fix | Delete
[2328] Fix | Delete
if ( ! current_user_can( 'delete_term', $term_id ) ) {
[2329] Fix | Delete
return new IXR_Error( 401, __( 'Sorry, you are not allowed to delete this term.' ) );
[2330] Fix | Delete
}
[2331] Fix | Delete
[2332] Fix | Delete
$result = wp_delete_term( $term_id, $taxonomy->name );
[2333] Fix | Delete
[2334] Fix | Delete
if ( is_wp_error( $result ) ) {
[2335] Fix | Delete
return new IXR_Error( 500, $term->get_error_message() );
[2336] Fix | Delete
}
[2337] Fix | Delete
[2338] Fix | Delete
if ( ! $result ) {
[2339] Fix | Delete
return new IXR_Error( 500, __( 'Sorry, deleting the term failed.' ) );
[2340] Fix | Delete
}
[2341] Fix | Delete
[2342] Fix | Delete
return $result;
[2343] Fix | Delete
}
[2344] Fix | Delete
[2345] Fix | Delete
/**
[2346] Fix | Delete
* Retrieves a term.
[2347] Fix | Delete
*
[2348] Fix | Delete
* @since 3.4.0
[2349] Fix | Delete
*
[2350] Fix | Delete
* @see get_term()
[2351] Fix | Delete
*
[2352] Fix | Delete
* @param array $args {
[2353] Fix | Delete
* Method arguments. Note: arguments must be ordered as documented.
[2354] Fix | Delete
*
[2355] Fix | Delete
* @type int $0 Blog ID (unused).
[2356] Fix | Delete
* @type string $1 Username.
[2357] Fix | Delete
* @type string $2 Password.
[2358] Fix | Delete
* @type string $3 Taxonomy name.
[2359] Fix | Delete
* @type int $4 Term ID.
[2360] Fix | Delete
* }
[2361] Fix | Delete
* @return array|IXR_Error IXR_Error on failure, array on success, containing:
[2362] Fix | Delete
* - 'term_id'
[2363] Fix | Delete
* - 'name'
[2364] Fix | Delete
* - 'slug'
[2365] Fix | Delete
* - 'term_group'
[2366] Fix | Delete
* - 'term_taxonomy_id'
[2367] Fix | Delete
* - 'taxonomy'
[2368] Fix | Delete
* - 'description'
[2369] Fix | Delete
* - 'parent'
[2370] Fix | Delete
* - 'count'
[2371] Fix | Delete
*/
[2372] Fix | Delete
public function wp_getTerm( $args ) {
[2373] Fix | Delete
if ( ! $this->minimum_args( $args, 5 ) ) {
[2374] Fix | Delete
return $this->error;
[2375] Fix | Delete
}
[2376] Fix | Delete
[2377] Fix | Delete
$this->escape( $args );
[2378] Fix | Delete
[2379] Fix | Delete
$username = $args[1];
[2380] Fix | Delete
$password = $args[2];
[2381] Fix | Delete
$taxonomy = $args[3];
[2382] Fix | Delete
$term_id = (int) $args[4];
[2383] Fix | Delete
[2384] Fix | Delete
$user = $this->login( $username, $password );
[2385] Fix | Delete
if ( ! $user ) {
[2386] Fix | Delete
return $this->error;
[2387] Fix | Delete
}
[2388] Fix | Delete
[2389] Fix | Delete
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
[2390] Fix | Delete
do_action( 'xmlrpc_call', 'wp.getTerm', $args, $this );
[2391] Fix | Delete
[2392] Fix | Delete
if ( ! taxonomy_exists( $taxonomy ) ) {
[2393] Fix | Delete
return new IXR_Error( 403, __( 'Invalid taxonomy.' ) );
[2394] Fix | Delete
}
[2395] Fix | Delete
[2396] Fix | Delete
$taxonomy = get_taxonomy( $taxonomy );
[2397] Fix | Delete
[2398] Fix | Delete
$term = get_term( $term_id, $taxonomy->name, ARRAY_A );
[2399] Fix | Delete
[2400] Fix | Delete
if ( is_wp_error( $term ) ) {
[2401] Fix | Delete
return new IXR_Error( 500, $term->get_error_message() );
[2402] Fix | Delete
}
[2403] Fix | Delete
[2404] Fix | Delete
if ( ! $term ) {
[2405] Fix | Delete
return new IXR_Error( 404, __( 'Invalid term ID.' ) );
[2406] Fix | Delete
}
[2407] Fix | Delete
[2408] Fix | Delete
if ( ! current_user_can( 'assign_term', $term_id ) ) {
[2409] Fix | Delete
return new IXR_Error( 401, __( 'Sorry, you are not allowed to assign this term.' ) );
[2410] Fix | Delete
}
[2411] Fix | Delete
[2412] Fix | Delete
return $this->_prepare_term( $term );
[2413] Fix | Delete
}
[2414] Fix | Delete
[2415] Fix | Delete
/**
[2416] Fix | Delete
* Retrieves all terms for a taxonomy.
[2417] Fix | Delete
*
[2418] Fix | Delete
* @since 3.4.0
[2419] Fix | Delete
*
[2420] Fix | Delete
* The optional $filter parameter modifies the query used to retrieve terms.
[2421] Fix | Delete
* Accepted keys are 'number', 'offset', 'orderby', 'order', 'hide_empty', and 'search'.
[2422] Fix | Delete
*
[2423] Fix | Delete
* @see get_terms()
[2424] Fix | Delete
*
[2425] Fix | Delete
* @param array $args {
[2426] Fix | Delete
* Method arguments. Note: arguments must be ordered as documented.
[2427] Fix | Delete
*
[2428] Fix | Delete
* @type int $0 Blog ID (unused).
[2429] Fix | Delete
* @type string $1 Username.
[2430] Fix | Delete
* @type string $2 Password.
[2431] Fix | Delete
* @type string $3 Taxonomy name.
[2432] Fix | Delete
* @type array $4 Optional. Modifies the query used to retrieve posts. Accepts 'number',
[2433] Fix | Delete
* 'offset', 'orderby', 'order', 'hide_empty', and 'search'. Default empty array.
[2434] Fix | Delete
* }
[2435] Fix | Delete
* @return array|IXR_Error An associative array of terms data on success, IXR_Error instance otherwise.
[2436] Fix | Delete
*/
[2437] Fix | Delete
public function wp_getTerms( $args ) {
[2438] Fix | Delete
if ( ! $this->minimum_args( $args, 4 ) ) {
[2439] Fix | Delete
return $this->error;
[2440] Fix | Delete
}
[2441] Fix | Delete
[2442] Fix | Delete
$this->escape( $args );
[2443] Fix | Delete
[2444] Fix | Delete
$username = $args[1];
[2445] Fix | Delete
$password = $args[2];
[2446] Fix | Delete
$taxonomy = $args[3];
[2447] Fix | Delete
$filter = isset( $args[4] ) ? $args[4] : array();
[2448] Fix | Delete
[2449] Fix | Delete
$user = $this->login( $username, $password );
[2450] Fix | Delete
if ( ! $user ) {
[2451] Fix | Delete
return $this->error;
[2452] Fix | Delete
}
[2453] Fix | Delete
[2454] Fix | Delete
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
[2455] Fix | Delete
do_action( 'xmlrpc_call', 'wp.getTerms', $args, $this );
[2456] Fix | Delete
[2457] Fix | Delete
if ( ! taxonomy_exists( $taxonomy ) ) {
[2458] Fix | Delete
return new IXR_Error( 403, __( 'Invalid taxonomy.' ) );
[2459] Fix | Delete
}
[2460] Fix | Delete
[2461] Fix | Delete
$taxonomy = get_taxonomy( $taxonomy );
[2462] Fix | Delete
[2463] Fix | Delete
if ( ! current_user_can( $taxonomy->cap->assign_terms ) ) {
[2464] Fix | Delete
return new IXR_Error( 401, __( 'Sorry, you are not allowed to assign terms in this taxonomy.' ) );
[2465] Fix | Delete
}
[2466] Fix | Delete
[2467] Fix | Delete
$query = array( 'taxonomy' => $taxonomy->name );
[2468] Fix | Delete
[2469] Fix | Delete
if ( isset( $filter['number'] ) ) {
[2470] Fix | Delete
$query['number'] = absint( $filter['number'] );
[2471] Fix | Delete
}
[2472] Fix | Delete
[2473] Fix | Delete
if ( isset( $filter['offset'] ) ) {
[2474] Fix | Delete
$query['offset'] = absint( $filter['offset'] );
[2475] Fix | Delete
}
[2476] Fix | Delete
[2477] Fix | Delete
if ( isset( $filter['orderby'] ) ) {
[2478] Fix | Delete
$query['orderby'] = $filter['orderby'];
[2479] Fix | Delete
[2480] Fix | Delete
if ( isset( $filter['order'] ) ) {
[2481] Fix | Delete
$query['order'] = $filter['order'];
[2482] Fix | Delete
}
[2483] Fix | Delete
}
[2484] Fix | Delete
[2485] Fix | Delete
if ( isset( $filter['hide_empty'] ) ) {
[2486] Fix | Delete
$query['hide_empty'] = $filter['hide_empty'];
[2487] Fix | Delete
} else {
[2488] Fix | Delete
$query['get'] = 'all';
[2489] Fix | Delete
}
[2490] Fix | Delete
[2491] Fix | Delete
if ( isset( $filter['search'] ) ) {
[2492] Fix | Delete
$query['search'] = $filter['search'];
[2493] Fix | Delete
}
[2494] Fix | Delete
[2495] Fix | Delete
$terms = get_terms( $query );
[2496] Fix | Delete
[2497] Fix | Delete
if ( is_wp_error( $terms ) ) {
[2498] Fix | Delete
return new IXR_Error( 500, $terms->get_error_message() );
[2499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function