Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
plugin_activate_hook();
}
// Register Plugin Deactive Hook
register_deactivation_hook( WOOLENTOR_ADDONS_PL_ROOT, [ $this, 'plugin_deactivation_hook'] );
// Support WooCommerce
add_action( 'after_setup_theme', [ $this, 'after_setup_theme' ] );
// Product View Count
add_action( 'template_redirect', [ $this, 'track_user_viewed_products' ], 99 );
}
/**
* [i18n] Load Text Domain
* @return [void]
*/
public function i18n() {
load_plugin_textdomain( 'woolentor', false, dirname( plugin_basename( WOOLENTOR_ADDONS_PL_ROOT ) ) . '/languages/' );
}
/**
* [init] Plugins Loaded Init Hook
* @return [void]
*/
public function init() {
if( is_admin()){
include_once( WOOLENTOR_ADDONS_PL_PATH.'includes/admin/include/class.notice.php' );
}
// Check for required PHP version
if ( version_compare( PHP_VERSION, self::MINIMUM_PHP_VERSION, '<' ) ) {
add_action( 'admin_notices', [ $this, 'admin_notice_minimum_php_version' ] );
return;
}
// Check WooCommerce
if ( !did_action( 'woocommerce_loaded' ) ) {
add_action('admin_notices', [ $this, 'admin_notic_missing_woocommerce' ] );
return;
}
// Plugins Setting Page
add_filter('plugin_action_links_'.WOOLENTOR_PLUGIN_BASE, [ $this, 'plugins_setting_links' ] );
add_filter( 'plugin_row_meta', [ $this, 'plugin_row_meta' ], 10, 4 );
// Include File
$this->include_files();
// After Active Plugin then redirect to setting page
$this->plugin_redirect_option_page();
/**
* [$template_info] Assign template data
* @var [type]
*/
if( is_admin() && class_exists('\Woolentor_Template_Library_Manager') ){
self::$template_info = \Woolentor_Template_Library_Manager::instance()->get_templates_info();
}
// Admin Notices
add_action( 'admin_head', [ $this, 'all_admin_notices' ] );
// Elementor Preview Action
if ( ! empty( $_REQUEST['action'] ) && 'elementor' === $_REQUEST['action'] && is_admin() ) {
add_action( 'admin_action_elementor', [ $this, 'wc_fontend_includes' ], 5 );
}
// Manage Page Action
\WooLentor_Page_Action::instance()->init();
}
/**
* [admin_notic_missing_woocommerce] Admin Notice For missing WooCommerce
* @return [void]
*/
public function admin_notic_missing_woocommerce(){
if( ! current_user_can( 'activate_plugins' ) ) {
return;
}
$woocommerce = 'woocommerce/woocommerce.php';
if( $this->is_plugins_install( $woocommerce ) ) {
$button['url'] = wp_nonce_url( 'plugins.php?action=activate&plugin=' . $woocommerce . '&plugin_status=all&paged=1&s', 'activate-plugin_' . $woocommerce );
$button['text'] = __( 'Activate WooCommerce', 'woolentor' );
$message = sprintf( __( '%1$sShopLentor Addons for Elementor%2$s requires %1$s"WooCommerce"%2$s plugin to be active. Please activate WooCommerce to continue.', 'woolentor' ), '', '');
}else{
$button['url'] = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=woocommerce' ), 'install-plugin_woocommerce' );
$button['text'] = __( 'Install WooCommerce', 'woolentor' );
$message = sprintf( __( '%1$sShopLentor Addons for Elementor%2$s requires %1$s"WooCommerce"%2$s plugin to be installed and activated. Please install WooCommerce to continue.', 'woolentor' ), '', '' );
}
\WooLentor_Notices::add_notice(
[
'id' => 'missing-woocommerce',
'type' => 'error',
'button' => $button,
'message' => $message,
'is_show' => true,
]
);
}
/**
* [admin_notice_minimum_php_version] Admin Notice For Required PHP Version
* @return [void]
*/
public function admin_notice_minimum_php_version() {
if ( isset( $_GET['activate'] ) ) unset( $_GET['activate'] );
$message = sprintf(
/* translators: 1: Plugin name 2: PHP 3: Required PHP version */
esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'woolentor' ),
'' . esc_html__( 'ShopLentor', 'woolentor' ) . '',
'' . esc_html__( 'PHP', 'woolentor' ) . '',
self::MINIMUM_PHP_VERSION
);
\WooLentor_Notices::add_notice(
[
'id' => 'phpcompatibility',
'type' => 'warning',
'message' => $message,
]
);
}
/**
* Admin Notices
*
* @return void
*/
public function all_admin_notices(){
// Rating notice
$this->admin_rating_notice();
// Promo Banner
$this->admin_promo_notice();
}
/**
* Rating Notice
*
* @return void
*/
public function admin_rating_notice(){
$logo_url = esc_url(WOOLENTOROPT_ASSETS.'/images/logo.png');
$message = '
'.esc_html__('Hi there! Thanks a lot for choosing ShopLentor to build an outstanding WooCommerce store.','woolentor').'
'.esc_html__('It would be greatly appreciated if you consider giving us a review in WordPress. These reviews help us improve the plugin further and make it easier for other users to decide when exploring ShopLentor!','woolentor').'