apsw_db_helper = $apsw_db_helper; $this->apsw_options_serialized = new APSW_Options_Serialize(); } public function get_default_options() { return $this->apsw_options_serialized; } /** * Builds options page */ public function options_form() { // $all_post_types = get_post_types('', 'names'); $all_post_types = $this->apsw_db_helper->get_published_post_types(); foreach ($all_post_types as $post_type) { // if ($post_type != 'attachment' && $post_type != 'revision' && $post_type != 'nav_menu_item') { $this->post_types[] = $post_type['post_type']; // } if ($post_type['taxonomies']) { foreach ($post_type['taxonomies'] as $taxonomies) { $this->custom_taxonomy_types[] = $taxonomies['taxonomy']; } } } // $all_taxonomy_types = get_taxonomies(); // foreach ($all_post_types as $post_type) { // if ($tax_type != 'nav_menu' && $tax_type != 'category' && $tax_type != 'post_tag' && $tax_type != 'link_category' && $tax_type != 'post_format') { // $this->custom_taxonomy_types[] = $tax_type; // } // } if (empty($this->apsw_options_serialized->post_types)) { $this->apsw_options_serialized->post_types = $this->post_types; } if (isset($_POST['submit'])) { if (function_exists('current_user_can') && !current_user_can('manage_options')) { die(_e('Hacker?', APSW_Core::$text_domain)); } if (function_exists('check_admin_referer')) { check_admin_referer('stats_options_form'); } $this->apsw_options_serialized->is_stats_together = $_POST['is_stats_together']; $this->apsw_options_serialized->post_types = empty($_POST['post_types']) ? $this->post_types : $_POST['post_types']; $this->apsw_options_serialized->custom_taxonomy_types = isset($_POST['custom_taxonomy_types']) ? $_POST['custom_taxonomy_types'] : array(); $this->apsw_options_serialized->is_simple_tabs_default = isset($_POST['is_simple_tabs_default']) ? $_POST['is_simple_tabs_default'] : 0; $this->apsw_options_serialized->is_display_author_name = isset($_POST['is_display_author_name']) ? $_POST['is_display_author_name'] : 0; $this->apsw_options_serialized->is_display_author_avatar = isset($_POST['is_display_author_avatar']) ? $_POST['is_display_author_avatar'] : 0; $this->apsw_options_serialized->is_author_popular_by_post_count = isset($_POST['is_author_popular_by_post_count']) ? $_POST['is_author_popular_by_post_count'] : '1'; $this->apsw_options_serialized->is_popular_posts_by_post_views = isset($_POST['is_popular_posts_by_post_views']) ? $_POST['is_popular_posts_by_post_views'] : '1'; $this->apsw_options_serialized->popular_authors_limit = (isset($_POST['popular_authors_limit']) && intval($_POST['popular_authors_limit']) && intval($_POST['popular_authors_limit']) > 0) ? intval($_POST['popular_authors_limit']) : '10'; $this->apsw_options_serialized->is_post_view_by_ip = isset($_POST['is_post_view_by_ip']) ? $_POST['is_post_view_by_ip'] : '1'; $this->apsw_options_serialized->is_display_daily_views = isset($_POST['is_display_daily_views']) ? $_POST['is_display_daily_views'] : '0'; $this->apsw_options_serialized->popular_posts_limit = (isset($_POST['popular_posts_limit']) && intval($_POST['popular_posts_limit']) && intval($_POST['popular_posts_limit']) > 0) ? intval($_POST['popular_posts_limit']) : '10'; $this->apsw_options_serialized->active_theme_name = isset($_POST['active_theme_name']) ? $_POST['active_theme_name'] : 'smoothness'; $this->apsw_options_serialized->custom_css = $_POST['custom_css']; $this->apsw_options_serialized->apsw_tab_active_bg_color = isset($_POST['apsw_tab_active_bg_color']) ? $_POST['apsw_tab_active_bg_color'] : '#fff'; $this->apsw_options_serialized->apsw_tab_bg_color = isset($_POST['apsw_tab_bg_color']) ? $_POST['apsw_tab_bg_color'] : '#ccc'; $this->apsw_options_serialized->apsw_tab_border_color = isset($_POST['apsw_tab_border_color']) ? $_POST['apsw_tab_border_color'] : '#d4d4d1'; $this->apsw_options_serialized->apsw_tab_active_text_color = isset($_POST['apsw_tab_active_text_color']) ? $_POST['apsw_tab_active_text_color'] : '#2e7da3'; $this->apsw_options_serialized->apsw_tab_text_color = isset($_POST['apsw_tab_text_color']) ? $_POST['apsw_tab_text_color'] : '#fff'; $this->apsw_options_serialized->apsw_tab_hover_text_color = isset($_POST['apsw_tab_hover_text_color']) ? $_POST['apsw_tab_hover_text_color'] : '#21759b'; $this->apsw_options_serialized->update_options(); } ?>