Exemple #1
0
 public function check_info($false, $action, $arg)
 {
     if (!isset($arg->slug) || $arg->slug == '') {
         return false;
     }
     if ($arg->slug === $this->slug) {
         return false;
     }
     $result = MainWPExtensions::getSlugs();
     $slugs = $result['slugs'];
     $am_slugs = $result['am_slugs'];
     if ($slugs != '') {
         $slugs = explode(',', $slugs);
         if (in_array($arg->slug, $slugs)) {
             return MainWPAPISettings::getUpgradeInformation($arg->slug);
         }
     }
     if ($am_slugs != '') {
         $am_slugs = explode(',', $am_slugs);
         if (in_array($arg->slug, $am_slugs)) {
             return MainWPAPISettings::getPluginInformation($arg->slug);
         }
     }
     return false;
 }
 public static function checkUpgrade()
 {
     $result = MainWPExtensions::getSlugs();
     $slugs = $result['slugs'];
     $am_slugs = $result['am_slugs'];
     $output = array();
     if ($slugs != '') {
         $username = get_option("mainwp_api_username");
         $password = MainWPUtility::decrypt(get_option('mainwp_api_password'), 'MainWPAPI');
         try {
             $responseArray = MainWPUtility::http_post("do=checkUpgradeV2&username="******"&password="******"mainwp.com", "/versioncontrol/rqst.php", true);
         } catch (Exception $e) {
             MainWPLogger::Instance()->warning('An error occured when trying to reach the MainWP server: ' . $e->getMessage());
         }
         if (is_array($responseArray) && isset($responseArray[1])) {
             $rslt = json_decode($responseArray[1]);
             if (!empty($rslt)) {
                 foreach ($rslt as $upgrade) {
                     $output[] = $upgrade;
                 }
             }
         }
     }
     if ($am_slugs != '') {
         $am_slugs = explode(",", $am_slugs);
         foreach ($am_slugs as $am_slug) {
             $rslt = self::getUpgradeInformationTwo($am_slug);
             if (!empty($rslt)) {
                 $output[$am_slug] = $rslt;
             }
         }
     }
     return $output;
 }