From 7e0dbb385f8dfc2379dde4571b3ea08276456ca7 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Fri, 13 Feb 2015 18:57:42 +1100 Subject: [PATCH] Add countdown module with team logos option --- assets/css/sportspress.css | 27 ++++++++ assets/fonts/sportspress.eot | Bin 6540 -> 6340 bytes assets/fonts/sportspress.svg | 5 +- assets/fonts/sportspress.ttf | Bin 6360 -> 6160 bytes assets/fonts/sportspress.woff | Bin 6436 -> 6236 bytes assets/js/admin/editor-lang.php | 2 +- includes/class-sp-modules.php | 6 +- modules/sportspress-countdowns.php | 105 +++++++++++++++++++++++++++++ sportspress.php | 1 - templates/countdown.php | 25 ++++++- 10 files changed, 163 insertions(+), 8 deletions(-) create mode 100644 modules/sportspress-countdowns.php diff --git a/assets/css/sportspress.css b/assets/css/sportspress.css index 41979724..06dc889e 100644 --- a/assets/css/sportspress.css +++ b/assets/css/sportspress.css @@ -250,6 +250,33 @@ padding: 0; } +/* Countdowns */ +.sp-template-countdown .event-name { + overflow: auto; +} +.sp-template-countdown .team-logo { + width: 20%; + height: auto; + max-width: 4em; +} +.sp-template-countdown .logo-odd { + float: left; + margin-right: 10px; +} +.sp-template-countdown .logo-even { + float: right; + margin-left: 10px; +} +.sp-template-countdown .team-logo img { + max-width: 100%; + max-height: 100%; + width: auto; + height: auto; +} +.sp-template-countdown .sp-countdown { + clear: both; +} + /* Google Maps */ .sp-google-map { height: 320px; diff --git a/assets/fonts/sportspress.eot b/assets/fonts/sportspress.eot index 432ebdcf128d2ade42439b6226fd3560693a636b..684f8fca5b79c7290c48db08f71dd082187d16e2 100755 GIT binary patch delta 624 zcmeA%K4QpvM1p}qU?QtIOVrisoQV!o>Qk(f=Q1!b$^bD-dSY<_15loUfk^>KbEM}~ zraf4$;R@tyFfa(KWTYmhFst4VXJ8QZ0m_?Y00o#IF#(yPEkHsgBe$f&Y&&Z#kiP=R zugS?zPPCP9VqstqQvvcFauX{G7_=D<0Qo6EzCvDNu4L+hNg~BS0iXelnF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/fonts/sportspress.svg +++ b/assets/fonts/sportspress.svg @@ -10,7 +10,6 @@ - @@ -20,7 +19,6 @@ - @@ -30,7 +28,8 @@ - + + diff --git a/assets/fonts/sportspress.ttf b/assets/fonts/sportspress.ttf index aaac5e2b7f14eb7a2648a47b159df5b94d341dc5..ff5ce3c674805dc86ad8dc58e31453c32c1c4af5 100755 GIT binary patch delta 612 zcmca%IKg0oLVb#L@>~W6Mj0SxNlz>;U|?VnU|?WU0MZ=kIhAP-mTR~I`5Fui!YUc5 zi7Cvg_rn<&M16qrW*I;M=0{9Grf3V0P|3(GsW98l8VlsF0P<^c@{<#7C7f6o7{pY7 ze23h`iUJ00h66x;3XrdmmzXP=x?qw>F;D<#0AprBesKu{Gf;{_{KLc@)#e|7EDHt& z1{MYh21W*jj~pKbKZ<>H{pkKNvn|WDvST=WZrE%07 zF-S3{OWpyP!CQ%VNCSxNzCQ}nVCS^e-HB%EaVQcoYgh);q(Spo@q9^Lw7>|M0%N?}+@t zH)8LPl^(kdfU-$2t&y%y05AjK0-|(l^m5C+<8R&(mH{$8wlznZ@Ybt(0Ffd6KpQD& z7BM1xn6T8=-rZaJL>D65M)-QPqcKwBuUaMig>Y4Sq_-2i@C?A}C2WsH+HK8~qkI=B z5EHuC+0oSv8q$KynL9IA`hSsZKiEMFS%AQ<(27M7l}x2tIjS@%1In#ck4mWqHAA(j z4%MX=sIpq3mad(14$r`M(ARx+7d_m8*nKVJWi_r|WboS0E^iQDAXxS!k#_kw%Q z-RFk5LH09CvlO$<{ALtph561bGfT`T<7?x%am*;DZIC;lxPs(SY)s^18TV^|1qrEW z3OFc)GJs$%vgV@VqCl_$1u2iq<93*kp3g&K(LvC z$qn=k&4U0=*h`+u!C`^V#l=MxxWr$Goj%L%fdyXg^kp~&YtU1Iz*k%8a#hy)b~O}@ zhEkC()n$dze5xh?9g$Nb+h?Ppa5NeYMN!3Yoh{r4pobR7N<2=V#@SD6Ry?~v noX)F@>HGBWsRn9_dP|?9@6yYL(}qdI53-W{X|N|QiPPv0QJCat diff --git a/assets/fonts/sportspress.woff b/assets/fonts/sportspress.woff index a157933d6dc40bc756b5b494922758e47c67d938..ae7e02ae256c751dcc72e47031a58e9c5b890eb0 100755 GIT binary patch delta 700 zcmZ2tbjLuf+~3WOfsp|SBw`r2!L$Ga<77uBv57kJ^(+hwj4UbE$#c^aiwhVSm~wy$ zIG|V{J*P4aC|1J2Aglty50-1VW~3&jFffSD0ID$qVP@6);Tb?dpx6ZcoKdFgSp)t%Q*iOKxHXP(W-0P(T5UwHXfNCFZ6A z#efDfW`gj7Ng~As`NcqoNZ3sL(_H@nsL%qaoP|LG=rx6p93KTgihXqb=>9R~W7Egh zPwJo9KXZPT{H*j@^|QujgU_a)ExrVQ$^6pvrQ<8dSC#*N|NjS?0JIQEXEIiuCQzM? zNIDtK{y*mX!}o>n1K%OOgM7>QI{DgppYgKuvhjT9dC&8f=QYn0o`*d5xsP&h;GW4n zgegUd<$vQ++im zp5Nvx12+>$3ByHZe_t3qxkk)fRvs)2B^ZG;P@OLjO9Qd-&w= z62@IjY)lSJ9ZZXuPB6V;)?z-#qQ#QKTElvYEskvg+bQ-K_8A-w99>~Zhhy?f~0om;7MyW1>9wmCO@nHrkGRzak_D9vXyAE2OtxUvE> zglq^UA!4sTqQ4eI5D^7EphPU8Kl~>J`=^rYRVbgGtL=~e=)i~H`F+p#_dDlsI8&Z` zKEC5nSs5T8!y>YL+@L?qe`k_$45X^a}1+B=E%gya`x3ZAM$k(L_bGy6$i zB2(`7mCQF)can|G#0<6#a^PiibyFSDZjr;ClNq_mwY9dik;7S(11p!Kzld=su`9t! zu4WTy(J1m_s#q%S7i+~H@#?%=q9l!!B3UH6xyN zZ23=Z&3|hB8?~1bwXr3{X3yzf>t5*|>iTrO>^GKXDQ1oN&4|n#^MjdXW|*(qx7s1? zpq5Wsj(PB&_<8KZQ3bFdAPJ3v4su}!KrkJd(@~x;5G+JN%I$Q!?0Tf;G7#_Ei`+Wo zu)Fg8fjl3dfr0_Qn^N<^fXhpHc$6-=1>OG$4No!xGs&`Y=o?gNR9spb zXGm2KyIHmvIWWTu7O(!X;5Hc3tVV-HD6Q!3pr{UtqdF-n>_EuKFvcW}-%OMlN^3e> z%I!KCzpeBrc#Vkzn>e+@ zo8mB;gYJ9;-ijipv#7$Gh@nU%B$F&uTEl2UUh-^OJhEl&R3sFRM8cs6D(tVcgu4OM zP!HDlQt|`5^;!9R*BSlpMbP4nM;xCk8Ivb+j6F96Gi`E~7>G=WFHG1%$Rn^Z1D_oW z@&e*wRea{YW;BL5T!n}5G+t5I6=jMm${gjmDo53 array( - 'details', 'results', 'performance', 'countdown' + 'details', 'results', 'performance' ), 'player' => array( 'details', 'statistics' diff --git a/includes/class-sp-modules.php b/includes/class-sp-modules.php index 5e675295..53aca1ce 100644 --- a/includes/class-sp-modules.php +++ b/includes/class-sp-modules.php @@ -5,7 +5,7 @@ * The SportsPress modules class stores available modules. * * @class SP_Modules - * @version 1.6 + * @version 1.6.1 * @package SportsPress/Classes * @category Class * @author ThemeBoy @@ -32,6 +32,10 @@ class SP_Modules { 'label' => __( 'Videos', 'sportspress' ), 'icon' => 'dashicons dashicons-video-alt', ), + 'countdowns' => array( + 'label' => __( 'Countdowns', 'sportspress' ), + 'icon' => 'sp-icon-clock', + ), 'tournaments' => array( 'label' => __( 'Tournaments', 'sportspress' ), 'class' => 'SportsPress_Tournaments', diff --git a/modules/sportspress-countdowns.php b/modules/sportspress-countdowns.php new file mode 100644 index 00000000..dd3f5e89 --- /dev/null +++ b/modules/sportspress-countdowns.php @@ -0,0 +1,105 @@ +define_constants(); + + // Actions + add_action( 'sportspress_widgets', array( $this, 'include_widgets' ) ); + + // Filters + add_filter( 'sportspress_shortcodes', array( $this, 'add_shortcodes' ) ); + add_filter( 'sportspress_event_settings', array( $this, 'add_settings' ) ); + } + + /** + * Define constants. + */ + private function define_constants() { + if ( !defined( 'SP_COUNTDOWNS_VERSION' ) ) + define( 'SP_COUNTDOWNS_VERSION', '1.6.1' ); + + if ( !defined( 'SP_COUNTDOWNS_URL' ) ) + define( 'SP_COUNTDOWNS_URL', plugin_dir_url( __FILE__ ) ); + + if ( !defined( 'SP_COUNTDOWNS_DIR' ) ) + define( 'SP_COUNTDOWNS_DIR', plugin_dir_path( __FILE__ ) ); + } + + /** + * Add widgets. + * + * @return array + */ + public function include_widgets() { + include_once( SP()->plugin_path() . '/includes/widgets/class-sp-widget-countdown.php' ); + } + + /** + * Add shortcodes. + * + * @return array + */ + public function add_shortcodes( $shortcodes ) { + $shortcodes['event'][] = 'countdown'; + return $shortcodes; + } + + /** + * Add settings. + * + * @return array + */ + public function add_settings( $settings ) { + $settings = array_merge( $settings, + array( + array( 'title' => __( 'Countdowns', 'sportspress' ), 'type' => 'title', 'id' => 'countdown_options' ), + ), + + apply_filters( 'sportspress_countdown_options', array( + array( + 'title' => __( 'Teams', 'sportspress' ), + 'desc' => __( 'Display logos', 'sportspress' ), + 'id' => 'sportspress_countdown_show_logos', + 'default' => 'no', + 'type' => 'checkbox', + ), + )), + + array( + array( 'type' => 'sectionend', 'id' => 'countdown_options' ), + ) + ); + return $settings; + } +} + +endif; + +if ( get_option( 'sportspress_load_countdowns_module', 'yes' ) == 'yes' ) { + new SportsPress_Countdowns(); +} diff --git a/sportspress.php b/sportspress.php index 7b2773de..eada084c 100644 --- a/sportspress.php +++ b/sportspress.php @@ -264,7 +264,6 @@ final class SportsPress { * Include core widgets. */ public function include_widgets() { - include_once( 'includes/widgets/class-sp-widget-countdown.php' ); include_once( 'includes/widgets/class-sp-widget-staff.php' ); do_action( 'sportspress_widgets' ); diff --git a/templates/countdown.php b/templates/countdown.php index 3988f363..2a91ef88 100644 --- a/templates/countdown.php +++ b/templates/countdown.php @@ -4,7 +4,7 @@ * * @author ThemeBoy * @package SportsPress/Templates - * @version 1.6 + * @version 1.6.1 */ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly @@ -14,6 +14,8 @@ $defaults = array( 'id' => null, 'live' => get_option( 'sportspress_enable_live_countdowns', 'yes' ) == 'yes' ? true : false, 'link_events' => get_option( 'sportspress_link_events', 'yes' ) == 'yes' ? true : false, + 'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false, + 'show_logos' => get_option( 'sportspress_countdown_show_logos', 'no' ) == 'yes' ? true : false, ); if ( isset( $id ) ): @@ -34,7 +36,26 @@ if ( $link_events ) $title = '' . $ ?>
-

+

+ ID, 'sp_team' ) ); + $i = 0; + + foreach ( $teams as $team ) { + $i++; + if ( has_post_thumbnail ( $team ) ) { + if ( $link_teams ) { + echo ''; + } else { + echo get_the_post_thumbnail( $team, 'sportspress-fit-icon', array( 'class' => 'team-logo logo-' . ( $i % 2 ? 'odd' : 'even' ) ) ); + } + } + } + } + ?> + +

ID, 'sp_venue' );