/** * Retrieves contest data. */ function get_data() { $orderby = 'url'; $order = 'asc'; if (isset($_GET['orderby'])) { $param = $_GET['orderby']; if ($param == 'error_url') { $orderby = 'url'; } elseif ($param == 'client_ip') { $orderby = 'ip'; } elseif ($param == 'error_date') { $orderby = 'date'; } else { $orderby = 'url'; } } if (isset($_GET['order'])) { $order = $_GET['order']; } $dm = '0'; $ft = '0'; if (isset($_GET['dm'])) { $dm = $_GET['dm']; } if (isset($_GET['ft'])) { $ft = $_GET['ft']; } $data = WSW_Model_Log::get_all($orderby, $order, $this->get_pagenum(), $this->per_page, $dm, $ft); $this->found_posts = WSW_Model_Log::$found_count; return $data; }
/** * Constructor */ protected function __construct() { self::$plugin_dir = plugin_dir_path(__FILE__); self::$plugin_url = plugins_url('', __FILE__); self::$plugin_name = plugin_basename(__FILE__); WSW_Settings::get_options(); if (WSW_Main::$settings['wsw_initial_dt'] == '') { $options = WSW_Main::$settings; $options['wsw_initial_dt'] = time(); WSW_Settings::update_options($options); } // create tables for plugin work WSW_Model_Log::create_table(); $this->register_hook_callbacks(); $this->modules = array('WSW_Dashboard' => WSW_Dashboard::get_instance(), 'WSW_Show' => WSW_Show::get_instance()); }
/** Get all Products */ public static function get_all($orderby, $order, $pagenum, $per_page, $dm, $ft) { global $wpdb; $limit = ($pagenum - 1) * $per_page; $query = 'SELECT * FROM ' . self::table_name . ' '; // filtering $filter = ''; if ($dm != '0') { $current_time = date("Y-m-d h:i a"); $local_time = strtotime($current_time) + intval(get_option('gmt_offset')) * 60 * 60; $start_date = date('Y-m-d', $local_time); list($year, $month, $day) = explode('-', $start_date); if ($dm == 'last_month') { $month = intval($month) - 1; } elseif ($dm == 'last_month_3') { $month = intval($month) - 3; } elseif ($dm == 'last_month_6') { $month = intval($month) - 6; } elseif ($dm == 'last_year') { $year = intval($year) - 1; } if ($month <= 0) { $month = intval($month) + 12; $year = $year - 1; } $compare_date = sprintf("%04d-%02d-00", $year, $month); $filter .= "where date >= '{$compare_date}' "; } if ($ft != '0') { if ($dm != '0') { $filter .= "and status = '{$ft}' "; } else { $filter .= "where status = '{$ft}' "; } } $query1 = 'Select count(*) from ' . self::table_name . ' ' . $filter; self::$found_count = $wpdb->get_var($query1); $query .= $filter; $query .= 'ORDER BY ' . $orderby . ' ' . $order . ' '; $query .= 'LIMIT ' . $limit . ',' . $per_page . ';'; $results = $wpdb->get_results($query, ARRAY_A); if (!is_array($results)) { $results = array(); self::$found_count = 0; return $results; } return $results; }
/** * Creates the markup for the Dashboard page */ public function markup_dashboard_page() { WSW_Main::markup_settings_header(); if (current_user_can(WSW_Main::REQUIRED_CAPABILITY)) { $variables = array(); $variables['chk_keyword_to_titles'] = WSW_Main::$settings['chk_keyword_to_titles']; $variables['chk_tweak_permalink'] = WSW_Main::$settings['chk_tweak_permalink']; $variables['chk_nofollow_in_external'] = WSW_Main::$settings['chk_nofollow_in_external']; $variables['chk_nofollow_in_image'] = WSW_Main::$settings['chk_nofollow_in_image']; $variables['chk_use_facebook'] = WSW_Main::$settings['chk_use_facebook']; $variables['chk_use_twitter'] = WSW_Main::$settings['chk_use_twitter']; $variables['chk_use_meta_robot'] = WSW_Main::$settings['chk_use_meta_robot']; $variables['chk_use_richsnippets'] = WSW_Main::$settings['chk_use_richsnippets']; $variables['chk_keyword_decorate_bold'] = WSW_Main::$settings['chk_keyword_decorate_bold']; $variables['chk_keyword_decorate_italic'] = WSW_Main::$settings['chk_keyword_decorate_italic']; $variables['chk_keyword_decorate_underline'] = WSW_Main::$settings['chk_keyword_decorate_underline']; $variables['chk_make_sitemap'] = WSW_Main::$settings['chk_make_sitemap']; $variables['opt_keyword_decorate_bold_type'] = WSW_Main::$settings['opt_keyword_decorate_bold_type']; $variables['opt_keyword_decorate_italic_type'] = WSW_Main::$settings['opt_keyword_decorate_italic_type']; $variables['opt_keyword_decorate_underline_type'] = WSW_Main::$settings['opt_keyword_decorate_underline_type']; $variables['opt_image_alternate_type'] = WSW_Main::$settings['opt_image_alternate_type']; $variables['opt_image_title_type'] = WSW_Main::$settings['opt_image_title_type']; $variables['txt_image_alternate'] = WSW_Main::$settings['txt_image_alternate']; $variables['txt_image_title'] = WSW_Main::$settings['txt_image_title']; $variables['chk_use_headings_h1'] = WSW_Main::$settings['chk_use_headings_h1']; $variables['chk_use_headings_h2'] = WSW_Main::$settings['chk_use_headings_h2']; $variables['chk_use_headings_h3'] = WSW_Main::$settings['chk_use_headings_h3']; $variables['chk_tagging_using_google'] = WSW_Main::$settings['chk_tagging_using_google']; $variables['txt_generic_tags'] = WSW_Main::$settings['txt_generic_tags']; $variables['chk_author_linking'] = WSW_Main::$settings['chk_author_linking']; $variables['chk_block_login_page'] = WSW_Main::$settings['chk_block_login_page']; $variables['chk_block_admin_page'] = WSW_Main::$settings['chk_block_admin_page']; $variables['lsi_bing_api_key'] = WSW_Main::$settings['lsi_bing_api_key']; $variables['first_tab'] = 'tab1'; if ($_GET['action'] == 'Trash') { WSW_Model_Log::remove_record($_GET['book']); $variables['first_tab'] = 'tab4'; } else { if ($_GET['paged']) { $variables['first_tab'] = 'tab4'; } } if ($_POST['page'] == 'wsw_log_404') { if ($_POST['log404']) { foreach ($_POST['log404'] as $log404) { WSW_Model_Log::remove_record($log404); } } $variables['first_tab'] = 'tab4'; } echo self::render_template('global-settings/page-dashboard.php', $variables); } else { wp_die('Access denied.'); } }