Esempio n. 1
0
 /**
  * Returns an array with all the plugin options.
  *
  * NOTE: There is a maximum number of lines for this file, one is for the
  * exit point and the other one is for a single line JSON encoded string.
  * We will discard any other content that exceeds this limit.
  *
  * @return array Array with all the plugin options.
  */
 public static function getAllOptions()
 {
     $options = array();
     $fpath = self::optionsFilePath();
     /* Use this over SucuriScanCache to prevent nested function calls */
     $content = SucuriScanFileInfo::fileContent($fpath);
     if ($content !== false) {
         // Refer to self::optionsFilePath to know why the number two.
         $lines = explode("\n", $content, 2);
         if (count($lines) >= 2) {
             $jsonData = json_decode($lines[1], true);
             if (is_array($jsonData) && !empty($jsonData)) {
                 $options = $jsonData;
             }
         }
     }
     return $options;
 }