function hocwp_setup_theme_body_class($classes) { $classes[] = 'front-end'; if (is_single() || is_page() || is_singular()) { $classes[] = 'hocwp-single'; } $classes[] = hocwp_get_browser(); if (!hocwp_theme_license_valid(hocwp_theme_get_license_defined_data())) { $classes[] = 'hocwp-invalid-license'; } if (is_user_logged_in()) { $classes[] = 'hocwp-user'; global $current_user; if (hocwp_is_admin($current_user)) { $classes[] = 'hocwp-user-admin'; } $classes[] = 'hocwp-user'; } else { $classes[] = 'hocwp-guest'; } $only_content = apply_filters('hocwp_body_class_only_content', false); if ($only_content) { $classes[] = 'only-content'; } return $classes; }
function hocwp_statistics_track() { if (hocwp_is_bots()) { return; } $hocwp_statistics_browser = isset($_SESSION['hocwp_statistics_browser']) ? $_SESSION['hocwp_statistics_browser'] : ''; $user_agent = $_SERVER['HTTP_USER_AGENT']; $browser = hocwp_get_browser(); $ip = hocwp_get_user_isp_ip(); $pc_ip = hocwp_get_pc_ip(); $pc_ip .= $ip . $browser . $user_agent; $transient_name = 'hocwp_statistics_%s'; $transient_name = hocwp_build_transient_name($transient_name, $pc_ip); if (false === get_transient($transient_name)) { $online = hocwp_statistics_online_real(); if ($hocwp_statistics_browser != $browser || 0 == $online) { $current_datetime = hocwp_get_current_datetime_mysql(); $user_id = 0; if (is_user_logged_in()) { $user = wp_get_current_user(); $user_id = $user->ID; } $location = hocwp_get_current_visitor_location(); $statistics_id = hocwp_statistics_add_row(HOCWP_COUNTER_TABLE_STATISTICS, $user_id, $current_datetime, $ip, $pc_ip, $browser, $location, $user_agent); $online_id = hocwp_statistics_add_row(HOCWP_COUNTER_TABLE_ONLINE, $user_id, $current_datetime, $ip, $pc_ip, $browser, $location, $user_agent); $_SESSION['hocwp_statistics_user_online'] = $online_id; $_SESSION['hocwp_statistics_browser'] = $browser; $minutes = hocwp_statistics_get_online_refresh_minute(); set_transient($transient_name, $statistics_id, $minutes * MINUTE_IN_SECONDS); } } }
function hocwp_option_page_about_content() { global $wpdb; $current_theme = wp_get_theme(); $themes = wp_get_themes(); ?> <div id="dashboard-widgets-wrap" class="hocwp server-information"> <div id="dashboard-widgets" class="metabox-holder"> <div class="postbox-container"> <?php ob_start(); ?> <table> <tbody> <tr> <td class="label">WordPress version</td> <td><?php echo hocwp_get_wp_version(); ?> </td> </tr> <tr> <td class="label">Home URL</td> <td><?php echo home_url(); ?> </td> </tr> <tr> <td class="label">Site URL</td> <td><?php bloginfo('url'); ?> </td> </tr> <tr> <td class="label">Admin email</td> <td><?php bloginfo('admin_email'); ?> </td> </tr> <tr> <td class="label">Home dir</td> <td><?php echo htmlspecialchars(ABSPATH); ?> </td> </tr> <tr> <td class="label">Content dir</td> <td><?php echo htmlspecialchars(WP_CONTENT_DIR); ?> </td> </tr> <tr> <td class="label">Plugin dir</td> <td><?php echo htmlspecialchars(WP_PLUGIN_DIR); ?> </td> </tr> <tr> <td class="label">Table prefix</td> <td><?php echo hocwp_get_table_prefix(); ?> </td> </tr> <tr> <td class="label">Active plugins</td> <td><?php echo count((array) get_option('active_plugins')); ?> </td> </tr> <tr> <td class="label">Total users</td> <td><?php echo hocwp_count_user(); ?> </td> </tr> </tbody> </table> <?php $content = ob_get_clean(); $args = array('title' => __('Your Site', 'hocwp-theme'), 'content' => $content); hocwp_field_admin_postbox($args); unset($content, $args); ob_start(); ?> <table> <tbody> <tr> <td class="label">Current theme</td> <td><?php echo $current_theme->get('Name'); ?> </td> </tr> <tr> <td class="label">Current theme author</td> <td><?php echo $current_theme->get('Author'); ?> </td> </tr> <tr> <td class="label">Current theme URL</td> <td><?php echo $current_theme->get('AuthorURI'); ?> </td> </tr> <tr> <td class="label">Installed</td> <td><?php echo count($themes); ?> </td> </tr> <tr> <td class="label">Core version</td> <td><?php echo HOCWP_VERSION; ?> </td> </tr> <tr> <td class="label">Theme core version</td> <td><?php echo HOCWP_THEME_CORE_VERSION; ?> </td> </tr> </tbody> </table> <?php $content = ob_get_clean(); $args = array('title' => __('Theme', 'hocwp-theme'), 'content' => $content); hocwp_field_admin_postbox($args); unset($content, $args, $themes, $current_theme); ?> </div> <div class="postbox-container"> <?php ob_start(); ?> <table> <tbody> <tr> <td class="label">PHP version</td> <td><?php echo phpversion(); ?> </td> </tr> <tr> <td class="label">MySQL version</td> <td><?php echo $wpdb->db_version(); ?> </td> </tr> <tr> <td class="label">Server software</td> <td><?php echo hocwp_get_web_server(); ?> </td> </tr> <tr> <td class="label">Server OS</td> <td><?php echo implode(' ', hocwp_get_computer_info()); ?> </td> </tr> <tr> <td class="label">Peak memory usage</td> <td><?php echo hocwp_size_converter(hocwp_get_peak_memory_usage()); ?> </td> </tr> <tr> <td class="label">Current memory usage</td> <td><?php echo hocwp_size_converter(hocwp_get_memory_usage()); ?> </td> </tr> <tr> <td class="label">Memory limit</td> <td><?php echo hocwp_get_memory_limit(); ?> </td> </tr> <tr> <td class="label">Curl version</td> <td><?php echo hocwp_get_curl_version(); ?> </td> </tr> </tbody> </table> <hr> <a onclick="window.open('<?php echo HOCWP_THEME_INC_URL; ?> /views/phpinfo.php', 'PHPInfo', 'width=800, height=600, scrollbars=1'); return false;" href="#" class="button-primary">PHP Info</a> <?php $content = ob_get_clean(); $args = array('title' => __('Server Info', 'hocwp-theme'), 'content' => $content); hocwp_field_admin_postbox($args); unset($args, $content); ob_start(); ?> <table> <tbody> <tr> <td class="label">Browser</td> <td><?php echo hocwp_uppercase_first_char_words(hocwp_get_browser()); ?> </td> </tr> <tr> <td class="label">User Agent</td> <td><?php echo $_SERVER['HTTP_USER_AGENT']; ?> </td> </tr> <tr> <td class="label">IP Address</td> <td><?php echo hocwp_get_ip_address(); ?> </td> </tr> </tbody> </table> <?php $content = ob_get_clean(); $args = array('title' => __('Client Info', 'hocwp-theme'), 'content' => $content); hocwp_field_admin_postbox($args); ?> </div> </div> </div> <?php unset($current_theme, $args, $content); }