-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Akshay Urankar
authored and
Akshay Urankar
committed
Jan 8, 2025
1 parent
847cc68
commit d894085
Showing
4 changed files
with
143 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '7308ebd37e6188c7aa97'); | ||
<?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => 'f06c918009181b168113'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<?php | ||
/** | ||
* UAE. | ||
* | ||
* @package UAE | ||
*/ | ||
|
||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; | ||
} | ||
|
||
if ( ! class_exists( 'Uae_Nps_Survey' ) ) : | ||
|
||
/** | ||
* Admin | ||
*/ | ||
class Uae_Nps_Survey { | ||
/** | ||
* Instance | ||
* | ||
* @since 1.0.0 | ||
* @var (Object) Uae_Nps_Survey | ||
*/ | ||
private static $instance = null; | ||
|
||
/** | ||
* Get Instance | ||
* | ||
* @since 1.0.0 | ||
* | ||
* @return object Class object. | ||
*/ | ||
public static function get_instance() { | ||
if ( ! isset( self::$instance ) ) { | ||
self::$instance = new self(); | ||
} | ||
|
||
return self::$instance; | ||
} | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
private function __construct() { | ||
$this->version_check(); | ||
add_action( 'init', array( $this, 'load' ), 999 ); | ||
} | ||
|
||
/** | ||
* Version Check | ||
* | ||
* @return void | ||
*/ | ||
public function version_check() { | ||
|
||
$file = realpath( dirname( __FILE__ ) . '/nps-survey/version.json' ); | ||
|
||
// Is file exist? | ||
if ( is_file( $file ) ) { | ||
|
||
$file_data = json_decode( file_get_contents( $file ), true ); //phpcs:ignore WordPressVIPMinimum.Performance.FetchingRemoteData.FileGetContentsUnknown | ||
|
||
global $nps_survey_version, $nps_survey_init; | ||
|
||
$path = realpath( dirname( __FILE__ ) . '/nps-survey/nps-survey.php' ); | ||
|
||
$version = isset( $file_data['nps-survey'] ) ? $file_data['nps-survey'] : 0; | ||
|
||
if ( null === $nps_survey_version ) { | ||
$nps_survey_version = '1.0.0'; | ||
} | ||
|
||
// Compare versions. | ||
if ( version_compare( $version, $nps_survey_version, '>=' ) ) { | ||
$nps_survey_version = $version; | ||
$nps_survey_init = $path; | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Load latest plugin | ||
* | ||
* @return void | ||
*/ | ||
public function load() { | ||
|
||
global $nps_survey_version, $nps_survey_init; | ||
if ( is_file( realpath( $nps_survey_init ) ) ) { | ||
include_once realpath( $nps_survey_init ); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Kicking this off by calling 'get_instance()' method | ||
*/ | ||
Uae_Nps_Survey::get_instance(); | ||
|
||
endif; |