ts_get_version(); self::$previous_plugin_version = $ts_previous_version; self::$plugin_url = $this->ts_get_plugin_url(); self::$template_base = $this->ts_get_template_path(); } function ts_delete_plugin_from_active_check ( ){ $active_ts_plugins = get_option( 'active_TS_plugins', array() ); if ( in_array ( self::$plugin_name , $active_ts_plugins) ){ $ts_plugin_name = array ( self::$plugin_name ); $updated_activated_ts_plugins = array_diff( $active_ts_plugins, $ts_plugin_name ); update_option( 'active_TS_plugins', $updated_activated_ts_plugins ); } } function ts_add_plugin_active_check () { $active_ts_plugins = get_option( 'active_TS_plugins', array() ); if ( !in_array ( self::$plugin_name , $active_ts_plugins) ){ $active_ts_plugins [] = self::$plugin_name; update_option( 'active_TS_plugins', $active_ts_plugins ); } } /** * This function returns the plugin version number. * * @access public * @since 7.7 * @return $plugin_version */ public function ts_get_version() { $plugin_version = ''; $plugin_data = get_file_data( self::$plugin_file_path, array( 'Version' => 'Version' ) ); if ( ! empty( $plugin_data['Version'] ) ) { $plugin_version = $plugin_data[ 'Version' ]; } return $plugin_version;; } /** * This function returns the plugin url * * @access public * @since 7.7 * @return string */ public function ts_get_plugin_url() { return plugins_url() . '/' . self::$plugin_folder ; } /** * This function returns the template directory path * * @access public * @since 7.7 * @return string */ public function ts_get_template_path() { return untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/templates/'; } /** * Register the Dashboard Page which is later hidden but this pages * is used to render the Welcome page. * * @access public * @since 7.7 * @return void */ public function admin_menus() { $display_version = self::$plugin_version; // About Page add_dashboard_page( sprintf( esc_html__( 'Welcome to %s %s', self::$plugin_context ), self::$plugin_name, $display_version ), esc_html__( 'Welcome to ' . self::$plugin_name, self::$plugin_context ), $this->minimum_capability, self::$plugin_prefix . '-pro-about', array( $this, 'about_screen' ) ); } /** * Hide Individual Dashboard Pages * * @access public * @since 7.7 * @return void */ public function admin_head() { remove_submenu_page( 'index.php', self::$plugin_prefix . '-pro-about' ); } /** * Render About Screen * * @access public * @since 7.7 * @return void */ public function about_screen() { $display_version = self::$plugin_version; $ts_file_path = dirname( __FILE__ ) ; $ts_plugin_dir_path = plugin_dir_url( __FILE__ ); // Badge for welcome page $badge_url = $ts_plugin_dir_path . '/assets/images/icon-256x256.png'; $shortcodes_array = array( 'plugin_name' => self::$plugin_name, 'plugin_url' => self::$plugin_url, 'display_version' => $display_version, 'badge_url' => $badge_url, 'ts_dir_image_path' => $ts_plugin_dir_path . '/assets/images/', 'plugin_context' => self::$plugin_context, 'get_welcome_header' => self::get_welcome_header() ); set_query_var( 'shortcodes_array', $shortcodes_array ); ob_start(); load_template( $ts_file_path . '/templates/welcome/welcome-page.php' ); echo ob_get_clean(); add_option( self::$plugin_prefix . '_pro_welcome_page_shown', 'yes' ); add_option( self::$plugin_prefix . '_pro_welcome_page_shown_time', current_time( 'timestamp' ) ); } /** * The header section for the welcome screen. * * @since 7.7 */ public function get_welcome_header() { // Badge for welcome page $ts_file_path = plugin_dir_url( __FILE__ ) ; // Badge for welcome page $badge_url = $ts_file_path . '/assets/images/icon-256x256.png'; ?>