Changeset 1055323
- Timestamp:
- 12/28/2014 04:56:15 AM (11 years ago)
- Location:
- mygamertag/trunk
- Files:
-
- 2 edited
-
MyGamerTag.php (modified) (11 diffs)
-
readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mygamertag/trunk/MyGamerTag.php
r1055251 r1055323 5 5 Plugin URI: http://thecertifiedtech.net 6 6 Description: Pulls Xbox Gamertag Info And Displays In Widget 7 Version: 1. 07 Version: 1.1 8 8 Author: Paul Dow 9 9 Author URI: http://thecertifiedtech.net 10 10 */ 11 ?>12 <?php 13 /* 11 ?> 12 <?php 13 /* 14 14 Copyright 2014 Paul Dow (email : thecertifiedtech@outlook.com) 15 15 … … 31 31 global $MGT_db_version; 32 32 $MGT_db_version = '1.0'; 33 34 33 function MGT_install() { 35 34 global $wpdb; 36 37 35 $table_name = $wpdb->prefix . "MyGamerTag"; 38 39 36 $charset_collate = $wpdb->get_charset_collate(); 40 41 37 $sql = "CREATE TABLE $table_name ( 42 38 id mediumint(9) NOT NULL, 43 39 time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, 44 gamertag varchar( 60) NOT NULL,40 gamertag varchar(250) NOT NULL, 45 41 xboxapikey varchar(250) NOT NULL, 46 42 gamerscore varchar(60) NOT NULL, … … 51 47 UNIQUE KEY id (id) 52 48 ) $charset_collate;"; 53 54 49 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); 55 50 dbDelta( $sql ); 56 57 51 add_option( 'MGT_db_version', $MGT_db_version ); 52 $wpdb->insert("$table_name", array( 53 "gamertag" => "ENTER-GAMERTAG", 54 "xboxapikey" => "ENTER-XBOXAPIKEY" 55 )); 58 56 } 59 57 register_activation_hook( __FILE__, 'MGT_install' ); 60 ?>61 <?php62 58 function MGT_uninstall() { 63 59 global $wpdb; 64 65 60 $table_name = $wpdb->prefix . "MyGamerTag"; 66 67 61 $sql = "DROP TABLE IF EXISTS $table_name;"; 68 62 //die($sql); … … 71 65 } 72 66 register_deactivation_hook( __FILE__, 'MGT_uninstall' ); 73 ?>74 <?php75 67 class MyGamerTag extends WP_Widget 76 68 { … … 86 78 extract( $args, EXTR_SKIP); 87 79 $title = ($instance['title']); 88 // 89 global $wpdb; 90 $table_name = $wpdb->prefix . 'MyGamerTag'; 91 $userdata = $wpdb->get_row("SELECT * FROM ".$table_name.""); 92 80 global $wpdb; 81 $table_name = $wpdb->prefix . 'MyGamerTag'; 82 $id = 0;$userdata = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".$table_name." WHERE id = %d", $id)); 93 83 $currentgamertag = $userdata->gamertag; 94 84 $currentgamerscore = $userdata->gamerscore; 95 $currentname = $userdata->name;96 $currentlocation = $userdata->location;97 85 $currenttier = $userdata->tier; 98 86 $currentrep = $userdata->xboxonerep; … … 100 88 $currentgamerpic = $userdata->gamerpic; 101 89 $currentupdatetime = $userdata->time; 102 ?>90 ?> 103 91 <?php echo $before_widget; ?> 104 92 <?php echo $before_title . $title . $after_title; ?> … … 150 138 function MGT_settings() 151 139 { 152 ?> 153 <?php 154 global $wpdb; 155 $table_name = $wpdb->prefix . 'MyGamerTag'; 156 $userdata = $wpdb->get_row("SELECT * FROM ".$table_name.""); 140 global $wpdb; 141 $table_name = $wpdb->prefix . 'MyGamerTag'; 142 $id = 0;$userdata = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".$table_name." WHERE id = %d", $id)); 157 143 $currentgamertag = $userdata->gamertag; 158 144 $currentxboxapikey = $userdata->xboxapikey; … … 195 181 $cleangamertag = rawurlencode($_POST['gamertag']); 196 182 $wpdb->replace( $table_name, array( 'gamertag' => $cleangamertag, 'xboxapikey' => $_POST['xboxapikey'] ) ); 197 //198 183 do_action('xbox_api','execute_xboxapi'); 199 //200 184 echo " <script type='text/javascript'> 201 185 window.location=document.location.href; … … 213 197 { 214 198 global $wpdb; 215 // 216 $table_name = $wpdb->prefix . 'MyGamerTag'; 217 $userdata = $wpdb->get_row("SELECT * FROM ".$table_name.""); 199 $table_name = $wpdb->prefix . 'MyGamerTag'; 200 $id = 0;$userdata = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".$table_name." WHERE id = %d", $id)); 218 201 $insertgamertag = $userdata->gamertag; 219 202 $insertxboxapikey = $userdata->xboxapikey; 220 //221 203 $url = "https://xboxapi.com/v2/".$insertgamertag."/profile"; 222 204 $headers = array("X-AUTH: ".$insertxboxapikey.""); … … 227 209 curl_close($ch); 228 210 $pdata = json_decode ( $presult ); 229 $table_name = $wpdb->prefix . 'MyGamerTag'; 230 $wpdb->replace( 211 $id = 0; 212 $table_name = $wpdb->prefix . 'MyGamerTag'; 213 $wpdb->update( 231 214 $table_name, 232 215 array( … … 234 217 'gamerpic' => $pdata->GameDisplayPicRaw, 235 218 'gamerscore' => $pdata->Gamerscore, 236 'gamertag' => $ pdata->Gamertag,219 'gamertag' => $userdata->gamertag, 237 220 'xboxonerep' => $pdata->XboxOneRep, 238 221 'xboxapikey' => $userdata->xboxapikey, 239 ) 222 ), array('ID' => $id) 240 223 ); 241 224 // -
mygamertag/trunk/readme.txt
r1055251 r1055323 1 1 === MyGamerTag === 2 2 Contributors: TheCertifiedTech 3 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=DZ3KJZTST5WVA&lc=US&item_name= TheCertifiedTech&item_number=Development%20Support¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted3 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=DZ3KJZTST5WVA&lc=US&item_name=Paul%20Dow%20%2d%20TheCertifiedTech&item_number=Development%20Support¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted 4 4 Tags: gaming, gamertag, xbox, gamerscore, achievements 5 5 Requires at least: 4.0 6 6 Tested up to: 4.1 7 Stable tag: 1. 07 Stable tag: 1.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 27 27 28 28 = Option 1 = 29 1. Click 'Add New' -> Search WordPress Plugin Directory For 'MyGamerTag'. 30 1. Click 'Install Now' Then Click 'Activate'. 31 32 = Option 2 = 29 33 1. Unzip 'MyGamerTag.zip' Upload the `MyGamerTag` folder to the `/wp-content/plugins/` directory. 30 34 1. Activate the plugin through the 'Plugins' menu in WordPress. 31 35 32 = Option 2=36 = Option 3 = 33 37 1. Click 'Add New' -> 'Upload Plugin' -> 'Choose File' -> Choose The 'MyGamerTag.zip' that you downloaded. 34 1. Then Activate Plugin38 1. Activate the plugin through the 'Plugins' menu in WordPress. 35 39 36 40 You will find 'MGT' settings menu in your WordPress admin panel on the left side. … … 57 61 == Changelog == 58 62 63 = 1.1 = 64 65 * Plugin Now Retains Gamertag So Data Can Re-Sync If API or Xbox Live Goes Offline Then Back Online. 66 59 67 = 1.0 = 60 68 … … 63 71 == Upgrade Notice == 64 72 73 = 1.1 = 74 75 * Plugin Now Retains Gamertag So Data Can Re-Sync If API or Xbox Live Goes Offline Then Back Online. 76 65 77 = 1.0 = 66 78
Note: See TracChangeset
for help on using the changeset viewer.