Loading ga-page-stats.php +9 −2 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ Description: This plugin allows to get the page stats from Google Analytics. Author: Canek Peláez Version: 0.0.1 Author URI: https://aztlan.fciencias.unam.mx/~canek/ Text Domain: ga-page-stats */ define('GA_PAGE_STATS__PLUGIN_DIR', plugin_dir_path(__FILE__)); Loading @@ -33,7 +34,7 @@ function ga_page_stats_content_filter($content) { $users = number_format($r['users']); $views_label = __('Views', 'ga-page-stats'); $users_label = __('Users', 'ga-page-stats'); $sep = " | "; // $ga_options['separator'] $sep = $ga_options['separator'] ? " | " : ""; return $content . "<span style=\"font-size:small;\">" . "<em>$views_label: $page_views</em> | " . "<em>$users_label: $users</em>$sep</span>"; Loading @@ -42,7 +43,8 @@ function ga_page_stats_content_filter($content) { register_activation_hook(__FILE__, 'ga_page_stats_activation'); function ga_page_stats_activation($network_wide) { $option_name = 'ga_page_stats_options'; $option = array('view_id' => '', 'key_file' => '', 'show_default' => false); $option = array('view_id' => '', 'key_file' => '', 'show_default' => false, 'separator' => false); if (is_multisite() && $network_wide) { $ms_sites = function_exists('get_sites') ? get_sites() : wp_get_sites(); Loading @@ -60,3 +62,8 @@ function ga_page_stats_activation($network_wide) { add_option($option_name, $option); } } add_action('plugins_loaded', 'ga_page_stats_load_textdomain'); function ga_page_stats_load_textdomain() { load_plugin_textdomain('ga-page-stats'); } options.php +11 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ if (!empty($_POST['Submit'])) { $ga_options['key_file'] = !empty($_POST['key_file_text']) ? addslashes(trim(wp_filter_kses($_POST['key_file_text']))) : ''; $ga_options['show_default'] = !empty($_POST['show_default_check']); $ga_options['separator'] = !empty($_POST['separator_check']); $update_ga_queries = array(); $update_ga_text = array(); Loading @@ -34,6 +35,7 @@ $ga_options = get_option('ga_page_stats_options'); $view_id = $ga_options['view_id']; $key_file = $ga_options['key_file']; $show_default = $ga_options['show_default']; $separator = $ga_options['separator']; if (!empty($text)) { echo '<!-- Last Action --><div id="message" ' . Loading Loading @@ -71,6 +73,15 @@ if (!empty($text)) { </td> </tr> <tr> <tr> <th scope="row" valign="top"><?php _e('Show separator', 'ga-page-stats'); ?></th> <td> <input type="checkbox" name="separator_check" <?php if ($separator) echo 'value="checked" checked '; ?>/> </td> </tr> <tr> </table> <p class="submit"> <input type="submit" name="Submit" class="button" Loading Loading
ga-page-stats.php +9 −2 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ Description: This plugin allows to get the page stats from Google Analytics. Author: Canek Peláez Version: 0.0.1 Author URI: https://aztlan.fciencias.unam.mx/~canek/ Text Domain: ga-page-stats */ define('GA_PAGE_STATS__PLUGIN_DIR', plugin_dir_path(__FILE__)); Loading @@ -33,7 +34,7 @@ function ga_page_stats_content_filter($content) { $users = number_format($r['users']); $views_label = __('Views', 'ga-page-stats'); $users_label = __('Users', 'ga-page-stats'); $sep = " | "; // $ga_options['separator'] $sep = $ga_options['separator'] ? " | " : ""; return $content . "<span style=\"font-size:small;\">" . "<em>$views_label: $page_views</em> | " . "<em>$users_label: $users</em>$sep</span>"; Loading @@ -42,7 +43,8 @@ function ga_page_stats_content_filter($content) { register_activation_hook(__FILE__, 'ga_page_stats_activation'); function ga_page_stats_activation($network_wide) { $option_name = 'ga_page_stats_options'; $option = array('view_id' => '', 'key_file' => '', 'show_default' => false); $option = array('view_id' => '', 'key_file' => '', 'show_default' => false, 'separator' => false); if (is_multisite() && $network_wide) { $ms_sites = function_exists('get_sites') ? get_sites() : wp_get_sites(); Loading @@ -60,3 +62,8 @@ function ga_page_stats_activation($network_wide) { add_option($option_name, $option); } } add_action('plugins_loaded', 'ga_page_stats_load_textdomain'); function ga_page_stats_load_textdomain() { load_plugin_textdomain('ga-page-stats'); }
options.php +11 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ if (!empty($_POST['Submit'])) { $ga_options['key_file'] = !empty($_POST['key_file_text']) ? addslashes(trim(wp_filter_kses($_POST['key_file_text']))) : ''; $ga_options['show_default'] = !empty($_POST['show_default_check']); $ga_options['separator'] = !empty($_POST['separator_check']); $update_ga_queries = array(); $update_ga_text = array(); Loading @@ -34,6 +35,7 @@ $ga_options = get_option('ga_page_stats_options'); $view_id = $ga_options['view_id']; $key_file = $ga_options['key_file']; $show_default = $ga_options['show_default']; $separator = $ga_options['separator']; if (!empty($text)) { echo '<!-- Last Action --><div id="message" ' . Loading Loading @@ -71,6 +73,15 @@ if (!empty($text)) { </td> </tr> <tr> <tr> <th scope="row" valign="top"><?php _e('Show separator', 'ga-page-stats'); ?></th> <td> <input type="checkbox" name="separator_check" <?php if ($separator) echo 'value="checked" checked '; ?>/> </td> </tr> <tr> </table> <p class="submit"> <input type="submit" name="Submit" class="button" Loading