From d0e77dcb4d5ab1291251f5d7d3240818058e8af8 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Thu, 17 Sep 2015 12:33:16 +1000 Subject: [PATCH] Add icons module --- assets/css/icons.css | 50 ++++++ assets/css/menu.css | 57 +++++- assets/fonts/sportspress.eot | Bin 7888 -> 10208 bytes assets/fonts/sportspress.svg | 9 + assets/fonts/sportspress.ttf | Bin 7708 -> 10028 bytes assets/fonts/sportspress.woff | Bin 7784 -> 10104 bytes assets/fonts/sportspress.woff2 | Bin 3596 -> 4696 bytes assets/js/admin/iconpicker.js | 37 ++++ includes/admin/class-sp-admin-sports.php | 12 ++ includes/admin/views/html-admin-config.php | 6 +- license.txt | 5 +- modules/sportspress-icons.php | 168 ++++++++++++++++++ templates/event-logos.php | 8 +- .../event-performance-table-combined.php | 10 +- templates/event-performance-table.php | 141 ++++++--------- templates/event-performance.php | 24 +-- 16 files changed, 404 insertions(+), 123 deletions(-) create mode 100644 assets/css/icons.css create mode 100644 assets/js/admin/iconpicker.js create mode 100644 modules/sportspress-icons.php diff --git a/assets/css/icons.css b/assets/css/icons.css new file mode 100644 index 00000000..21b8c9e6 --- /dev/null +++ b/assets/css/icons.css @@ -0,0 +1,50 @@ +/* SportsPress icons */ +@font-face { + font-family: 'sportspress'; + src:url('../fonts/sportspress.eot?-76nsup'); + src:url('../fonts/sportspress.eot?#iefix-76nsup') format('embedded-opentype'), + url('../fonts/sportspress.woff2?-76nsup') format('woff2'), + url('../fonts/sportspress.ttf?-76nsup') format('truetype'), + url('../fonts/sportspress.woff?-76nsup') format('woff'), + url('../fonts/sportspress.svg?-76nsup#sportspress') format('svg'); + font-weight: normal; + font-style: normal; +} + +[class^="sp-icon-"], [class*=" sp-icon-"] { + font-family: sportspress, dashicons; + speak: none; + font-style: normal; + font-weight: normal; + font-variant: normal; + text-transform: none; + line-height: 1; + display: inline-block; + width: 20px; + height: 20px; + font-size: 20px; + vertical-align: top; + + /* Better Font Rendering =========== */ + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.sp-icon-baseball:before { + content: "\e701"; +} +.sp-icon-basketball:before { + content: "\e602"; +} +.sp-icon-cricketball:before { + content: "\e604"; +} +.sp-icon-soccerball:before { + content: "\e700"; +} +.sp-icon-shoe:before { + content: "\e800"; +} +.sp-icon-card:before { + content: "\e801"; +} \ No newline at end of file diff --git a/assets/css/menu.css b/assets/css/menu.css index bab481f5..8ef39c8b 100644 --- a/assets/css/menu.css +++ b/assets/css/menu.css @@ -1,12 +1,12 @@ /* SportsPress menu styles */ @font-face { font-family: 'sportspress'; - src:url('../fonts/sportspress.eot?gvy36n'); - src:url('../fonts/sportspress.eot?#iefixgvy36n') format('embedded-opentype'), - url('../fonts/sportspress.woff2?gvy36n') format('woff2'), - url('../fonts/sportspress.ttf?gvy36n') format('truetype'), - url('../fonts/sportspress.woff?gvy36n') format('woff'), - url('../fonts/sportspress.svg?gvy36n#sportspress') format('svg'); + src:url('../fonts/sportspress.eot?-76nsup'); + src:url('../fonts/sportspress.eot?#iefix-76nsup') format('embedded-opentype'), + url('../fonts/sportspress.woff2?-76nsup') format('woff2'), + url('../fonts/sportspress.ttf?-76nsup') format('truetype'), + url('../fonts/sportspress.woff?-76nsup') format('woff'), + url('../fonts/sportspress.svg?-76nsup#sportspress') format('svg'); font-weight: normal; font-style: normal; } @@ -138,6 +138,27 @@ .sp-icon-whistle:before { content: "\f227"; } +.sp-icon-baseball:before { + content: "\e701"; +} +.sp-icon-basketball:before { + content: "\e602"; +} +.sp-icon-golfball:before { + content: "\e603"; +} +.sp-icon-cricketball:before { + content: "\e604"; +} +.sp-icon-soccerball:before { + content: "\e700"; +} +.sp-icon-shoe:before { + content: "\e800"; +} +.sp-icon-card:before { + content: "\e801"; +} #adminmenu #toplevel_page_sportspress .toplevel_page_sportspress div.wp-menu-image:before, #adminmenu #toplevel_page_themeboy .toplevel_page_themeboy div.wp-menu-image:before, @@ -202,6 +223,30 @@ color: #ccc; } +/* Icons */ +.sp-icons .button { + margin: 0 3px 4px 0; + padding: 0 7px 1px 5px; +} + +.sp-icons .button i { + margin: 3px 0; +} + +.sp-icon-color-box input[type=text] { + color: #fff; +} + +.wp-admin .sp-icons label input[type=radio] { + margin-top: -3px; +} + +@media screen and (max-width: 782px) { + .wp-admin .sp-icons label input[type=radio] { + margin-top: 1px; + } +} + /* TinyMCE */ .mce-toolbar i.mce-i-sp_shortcodes_button, .mce-toolbar span.mce_sp_shortcodes_button { margin-right: -5px; diff --git a/assets/fonts/sportspress.eot b/assets/fonts/sportspress.eot index 9a009bb5e7ca66ceccad70e1f9d7dcd7cca2c4ab..907eb16b969ec2a3ec4dc766758d3ba54df6b4f2 100755 GIT binary patch delta 2746 zcma)8YiJzT6~5=rQI(}?nNjmb{JA}ADLwof&Duin^ zjPi#lXOEveeddujl>iQL4|4Iu6OS!i8oclp%2!ZcJh^b@6xr2JE)vpRMn(GZg_FmY zzxJn_D9@tm551}+o#)w2z0wjH1+<+U@iD_oQl#QnGnXzvC)_C3cq45L#W4%oe>j7QXrQpAUcY>b=KM8&u{Cn_k z+8?!FYZtYjYA}0n`LcDC7V@} zZEQ9d@3UU%otWswyDE_cybWt4NV@A}5U-{mD&;D^t!>GS`4=&YsvO=zX)uZxU|Uh= zOS7Pn&gIg{&dy{caep>@f5Oe@-R)8HBW~hT4#lT?dZ**5sr-(qRM?I=(bR!L@j%Ls z#q899V!d!66;4g<$WNu>)4e^@ah^m0GE2&^jvlHcLOO_tPL7aC@-W5}ql59lR^oB9 zOBg4~*Oibtr3#ubYz}rbxyU@%#t|C1fFo>$Op#BhxJDfqtWzfqDU8HWR zd5cOk5~Igx+}dC48g^0{;Wu36&?OqP_ZQQ{v6M@jG!~(vV8!XNz0Pn~QOKk)%ZD6_ zyH(nswc~Wn8;_+>bcWLH6?6XOyohw?B)!oyS%9 z?uWnFfLCCH^ph$XB@^U9a*!OsY<`@46K}$bmWH6nlM{op6*Qi{s2;3VaD-9C`0=Q^ zjB9YoUGDjEy|g(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KnH9q$S*EoUJzGcYrLpIpLN&94CDxiB~|urjbPFfu4iW?^!h9Kht_ z!1tf;FW*#u4)HDL>*nj^eZkAg%fa)X=P%D6o-aI~cs}sF<{st^%%{YzWJT%Cq@9T CS9Prb diff --git a/assets/fonts/sportspress.svg b/assets/fonts/sportspress.svg index 6463385d..129f688b 100755 --- a/assets/fonts/sportspress.svg +++ b/assets/fonts/sportspress.svg @@ -7,6 +7,15 @@ + + + + + + + + + diff --git a/assets/fonts/sportspress.ttf b/assets/fonts/sportspress.ttf index b9239a94d1e597a98f858cfc653f410facf0644d..3e1948e4fde99314958ff4fd2deac6ae5ac5802f 100755 GIT binary patch delta 2742 zcma)8YiJzT6~5=r-72voA@zJFDGz_1dRamK0fbWK|E#QIK%${IDZgmi)s` zOp>;43t7>$&|irY6-t9Bfk2=TLa|CxXlM;Brlg7qef$ZfEe=?2nv^DPaT2$ip1UJU zq&2j|z31F>&V8J@=bUe5W8{^i4FZG^ovaao6d#=LFDs|@-=O9V?2nv2zj$G!emhMF zB(X27EUc2zv6HlU}_~ZlJP6YVmxhr3H22q$MV?-hvzEA3gxD7X9eHtd@8)Tc@B#hfZetXstR*E9DOA*e3PD z>pwROjcP962YCw|6TD0=U(0(a)@%7usJrzJaGB$pz`Q(jEA>2(;=*V)JGxN3%bzn- z;qZNqb6+@|GR=t6dLrh%wd3(X+%S+#m_aC;rsqsHCLPZ-%MdgtX2+s)(J_)eu+U#z zIFLnN>_-k?+1u7g^TTXBENvQh4>L@zwYdvv%1NgR%Ei>j{#3-tAcng(s1TVm`Bkt#B!Fno} zOC>rx6XE!wZ1zyxD-^uFQS$?C;!}>trn`HlW67z)zNuu$iMo;Ge6cj2bfQrwIbUiN z=aZr2)V{)0GB(}QJssouqmWrrg)Q_@BVp1(^62C+nIsQkOffnb4{Q}4H>ZMel6+kS znOmu$3B%@MN0Wyv?>RU^BNuRlt(YnC2{q4b0D~>+h6Ry2QMx?l4yQ`gOEzy)iH4)} z42{`GO6egtnGt@;R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m{OEjQwkNSsrHW0+I#?X5d^dLMdY@klILpUd~p@^@$Z^Kb$0;4(Sw=F-&~zU|cUy%Kui@=sws0Vc@lA>bo$B`m}RS)`IcMF0w20NtV@2~70u zo4H?)&4ofkeyu2JILfRb;3Lv(DCU#8R7n+;kW5uIcW>BWdb9oa08siEu7E2wapup? z0|c=D3}C(kJr6eS&<&cU1d?bEQ-~n+TjZ55NDKskIN&k>qY|J>Apv6hCQu8) z0Fv&DO~<&>B?pyn;Yzr3ml|aJ#|g+fepc7M+_O57mm^cxMvs ziNAq_#E>dT^GL^#syjNj?L}H|y%7K2m)-yao}*Rzj9>{*iOb?s;!mZpv@E?M8}g!j zL4KF5uphI_?9aY{?~v~~-(}xFl?zH+UC_R$z3M;i|3EM3NAwSjym8qKnBO#i6;J~U Zfghj?+>Ii6!~3Hp6#v9R8?D4U@Ne7Ys_Os% delta 499 zcmez2_rgY`+~3WOfsp|SPlAlXDXb7#J8cfY=6v?bg^urY9By z#h8`=m2yC_KzdGP8c=Kv1A{~j2=DwPqmz-En8LsytpQYH2Er^$Ds3}>f{5c@(v7PNuPJS{_ou7;XP#^$=Q1e3-XIgfWGm7t78VTm>IuM=3%Vn2kCTSaA06%U;+ACVe%YC zx5+OUU2ORN^Zn)f%J-4)FyA4*<$T?IoxCr2Ie9sF{`36h`NQ*t=M&Edo|il?c%Jh- zvc^m)$ diff --git a/assets/fonts/sportspress.woff2 b/assets/fonts/sportspress.woff2 index 75a8e3e90b0d21d96dfaa971feafc5b82f1db4e9..2bb9e6f86b913ba3995b05d7fec620770792e129 100755 GIT binary patch literal 4696 zcmV-e5~uBVPew8T0RR9101{XL3jhEB04E>-01^rS0RR9100000000000000000000 z00006U;u(t5eN#xFtafMHUcCAfj|pl00bZfgEj{s8+;y7l#y08*;fa=VbS<)kRVBJ z%X(J~o64%pH?W3M{(*D#FKLpdNedNAkQ&AR(l+6)+%lh*7Apy6XIRq}EwDX@6+6?G zb1y3*a3aF)8K)~+h~~!9`d}c~@(^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|*DmUDG~|7FbNz zRAO`Xt5~Kth&XNrM_0PX*e4Zxql6>w{hlqc}Dar5@06b+7L_spjHfLNmJ_+o4OL1NxYeJY68WE= z{jp{J6JUoY)?0pj_NTmf>ZbrBQ?S{PFpPjGAQcHBB-O}%+dRTOu*N1{9Xz^+4^2sL z{p+9o+o1pVXRp_L2}Z9EIBkrpBtTSOc1q+c&q6Ev?{2rhG?Go?9JS=~`zkxuuj;g30(WYCt)xJ@zeq z<3^P<9rO?0<$r7*0_|p!s&hNE0mxlPk>&FyoKUb-kftkMfZ0W!z+y^gmWz3ZKhp0^iWpYpv;jdQ)D_bnLq=O5%_AAR{nr?#MVVxqM+bZ%)& z0rnB7{AZM13McIDw8VtA?2vS;l)LGuE1jd)-8g>yhE9u?A?H*Vw9WmVZJacGG`Z_V zgYhN!i;dRC3hSF$h`nj8XtctfJ=tWS-v7+U*KRa@>Fo%`{R zhPP~$2ljzxhv^4PZ-b_uqje?;D}UYj!UtMyJrw8bMMjE?^3$N0@|xjXE?K%3t& zF*Rk1Vpe!QYKkiUi`VZ0dD!giv(L`XJp0^#V+1?;tMjuvzM9wYH(*?M+VdB_d27&Z zrg{k<*kz!B*C78^y5+6l4~R#p7+ePy4iFEOmHY%@YXAxqhYE@tHkSc8TZ6e7(L8N# ztpGw@+fwRE7GoMKoWZ8AofYN!^>`$VASUB+jM?!7jz5%)R70uAl2AHwqB%=&Ld;~d z4lrgB#^Z9`Kb~MFhmw&$45cF1gwl~aT49M^%A2Zd03p-Tjie$j2!6rxP%ehM);VDi zNLna3mvx-AH!Sz(Hq7U0vLBcpmqs;iDMon&0ky*L(Ch7;CmB1m*hcHbBM_m*ys3Z= S;32PPZ`aYuk#_z&0s{atV9B@u diff --git a/assets/js/admin/iconpicker.js b/assets/js/admin/iconpicker.js new file mode 100644 index 00000000..04f99c60 --- /dev/null +++ b/assets/js/admin/iconpicker.js @@ -0,0 +1,37 @@ +jQuery(document).ready(function($){ + + // Icon picker + $('.sp-icons input').on('change', function() { + if ('' == $(this).val()) { + $('.sp-custom-colors').hide(); + $('.sp-custom-thumbnail').show(); + } else { + $('.sp-custom-thumbnail').hide(); + $('.sp-custom-colors').show(); + } + }); + + // Color picker + $('.colorpick').iris( { + change: function(event, ui){ + $(this).css( { backgroundColor: ui.color.toString() } ); + }, + hide: true, + border: true + } ).each( function() { + $(this).css( { backgroundColor: $(this).val() } ); + }) + .click(function(){ + $('.iris-picker').hide(); + $(this).closest('.sp-icon-color-box, td').find('.iris-picker').show(); + }); + + $('body').click(function() { + $('.iris-picker').hide(); + }); + + $('.sp-icon-color-box, .colorpick').click(function(event){ + event.stopPropagation(); + }); + +}); \ No newline at end of file diff --git a/includes/admin/class-sp-admin-sports.php b/includes/admin/class-sp-admin-sports.php index 5ebe716e..647d3f04 100644 --- a/includes/admin/class-sp-admin-sports.php +++ b/includes/admin/class-sp-admin-sports.php @@ -47,6 +47,16 @@ class SP_Admin_Sports { $id = preg_replace('/\\.[^.\\s]{3,4}$/', '', $file ); $presets[ $id ] = $data; $name = array_key_exists( 'name', $data ) ? __( $data['name'], 'sportspress' ) : $id; + + // Conditionally append filename in parentheses for clarity + if ( false === strpos( str_replace( ' ', '', strtolower( $data['name'] ) ), str_replace( '-', '', $id ) ) ) { + if ( 4 < strlen( $id ) ) { + $name .= ' (' . ucfirst( $id ) . ')'; + } else { + $name .= ' (' . strtoupper( $id ) . ')'; + } + } + self::$options[ $slug ][ $id ] = $name; } asort( self::$options[ $slug ] ); @@ -153,6 +163,8 @@ class SP_Admin_Sports { if ( isset( $performance['position'] ) ) { wp_set_object_terms( $id, $performance['position'], 'sp_position', false ); } + update_post_meta( $id, 'sp_icon', sp_array_value( $performance, 'icon', null ) ); + update_post_meta( $id, 'sp_color', sp_array_value( $performance, 'color', null ) ); $i ++; } diff --git a/includes/admin/views/html-admin-config.php b/includes/admin/views/html-admin-config.php index 81dec039..52d3bdea 100644 --- a/includes/admin/views/html-admin-config.php +++ b/includes/admin/views/html-admin-config.php @@ -185,9 +185,11 @@ ID ) ) - echo get_the_post_thumbnail( $row->ID, 'sportspress-fit-mini' ); + $icon = get_the_post_thumbnail( $row->ID, 'sportspress-fit-mini' ); else - echo ' '; + $icon = ' '; + + echo apply_filters( 'sportspress_performance_icon', $icon, $row->ID ); ?> post_title; ?> diff --git a/license.txt b/license.txt index d14e3cfa..34aca7e5 100644 --- a/license.txt +++ b/license.txt @@ -25,8 +25,9 @@ permission notices: SportsPress includes icons from WebHostingHub Glyphs, released under the SIL Open Font License; 80 Shades of White Icons by Victor Erixon; Entypo and Entypo+ by Daniel Bruce, released under CC BY-SA 3.0; Font Awesome by - Dave Gancy, released under the GPL. The custom designed icons included in - SportsPress are released under the GPL. + Dave Gancy, released under the GPL; Flaticon by Freepick, released under + CC BY 3.0. The custom designed icons included in SportsPress are released + under the GPL. Wherever third party code has been used, credit has been given in the code's comments. diff --git a/modules/sportspress-icons.php b/modules/sportspress-icons.php new file mode 100644 index 00000000..248dda2a --- /dev/null +++ b/modules/sportspress-icons.php @@ -0,0 +1,168 @@ +define_constants(); + + // Define icons + $this->get_icons(); + + add_filter( 'sportspress_enqueue_styles', array( $this, 'add_styles' ) ); + add_filter( 'sportspress_performance_icon', array( $this, 'icon' ), 10, 2 ); + add_filter( 'sportspress_event_performance_icons', array( $this, 'replace_icons' ), 10, 3 ); + add_filter( 'admin_post_thumbnail_html', array( $this, 'admin_post_thumbnail_html' ), 10, 2 ); + add_action( 'sportspress_process_sp_performance_meta', array( $this, 'save' ), 10, 2 ); + } + + /** + * Define constants. + */ + private function define_constants() { + if ( !defined( 'SP_ICONS_VERSION' ) ) + define( 'SP_ICONS_VERSION', '1.9' ); + + if ( !defined( 'SP_ICONS_URL' ) ) + define( 'SP_ICONS_URL', plugin_dir_url( __FILE__ ) ); + + if ( !defined( 'SP_ICONS_DIR' ) ) + define( 'SP_ICONS_DIR', plugin_dir_path( __FILE__ ) ); + } + + /** + * Add stylesheet. + */ + public static function add_styles( $styles = array() ) { + $styles['sportspress-icons'] = array( + 'src' => str_replace( array( 'http:', 'https:' ), '', SP()->plugin_url() ) . '/assets/css/icons.css', + 'deps' => '', + 'version' => SP_ICONS_VERSION, + 'media' => 'all' + ); + return $styles; + } + + /** + * Define icons. + */ + private function get_icons() { + $this->icons = apply_filters( 'sportspress_icons', array( + 'soccerball', + 'baseball', + 'basketball', + 'cricketball', + 'shoe', + 'card', + ) ); + } + + /** + * Display vector icon. + */ + public function icon( $icon = '', $id = 0 ) { + if ( ! $id ) return $icon; + $meta = get_post_meta( $id, 'sp_icon', true ); + if ( null !== $meta && in_array( $meta, $this->icons ) ) { + $color = get_post_meta( $id, 'sp_color', true ); + $icon = ''; + } + return $icon; + } + + /** + * Replace icons with vectors when available. + */ + public function replace_icons( $icons = '', $id = 0, $value = 0 ) { + if ( ! $id || ! $value ) return $icons; + $icon = get_post_meta( $id, 'sp_icon', true ); + if ( null !== $icon && in_array( $icon, $this->icons ) ) { + $title = get_the_title( $id ); + $color = get_post_meta( $id, 'sp_color', true ); + $icons = str_repeat( '' . ' ', $value ); + } + return $icons; + } + + /** + * Post thumbnail HTML. + */ + public function admin_post_thumbnail_html( $content = '', $id = 0 ) { + // Bypass if no ID + if ( ! $id ) return $content; + + // Bypass if not performance post type + $post_type = get_post_type( $id ); + if ( 'sp_performance' !== $post_type ) return $content; + + // Enqueue scripts + wp_enqueue_script( 'sp_iconpicker', SP()->plugin_url() . '/assets/js/admin/iconpicker.js', array( 'jquery', 'wp-color-picker', 'iris' ), SP_ICONS_VERSION, true ); + + // Get selected icon + $has_icon = has_post_thumbnail( $id ); + $selected = get_post_meta( $id, 'sp_icon', true ); + if ( $has_icon ) $selected = null; + + // Generate icon selector + $icons = ''; + foreach ( $this->icons as $icon ) { + $icons .= ''; + } + + $icons .= ''; + + // Get color value + $value = get_post_meta( $id, 'sp_color', true ); + if ( empty( $value ) ) $value = '111111'; + + $color = '
'; + + $content = '

' . __( 'Select Icon', 'sportspress' ) . '

+

' . $icons . '

+
' . $color . '
+
' . $content . '
'; + return $content; + } + + /** + * Save meta boxes data + */ + public static function save( $post_id, $post ) { + update_post_meta( $post_id, 'sp_icon', sp_array_value( $_POST, 'sp_icon', null ) ); + update_post_meta( $post_id, 'sp_color', sp_array_value( $_POST, 'sp_color', null ) ); + if ( null != sp_array_value( $_POST, 'sp_icon', null ) ) { + delete_post_thumbnail( $post ); + } + } +} + +endif; + +new SportsPress_Icons(); \ No newline at end of file diff --git a/templates/event-logos.php b/templates/event-logos.php index b9cb4585..d53d772d 100644 --- a/templates/event-logos.php +++ b/templates/event-logos.php @@ -32,9 +32,11 @@ if ( $teams ): if ( ! has_post_thumbnail( $team ) ) continue; $logo = get_the_post_thumbnail( $team, 'sportspress-fit-icon' ); + $alt = sizeof( $teams ) == 2 && $i % 2; + // Add team name if ( $show_team_names ) { - if ( $i % 2 ) { + if ( $alt ) { $logo .= ' ' . get_the_title( $team ) . ''; } else { $logo = '' . get_the_title( $team ) . ' ' . $logo; @@ -46,7 +48,7 @@ if ( $teams ): // Add result if ( $show_results ) { - if ( $i % 2 ) { + if ( $alt ) { $logo = '' . array_shift( $results ) . ' ' . $logo; } else { $logo .= ' ' . array_shift( $results ) . ''; @@ -58,7 +60,7 @@ if ( $teams ): endforeach; $team_logos = array_filter( $team_logos ); if ( ! empty( $team_logos ) ): - echo '
'; + echo '
'; $delimiter = get_option( 'sportspress_event_teams_delimiter', 'vs' ); echo implode( ' ' . $delimiter . ' ', $team_logos ); echo '
'; diff --git a/templates/event-performance-table-combined.php b/templates/event-performance-table-combined.php index 8d543cae..f0ca5297 100644 --- a/templates/event-performance-table-combined.php +++ b/templates/event-performance-table-combined.php @@ -12,7 +12,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly // Initialize totals $totals = array(); ?> -
+

@@ -94,9 +94,11 @@ $totals = array(); echo '' . $value . ''; elseif ( intval( $value ) && $mode == 'icons' ): $performance_id = sp_array_value( $performance_ids, $key, null ); + $icons = ''; if ( $performance_id && has_post_thumbnail( $performance_id ) ): - echo str_repeat( get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini' ) . ' ', $value ); + $icons = str_repeat( get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini' ) . ' ', $value ); endif; + echo apply_filters( 'sportspress_event_performance_icons', $icons, $performance_id, $value ); endif; endforeach; @@ -142,9 +144,11 @@ $totals = array(); echo '' . $value . ''; elseif ( intval( $value ) && $mode == 'icons' ): $performance_id = sp_array_value( $performance_ids, $key, null ); + $icons = ''; if ( $performance_id && has_post_thumbnail( $performance_id ) ): - echo str_repeat( get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini' ) . ' ', $value ); + $icons = str_repeat( get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini' ) . ' ', $value ); endif; + echo apply_filters( 'sportspress_event_performance_icons', $icons, $performance_id, $value ); endif; endforeach; diff --git a/templates/event-performance-table.php b/templates/event-performance-table.php index 38686a67..fe08a9e3 100644 --- a/templates/event-performance-table.php +++ b/templates/event-performance-table.php @@ -11,8 +11,12 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly // Initialize totals $totals = array(); + +// Set null +if ( ! isset( $position ) ) $position = null; +if ( ! isset( $class ) ) $class = null; ?> -
+

