当前位置: 首页>>代码示例>>PHP>>正文


PHP caUnserializeForDatabase函数代码示例

本文整理汇总了PHP中caUnserializeForDatabase函数的典型用法代码示例。如果您正苦于以下问题:PHP caUnserializeForDatabase函数的具体用法?PHP caUnserializeForDatabase怎么用?PHP caUnserializeForDatabase使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了caUnserializeForDatabase函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getParametersForDisplay

 /**
  * Extracts and returns printable parameters for the queue record passed in $pa_rec
  * This is used by utilties that present information on the task queue to show details of each queued task
  * without having to know specifics about the type of task.
  *
  * @param array $pa_rec An raw database record array for the queued task (eg. each key a field in ca_task_queue and the values are raw database data that has not been manipulated or unserialized)
  * @return array An array of printable parameters for the task; array keys are parameter codes, values are arrays with two keys: 'label' = a printable parameter description'; 'value' is a printable parameter setting
  */
 public function getParametersForDisplay($pa_rec)
 {
     $va_parameters = caUnserializeForDatabase($pa_rec["parameters"]);
     $va_params = array();
     $va_params['input_format'] = array('label' => _t('Input format'), 'value' => $va_parameters["INPUT_MIMETYPE"]);
     if (file_exists($va_parameters["FILENAME"])) {
         $va_params['input_file_size'] = array('label' => _t('Input file size'), 'value' => sprintf("%4.2dM", filesize($va_parameters["FILENAME"]) / (1024 * 1024)));
     }
     $va_params['table'] = array('label' => _t('Data source'), 'value' => $va_parameters["TABLE"] . ':' . $va_parameters["FIELD"] . ':' . $va_parameters["PK_VAL"]);
     $va_params['temporary_filename'] = array('label' => _t('Temporary filename'), 'value' => $va_parameters["FILENAME"]);
     if (is_array($va_parameters["VERSIONS"])) {
         $va_params['version'] = array('label' => _t('Versions output'), 'value' => join(", ", array_keys($va_parameters["VERSIONS"])));
     }
     if (is_array($va_parameters["RULES"]) && sizeof($va_parameters["RULES"]) > 0) {
         $vs_rules = '';
         foreach ($va_parameters["RULES"] as $vs_rule => $va_rule_info) {
             $vs_params .= "\t" . $vs_rule . " => ";
             $va_rule_list = array();
             foreach ($va_rule_info as $vs_key => $vs_val) {
                 $va_rule_list[] = "{$vs_key} = {$vs_val}";
             }
             $vs_rules = join("; ", $va_rule_list) . "\n";
         }
         $va_params['rule_list'] = array('label' => _t('Media processing rules'), 'value' => $vs_rules);
     }
     return $va_params;
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:35,代码来源:mediaproc.php

示例2: getParametersForDisplay

 public function getParametersForDisplay($pa_rec)
 {
     $va_parameters = caUnserializeForDatabase($pa_rec["parameters"]);
     $va_params = array();
     // TODO: add params
     return $va_params;
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:7,代码来源:mediaReplication.php

示例3: loadTypeSpecificValueFromRow

 /**
  *
  *
  */
 public function loadTypeSpecificValueFromRow($pa_value_array)
 {
     $this->ops_text_value = $pa_value_array['value_longtext1'];
     $this->ops_uri_value = $pa_value_array['value_longtext2'];
     $va_info = caUnserializeForDatabase($pa_value_array['value_blob']);
     $this->opa_indexing_info = is_array($va_info) && isset($va_info['indexing_info']) && is_array($va_info['indexing_info']) ? $va_info['indexing_info'] : array();
     $this->opa_extra_info = is_array($va_info) && isset($va_info['extra_info']) && is_array($va_info['extra_info']) ? $va_info['extra_info'] : array();
 }
开发者ID:samrahman,项目名称:providence,代码行数:12,代码来源:InformationServiceAttributeValue.php

示例4: getMediaArray

 public function getMediaArray($ps_data)
 {
     if (!is_array($ps_data)) {
         $va_data = caUnserializeForDatabase($ps_data);
         return is_array($va_data) ? $va_data : false;
     } else {
         return $ps_data;
     }
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:9,代码来源:MediaInfoCoder.php

示例5: getParametersForDisplay

 public function getParametersForDisplay($pa_rec)
 {
     $va_parameters = caUnserializeForDatabase($pa_rec["parameters"]);
     $va_params = array();
     $t_set = new ca_sets($va_parameters['set_id']);
     $va_params['importing_from'] = array('label' => _t("Applying batch edits to set"), 'value' => $t_set->getLabelForDisplay());
     $va_params['number_of_records'] = array('label' => _t("Records to edit"), 'value' => (int) $t_set->getItemCount(array('user_id' => $va_parameters['user_id'])));
     $t_ui = new ca_editor_uis($va_parameters['ui_id']);
     $t_screen = new ca_editor_ui_screens();
     if ($t_screen->load(array('ui_id' => $t_ui->getPrimaryKey(), 'screen_id' => str_ireplace("screen", "", $va_parameters['screen'])))) {
         $va_params['ui'] = array('label' => _t("Using interface"), 'value' => $t_ui->getLabelForDisplay() . " ➜ " . $t_screen->getLabelForDisplay());
     }
     return $va_params;
 }
开发者ID:ffarago,项目名称:pawtucket2,代码行数:14,代码来源:batchEditor.php

示例6: getParametersForDisplay

 public function getParametersForDisplay($pa_rec)
 {
     $va_parameters = caUnserializeForDatabase($pa_rec["parameters"]);
     $va_params = array();
     $o_config = Configuration::load();
     $vs_batch_media_import_root_directory = $o_config->get('batch_media_import_root_directory');
     $vs_relative_directory = preg_replace("!{$vs_batch_media_import_root_directory}[/]*!", "", $va_parameters["importFromDirectory"]);
     $va_params['importFromDirectory'] = array('label' => _t("Importing media from"), 'value' => "/" . $vs_relative_directory);
     if (file_exists($va_parameters["importFromDirectory"])) {
         $va_counts = caGetDirectoryContentsCount($va_parameters["importFromDirectory"], $va_parameters["includeSubDirectories"], false);
         $va_params['number_of_files'] = array('label' => _t("Files to import"), 'value' => (int) $va_counts['files']);
     }
     return $va_params;
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:14,代码来源:mediaImport.php

示例7: __construct

 public function __construct($po_db = null)
 {
     if (!is_object($po_db)) {
         $po_db = new Db();
     }
     $this->o_db = $po_db;
     $qr_res = $po_db->query("SELECT * FROM ca_application_vars LIMIT 1");
     if (!$qr_res->nextRow()) {
         # -- create app var record
         $this->opa_app_vars = array("last_modified_on" => time());
         $this->o_db->query("INSERT INTO ca_application_vars (vars) VALUES (?)", caSerializeForDatabase($this->opa_app_vars));
         if ($this->o_db->numErrors()) {
             # error
             $this->postError(300, join(';', $this->o_db->getErrors()), "ApplicationVars->load()");
             return false;
         }
         return true;
     }
     if (!is_array($this->opa_app_vars = caUnserializeForDatabase($qr_res->get('vars')))) {
         $this->opa_app_vars = array();
     }
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:22,代码来源:ApplicationVars.php

示例8: _genExport

 /**
  * Generate  export file of current result
  */
 protected function _genExport($pt_subject, $ps_template, $ps_output_filename, $ps_title = null)
 {
     $this->view->setVar('t_subject', $pt_subject);
     if (substr($ps_template, 0, 5) === '_pdf_') {
         $va_template_info = caGetPrintTemplateDetails('summary', substr($ps_template, 5));
     } elseif (substr($ps_template, 0, 9) === '_display_') {
         $vn_display_id = substr($ps_template, 9);
         $t_display = new ca_bundle_displays($vn_display_id);
         if ($vn_display_id && $t_display->haveAccessToDisplay($this->request->getUserID(), __CA_BUNDLE_DISPLAY_READ_ACCESS__)) {
             $this->view->setVar('t_display', $t_display);
             $this->view->setVar('display_id', $vn_display_id);
             $va_display_list = array();
             $va_placements = $t_display->getPlacements(array('settingsOnly' => true));
             foreach ($va_placements as $vn_placement_id => $va_display_item) {
                 $va_settings = caUnserializeForDatabase($va_display_item['settings']);
                 // get column header text
                 $vs_header = $va_display_item['display'];
                 if (isset($va_settings['label']) && is_array($va_settings['label'])) {
                     $va_tmp = caExtractValuesByUserLocale(array($va_settings['label']));
                     if ($vs_tmp = array_shift($va_tmp)) {
                         $vs_header = $vs_tmp;
                     }
                 }
                 $va_display_list[$vn_placement_id] = array('placement_id' => $vn_placement_id, 'bundle_name' => $va_display_item['bundle_name'], 'display' => $vs_header, 'settings' => $va_settings);
             }
             $this->view->setVar('placements', $va_display_list);
         } else {
             $this->postError(3100, _t("Invalid format %1", $ps_template), "DetailController->_genExport()");
             return;
         }
         $va_template_info = caGetPrintTemplateDetails('summary', 'summary');
     } else {
         $this->postError(3100, _t("Invalid format %1", $ps_template), "DetailController->_genExport()");
         return;
     }
     //
     // PDF output
     //
     if (!is_array($va_template_info)) {
         $this->postError(3110, _t("Could not find view for PDF"), "DetailController->_genExport()");
         return;
     }
     //
     // Tag substitution
     //
     // Views can contain tags in the form {{{tagname}}}. Some tags, such as "itemType" and "detailType" are defined by
     // the detail controller. More usefully, you can pull data from the item being detailed by using a valid "get" expression
     // as a tag (Eg. {{{ca_objects.idno}}}. Even more usefully for some, you can also use a valid bundle display template
     // (see http://docs.collectiveaccess.org/wiki/Bundle_Display_Templates) as a tag. The template will be evaluated in the
     // context of the item being detailed.
     //
     $va_defined_vars = array_keys($this->view->getAllVars());
     // get list defined vars (we don't want to copy over them)
     $va_tag_list = $this->getTagListForView($va_template_info['path']);
     // get list of tags in view
     foreach ($va_tag_list as $vs_tag) {
         if (in_array($vs_tag, $va_defined_vars)) {
             continue;
         }
         if (strpos($vs_tag, "^") !== false || strpos($vs_tag, "<") !== false) {
             $this->view->setVar($vs_tag, $pt_subject->getWithTemplate($vs_tag, array('checkAccess' => $this->opa_access_values)));
         } elseif (strpos($vs_tag, ".") !== false) {
             $this->view->setVar($vs_tag, $pt_subject->get($vs_tag, array('checkAccess' => $this->opa_access_values)));
         } else {
             $this->view->setVar($vs_tag, "?{$vs_tag}");
         }
     }
     try {
         $this->view->setVar('base_path', $vs_base_path = pathinfo($va_template_info['path'], PATHINFO_DIRNAME));
         $this->view->addViewPath(array($vs_base_path, "{$vs_base_path}/local"));
         $vs_content = $this->render($va_template_info['path']);
         $o_dompdf = new DOMPDF();
         $o_dompdf->load_html($vs_content);
         $o_dompdf->set_paper(caGetOption('pageSize', $va_template_info, 'letter'), caGetOption('pageOrientation', $va_template_info, 'portrait'));
         $o_dompdf->set_base_path(caGetPrintTemplateDirectoryPath('summary'));
         $o_dompdf->render();
         $o_dompdf->stream(caGetOption('filename', $va_template_info, 'export_results.pdf'));
         $vb_printed_properly = true;
     } catch (Exception $e) {
         $vb_printed_properly = false;
         $this->postError(3100, _t("Could not generate PDF"), "DetailController->_genExport()");
     }
     return;
 }
开发者ID:ffarago,项目名称:pawtucket2,代码行数:87,代码来源:DetailController.php

示例9: _getIntrinsicValue

 /**
  * get() value for intrinsic
  *
  * @param array $pa_value_list
  * @param BaseModel $pt_instance
  * @param array Options
  *
  * @return array|string
  */
 private function _getIntrinsicValue($pa_value_list, $pt_instance, $pa_options)
 {
     $vb_return_as_link = isset($pa_options['returnAsLink']) ? $pa_options['returnAsLink'] : false;
     $vb_get_direct_date = (bool) caGetOption(array('getDirectDate', 'GET_DIRECT_DATE'), $pa_options, false);
     $vb_sortable = isset($pa_options['sortable']) ? $pa_options['sortable'] : false;
     $va_path_components = $pa_options['pathComponents'];
     $va_field_info = $pa_options['fieldInfo'];
     $vs_pk = $pa_options['primaryKey'];
     $vs_table_name = $pt_instance->tableName();
     // Handle specific intrinsic types
     switch ($va_field_info['FIELD_TYPE']) {
         case FT_DATERANGE:
         case FT_HISTORIC_DATERANGE:
         case FT_TIMESTAMP:
         case FT_DATETIME:
         case FT_HISTORIC_DATETIME:
             foreach ($pa_value_list as $vn_locale_id => $va_values) {
                 if ($pa_options['useLocaleCodes']) {
                     if (!$vn_locale_id || !($vm_locale_id = $this->opo_locales->localeIDToCode($vn_locale_id))) {
                         $vm_locale_id = __CA_DEFAULT_LOCALE__;
                     }
                 } else {
                     if (!($vm_locale_id = $vn_locale_id)) {
                         $vm_locale_id = $this->opo_locales->localeCodeToID(__CA_DEFAULT_LOCALE__);
                     }
                 }
                 foreach ($va_values as $vn_i => $va_value) {
                     $va_ids[] = $vn_id = $va_value[$vs_pk];
                     if (in_array($va_field_info['FIELD_TYPE'], array(FT_TIMESTAMP, FT_DATETIME, FT_HISTORIC_DATETIME))) {
                         $vs_prop = $va_value[$va_path_components['field_name']];
                         if (!$vb_get_direct_date && !$vb_sortable) {
                             $this->opo_tep->init();
                             if ($va_field_info['FIELD_TYPE'] !== FT_HISTORIC_DATETIME) {
                                 $this->opo_tep->setUnixTimestamps($vs_prop, $vs_prop);
                             } else {
                                 $this->opo_tep->setHistoricTimestamps($vs_prop, $vs_prop);
                             }
                             $vs_prop = $this->opo_tep->getText($pa_options);
                         }
                     } elseif ($vb_get_direct_date) {
                         $vs_prop = $va_value[$va_field_info['START']];
                     } elseif ($vb_sortable) {
                         $vs_prop = $va_value[$va_field_info['START']];
                     } else {
                         $this->opo_tep->init();
                         if ($va_field_info['FIELD_TYPE'] == FT_DATERANGE) {
                             $this->opo_tep->setUnixTimestamps($va_value[$va_field_info['START']], $va_value[$va_field_info['END']]);
                         } else {
                             $this->opo_tep->setHistoricTimestamps($va_value[$va_field_info['START']], $va_value[$va_field_info['END']]);
                         }
                         $vs_prop = $this->opo_tep->getText($pa_options);
                     }
                     if ($vb_return_as_link) {
                         $vs_prop = array_shift(caCreateLinksFromText(array($vs_prop), $vs_table_name, array($vn_id)));
                     }
                     $va_return_values[$vn_id][$vm_locale_id] = $vs_prop;
                 }
             }
             break;
         case FT_MEDIA:
             if (!($vs_version = $va_path_components['subfield_name'])) {
                 $vs_version = "largeicon";
                 // TODO: fix
             }
             foreach ($pa_value_list as $vn_locale_id => $va_values) {
                 if ($pa_options['useLocaleCodes']) {
                     if (!$vn_locale_id || !($vm_locale_id = $this->opo_locales->localeIDToCode($vn_locale_id))) {
                         $vm_locale_id = __CA_DEFAULT_LOCALE__;
                     }
                 } else {
                     if (!($vm_locale_id = $vn_locale_id)) {
                         $vm_locale_id = $this->opo_locales->localeCodeToID(__CA_DEFAULT_LOCALE__);
                     }
                 }
                 foreach ($va_values as $vn_i => $va_value) {
                     $va_ids[] = $vn_id = $va_value[$vs_pk];
                     $o_media_settings = new MediaProcessingSettings($va_path_components['table_name'], $va_path_components['field_name']);
                     $va_versions = $o_media_settings->getMediaTypeVersions('*');
                     if (!isset($va_versions[$vs_version])) {
                         $va_tmp = array_keys($va_versions);
                         $vs_version = array_shift($va_tmp);
                     }
                     // See if an info element was passed, eg. ca_object_representations.media.icon.width should return the width of the media rather than a tag or url to the media
                     $vs_info_element = $va_path_components['num_components'] == 4 ? $va_path_components['components'][3] : null;
                     if ($pa_options['unserialize']) {
                         $va_return_values[$vn_id][$vm_locale_id] = caUnserializeForDatabase($va_value[$va_path_components['field_name']]);
                     } elseif ($vs_info_element) {
                         $va_return_values[$vn_id][$vm_locale_id] = $this->getMediaInfo($va_path_components['table_name'] . '.' . $va_path_components['field_name'], $vs_version, $vs_info_element, $pa_options);
                     } elseif (isset($pa_options['returnURL']) && $pa_options['returnURL']) {
                         $va_return_values[$vn_id][$vm_locale_id] = $this->getMediaUrl($va_path_components['table_name'] . '.' . $va_path_components['field_name'], $vs_version, $pa_options);
                     } elseif (isset($pa_options['returnPath']) && $pa_options['returnPath']) {
//.........这里部分代码省略.........
开发者ID:kai-iak,项目名称:providence,代码行数:101,代码来源:SearchResult.php

示例10: getDisplaysAsXML

 public function getDisplaysAsXML()
 {
     $t_display = new ca_bundle_displays();
     /** @var Datamodel $o_dm */
     $o_dm = Datamodel::load();
     $this->opt_locale = new ca_locales();
     $va_displays = $t_display->getBundleDisplays();
     $vs_buf = "<displays>\n";
     foreach ($va_displays as $vn_i => $va_display_by_locale) {
         $va_locales = array_keys($va_display_by_locale);
         $va_info = $va_display_by_locale[$va_locales[0]];
         if (!$t_display->load($va_info['display_id'])) {
             continue;
         }
         $vs_buf .= "\t<display code='" . ($va_info['display_code'] && preg_match('!^[A-Za-z0-9_]+$!', $va_info['display_code']) ? $va_info['display_code'] : 'display_' . $va_info['display_id']) . "' type='" . $o_dm->getTableName($va_info['table_num']) . "' system='" . $t_display->get('is_system') . "'>\n";
         $vs_buf .= "\t\t<labels>\n";
         foreach ($va_display_by_locale as $vn_locale_id => $va_display_info) {
             if (strlen($this->opt_locale->localeIDToCode($vn_locale_id)) > 0) {
                 $vs_buf .= "\t\t\t<label locale='" . $this->opt_locale->localeIDToCode($vn_locale_id) . "'><name>" . caEscapeForXML($va_display_info['name']) . "</name></label>\n";
             }
         }
         $vs_buf .= "\t\t</labels>\n";
         $va_settings = $t_display->getSettings();
         if (sizeof($va_settings) > 0) {
             $vs_buf .= "\t\t<settings>\n";
             foreach ($va_settings as $vs_setting => $vm_val) {
                 if (is_array($vm_val)) {
                     foreach ($vm_val as $vn_i => $vn_val) {
                         $vs_buf .= "\t\t\t<setting name='{$vs_setting}'><![CDATA[" . $vn_val . "]]></setting>\n";
                     }
                 } else {
                     $vs_buf .= "\t\t\t<setting name='{$vs_setting}'><![CDATA[" . $vm_val . "]]></setting>\n";
                 }
             }
             $vs_buf .= "\t\t</settings>\n";
         }
         // User and group access
         $va_users = $t_display->getUsers();
         if (sizeof($va_users) > 0) {
             $vs_buf .= "\t\t<userAccess>\n";
             foreach ($va_users as $va_user_info) {
                 $vs_buf .= "\t\t\t<permission user='" . $va_user_info["user_name"] . "' access='" . $this->_convertUserGroupAccessToString(intval($va_user_info['access'])) . "'/>\n";
             }
             $vs_buf .= "\t\t</userAccess>\n";
         }
         $va_groups = $t_display->getUserGroups();
         if (sizeof($va_groups) > 0) {
             $vs_buf .= "\t\t<groupAccess>\n";
             foreach ($va_groups as $va_group_info) {
                 $vs_buf .= "\t\t\t<permission group='" . $va_group_info["code"] . "' access='" . $this->_convertUserGroupAccessToString(intval($va_group_info['access'])) . "'/>\n";
             }
             $vs_buf .= "\t\t</groupAccess>\n";
         }
         $va_placements = $t_display->getPlacements();
         $vs_buf .= "<bundlePlacements>\n";
         foreach ($va_placements as $vn_placement_id => $va_placement_info) {
             $vs_buf .= "\t\t<placement code='" . preg_replace("![^A-Za-z0-9_]+!", "_", $va_placement_info['bundle_name']) . "'><bundle>" . $va_placement_info['bundle_name'] . "</bundle>\n";
             $va_settings = caUnserializeForDatabase($va_placement_info['settings']);
             if (is_array($va_settings)) {
                 $vs_buf .= "<settings>\n";
                 foreach ($va_settings as $vs_setting => $vm_value) {
                     switch ($vs_setting) {
                         case 'label':
                             if (is_array($vm_value)) {
                                 foreach ($vm_value as $vn_locale_id => $vm_locale_specific_value) {
                                     if (preg_match("/^[a-z]{2,3}\\_[A-Z]{2,3}\$/", $vn_locale_id)) {
                                         // locale code
                                         $vs_locale_code = $vn_locale_id;
                                     } else {
                                         if (!($vs_locale_code = $this->opt_locale->localeIDToCode($vn_locale_id))) {
                                             $vs_locale_code = 'en_US';
                                         }
                                     }
                                     $vs_buf .= "<setting name='label' locale='" . $vs_locale_code . "'>" . caEscapeForXML($vm_locale_specific_value) . "</setting>\n";
                                 }
                             }
                             break;
                         case 'restrict_to_relationship_types':
                             if (is_array($vm_value)) {
                                 foreach ($vm_value as $vn_val) {
                                     $t_rel_type = new ca_relationship_types($vn_val);
                                     if ($t_rel_type->getPrimaryKey()) {
                                         $vs_value = $t_rel_type->get('type_code');
                                         $vs_buf .= "\t\t\t\t<setting name='{$vs_setting}'><![CDATA[" . $vs_value . "]]></setting>\n";
                                     }
                                 }
                             }
                             break;
                         case 'restrict_to_types':
                             if (is_array($vm_value)) {
                                 foreach ($vm_value as $vn_val) {
                                     $t_item = new ca_list_items($vn_val);
                                     if ($t_item->getPrimaryKey()) {
                                         $vs_value = $t_item->get('idno');
                                         $vs_buf .= "\t\t\t\t<setting name='{$vs_setting}'><![CDATA[" . $vs_value . "]]></setting>\n";
                                     }
                                 }
                             }
                             break;
                         default:
//.........这里部分代码省略.........
开发者ID:idiscussforum,项目名称:providence,代码行数:101,代码来源:ConfigurationExporter.php

示例11: getChangeLog

 /**
  * Get change log for the current record represented by this BaseModel object, or for another specified row.
  * 
  * @access public
  * @param int $pn_row_id Return change log for row with specified primary key id. If omitted currently loaded record is used.
  * @param array $pa_options Array of options. Valid options are:
  * 		range = optional range to restrict returned entries to. Should be array with 0th key set to start and 1st key set to end of range. Both values should be Unix timestamps. You can also use 'start' and 'end' as keys if desired. 
  * 		limit = maximum number of entries returned. Omit or set to zero for no limit. [default=all]
  * 		forTable = if true only return changes made directly to the current table (ie. omit changes to related records that impact this record [default=false]
  * 		excludeUnitID = if set, log records with the specific unit_id are not returned [default=not set]
  *		changeType = if set to I, U or D, will limit change log to inserts, updates or deletes respectively. If not set all types are returned.
  * @return array Change log data
  */
 public function getChangeLog($pn_row_id = null, $pa_options = null)
 {
     $pa_datetime_range = isset($pa_options['range']) && is_array($pa_options['range']) ? $pa_options['range'] : null;
     $pn_max_num_entries_returned = isset($pa_options['limit']) && (int) $pa_options['limit'] ? (int) $pa_options['limit'] : 0;
     $pb_for_table = isset($pa_options['forTable']) ? (bool) $pa_options['forTable'] : false;
     $ps_exclude_unit_id = isset($pa_options['excludeUnitID']) && $pa_options['excludeUnitID'] ? $pa_options['excludeUnitID'] : null;
     $ps_change_type = isset($pa_options['changeType']) && in_array($pa_options['changeType'], array('I', 'U', 'D')) ? $pa_options['changeType'] : null;
     $vs_daterange_sql = '';
     if ($pa_datetime_range) {
         $vn_start = $vn_end = null;
         if (isset($pa_datetime_range[0])) {
             $vn_start = (int) $pa_datetime_range[0];
         } else {
             if (isset($pa_datetime_range['start'])) {
                 $vn_start = (int) $pa_datetime_range['start'];
             }
         }
         if (isset($pa_datetime_range[1])) {
             $vn_end = (int) $pa_datetime_range[1];
         } else {
             if (isset($pa_datetime_range['end'])) {
                 $vn_end = (int) $pa_datetime_range['end'];
             }
         }
         if ($vn_start <= 0) {
             $vn_start = time() - 3600;
         }
         if (!$vn_end <= 0) {
             $vn_end = time();
         }
         if ($vn_end < $vn_start) {
             $vn_end = $vn_start;
         }
         if (!$pn_row_id) {
             if (!($pn_row_id = $this->getPrimaryKey())) {
                 return array();
             }
         }
         $vs_daterange_sql = " AND (wcl.log_datetime > ? AND wcl.log_datetime < ?)";
     }
     if (!$this->opqs_get_change_log) {
         $vs_change_log_database = '';
         if ($vs_change_log_database = $this->_CONFIG->get("change_log_database")) {
             $vs_change_log_database .= ".";
         }
         $o_db = $this->getDb();
         if ($pb_for_table) {
             if (!($this->opqs_get_change_log = $o_db->prepare("\n\t\t\t\t\tSELECT DISTINCT\n\t\t\t\t\t\twcl.log_id, wcl.log_datetime log_datetime, wcl.user_id, wcl.changetype, wcl.logged_table_num, wcl.logged_row_id,\n\t\t\t\t\t\twclsnap.snapshot, wcl.unit_id, wu.email, wu.fname, wu.lname\n\t\t\t\t\tFROM ca_change_log wcl\n\t\t\t\t\tINNER JOIN ca_change_log_snapshots AS wclsnap ON wclsnap.log_id = wcl.log_id\n\t\t\t\t\tLEFT JOIN ca_change_log_subjects AS wcls ON wcl.log_id = wcls.log_id\n\t\t\t\t\tLEFT JOIN ca_users AS wu ON wcl.user_id = wu.user_id\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\t(wcl.logged_table_num = " . (int) $this->tableNum() . ") AND " . ($ps_change_type ? "(wcl.changetype = '" . $ps_change_type . "') AND " : "") . "\n\t\t\t\t\t\t\t(wcl.logged_row_id = ?)\n\t\t\t\t\t\t)\n\t\t\t\t\t\t{$vs_daterange_sql}\n\t\t\t\t\tORDER BY log_datetime\n\t\t\t\t"))) {
                 # should not happen
                 return false;
             }
         } else {
             if (!($this->opqs_get_change_log = $o_db->prepare("\n\t\t\t\t\tSELECT DISTINCT\n\t\t\t\t\t\twcl.log_id, wcl.log_datetime log_datetime, wcl.user_id, wcl.changetype, wcl.logged_table_num, wcl.logged_row_id,\n\t\t\t\t\t\twclsnap.snapshot, wcl.unit_id, wu.email, wu.fname, wu.lname\n\t\t\t\t\tFROM ca_change_log wcl\n\t\t\t\t\tINNER JOIN ca_change_log_snapshots AS wclsnap ON wclsnap.log_id = wcl.log_id\n\t\t\t\t\tLEFT JOIN ca_change_log_subjects AS wcls ON wcl.log_id = wcls.log_id\n\t\t\t\t\tLEFT JOIN ca_users AS wu ON wcl.user_id = wu.user_id\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\t(wcl.logged_table_num = " . (int) $this->tableNum() . ") AND " . ($ps_change_type ? "(wcl.changetype = '" . $ps_change_type . "') AND " : "") . "\n\t\t\t\t\t\t\t(wcl.logged_row_id = ?)\n\t\t\t\t\t\t)\n\t\t\t\t\t\t{$vs_daterange_sql}\n\t\t\t\t\tUNION\n\t\t\t\t\tSELECT DISTINCT\n\t\t\t\t\t\twcl.log_id, wcl.log_datetime, wcl.user_id, wcl.changetype, wcl.logged_table_num, wcl.logged_row_id,\n\t\t\t\t\t\twclsnap.snapshot, wcl.unit_id, wu.email, wu.fname, wu.lname\n\t\t\t\t\tFROM ca_change_log wcl\n\t\t\t\t\tINNER JOIN ca_change_log_snapshots AS wclsnap ON wclsnap.log_id = wcl.log_id\n\t\t\t\t\tLEFT JOIN ca_change_log_subjects AS wcls ON wcl.log_id = wcls.log_id\n\t\t\t\t\tLEFT JOIN ca_users AS wu ON wcl.user_id = wu.user_id\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t (\n\t\t\t\t\t\t\t(wcls.subject_table_num = " . (int) $this->tableNum() . ") AND " . ($ps_change_type ? "(wcl.changetype = '" . $ps_change_type . "') AND " : "") . "\n\t\t\t\t\t\t\t(wcls.subject_row_id  = ?)\n\t\t\t\t\t\t)\n\t\t\t\t\t\t{$vs_daterange_sql}\n\t\t\t\t\tORDER BY log_datetime\n\t\t\t\t"))) {
                 # should not happen
                 return false;
             }
         }
         if ($pn_max_num_entries_returned > 0) {
             $this->opqs_get_change_log->setLimit($pn_max_num_entries_returned);
         }
     }
     // get directly logged records
     $va_log = array();
     if ($pb_for_table) {
         $qr_log = $this->opqs_get_change_log->execute($vs_daterange_sql ? array((int) $pn_row_id, (int) $vn_start, (int) $vn_end) : array((int) $pn_row_id));
     } else {
         $qr_log = $this->opqs_get_change_log->execute($vs_daterange_sql ? array((int) $pn_row_id, (int) $vn_start, (int) $vn_end, (int) $pn_row_id, (int) $vn_start, (int) $vn_end) : array((int) $pn_row_id, (int) $pn_row_id));
     }
     while ($qr_log->nextRow()) {
         if ($ps_exclude_unit_id && $ps_exclude_unit_id == $qr_log->get('unit_id')) {
             continue;
         }
         $va_log[] = $qr_log->getRow();
         $va_log[sizeof($va_log) - 1]['snapshot'] = caUnserializeForDatabase($va_log[sizeof($va_log) - 1]['snapshot']);
     }
     return $va_log;
 }
开发者ID:samrahman,项目名称:providence,代码行数:90,代码来源:BaseModel.php

示例12: getBundleFormValues

 /**
  * Returns values for bundle. Can be used to set initial state of bundle as well as to grab partial value sets for
  * progressive loading of bundles.
  *
  * NOTE: Currently only support ca_object_representations bundle
  *
  */
 public function getBundleFormValues($ps_bundle_name, $ps_placement_code, $pa_bundle_settings, $pa_options = null)
 {
     global $g_ui_locale;
     // Check if user has access to this bundle
     if ($pa_options['request']->user->getBundleAccessLevel($this->tableName(), $ps_bundle_name) == __CA_BUNDLE_ACCESS_NONE__) {
         return;
     }
     // Check if user has access to this type
     if ((bool) $this->getAppConfig()->get('perform_type_access_checking')) {
         $vn_type_access = $pa_options['request']->user->getTypeAccessLevel($this->tableName(), $this->getTypeID());
         if ($vn_type_access == __CA_BUNDLE_ACCESS_NONE__) {
             return;
         }
         if ($vn_type_access == __CA_BUNDLE_ACCESS_READONLY__) {
             $pa_bundle_settings['readonly'] = true;
         }
     }
     // Check if user has access to this source
     if ((bool) $this->getAppConfig()->get('perform_source_access_checking')) {
         $vn_source_access = $pa_options['request']->user->getSourceAccessLevel($this->tableName(), $this->getSourceID());
         if ($vn_source_access == __CA_BUNDLE_ACCESS_NONE__) {
             return;
         }
         if ($vn_source_access == __CA_BUNDLE_ACCESS_READONLY__) {
             $pa_bundle_settings['readonly'] = true;
         }
     }
     if ((bool) $this->getAppConfig()->get('perform_item_level_access_checking') && $this->getPrimaryKey()) {
         $vn_item_access = $this->checkACLAccessForUser($pa_options['request']->user);
         if ($vn_item_access == __CA_ACL_NO_ACCESS__) {
             return;
         }
         if ($vn_item_access == __CA_ACL_READONLY_ACCESS__) {
             $pa_bundle_settings['readonly'] = true;
         }
     }
     $va_info = $this->getBundleInfo($ps_bundle_name);
     if (!($vs_type = $va_info['type'])) {
         return null;
     }
     if (isset($pa_options['config']) && is_object($pa_options['config'])) {
         $o_config = $pa_options['config'];
     } else {
         $o_config = $this->getAppConfig();
     }
     // start and count
     $pn_start = caGetOption('start', $pa_options, 0);
     $pn_limit = caGetOption('limit', $pa_options, null);
     $vs_element = '';
     switch ($vs_type) {
         # -------------------------------------------------
         case 'preferred_label':
         case 'nonpreferred_label':
             break;
             # -------------------------------------------------
         # -------------------------------------------------
         case 'intrinsic':
             break;
             # -------------------------------------------------
         # -------------------------------------------------
         case 'attribute':
             break;
             # -------------------------------------------------
         # -------------------------------------------------
         case 'related_table':
             switch ($ps_bundle_name) {
                 # -------------------------------
                 case 'ca_object_representations':
                     foreach (array('restrict_to_types', 'restrict_to_relationship_types') as $vs_k) {
                         $pa_options[$vs_k] = $pa_bundle_settings[$vs_k];
                     }
                     $va_reps = $this->getRepresentations(array('thumbnail', 'original'), null, $pa_options);
                     $t_item = new ca_object_representations();
                     $va_rep_type_list = $t_item->getTypeList();
                     $va_errors = array();
                     $vs_bundle_template = caGetOption('display_template', $pa_bundle_settings, null);
                     // Paging
                     $vn_primary_id = 0;
                     $va_initial_values = array();
                     if (sizeof($va_reps)) {
                         $o_type_config = Configuration::load($t_item->getAppConfig()->get('annotation_type_config'));
                         $va_annotation_type_mappings = $o_type_config->getAssoc('mappings');
                         // Get display template values
                         $va_display_template_values = array();
                         if ($vs_bundle_template && is_array($va_relation_ids = caExtractValuesFromArrayList($va_reps, 'relation_id')) && sizeof($va_relation_ids)) {
                             if ($vs_linking_table = RepresentableBaseModel::getRepresentationRelationshipTableName($this->tableName())) {
                                 $va_display_template_values = caProcessTemplateForIDs($vs_bundle_template, $vs_linking_table, $va_relation_ids, array_merge($pa_options, array('returnAsArray' => true, 'returnAllLocales' => false, 'includeBlankValuesInArray' => true)));
                             }
                         }
                         $vn_i = 0;
                         foreach ($va_reps as $va_rep) {
                             $vn_num_multifiles = $va_rep['num_multifiles'];
                             if ($vs_extracted_metadata = caFormatMediaMetadata(caSanitizeArray(caUnserializeForDatabase($va_rep['media_metadata'])))) {
//.........这里部分代码省略.........
开发者ID:idiscussforum,项目名称:providence,代码行数:101,代码来源:BundlableLabelableBaseModelWithAttributes.php

示例13: getGroupRoles

 /**
  * Get list of roles the current user has via associated groups
  *
  * @access public
  * @return array Returns associative array of roles. Key is role id, value is array containing information about the role.
  *
  * The role information array contains the following keys: 
  *		role_id 	(numeric id you can use in addRoles(), deleteRoles(), hasRole(), etc.)
  *		name 		(the full name of the role)
  *		code		(a short code used for the role)
  *		description	(narrative description of role)
  */
 public function getGroupRoles()
 {
     if ($pn_user_id = $this->getPrimaryKey()) {
         if (isset(ca_users::$s_group_role_cache[$pn_user_id])) {
             return ca_users::$s_group_role_cache[$pn_user_id];
         } else {
             $o_db = $this->getDb();
             $qr_res = $o_db->query("\n\t\t\t\t\tSELECT wur.role_id, wur.name, wur.code, wur.description, wur.rank, wur.vars\n\t\t\t\t\tFROM ca_user_roles wur\n\t\t\t\t\tINNER JOIN ca_groups_x_roles AS wgxr ON wgxr.role_id = wur.role_id\n\t\t\t\t\tINNER JOIN ca_users_x_groups AS wuxg ON wuxg.group_id = wgxr.group_id\n\t\t\t\t\tWHERE wuxg.user_id = ?\n\t\t\t\t", (int) $pn_user_id);
             $va_roles = array();
             while ($qr_res->nextRow()) {
                 $va_row = $qr_res->getRow();
                 $va_row['vars'] = caUnserializeForDatabase($va_row['vars']);
                 $va_roles[$va_row['role_id']] = $va_row;
             }
             return ca_users::$s_group_role_cache[$pn_user_id] = $va_roles;
         }
     } else {
         return array();
     }
 }
开发者ID:kai-iak,项目名称:providence,代码行数:32,代码来源:ca_users.php

示例14: getDisplaysAsXML

 public function getDisplaysAsXML($pa_options = null)
 {
     $t_display = new ca_bundle_displays();
     $o_dm = Datamodel::load();
     $this->opt_locale = new ca_locales();
     $va_displays = $t_display->getBundleDisplays();
     $vs_buf = "<displays>\n";
     foreach ($va_displays as $vn_i => $va_display_by_locale) {
         $va_locales = array_keys($va_display_by_locale);
         $va_info = $va_display_by_locale[$va_locales[0]];
         if (!$t_display->load($va_info['display_id'])) {
             continue;
         }
         $vs_buf .= "\t<display code='" . ($va_info['display_code'] && preg_match('!^[A-Za-z0-9_]+$!', $va_info['display_code']) ? $va_info['display_code'] : 'display_' . $va_info['display_id']) . "' type='" . $o_dm->getTableName($va_info['table_num']) . "' system='" . $t_display->get('is_system') . "'>\n";
         $vs_buf .= "\t\t<labels>\n";
         foreach ($va_display_by_locale as $vn_locale_id => $va_display_info) {
             if (strlen($this->opt_locale->localeIDToCode($vn_locale_id)) > 0) {
                 $vs_buf .= "\t\t\t<label locale='" . $this->opt_locale->localeIDToCode($vn_locale_id) . "'><name>" . caEscapeForXML($va_display_info['name']) . "</name></label>\n";
             }
         }
         $vs_buf .= "\t\t</labels>\n";
         $va_placements = $t_display->getPlacements();
         //print_R(($va_placements));
         $vs_buf .= "<bundlePlacements>\n";
         foreach ($va_placements as $vn_placement_id => $va_placement_info) {
             $vs_buf .= "\t\t<placement code='" . preg_replace("![^A-Za-z0-9_]+!", "_", $va_placement_info['bundle_name']) . "'><bundle>" . $va_placement_info['bundle_name'] . "</bundle>\n";
             $va_settings = caUnserializeForDatabase($va_placement_info['settings']);
             if (is_array($va_settings)) {
                 $vs_buf .= "<settings>\n";
                 foreach ($va_settings as $vs_setting => $vm_value) {
                     switch ($vs_setting) {
                         case 'label':
                             //restrict_to_relationship_types
                             if (is_array($vm_value)) {
                                 foreach ($vm_value as $vn_locale_id => $vm_locale_specific_value) {
                                     $vs_buf .= "<setting name='label' locale='" . $this->opt_locale->localeIDToCode($vn_locale_id) . "'>" . caEscapeForXML($vm_locale_specific_value) . "</setting>\n";
                                 }
                             }
                             break;
                         default:
                             if (is_array($vm_value)) {
                                 foreach ($vm_value as $vn_i => $vn_val) {
                                     $vs_buf .= "\t\t\t\t<setting name='{$vs_setting}'>" . caEscapeForXML($vn_val) . "</setting>\n";
                                 }
                             } else {
                                 $vs_buf .= "\t\t\t\t<setting name='{$vs_setting}'>" . caEscapeForXML($vm_value) . "</setting>\n";
                             }
                             break;
                     }
                 }
                 $vs_buf .= "</settings>\n";
             }
             $vs_buf .= "\t\t</placement>\n";
         }
         $vs_buf .= "</bundlePlacements>\n";
         $vs_buf .= "\t</display>\n";
     }
     $vs_buf .= "</displays>\n";
     //print_R($va_displays);
     return $vs_buf;
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:61,代码来源:ConfigurationExporter.php

示例15: getPlacements

 /**
  * Returns list of placements for the currently loaded display.
  *
  * @param array $pa_options Optional array of options. Supports the following options:
  * 		noCache = if set to true then the returned list if always generated directly from the database, otherwise it is returned from the cache if possible. Set this to true if you expect the cache may be stale. Default is false.
  *		returnAllAvailableIfEmpty = if set to true then the list of all available bundles will be returned if the currently loaded display has no placements, or if there is no display loaded
  *		table = if using the returnAllAvailableIfEmpty option and you expect a list of available bundles to be returned if no display is loaded, you must specify the table the bundles are intended for use with with this option. Either the table name or number may be used.
  *		user_id = if specified then placements are only returned if the user has at least read access to the display
  *		settingsOnly = if true the settings forms are omitted and only setting values are returned; default is false
  * @return array List of placements in display order. Array is keyed on bundle name. Values are arrays with the following keys:
  *		placement_id = primary key of ca_bundle_display_placements row - a unique id for the placement
  *		bundle_name = bundle name (a code - not for display)
  *		settings = array of placement settings. Keys are setting names.
  *		display = display string for bundle
  */
 public function getPlacements($pa_options = null)
 {
     $pb_no_cache = isset($pa_options['noCache']) ? (bool) $pa_options['noCache'] : false;
     $pb_settings_only = isset($pa_options['settingsOnly']) ? (bool) $pa_options['settingsOnly'] : false;
     $pb_return_all_available_if_empty = isset($pa_options['returnAllAvailableIfEmpty']) && !$pb_settings_only ? (bool) $pa_options['returnAllAvailableIfEmpty'] : false;
     $ps_table = isset($pa_options['table']) ? $pa_options['table'] : null;
     $pn_user_id = isset($pa_options['user_id']) ? $pa_options['user_id'] : null;
     if ($pn_user_id && !$this->haveAccessToDisplay($pn_user_id, __CA_BUNDLE_DISPLAY_READ_ACCESS__)) {
         return array();
     }
     if (!($vn_display_id = $this->getPrimaryKey())) {
         if ($pb_return_all_available_if_empty && $ps_table) {
             return ca_bundle_displays::$s_placement_list_cache[$vn_display_id] = $this->getAvailableBundles($ps_table);
         }
         return array();
     }
     $vs_cache_key = $vn_display_id . '/' . ($pb_settings_only ? 1 : 0);
     if (!$pb_no_cache && isset(ca_bundle_displays::$s_placement_list_cache[$vs_cache_key]) && ca_bundle_displays::$s_placement_list_cache[$vs_cache_key]) {
         return ca_bundle_displays::$s_placement_list_cache[$vs_cache_key];
     }
     $o_dm = $this->getAppDatamodel();
     $o_db = $this->getDb();
     $t_list = new ca_lists();
     if ($this->inTransaction()) {
         $t_list->setTransaction($this->getTransaction());
     }
     $qr_res = $o_db->query("\n\t\t\tSELECT placement_id, bundle_name, settings\n\t\t\tFROM ca_bundle_display_placements\n\t\t\tWHERE\n\t\t\t\tdisplay_id = ?\n\t\t\tORDER BY rank\n\t\t", (int) $vn_display_id);
     $va_available_bundles = $pb_settings_only ? array() : $this->getAvailableBundles(null, $pa_options);
     $va_placements = array();
     if ($qr_res->numRows() > 0) {
         $vs_subject_table = $o_dm->getTableName($this->get('table_num'));
         $t_subject = $o_dm->getInstanceByTableNum($this->get('table_num'), true);
         $t_placement = new ca_bundle_display_placements();
         if ($this->inTransaction()) {
             $t_placement->setTransaction($this->getTransaction());
         }
         while ($qr_res->nextRow()) {
             $vs_bundle_name = $qr_res->get('bundle_name');
             $va_bundle_name = explode(".", $vs_bundle_name);
             $va_placements[$vn_placement_id = (int) $qr_res->get('placement_id')] = $qr_res->getRow();
             $va_placements[$vn_placement_id]['settings'] = $va_settings = caUnserializeForDatabase($qr_res->get('settings'));
             if (!$pb_settings_only) {
                 $t_placement->setSettingDefinitionsForPlacement($va_available_bundles[$vs_bundle_name]['settings']);
                 $va_placements[$vn_placement_id]['display'] = $va_available_bundles[$vs_bundle_name]['display'];
                 $va_placements[$vn_placement_id]['settingsForm'] = $t_placement->getHTMLSettingForm(array('id' => $vs_bundle_name . '_' . $vn_placement_id, 'settings' => $va_settings));
             } else {
                 $va_tmp = explode('.', $vs_bundle_name);
                 $t_instance = $o_dm->getInstanceByTableName($va_tmp[0], true);
                 $va_placements[$vn_placement_id]['display'] = $t_instance ? $t_instance->getDisplayLabel($vs_bundle_name) : "???";
             }
             if ($va_bundle_name[0] == $vs_subject_table) {
                 // Only primary fields are inline-editable
                 // Check if it is one of the types of fields that is inline editable
                 if ($va_bundle_name[1] == 'preferred_labels') {
                     // Preferred labels are inline editable
                     $va_placements[$vn_placement_id]['allowInlineEditing'] = true;
                     $va_placements[$vn_placement_id]['inlineEditingType'] = DT_FIELD;
                 } elseif ($t_subject->hasField($va_bundle_name[1])) {
                     //
                     // Intrinsics are editable, except for type_id
                     //
                     if ($va_bundle_name[1] == $t_subject->getTypeFieldName()) {
                         $va_placements[$vn_placement_id]['allowInlineEditing'] = false;
                         $va_placements[$vn_placement_id]['inlineEditingType'] = null;
                     } else {
                         if (isset($va_bundle_name[1])) {
                             // check if identifier is editable
                             $id_editable = $t_subject->opo_idno_plugin_instance->isFormatEditable($vs_subject_table);
                             // Do not allow in-line editing if the intrinsic element is identifier and
                             // a). is not editable (editable = 0 in multipart_id_numbering.conf)
                             // b). consists of multiple elements
                             if ($va_bundle_name[1] == $t_subject->getProperty('ID_NUMBERING_ID_FIELD') && $id_editable == false) {
                                 $va_placements[$vn_placement_id]['allowInlineEditing'] = false;
                             } else {
                                 $va_placements[$vn_placement_id]['allowInlineEditing'] = true;
                             }
                         }
                         switch ($t_subject->getFieldInfo($va_bundle_name[1], 'DISPLAY_TYPE')) {
                             case 'DT_SELECT':
                                 if (($vs_list_code = $t_subject->getFieldInfo($va_bundle_name[1], 'LIST')) || ($vs_list_code = $t_subject->getFieldInfo($va_bundle_name[1], 'LIST_CODE'))) {
                                     $va_placements[$vn_placement_id]['inlineEditingType'] = DT_SELECT;
                                     if (!is_array($va_list_labels = $t_list->getItemsForList($vs_list_code, array('labelsOnly' => true)))) {
                                         $va_list_labels = array();
                                     }
                                     $va_placements[$vn_placement_id]['inlineEditingListValues'] = array_values($va_list_labels);
//.........这里部分代码省略.........
开发者ID:idiscussforum,项目名称:providence,代码行数:101,代码来源:ca_bundle_displays.php


注:本文中的caUnserializeForDatabase函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。