Example #1
0
 /**
  * Get a package - from cache if possible
  * @param string unique name or identifier known to WordPress
  * @param string "core", "theme" or "plugin"
  * @return LocoPackage
  */
 public static function get($handle, $type)
 {
     $key = $type . '_' . $handle;
     $package = Loco::cached($key);
     if ($package instanceof LocoPackage) {
         if ($package->invalidate()) {
             $package = null;
         }
     }
     if (!$package instanceof LocoPackage) {
         $getter = array(__CLASS__, 'get_' . $type);
         $package = call_user_func($getter, $handle);
         if ($package) {
             $package->meta();
             Loco::cache($key, $package);
         }
     }
     return $package;
 }