Я пытаюсь включить плагин для моего веб-сайта WP, который включает jalili/shamsi datepicker
, и он устанавливает плагин, но поскольку я хочу сделать его активным, он отрицает это:
Parse error: syntax error, unexpected 'include' (T_INCLUDE), expecting identifier (T_STRING) in /home/halagard/public_html/wp-content/plugins/daterangepicker-ariawp/class-ariawp-ajax.php on line 29
Здесь это файл, который упоминается в ошибке:
<?php
namespace Ariawp\Traveler\DateTime;
use \Morilog\Jalali\Jalalian as Jalalian;
use \Morilog\Jalali\CalendarUtils as CalendarUtils;
if( !class_exists("AriawpAjAx") ){
class AriawpAjAx {
const VERESION = '1.0.1';
/**
* @var object of AriawpAjax
*/
protected static $instance = null;
/**
* @return object AriawpAjax
*/
public static function getInstance(){
if( is_null( self::$instance ) )
self::$instance = new self();
return self::$instance;
}
protected function __construct(){
$this->include();
$this->hook();
}
protected function include(){
// include the file we need it
}
public function hook(){
/**
* Description : Editing the st_get_info_booking_history ajax method
* Step1: Remove All Action That Acting on this hook
* Step2: Hook new function for edit the DateElement
*/
add_action("wp_ajax_st_get_info_booking_history", array($this,"hookStGetInfoBookingHistory"),-999);
add_action("wp_ajax_nopriv_st_get_info_booking_history", array($this,"hookStGetInfoBookingHistory"),-999);
}
public function hookStGetInfoBookingHistory(){
remove_all_actions("wp_ajax_st_get_info_booking_history");
remove_all_actions("wp_ajax_nopriv_st_get_info_booking_history");
$this->ariawpGetInfoBookingHistory();
}
public function ariawpGetInfoBookingHistory(){
require_once( ST_TRAVELER_DIR."/inc/class.traveler.php");
$order_id = \STInput::request( 'order_id' );
$service_id = \STInput::request( 'service_id' );
$res = [ 'status' => 0, 'msg' => "" ];
$my_user = wp_get_current_user();
$user_partner = 0;
$user_book = 0;
global $wpdb;
$sql = "SELECT * FROM {$wpdb->prefix}st_order_item_meta WHERE order_item_id = " . $order_id . " or wc_order_id = " . $order_id;
$rs = $wpdb->get_row( $sql, ARRAY_A );
$order_data = $rs;
// CalendarUtils::toJalali($start_Date['year'],$start_Date['month'],$start_Date['day']);
/**
* Adding in persinan version
*/
$order_data['check_in'] = $this->toJalali( $order_data['check_in'] );
$order_data['check_out'] = $this->toJalali( $order_data['check_out'] );
$order_data['created'] = $this->toJalali( $order_data['created'] );
if( !is_null( $order_data['starttime'] ) )
$order_data['starttime'] = $this->toJalali( $order_data['starttime'] );
if ( !empty( $rs[ 'id' ] ) ) {
$user_book = $rs[ 'user_id' ];
}
if ( !empty( $rs[ 'partner_id' ] ) ) {
$user_partner = $rs[ 'partner_id' ];
}
$is_checked = true;
if ( !is_user_logged_in() ) {
$is_checked = false;
}
if ( $user_book != $my_user->ID ) {
$is_checked = false;
}
if ( $user_partner == $my_user->ID ) {
$is_checked = true;
}
if ( current_user_can( 'manage_options' ) ) {
$is_checked = true;
}
if ( $is_checked and !empty( $rs ) ) {
$html = '';
$post_type = $rs[ 'st_booking_post_type' ];
$order_id = $rs[ 'wc_order_id' ];
if ( $order_data[ 'type' ] == "normal_booking" ) {
$html = $this->loadTemplate( 'user/detail-booking-history/' . $post_type, false, [ 'order_id' => $order_id, 'service_id' => $service_id, 'order_data' => $order_data ] );
} else {
$html = $this->loadTemplate( 'user/detail-booking-history/woo/' . $post_type, false, [ 'order_id' => $order_id, 'service_id' => $service_id, 'order_data' => $order_data ] );
}
$res[ 'status' ] = 1;
$res[ 'html' ] = $html;
} else {
$res[ 'msg' ] = '<p class="text-center">' . esc_html__( "Load failed...", ST_TEXTDOMAIN ) . '</p>';
}
echo json_encode( $res );
die();
}
public function loadTemplate( $fileSlug , $name = false , $data = array()){
if (is_array($data))
extract($data);
$fileUri = __DIR__.'/st/'.$fileSlug.'.php';
$out = '';
if( file_exists($fileUri ) ){
ob_start();
include( $fileUri );
$out = @ob_get_clean();
return $out;
}
}
public function toJalali( string $input ){
// "04/21/2017"
$dateFormat = "MM/DD/YYYY";
// echo date("YW", strtotime("2011-01-07"));
$timestep = strtotime( $input );
$day = date("d" , $timestep);
$month = date( "m" , $timestep );
$year = date( 'Y' , $timestep);
$jalali = CalendarUtils::toJalali( $year , $month , $day );
$out = $jalali[0]."/".$jalali[1]."/".$jalali[2];
return $out;
}
}
}
?>