Changeset 2015814
- Timestamp:
- 01/20/2019 01:58:16 PM (7 years ago)
- Location:
- livetwitch
- Files:
-
- 7 edited
-
assets/screenshot-1.png (modified) (previous)
-
assets/screenshot-2.png (modified) (previous)
-
tags/1.0/README.txt (modified) (2 diffs)
-
tags/1.0/admin/class-twitch-admin.php (modified) (1 diff)
-
tags/1.0/includes/class-twitch-cron.php (modified) (2 diffs)
-
tags/1.0/includes/class-twitch.php (modified) (3 diffs)
-
tags/1.0/public/css/twitch-public.css (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
livetwitch/tags/1.0/README.txt
r1995959 r2015814 4 4 Tags: twitch,live stream,twitch live,streams,twitch.tv 5 5 Requires at least: 4.8 6 Tested up to: 5.0 7 Stable tag: 4.8.96 Tested up to: 5.0.3 7 Stable tag: 5.0.3 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 35 35 3. Settings page 36 36 4. Twitch CPT 37 38 == Changelog ==39 40 = 1.0 =41 * Initial. -
livetwitch/tags/1.0/admin/class-twitch-admin.php
r1995959 r2015814 141 141 142 142 $options = get_option( 'twitch_settings' ); 143 $checked = NULL; 144 if(isset($options['twitch_style'])){ 145 $checked = $options['twitch_style']; 146 } 143 147 ?> 144 <input type="checkbox" value="1" <?php checked( $ options['twitch_style'], 1 ); ?> name='twitch_settings[twitch_style]' size="32">148 <input type="checkbox" value="1" <?php checked( $checked, 1 ); ?> name='twitch_settings[twitch_style]' size="32"> 145 149 Check for darker display theme. 146 150 <?php -
livetwitch/tags/1.0/includes/class-twitch-cron.php
r1995959 r2015814 125 125 $response = wp_remote_get( $api_url, $args); 126 126 $json = json_decode($response['body']); 127 128 127 return $json; 129 128 … … 163 162 $r = false; 164 163 $d = $data; 165 166 foreach($d->data as $stream){ 167 $post = get_page_by_title($stream->user_name,OBJECT,'twitch'); 168 169 $game_name = $this->LiveTwitch_GameNameById($stream->game_id); 170 foreach($metadatas as $meta){ 171 $value = $stream->$meta; 172 if($meta == "game_id"){ 173 $value = $game_name->data[0]->name; 164 if(!isset($d->status) || $d->status != '401'){ 165 if(is_array($d)){ 166 $d = $d['data']; 167 }elseif(is_object($d)) { 168 $d = $d->data; 174 169 } 175 176 update_post_meta($post->ID, $meta, $value); 177 $r = true; 178 } 170 foreach($d as $stream){ 171 $post = get_page_by_title($stream->user_name,OBJECT,'twitch'); 172 173 if( !is_null($post) ){ 174 $game_name = $this->LiveTwitch_GameNameById($stream->game_id); 175 foreach($metadatas as $meta){ 176 $value = $stream->$meta; 177 if($meta == "game_id"){ 178 $value = $game_name->data[0]->name; 179 } 180 181 update_post_meta($post->ID, $meta, $value); 182 $r = true; 183 } 184 } 185 } 186 187 }else { 188 error_log( print_r( $data, true ) ); 179 189 } 180 190 } -
livetwitch/tags/1.0/includes/class-twitch.php
r1995959 r2015814 51 51 $this->version = PLUGIN_NAME_VERSION; 52 52 } else { 53 $this->version = '0.0. 2';53 $this->version = '0.0.3'; 54 54 } 55 55 $this->activator = new LiveTwitch_Activator(); … … 305 305 } 306 306 307 308 /** 309 * Add filter for Twitch game name. 310 * 311 * @since 0.0.3 312 * @access public 313 * @var string $game Game name. 314 */ 315 static function livetwitch_gamedisplay($game) { 316 return apply_filters('livetwitch_gamedisplay_filter', $game); 317 } 318 307 319 static public function display_stream($stream){ 308 320 309 321 $options = get_option( 'twitch_settings' ); 310 if($options['twitch_style']){ 311 $class = " dark"; 312 }else { 313 $class = ""; 314 } 322 $class = ""; 323 324 if(isset($options['twitch_style'])){ 325 if($options['twitch_style']){ 326 $class = " dark"; 327 } 328 } 329 315 330 $st_length = strlen($stream['stream_title']); 316 331 $extra_class = ""; … … 328 343 ob_start(); 329 344 ?> 330 <div class=" twitch-card<?php echo $class; ?>">345 <div class="mx-auto twitch-card<?php echo $class; ?>"> 331 346 <a target="_blank" class="twitch-link" href="https://www.twitch.tv/<?php echo $stream['title']; ?>"> 332 347 <div class="thumbnail"> 333 348 <img class='img-responsive' src='<?php echo $stream['image'];?>'> 334 349 <p class="streamer"><?php echo $stream['title'];?></p> 335 <div class="stream-title<?php echo $extra_class; ?>"> 336 <p><?php echo $stream['stream_title']; ?></p> 337 </div> 350 <p class="viewers"><svg class="views" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 21 21"><g transform="matrix(.02146 0 0 .02146 1 1)"><path d="m466.07 161.53c-205.6 0-382.8 121.2-464.2 296.1-2.5 5.3-2.5 11.5 0 16.9 81.4 174.9 258.6 296.1 464.2 296.1 205.6 0 382.8-121.2 464.2-296.1 2.5-5.3 2.5-11.5 0-16.9-81.4-174.9-258.6-296.1-464.2-296.1m0 514.7c-116.1 0-210.1-94.1-210.1-210.1 0-116.1 94.1-210.1 210.1-210.1 116.1 0 210.1 94.1 210.1 210.1 0 116-94.1 210.1-210.1 210.1"/><circle cx="466.08" cy="466.02" r="134.5"/></g></svg><?php echo $stream['viewers'];?></p> 351 <div class="stream-title<?php echo $extra_class; ?>"> 352 <p><?php echo $stream['stream_title']; ?></p> 353 </div> 338 354 </div> 339 355 <div class="information"> 340 <p class="viewers"><svg class="views" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22"><g transform="matrix(.02146 0 0 .02146 1 1)"><path d="m466.07 161.53c-205.6 0-382.8 121.2-464.2 296.1-2.5 5.3-2.5 11.5 0 16.9 81.4 174.9 258.6 296.1 464.2 296.1 205.6 0 382.8-121.2 464.2-296.1 2.5-5.3 2.5-11.5 0-16.9-81.4-174.9-258.6-296.1-464.2-296.1m0 514.7c-116.1 0-210.1-94.1-210.1-210.1 0-116.1 94.1-210.1 210.1-210.1 116.1 0 210.1 94.1 210.1 210.1 0 116-94.1 210.1-210.1 210.1"/><circle cx="466.08" cy="466.02" r="134.5"/></g></svg><?php echo $stream['viewers'];?></p> 341 <p class="game"><?php echo $stream['game'];?></p> 356 <p class="game"> 357 <?php 358 echo LiveTwitch::livetwitch_gamedisplay($stream['game']); 359 ?> 360 </p> 342 361 </div> 343 362 </a> -
livetwitch/tags/1.0/public/css/twitch-public.css
r1995959 r2015814 15 15 } 16 16 .twitch-card { 17 display: inline-block; 18 width: 250px; 17 display: flex; 18 justify-self: center; 19 flex-flow: column; 20 flex-wrap: wrap; 21 max-width: 250px; 22 min-width: 150px; 19 23 background-color: #ECECEC; 20 24 color: #232323; … … 43 47 44 48 .twitch-card .thumbnail { 45 height: 150px; 46 width: 250px; 49 margin: initial; 50 width: auto; 51 max-height: 170px; 52 max-width: 250px; 53 margin-top: 0px; 47 54 position: relative; 48 55 } … … 73 80 74 81 .twitch-card .thumbnail img.img-responsive{ 75 width: 250px;82 max-width: 250px; 76 83 border-top-left-radius: calc(.25rem - 1px); 77 84 border-top-right-radius: calc(.25rem - 1px); … … 142 149 } 143 150 144 .twitch-card .streamer { 145 font-weight: 800; 151 .twitch-card .streamer, .twitch-card .viewers { 146 152 position: absolute; 147 153 top: 10px; 148 left: 10px;149 154 color: white; 150 text-shadow: 0px 0px #232323;155 text-shadow: 0px 0px 2px #232323; 151 156 z-index: 3; 152 157 } 158 .twitch-card .viewers { 159 right: 10px; 160 } 161 .twitch-card .streamer { 162 font-weight: 800; 163 left: 10px; 164 } 153 165 154 .twitch-card . viewers, .twitch-card .game {166 .twitch-card .game { 155 167 display: inline-block; 156 168 margin-bottom: 0; 157 169 font-size: 0.9em; 158 } 159 160 .twitch-card .game { 161 float: right; 162 max-width: 145px; 170 max-width: inherit; 163 171 white-space: nowrap; 164 172 overflow: hidden; … … 166 174 } 167 175 176 .twitch-card svg.views{ 177 height: 1em; 178 vertical-align: middle; 179 fill: currentColor; 180 margin-top: -2px; 181 margin-right: 2px; 182 } 168 183 169 .twitch-card svg.views{ 170 height: 1.3em; 171 vertical-align: top; 172 fill: currentColor; 184 .twitch-card:last-of-type{ 185 margin-bottom: 20px; 173 186 }
Note: See TracChangeset
for help on using the changeset viewer.