Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/ultimate.../classes
File: wsl-main-class.php
<?php
[0] Fix | Delete
/*
[1] Fix | Delete
Exit if accessed directly
[2] Fix | Delete
*/
[3] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) exit;
[4] Fix | Delete
if ( ! class_exists( 'LCW_Live_Score' ) ) {
[5] Fix | Delete
[6] Fix | Delete
class LCW_Live_Score extends LCW_Base_Class{
[7] Fix | Delete
[8] Fix | Delete
/**
[9] Fix | Delete
* Setup the plugin data
[10] Fix | Delete
*
[11] Fix | Delete
* @since 1.0.0
[12] Fix | Delete
*/
[13] Fix | Delete
public function __construct() {
[14] Fix | Delete
[15] Fix | Delete
$this->add_action( 'admin_menu', 'lcw_score_admin_menus');
[16] Fix | Delete
[17] Fix | Delete
$this->add_action( 'wp_loaded', 'lcw_score_front_reg_scripts');
[18] Fix | Delete
[19] Fix | Delete
$this->add_action( 'admin_enqueue_scripts', 'lcw_score_admin_scripts');
[20] Fix | Delete
[21] Fix | Delete
$this->add_action( 'admin_enqueue_scripts', 'lcw_score_admin_styles');
[22] Fix | Delete
[23] Fix | Delete
$this->add_action( 'wp_enqueue_scripts', 'lcw_score_front_scripts');
[24] Fix | Delete
[25] Fix | Delete
$this->add_action( 'wp_enqueue_scripts', 'lcw_score_front_styles');
[26] Fix | Delete
[27] Fix | Delete
$this->add_action( 'wp_footer', 'lcw_add_js_code');
[28] Fix | Delete
[29] Fix | Delete
$this->add_action( 'wp_head', 'lcw_add_css_code');
[30] Fix | Delete
[31] Fix | Delete
$this->add_action( 'init', 'lcw_score_mapping' );
[32] Fix | Delete
[33] Fix | Delete
$this->add_action( 'init', 'lcw_score_matches_mapping' );
[34] Fix | Delete
[35] Fix | Delete
$this->add_filter( 'lcw_fixture_text', 'lcw_add_fixture_text');
[36] Fix | Delete
[37] Fix | Delete
$this->add_filter( 'lcw_stats_tab_text' , 'lcw_add_stats_tab_text');
[38] Fix | Delete
[39] Fix | Delete
$this->add_filter( 'lcw_completed_tab_text' , 'lcw_add_completed_tab_text');
[40] Fix | Delete
[41] Fix | Delete
$this->add_filter( 'lcw_upcomming_tab_text' , 'lcw_add_upcomming_tab_text');
[42] Fix | Delete
[43] Fix | Delete
$this->add_filter( 'lcw_series_text' , 'lcw_add_series_text');
[44] Fix | Delete
[45] Fix | Delete
$this->add_filter( 'lcw_completed_widget_text', 'lcw_add_completed_widget_text');
[46] Fix | Delete
[47] Fix | Delete
$this->add_filter( 'lcw_upcomming_widget_text', 'lcw_add_upcomming_widget_text');
[48] Fix | Delete
[49] Fix | Delete
$this->add_filter( 'lcw_live_widget_text', 'lcw_add_live_widget_text');
[50] Fix | Delete
[51] Fix | Delete
$this->add_ajax ( 'lcw_update_score', 'lcw_update_score');
[52] Fix | Delete
[53] Fix | Delete
$this->add_ajax ( 'lcw_update_live_score', 'lcw_update_live_score');
[54] Fix | Delete
[55] Fix | Delete
$this->add_ajax ( 'lcw_update_score_cards', 'lcw_update_score_cards');
[56] Fix | Delete
$this->add_ajax ( 'lcw_update_psl_score', 'lcw_update_psl_score');
[57] Fix | Delete
$this->add_ajax ( 'lcw_update_psl_score_shortcode', 'lcw_update_psl_score_shortcode');
[58] Fix | Delete
$this->register_shortcode( 'series', 'lcw_score_series_shortcode' );
[59] Fix | Delete
[60] Fix | Delete
$this->register_shortcode( 'series-matches', 'lcw_score_series_matches_shortcode' );
[61] Fix | Delete
[62] Fix | Delete
$this->register_shortcode( 'match-detail', 'lcw_match_detail_shortcode' );
[63] Fix | Delete
[64] Fix | Delete
$this->register_shortcode( 'player-stats', 'lcw_player_stats_shortcode' );
[65] Fix | Delete
$this->register_shortcode( 'psl-match', 'lcw_psl_match_shortcode' );
[66] Fix | Delete
$this->add_action( 'init', 'lcw_feed');
[67] Fix | Delete
$this->add_filter( 'document_title_parts', 'lcw_change_document_title_parts' );
[68] Fix | Delete
$this->add_filter( 'pre_get_document_title', 'lcw_change_document_title', 999,1 );
[69] Fix | Delete
$this->add_action( 'init','lcw_rewrite_rules');
[70] Fix | Delete
$this->add_action( 'admin_init', 'lcw_flush_rewrite');
[71] Fix | Delete
$this->add_ajax ( 'lcw_series_list', 'lcw_list_ajax');
[72] Fix | Delete
$this->add_action( 'admin_footer' , 'lcw_series_list' );
[73] Fix | Delete
$this->add_action( 'admin_head' , 'lcw_mce_button');
[74] Fix | Delete
[75] Fix | Delete
}
[76] Fix | Delete
public function lcw_update_psl_score_shortcode( ){
[77] Fix | Delete
[78] Fix | Delete
die();
[79] Fix | Delete
}
[80] Fix | Delete
public function lcw_flush_rewrite() {
[81] Fix | Delete
[82] Fix | Delete
if ( !get_option('plugin_settings_have_changed') ) {
[83] Fix | Delete
flush_rewrite_rules();
[84] Fix | Delete
update_option('plugin_settings_have_changed', false);
[85] Fix | Delete
}
[86] Fix | Delete
}
[87] Fix | Delete
/**
[88] Fix | Delete
* Add widget to Admin
[89] Fix | Delete
*
[90] Fix | Delete
* @access public
[91] Fix | Delete
* @param void
[92] Fix | Delete
* @return void
[93] Fix | Delete
* @since 1.0.0
[94] Fix | Delete
*/
[95] Fix | Delete
public function lcw_score_widget( ){
[96] Fix | Delete
register_widget( 'lcw_live_score_widget' );
[97] Fix | Delete
}
[98] Fix | Delete
/**
[99] Fix | Delete
* Add Admin Menu
[100] Fix | Delete
*
[101] Fix | Delete
* @access public
[102] Fix | Delete
* @param void
[103] Fix | Delete
* @return void
[104] Fix | Delete
* @since 1.0.0
[105] Fix | Delete
*/
[106] Fix | Delete
public static function lcw_score_admin_menus() {
[107] Fix | Delete
[108] Fix | Delete
add_menu_page( LCW_LIVE_SCORE_PLUGIN_NAME, __( LCW_LIVE_SCORE_PLUGIN_NAME , 'emoji-reaction-settings' ), 'manage_options', 'lcw-score-settings', array(
[109] Fix | Delete
__CLASS__,
[110] Fix | Delete
'lcw_score_plugin_settings_page'
[111] Fix | Delete
[112] Fix | Delete
), plugins_url( 'images/live-score.png', dirname(__FILE__)));
[113] Fix | Delete
[114] Fix | Delete
[115] Fix | Delete
}
[116] Fix | Delete
/**
[117] Fix | Delete
* Add Settings Page
[118] Fix | Delete
*
[119] Fix | Delete
* @access public
[120] Fix | Delete
* @param void
[121] Fix | Delete
* @return void
[122] Fix | Delete
* @since 1.0.0
[123] Fix | Delete
*/
[124] Fix | Delete
public static function lcw_score_plugin_settings_page() {
[125] Fix | Delete
[126] Fix | Delete
require_once LCW_LIVE_SCORE_ROOT_PATH . '/admin-pages/live-score-settings.php';
[127] Fix | Delete
}
[128] Fix | Delete
public function lcw_feed(){
[129] Fix | Delete
[130] Fix | Delete
add_feed('lcw-feed', array($this,'lcw_feed_content'));
[131] Fix | Delete
}
[132] Fix | Delete
[133] Fix | Delete
/**
[134] Fix | Delete
* Function to output button list ajax script
[135] Fix | Delete
* @since 1.6
[136] Fix | Delete
* @return string
[137] Fix | Delete
*/
[138] Fix | Delete
public function lcw_series_list() {
[139] Fix | Delete
// create nonce
[140] Fix | Delete
global $pagenow;
[141] Fix | Delete
if( $pagenow != 'admin.php' ){
[142] Fix | Delete
$nonce = wp_create_nonce( 'twd-nonce' );
[143] Fix | Delete
?>
[144] Fix | Delete
<script type="text/javascript">
[145] Fix | Delete
jQuery( document ).ready( function( $ ) {
[146] Fix | Delete
var data = {
[147] Fix | Delete
'action' : 'lcw_series_list', // wp ajax action
[148] Fix | Delete
'security' : '<?php echo $nonce; ?>' // nonce value created earlier
[149] Fix | Delete
};
[150] Fix | Delete
// fire ajax
[151] Fix | Delete
jQuery.post( ajaxurl, data, function( response ) {
[152] Fix | Delete
// if nonce fails then not authorized else settings saved
[153] Fix | Delete
if( response === '-1' ){
[154] Fix | Delete
// do nothing
[155] Fix | Delete
console.log('error');
[156] Fix | Delete
} else {
[157] Fix | Delete
if (typeof(tinyMCE) != 'undefined') {
[158] Fix | Delete
if (tinyMCE.DOM != null) {
[159] Fix | Delete
tinyMCE.DOM.cptPostsList = response;
[160] Fix | Delete
}
[161] Fix | Delete
}
[162] Fix | Delete
}
[163] Fix | Delete
});
[164] Fix | Delete
});
[165] Fix | Delete
</script>
[166] Fix | Delete
<?php
[167] Fix | Delete
}
[168] Fix | Delete
}
[169] Fix | Delete
// Hooks your functions into the correct filters
[170] Fix | Delete
public function lcw_mce_button() {
[171] Fix | Delete
// check user permissions
[172] Fix | Delete
if ( !current_user_can( 'edit_posts' ) && !current_user_can( 'edit_pages' ) ) {
[173] Fix | Delete
return;
[174] Fix | Delete
}
[175] Fix | Delete
// check if WYSIWYG is enabled
[176] Fix | Delete
if ( 'true' == get_user_option( 'rich_editing' ) ) {
[177] Fix | Delete
$this->add_filter( 'mce_external_plugins', 'add_mce_plugin' );
[178] Fix | Delete
$this->add_filter( 'mce_buttons', 'register_mce_button' );
[179] Fix | Delete
}
[180] Fix | Delete
}
[181] Fix | Delete
[182] Fix | Delete
// Script for our mce button
[183] Fix | Delete
public function add_mce_plugin( $plugin_array ) {
[184] Fix | Delete
$plugin_array['twd_mce_button'] = plugins_url('js/mce.js',dirname(__FILE__));
[185] Fix | Delete
return $plugin_array;
[186] Fix | Delete
}
[187] Fix | Delete
[188] Fix | Delete
// Register our button in the editor
[189] Fix | Delete
public function register_mce_button( $buttons ) {
[190] Fix | Delete
array_push( $buttons, 'twd_mce_button' );
[191] Fix | Delete
return $buttons;
[192] Fix | Delete
}
[193] Fix | Delete
public function lcw_list_ajax( ){
[194] Fix | Delete
$content = '';
[195] Fix | Delete
$content = $this->lcw_get_content('series');
[196] Fix | Delete
$contents = utf8_encode($content);
[197] Fix | Delete
$series = json_decode($contents);
[198] Fix | Delete
$arr = array();
[199] Fix | Delete
[200] Fix | Delete
if( !empty( $series ) ){
[201] Fix | Delete
[202] Fix | Delete
$series_list = $series->seriesList->series;
[203] Fix | Delete
$arr[ 'World Cup 2019' ] = 2181;
[204] Fix | Delete
foreach ($series_list as $single_series) {
[205] Fix | Delete
[206] Fix | Delete
[207] Fix | Delete
$list[] = array(
[208] Fix | Delete
'text' => $single_series->name,
[209] Fix | Delete
'value' => $single_series->id
[210] Fix | Delete
);
[211] Fix | Delete
}
[212] Fix | Delete
$list[] = array(
[213] Fix | Delete
[214] Fix | Delete
'text' => 'World Cup 2019',
[215] Fix | Delete
'value' => 2181
[216] Fix | Delete
);
[217] Fix | Delete
[218] Fix | Delete
$json = wp_send_json( $list );
[219] Fix | Delete
return $json;
[220] Fix | Delete
}
[221] Fix | Delete
}
[222] Fix | Delete
public function lcw_update_psl_score( ){
[223] Fix | Delete
$match_id = $_POST['match_id'];
[224] Fix | Delete
$psl_content = $this->lcw_get_content_psl( 'https://cricket.yahoo.net/sifeeds/cricket/live/json/'.$match_id.'.json' );
[225] Fix | Delete
$psl_contents = utf8_encode( $psl_content );
[226] Fix | Delete
$pslmatches_list = json_decode( $psl_contents);
[227] Fix | Delete
ob_start();
[228] Fix | Delete
?>
[229] Fix | Delete
<div class="lcw-match-info">
[230] Fix | Delete
<div class="row">
[231] Fix | Delete
<div class="col-md-6">
[232] Fix | Delete
[233] Fix | Delete
<?php
[234] Fix | Delete
if(!empty($pslmatches_list->Innings)){
[235] Fix | Delete
[236] Fix | Delete
foreach ( $pslmatches_list->Innings as $Inning ) {
[237] Fix | Delete
[238] Fix | Delete
$team = $Inning->Battingteam;
[239] Fix | Delete
[240] Fix | Delete
?>
[241] Fix | Delete
[242] Fix | Delete
<div class="lcw-home-team">
[243] Fix | Delete
[244] Fix | Delete
<?php echo $pslmatches_list->Teams->{$team}->Name_Full ?>
[245] Fix | Delete
[246] Fix | Delete
<span> <?php echo $Inning->Total ?>/<?php echo $Inning->Wickets ?> (<?php echo $Inning->Overs ?>) </span>
[247] Fix | Delete
[248] Fix | Delete
</div>
[249] Fix | Delete
<?php } ?>
[250] Fix | Delete
<?php }else{ ?>
[251] Fix | Delete
<div class="lcw-home-team">
[252] Fix | Delete
<?php echo $pslmatches_list->Teams->{ $pslmatches_list->Matchdetail->Team_Home }->Name_Full ?>
[253] Fix | Delete
</div>
[254] Fix | Delete
<div class="lcw-home-team">
[255] Fix | Delete
<?php echo $pslmatches_list->Teams->{ $pslmatches_list->Matchdetail->Team_Away }->Name_Full ?>
[256] Fix | Delete
</div>
[257] Fix | Delete
<?php } ?>
[258] Fix | Delete
<div class="lcw-match-msg">
[259] Fix | Delete
<?php echo $pslmatches_list->Matchdetail->Result; ?>
[260] Fix | Delete
<?php echo $pslmatches_list->Matchdetail->Status; ?>
[261] Fix | Delete
[262] Fix | Delete
[263] Fix | Delete
</div>
[264] Fix | Delete
[265] Fix | Delete
</div>
[266] Fix | Delete
<div class="col-md-6">
[267] Fix | Delete
<p><?php echo $pslmatches_list->Matchdetail->Series->Name; ?></p>
[268] Fix | Delete
<p><?php echo $pslmatches_list->Matchdetail->Venue->Name; ?></p>
[269] Fix | Delete
<p>Start Date : <?php echo date('d F Y ',strtotime( $pslmatches_list->Matchdetail->Match->Date )) ?></p>
[270] Fix | Delete
</div>
[271] Fix | Delete
</div>
[272] Fix | Delete
</div>
[273] Fix | Delete
[274] Fix | Delete
<?php if($pslmatches_list->Matchdetail->Status_Id == 117): ?>
[275] Fix | Delete
<div class="lcw-table lcw-batsmen" id="lcw-sm-table">
[276] Fix | Delete
[277] Fix | Delete
<div class="lcw-tbody">
[278] Fix | Delete
<?php foreach ( $pslmatches_list->Innings as $Inning ) {
[279] Fix | Delete
[280] Fix | Delete
$team = $Inning->Battingteam;
[281] Fix | Delete
[282] Fix | Delete
?>
[283] Fix | Delete
[284] Fix | Delete
<div class="lcw-thead">
[285] Fix | Delete
<div class="lcw-tr" style="background: #3e3e3e !important;">
[286] Fix | Delete
<div class="lcw-td" style="text-align: center;"><?php echo $pslmatches_list->Teams->{$team}->Name_Full ?>( Run Rate : <?php echo $Inning->Runrate ?> )</div>
[287] Fix | Delete
[288] Fix | Delete
</div>
[289] Fix | Delete
</div>
[290] Fix | Delete
<div class="lcw-thead">
[291] Fix | Delete
<div class="lcw-tr">
[292] Fix | Delete
<div class="lcw-td">Batsmens</div>
[293] Fix | Delete
<div class="lcw-td">R</div>
[294] Fix | Delete
<div class="lcw-td">B</div>
[295] Fix | Delete
<div class="lcw-td">4S</div>
[296] Fix | Delete
<div class="lcw-td">6S</div>
[297] Fix | Delete
<div class="lcw-td">SR</div>
[298] Fix | Delete
</div>
[299] Fix | Delete
</div>
[300] Fix | Delete
<?php foreach ($Inning->Batsmen as $batsmen ) {
[301] Fix | Delete
[302] Fix | Delete
[303] Fix | Delete
if(!isset($batsmen->Isbatting) && !$batsmen->Isbatting){
[304] Fix | Delete
[305] Fix | Delete
continue;
[306] Fix | Delete
}
[307] Fix | Delete
if(isset($batsmen->Isonstrike) && $batsmen->Isonstrike){
[308] Fix | Delete
[309] Fix | Delete
$strike = '<em style="color: red;">*</em>';
[310] Fix | Delete
}else{
[311] Fix | Delete
[312] Fix | Delete
$strike = "";
[313] Fix | Delete
}
[314] Fix | Delete
?>
[315] Fix | Delete
<div class="lcw-tr">
[316] Fix | Delete
<div class="lcw-td">
[317] Fix | Delete
[318] Fix | Delete
<?php
[319] Fix | Delete
[320] Fix | Delete
echo $pslmatches_list->Teams->{$team}->Players->{ $batsmen->Batsman }->Name_Full.$strike;
[321] Fix | Delete
?>
[322] Fix | Delete
<p><?php echo $batsmen->Howout ?></p>
[323] Fix | Delete
</div>
[324] Fix | Delete
<div class="lcw-td"><?php echo $batsmen->Runs ?></div>
[325] Fix | Delete
<div class="lcw-td"><?php echo $batsmen->Balls ?></div>
[326] Fix | Delete
<div class="lcw-td hidden-xs hidden-sm"><?php echo $batsmen->Fours ?></div>
[327] Fix | Delete
<div class="lcw-td hidden-xs hidden-sm"><?php echo $batsmen->Sixes ?></div>
[328] Fix | Delete
<div class="lcw-td hidden-xs hidden-sm"><?php echo $batsmen->Strikerate ?></div>
[329] Fix | Delete
</div>
[330] Fix | Delete
<?php } ?>
[331] Fix | Delete
<div class="lcw-thead">
[332] Fix | Delete
<div class="lcw-tr">
[333] Fix | Delete
<div class="lcw-td">Bowler</div>
[334] Fix | Delete
<div class="lcw-td">O</div>
[335] Fix | Delete
<div class="lcw-td">R</div>
[336] Fix | Delete
<div class="lcw-td">W</div>
[337] Fix | Delete
<div class="lcw-td hidden-xs hidden-sm">Econ</div>
[338] Fix | Delete
<div class="lcw-td hidden-xs hidden-sm">WD</div>
[339] Fix | Delete
</div>
[340] Fix | Delete
</div>
[341] Fix | Delete
<?php foreach ($Inning->Bowlers as $bowler ) {
[342] Fix | Delete
[343] Fix | Delete
[344] Fix | Delete
if(!isset($bowler->Isbowlingtandem) && !$bowler->Isbowlingtandem){
[345] Fix | Delete
[346] Fix | Delete
continue;
[347] Fix | Delete
}
[348] Fix | Delete
if(isset($bowler->Isbowlingnow) && $bowler->Isbowlingnow){
[349] Fix | Delete
[350] Fix | Delete
$strike = '<em style="color: red;">*</em>';
[351] Fix | Delete
}else{
[352] Fix | Delete
[353] Fix | Delete
$strike = "";
[354] Fix | Delete
}
[355] Fix | Delete
?>
[356] Fix | Delete
<div class="lcw-tr">
[357] Fix | Delete
<div class="lcw-td">
[358] Fix | Delete
[359] Fix | Delete
<?php
[360] Fix | Delete
//echo $bowler->Bowler;
[361] Fix | Delete
if($pslmatches_list->Teams->{$pslmatches_list->Matchdetail->Team_Home}->Players->{$bowler->Bowler}->Name_Full){
[362] Fix | Delete
[363] Fix | Delete
echo $pslmatches_list->Teams->{$pslmatches_list->Matchdetail->Team_Home}->Players->{$bowler->Bowler}->Name_Full.$strike;
[364] Fix | Delete
[365] Fix | Delete
}elseif( $pslmatches_list->Teams->{$pslmatches_list->Matchdetail->Team_Away}->Players->{$bowler->Bowler}->Name_Full ){
[366] Fix | Delete
[367] Fix | Delete
[368] Fix | Delete
echo $pslmatches_list->Teams->{$pslmatches_list->Matchdetail->Team_Away}->Players->{$bowler->Bowler}->Name_Full.$strike;
[369] Fix | Delete
}else{
[370] Fix | Delete
[371] Fix | Delete
[372] Fix | Delete
}
[373] Fix | Delete
?>
[374] Fix | Delete
</div>
[375] Fix | Delete
<div class="lcw-td"><?php echo $bowler->Overs ?></div>
[376] Fix | Delete
<div class="lcw-td"><?php echo $bowler->Runs ?></div>
[377] Fix | Delete
<div class="lcw-td"><?php echo $bowler->Wickets ?></div>
[378] Fix | Delete
<div class="lcw-td hidden-xs hidden-sm"><?php echo $bowler->Economyrate ?></div>
[379] Fix | Delete
<div class="lcw-td hidden-xs hidden-sm"><?php echo $bowler->Wides ?></div>
[380] Fix | Delete
</div>
[381] Fix | Delete
<?php } ?>
[382] Fix | Delete
[383] Fix | Delete
<?php } ?>
[384] Fix | Delete
</div>
[385] Fix | Delete
</div>
[386] Fix | Delete
<?php endif; ?>
[387] Fix | Delete
<?php
[388] Fix | Delete
$content = ob_get_clean();
[389] Fix | Delete
[390] Fix | Delete
echo $content;
[391] Fix | Delete
die();
[392] Fix | Delete
}
[393] Fix | Delete
public function lcw_psl_match_shortcode( $atts ){
[394] Fix | Delete
[395] Fix | Delete
/*extract(shortcode_atts(
[396] Fix | Delete
array(
[397] Fix | Delete
[398] Fix | Delete
'match_id' => -1,
[399] Fix | Delete
[400] Fix | Delete
), $atts));
[401] Fix | Delete
require_once LCW_LIVE_SCORE_ROOT_PATH . '/templates/psl-matches.php';
[402] Fix | Delete
$content = lcw_load_psl_match( $this, $match_id );*/
[403] Fix | Delete
return false;
[404] Fix | Delete
}
[405] Fix | Delete
public function lcw_get_content_psl( $segment ){
[406] Fix | Delete
if ( function_exists('curl_init')){
[407] Fix | Delete
[408] Fix | Delete
$ch = curl_init();
[409] Fix | Delete
curl_setopt($ch, CURLOPT_URL, $segment );
[410] Fix | Delete
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
[411] Fix | Delete
$content = curl_exec($ch);
[412] Fix | Delete
curl_close($ch);
[413] Fix | Delete
[414] Fix | Delete
[415] Fix | Delete
}else if( ini_get('allow_url_fopen') ){
[416] Fix | Delete
[417] Fix | Delete
$content = @file_get_contents( $segment );
[418] Fix | Delete
[419] Fix | Delete
}else{
[420] Fix | Delete
[421] Fix | Delete
$content = 'Please enable curl or allow_url_fopen in order to get cricket data';
[422] Fix | Delete
[423] Fix | Delete
}
[424] Fix | Delete
return $content;
[425] Fix | Delete
}
[426] Fix | Delete
public function lcw_change_document_title( $title ){
[427] Fix | Delete
[428] Fix | Delete
$series_id = isset( $_GET['series-id'] ) ? $_GET['series-id'] : '';
[429] Fix | Delete
$match_id = isset( $_GET['match-id'] ) ? $_GET['match-id'] : '';
[430] Fix | Delete
$player_id = isset( $_GET['player-id'] ) ? $_GET['player-id'] : '';
[431] Fix | Delete
$newtitle = '';
[432] Fix | Delete
if( get_query_var( 'series' ) ){
[433] Fix | Delete
[434] Fix | Delete
$series_id = get_query_var( 'series' );
[435] Fix | Delete
[436] Fix | Delete
}else{
[437] Fix | Delete
[438] Fix | Delete
$series_id = $series_id;
[439] Fix | Delete
}
[440] Fix | Delete
if( get_query_var( 'match' ) ){
[441] Fix | Delete
[442] Fix | Delete
$match_id = get_query_var( 'match' );
[443] Fix | Delete
[444] Fix | Delete
}else{
[445] Fix | Delete
[446] Fix | Delete
$match_id = $match_id;
[447] Fix | Delete
}
[448] Fix | Delete
if( get_query_var( 'player' ) ){
[449] Fix | Delete
[450] Fix | Delete
[451] Fix | Delete
}
[452] Fix | Delete
if( ! empty( $title ) && is_page('match-detail' ) ){
[453] Fix | Delete
[454] Fix | Delete
$match_detail_content = $this->lcw_get_content('matches/'.$series_id.'/'.$match_id);
[455] Fix | Delete
$match_detail_contents = utf8_encode( $match_detail_content );
[456] Fix | Delete
$match_detail_list = json_decode($match_detail_contents);
[457] Fix | Delete
if($match_detail_list->match->status == 'INPROGRESS' || $match_detail_list->match->status == 'LIVE' ){
[458] Fix | Delete
[459] Fix | Delete
if( !empty( $match_detail_list->match->scores->homeScore ) ){
[460] Fix | Delete
[461] Fix | Delete
$homeScore = $match_detail_list->match->scores->homeScore.' ( '.
[462] Fix | Delete
[463] Fix | Delete
$match_detail_list->match->scores->homeOvers.' ) ovs';
[464] Fix | Delete
[465] Fix | Delete
}else{
[466] Fix | Delete
[467] Fix | Delete
$homeScore = '';
[468] Fix | Delete
}
[469] Fix | Delete
if( !empty( $match_detail_list->match->scores->awayScore ) ){
[470] Fix | Delete
[471] Fix | Delete
$awayScore = $match_detail_list->match->scores->awayScore.' ( '.
[472] Fix | Delete
[473] Fix | Delete
$match_detail_list->match->scores->awayOvers.' ) ovs';
[474] Fix | Delete
[475] Fix | Delete
}else{
[476] Fix | Delete
[477] Fix | Delete
$awayScore = '';
[478] Fix | Delete
}
[479] Fix | Delete
[480] Fix | Delete
[481] Fix | Delete
$newtitle = $match_detail_list->match->homeTeam->shortName.' '.$homeScore.' | '.$match_detail_list->match->awayTeam->shortName.' '.$awayScore.' | '.$match_detail_list->match->series->name.' '.$title;
[482] Fix | Delete
[483] Fix | Delete
}else{
[484] Fix | Delete
[485] Fix | Delete
$newtitle = $match_detail_list->match->name.' , '.$match_detail_list->match->series->name.' '.$title;
[486] Fix | Delete
}
[487] Fix | Delete
return $newtitle;
[488] Fix | Delete
}elseif( is_page( 'player-stats' ) ){
[489] Fix | Delete
[490] Fix | Delete
$player_id = get_query_var( 'player' );
[491] Fix | Delete
$player_detail_content = $this->lcw_get_content('players/'.$player_id.'/stats/');
[492] Fix | Delete
$player_detail_contents = utf8_encode( $player_detail_content );
[493] Fix | Delete
$player_detail_list = json_decode($player_detail_contents);
[494] Fix | Delete
[495] Fix | Delete
$newtitle = $player_detail_list->meta->firstName.' '.$player_detail_list->meta->lastName.' '.$title;
[496] Fix | Delete
return $newtitle;
[497] Fix | Delete
}else{
[498] Fix | Delete
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function