$is_username = false; if (hocwp_id_number_valid($user_id)) { $user = get_user_by('id', $user_id); if ($author == $user->user_login) { $is_username = true; } } if (!$is_username) { $author = hocwp_uppercase_first_char_words($author); } } } return $author; } add_filter('get_comment_author', 'hocwp_setup_theme_get_comment_author', 10, 3); if ($maintenance_mode && !hocwp_maintenance_mode_exclude_condition()) { add_action('admin_notices', 'hocwp_setup_theme_in_maintenance_mode_notice'); add_action('init', 'hocwp_theme_maintenance_mode'); add_action('hocwp_maintenance_head', 'hocwp_setup_theme_maintenance_head'); add_action('hocwp_maintenance', 'hocwp_setup_theme_maintenance'); add_action('wp_enqueue_scripts', 'hocwp_setup_theme_maintenance_scripts'); add_filter('body_class', 'hocwp_setup_theme_maintenance_body_class'); } function hocwp_setup_theme_allow_shortcode_in_comment() { $options = get_option('hocwp_discussion'); $allow_shortcode = hocwp_get_value_by_key($options, 'allow_shortcode'); if ((bool) $allow_shortcode) { add_filter('comment_text', 'do_shortcode'); } }
function hocwp_in_maintenance_mode() { $option = get_option('hocwp_maintenance'); $result = hocwp_get_value_by_key($option, 'enabled'); $result = (bool) $result; $result = apply_filters('hocwp_enable_maintenance_mode', $result); if (hocwp_maintenance_mode_exclude_condition() || hocwp_is_login_page()) { $result = false; } return $result; }
function hocwp_theme_maintenance_mode() { if (!is_admin() && hocwp_in_maintenance_mode()) { if (!hocwp_maintenance_mode_exclude_condition()) { $charset = get_bloginfo('charset') ? get_bloginfo('charset') : 'UTF-8'; $protocol = !empty($_SERVER['SERVER_PROTOCOL']) && in_array($_SERVER['SERVER_PROTOCOL'], array('HTTP/1.1', 'HTTP/1.0')) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0'; $status_code = (int) apply_filters('hocwp_maintenance_mode_status_code', 503); nocache_headers(); ob_start(); header("Content-type: text/html; charset={$charset}"); header("{$protocol} {$status_code} Service Unavailable", true, $status_code); get_template_part('inc/views/maintenance'); ob_flush(); exit; } } }