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


PHP isURL函数代码示例

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


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

示例1: rdf

 /**
  * Return an RDF object based an a $row
  */
 public function rdf($row, $prefix = '')
 {
     $row->type = isset($row->type) ? $row->type : 'version';
     if (isset($row->url)) {
         if (!is_array($row->url)) {
             $row->url = array($row->url);
         }
         foreach ($row->url as $key => $value) {
             if (!isURL($value)) {
                 $row->url[$key] = abs_url($value, $prefix);
             }
         }
     }
     $rdf = parent::rdf($row, $prefix);
     // Blend with RDF from the semantic store
     if (!empty($row->rdf)) {
         foreach ($row->rdf as $p => $values) {
             if (array_key_exists($p, $rdf)) {
                 // TODO: Not sure we should allow a collision between the semantic and relational tables? For now, don't.
             } else {
                 $rdf[$p] = $values;
             }
         }
     }
     return $rdf;
 }
开发者ID:austinvernsonger,项目名称:scalar,代码行数:29,代码来源:version_model.php

示例2: rdf_value

 private function rdf_value($value = array())
 {
     $return = array();
     foreach ($value as $val) {
         if (empty($val)) {
             continue;
         }
         $return[] = array('value' => $val, 'type' => isURL($val) ? 'uri' : 'literal');
     }
     return $return;
 }
开发者ID:plusperturbatio,项目名称:scalar,代码行数:11,代码来源:Image_Metadata.php

示例3: print_rdf

function print_rdf($rdf, $tabs = 0, $ns = array(), $hide = array(), $aria = false)
{
    $hide = array_merge($hide, array('rdf:type', 'dcterms:title', 'sioc:content'));
    foreach ($rdf as $p => $values) {
        if (in_array($p, $hide)) {
            continue;
        }
        foreach ($values as $value) {
            if (isURL($value['value'])) {
                $str = '<a class="metadata" aria-hidden="' . ($aria ? 'false' : 'true') . '" rel="' . toNS($p, $ns) . '" href="' . $value['value'] . '"></a>' . "\n";
            } else {
                $str = '<span class="metadata" aria-hidden="' . ($aria ? 'false' : 'true') . '" property="' . toNS($p, $ns) . '">' . $value['value'] . '</span>' . "\n";
            }
            for ($j = 0; $j < $tabs; $j++) {
                $str = "\t" . $str;
            }
            echo $str;
        }
    }
}
开发者ID:austinvernsonger,项目名称:scalar,代码行数:20,代码来源:wrapper.php

