Changeset 227128
- Timestamp:
- 04/09/2010 04:36:19 PM (16 years ago)
- File:
-
- 1 edited
-
chartbeat/trunk/chartbeat.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
chartbeat/trunk/chartbeat.php
r198449 r227128 4 4 Plugin URI: http://chartbeat.com/wordpress 5 5 Description: Adds Chartbeat pinging to Wordpress. 6 Version: 1. 16 Version: 1.2 7 7 Author: Chartbeat 8 8 Author URI: http://chartbeat.com … … 24 24 limitations under the License. 25 25 */ 26 27 add_action('wp_head', 'add_chartbeat_head');28 add_action('wp_footer', 'add_chartbeat_footer');29 add_action('admin_menu', 'chartbeat_menu');30 // widget?31 // admin?32 33 26 add_option('chartbeat_userid'); 34 27 add_option('chartbeat_apikey'); 35 28 add_option('chartbeat_widgetconfig'); 36 29 30 37 31 function chartbeat_menu() { 38 32 add_options_page('chartbeat plugin options', 'Chartbeat', 'administrator', … … 46 40 47 41 <form method="post" action="options.php" onsubmit="buildOptions()"> 48 <?php wp_nonce_field('update-options'); ?> 42 <?php 43 44 // outputs all of the hidden fields that options.php will check, including the nonce 45 wp_nonce_field('update-options'); 46 settings_fields('chartbeat-options'); ?> 49 47 50 48 <script> … … 150 148 } 151 149 150 // Function to register settings and sanitize output. To be called later in add_action 151 function chartbeat_register_settings() { 152 register_setting('chartbeat-options','chartbeat_userid'); 153 register_setting('chartbeat-options','chartbeat_apikey'); 154 register_setting('chartbeat-options','chartbeat_widgetconfig'); 155 156 } 157 152 158 function add_chartbeat_head() { 153 echo '<script type="text/javascript">var _sf_startpt=(new Date()).getTime()</script>';159 echo "\n<script type=\"text/javascript\">var _sf_startpt=(new Date()).getTime()</script>\n"; 154 160 } 155 161 … … 204 210 205 211 add_action('widgets_init', 'chartbeat_widget_init'); 206 ?> 212 add_action('admin_menu', 'chartbeat_menu'); 213 214 215 // If admin register settings on page that have been saved 216 // if not, add content to wp_head and wp_footer. 217 if ( is_admin() ){ 218 add_action( 'admin_init', 'chartbeat_register_settings' ); 219 }else { 220 add_action('wp_head', 'add_chartbeat_head'); 221 add_action('wp_footer', 'add_chartbeat_footer'); 222 } 223 ?>
Note: See TracChangeset
for help on using the changeset viewer.