Changeset 789136
- Timestamp:
- 10/17/2013 06:48:50 AM (12 years ago)
- File:
-
- 1 edited
-
qr-code-login-by-tagauth/trunk/tagauth.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
qr-code-login-by-tagauth/trunk/tagauth.php
r789085 r789136 5 5 Description: Use mobile to login your wordpress site by scanning QR Code. 6 6 Version: 1 7 Author: APSense.com7 Author: Inhao.com 8 8 Tags: QR Code Login, inhao, tagbook, scan qr code, login wp by qrcode, apsense 9 9 Author URI: http://www.inhao.com 10 10 */ 11 11 12 $tagauth_plugin_url = plugins_url() . '/tagauth'; 13 14 add_action('admin_menu', 'qr_auth_plugin'); 12 $tagauth_plugin_url = plugins_url('' , __FILE__); 15 13 add_action('plugins_loaded', 'init_qr_js_list'); 14 15 register_activation_hook( __FILE__, 'qr_auth_pluginInstall' ); 16 16 register_deactivation_hook( __FILE__, 'qr_auth_pluginUninstall' ); 17 17 18 function qr_auth_pluginUninstall() { 19 global $wpdb; 20 $wpdb->query("DROP TABLE IF EXISTS wp_tagauth_settings"); 21 $wpdb->query("DROP TABLE IF EXISTS srv_tagauth_code"); 22 $wpdb->query("DROP TABLE IF EXISTS srv_tagauth_user"); 23 delete_option('tagauth_site_id'); 24 delete_option('tagauth_site_key'); 25 } 26 27 function init_qr_js_list() { 28 wp_enqueue_script('my_qrcode_js', plugins_url('/qrcode.js', __FILE__)); 29 } 30 31 function qr_auth_plugin() { 18 if ( is_admin() ) { 19 add_filter('plugin_action_links', 'tagauth_plugin_action_links', 10, 2); 20 add_action('admin_menu', 'tagauth_admin_menu'); 21 } 22 else 23 { 24 add_action('admin_menu', 'tagauth_user_menu'); 25 } 26 27 function tagauth_admin_menu() { 28 add_dashboard_page('Get QR Key', 'Get QR Key', 'manage_options', 'get_qr_key', 'get_qr_key'); 29 add_options_page('', 'TagAuth', 'manage_options', __FILE__, 'TagAuth_Settings', '', 6); 30 } 31 32 function tagauth_user_menu() { 33 add_dashboard_page('Get QR Key', 'Get QR Key', 'manage_options', 'get_qr_key', 'get_qr_key'); 34 } 35 36 function qr_auth_pluginInstall() { 32 37 global $wpdb; 33 38 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); … … 49 54 ) ENGINE=MyISAM;"; 50 55 dbDelta($sql); 51 add_dashboard_page('TagAuth Settings', 'TagAuth Settings', 'manage_options', 'TagAuth_Settings', 'TagAuth_Settings'); 52 add_dashboard_page('Get QR Key', 'Get QR Key', 'manage_options', 'get_qr_key', 'get_qr_key'); 53 add_options_page('test1', 'test1', '', 'test1', 'test1'); 56 } 57 58 function qr_auth_pluginUninstall() { 59 global $wpdb; 60 $wpdb->query("DROP TABLE IF EXISTS srv_tagauth_code"); 61 $wpdb->query("DROP TABLE IF EXISTS srv_tagauth_user"); 62 delete_option('tagauth_site_id'); 63 delete_option('tagauth_site_key'); 64 } 65 66 function init_qr_js_list() { 67 wp_enqueue_script('my_qrcode_js', plugins_url('/qrcode.js', __FILE__)); 54 68 } 55 69 … … 62 76 <?php 63 77 } 64 65 78 66 79 function TagAuth_Settings() { … … 132 145 function get_qr_key() { 133 146 147 $plugin = plugin_basename(__FILE__); 148 134 149 $user_id = get_current_user_id(); 135 150 global $wpdb; … … 148 163 if ($site_id == 0 || $site_key == '') 149 164 { 150 echo "<h2>Please setup Site ID and API Key first. <a href='".$_SERVER['REQUEST_URI']."'>Click here to setup</a></h2>"; 151 echo plugin_dir_url( $file ); 165 echo "<h2>Please setup Site ID and API Key first. <a href='options-general.php?page=$plugin'>Click here to setup</a></h2>"; 152 166 } 153 167 else … … 434 448 return; 435 449 } 436 ?> 450 451 function tagauth_plugin_action_links( $links, $file ) { 452 453 $plugin = plugin_basename(__FILE__); 454 455 // check to make sure we are on the correct plugin 456 if ( $file == $plugin ) { 457 $settings_link = "<a href=\"options-general.php?page=$plugin\">" . __('Settings', 'tagauth') . '</a>'; 458 array_unshift( $links, $settings_link ); 459 } 460 461 return $links; 462 } 463 ?>
Note: See TracChangeset
for help on using the changeset viewer.