private static function getPlist() { // check cached version if (iPhoto::$plist == null) { try { if (file_exists(ALBUM_XML_LOCATION)) { $parser = new plistParser(); iPhoto::$plist = $parser->parseFile(ALBUM_XML_LOCATION); } } catch (Exception $e) { return null; } } // done return iPhoto::$plist; }
<?php include "PlistParser.inc"; $parser = new plistParser(); $plist = $parser->parseFile(dirname(__FILE__) . "/Info.plist"); var_dump($plist);
echo "[30m" . $contents . "[0m\n"; if ($user_latitude != 360 && $user_longitude != 360) { echo "[33m" . $user_latitude . ', ' . $user_longitude . "[0m\n"; } echo "[34m" . $text_tags . "[0m\n"; echo "[35m" . $photo_file . "[0m\n"; $options = ' -d="' . $datetime . '"'; if ($photo_file != '') { $photo_file_path = dirname(__FILE__) . '/Photo/' . $photo_file; $options .= ' -p="' . $photo_file_path . '"'; } $newentry = system('echo "' . $contents . '" | dayone ' . $options . ' new'); $newentry = str_replace('New entry : ~/', '', $newentry); $newentry = system('ls ~/"' . $newentry . '"'); $parser = new plistParser(); $plist = $parser->parseFile($newentry); $xml = '<?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>Creation Date</key> <date>' . $plist['Creation Date'] . '</date> <key>Entry Text</key> <string>' . $plist['Entry Text'] . '</string> <key>Starred</key> <false/> <key>Tags</key> <array>' . Tags($text_tags) . '</array> ' . Location($user_latitude, $user_longitude) . ' <key>UUID</key> <string>' . $plist['UUID'] . '</string>
<?php include "PlistParser.inc"; $parser = new plistParser(); $plist = $parser->parseFile(dirname(__FILE__) . "/iTunes.xml"); var_dump($plist);
<?php # provides a class to parse Plist XML files require_once "classes/PlistParser.inc"; $parser = new plistParser(); # lib.xml is the iTunes Music Library file $plist = $parser->parseFile(dirname(__FILE__) . "/lib.xml"); # counters $track_count = 0; $played_track_count = 0; # loop through the tracks foreach ($plist['Tracks'] as $track) { $track_count++; if (isset($track['Play Count']) && $track['Play Count'] > 0) { $played_track_count++; $name = isset($track['Name']) ? $track['Name'] : "Untitled"; $artist = isset($track['Artist Album']) ? $track['Artist Album'] : "Unknown Artist"; $album = isset($track['Album']) ? $track['Album'] : "Unknown Album"; /** * TO DO: store played songs in the databse */ } } print $track_count; /* FOR TESTING PURPOSE ONLY */
function getKextVersion($kext) { global $workPath; if (!is_dir($kext)) { return "0.00"; } // If $kext dosent exist we will just return 0.00 include_once "{$workPath}/bin/html/libs/PlistParser.inc"; $parser = new plistParser(); $plist = $parser->parseFile("{$kext}/Contents/Info.plist"); reset($plist); while (list($key, $value) = each($plist)) { if ($key == "CFBundleShortVersionString") { return "{$value}"; } } }