示例4: lookup

 /** 
  * Perform lookup on Wikipedia-based data service
  *
  * @param array $pa_settings Plugin settings values
  * @param string $ps_search The expression with which to query the remote data service
  * @param array $pa_options Lookup options (none defined yet)
  * @return array
  */
 public function lookup($pa_settings, $ps_search, $pa_options = null)
 {
     // support passing full wikipedia URLs
     if (isURL($ps_search)) {
         $ps_search = self::getPageTitleFromURI($ps_search);
     }
     $vs_lang = caGetOption('lang', $pa_settings, 'en');
     // readable version of get parameters
     $va_get_params = array('action' => 'query', 'generator' => 'search', 'gsrsearch' => urlencode($ps_search), 'gsrlimit' => 50, 'gsrwhat' => 'nearmatch', 'prop' => 'info', 'inprop' => 'url', 'format' => 'json');
     $vs_content = caQueryExternalWebservice($vs_url = 'https://' . $vs_lang . '.wikipedia.org/w/api.php?' . caConcatGetParams($va_get_params));
     $va_content = @json_decode($vs_content, true);
     if (!is_array($va_content) || !isset($va_content['query']['pages']) || !is_array($va_content['query']['pages']) || !sizeof($va_content['query']['pages'])) {
         return array();
     }
     // the top two levels are 'query' and 'pages'
     $va_results = $va_content['query']['pages'];
     $va_return = array();
     foreach ($va_results as $va_result) {
         $va_return['results'][] = array('label' => $va_result['title'] . ' [' . $va_result['fullurl'] . ']', 'url' => $va_result['fullurl'], 'idno' => $va_result['pageid']);
     }
     return $va_return;
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:30,代码来源:Wikipedia.php

示例5: caQueryExternalWebservice

/**
 * Query external web service and return whatever body it returns as string
 * @param string $ps_url URL of the web service to query
 * @return string
 * @throws \Exception
 */
function caQueryExternalWebservice($ps_url)
{
    if (!isURL($ps_url)) {
        return false;
    }
    $o_conf = Configuration::load();
    $vo_curl = curl_init();
    curl_setopt($vo_curl, CURLOPT_URL, $ps_url);
    if ($vs_proxy = $o_conf->get('web_services_proxy_url')) {
        /* proxy server is configured */
        curl_setopt($vo_curl, CURLOPT_PROXY, $vs_proxy);
    }
    curl_setopt($vo_curl, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($vo_curl, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($vo_curl, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($vo_curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($vo_curl, CURLOPT_AUTOREFERER, true);
    curl_setopt($vo_curl, CURLOPT_CONNECTTIMEOUT, 120);
    curl_setopt($vo_curl, CURLOPT_TIMEOUT, 120);
    curl_setopt($vo_curl, CURLOPT_MAXREDIRS, 10);
    curl_setopt($vo_curl, CURLOPT_USERAGENT, 'CollectiveAccess web service lookup');
    $vs_content = curl_exec($vo_curl);
    if (curl_getinfo($vo_curl, CURLINFO_HTTP_CODE) !== 200) {
        throw new \Exception(_t('An error occurred while querying an external webservice'));
    }
    curl_close($vo_curl);
    return $vs_content;
}
开发者ID:samrahman,项目名称:providence,代码行数:34,代码来源:utilityHelpers.php

示例6: caQueryExternalWebservice

/**
 * Query external web service and return whatever body it returns as string
 * @param string $ps_url URL of the web service to query
 * @return string
 */
function caQueryExternalWebservice($ps_url)
{
    if (!isURL($ps_url)) {
        return false;
    }
    $o_conf = Configuration::load();
    if ($vs_proxy = $o_conf->get('web_services_proxy_url')) {
        /* proxy server is configured */
        $vs_proxy_auth = null;
        if (($vs_proxy_user = $o_conf->get('web_services_proxy_auth_user')) && ($vs_proxy_pass = $o_conf->get('web_services_proxy_auth_pw'))) {
            $vs_proxy_auth = base64_encode("{$vs_proxy_user}:{$vs_proxy_pass}");
        }
        // non-authed proxy requests go through curl to properly support https queries
        // everything else is still handled via file_get_contents and stream contexts
        if (is_null($vs_proxy_auth) && function_exists('curl_exec')) {
            $vo_curl = curl_init();
            curl_setopt($vo_curl, CURLOPT_URL, $ps_url);
            curl_setopt($vo_curl, CURLOPT_PROXY, $vs_proxy);
            curl_setopt($vo_curl, CURLOPT_SSL_VERIFYHOST, 0);
            curl_setopt($vo_curl, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($vo_curl, CURLOPT_FOLLOWLOCATION, true);
            curl_setopt($vo_curl, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($vo_curl, CURLOPT_AUTOREFERER, true);
            curl_setopt($vo_curl, CURLOPT_CONNECTTIMEOUT, 120);
            curl_setopt($vo_curl, CURLOPT_TIMEOUT, 120);
            curl_setopt($vo_curl, CURLOPT_MAXREDIRS, 10);
            curl_setopt($vo_curl, CURLOPT_USERAGENT, 'CollectiveAccess web service lookup');
            $vs_content = curl_exec($vo_curl);
            curl_close($vo_curl);
            return $vs_content;
        } else {
            $va_context_options = array('http' => array('proxy' => $vs_proxy, 'request_fulluri' => true, 'header' => 'User-agent: CollectiveAccess web service lookup'));
            if ($vs_proxy_auth) {
                $va_context_options['http']['header'] = "Proxy-Authorization: Basic {$vs_proxy_auth}";
            }
            $vo_context = stream_context_create($va_context_options);
            return @file_get_contents($ps_url, false, $vo_context);
        }
    } else {
        return @file_get_contents($ps_url);
    }
}
开发者ID:kai-iak,项目名称:pawtucket2,代码行数:47,代码来源:utilityHelpers.php

示例7:

 if ($requestedWatch !== $currentlyWatching) {
     if ($requestedWatch) {
         $tikilib->add_user_watch($user, 'wiki_page_changed', $page, 'wiki page', $page, $wikilib->sefurl($page));
     } else {
         $tikilib->remove_user_watch($user, 'wiki_page_changed', $page, 'wiki page');
     }
 }
 if (!empty($prefs['geo_locate_wiki']) && $prefs['geo_locate_wiki'] == 'y' && !empty($_REQUEST['geolocation'])) {
     TikiLib::lib('geo')->set_coordinates('wiki page', $page, $_REQUEST['geolocation']);
 }
 if ($prefs['namespace_enabled'] == 'y' && isset($_REQUEST['explicit_namespace'])) {
     $wikilib->set_explicit_namespace($page, $_REQUEST['explicit_namespace']);
 }
 if (!empty($_REQUEST['returnto'])) {
     // came from wikiplugin_include.php edit button
     if (isURL($_REQUEST['returnto'])) {
         $url = $_REQUEST['returnto'];
     } else {
         $url = $wikilib->sefurl($_REQUEST['returnto']);
     }
 } else {
     if ($page_ref_id) {
         $url = "tiki-index.php?page_ref_id={$page_ref_id}";
     } else {
         $url = $wikilib->sefurl($page);
     }
 }
 if ($prefs['feature_multilingual'] === 'y' && $prefs['feature_best_language'] === 'y' && isset($info['lang']) && $info['lang'] !== $prefs['language']) {
     $url .= (strpos($url, '?') === false ? '?' : '&') . 'no_bl=y';
 }
 if ($prefs['flaggedrev_approval'] == 'y' && $tiki_p_wiki_approve == 'y') {
开发者ID:hurcane,项目名称:tiki-azure,代码行数:31,代码来源:tiki-editpage.php

示例8: getObjectRepresentationID


//.........这里部分代码省略.........
                                         break 5;
                                     }
                                 }
                             }
                         }
                     }
                 } else {
                     foreach ($va_idnos_to_match as $vs_idno_match) {
                         if (!$vs_idno_match) {
                             continue;
                         }
                         if ($vn_id = ca_object_representations::find(array('idno' => $vs_idno_match), array('returnAs' => 'firstId', 'transaction' => $pa_options['transaction']))) {
                             break 3;
                         }
                     }
                 }
                 break;
         }
     }
     if (!$vn_id) {
         if (isset($pa_options['dontCreate']) && $pa_options['dontCreate']) {
             return false;
         }
         if ($o_event) {
             $o_event->beginItem($vs_event_source, 'ca_object_representations', 'I');
         }
         $t_rep->setMode(ACCESS_WRITE);
         $t_rep->set('locale_id', $pn_locale_id);
         $t_rep->set('type_id', $pn_type_id);
         $t_rep->set('source_id', isset($pa_values['source_id']) ? $pa_values['source_id'] : null);
         $t_rep->set('access', isset($pa_values['access']) ? $pa_values['access'] : 0);
         $t_rep->set('status', isset($pa_values['status']) ? $pa_values['status'] : 0);
         if (isset($pa_values['media']) && $pa_values['media']) {
             if ($vb_match_media_without_extension && !isURL($pa_values['media']) && !file_exists($pa_values['media'])) {
                 $vs_dirname = pathinfo($pa_values['media'], PATHINFO_DIRNAME);
                 $vs_filename = preg_replace('!\\.[A-Za-z0-9]{1,4}$!', '', pathinfo($pa_values['media'], PATHINFO_BASENAME));
                 $vs_original_path = $pa_values['media'];
                 $pa_values['media'] = null;
                 $va_files_in_dir = caGetDirectoryContentsAsList($vs_dirname, true, false, false, false);
                 foreach ($va_files_in_dir as $vs_filepath) {
                     if ($o_log) {
                         $o_log->logDebug(_t("Trying media %1 in place of %2/%3", $vs_filepath, $vs_original_path, $vs_filename));
                     }
                     if (pathinfo($vs_filepath, PATHINFO_FILENAME) == $vs_filename) {
                         if ($o_log) {
                             $o_log->logNotice(_t("Found media %1 for %2/%3", $vs_filepath, $vs_original_path, $vs_filename));
                         }
                         $pa_values['media'] = $vs_filepath;
                         break;
                     }
                 }
             }
             $t_rep->set('media', $pa_values['media']);
         }
         $t_rep->set('idno', $vs_idno);
         $t_rep->insert();
         if ($t_rep->numErrors()) {
             if (isset($pa_options['outputErrors']) && $pa_options['outputErrors']) {
                 print "[Error] " . _t("Could not insert object %1: %2", $ps_representation_name, join('; ', $t_rep->getErrors())) . "\n";
             }
             if ($o_log) {
                 $o_log->logError(_t("Could not insert object %1: %2", $ps_representation_name, join('; ', $t_rep->getErrors())));
             }
             return null;
         }
         $vb_label_errors = false;
开发者ID:kai-iak,项目名称:pawtucket2,代码行数:67,代码来源:DataMigrationUtils.php

示例9: parseValue

 /**
  *
  *
  */
 public function parseValue($ps_value, $pa_element_info, $pa_options = null)
 {
     $ps_value = trim(preg_replace("![\t\n\r]+!", ' ', $ps_value));
     $vs_service = caGetOption('service', $this->getSettingValuesFromElementArray($pa_element_info, array('service')));
     //if (!trim($ps_value)) {
     //$this->postError(1970, _t('Entry was blank.'), 'InformationServiceAttributeValue->parseValue()');
     //	return false;
     //}
     if (trim($ps_value)) {
         $va_tmp = explode('|', $ps_value);
         $va_info = array();
         if (sizeof($va_tmp) == 3) {
             /// value is already in desired format (from autocomplete lookup)
             // get extra indexing info for this uri from plugin implementation
             $this->opo_plugin = InformationServiceManager::getInformationServiceInstance($vs_service);
             $vs_display_text = $this->opo_plugin->getDisplayValueFromLookupText($va_tmp[0]);
             $va_info['indexing_info'] = $this->opo_plugin->getDataForSearchIndexing($pa_element_info['settings'], $va_tmp[2]);
             $va_info['extra_info'] = $this->opo_plugin->getExtraInfo($pa_element_info['settings'], $va_tmp[2]);
             return array('value_longtext1' => $vs_display_text, 'value_longtext2' => $va_tmp[2], 'value_decimal1' => $va_tmp[1], 'value_blob' => caSerializeForDatabase($va_info));
         } elseif (sizeof($va_tmp) == 1 && (isURL($va_tmp[0], array('strict' => true)) || is_numeric($va_tmp[0]))) {
             // URI or ID -> try to look it up. we match hit when exactly 1 hit comes back
             // try lookup cache
             if (CompositeCache::contains($va_tmp[0], "InformationServiceLookup{$vs_service}")) {
                 return CompositeCache::fetch($va_tmp[0], "InformationServiceLookup{$vs_service}");
             }
             // try lookup
             $this->opo_plugin = InformationServiceManager::getInformationServiceInstance($vs_service);
             $va_ret = $this->opo_plugin->lookup($pa_element_info['settings'], $va_tmp[0]);
             // only match exact results. at some point we might want to try to get fancy
             // and pick one (or rather, have the plugin pick one) if there's more than one
             if (is_array($va_ret['results']) && sizeof($va_ret['results']) == 1) {
                 $va_hit = array_shift($va_ret['results']);
                 $va_info['indexing_info'] = $this->opo_plugin->getDataForSearchIndexing($pa_element_info['settings'], $va_hit['url']);
                 $va_info['extra_info'] = $this->opo_plugin->getExtraInfo($pa_element_info['settings'], $va_hit['url']);
                 $vs_display_text = $this->opo_plugin->getDisplayValueFromLookupText($va_hit['label']);
                 $va_return = array('value_longtext1' => $vs_display_text, 'value_longtext2' => $va_hit['url'], 'value_decimal1' => $va_hit['id'], 'value_blob' => caSerializeForDatabase($va_info));
             } else {
                 $this->postError(1970, _t('Value for InformationService lookup has to be an ID or URL that returns exactly 1 hit. We got more or no hits. Value was %1', $ps_value), 'ListAttributeValue->parseValue()');
                 return false;
             }
             CompositeCache::save($va_tmp[0], $va_return, "InformationServiceLookup{$vs_service}");
             return $va_return;
         } else {
             // don't save if value hasn't changed
             return array('_dont_save' => true);
         }
     }
     return array('value_longtext1' => '', 'value_longtext2' => '', 'value_decimal1' => null, 'value_blob' => null);
 }
开发者ID:samrahman,项目名称:providence,代码行数:53,代码来源:InformationServiceAttributeValue.php

示例10: dashboard

 public function dashboard()
 {
     $this->load->model('book_model', 'books');
     $book_id = isset($_REQUEST['book_id']) && !empty($_REQUEST['book_id']) ? $_REQUEST['book_id'] : 0;
     $user_id = isset($_REQUEST['user_id']) && !empty($_REQUEST['user_id']) ? $_REQUEST['user_id'] : 0;
     $action = isset($_REQUEST['action']) && !empty($_REQUEST['action']) ? $_REQUEST['action'] : null;
     // There is more specific validation in each call below, but here run a general check on calls on books and users
     if (!$this->data['login']->is_logged_in) {
         $this->require_login(4);
     }
     if (!empty($book_id)) {
         $this->data['book'] = $this->books->get($book_id);
         $this->set_user_book_perms();
         $this->protect_book();
     }
     if (!$this->data['login_is_super'] && !empty($user_id)) {
         if ($this->data['login']->user_id != $user_id) {
             $this->kickout();
         }
     }
     $this->load->model('page_model', 'pages');
     $this->load->model('version_model', 'versions');
     $this->load->model('path_model', 'paths');
     $this->load->model('tag_model', 'tags');
     $this->load->model('annotation_model', 'annotations');
     $this->load->model('reply_model', 'replies');
     $this->data['zone'] = isset($_REQUEST['zone']) && !empty($_REQUEST['zone']) ? $_REQUEST['zone'] : 'user';
     $this->data['type'] = isset($_GET['type']) && !empty($_GET['type']) ? $_GET['type'] : null;
     $this->data['sq'] = isset($_GET['sq']) && !empty($_GET['sq']) ? trim($_GET['sq']) : null;
     $this->data['book_id'] = isset($_GET['book_id']) && !empty($_GET['book_id']) ? trim($_GET['book_id']) : 0;
     $this->data['delete'] = isset($_GET['delete']) && !empty($_GET['delete']) ? trim($_GET['delete']) : null;
     $this->data['saved'] = isset($_GET['action']) && 'saved' == $_GET['action'] ? true : false;
     $this->data['deleted'] = isset($_GET['action']) && 'deleted' == $_GET['action'] ? true : false;
     $this->data['duplicated'] = isset($_GET['action']) && 'duplicated' == $_GET['action'] ? true : false;
     // Actions
     try {
         switch ($action) {
             case 'do_save_style':
                 // Book Properties (method requires book_id)
                 $array = $_POST;
                 unset($array['action']);
                 unset($array['zone']);
                 $this->books->save($array);
                 $this->books->save_versions($array);
                 header('Location: ' . $this->base_url . '?book_id=' . $book_id . '&zone=' . $this->data['zone'] . '&action=book_style_saved');
                 exit;
             case 'do_save_user':
                 // My Account (method requires user_id & book_id)
                 $array = $_POST;
                 if ($this->users->email_exists_for_different_user($array['email'], $this->data['login']->user_id)) {
                     header('Location: ' . $this->base_url . '?book_id=' . $book_id . '&zone=' . $this->data['zone'] . '&error=email_exists');
                     exit;
                 }
                 if (empty($array['fullname'])) {
                     header('Location: ' . $this->base_url . '?book_id=' . $book_id . '&zone=' . $this->data['zone'] . '&error=fullname_required');
                     exit;
                 }
                 if (!empty($array['url'])) {
                     if (!isURL($array['url'])) {
                         $array['url'] = 'http://' . $array['url'];
                     }
                 }
                 if (!empty($array['password'])) {
                     if (!$this->users->get_by_email_and_password($array['email'], $array['old_password'])) {
                         header('Location: ' . $this->base_url . '?book_id=' . $book_id . '&zone=' . $this->data['zone'] . '&error=incorrect_password');
                         exit;
                     }
                     if ($array['password'] != $array['password_2']) {
                         header('Location: ' . $this->base_url . '?book_id=' . $book_id . '&zone=' . $this->data['zone'] . '&error=password_match');
                         exit;
                     }
                     $this->users->set_password($this->data['login']->user_id, $array['password']);
                 }
                 // Save profile
                 unset($array['password']);
                 unset($array['old_password']);
                 unset($array['password_2']);
                 $this->users->save($array);
                 $this->set_login_params();
                 header('Location: ' . $this->base_url . '?book_id=' . $book_id . '&zone=' . $this->data['zone'] . '&action=user_saved');
                 exit;
             case 'do_save_sharing':
                 $this->books->save(array('title' => $_POST['title'], 'book_id' => (int) $_POST['book_id']));
                 $array = $_POST;
                 unset($array['action']);
                 unset($array['zone']);
                 $this->books->save($array);
                 header('Location: ' . $this->base_url . '?book_id=' . $book_id . '&zone=' . $this->data['zone'] . '&action=book_sharing_saved#tabs-' . $this->data['zone']);
                 exit;
             case 'do_duplicate_book':
                 // My Account  TODO
                 $user_id = @(int) $_POST['user_id'];
                 $array = $_POST;
                 if (empty($user_id) && !$this->data['login_is_super']) {
                     $this->kickout();
                 }
                 $book_id = (int) $this->books->duplicate($array);
                 // Option to redirect to page of choice
                 if (isset($array['redirect']) && filter_var($array['redirect'], FILTER_VALIDATE_URL)) {
                     $url_has_query = parse_url($array['redirect'], PHP_URL_QUERY);
//.........这里部分代码省略.........
开发者ID:austinvernsonger,项目名称:scalar,代码行数:101,代码来源:system.php

示例11: _processMedia

 /**
  * Perform media processing for the given field if something has been uploaded
  *
  * @access private
  * @param string $ps_field field name
  * @param array options
  * 
  * Supported options:
  * 		delete_old_media = set to zero to prevent that old media files are deleted; defaults to 1
  *		these_versions_only = if set to an array of valid version names, then only the specified versions are updated with the currently updated file; ignored if no media already exists
  *		dont_allow_duplicate_media = if set to true, and the model as a field named "md5" then media will be rejected if a row already exists with the same MD5 signature
  */
 public function _processMedia($ps_field, $pa_options = null)
 {
     global $AUTH_CURRENT_USER_ID;
     if (!is_array($pa_options)) {
         $pa_options = array();
     }
     if (!isset($pa_options['delete_old_media'])) {
         $pa_options['delete_old_media'] = true;
     }
     if (!isset($pa_options['these_versions_only'])) {
         $pa_options['these_versions_only'] = null;
     }
     $vs_sql = "";
     $vn_max_execution_time = ini_get('max_execution_time');
     set_time_limit(7200);
     $o_tq = new TaskQueue();
     $o_media_proc_settings = new MediaProcessingSettings($this, $ps_field);
     # only set file if something was uploaded
     # (ie. don't nuke an existing file because none
     #      was uploaded)
     $va_field_info = $this->getFieldInfo($ps_field);
     if (isset($this->_FILES_CLEAR[$ps_field]) && $this->_FILES_CLEAR[$ps_field]) {
         //
         // Clear files
         //
         $va_versions = $this->getMediaVersions($ps_field);
         #--- delete files
         foreach ($va_versions as $v) {
             $this->_removeMedia($ps_field, $v);
         }
         $this->_removeMedia($ps_field, '_undo_');
         $this->_FILES[$ps_field] = null;
         $this->_FIELD_VALUES[$ps_field] = null;
         $vs_sql = "{$ps_field} = " . $this->quote(caSerializeForDatabase($this->_FILES[$ps_field], true)) . ",";
     } else {
         // Don't try to process files when no file is actually set
         if (isset($this->_SET_FILES[$ps_field]['tmp_name'])) {
             $o_tq = new TaskQueue();
             $o_media_proc_settings = new MediaProcessingSettings($this, $ps_field);
             //
             // Process incoming files
             //
             $m = new Media();
             $va_media_objects = array();
             // is it a URL?
             $vs_url_fetched_from = null;
             $vn_url_fetched_on = null;
             $vb_allow_fetching_of_urls = (bool) $this->_CONFIG->get('allow_fetching_of_media_from_remote_urls');
             $vb_is_fetched_file = false;
             if ($vb_allow_fetching_of_urls && (bool) ini_get('allow_url_fopen') && isURL($vs_url = html_entity_decode($this->_SET_FILES[$ps_field]['tmp_name']))) {
                 $vs_tmp_file = tempnam(__CA_APP_DIR__ . '/tmp', 'caUrlCopy');
                 $r_incoming_fp = fopen($vs_url, 'r');
                 if (!$r_incoming_fp) {
                     $this->postError(1600, _t('Cannot open remote URL [%1] to fetch media', $vs_url), "BaseModel->_processMedia()", $this->tableName() . '.' . $ps_field);
                     set_time_limit($vn_max_execution_time);
                     return false;
                 }
                 $r_outgoing_fp = fopen($vs_tmp_file, 'w');
                 if (!$r_outgoing_fp) {
                     $this->postError(1600, _t('Cannot open file for media fetched from URL [%1]', $vs_url), "BaseModel->_processMedia()", $this->tableName() . '.' . $ps_field);
                     set_time_limit($vn_max_execution_time);
                     return false;
                 }
                 while (($vs_content = fgets($r_incoming_fp, 4096)) !== false) {
                     fwrite($r_outgoing_fp, $vs_content);
                 }
                 fclose($r_incoming_fp);
                 fclose($r_outgoing_fp);
                 $vs_url_fetched_from = $vs_url;
                 $vn_url_fetched_on = time();
                 $this->_SET_FILES[$ps_field]['tmp_name'] = $vs_tmp_file;
                 $vb_is_fetched_file = true;
             }
             // is it server-side stored user media?
             if (preg_match("!^userMedia[\\d]+/!", $this->_SET_FILES[$ps_field]['tmp_name'])) {
                 // use configured directory to dump media with fallback to standard tmp directory
                 if (!is_writeable($vs_tmp_directory = $this->getAppConfig()->get('ajax_media_upload_tmp_directory'))) {
                     $vs_tmp_directory = caGetTempDirPath();
                 }
                 $this->_SET_FILES[$ps_field]['tmp_name'] = "{$vs_tmp_directory}/" . $this->_SET_FILES[$ps_field]['tmp_name'];
                 // read metadata
                 if (file_exists("{$vs_tmp_directory}/" . $this->_SET_FILES[$ps_field]['tmp_name'] . "_metadata")) {
                     if (is_array($va_tmp_metadata = json_decode(file_get_contents("{$vs_tmp_directory}/" . $this->_SET_FILES[$ps_field]['tmp_name'] . "_metadata")))) {
                         $this->_SET_FILES[$ps_field]['original_filename'] = $va_tmp_metadata['original_filename'];
                     }
                 }
             }
             if (isset($this->_SET_FILES[$ps_field]['tmp_name']) && file_exists($this->_SET_FILES[$ps_field]['tmp_name'])) {
//.........这里部分代码省略.........
开发者ID:samrahman,项目名称:providence,代码行数:101,代码来源:BaseModel.php

示例12: mediaIsEmpty

 /**
  * Returns true if the media field is set to a non-empty file
  **/
 public function mediaIsEmpty()
 {
     if (!($vs_media_path = $this->getMediaPath('media', 'original'))) {
         $vs_media_path = $this->get('media');
     }
     if ($vs_media_path) {
         if (file_exists($vs_media_path) && abs(filesize($vs_media_path)) > 0) {
             return false;
         }
     }
     // is it a URL?
     if ($this->_CONFIG->get('allow_fetching_of_media_from_remote_urls')) {
         if (isURL($vs_media_path)) {
             return false;
         }
     }
     return true;
 }
开发者ID:ffarago,项目名称:pawtucket2,代码行数:21,代码来源:ca_object_representations.php

示例13: confirm_base

function confirm_base($uri)
{
    if (empty($uri)) {
        return $uri;
    }
    if (isURL($uri)) {
        return $uri;
    }
    return base_url() . $uri;
}
开发者ID:paulshannon,项目名称:scalar,代码行数:10,代码来源:MY_url_helper.php

示例14: foaf_homepage

 public function foaf_homepage($value, $base_uri)
 {
     if (isURL($value)) {
         return $value;
     }
     return confirm_slash($base_uri) . 'users/' . $value;
 }
开发者ID:paulshannon,项目名称:scalar,代码行数:7,代码来源:MY_Model.php

示例15:

     if ($fldNotNull[$i] && $fldValue[$i] == "" && !($action == 'change' && $fld[$i] == $AUTHORIZE_BY)) {
         $errCode = 1;
     }
     if ($fldNotNull[$i] && $fldFmt[$i] == "url" && ($fldValue[$i] == 'http://' || $fldValue[$i] == 'ftp://')) {
         $errCode = 1;
     }
     if ($fldFmt[$i] == "email" && $fldValue[$i] && !nc_preg_match("/^[a-z0-9\\._-]+@[a-z0-9\\._-]+\\.[a-z]{2,6}\$/i", $fldValue[$i])) {
         $errCode = 2;
     }
     if ($fldFmt[$i] == "phone" && $fldValue[$i] && !nc_preg_match("/^ (\\+?\\d-?)?  (((\\(\\d{3}\\))|(\\d{3})?)-?)?  \\d{3}-?\\d{2}-?\\d{2} \$/x", str_replace(array(" ", " \t"), '', $fldValue[$i]))) {
         $errCode = 2;
     }
     if ($fldType[$i] == 1 && $fldFmt[$i] == "url" && ($fldValue[$i] == 'http://' || $fldValue[$i] == 'ftp://')) {
         $fldValue[$i] = "";
     }
     if ($fldFmt[$i] == "url" && $fldValue[$i] && !isURL($fldValue[$i])) {
         $errCode = 2;
     }
     break;
     # int
 # int
 case NC_FIELDTYPE_INT:
     if ($fldNotNull[$i] && $fldValue[$i] == "") {
         $errCode = 1;
     }
     if ($fldValue[$i] != "" && $fldValue[$i] != strval(intval($fldValue[$i]))) {
         $errCode = 2;
     }
     break;
     # text
 # text
开发者ID:Blu2z,项目名称:implsk,代码行数:31,代码来源:message_fields.php


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