WordPressを読む 10-13 /blog/wp-includes/functions.php 13
2014/11/29
目次
/blog/wp-includes/functions.php 13
読込元 : /blog/wp-settings.php
読込元 : /blog/wp-load.php
関数
_xmlrpc_wp_die_handler()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | /** * Kill WordPress execution and display XML message with error message. * * This is the handler for wp_die when processing XMLRPC requests. * * @since 3.2.0 * @access private * * @param string $message Error message. * @param string $title Optional. Error title. Default empty. * @param string|array $args Optional. Arguments to control behavior. Default empty array. */ function _xmlrpc_wp_die_handler( $message, $title = '', $args = array() ) { global $wp_xmlrpc_server; $defaults = array( 'response' => 500 ); $r = wp_parse_args($args, $defaults); if ( $wp_xmlrpc_server ) { $error = new IXR_Error( $r['response'] , $message); $wp_xmlrpc_server->output( $error->getXml() ); } die(); } |
関数
_ajax_wp_die_handler()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /** * Kill WordPress ajax execution. * * This is the handler for wp_die when processing Ajax requests. * * @since 3.4.0 * @access private * * @param string $message Optional. Response to print. Default empty. */ function _ajax_wp_die_handler( $message = '' ) { if ( is_scalar( $message ) ) die( (string) $message ); die( '0' ); } |
関数
_scalar_wp_die_handler()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /** * Kill WordPress execution. * * This is the handler for wp_die when processing APP requests. * * @since 3.4.0 * @access private * * @param string $message Optional. Response to print. Default empty. */ function _scalar_wp_die_handler( $message = '' ) { if ( is_scalar( $message ) ) die( (string) $message ); die(); } |
関数
wp_send_json()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /** * Send a JSON response back to an Ajax request. * * @since 3.5.0 * * @param mixed $response Variable (usually an array or object) to encode as JSON, * then print and die. */ function wp_send_json( $response ) { @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) ); echo json_encode( $response ); if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) wp_die(); else die; } |
関数
wp_send_json_success()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /** * Send a JSON response back to an Ajax request, indicating success. * * @since 3.5.0 * * @param mixed $data Data to encode as JSON, then print and die. */ function wp_send_json_success( $data = null ) { $response = array( 'success' => true ); if ( isset( $data ) ) $response['data'] = $data; wp_send_json( $response ); } |
関数
wp_send_json_error()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /** * Send a JSON response back to an Ajax request, indicating failure. * * @since 3.5.0 * * @param mixed $data Data to encode as JSON, then print and die. */ function wp_send_json_error( $data = null ) { $response = array( 'success' => false ); if ( isset( $data ) ) $response['data'] = $data; wp_send_json( $response ); } |
関数
_config_wp_home()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /** * Retrieve the WordPress home page URL. * * If the constant named 'WP_HOME' exists, then it will be used and returned * by the function. This can be used to counter the redirection on your local * development environment. * * @since 2.2.0 * @access private * * @see WP_HOME * * @param string $url URL for the home location. * @return string Homepage location. */ function _config_wp_home( $url = '' ) { if ( defined( 'WP_HOME' ) ) return untrailingslashit( WP_HOME ); return $url; } |
関数
_config_wp_siteurl()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /** * Retrieve the WordPress site URL. * * If the constant named 'WP_SITEURL' is defined, then the value in that * constant will always be returned. This can be used for debugging a site * on your localhost while not having to change the database to your URL. * * @since 2.2.0 * @access private * * @see WP_SITEURL * * @param string $url URL to set the WordPress site location. * @return string The WordPress Site URL. */ function _config_wp_siteurl( $url = '' ) { if ( defined( 'WP_SITEURL' ) ) return untrailingslashit( WP_SITEURL ); return $url; } |
関数
_mce_set_direction()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | /** * Set the localized direction for MCE plugin. * * Will only set the direction to 'rtl', if the WordPress locale has * the text direction set to 'rtl'. * * Fills in the 'directionality' setting, enables the 'directionality' * plugin, and adds the 'ltr' button to 'toolbar1', formerly * 'theme_advanced_buttons1' array keys. These keys are then returned * in the $input (TinyMCE settings) array. * * @since 2.1.0 * @access private * * @param array $input MCE settings array. * @return array Direction set for 'rtl', if needed by locale. */ function _mce_set_direction( $input ) { if ( is_rtl() ) { $input['directionality'] = 'rtl'; $input['plugins'] .= ',directionality'; $input['toolbar1'] .= ',ltr'; } return $input; } |