コード例 #1
0
ファイル: sucuri.php プロジェクト: sirhair/SH_WP_PluginRepo
 /**
  * Generate the menu and submenus for the plugin in the admin interface.
  *
  * @return void
  */
 public static function add_interface_menu()
 {
     global $sucuriscan_pages;
     if (function_exists('add_menu_page') && $sucuriscan_pages && is_array($sucuriscan_pages) && array_key_exists('sucuriscan', $sucuriscan_pages)) {
         // Add main menu link.
         add_menu_page('Sucuri Security', 'Sucuri Security', 'manage_options', 'sucuriscan', 'sucuriscan_page', SUCURISCAN_URL . '/inc/images/menu-icon.png');
         foreach ($sucuriscan_pages as $sub_page_func => $sub_page_title) {
             if ($sub_page_func == 'sucuriscan_scanner' && SucuriScanOption::is_disabled(':sitecheck_scanner')) {
                 continue;
             }
             $page_func = $sub_page_func . '_page';
             add_submenu_page('sucuriscan', $sub_page_title, $sub_page_title, 'manage_options', $sub_page_func, $page_func);
         }
     }
 }
コード例 #2
0
 /**
  * Do something if the plugin was updated.
  *
  * Check if an option exists with the version number of the plugin, if the
  * number is different than the number defined in the constant that comes
  * with this code then we can consider this as an update, in which case we
  * will execute certain actions and/or display some messages.
  *
  * @return void
  */
 public static function noticeAfterUpdate()
 {
     $version = SucuriScanOption::get_option(':plugin_version');
     // Use simple comparison to force type cast.
     if ($version != SUCURISCAN_VERSION) {
         /**
          * Check if the API communication has been disabled due to issues
          * with the previous version of the code, in this case we will
          * display a message at the top of the admin dashboard suggesting
          * the user to enable it once again expecting to see have a better
          * performance with the new code.
          */
         if (SucuriScanOption::is_disabled(':api_service')) {
             self::info('API service communication is disabled, if you just updated ' . 'the plugin this might be a good opportunity to test this ' . 'feature once again with the new code. Enable it again from ' . 'the "API Service" panel located in the settings page.');
         }
         // Update the version number in the plugin settings.
         SucuriScanOption::update_option(':plugin_version', SUCURISCAN_VERSION);
     }
 }