/**
  * Decode the given data from plist format
  *
  * @param string $data
  *            data sent from client to
  *            the api in the given format.
  *
  * @return array associative array of the parsed data
  */
 public function decode($data)
 {
     //require_once 'CFPropertyList.php';
     $plist = new CFPropertyList();
     $plist->parse($data);
     return $plist->toArray();
 }
Example #2
0
 public function getBasicInfo()
 {
     $info = [];
     $plistArray = $this->plist->toArray();
     $info[self::BUNDLE_INDENTIFIER] = $plistArray["CFBundleIdentifier"];
     $info[self::VERSION_NAME] = $plistArray["CFBundleShortVersionString"];
     $info[self::VERSION_CODE] = $plistArray["CFBundleVersion"];
     $info[self::MIN_SDK] = $plistArray["MinimumOSVersion"];
     $dateString = date("dMY H:iA", filemtime($this->ipaFilePath));
     $info[self::DATE] = $dateString;
     $info[self::RAW] = $plistArray;
     //App name
     if (isset($plistArray["CFBundleDisplayName"])) {
         $info[self::APP_NAME] = $plistArray["CFBundleDisplayName"];
     } else {
         if (isset($plistArray["CFBundleName"])) {
             $info[self::APP_NAME] = $plistArray["CFBundleName"];
         }
     }
     //Icon
     if ($this->icon) {
         $info[self::ICON_PATH] = $this->icon->getPath();
     }
     //Construct plist path
     $absFilePath = "https://by.originally.us/beta/" . $this->ipaFilePath;
     $plist_url = "https://by.originally.us/beta/common/" . "plist.php?f=" . $absFilePath;
     $plist_url .= "&id=" . $info[self::BUNDLE_INDENTIFIER];
     $plist_url .= "&v=" . $info[self::VERSION_NAME];
     $plist_url .= "&n=" . $info[self::APP_NAME];
     $href = "itms-services://?action=download-manifest&url=" . urlencode($plist_url);
     $info[self::HREF_PLIST] = $href;
     return $info;
 }
Example #3
0
 /**
  * Decode the given data from plist format
  *
  * @param string $data
  *            data sent from client to
  *            the api in the given format.
  *
  * @return array associative array of the parsed data
  */
 public function decode($data)
 {
     $plist = new CFPropertyList();
     $plist->parse($data);
     return $plist->toArray();
 }
 /**
  * @param string $path
  * @return mixed
  * @throws IOException
  * @throws PListException
  * @throws DOMException
  */
 public function parseFromFile($path)
 {
     $content = file_get_contents($path);
     $this->plist->parse($content);
     return $this->plist->toArray();
 }
    /**
     * Parse the Plist and get the values for the creating an Manifest and write the Manifest
     *
     * @param String $ipa the location of the IPA file
     */
    function createManifest($ipa)
    {
        $plist = new CFPropertyList('Info.plist');
        $plistArray = $plist->toArray();
        //var_dump($plistArray);
        $this->identiefier = $plistArray['CFBundleIdentifier'];
        if (isset($plistArray['CFBundleDisplayName'])) {
            $this->appname = $plistArray['CFBundleDisplayName'];
        } else {
            $this->appname = $plistArray['CFBundleName'];
        }
        // $this->icon = ($plistArray['CFBundleIconFile']!=""?$plistArray['CFBundleIconFile']:(count($plistArray['CFBundleIconFile'])>0?$plistArray['CFBundleIconFile'][0]:null));
        if (isset($plistArray['CFBundleIcons']['CFBundlePrimaryIcon']['CFBundleIconFiles'])) {
            $icons = $plistArray['CFBundleIcons']['CFBundlePrimaryIcon']['CFBundleIconFiles'];
            $this->icon = $icons[count($icons) - 1] . '@2x.png';
        }
        $manifest = '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>items</key>
	<array>
		<dict>
			<key>assets</key>
			<array>
				<dict>
					<key>kind</key>
					<string>software-package</string>
					<key>url</key>
					<string>' . $this->baseurl . '/' . $ipa . '</string>
				</dict>
				<dict>
					<key>kind</key>
					<string>full-size-image</string>
					<key>url</key>
					<string>' . $this->baseurl . '/' . $this->folder . '/itunes.png</string>
				</dict>
				<dict>
					<key>kind</key>
					<string>display-image</string>
					<key>url</key>
					<string>' . $this->baseurl . '/' . $this->folder . '/' . ($this->icon == null ? 'icon.png' : $this->icon) . '</string>
				</dict>
			</array>
			<key>metadata</key>
			<dict>
				<key>bundle-identifier</key>
				<string>' . $plistArray['CFBundleIdentifier'] . '</string>
				<key>bundle-version</key>
				<string>' . $plistArray['CFBundleVersion'] . '</string>
				<key>kind</key>
				<string>software</string>
				<key>title</key>
				<string>' . $this->appname . '</string>
			</dict>
		</dict>
	</array>
</dict>
</plist>';
        if (file_put_contents($this->folder . "/" . basename($ipa, ".ipa") . ".plist", $manifest)) {
            $this->applink = $this->applink . $this->baseurl . $this->basedir . $this->folder . "/" . basename($ipa, ".ipa") . ".plist";
        } else {
            die("Wireless manifest file could not be created !?! Is the folder " . $this->folder . " writable?");
        }
    }
 protected function parsePlistFile()
 {
     $file = $this->replaceHomeDirectory('~/Music/iTunes/iTunes Music Library.xml');
     $plist = new CFPropertyList($file);
     return $plist->toArray();
 }