PageRenderTime 52ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/public/wp-content/plugins/wp-statistics/includes/settings/tabs/wps-notifications.php

https://gitlab.com/kath.de/cibedo_cibedo.de
PHP | 201 lines | 160 code | 35 blank | 6 comment | 16 complexity | c75b80c5c9eb86595d8c6b7ad716cf40 MD5 | raw file
  1. <?php
  2. $selist = wp_statistics_searchengine_list( true );
  3. if( $wps_nonce_valid ) {
  4. // We need to handle a change in the report schedule manually, so check to see it has been set.
  5. if( array_key_exists( 'wps_time_report', $_POST ) ) {
  6. // If the report has been changed, we need to update the schedule.
  7. if( $WP_Statistics->get_option('time_report') != $_POST['wps_time_report'] ) {
  8. // Remove the old schedule if it exists.
  9. if( wp_next_scheduled('report_hook') ) {
  10. wp_unschedule_event(wp_next_scheduled('report_hook'), 'report_hook');
  11. }
  12. // Setup the new schedule, we could just let this fall through and let the code in schedule.php deal with it
  13. // but that would require an extra page load to start the schedule so do it here instead.
  14. wp_schedule_event(time(), $_POST['wps_time_report'], 'report_hook');
  15. }
  16. }
  17. $wps_option_list = array("wps_stats_report","wps_time_report","wps_send_report","wps_content_report","wps_email_list","wps_browscap_report","wps_geoip_report","wps_prune_report","wps_upgrade_report");
  18. foreach( $wps_option_list as $option ) {
  19. if( array_key_exists( $option, $_POST ) ) { $value = $_POST[$option]; } else { $value = ''; }
  20. // WordPress escapes form data no matter what the setting of magic quotes is in PHP (http://www.theblog.ca/wordpress-addslashes-magic-quotes).
  21. $value = stripslashes($value);
  22. $new_option = str_replace( "wps_", "", $option );
  23. $WP_Statistics->store_option($new_option, $value);
  24. }
  25. }
  26. ?>
  27. <script type="text/javascript">
  28. function ToggleStatOptions() {
  29. jQuery('[id^="wps_stats_report_option"]').fadeToggle();
  30. }
  31. </script>
  32. <table class="form-table">
  33. <tbody>
  34. <tr valign="top">
  35. <th scope="row" colspan="2"><h3><?php _e('Common Report Options', 'wp_statistics'); ?></h3></th>
  36. </tr>
  37. <tr valign="top">
  38. <td scope="row" style="vertical-align: top;">
  39. <label for="email-report"><?php _e('E-mail addresses', 'wp_statistics'); ?>:</label>
  40. </td>
  41. <td>
  42. <input type="text" id="email_list" name="wps_email_list" size="30" value="<?php if( $WP_Statistics->get_option('email_list') == '' ) { $WP_Statistics->store_option('email_list', get_bloginfo('admin_email')); } echo htmlentities( $WP_Statistics->get_option('email_list'), ENT_QUOTES ); ?>"/>
  43. <p class="description"><?php _e('A comma separated list of e-mail addresses to send reports to.', 'wp_statistics'); ?></p>
  44. </td>
  45. </tr>
  46. <tr valign="top">
  47. <th scope="row" colspan="2"><h3><?php _e('Update Reports', 'wp_statistics'); ?></h3></th>
  48. </tr>
  49. <tr valign="top">
  50. <td scope="row">
  51. <label for="browscap-report"><?php _e('Browscap', 'wp_statistics'); ?>:</label>
  52. </td>
  53. <td>
  54. <input id="browscap-report" type="checkbox" value="1" name="wps_browscap_report" <?php echo $WP_Statistics->get_option('browscap_report')==true? "checked='checked'":'';?>>
  55. <label for="browscap-report"><?php _e('Active', 'wp_statistics'); ?></label>
  56. <p class="description"><?php _e('Send a report whenever the browscap.ini is updated.', 'wp_statistics'); ?></p>
  57. </td>
  58. </tr>
  59. <tr valign="top">
  60. <td scope="row">
  61. <label for="geoip-report"><?php _e('GeoIP', 'wp_statistics'); ?>:</label>
  62. </td>
  63. <td>
  64. <input id="geoip-report" type="checkbox" value="1" name="wps_geoip_report" <?php echo $WP_Statistics->get_option('geoip_report')==true? "checked='checked'":'';?>>
  65. <label for="geoip-report"><?php _e('Active', 'wp_statistics'); ?></label>
  66. <p class="description"><?php _e('Send a report whenever the GeoIP database is updated.', 'wp_statistics'); ?></p>
  67. </td>
  68. </tr>
  69. <tr valign="top">
  70. <td scope="row">
  71. <label for="prune-report"><?php _e('Pruning', 'wp_statistics'); ?>:</label>
  72. </td>
  73. <td>
  74. <input id="prune-report" type="checkbox" value="1" name="wps_prune_report" <?php echo $WP_Statistics->get_option('prune_report')==true? "checked='checked'":'';?>>
  75. <label for="prune-report"><?php _e('Active', 'wp_statistics'); ?></label>
  76. <p class="description"><?php _e('Send a report whenever the pruning of database is run.', 'wp_statistics'); ?></p>
  77. </td>
  78. </tr>
  79. <tr valign="top">
  80. <td scope="row">
  81. <label for="upgrade-report"><?php _e('Upgrade', 'wp_statistics'); ?>:</label>
  82. </td>
  83. <td>
  84. <input id="upgrade-report" type="checkbox" value="1" name="wps_upgrade_report" <?php echo $WP_Statistics->get_option('upgrade_report')==true? "checked='checked'":'';?>>
  85. <label for="upgrade-report"><?php _e('Active', 'wp_statistics'); ?></label>
  86. <p class="description"><?php _e('Send a report whenever the plugin is upgraded.', 'wp_statistics'); ?></p>
  87. </td>
  88. </tr>
  89. <tr valign="top">
  90. <th scope="row" colspan="2"><h3><?php _e('Statistical reporting', 'wp_statistics'); ?></h3></th>
  91. </tr>
  92. <tr valign="top">
  93. <th scope="row">
  94. <label for="stats-report"><?php _e('Statistical reporting', 'wp_statistics'); ?>:</label>
  95. </th>
  96. <td>
  97. <input id="stats-report" type="checkbox" value="1" name="wps_stats_report" <?php echo $WP_Statistics->get_option('stats_report')==true? "checked='checked'":'';?> onClick='ToggleStatOptions();'>
  98. <label for="stats-report"><?php _e('Active', 'wp_statistics'); ?></label>
  99. <p class="description"><?php _e('Enable or disable this feature', 'wp_statistics'); ?></p>
  100. </td>
  101. </tr>
  102. <?php if( $WP_Statistics->get_option('stats_report') ) { $hidden=""; } else { $hidden=" style='display: none;'"; }?>
  103. <tr valign="top"<?php echo $hidden;?> id='wps_stats_report_option'>
  104. <td scope="row" style="vertical-align: top;">
  105. <label for="time-report"><?php _e('Schedule', 'wp_statistics'); ?>:</label>
  106. </td>
  107. <td>
  108. <select name="wps_time_report" id="time-report">
  109. <option value="0" <?php selected($WP_Statistics->get_option('time_report'), '0'); ?>><?php _e('Please select', 'wp_statistics'); ?></option>
  110. <?php
  111. function wp_statistics_schedule_sort( $a, $b ) {
  112. if ($a['interval'] == $b['interval']) {
  113. return 0;
  114. }
  115. return ($a['interval'] < $b['interval']) ? -1 : 1;
  116. }
  117. $schedules = wp_get_schedules();
  118. uasort( $schedules, 'wp_statistics_schedule_sort' );
  119. foreach( $schedules as $key => $value ) {
  120. echo ' <option value="' . $key . '" ' . selected($WP_Statistics->get_option('time_report'), $key) . '>' . $value['display'] . '</option>';
  121. }
  122. ?>
  123. </select>
  124. <p class="description"><?php _e('Select how often to receive statistical report.', 'wp_statistics'); ?></p>
  125. </td>
  126. </tr>
  127. <tr valign="top"<?php echo $hidden;?> id='wps_stats_report_option'>
  128. <td scope="row" style="vertical-align: top;">
  129. <label for="send-report"><?php _e('Send reports via', 'wp_statistics'); ?>:</label>
  130. </td>
  131. <td>
  132. <select name="wps_send_report" id="send-report">
  133. <option value="0" <?php selected($WP_Statistics->get_option('send_report'), '0'); ?>><?php _e('Please select', 'wp_statistics'); ?></option>
  134. <option value="mail" <?php selected($WP_Statistics->get_option('send_report'), 'mail'); ?>><?php _e('Email', 'wp_statistics'); ?></option>
  135. <?php if( is_plugin_active('wp-sms/wp-sms.php') || is_plugin_active('wp-sms-pro/wp-sms.php') ) { ?>
  136. <option value="sms" <?php selected($WP_Statistics->get_option('send_report'), 'sms'); ?>><?php _e('SMS', 'wp_statistics'); ?></option>
  137. <?php } ?>
  138. </select>
  139. <p class="description"><?php _e('Select delivery method for statistical report.', 'wp_statistics'); ?></p>
  140. <?php if( !is_plugin_active('wp-sms/wp-sms.php') ) { ?>
  141. <p class="description note"><?php echo sprintf(__('Note: To send SMS text messages please install the %s plugin.', 'wp_statistics'), '<a href="http://wordpress.org/extend/plugins/wp-sms/" target="_blank">' . __('WordPress SMS', 'wp_statistics') . '</a>'); ?></p>
  142. <?php } ?>
  143. </td>
  144. </tr>
  145. <tr valign="top"<?php echo $hidden;?> id='wps_stats_report_option'>
  146. <td scope="row" style="vertical-align: top;">
  147. <label for="content-report"><?php _e('Report body', 'wp_statistics'); ?>:</label>
  148. </td>
  149. <td>
  150. <?php wp_editor( $WP_Statistics->get_option('content_report'), 'content-report', array('media_buttons' => false, 'textarea_name' => 'wps_content_report', 'textarea_rows' => 5) ); ?>
  151. <p class="description"><?php _e('Enter the contents of the report.', 'wp_statistics'); ?></p>
  152. <p class="description data">
  153. <?php _e('Any shortcode supported by your installation of WordPress, include all shortcodes for WP Statistics (see the admin manual for a list of codes available) are supported in the body of the message. Here are some examples:', 'wp_statistics'); ?><br><br>
  154. &nbsp;&nbsp;&nbsp;&nbsp;<?php _e('User Online', 'wp_statistics'); ?>: <code>[wpstatistics stat=usersonline]</code><br>
  155. &nbsp;&nbsp;&nbsp;&nbsp;<?php _e('Today Visitor', 'wp_statistics'); ?>: <code>[wpstatistics stat=visitors time=today]</code><br>
  156. &nbsp;&nbsp;&nbsp;&nbsp;<?php _e('Today Visit', 'wp_statistics'); ?>: <code>[wpstatistics stat=visits time=today]</code><br>
  157. &nbsp;&nbsp;&nbsp;&nbsp;<?php _e('Yesterday Visitor', 'wp_statistics'); ?>: <code>[wpstatistics stat=visitors time=yesterday]</code><br>
  158. &nbsp;&nbsp;&nbsp;&nbsp;<?php _e('Yesterday Visit', 'wp_statistics'); ?>: <code>[wpstatistics stat=visits time=yesterday]</code><br>
  159. &nbsp;&nbsp;&nbsp;&nbsp;<?php _e('Total Visitor', 'wp_statistics'); ?>: <code>[wpstatistics stat=visitors time=total]</code><br>
  160. &nbsp;&nbsp;&nbsp;&nbsp;<?php _e('Total Visit', 'wp_statistics'); ?>: <code>[wpstatistics stat=visits time=total]</code><br>
  161. </p>
  162. </td>
  163. </tr>
  164. </tbody>
  165. </table>
  166. <?php submit_button(__('Update', 'wp_statistics'), 'primary', 'submit'); ?>