Loading google-analytics-page-stats.php +6 −5 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ */ /* Plugin Name: Google Analytics Page Stats Plugin URI: https://aztlan.fciencias.unam.mx/gitlab/google-analytics-page-stats/ Plugin URI: https://aztlan.fciencias.unam.mx/gitlab/canek/google-analytics-page-stats/ Description: This plugin offers allows to get the page stats from Google Analytics. Author: Canek Peláez Version: 0.0.1 Loading @@ -21,8 +21,11 @@ function ga_page_stats_menu() { 'google-analytics-page-stats/options.php') ; } add_filter('the_content', 'ga_page_stats_content_filter'); function ga_page_stats_content_filter($content) { if (!is_singular() || !current_user_can('administrator')) $ga_options = get_option('ga_page_stats_options'); if (!$ga_options['show_default'] || !is_singular() || !current_user_can('administrator')) return $content; $r = GAPageStats::getPageStats($_SERVER['REQUEST_URI']); $spv = number_format($r[0]); Loading @@ -31,12 +34,10 @@ function ga_page_stats_content_filter($content) { '</em> | <em>Usuarios: ' . $su . '</em> | </span>'; } add_filter('the_content', 'ga_page_stats_content_filter'); 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' => ''); $option = array('view_id' => '', 'key_file' => '', 'show_default' => false); if (is_multisite() && $network_wide) { $ms_sites = function_exists('get_sites') ? get_sites() : wp_get_sites(); Loading options.php +17 −4 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ if(!empty($_POST['Submit'])) { addslashes(trim(wp_filter_kses($_POST['view_id_text']))) : ''; $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']); $update_ga_queries = array(); $update_ga_text = array(); Loading @@ -27,6 +28,9 @@ if(!empty($_POST['Submit'])) { } $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']; if (!empty($text)) { echo '<!-- Last Action --><div id="message" ' . Loading @@ -42,7 +46,7 @@ if (!empty($text)) { <th scope="row" valign="top">Identificador de vista</th> <td> <input type="text" name="view_id_text" value="<?php echo stripslashes($ga_options['view_id']); ?>" value="<?php echo stripslashes($view_id); ?>" size="30" /> </td> </tr> Loading @@ -50,11 +54,20 @@ if (!empty($text)) { <th scope="row" valign="top">Archivo con llave</th> <td> <input type="text" name="key_file_text" value="<?php echo stripslashes($ga_options['key_file']); ?>" value="<?php echo stripslashes($key_file); ?>" size="30" /> </td> </tr> <tr> <tr> <th scope="row" valign="top">Mostrar por omisión</th> <td> <input type="checkbox" name="show_default_check" <?php if ($show_default) echo 'value="checked" checked '; ?>/> </td> </tr> <tr> </table> <p class="submit"> <input type="submit" name="Submit" class="button" Loading Loading
google-analytics-page-stats.php +6 −5 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ */ /* Plugin Name: Google Analytics Page Stats Plugin URI: https://aztlan.fciencias.unam.mx/gitlab/google-analytics-page-stats/ Plugin URI: https://aztlan.fciencias.unam.mx/gitlab/canek/google-analytics-page-stats/ Description: This plugin offers allows to get the page stats from Google Analytics. Author: Canek Peláez Version: 0.0.1 Loading @@ -21,8 +21,11 @@ function ga_page_stats_menu() { 'google-analytics-page-stats/options.php') ; } add_filter('the_content', 'ga_page_stats_content_filter'); function ga_page_stats_content_filter($content) { if (!is_singular() || !current_user_can('administrator')) $ga_options = get_option('ga_page_stats_options'); if (!$ga_options['show_default'] || !is_singular() || !current_user_can('administrator')) return $content; $r = GAPageStats::getPageStats($_SERVER['REQUEST_URI']); $spv = number_format($r[0]); Loading @@ -31,12 +34,10 @@ function ga_page_stats_content_filter($content) { '</em> | <em>Usuarios: ' . $su . '</em> | </span>'; } add_filter('the_content', 'ga_page_stats_content_filter'); 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' => ''); $option = array('view_id' => '', 'key_file' => '', 'show_default' => false); if (is_multisite() && $network_wide) { $ms_sites = function_exists('get_sites') ? get_sites() : wp_get_sites(); Loading
options.php +17 −4 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ if(!empty($_POST['Submit'])) { addslashes(trim(wp_filter_kses($_POST['view_id_text']))) : ''; $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']); $update_ga_queries = array(); $update_ga_text = array(); Loading @@ -27,6 +28,9 @@ if(!empty($_POST['Submit'])) { } $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']; if (!empty($text)) { echo '<!-- Last Action --><div id="message" ' . Loading @@ -42,7 +46,7 @@ if (!empty($text)) { <th scope="row" valign="top">Identificador de vista</th> <td> <input type="text" name="view_id_text" value="<?php echo stripslashes($ga_options['view_id']); ?>" value="<?php echo stripslashes($view_id); ?>" size="30" /> </td> </tr> Loading @@ -50,11 +54,20 @@ if (!empty($text)) { <th scope="row" valign="top">Archivo con llave</th> <td> <input type="text" name="key_file_text" value="<?php echo stripslashes($ga_options['key_file']); ?>" value="<?php echo stripslashes($key_file); ?>" size="30" /> </td> </tr> <tr> <tr> <th scope="row" valign="top">Mostrar por omisión</th> <td> <input type="checkbox" name="show_default_check" <?php if ($show_default) echo 'value="checked" checked '; ?>/> </td> </tr> <tr> </table> <p class="submit"> <input type="submit" name="Submit" class="button" Loading