Changeset 386209
- Timestamp:
- 05/18/2011 09:47:55 AM (15 years ago)
- Location:
- piwikcounter/trunk
- Files:
-
- 4 edited
-
class.PiwikCounterAdministration.php (modified) (3 diffs)
-
class.PiwikCounterWidget.php (modified) (1 diff)
-
class.Visitors.php (modified) (1 diff)
-
piwikcounter.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
piwikcounter/trunk/class.PiwikCounterAdministration.php
r385726 r386209 21 21 if (!current_user_can('manage_options')) 22 22 { 23 wp_die( __('You do not have sufficient permissions to access this page.' ) );23 wp_die( __('You do not have sufficient permissions to access this page.', 'piwikcounter') ); 24 24 } 25 25 … … 32 32 update_option( 'piwikcounter_unique_visitors', $_POST[ 'unique_visitors' ] ); 33 33 34 if (isset($_POST[ 'visits_today_visible' ]) && ($_POST[ 'visits_today_visible' ] == 1)) { 35 update_option( 'piwikcounter_visits_today_visible', $_POST[ 'visits_today_visible' ] ); 36 } 37 else 38 { 39 update_option( 'piwikcounter_visits_today_visible', 0 ); 40 } 41 42 $visitors = new Visitors(); 43 $visitors->updateYesterdayVisitors(); 44 34 45 ?> 35 46 <div id="message" class="updated fade"><p><strong><?php _e('Options saved.') ?></strong></p></div> … … 40 51 echo '<div class="wrap">'; 41 52 echo '<div id="icon-options-general" class="icon32"><br /></div>'; 42 echo "<h2>" . __( 'PiwikCounter Settings', ' PiwikCounter' ) . "</h2>";53 echo "<h2>" . __( 'PiwikCounter Settings', 'piwikcounter' ) . "</h2>"; 43 54 44 55 ?> 45 46 56 47 57 <form name="piwik_counter_administration" method="post" action=""> 48 58 49 <b>Piwik installation: </b><input type="text" name="piwik_url" value="<?php echo get_option('piwikcounter_piwik_url') ?>" /> (http://domain.tld)<br /> 50 <b>Site ID: </b><input type="text" name="site_id" value="<?php echo get_option('piwikcounter_site_id') ?>" /><br /> 51 <b>Authorisation Key: </b><input type="text" name="auth_key" value="<?php echo get_option('piwikcounter_auth_key') ?>" /><br /> 59 <table class="form-table"> 60 <tr valign="top"> 61 <th scope="row"><?php _e("Piwik installation", 'piwikcounter'); ?></th> 62 <td> 63 <input type="text" size="40" name="piwik_url" value="<?php echo get_option('piwikcounter_piwik_url') ?>" /> (http://domain.tld) 64 </td> 65 </tr> 66 67 <tr valign="top"> 68 <th scope="row"><?php _e("Site ID", 'piwikcounter'); ?></th> 69 <td> 70 <input type="text" size="40" name="site_id" value="<?php echo get_option('piwikcounter_site_id') ?>" /> 71 </td> 72 </tr> 73 74 <tr valign="top"> 75 <th scope="row"><?php _e("Authorisation Key", 'piwikcounter'); ?></th> 76 <td> 77 <input type="text" size="40" name="auth_key" value="<?php echo get_option('piwikcounter_auth_key') ?>" /> 78 </td> 79 </tr> 52 80 53 <b>Start Date: </b><input type="text" name="start_date" value="<?php echo get_option('piwikcounter_start_date') ?>" /> (YYYY-MM-DD)<br /> 81 <tr valign="top"> 82 <th scope="row"><?php _e("Start date", 'piwikcounter'); ?></th> 83 <td> 84 <input type="text" size="10" name="start_date" value="<?php echo get_option('piwikcounter_start_date') ?>" /> (YYYY-MM-DD) 85 </td> 86 </tr> 54 87 55 <select name="unique_visitors"> 56 <option value="1" <?php if (get_option('piwikcounter_unique_visitors') == 1) { echo 'selected="selected"'; } ?>>unique visitors</option> 57 <option value="0" <?php if (get_option('piwikcounter_unique_visitors') == 0) { echo 'selected="selected"'; } ?>>all visits</option> 58 </select><br /> 59 88 <tr valign="top"> 89 <th scope="row"><?php _e("Type of visits", 'piwikcounter'); ?></th> 90 <td> 91 <input type="radio" name="unique_visitors" value="1" 92 <?php if (get_option('piwikcounter_unique_visitors') == 1) { echo 'checked="checked"'; } ?> /> unique visitors<br /> 93 <input type="radio" name="unique_visitors" value="0" 94 <?php if (get_option('piwikcounter_unique_visitors') == 0) { echo 'checked="checked"'; } ?> /> all visits 95 </td> 96 </tr> 97 98 <tr valign="top"> 99 <th scope="row"><?php _e("Todays visitors", 'piwikcounter'); ?></th> 100 <td> 101 <input type="checkbox" name="visits_today_visible" value="1" 102 <?php if (get_option('piwikcounter_visits_today_visible') == 1) { echo 'checked="checked"'; } ?> /> 103 <?php _e("Show todays visitors", 'piwikcounter'); ?> 104 </td> 105 </tr> 106 </table> 107 60 108 <p><input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" /></p> 61 109 -
piwikcounter/trunk/class.PiwikCounterWidget.php
r385726 r386209 48 48 49 49 echo $before_widget; 50 51 echo '<!-- PiwikCounter -->'; 52 50 53 if ( $title ) { echo $before_title . $title . $after_title; } 51 54 55 echo '<div id="piwikcounter_widget" style="text-align: center;">'; 56 52 57 // Output complete amount of visitors since the specified date 53 echo '<div style="text-align: center;">'; 54 printf ( __( "%d visitors<br/>since" ), $all_visits); 58 if($all_visits == 0) 59 { 60 echo __("0<br/>visitors since", 'piwikcounter'); 61 } 62 else 63 { 64 printf( _n( "%d<br/>visitor since", "%d<br/>visitors since", $all_visits, 'piwikcounter' ), $all_visits); 65 } 66 67 setlocale(LC_TIME, WPLANG); 68 echo strftime(" %B %Y", strtotime(get_option('piwikcounter_start_date'))) .'<br/>'; 69 //echo date(" F Y", strtotime(get_option('piwikcounter_start_date')) ) .'<br/>'; 55 70 56 71 // Output amount of visitors who came today 57 echo date(" F Y", strtotime(get_option('piwikcounter_start_date')) ) .'<br/>'; 58 printf ( __( "%d<br/>visits today" ), $visits_today ); 72 if(get_option("piwikcounter_visits_today_visible") == 1) 73 { 74 if($visits_today == 0) 75 { 76 echo __("0<br/>visits today", 'piwikcounter'); 77 } 78 else 79 { 80 printf(_n("%d<br/>visit today", "%d<br/>visits today", $visits_today, 'piwikcounter'), $visits_today); 81 } 82 } 59 83 60 84 echo '</div>'; 61 85 86 echo '<!-- End PiwikCounter -->'; 62 87 echo $after_widget; 63 88 } -
piwikcounter/trunk/class.Visitors.php
r385726 r386209 56 56 // Get Visitors from Piwik 57 57 $visitors_yesterday = $this->getVisitors( get_option('piwikcounter_start_date'), get_option('piwikcounter_piwik_url'), get_option('piwikcounter_site_id'), get_option('piwikcounter_auth_key'), get_option('piwikcounter_unique_visitors') ); 58 59 echo '<!--' .$visitors_yesterday .' -->';60 58 61 59 // Update -
piwikcounter/trunk/piwikcounter.php
r385726 r386209 32 32 add_option( 'piwikcounter_visitors_yesterday', '', '', 'yes' ); // quantity of visitors until yesterday 33 33 add_option( 'piwikcounter_visitors_last_change', '2000-01-01', '', 'yes' ); // last modification date of piwikcounter_visitors_yesterday (date YYYY-MM-DD) 34 add_option( 'piwikcounter_visits_today_visible', '1', '', 'yes' ); // enables visability of visits for today 34 35 35 36 $pca = new PiwikCounterAdministration();
Note: See TracChangeset
for help on using the changeset viewer.