Advertisement
Guest User

Untitled

a guest
May 19th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 45.14 KB | None | 0 0
  1. PASTEBINnew pastePRO API tools faq deals
  2. search...
  3.  
  4.  
  5. Guest User
  6. -
  7.  
  8. Public Pastes
  9. Untitled
  10. 1 sec ago
  11. Untitled
  12. 8 sec ago
  13. Untitled
  14. 13 sec ago
  15. Untitled
  16. 15 sec ago
  17. With love from Linda
  18. 30 sec ago
  19. Untitled
  20. 32 sec ago
  21. Praktikum 2 - The ...
  22. Kotlin | 51 sec ago
  23. Untitled
  24. 51 sec ago
  25.  
  26. SHARE
  27. TWEET
  28.  
  29. Untitled
  30. A GUEST MAY 19TH, 2019 58 NEVER
  31.  
  32. NOTE: Your guest paste has been posted. If you sign up for a free account, you can edit and delete your pastes!
  33. rawdownloadcloneembedreportprint text 18.44 KB
  34. <?php
  35. /**
  36. * Event List
  37. *
  38. * @author ThemeBoy
  39. * @package SportsPress/Templates
  40. * @version 2.6.12
  41. */
  42.  
  43. if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
  44.  
  45. $defaults = array(
  46. 'id' => null,
  47. 'title' => false,
  48. 'status' => 'default',
  49. 'format' => 'all',
  50. 'date' => 'default',
  51. 'date_from' => 'default',
  52. 'date_to' => 'default',
  53. 'date_past' => 'default',
  54. 'date_future' => 'default',
  55. 'date_relative' => 'default',
  56. 'day' => 'default',
  57. 'league' => null,
  58. 'season' => null,
  59. 'venue' => null,
  60. 'team' => null,
  61. 'teams_past' => null,
  62. 'date_before' => null,
  63. 'player' => null,
  64. 'number' => -1,
  65. 'show_team_logo' => get_option( 'sportspress_event_list_show_logos', 'no' ) == 'yes' ? true : false,
  66. 'link_events' => get_option( 'sportspress_link_events', 'yes' ) == 'yes' ? true : false,
  67. 'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
  68. 'link_venues' => get_option( 'sportspress_link_venues', 'yes' ) == 'yes' ? true : false,
  69. 'responsive' => get_option( 'sportspress_enable_responsive_tables', 'no' ) == 'yes' ? true : false,
  70. 'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false,
  71. 'scrollable' => get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false,
  72. 'paginated' => get_option( 'sportspress_event_list_paginated', 'yes' ) == 'yes' ? true : false,
  73. 'rows' => get_option( 'sportspress_event_list_rows', 10 ),
  74. 'order' => 'default',
  75. 'columns' => null,
  76. 'show_all_events_link' => false,
  77. 'show_title' => get_option( 'sportspress_event_list_show_title', 'yes' ) == 'yes' ? true : false,
  78. 'title_format' => get_option( 'sportspress_event_list_title_format', 'title' ),
  79. 'time_format' => get_option( 'sportspress_event_list_time_format', 'combined' ),
  80. );
  81.  
  82. extract( $defaults, EXTR_SKIP );
  83.  
  84. $calendar = new SP_Calendar( $id );
  85. if ( $status != 'default' )
  86. $calendar->status = $status;
  87. if ( $format != 'default' )
  88. $calendar->event_format = $format;
  89. if ( $date != 'default' )
  90. $calendar->date = $date;
  91. if ( $date_from != 'default' )
  92. $calendar->from = $date_from;
  93. if ( $date_to != 'default' )
  94. $calendar->to = $date_to;
  95. if ( $date_past != 'default' )
  96. $calendar->past = $date_past;
  97. if ( $date_future != 'default' )
  98. $calendar->future = $date_future;
  99. if ( $date_relative != 'default' )
  100. $calendar->relative = $date_relative;
  101. if ( $league )
  102. $calendar->league = $league;
  103. if ( $season )
  104. $calendar->season = $season;
  105. if ( $venue )
  106. $calendar->venue = $venue;
  107. if ( $team )
  108. $calendar->team = $team;
  109. if ( $teams_past )
  110. $calendar->teams_past = $teams_past;
  111. if ( $date_before )
  112. $calendar->date_before = $date_before;
  113. if ( $player )
  114. $calendar->player = $player;
  115. if ( $order != 'default' )
  116. $calendar->order = $order;
  117. if ( $day != 'default' )
  118. $calendar->day = $day;
  119. $data = $calendar->data();
  120. $usecolumns = $calendar->columns;
  121.  
  122. if ( isset( $columns ) ):
  123. if ( is_array( $columns ) )
  124. $usecolumns = $columns;
  125. else
  126. $usecolumns = explode( ',', $columns );
  127. endif;
  128.  
  129. if ( $show_title && false === $title && $id ):
  130. $caption = $calendar->caption;
  131. if ( $caption )
  132. $title = $caption;
  133. else
  134. $title = get_the_title( $id );
  135. endif;
  136. $labels = array();
  137. //Create a unique identifier based on the current time in microseconds
  138. $identifier = uniqid( 'eventlist_' );
  139. ?>
  140. <div class="sp-template sp-template-event-list">
  141. <?php if ( $title ) { ?>
  142. <h4 class="sp-table-caption"><?php echo $title; ?></h4>
  143. <?php } ?>
  144. <div class="sp-table-wrapper">
  145. <table class="sp-event-list sp-event-list-format-<?php echo $title_format; ?> sp-data-table<?php if ( $paginated ) { ?> sp-paginated-table<?php } if ( $sortable ) { ?> sp-sortable-table<?php } if ( $responsive ) { echo ' sp-responsive-table '.$identifier; } if ( $scrollable ) { ?> sp-scrollable-table <?php } ?>" data-sp-rows="<?php echo $rows; ?>">
  146. <thead>
  147. <tr>
  148. <?php
  149. echo '<th class="data-date">' . __( 'Date', 'sportspress' ) . '</th>';
  150.  
  151. switch ( $title_format ) {
  152. case 'homeaway':
  153. if ( sp_column_active( $usecolumns, 'event' ) ) {
  154. echo '<th class="data-home">' . __( 'Home', 'sportspress' ) . '</th>';
  155. }
  156.  
  157. if ( 'combined' == $time_format && sp_column_active( $usecolumns, 'time' ) ) {
  158. echo '<th class="data-time">' . __( 'Time/Results', 'sportspress' ) . '</th>';
  159. $labels[] = __( 'Time/Results', 'sportspress' );
  160. } elseif ( in_array( $time_format, array( 'separate', 'results' ) ) && sp_column_active( $usecolumns, 'results' ) ) {
  161. echo '<th class="data-results">' . __( 'Results', 'sportspress' ) . '</th>';
  162. }
  163.  
  164. if ( sp_column_active( $usecolumns, 'event' ) ) {
  165. echo '<th class="data-away">' . __( 'Away', 'sportspress' ) . '</th>';
  166. }
  167.  
  168. if ( in_array( $time_format, array( 'separate', 'time' ) ) && sp_column_active( $usecolumns, 'time' ) ) {
  169. echo '<th class="data-time">' . __( 'Time', 'sportspress' ) . '</th>';
  170. }
  171. break;
  172. default:
  173. if ( sp_column_active( $usecolumns, 'event' ) ) {
  174. if ( $title_format == 'teams' ){
  175. echo '<th class="data-teams">' . __( 'Teams', 'sportspress' ) . '</th>';
  176. } else {
  177. echo '<th class="data-event">' . __( 'Event', 'sportspress' ) . '</th>';
  178. }
  179. }
  180.  
  181. switch ( $time_format ) {
  182. case 'separate':
  183. if ( sp_column_active( $usecolumns, 'time' ) )
  184. echo '<th class="data-time">' . __( 'Time', 'sportspress' ) . '</th>';
  185. if ( sp_column_active( $usecolumns, 'results' ) )
  186. echo '<th class="data-results">' . __( 'Results', 'sportspress' ) . '</th>';
  187. break;
  188. case 'time':
  189. if ( sp_column_active( $usecolumns, 'time' ) )
  190. echo '<th class="data-time">' . __( 'Time', 'sportspress' ) . '</th>';
  191. break;
  192. case 'results':
  193. if ( sp_column_active( $usecolumns, 'results' ) )
  194. echo '<th class="data-results">' . __( 'Results', 'sportspress' ) . '</th>';
  195. break;
  196. default:
  197. if ( sp_column_active( $usecolumns, 'time' ) )
  198. echo '<th class="data-time">' . __( 'Time/Results', 'sportspress' ) . '</th>';
  199. }
  200. }
  201.  
  202. if ( sp_column_active( $usecolumns, 'league' ) )
  203. echo '<th class="data-league">' . __( 'League', 'sportspress' ) . '</th>';
  204.  
  205. if ( sp_column_active( $usecolumns, 'season' ) )
  206. echo '<th class="data-season">' . __( 'Season', 'sportspress' ) . '</th>';
  207.  
  208. if ( sp_column_active( $usecolumns, 'venue' ) )
  209. echo '<th class="data-venue">' . __( 'Venue', 'sportspress' ) . '</th>';
  210.  
  211. if ( sp_column_active( $usecolumns, 'article' ) )
  212. echo '<th class="data-article">' . __( 'Article', 'sportspress' ) . '</th>';
  213.  
  214. if ( sp_column_active( $usecolumns, 'day' ) )
  215. echo '<th class="data-day">' . __( 'Match Day', 'sportspress' ) . '</th>';
  216.  
  217. do_action( 'sportspress_event_list_head_row', $usecolumns );
  218. ?>
  219. </tr>
  220. </thead>
  221. <tbody>
  222. <?php
  223. $i = 0;
  224.  
  225. if ( is_numeric( $number ) && $number > 0 )
  226. $limit = $number;
  227.  
  228. foreach ( $data as $event ):
  229. if ( isset( $limit ) && $i >= $limit ) continue;
  230.  
  231. $teams = get_post_meta( $event->ID, 'sp_team' );
  232. $video = get_post_meta( $event->ID, 'sp_video', true );
  233. $status = get_post_meta( $event->ID, 'sp_status', true );
  234.  
  235. $main_results = apply_filters( 'sportspress_event_list_main_results', sp_get_main_results( $event ), $event->ID );
  236.  
  237. $teams_output = '';
  238. $team_class = '';
  239. $teams_array = array();
  240. $team_logos = array();
  241.  
  242. if ( $teams ):
  243. $licznik = 0;
  244. foreach ( $teams as $t => $team ):
  245. $licznik++;
  246. $name = sp_team_short_name( $team );
  247. if ( $name ):
  248.  
  249. $name = '<meta itemprop="name" content="' . $name . '">' . $name;
  250.  
  251. if ( $show_team_logo ):
  252. if ( has_post_thumbnail( $team ) ):
  253. if ($licznik == 2) $logo = '<span class="team-logo2">' . sp_get_logo( $team, 'mini', array( 'itemprop' => 'url' ) ) . '</span>';
  254. else $logo = '<span class="team-logo">' . sp_get_logo( $team, 'mini', array( 'itemprop' => 'url' ) ) . '</span>';
  255. $team_logos[] = $logo;
  256. $team_class .= ' has-logo';
  257.  
  258. if ( $t ):
  259. $name = $logo . ' ' . $name;
  260. else:
  261. $name .= ' ' . $logo;
  262. endif;
  263. endif;
  264. endif;
  265.  
  266. if ( $link_teams ):
  267. $team_output = '<a href="' . get_post_permalink( $team ) . '" itemprop="url">' . $name . '</a>';
  268. else:
  269. $team_output = $name;
  270. endif;
  271.  
  272. $team_result = sp_array_value( $main_results, $team, null );
  273.  
  274. if ( $team_result != null ):
  275. if ( $usecolumns != null && ! in_array( 'time', $usecolumns ) ):
  276. $team_output .= ' (' . $team_result . ')';
  277. endif;
  278. endif;
  279.  
  280. $teams_array[] = $team_output;
  281.  
  282. $teams_output .= $team_output . '<br>';
  283. endif;
  284. endforeach;
  285. else:
  286. $teams_output .= '&mdash;';
  287. endif;
  288.  
  289. echo '<tr class="sp-row sp-post' . ( $i % 2 == 0 ? ' alternate' : '' ) . ' sp-row-no-' . $i . '" itemscope itemtype="http://schema.org/SportsEvent">';
  290.  
  291. $date_html = '<date>' . get_post_time( 'Y-m-d H:i:s', false, $event ) . '</date>' . apply_filters( 'sportspress_event_date', get_post_time( get_option( 'date_format' ), false, $event, true ), $event->ID );
  292.  
  293. if ( $link_events ) $date_html = '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">' . $date_html . '</a>';
  294.  
  295. echo '<td class="data-date" itemprop="startDate" content="' . mysql2date( 'Y-m-d\TH:iP', $event->post_date ) . '" data-label="'.__( 'Date', 'sportspress' ).'">' . $date_html . '</td>';
  296.  
  297. switch ( $title_format ) {
  298. case 'homeaway':
  299. if ( sp_column_active( $usecolumns, 'event' ) ) {
  300. $team = array_shift( $teams_array );
  301. echo '<td class="data-home' . $team_class . '" itemprop="competitor" itemscope itemtype="http://schema.org/SportsTeam" data-label="'.__( 'Home', 'sportspress' ).'">' . $team . '</td>';
  302. }
  303.  
  304. if ( 'combined' == $time_format && sp_column_active( $usecolumns, 'time' ) ) {
  305. echo '<td class="data-time '.$status.'" data-label="'.__( 'Time/Results', 'sportspress' ).'">';
  306. if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
  307. if ( ! empty( $main_results ) ):
  308. echo implode( ' - ', $main_results );
  309. else:
  310. echo '<date>&nbsp;' . get_post_time( 'H:i:s', false, $event ) . '</date>' . apply_filters( 'sportspress_event_time', sp_get_time( $event ), $event->ID );
  311. endif;
  312. if ( $link_events ) echo '</a>';
  313. echo '</td>';
  314. } elseif ( in_array( $time_format, array( 'separate', 'results' ) ) && sp_column_active( $usecolumns, 'results' ) ) {
  315. echo '<td class="data-results" data-label="'.__( 'Results', 'sportspress' ).'">';
  316. if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
  317. if ( ! empty( $main_results ) ):
  318. echo implode( ' - ', $main_results );
  319. else:
  320. echo '-';
  321. endif;
  322. if ( $link_events ) echo '</a>';
  323. echo '</td>';
  324. }
  325.  
  326. if ( sp_column_active( $usecolumns, 'event' ) ) {
  327. $team = array_shift( $teams_array );
  328. echo '<td class="data-away' . $team_class . '" itemprop="competitor" itemscope itemtype="http://schema.org/SportsTeam" data-label="'.__( 'Away', 'sportspress' ).'">' . $team . '</td>';
  329. }
  330.  
  331. if ( in_array( $time_format, array( 'separate', 'time' ) ) && sp_column_active( $usecolumns, 'time' ) ) {
  332. echo '<td class="data-time '.$status.'" data-label="'.__( 'Time', 'sportspress' ).'">';
  333. if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
  334. echo '<date>&nbsp;' . get_post_time( 'H:i:s', false, $event ) . '</date>' . apply_filters( 'sportspress_event_time', sp_get_time( $event ), $event->ID );
  335. if ( $link_events ) echo '</a>';
  336. echo '</td>';
  337. }
  338. break;
  339. default:
  340. if ( sp_column_active( $usecolumns, 'event' ) ) {
  341. if ( $title_format == 'teams' ) {
  342. echo '<td class="data-event data-teams" data-label="'.__( 'Teams', 'sportspress' ).'">' . $teams_output . '</td>';
  343. } else {
  344. $title_html = implode( ' ', $team_logos ) . ' ' . $event->post_title;
  345. if ( $link_events ) $title_html = '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">' . $title_html . '</a>';
  346. echo '<td class="data-event" data-label="'.__( 'Event', 'sportspress' ).'">' . $title_html . '</td>';
  347. }
  348. }
  349.  
  350. switch ( $time_format ) {
  351. case 'separate':
  352. if ( sp_column_active( $usecolumns, 'time' ) ) {
  353. echo '<td class="data-time '.$status.'" data-label="'.__( 'Time', 'sportspress' ).'">';
  354. if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
  355. echo '<date>&nbsp;' . get_post_time( 'H:i:s', false, $event ) . '</date>' . apply_filters( 'sportspress_event_time', sp_get_time( $event ), $event->ID );
  356. if ( $link_events ) echo '</a>';
  357. echo '</td>';
  358. }
  359. if ( sp_column_active( $usecolumns, 'results' ) ) {
  360. echo '<td class="data-results" data-label="'.__( 'Results', 'sportspress' ).'">';
  361. if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
  362. if ( ! empty( $main_results ) ):
  363. echo implode( ' - ', $main_results );
  364. else:
  365. echo '-';
  366. endif;
  367. if ( $link_events ) echo '</a>';
  368. echo '</td>';
  369. }
  370. break;
  371. case 'time':
  372. if ( sp_column_active( $usecolumns, 'time' ) ) {
  373. echo '<td class="data-time '.$status.'" data-label="'.__( 'Time', 'sportspress' ).'">';
  374. if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
  375. echo '<date>&nbsp;' . get_post_time( 'H:i:s', false, $event ) . '</date>' . apply_filters( 'sportspress_event_time', sp_get_time( $event ), $event->ID );
  376. if ( $link_events ) echo '</a>';
  377. echo '</td>';
  378. }
  379. break;
  380. case 'results':
  381. if ( sp_column_active( $usecolumns, 'results' ) ) {
  382. echo '<td class="data-results" data-label="'.__( 'Results', 'sportspress' ).'">';
  383. if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
  384. if ( ! empty( $main_results ) ):
  385. echo implode( ' - ', $main_results );
  386. else:
  387. echo '-';
  388. endif;
  389. if ( $link_events ) echo '</a>';
  390. echo '</td>';
  391. }
  392. break;
  393. default:
  394. if ( sp_column_active( $usecolumns, 'time' ) ) {
  395. echo '<td class="data-time '.$status.'" data-label="'.__( 'Time/Results', 'sportspress' ).'">';
  396. if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
  397. if ( ! empty( $main_results ) ):
  398. echo implode( ' - ', $main_results );
  399. else:
  400. echo '<date>&nbsp;' . get_post_time( 'H:i:s', false, $event ) . '</date>' . apply_filters( 'sportspress_event_time', sp_get_time( $event ), $event->ID );
  401. endif;
  402. if ( $link_events ) echo '</a>';
  403. echo '</td>';
  404. }
  405. }
  406. }
  407.  
  408. if ( sp_column_active( $usecolumns, 'league' ) ):
  409. echo '<td class="data-league" data-label="'.__( 'League', 'sportspress' ).'">';
  410. $leagues = get_the_terms( $event->ID, 'sp_league' );
  411. if ( $leagues ): foreach ( $leagues as $league ):
  412. echo $league->name;
  413. endforeach; endif;
  414. echo '</td>';
  415. endif;
  416.  
  417. if ( sp_column_active( $usecolumns, 'season' ) ):
  418. echo '<td class="data-season" data-label="'.__( 'Season', 'sportspress' ).'">';
  419. $seasons = get_the_terms( $event->ID, 'sp_season' );
  420. if ( $seasons ): foreach ( $seasons as $season ):
  421. echo $season->name;
  422. endforeach; endif;
  423. echo '</td>';
  424. endif;
  425.  
  426. if ( sp_column_active( $usecolumns, 'venue' ) ):
  427. echo '<td class="data-venue" data-label="'.__( 'Venue', 'sportspress' ).'">';
  428. if ( $link_venues ):
  429. the_terms( $event->ID, 'sp_venue' );
  430. else:
  431. $venues = get_the_terms( $event->ID, 'sp_venue' );
  432. if ( $venues ): foreach ( $venues as $venue ):
  433. echo $venue->name;
  434. endforeach; endif;
  435. endif;
  436. echo '</td>';
  437. endif;
  438.  
  439. if ( sp_column_active( $usecolumns, 'article' ) ):
  440. echo '<td class="data-article" data-label="'.__( 'Article', 'sportspress' ).'">';
  441. if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
  442.  
  443. if ( $video ):
  444. echo '<div class="dashicons dashicons-video-alt"></div>';
  445. elseif ( has_post_thumbnail( $event->ID ) ):
  446. echo '<div class="dashicons dashicons-camera"></div>';
  447. endif;
  448. if ( $event->post_content !== null ):
  449. if ( $event->post_status == 'publish' ):
  450. _e( 'Recap', 'sportspress' );
  451. else:
  452. _e( 'Preview', 'sportspress' );
  453. endif;
  454. endif;
  455.  
  456. if ( $link_events ) echo '</a>';
  457. echo '</td>';
  458. endif;
  459.  
  460. if ( sp_column_active( $usecolumns, 'day' ) ):
  461. echo '<td class="data-day" data-label="'.__( 'Match Day', 'sportspress' ).'">';
  462. $day = get_post_meta( $event->ID, 'sp_day', true );
  463. if ( '' == $day ) {
  464. echo '-';
  465. } else {
  466. echo $day;
  467. }
  468. echo '</td>';
  469. endif;
  470.  
  471. do_action( 'sportspress_event_list_row', $event, $usecolumns );
  472.  
  473. echo '</tr>';
  474.  
  475. $i++;
  476. endforeach;
  477. ?>
  478. </tbody>
  479. </table>
  480. </div>
  481. <?php
  482. // If responsive tables are enabled then load the inline css code
  483. if ( $responsive ){
  484. //sportspress_responsive_tables_css( $identifier );
  485. }
  486. if ( $id && $show_all_events_link ) {
  487. echo '<div class="sp-calendar-link sp-view-all-link"><a href="' . get_permalink( $id ) . '">' . __( 'View all events', 'sportspress' ) . '</a></div>';
  488. }
  489. ?>
  490. </div>
  491. RAW Paste Data
  492. <?php
  493. /**
  494. * Event List
  495. *
  496. * @author ThemeBoy
  497. * @package SportsPress/Templates
  498. * @version 2.6.12
  499. */
  500.  
  501. if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
  502.  
  503. $defaults = array(
  504. 'id' => null,
  505. 'title' => false,
  506. 'status' => 'default',
  507. 'format' => 'all',
  508. 'date' => 'default',
  509. 'date_from' => 'default',
  510. 'date_to' => 'default',
  511. 'date_past' => 'default',
  512. 'date_future' => 'default',
  513. 'date_relative' => 'default',
  514. 'day' => 'default',
  515. 'league' => null,
  516. 'season' => null,
  517. 'venue' => null,
  518. 'team' => null,
  519. 'teams_past' => null,
  520. 'date_before' => null,
  521. 'player' => null,
  522. 'number' => -1,
  523. 'show_team_logo' => get_option( 'sportspress_event_list_show_logos', 'no' ) == 'yes' ? true : false,
  524. 'link_events' => get_option( 'sportspress_link_events', 'yes' ) == 'yes' ? true : false,
  525. 'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
  526. 'link_venues' => get_option( 'sportspress_link_venues', 'yes' ) == 'yes' ? true : false,
  527. 'responsive' => get_option( 'sportspress_enable_responsive_tables', 'no' ) == 'yes' ? true : false,
  528. 'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false,
  529. 'scrollable' => get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false,
  530. 'paginated' => get_option( 'sportspress_event_list_paginated', 'yes' ) == 'yes' ? true : false,
  531. 'rows' => get_option( 'sportspress_event_list_rows', 10 ),
  532. 'order' => 'default',
  533. 'columns' => null,
  534. 'show_all_events_link' => false,
  535. 'show_title' => get_option( 'sportspress_event_list_show_title', 'yes' ) == 'yes' ? true : false,
  536. 'title_format' => get_option( 'sportspress_event_list_title_format', 'title' ),
  537. 'time_format' => get_option( 'sportspress_event_list_time_format', 'combined' ),
  538. );
  539.  
  540. extract( $defaults, EXTR_SKIP );
  541.  
  542. $calendar = new SP_Calendar( $id );
  543. if ( $status != 'default' )
  544. $calendar->status = $status;
  545. if ( $format != 'default' )
  546. $calendar->event_format = $format;
  547. if ( $date != 'default' )
  548. $calendar->date = $date;
  549. if ( $date_from != 'default' )
  550. $calendar->from = $date_from;
  551. if ( $date_to != 'default' )
  552. $calendar->to = $date_to;
  553. if ( $date_past != 'default' )
  554. $calendar->past = $date_past;
  555. if ( $date_future != 'default' )
  556. $calendar->future = $date_future;
  557. if ( $date_relative != 'default' )
  558. $calendar->relative = $date_relative;
  559. if ( $league )
  560. $calendar->league = $league;
  561. if ( $season )
  562. $calendar->season = $season;
  563. if ( $venue )
  564. $calendar->venue = $venue;
  565. if ( $team )
  566. $calendar->team = $team;
  567. if ( $teams_past )
  568. $calendar->teams_past = $teams_past;
  569. if ( $date_before )
  570. $calendar->date_before = $date_before;
  571. if ( $player )
  572. $calendar->player = $player;
  573. if ( $order != 'default' )
  574. $calendar->order = $order;
  575. if ( $day != 'default' )
  576. $calendar->day = $day;
  577. $data = $calendar->data();
  578. $usecolumns = $calendar->columns;
  579.  
  580. if ( isset( $columns ) ):
  581. if ( is_array( $columns ) )
  582. $usecolumns = $columns;
  583. else
  584. $usecolumns = explode( ',', $columns );
  585. endif;
  586.  
  587. if ( $show_title && false === $title && $id ):
  588. $caption = $calendar->caption;
  589. if ( $caption )
  590. $title = $caption;
  591. else
  592. $title = get_the_title( $id );
  593. endif;
  594. $labels = array();
  595. //Create a unique identifier based on the current time in microseconds
  596. $identifier = uniqid( 'eventlist_' );
  597. ?>
  598. <div class="sp-template sp-template-event-list">
  599. <?php if ( $title ) { ?>
  600. <h4 class="sp-table-caption"><?php echo $title; ?></h4>
  601. <?php } ?>
  602. <div class="sp-table-wrapper">
  603. <table class="sp-event-list sp-event-list-format-<?php echo $title_format; ?> sp-data-table<?php if ( $paginated ) { ?> sp-paginated-table<?php } if ( $sortable ) { ?> sp-sortable-table<?php } if ( $responsive ) { echo ' sp-responsive-table '.$identifier; } if ( $scrollable ) { ?> sp-scrollable-table <?php } ?>" data-sp-rows="<?php echo $rows; ?>">
  604. <thead>
  605. <tr>
  606. <?php
  607. echo '<th class="data-date">' . __( 'Date', 'sportspress' ) . '</th>';
  608.  
  609. switch ( $title_format ) {
  610. case 'homeaway':
  611. if ( sp_column_active( $usecolumns, 'event' ) ) {
  612. echo '<th class="data-home">' . __( 'Home', 'sportspress' ) . '</th>';
  613. }
  614.  
  615. if ( 'combined' == $time_format && sp_column_active( $usecolumns, 'time' ) ) {
  616. echo '<th class="data-time">' . __( 'Time/Results', 'sportspress' ) . '</th>';
  617. $labels[] = __( 'Time/Results', 'sportspress' );
  618. } elseif ( in_array( $time_format, array( 'separate', 'results' ) ) && sp_column_active( $usecolumns, 'results' ) ) {
  619. echo '<th class="data-results">' . __( 'Results', 'sportspress' ) . '</th>';
  620. }
  621.  
  622. if ( sp_column_active( $usecolumns, 'event' ) ) {
  623. echo '<th class="data-away">' . __( 'Away', 'sportspress' ) . '</th>';
  624. }
  625.  
  626. if ( in_array( $time_format, array( 'separate', 'time' ) ) && sp_column_active( $usecolumns, 'time' ) ) {
  627. echo '<th class="data-time">' . __( 'Time', 'sportspress' ) . '</th>';
  628. }
  629. break;
  630. default:
  631. if ( sp_column_active( $usecolumns, 'event' ) ) {
  632. if ( $title_format == 'teams' ){
  633. echo '<th class="data-teams">' . __( 'Teams', 'sportspress' ) . '</th>';
  634. } else {
  635. echo '<th class="data-event">' . __( 'Event', 'sportspress' ) . '</th>';
  636. }
  637. }
  638.  
  639. switch ( $time_format ) {
  640. case 'separate':
  641. if ( sp_column_active( $usecolumns, 'time' ) )
  642. echo '<th class="data-time">' . __( 'Time', 'sportspress' ) . '</th>';
  643. if ( sp_column_active( $usecolumns, 'results' ) )
  644. echo '<th class="data-results">' . __( 'Results', 'sportspress' ) . '</th>';
  645. break;
  646. case 'time':
  647. if ( sp_column_active( $usecolumns, 'time' ) )
  648. echo '<th class="data-time">' . __( 'Time', 'sportspress' ) . '</th>';
  649. break;
  650. case 'results':
  651. if ( sp_column_active( $usecolumns, 'results' ) )
  652. echo '<th class="data-results">' . __( 'Results', 'sportspress' ) . '</th>';
  653. break;
  654. default:
  655. if ( sp_column_active( $usecolumns, 'time' ) )
  656. echo '<th class="data-time">' . __( 'Time/Results', 'sportspress' ) . '</th>';
  657. }
  658. }
  659.  
  660. if ( sp_column_active( $usecolumns, 'league' ) )
  661. echo '<th class="data-league">' . __( 'League', 'sportspress' ) . '</th>';
  662.  
  663. if ( sp_column_active( $usecolumns, 'season' ) )
  664. echo '<th class="data-season">' . __( 'Season', 'sportspress' ) . '</th>';
  665.  
  666. if ( sp_column_active( $usecolumns, 'venue' ) )
  667. echo '<th class="data-venue">' . __( 'Venue', 'sportspress' ) . '</th>';
  668.  
  669. if ( sp_column_active( $usecolumns, 'article' ) )
  670. echo '<th class="data-article">' . __( 'Article', 'sportspress' ) . '</th>';
  671.  
  672. if ( sp_column_active( $usecolumns, 'day' ) )
  673. echo '<th class="data-day">' . __( 'Match Day', 'sportspress' ) . '</th>';
  674.  
  675. do_action( 'sportspress_event_list_head_row', $usecolumns );
  676. ?>
  677. </tr>
  678. </thead>
  679. <tbody>
  680. <?php
  681. $i = 0;
  682.  
  683. if ( is_numeric( $number ) && $number > 0 )
  684. $limit = $number;
  685.  
  686. foreach ( $data as $event ):
  687. if ( isset( $limit ) && $i >= $limit ) continue;
  688.  
  689. $teams = get_post_meta( $event->ID, 'sp_team' );
  690. $video = get_post_meta( $event->ID, 'sp_video', true );
  691. $status = get_post_meta( $event->ID, 'sp_status', true );
  692.  
  693. $main_results = apply_filters( 'sportspress_event_list_main_results', sp_get_main_results( $event ), $event->ID );
  694.  
  695. $teams_output = '';
  696. $team_class = '';
  697. $teams_array = array();
  698. $team_logos = array();
  699.  
  700. if ( $teams ):
  701. $i = 0;
  702. foreach ( $teams as $t => $team ):
  703. $i++;
  704. $name = sp_team_short_name( $team );
  705. if ( $name ):
  706.  
  707. $name = '<meta itemprop="name" content="' . $name . '">' . $name;
  708.  
  709. if ( $show_team_logo ):
  710. if ( has_post_thumbnail( $team ) ):
  711. if ($i == 2) $logo = '<span class="team-logo2">' . sp_get_logo( $team, 'mini', array( 'itemprop' => 'url' ) ) . '</span>';
  712. else $logo = '<span class="team-logo">' . sp_get_logo( $team, 'mini', array( 'itemprop' => 'url' ) ) . '</span>';
  713. $team_logos[] = $logo;
  714. $team_class .= ' has-logo';
  715.  
  716. if ( $t ):
  717. $name = $logo . ' ' . $name;
  718. else:
  719. $name .= ' ' . $logo;
  720. endif;
  721. endif;
  722. endif;
  723.  
  724. if ( $link_teams ):
  725. $team_output = '<a href="' . get_post_permalink( $team ) . '" itemprop="url">' . $name . '</a>';
  726. else:
  727. $team_output = $name;
  728. endif;
  729.  
  730. $team_result = sp_array_value( $main_results, $team, null );
  731.  
  732. if ( $team_result != null ):
  733. if ( $usecolumns != null && ! in_array( 'time', $usecolumns ) ):
  734. $team_output .= ' (' . $team_result . ')';
  735. endif;
  736. endif;
  737.  
  738. $teams_array[] = $team_output;
  739.  
  740. $teams_output .= $team_output . '<br>';
  741. endif;
  742. endforeach;
  743. else:
  744. $teams_output .= '&mdash;';
  745. endif;
  746.  
  747. echo '<tr class="sp-row sp-post' . ( $i % 2 == 0 ? ' alternate' : '' ) . ' sp-row-no-' . $i . '" itemscope itemtype="http://schema.org/SportsEvent">';
  748.  
  749. $date_html = '<date>' . get_post_time( 'Y-m-d H:i:s', false, $event ) . '</date>' . apply_filters( 'sportspress_event_date', get_post_time( get_option( 'date_format' ), false, $event, true ), $event->ID );
  750.  
  751. if ( $link_events ) $date_html = '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">' . $date_html . '</a>';
  752.  
  753. echo '<td class="data-date" itemprop="startDate" content="' . mysql2date( 'Y-m-d\TH:iP', $event->post_date ) . '" data-label="'.__( 'Date', 'sportspress' ).'">' . $date_html . '</td>';
  754.  
  755. switch ( $title_format ) {
  756. case 'homeaway':
  757. if ( sp_column_active( $usecolumns, 'event' ) ) {
  758. $team = array_shift( $teams_array );
  759. echo '<td class="data-home' . $team_class . '" itemprop="competitor" itemscope itemtype="http://schema.org/SportsTeam" data-label="'.__( 'Home', 'sportspress' ).'">' . $team . '</td>';
  760. }
  761.  
  762. if ( 'combined' == $time_format && sp_column_active( $usecolumns, 'time' ) ) {
  763. echo '<td class="data-time '.$status.'" data-label="'.__( 'Time/Results', 'sportspress' ).'">';
  764. if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
  765. if ( ! empty( $main_results ) ):
  766. echo implode( ' - ', $main_results );
  767. else:
  768. echo '<date>&nbsp;' . get_post_time( 'H:i:s', false, $event ) . '</date>' . apply_filters( 'sportspress_event_time', sp_get_time( $event ), $event->ID );
  769. endif;
  770. if ( $link_events ) echo '</a>';
  771. echo '</td>';
  772. } elseif ( in_array( $time_format, array( 'separate', 'results' ) ) && sp_column_active( $usecolumns, 'results' ) ) {
  773. echo '<td class="data-results" data-label="'.__( 'Results', 'sportspress' ).'">';
  774. if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
  775. if ( ! empty( $main_results ) ):
  776. echo implode( ' - ', $main_results );
  777. else:
  778. echo '-';
  779. endif;
  780. if ( $link_events ) echo '</a>';
  781. echo '</td>';
  782. }
  783.  
  784. if ( sp_column_active( $usecolumns, 'event' ) ) {
  785. $team = array_shift( $teams_array );
  786. echo '<td class="data-away' . $team_class . '" itemprop="competitor" itemscope itemtype="http://schema.org/SportsTeam" data-label="'.__( 'Away', 'sportspress' ).'">' . $team . '</td>';
  787. }
  788.  
  789. if ( in_array( $time_format, array( 'separate', 'time' ) ) && sp_column_active( $usecolumns, 'time' ) ) {
  790. echo '<td class="data-time '.$status.'" data-label="'.__( 'Time', 'sportspress' ).'">';
  791. if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
  792. echo '<date>&nbsp;' . get_post_time( 'H:i:s', false, $event ) . '</date>' . apply_filters( 'sportspress_event_time', sp_get_time( $event ), $event->ID );
  793. if ( $link_events ) echo '</a>';
  794. echo '</td>';
  795. }
  796. break;
  797. default:
  798. if ( sp_column_active( $usecolumns, 'event' ) ) {
  799. if ( $title_format == 'teams' ) {
  800. echo '<td class="data-event data-teams" data-label="'.__( 'Teams', 'sportspress' ).'">' . $teams_output . '</td>';
  801. } else {
  802. $title_html = implode( ' ', $team_logos ) . ' ' . $event->post_title;
  803. if ( $link_events ) $title_html = '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">' . $title_html . '</a>';
  804. echo '<td class="data-event" data-label="'.__( 'Event', 'sportspress' ).'">' . $title_html . '</td>';
  805. }
  806. }
  807.  
  808. switch ( $time_format ) {
  809. case 'separate':
  810. if ( sp_column_active( $usecolumns, 'time' ) ) {
  811. echo '<td class="data-time '.$status.'" data-label="'.__( 'Time', 'sportspress' ).'">';
  812. if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
  813. echo '<date>&nbsp;' . get_post_time( 'H:i:s', false, $event ) . '</date>' . apply_filters( 'sportspress_event_time', sp_get_time( $event ), $event->ID );
  814. if ( $link_events ) echo '</a>';
  815. echo '</td>';
  816. }
  817. if ( sp_column_active( $usecolumns, 'results' ) ) {
  818. echo '<td class="data-results" data-label="'.__( 'Results', 'sportspress' ).'">';
  819. if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
  820. if ( ! empty( $main_results ) ):
  821. echo implode( ' - ', $main_results );
  822. else:
  823. echo '-';
  824. endif;
  825. if ( $link_events ) echo '</a>';
  826. echo '</td>';
  827. }
  828. break;
  829. case 'time':
  830. if ( sp_column_active( $usecolumns, 'time' ) ) {
  831. echo '<td class="data-time '.$status.'" data-label="'.__( 'Time', 'sportspress' ).'">';
  832. if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
  833. echo '<date>&nbsp;' . get_post_time( 'H:i:s', false, $event ) . '</date>' . apply_filters( 'sportspress_event_time', sp_get_time( $event ), $event->ID );
  834. if ( $link_events ) echo '</a>';
  835. echo '</td>';
  836. }
  837. break;
  838. case 'results':
  839. if ( sp_column_active( $usecolumns, 'results' ) ) {
  840. echo '<td class="data-results" data-label="'.__( 'Results', 'sportspress' ).'">';
  841. if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
  842. if ( ! empty( $main_results ) ):
  843. echo implode( ' - ', $main_results );
  844. else:
  845. echo '-';
  846. endif;
  847. if ( $link_events ) echo '</a>';
  848. echo '</td>';
  849. }
  850. break;
  851. default:
  852. if ( sp_column_active( $usecolumns, 'time' ) ) {
  853. echo '<td class="data-time '.$status.'" data-label="'.__( 'Time/Results', 'sportspress' ).'">';
  854. if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
  855. if ( ! empty( $main_results ) ):
  856. echo implode( ' - ', $main_results );
  857. else:
  858. echo '<date>&nbsp;' . get_post_time( 'H:i:s', false, $event ) . '</date>' . apply_filters( 'sportspress_event_time', sp_get_time( $event ), $event->ID );
  859. endif;
  860. if ( $link_events ) echo '</a>';
  861. echo '</td>';
  862. }
  863. }
  864. }
  865.  
  866. if ( sp_column_active( $usecolumns, 'league' ) ):
  867. echo '<td class="data-league" data-label="'.__( 'League', 'sportspress' ).'">';
  868. $leagues = get_the_terms( $event->ID, 'sp_league' );
  869. if ( $leagues ): foreach ( $leagues as $league ):
  870. echo $league->name;
  871. endforeach; endif;
  872. echo '</td>';
  873. endif;
  874.  
  875. if ( sp_column_active( $usecolumns, 'season' ) ):
  876. echo '<td class="data-season" data-label="'.__( 'Season', 'sportspress' ).'">';
  877. $seasons = get_the_terms( $event->ID, 'sp_season' );
  878. if ( $seasons ): foreach ( $seasons as $season ):
  879. echo $season->name;
  880. endforeach; endif;
  881. echo '</td>';
  882. endif;
  883.  
  884. if ( sp_column_active( $usecolumns, 'venue' ) ):
  885. echo '<td class="data-venue" data-label="'.__( 'Venue', 'sportspress' ).'">';
  886. if ( $link_venues ):
  887. the_terms( $event->ID, 'sp_venue' );
  888. else:
  889. $venues = get_the_terms( $event->ID, 'sp_venue' );
  890. if ( $venues ): foreach ( $venues as $venue ):
  891. echo $venue->name;
  892. endforeach; endif;
  893. endif;
  894. echo '</td>';
  895. endif;
  896.  
  897. if ( sp_column_active( $usecolumns, 'article' ) ):
  898. echo '<td class="data-article" data-label="'.__( 'Article', 'sportspress' ).'">';
  899. if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
  900.  
  901. if ( $video ):
  902. echo '<div class="dashicons dashicons-video-alt"></div>';
  903. elseif ( has_post_thumbnail( $event->ID ) ):
  904. echo '<div class="dashicons dashicons-camera"></div>';
  905. endif;
  906. if ( $event->post_content !== null ):
  907. if ( $event->post_status == 'publish' ):
  908. _e( 'Recap', 'sportspress' );
  909. else:
  910. _e( 'Preview', 'sportspress' );
  911. endif;
  912. endif;
  913.  
  914. if ( $link_events ) echo '</a>';
  915. echo '</td>';
  916. endif;
  917.  
  918. if ( sp_column_active( $usecolumns, 'day' ) ):
  919. echo '<td class="data-day" data-label="'.__( 'Match Day', 'sportspress' ).'">';
  920. $day = get_post_meta( $event->ID, 'sp_day', true );
  921. if ( '' == $day ) {
  922. echo '-';
  923. } else {
  924. echo $day;
  925. }
  926. echo '</td>';
  927. endif;
  928.  
  929. do_action( 'sportspress_event_list_row', $event, $usecolumns );
  930.  
  931. echo '</tr>';
  932.  
  933. $i++;
  934. endforeach;
  935. ?>
  936. </tbody>
  937. </table>
  938. </div>
  939. <?php
  940. // If responsive tables are enabled then load the inline css code
  941. if ( $responsive ){
  942. //sportspress_responsive_tables_css( $identifier );
  943. }
  944. if ( $id && $show_all_events_link ) {
  945. echo '<div class="sp-calendar-link sp-view-all-link"><a href="' . get_permalink( $id ) . '">' . __( 'View all events', 'sportspress' ) . '</a></div>';
  946. }
  947. ?>
  948. </div>
  949.  
  950. SAY NO TO QUERY WRITING & YES TO REACTIVE DATA FLOW. TRY QLIK CORE TODAY.
  951.  
  952.  
  953. create new paste / dealsnew! / syntax languages / archive / faq / tools / night mode / api / scraping api
  954. privacy statement / cookies policy / terms of service / security disclosure / dmca / contact
  955.  
  956. By using Pastebin.com you agree to our cookies policy to enhance your experience.
  957. Site design & logo © 2018 Pastebin; user contributions (pastes) licensed under cc by-sa 3.0 -- Dedicated Server Hosting by Steadfast
  958. My Messages
  959. Top
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement