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


PHP require_library函数代码示例

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


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

示例1: get_all_taxa

 function get_all_taxa()
 {
     require_library('connectors/INBioAPI');
     $func = new INBioAPI();
     $paths = $func->extract_archive_file($this->dwca_file, "meta.xml");
     $archive_path = $paths['archive_path'];
     $temp_dir = $paths['temp_dir'];
     $harvester = new ContentArchiveReader(NULL, $archive_path);
     $tables = $harvester->tables;
     if (!($this->fields["taxa"] = $tables["http://rs.tdwg.org/dwc/terms/taxon"][0]->fields)) {
         debug("Invalid archive file. Program will terminate.");
         return false;
     }
     self::build_taxa_rank_array($harvester->process_row_type('http://rs.tdwg.org/dwc/terms/Taxon'));
     self::create_instances_from_taxon_object($harvester->process_row_type('http://rs.tdwg.org/dwc/terms/Taxon'));
     self::get_objects($harvester->process_row_type('http://eol.org/schema/media/Document'));
     self::get_references($harvester->process_row_type('http://rs.gbif.org/terms/1.0/Reference'));
     self::get_agents($harvester->process_row_type('http://eol.org/schema/agent/Agent'));
     self::get_vernaculars($harvester->process_row_type('http://rs.gbif.org/terms/1.0/VernacularName'));
     $this->archive_builder->finalize(TRUE);
     // remove temp dir
     recursive_rmdir($temp_dir);
     echo "\n temporary directory removed: " . $temp_dir;
     print_r($this->debug);
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:25,代码来源:WormsArchiveAPI.php

示例2: export_gbif_to_eol

 function export_gbif_to_eol($params)
 {
     require_library('connectors/INBioAPI');
     $func = new INBioAPI();
     $paths = $func->extract_archive_file($params["dwca_file"], "meta.xml");
     $archive_path = $paths['archive_path'];
     $temp_dir = $paths['temp_dir'];
     $harvester = new ContentArchiveReader(NULL, $archive_path);
     $tables = $harvester->tables;
     if (!($this->fields["occurrence"] = $tables["http://rs.tdwg.org/dwc/terms/occurrence"][0]->fields)) {
         debug("Invalid archive file. Program will terminate.");
         return false;
     }
     /*
         $harvester->process_row_type() -  this will convert rows into array.
     */
     // $r = $harvester->process_row_type('http://rs.tdwg.org/dwc/terms/occurrence');
     // $r = $harvester->process_row_type('http://rs.gbif.org/terms/1.0/Multimedia');
     // print_r($r); exit;
     self::create_instances_from_taxon_object($harvester->process_row_type('http://rs.tdwg.org/dwc/terms/occurrence'));
     self::get_media_objects($harvester->process_row_type('http://rs.gbif.org/terms/1.0/Multimedia'));
     // self::get_objects($harvester->process_row_type('http://eol.org/schema/media/Document'));
     // self::get_references($harvester->process_row_type('http://rs.gbif.org/terms/1.0/Reference'));
     // self::get_agents($harvester->process_row_type('http://eol.org/schema/agent/Agent'));
     // self::get_vernaculars($harvester->process_row_type('http://rs.gbif.org/terms/1.0/VernacularName'));
     $this->archive_builder->finalize(TRUE);
     // remove temp dir
     recursive_rmdir($temp_dir);
     echo "\n temporary directory removed: " . $temp_dir;
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:30,代码来源:GBIFdwcaAPI.php

示例3: generate_EnvEOL_data

 function generate_EnvEOL_data()
 {
     require_library('connectors/IUCNRedlistDataConnector');
     $func = new IUCNRedlistDataConnector();
     $basenames = array("eol_env_annotations_noParentTerms");
     // list of needed basenames
     $options = $this->download_options;
     $options['expire_seconds'] = 2592000 * 3;
     // 3 months before cache expires
     $text_path = $func->load_zip_contents($this->species_list_export, $options, $basenames, ".tsv");
     print_r($text_path);
     self::csv_to_array($text_path[$basenames[0]]);
     $this->archive_builder->finalize(TRUE);
     // remove temp dir
     $parts = pathinfo($text_path[$basenames[0]]);
     recursive_rmdir($parts["dirname"]);
     debug("\n temporary directory removed: " . $parts["dirname"]);
     recursive_rmdir($this->TEMP_DIR);
     // comment this if u want to check "need_to_check_tc_id.txt"
     /* run problematic tc_ids with cache=0 --- a utility
        $tc_ids = self::get_dump();
        foreach($tc_ids as $tc_id)
        {
            $rec['taxon_id'] = $tc_id;
            self::prepare_taxon($rec);
        }
        exit("\n-exit-\n");
        */
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:29,代码来源:EnvironmentsEOLDataConnector.php

示例4: get_uris

 private function get_uris($params)
 {
     $fields = array();
     if (in_array($params["dataset"], array("NMNH", "NHM"))) {
         $fields["institutionCode"] = "institutionCode_uri";
         $fields["sex"] = "sex_uri";
         $fields["typeStatus"] = "typeStatus_uri";
         $fields["lifeStage"] = "lifeStage_uri";
         $fields["collectionCode"] = "collectionCode_uri";
     }
     require_library('connectors/LifeDeskToScratchpadAPI');
     $func = new LifeDeskToScratchpadAPI();
     $spreadsheet_options = array("cache" => 1, "timeout" => 3600, "file_extension" => "xlsx", 'download_attempts' => 2, 'delay_in_minutes' => 2);
     $spreadsheet_options["expire_seconds"] = 0;
     // false => won't expire; 0 => expires now
     $uris = array();
     if ($spreadsheet = @$params["uri_file"]) {
         if ($arr = $func->convert_spreadsheet($spreadsheet, 0, $spreadsheet_options)) {
             foreach ($fields as $key => $value) {
                 $i = 0;
                 foreach ($arr[$key] as $item) {
                     $item = trim($item);
                     if ($item) {
                         $uris[$item] = $arr[$value][$i];
                     }
                     $i++;
                 }
             }
         }
     }
     return $uris;
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:32,代码来源:NMNHTypeRecordAPI.php

示例5: update_eol_xml

 private function update_eol_xml($lifedesk_name)
 {
     /*
     taxon = 434
     dwc:ScientificName = 434
     reference = 614
     synonym = 68
     commonName = 2
     dataObjects = 1705
     reference = 0
     texts = 1146
     images = 559
     videos = 0
     sounds = 0
     */
     require_library('ResourceDataObjectElementsSetting');
     $resource_path = CONTENT_RESOURCE_LOCAL_PATH . $lifedesk_name . ".xml";
     $func = new ResourceDataObjectElementsSetting($lifedesk_name, $resource_path);
     $xml = file_get_contents($this->text_path["eol_xml"]);
     $xml = $func->replace_taxon_element_value("dc:source", "replace any existing value", "", $xml, false);
     $xml = $func->replace_data_object_element_value("dc:source", "replace any existing value", "", $xml, false);
     $xml = self::remove_tags_in_references($xml);
     $func->save_resource_document($xml);
     // zip the xml
     $command_line = "gzip -c " . CONTENT_RESOURCE_LOCAL_PATH . $lifedesk_name . ".xml >" . CONTENT_RESOURCE_LOCAL_PATH . $lifedesk_name . ".xml.gz";
     $output = shell_exec($command_line);
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:27,代码来源:LifeDeskToEOLAPI.php

示例6: remove_dataObject

function remove_dataObject()
{
    require_library('ResourceDataObjectElementsSetting');
    $resource_id = 346;
    $resource_path = "http://localhost/eol_php_code/applications/content_server/resources/346.xml.gz";
    $nmnh = new ResourceDataObjectElementsSetting($resource_id, $resource_path);
    $xml = $nmnh->load_xml_string();
    $xml = $nmnh->remove_data_object_of_certain_element_value("mimeType", "image/x-adobe-dng", $xml);
    $nmnh->save_resource_document($xml);
}
开发者ID:eliagbayani,项目名称:maps_test,代码行数:10,代码来源:remove_dataObject.php

示例7: convert_to_dwca

 function convert_to_dwca($params)
 {
     require_library('FlickrAPI');
     $auth_token = NULL;
     // if(FlickrAPI::valid_auth_token(FLICKR_AUTH_TOKEN)) $auth_token = FLICKR_AUTH_TOKEN;
     $page = 1;
     $per_page = 500;
     $url = $this->service['photosets'] . '&photoset_id=' . $params['photoset_id'] . '&user_id=' . $params['flickr_user_id'] . '&per_page=' . $per_page;
     if ($json = Functions::lookup_with_cache($url . '&page=' . $page, $this->download_options)) {
         $json = str_replace("\\'", "'", $json);
         $obj = json_decode($json);
         $total_pages = ceil($obj->photoset->total / $per_page);
         echo "\ntotal_pages = {$total_pages}\n";
         for ($i = 1; $i <= $total_pages; $i++) {
             if ($json = Functions::lookup_with_cache($url . '&page=' . $page, $this->download_options)) {
                 $json = str_replace("\\'", "'", $json);
                 $obj = json_decode($json);
                 $k = 0;
                 $total_photos = count($obj->photoset->photo);
                 foreach ($obj->photoset->photo as $rec) {
                     $k++;
                     echo "\n{$i} of {$total_pages} - {$k} of {$total_photos}";
                     if (!($sciname = self::get_sciname_from_title($rec->title))) {
                         continue;
                     }
                     // if($sciname == "SONY DSC") //debug
                     // {
                     //     print_r($rec);
                     // }
                     $photo_response = FlickrAPI::photos_get_info($rec->id, $rec->secret, $auth_token, $this->download_options);
                     $photo = @$photo_response->photo;
                     if (!$photo) {
                         continue;
                     }
                     if ($photo->visibility->ispublic != 1) {
                         continue;
                     }
                     if ($photo->usage->candownload != 1) {
                         continue;
                     }
                     if (@(!$GLOBALS["flickr_licenses"][$photo->license])) {
                         continue;
                     }
                     $data_objects = FlickrAPI::get_data_objects($photo, $params['flickr_user_id']);
                     foreach ($data_objects as $do) {
                         self::create_archive($sciname, $do);
                     }
                 }
             }
             $page++;
             // break; //debug
         }
     }
     $this->archive_builder->finalize(TRUE);
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:55,代码来源:FlickrUserAlbumAPI.php

示例8: top_images

 public static function top_images()
 {
     require_library('TopImages');
     $log = HarvestProcessLog::create(array('process_name' => 'Top Images'));
     $top_images = new TopImages();
     $top_images->begin_process();
     $top_images->top_concept_images(true);
     $top_images->top_concept_images(false);
     \Resque::enqueue('harvesting', 'CodeBridge', array('cmd' => 'denormalize_tables'));
     $log->finished();
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:11,代码来源:TopImagesHandler.php

示例9: __construct

 public function __construct()
 {
     $this->mysqli =& $GLOBALS['db_connection'];
     if ($GLOBALS['ENV_NAME'] == 'production' && environment_defined('slave')) {
         $this->mysqli_slave = load_mysql_environment('slave');
     } else {
         $this->mysqli_slave =& $this->mysqli;
     }
     require_library('RubyNameParserClient');
     $this->name_parser = new RubyNameParserClient();
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:11,代码来源:NamesCheck.php

示例10: start

 private function start($spreadsheet, $temp_path = false)
 {
     require_library('XLSParser');
     $parser = new XLSParser();
     $doc = self::download_file_accordingly($spreadsheet);
     $download_options = $this->download_options;
     $download_options['file_extension'] = self::get_extension($doc);
     if ($path = Functions::save_remote_file_to_local($doc, $download_options)) {
         $worksheets = self::get_worksheets($path, $parser, $temp_path);
         print_r($worksheets);
         foreach ($worksheets as $index => $worksheet_title) {
             echo "\nProcessing worksheet: [{$worksheet_title}]";
             if ($temp_path) {
                 $params = array("worksheet_title" => $worksheet_title, "path" => $temp_path);
                 $parser->convert_sheet_to_array($path, $index, NULL, $params);
             } else {
                 $arr = $parser->convert_sheet_to_array($path, $index);
                 if (!self::sheet_is_valid($arr, $worksheet_title)) {
                     echo " - invalid worksheet\n";
                     continue;
                 }
                 $fields = array();
                 $uris = array();
                 $fields = array_keys($arr);
                 foreach ($fields as $field) {
                     $uris[] = $arr[$field][0];
                 }
                 // print_r($fields); print_r($uris); continue;
                 $i = -1;
                 foreach ($arr[$fields[0]] as $row) {
                     $i++;
                     if ($i > 7) {
                         $rec = array();
                         foreach ($fields as $field) {
                             $rec[$field] = $arr[$field][$i];
                         }
                         if ($rec) {
                             self::create_archive($worksheet_title, $fields, $uris, $rec);
                         }
                     }
                 }
             }
         }
         unlink($path);
         if (file_exists($doc)) {
             unlink($doc);
         }
     } else {
         echo "\n [{$doc}] unavailable! \n";
     }
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:51,代码来源:EOLSpreadsheetToArchiveAPI.php

示例11: get_institution_uris

 private function get_institution_uris()
 {
     require_library('connectors/LifeDeskToScratchpadAPI');
     $func = new LifeDeskToScratchpadAPI();
     $arr = $func->convert_spreadsheet($this->institutions_xls, 0);
     $institutions = array();
     $k = 0;
     foreach ($arr["Code"] as $code) {
         $institutions[$code] = $arr["URI"][$k];
         $k++;
     }
     echo "\nInstitutions from spreadsheet [{$this->institutions_xls}]:" . count($institutions) . "\n";
     return $institutions;
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:14,代码来源:RotifersTypeSpecimenAPI.php

示例12: parse_xls

 private function parse_xls()
 {
     if ($this->data_dump_url = Functions::save_remote_file_to_local($this->data_dump_url, array('download_wait_time' => 1000000, 'timeout' => 600, 'download_attempts' => 5, 'file_extension' => 'xls'))) {
         require_library('XLSParser');
         $parser = new XLSParser();
         debug("\n reading: " . $this->data_dump_url . "\n");
         $temp = $parser->convert_sheet_to_array($this->data_dump_url);
         $records = $parser->prepare_data($temp, "single", "SCIENTIFIC NAME", "SCIENTIFIC NAME", "CATEGORY", "ENGLISH NAME", "RANGE", "ORDER", "FAMILY", "EXTINCT", "EXTINCT_YEAR");
         $records = self::fill_in_missing_names($records);
         $records = self::fill_in_parent_id($records);
         debug("\n" . count($records));
         return $records;
     }
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:14,代码来源:ClementsAPI.php

示例13: process_xml

 function process_xml($params)
 {
     $all_taxa = self::get_taxa_list_from_biogeodb();
     $this->taxa_id_list = array_merge($all_taxa, self::get_taxa_list_from_myspecies());
     require_library('connectors/INBioAPI');
     $func = new INBioAPI();
     $paths = $func->extract_archive_file($params["eol_xml_file"], $params["filename"], array("timeout" => 7200, "expire_seconds" => false));
     print_r($paths);
     $params["path"] = $paths["temp_dir"];
     $xml = self::update_xml($params);
     recursive_rmdir($paths["temp_dir"]);
     // remove temp dir
     return $xml;
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:14,代码来源:STRIorigAPI.php

示例14: parse_xls

 private function parse_xls()
 {
     if ($this->data_dump_url = Functions::save_remote_file_to_local($this->data_dump_url, array('cache' => 1, 'download_wait_time' => 1000000, 'timeout' => 600, 'download_attempts' => 5, 'file_extension' => 'xlsx'))) {
         require_library('XLSParser');
         $parser = new XLSParser();
         debug("\n reading: " . $this->data_dump_url . "\n");
         $temp = $parser->convert_sheet_to_array($this->data_dump_url, 0);
         $records = $parser->prepare_data($temp, "single", "Scientific name", "Scientific name", "Category", "English name", "Range", "Order", "Family", "Extinct", "Extinction Year");
         $records = self::add_uppercase_fields($records);
         $records = self::fill_in_missing_names($records);
         $records = self::fill_in_parent_id($records);
         debug("\n" . count($records));
         return $records;
     }
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:15,代码来源:ClementsAPIv2.php

示例15: model_boostrap

 function model_boostrap()
 {
     require_library("/vendor/doctrine/Doctrine.php");
     spl_autoload_register(array('doctrine', 'autoload'));
     $conn = Doctrine_Manager::connection(dsn);
     $conn->setCollate('utf8_general_ci');
     $conn->setCharset('utf8');
     $conn->setAttribute(Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE, true);
     $conn->setAttribute(Doctrine::ATTR_AUTOLOAD_TABLE_CLASSES, true);
     $servers = array('host' => 'localhost', 'port' => 11211, 'persistent' => true);
     $cacheDriver = new Doctrine_Cache_Memcache(array('servers' => $servers, 'compression' => false));
     $conn->setAttribute(Doctrine::ATTR_QUERY_CACHE, $cacheDriver);
     Doctrine::loadModels(library_root . '/models/dal');
     Doctrine::loadModels(library_root . '/models');
 }
开发者ID:hasanozgan,项目名称:kissabe,代码行数:15,代码来源:base.php


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