WordPressを読む 10-17 /blog/wp-includes/functions.php 17
2014/11/29
目次
/blog/wp-includes/functions.php 17
読込元 : /blog/wp-settings.php
読込元 : /blog/wp-load.php
関数
is_lighttpd_before_150()
1 2 3 4 5 6 7 8 9 10 11 12 | /** * Is the server running earlier than 1.5.0 version of lighttpd? * * @since 2.5.0 * * @return bool Whether the server is running lighttpd < 1.5.0. */ function is_lighttpd_before_150() { $server_parts = explode( '/', isset( $_SERVER['SERVER_SOFTWARE'] )? $_SERVER['SERVER_SOFTWARE'] : '' ); $server_parts[1] = isset( $server_parts[1] )? $server_parts[1] : ''; return 'lighttpd' == $server_parts[0] && -1 == version_compare( $server_parts[1], '1.5.0' ); } |
関数
apache_mod_loaded()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | /** * Does the specified module exist in the Apache config? * * @since 2.5.0 * * @param string $mod The module, e.g. mod_rewrite. * @param bool $default Optional. The default return value if the module is not found. Default false. * @return bool Whether the specified module is loaded. */ function apache_mod_loaded($mod, $default = false) { global $is_apache; if ( !$is_apache ) return false; if ( function_exists( 'apache_get_modules' ) ) { $mods = apache_get_modules(); if ( in_array($mod, $mods) ) return true; } elseif ( function_exists( 'phpinfo' ) && false === strpos( ini_get( 'disable_functions' ), 'phpinfo' ) ) { ob_start(); phpinfo(8); $phpinfo = ob_get_clean(); if ( false !== strpos($phpinfo, $mod) ) return true; } return $default; } |
関数
iis7_supports_permalinks()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | /** * Check if IIS 7+ supports pretty permalinks. * * @since 2.8.0 * * @return bool Whether IIS7 supports permalinks. */ function iis7_supports_permalinks() { global $is_iis7; $supports_permalinks = false; if ( $is_iis7 ) { /* First we check if the DOMDocument class exists. If it does not exist, then we cannot * easily update the xml configuration file, hence we just bail out and tell user that * pretty permalinks cannot be used. * * Next we check if the URL Rewrite Module 1.1 is loaded and enabled for the web site. When * URL Rewrite 1.1 is loaded it always sets a server variable called 'IIS_UrlRewriteModule'. * Lastly we make sure that PHP is running via FastCGI. This is important because if it runs * via ISAPI then pretty permalinks will not work. */ $supports_permalinks = class_exists('DOMDocument') && isset($_SERVER['IIS_UrlRewriteModule']) && ( php_sapi_name() == 'cgi-fcgi' ); } /** * Filter whether IIS 7+ supports pretty permalinks. * * @since 2.8.0 * * @param bool $supports_permalinks Whether IIS7 supports permalinks. Default false. */ return apply_filters( 'iis7_supports_permalinks', $supports_permalinks ); } |
関数
validate_file()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | /** * File validates against allowed set of defined rules. * * A return value of '1' means that the $file contains either '..' or './'. A * return value of '2' means that the $file contains ':' after the first * character. A return value of '3' means that the file is not in the allowed * files list. * * @since 1.2.0 * * @param string $file File path. * @param array $allowed_files List of allowed files. * @return int 0 means nothing is wrong, greater than 0 means something was wrong. */ function validate_file( $file, $allowed_files = '' ) { if ( false !== strpos( $file, '..' ) ) return 1; if ( false !== strpos( $file, './' ) ) return 1; if ( ! empty( $allowed_files ) && ! in_array( $file, $allowed_files ) ) return 3; if (':' == substr( $file, 1, 1 ) ) return 2; return 0; } |
関数
is_ssl()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /** * Determine if SSL is used. * * @since 2.6.0 * * @return bool True if SSL, false if not used. */ function is_ssl() { if ( isset($_SERVER['HTTPS']) ) { if ( 'on' == strtolower($_SERVER['HTTPS']) ) return true; if ( '1' == $_SERVER['HTTPS'] ) return true; } elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) { return true; } return false; } |
関数
force_ssl_login()
1 2 3 4 5 6 7 8 9 10 11 12 13 | /** * Whether SSL login should be forced. * * @since 2.6.0 * * @see force_ssl_admin() * * @param string|bool $force Optional Whether to force SSL login. Default null. * @return bool True if forced, false if not forced. */ function force_ssl_login( $force = null ) { return force_ssl_admin( $force ); } |
関数
force_ssl_admin()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /** * Whether to force SSL used for the Administration Screens. * * @since 2.6.0 * * @param string|bool $force Optional. Whether to force SSL in admin screens. Default null. * @return bool True if forced, false if not forced. */ function force_ssl_admin( $force = null ) { static $forced = false; if ( !is_null( $force ) ) { $old_forced = $forced; $forced = $force; return $old_forced; } return $forced; } |