Loading class.ga-page-stats.php +1 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ class GAPageStats { protected function __clone() { } public function __wakeup() { throw new Exception("Cannot unserialize a singleton."); throw new Exception(__("Cannot unserialize a singleton.", 'ga-page-stats')); } protected static function getInstance(): GAPageStats { Loading google-analytics-page-stats.php +10 −5 Original line number Diff line number Diff line Loading @@ -17,7 +17,8 @@ require_once(GA_PAGE_STATS__PLUGIN_DIR . 'class.ga-page-stats.php'); add_action('admin_menu', 'ga_page_stats_menu'); function ga_page_stats_menu() { add_options_page('Google Analytics', 'Google Analytics', 'manage_options', add_options_page(__('Google Analytics page statistics', 'ga-page-stats'), __('Google Analytics'), 'manage_options', 'google-analytics-page-stats/options.php'); } Loading @@ -28,10 +29,14 @@ function ga_page_stats_content_filter($content) { !current_user_can('administrator')) return $content; $r = GAPageStats::getPageStats($_SERVER['REQUEST_URI']); $pv = number_format($r['pageViews']); $u = number_format($r['users']); return $content . '<span style="font-size:small;"><em>Vistas: ' . $pv . '</em> | <em>Usuarios: ' . $u . '</em> | </span>'; $page_views = number_format($r['pageViews']); $users = number_format($r['users']); $views_label = __('Views', 'ga-page-stats'); $users_label = __('Users', 'ga-page-stats'); $sep = " | "; // $ga_options['separator'] return $content . "<span style=\"font-size:small;\">" . "<em>$views_label: $page_views</em> | " . "<em>$users_label: $users</em>$sep</span>"; } register_activation_hook(__FILE__, 'ga_page_stats_activation'); Loading options.php +12 −9 Original line number Diff line number Diff line <?php $gaps_title = __('Google Analytics page statistics', 'ga-page-stats'); if (!empty($_POST['Submit'])) { check_admin_referer('ga-page-stats_options'); Loading @@ -12,18 +13,20 @@ if (!empty($_POST['Submit'])) { $update_ga_queries = array(); $update_ga_text = array(); $update_ga_queries[] = update_option('ga_page_stats_options', $ga_options); $update_ga_text[] = 'Estadísticas de página con Google Analytics'; $update_ga_text[] = $gaps_title; $i = 0; $text = ''; foreach ($update_ga_queries as $update_ga_query) { if ($update_ga_query) { $text .= '<p style="color: green;">' . $update_ga_text[$i] . ' ' . 'Actualizado' . '</p>'; $ti = $update_ga_text[$i]; $upd = __('updated', 'ga-page-stats'); $text .= "<p style=\"color: green;\">$ti $upd</p>"; } $i++; } if (empty($text)) { $text = '<p style="color: red;">' . 'Ninguna opción actualizada' . '</p>'; $msg = __('No option updated', 'ga-page-stats'); $text = "<p style=\"color: red;\">$msg</p>"; } } Loading @@ -40,10 +43,10 @@ if (!empty($text)) { <form method="post" action="<?php echo admin_url('admin.php?page='.plugin_basename(__FILE__)); ?>"> <?php wp_nonce_field('ga-page-stats_options'); ?> <div class="wrap"> <h2>Estadísticas de página con Google Analytics</h2> <h2><?php echo $gaps_title; ?></h2> <table class="form-table"> <tr> <th scope="row" valign="top">Identificador de vista</th> <th scope="row" valign="top"><?php _e('View ID', 'ga-page-stats'); ?></th> <td> <input type="text" name="view_id_text" value="<?php echo stripslashes($view_id); ?>" Loading @@ -51,7 +54,7 @@ if (!empty($text)) { </td> </tr> <tr> <th scope="row" valign="top">Archivo con llave</th> <th scope="row" valign="top"><?php _e('Key file', 'ga-page-stats'); ?></th> <td> <input type="text" name="key_file_text" value="<?php echo stripslashes($key_file); ?>" Loading @@ -60,7 +63,7 @@ if (!empty($text)) { </tr> <tr> <tr> <th scope="row" valign="top">Mostrar por omisión</th> <th scope="row" valign="top"><?php _e('Show by default', 'ga-page-stats'); ?></th> <td> <input type="checkbox" name="show_default_check" <?php if ($show_default) Loading @@ -71,7 +74,7 @@ if (!empty($text)) { </table> <p class="submit"> <input type="submit" name="Submit" class="button" value="Salvar cambios" /> value="<?php _e('Save changes', 'ga-page-stats'); ?>" /> </p> </div> </form> Loading
class.ga-page-stats.php +1 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ class GAPageStats { protected function __clone() { } public function __wakeup() { throw new Exception("Cannot unserialize a singleton."); throw new Exception(__("Cannot unserialize a singleton.", 'ga-page-stats')); } protected static function getInstance(): GAPageStats { Loading
google-analytics-page-stats.php +10 −5 Original line number Diff line number Diff line Loading @@ -17,7 +17,8 @@ require_once(GA_PAGE_STATS__PLUGIN_DIR . 'class.ga-page-stats.php'); add_action('admin_menu', 'ga_page_stats_menu'); function ga_page_stats_menu() { add_options_page('Google Analytics', 'Google Analytics', 'manage_options', add_options_page(__('Google Analytics page statistics', 'ga-page-stats'), __('Google Analytics'), 'manage_options', 'google-analytics-page-stats/options.php'); } Loading @@ -28,10 +29,14 @@ function ga_page_stats_content_filter($content) { !current_user_can('administrator')) return $content; $r = GAPageStats::getPageStats($_SERVER['REQUEST_URI']); $pv = number_format($r['pageViews']); $u = number_format($r['users']); return $content . '<span style="font-size:small;"><em>Vistas: ' . $pv . '</em> | <em>Usuarios: ' . $u . '</em> | </span>'; $page_views = number_format($r['pageViews']); $users = number_format($r['users']); $views_label = __('Views', 'ga-page-stats'); $users_label = __('Users', 'ga-page-stats'); $sep = " | "; // $ga_options['separator'] return $content . "<span style=\"font-size:small;\">" . "<em>$views_label: $page_views</em> | " . "<em>$users_label: $users</em>$sep</span>"; } register_activation_hook(__FILE__, 'ga_page_stats_activation'); Loading
options.php +12 −9 Original line number Diff line number Diff line <?php $gaps_title = __('Google Analytics page statistics', 'ga-page-stats'); if (!empty($_POST['Submit'])) { check_admin_referer('ga-page-stats_options'); Loading @@ -12,18 +13,20 @@ if (!empty($_POST['Submit'])) { $update_ga_queries = array(); $update_ga_text = array(); $update_ga_queries[] = update_option('ga_page_stats_options', $ga_options); $update_ga_text[] = 'Estadísticas de página con Google Analytics'; $update_ga_text[] = $gaps_title; $i = 0; $text = ''; foreach ($update_ga_queries as $update_ga_query) { if ($update_ga_query) { $text .= '<p style="color: green;">' . $update_ga_text[$i] . ' ' . 'Actualizado' . '</p>'; $ti = $update_ga_text[$i]; $upd = __('updated', 'ga-page-stats'); $text .= "<p style=\"color: green;\">$ti $upd</p>"; } $i++; } if (empty($text)) { $text = '<p style="color: red;">' . 'Ninguna opción actualizada' . '</p>'; $msg = __('No option updated', 'ga-page-stats'); $text = "<p style=\"color: red;\">$msg</p>"; } } Loading @@ -40,10 +43,10 @@ if (!empty($text)) { <form method="post" action="<?php echo admin_url('admin.php?page='.plugin_basename(__FILE__)); ?>"> <?php wp_nonce_field('ga-page-stats_options'); ?> <div class="wrap"> <h2>Estadísticas de página con Google Analytics</h2> <h2><?php echo $gaps_title; ?></h2> <table class="form-table"> <tr> <th scope="row" valign="top">Identificador de vista</th> <th scope="row" valign="top"><?php _e('View ID', 'ga-page-stats'); ?></th> <td> <input type="text" name="view_id_text" value="<?php echo stripslashes($view_id); ?>" Loading @@ -51,7 +54,7 @@ if (!empty($text)) { </td> </tr> <tr> <th scope="row" valign="top">Archivo con llave</th> <th scope="row" valign="top"><?php _e('Key file', 'ga-page-stats'); ?></th> <td> <input type="text" name="key_file_text" value="<?php echo stripslashes($key_file); ?>" Loading @@ -60,7 +63,7 @@ if (!empty($text)) { </tr> <tr> <tr> <th scope="row" valign="top">Mostrar por omisión</th> <th scope="row" valign="top"><?php _e('Show by default', 'ga-page-stats'); ?></th> <td> <input type="checkbox" name="show_default_check" <?php if ($show_default) Loading @@ -71,7 +74,7 @@ if (!empty($text)) { </table> <p class="submit"> <input type="submit" name="Submit" class="button" value="Salvar cambios" /> value="<?php _e('Save changes', 'ga-page-stats'); ?>" /> </p> </div> </form>