core = $core;
self::$plugin_info = $plugin_info;
$this->hooks();
}
/**
* Single Instance Initalization
*
* @param array $plugin_info
* @param array $general_vars
* @return object
*/
public static function init( $plugin_info, $core ) {
if ( is_null( self::$instance ) ) {
self::$instance = new self( $plugin_info, $core );
}
return self::$instance;
}
/**
* Hooks Functions.
*
* @return void
*/
public function hooks() {
add_action( 'admin_enqueue_scripts', array( $this, 'scripts' ) );
add_action( self::$plugin_info['name'] . '-pro-tab-content', array( $this, 'get_pro_features' ) );
}
/**
* Additional Scripts.
*
* @return void
*/
public function scripts() {
wp_enqueue_style( self::$plugin_info['name'] . '-magnif-popup-style', $this->core->core_assets_lib( 'magnific-popup', 'css' ), array(), 'all' );
wp_enqueue_script( self::$plugin_info['name'] . '-magnif-popup-script', $this->core->core_assets_lib( 'jquery.magnific-popup', 'js' ), array( 'jquery' ), '1.0.0', false );
}
/**
* Pro Tab Link
*
* @param string $main_page
* @param boolean $echo
* @return string
*/
public static function pro_tab( $main_page, $echo = false ) {
$content = '';
ob_start();
?>
plugin_pro_features_route,
array(
'body' => array(
'id' => $product_id,
),
)
);
$code = wp_remote_retrieve_response_code( $response );
$body = (array) json_decode( wp_remote_retrieve_body( $response ) );
if ( empty( $body ) && ( $counter < 3 ) ) {
$this->get_pro_features( ++$counter );
}
if ( ! empty( $body['content'] ) ) {
echo $body['content'];
echo $this->pro_features_popup_js();
}
}
/**
* Pro Features Popup Js Code.
*
* @return void
*/
private function pro_features_popup_js() {
$js_code = '';
ob_start();
?>