plugin_slug_plus_file = $this->plugin_slug .'/'. $this->plugin_main_file; if( $this->show_with_action_links && $this->plugin_slug_plus_file != "" ) { add_action( 'plugin_action_links_' . $this->plugin_slug_plus_file, array(&$this, 'func_show_upgrade_link_with_action_links'), 95 ); } else { return; } } /******************************* * Callback function for the above hook * used inside hook_with_plugin_action_links *******************************/ function func_show_upgrade_link_with_action_links( $links ) { $links = array_merge( $links, array( '' . __( 'Settings', 'chatbot' ) . '' ) ); $links = array_merge( $links, array( '' . __( 'Help', 'chatbot' ) . '' ) ); $links = array_merge( $links, array( '' . __( 'Get Support', 'chatbot' ) . '' ) ); $links = array_merge( $links, array( '' . $this->link_text . '' ) ); return $links; } /******************************* * Put Link with Plugin Meta Links * Like Plugin Author, Details, etc. * Ofcourse, in plugin.php page *******************************/ function hook_with_plugin_meta_links(){ if( $this->show_with_meta_links && $this->plugin_main_file != "" ) { add_action( 'plugin_row_meta', array(&$this, 'func_show_upgrade_link_with_meta_links'), 10, 2 ); } else { return; } } /******************************* * Callback function for the above hook * used inside hook_with_plugin_meta_links *******************************/ function func_show_upgrade_link_with_meta_links( $links, $file ) { $links = array_merge( array( ), $links ); if ( strpos( $file, "$this->plugin_main_file" ) !== false ) { $new_links = array( '' . $this->link_text . '' ); $links = array_merge( $links, $new_links ); } return $links; } /******************************* * Put Link inside WP Admin Menu * Created by the respective plugin *******************************/ function hook_with_plugin_submenu() { if( !$this->show_with_plugin_menu || $this->plugin_menu_slug == "" ){ return; } else { add_action( 'admin_menu' , array(&$this, 'func_qc_external_upgrade_link'), 20 ); } } /******************************* * Callback function for the avbove function/hook *******************************/ function func_qc_external_upgrade_link() { global $submenu; $current_user = wp_get_current_user(); if( !$this->show_with_plugin_menu || $this->plugin_menu_slug == "" ) { return; } $link_text = ''.$this->link_text.''; if($current_user->roles[0]!='subscriber') $submenu["$this->plugin_menu_slug"][300] = array( $link_text, 'activate_plugins' , $this->upgrade_link ); return $submenu; } } //End of class QcPluginUpgradeToProNotice } // End of class_exists /******************************* * Create instance and call the * appropriate worker/callback *******************************/ $instance_bot2 = new QcchatbotPluginUpgradeToProNotice(); if( is_admin() ) { //Uncommnent and Set these instance variables as per the requirements $instance_bot2->upgrade_link = "https://www.wpbot.pro/"; //$instance_sldf2->link_color = "#FCB214"; //$instance_sldf2->link_text = "Upgrade To Pro"; //$instance_sldf2->link_class = ""; //$instance_sldf2->link_target = "_blank"; $instance_bot2->plugin_slug = 'chatbot'; //Plugin Slug. i.e. Folder Name $instance_bot2->plugin_main_file = 'qcld-wpwbot.php'; //Primary file of the pluign $instance_bot2->plugin_menu_slug = 'wpbot-panel'; //Main Menu Slug $instance_bot2->show_with_action_links = true; //show in plugin.php page $instance_bot2->show_with_meta_links = true; //show in plugin.php page $instance_bot2->show_with_plugin_menu = true; //show inside parent menu of the plugin if( $instance_bot2->check_if_plugin_page() ) { $instance_bot2->hook_with_plugin_action_links(); $instance_bot2->hook_with_plugin_meta_links(); } $instance_bot2->hook_with_plugin_submenu(); }