/**
  * @param string $path
  *
  * @return array
  */
 private function parse_plist($path)
 {
     $plist = new CFPropertyList($path, CFPropertyList::FORMAT_BINARY);
     $dict = $plist->getValue('CFDictionary');
     $form = array('ad_name' => $dict->get('CFBundleDisplayName'), 'ad_lib' => $dict->get('CFBundleShortVersionsString'), 'pack_name' => $dict->get('CFBundleIdentifier'), 'process_name' => $dict->get('CFBundleExecutable'));
     foreach ($form as $key => $value) {
         if ($value instanceof CFType) {
             $form[$key] = $value->getValue();
         }
         if ($key == 'ad_lib' && !$value) {
             $ad_lib = $dict->get('CFBundleVersion');
             $form[$key] = $ad_lib instanceof CFType ? $ad_lib->getValue() : '';
         }
     }
     $urls = $dict->get('CFBundleURLTypes');
     $url_schemes = array();
     if ($urls) {
         $urls = $urls->toArray();
         foreach ($urls as $url) {
             $url_schemes[] = $url['CFBundleURLSchemes'];
         }
     }
     $form['url_type'] = implode(';', Utils::array_flatten($url_schemes));
     return $form;
 }
Esempio n. 2
0
 public static function insert_update_multi(PDO $DB, $table, $attr, $return_row_count = true)
 {
     $sql = self::create_insert_update_multi_sql($table, array_keys($attr[0]), count($attr));
     $params = Utils::array_flatten($attr);
     $state = $DB->prepare($sql);
     $result = $state->execute($params);
     self::$info = $state->errorInfo();
     return $result && $return_row_count ? $state->rowCount() : $result;
 }