@@ -54,6 +58,8 @@ $totals = array(); $lineup_sub_relation[ sp_array_value( $sub, 'sub', 0 ) ] = $sub_id; endforeach; + $data = apply_filters( 'sportspress_event_performance_players', $data, $lineups, $subs ); + $i = 0; foreach ( $data as $player_id => $row ): @@ -131,9 +137,11 @@ $totals = array(); echo '' . $value . ''; elseif ( intval( $value ) && $mode == 'icons' ): $performance_id = sp_array_value( $performance_ids, $key, null ); + $icons = ''; if ( $performance_id && has_post_thumbnail( $performance_id ) ): - echo str_repeat( get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini' ) . ' ', $value ); + $icons = str_repeat( get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini' ) . ' ', $value ); endif; + echo apply_filters( 'sportspress_event_performance_icons', $icons, $performance_id, $value ); endif; endforeach; @@ -147,111 +155,62 @@ $totals = array(); ?> - + <> - -  '; - } - echo '' . __( 'Extras', 'sportspress' ) . ''; - endif; + do_action( 'sportspress_event_performance_table_footer', $data, $labels, $position, $performance_ids ); + if ( ! $primary || sizeof( array_intersect_key( $totals, array_flip( (array) $primary ) ) ) ) { + ?> + +  '; + } + echo '' . __( 'Total', 'sportspress' ) . ''; + endif; - $row = sp_array_value( $data, -1, array() ); + $row = sp_array_value( $data, 0, array() ); - if ( $mode == 'icons' ) echo ''; + if ( $mode == 'icons' ) echo ''; - foreach ( $labels as $key => $label ): - if ( 'name' == $key ) - continue; - if ( isset( $position ) && 'position' == $key ) - continue; - if ( $key == 'position' ): + foreach ( $labels as $key => $label ): + if ( 'name' == $key ) + continue; + if ( isset( $position ) && 'position' == $key ) + continue; + if ( $key == 'position' ): + $value = ' '; + else: + if ( $primary && $key !== $primary ): $value = ' '; elseif ( array_key_exists( $key, $row ) && $row[ $key ] != '' ): $value = $row[ $key ]; else: - $value = ' '; + $value = apply_filters( 'sportspress_event_performance_table_total_value', sp_array_value( $totals, $key, 0 ), $data, $key ); endif; - - if ( $mode == 'values' ): - echo '' . $value . ''; - elseif ( intval( $value ) && $mode == 'icons' ): - $performance_id = sp_array_value( $performance_ids, $key, null ); - if ( $performance_id && has_post_thumbnail( $performance_id ) ): - echo str_repeat( get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini' ) . ' ', $value ); - endif; - endif; - endforeach; - - if ( $mode == 'icons' ) echo ''; - ?> - - - -  '; - } - echo '' . __( 'Total', 'sportspress' ) . ''; endif; - $row = sp_array_value( $data, 0, array() ); - - if ( $mode == 'icons' ) echo ''; - - foreach ( $labels as $key => $label ): - if ( 'name' == $key ) - continue; - if ( isset( $position ) && 'position' == $key ) - continue; - if ( $key == 'position' ): - $value = ' '; - else: - if ( $primary && $key !== $primary ): - $value = ' '; - elseif ( array_key_exists( $key, $row ) && $row[ $key ] != '' ): - $value = $row[ $key ]; - else: - $value = sp_array_value( $totals, $key, 0 ); - if ( $show_extras ) { - $value += sp_array_value( sp_array_value( $data, -1, array() ), $key, 0 ); - } - endif; + if ( $mode == 'values' ): + echo '' . $value . ''; + elseif ( intval( $value ) && $mode == 'icons' ): + $performance_id = sp_array_value( $performance_ids, $key, null ); + $icons = ''; + if ( $performance_id && has_post_thumbnail( $performance_id ) ): + $icons = str_repeat( get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini' ) . ' ', $value ); endif; + echo apply_filters( 'sportspress_event_performance_icons', $icons, $performance_id, $value ); + endif; + endforeach; - if ( $mode == 'values' ): - echo '' . $value . ''; - elseif ( intval( $value ) && $mode == 'icons' ): - $performance_id = sp_array_value( $performance_ids, $key, null ); - if ( $performance_id && has_post_thumbnail( $performance_id ) ): - echo str_repeat( get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini' ) . ' ', $value ); - endif; - endif; - endforeach; - - if ( $mode == 'icons' ) echo ''; - ?> - - + if ( $mode == 'icons' ) echo ''; + ?> + >
-
\ No newline at end of file +
+ + \ No newline at end of file diff --git a/templates/event-performance.php b/templates/event-performance.php index c47e84e2..01693b24 100644 --- a/templates/event-performance.php +++ b/templates/event-performance.php @@ -11,16 +11,15 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly $show_players = get_option( 'sportspress_event_show_players', 'yes' ) === 'yes' ? true : false; $show_staff = get_option( 'sportspress_event_show_staff', 'yes' ) === 'yes' ? true : false; -$show_extras = get_option( 'sportspress_event_show_extras', 'no' ) === 'yes' ? true : false; $show_total = get_option( 'sportspress_event_show_total', 'yes' ) === 'yes' ? true : false; $show_numbers = get_option( 'sportspress_event_show_player_numbers', 'yes' ) === 'yes' ? true : false; $split_positions = get_option( 'sportspress_event_split_players_by_position', 'no' ) === 'yes' ? true : false; $split_teams = get_option( 'sportspress_event_split_players_by_team', 'yes' ) === 'yes' ? true : false; $reverse_teams = get_option( 'sportspress_event_performance_reverse_teams', 'no' ) === 'yes' ? true : false; -$primary = get_option( 'sportspress_primary_performance', null ); +$primary = sp_get_main_performance_option(); $total = get_option( 'sportspress_event_total_performance', 'all'); -if ( ! $show_players && ! $show_staff && ! $show_extras && ! $show_total ) return; +if ( ! $show_players && ! $show_staff && ! $show_total ) return; if ( ! isset( $id ) ) $id = get_the_ID(); @@ -72,9 +71,7 @@ if ( is_array( $teams ) ): $players = sp_array_between( (array)get_post_meta( $id, 'sp_player', false ), 0, $index ); $has_players = sizeof( $players ) > 1; - if ( $show_extras ) { - $players[] = -1; - } + $players = apply_filters( 'sportspress_event_performance_split_team_players', $players ); $show_team_players = $show_players && $has_players; @@ -91,9 +88,9 @@ if ( is_array( $teams ) ): $data = sp_array_value( array_values( $performance ), $index ); } - if ( ! $show_team_players && ! $show_staff && ! $show_extras && ! $show_total ) continue; + if ( ! $show_team_players && ! $show_staff && ! $show_total ) continue; - if ( $show_team_players || $show_extras || $show_total ) { + if ( $show_team_players || $show_total ) { if ( $split_positions ) { $positions = get_terms( 'sp_position', array( 'orderby' => 'slug', @@ -138,9 +135,7 @@ if ( is_array( $teams ) ): } if ( sizeof( $subdata ) ) { - if ( $show_extras ) { - $subdata[-1] = sp_array_value( $data, -1 ); - } + $subdata = apply_filters( 'sportspress_event_performance_split_team_split_position_subdata', $subdata, $data ); sp_get_template( 'event-performance-table.php', array( 'position' => sp_get_position_caption( $position->term_id ), @@ -148,7 +143,6 @@ if ( is_array( $teams ) ): 'sortable' => $sortable, 'show_players' => $show_team_players, 'show_numbers' => $show_numbers, - 'show_extras' => $show_extras, 'show_total' => $show_total, 'caption' => 0 == $position_index && $team_id ? get_the_title( $team_id ) : null, 'labels' => $sublabels, @@ -158,6 +152,7 @@ if ( is_array( $teams ) ): 'link_posts' => $link_posts, 'performance_ids' => isset( $performance_ids ) ? $performance_ids : null, 'primary' => 'primary' == $total ? $primary : null, + 'class' => 'sp-template-event-performance-team-' . $index . '-position-' . $position_index, ) ); } } @@ -167,7 +162,6 @@ if ( is_array( $teams ) ): 'sortable' => $sortable, 'show_players' => $show_team_players, 'show_numbers' => $show_numbers, - 'show_extras' => $show_extras, 'show_total' => $show_total, 'caption' => $team_id ? get_the_title( $team_id ) : null, 'labels' => $labels, @@ -222,7 +216,6 @@ if ( is_array( $teams ) ): 'sortable' => $sortable, 'show_players' => $show_players, 'show_numbers' => $show_numbers, - 'show_extras' => $show_extras, 'show_total' => $show_total, 'caption' => sp_get_position_caption( $position->term_id ), 'labels' => $labels, @@ -241,9 +234,8 @@ if ( is_array( $teams ) ): 'sortable' => $sortable, 'show_players' => $show_players, 'show_numbers' => $show_numbers, - 'show_extras' => $show_extras, 'show_total' => $show_total, - 'caption' => __( 'Performance', 'sportspress' ), + 'caption' => __( 'Box Score', 'sportspress' ), 'labels' => $labels, 'mode' => $mode, 'data' => $data,