本文整理汇总了PHP中get_data_by_field函数的典型用法代码示例。如果您正苦于以下问题:PHP get_data_by_field函数的具体用法?PHP get_data_by_field怎么用?PHP get_data_by_field使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_data_by_field函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Hookyt2rsUpload_pluploadupload_page_bottom
function Hookyt2rsUpload_pluploadupload_page_bottom()
{
global $userref, $yt2rs_field_id, $lang;
$ref_user = 0 - $userref;
$youtube_copy_path = get_data_by_field($ref_user, $yt2rs_field_id);
if ($youtube_copy_path == "") {
return false;
} else {
if (preg_match("/youtu.be\\/[a-z1-9.-_]+/", $youtube_copy_path)) {
preg_match("/youtu.be\\/([a-z1-9.-_]+)/", $youtube_copy_path, $matches);
} else {
if (preg_match("/youtube.com(.+)v=([^&]+)/", $youtube_copy_path)) {
preg_match("/v=([^&]+)/", $youtube_copy_path, $matches);
}
}
}
$ytthumb_id = $matches[1];
$thumb_path = 'http://img.youtube.com/vi/' . $ytthumb_id . '/mqdefault.jpg';
?>
<h1><?php
echo $lang['yt2rs_thumb'];
?>
</h1>
<?php
echo $thumb_path;
}
示例2: showApproval
function showApproval($result)
{
$approval = sql_value("SELECT approval_status AS value FROM resource WHERE ref = {$result['ref']}", FALSE);
$approval_form_id = sql_value("SELECT ref AS value FROM resource_type_field WHERE name = 'approval_form'", FALSE);
if (!$approval_form_id) {
return;
}
$approval_form = TidyList(get_data_by_field($result['ref'], $approval_form_id));
if (empty($approval) and strpos($approval_form, 'Yes') !== FALSE) {
$approval = 'waiting';
}
if ($approval) {
switch ($approval) {
case 'waiting':
$title = 'Awaiting Approval';
break;
case 'minor':
$title = 'Minor Changes Needed';
break;
case 'major':
$title = 'Major Changes Needed';
break;
case 'approved':
$title = 'Approved';
break;
}
echo '<span class="rps-approval rps-approval-' . $approval . '" title="' . $title . '"></span>';
}
}
示例3: HookResourceconnectViewResourceactions_anonymous
function HookResourceconnectViewResourceactions_anonymous()
{
if (getval("resourceconnect_source", "") == "") {
return false;
}
# Not a ResourceConnect result set.
global $lang, $title_field, $ref, $baseurl, $search, $offset, $scramble_key, $language, $resource;
# Generate access key
$access_key = md5("resourceconnect" . $scramble_key);
# Formulate resource link (for collections bar)
$view_url = $baseurl . "/pages/view.php?ref=" . $ref . "&k=" . substr(md5($access_key . $ref), 0, 10) . "&language_set=" . urlencode($language) . "&resourceconnect_source=" . urlencode($baseurl);
# Add to collections link.
$url = getval("resourceconnect_source", "") . "/plugins/resourceconnect/pages/add_collection.php?nc=" . time();
$url .= "&title=" . urlencode(get_data_by_field($ref, $title_field));
$url .= "&url=" . urlencode($view_url);
# Add back URL
$url .= "&back=" . urlencode($baseurl . "/pages/view.php?" . $_SERVER["QUERY_STRING"]);
# Add images
if ($resource["has_image"] == 1) {
$url .= "&thumb=" . urlencode(get_resource_path($ref, false, "col", false, "jpg"));
} else {
$url .= "&thumb=" . urlencode($baseurl . "/gfx/" . get_nopreview_icon($resource["resource_type"], $resource["file_extension"], true));
}
?>
<li><a target="collections" href="<?php
echo $url;
?>
">> <?php
echo $lang["action-addtocollection"];
?>
</a></li>
<?php
}
示例4: HookLightbox_previewViewRenderbeforerecorddownload
function HookLightbox_previewViewRenderbeforerecorddownload()
{
global $resource, $title_field;
$url = getPreviewURL($resource);
if ($url === false) {
return;
}
$title = get_data_by_field($resource['ref'], $title_field);
setLink('#previewimagelink', $url, $title);
setLink('#previewlink', $url, $title, 'lightbox-other');
}
示例5: HookApprovalViewRenderbeforeresourcedetails
function HookApprovalViewRenderbeforeresourcedetails()
{
global $lang, $ref, $resource, $fields;
$approval_form_id = sql_value("SELECT ref AS value FROM resource_type_field WHERE name = 'approval_form'", FALSE);
if (!$approval_form_id) {
return;
}
$approval_form = TidyList(get_data_by_field($ref, $approval_form_id));
if ($approval_form !== 'Yes') {
return;
}
$history = sql_query('SELECT id, ref, posted, comment, name, signature, status FROM approval WHERE ref = ' . (int) $ref . ' ORDER BY posted DESC');
ob_start();
$path = dirname(dirname(__FILE__));
include $path . '/inc/approval.php';
echo ob_get_clean();
}
示例6: HookApprovalResource_emailFooterbottom
function HookApprovalResource_emailFooterbottom()
{
global $ref;
$approval_form_id = sql_value("SELECT ref AS value FROM resource_type_field WHERE name = 'approval_form'", FALSE);
if (!$approval_form_id) {
return;
}
$approval_form = TidyList(get_data_by_field($ref, $approval_form_id));
if ($approval_form !== 'Yes') {
return;
}
$settings = get_plugin_config('approval');
echo '
<script type="text/javascript">
document.getElementById("message").value = "' . htmlspecialchars($settings['email_message']) . '";
</script>
';
}
示例7: getTargetFilename
/**
* Returns the filename to be used for a specific file.
* @param type $ref The resource for which the name should be built.
* @param type $ext The new filename suffix to be used.
* @param type $size A short name for the target file format, for example 'hpr'.
*/
function getTargetFilename($ref, $ext, $size)
{
global $filename_field, $view_title_field;
# Get filename - first try title, then original filename, and finally use the resource ID
$filename = get_data_by_field($ref, $view_title_field);
if (empty($filename)) {
$filename = get_data_by_field($ref, $filename_field);
if (!empty($filename)) {
$originalSuffix = pathinfo($filename, PATHINFO_EXTENSION);
$filename = mb_basename($filename, $originalSuffix);
} else {
$filename = strval($ref);
}
}
# Remove potentially problematic characters, and make sure it's not too long
$filename = preg_replace("/[*:<>?\\/|]/", '_', $filename);
$filename = substr($filename, 0, 240);
return $filename . (empty($size) ? '' : '-' . strtolower($size)) . '.' . strtolower($ext);
}
示例8: Hookyt2rsViewreplacedownloadoptions
function Hookyt2rsViewreplacedownloadoptions()
{
// Replace download options
global $ref, $yt2rs_field_id, $baseurl_short, $lang;
$youtube_url = get_data_by_field($ref, $yt2rs_field_id);
if ($youtube_url !== "" && isValidURL($youtube_url)) {
?>
<table cellpadding="0" cellspacing="0">
<tr >
<td>File Information</td>
<td>File Size </td>
<td>Options</td>
</tr>
<tr class="DownloadDBlend">
<td><h2>Online Preview</h2><p>Youtube Video</p></td>
<td>N/A</td>
<td class="DownloadButton HorizontalWhiteNav"><a href="<?php
echo $baseurl_short;
?>
pages/resource_request.php?ref=<?php
echo urlencode($ref);
?>
&k=<?php
echo getval("k", "");
?>
" onClick="return CentralSpaceLoad(this,true);">
<?php
echo $lang["action-request"];
?>
</td>
</tr>
</table>
<?php
return true;
} else {
return false;
}
}
示例9: substr
<div class="clearerleft"></div>
<!--<h1><?php
echo $affiliatename;
?>
</h1>-->
<?php
for ($n = $offset; $n < count($results) && $n < $offset + $pagesize; $n++) {
$result = $results[$n];
$ref = $result["ref"];
$url = $baseurl . "/pages/view.php?ref=" . $ref . "&k=" . substr(md5($access_key . $ref), 0, 10) . "&language_set=" . urlencode($language) . "&search=" . urlencode($search) . "&offset=" . $offset . "&resourceconnect_source=" . urlencode(getval("resourceconnect_source", ""));
# Wrap with local page that includes header/footer/sidebar
$link_url = "../plugins/resourceconnect/pages/view.php?search=" . urlencode($search) . "&url=" . urlencode($url);
$title = str_replace(array("\"", "'"), "", htmlspecialchars(i18n_get_translated($result["field" . $view_title_field])));
# Add to collections link.
$add_url = getval("resourceconnect_source", "") . "/plugins/resourceconnect/pages/add_collection.php?nc=" . time();
$add_url .= "&title=" . urlencode(get_data_by_field($ref, $view_title_field));
$add_url .= "&url=" . urlencode(str_replace("&search", "&source_search", $url));
# Move the search so it doesn't get set, and therefore the nav is hidden when viewing the resource
$add_url .= "&back=" . urlencode($baseurl . "/pages/view.php?" . $_SERVER["QUERY_STRING"]);
# Add image
if ($result["has_image"] == 1) {
$add_url .= "&thumb=" . urlencode(get_resource_path($ref, false, "col", false, "jpg"));
$add_url .= "&large_thumb=" . urlencode(get_resource_path($ref, false, "thm", false, "jpg"));
$add_url .= "&xl_thumb=" . urlencode(get_resource_path($ref, false, "pre", false, "jpg"));
} else {
$add_url .= "&thumb=" . urlencode($baseurl . "/gfx/" . get_nopreview_icon($result["resource_type"], $result["file_extension"], true));
$add_url .= "&large_thumb=" . urlencode($baseurl . "/gfx/" . get_nopreview_icon($result["resource_type"], $result["file_extension"], false));
$add_url .= "&xl_thumb=" . urlencode($baseurl . "/gfx/" . get_nopreview_icon($result["resource_type"], $result["file_extension"], false));
}
?>
<div class="ResourcePanelShell">
示例10: trim
# Display resource ID
?>
<p><?php
echo $lang["resourceid"];
?>
: <?php
echo $ref;
?>
</p>
<?php
}
# Display fields
for ($n = 0; $n < count($infobox_fields); $n++) {
$field = $infobox_fields[$n];
if ((checkperm("f" . $field) || checkperm("f*")) && !checkperm("f-" . $field)) {
$value = trim(get_data_by_field($ref, $field));
$type = sql_value("select type value from resource_type_field where ref = {$field}", 0);
if ($value != "") {
if ($type != 8) {
$value = nl2br(htmlspecialchars(TidyList(i18n_get_translated($value))));
}
if ($type == 4) {
$value = nicedate($value);
}
?>
<p><?php
echo $value;
?>
</p>
<?php
}
示例11: exit
exit("Permission denied");
}
include "../include/resource_functions.php";
if (!$speedtagging) {
exit("This function is not enabled.");
}
if (getval("save", "") != "") {
$ref = getvalescaped("ref", "", true);
$keywords = getvalescaped("keywords", "");
# support resource_type based tag fields
$resource_type = get_resource_data($ref);
$resource_type = $resource_type['resource_type'];
if (isset($speedtagging_by_type[$resource_type])) {
$speedtaggingfield = $speedtagging_by_type[$resource_type];
}
$oldval = get_data_by_field($ref, $speedtaggingfield);
update_field($ref, $speedtaggingfield, $keywords);
# Write this edit to the log.
resource_log($ref, 'e', $speedtaggingfield, "", $oldval, $keywords);
}
# append resource type restrictions based on 'T' permission
# look for all 'T' permissions and append to the SQL filter.
global $userpermissions;
$rtfilter = array();
$sql_join = "";
$sql_filter = "";
for ($n = 0; $n < count($userpermissions); $n++) {
if (substr($userpermissions[$n], 0, 1) == "T") {
$rt = substr($userpermissions[$n], 1);
if (is_numeric($rt)) {
$rtfilter[] = $rt;
示例12: hookView_in_finderViewRenderinnerresourcedownloadspace
function hookView_in_finderViewRenderinnerresourcedownloadspace()
{
global $resource;
global $afp_server_path;
global $access;
global $staticSyncSyncDirField, $staticSyncDirs, $staticSyncUseArray;
$restrictedAccess = false;
$viewInFinder = get_plugin_config("view_in_finder");
/*
echo "<pre>";
print_r($viewInFinder);
echo "</pre>";
*/
// check to see if we are using permissions, and if yes then do they have access to this resource type?
if ($viewInFinder['afpServerPath'] && $access != 0) {
$restrictedAccess = true;
}
if (!$restrictedAccess) {
//echo "Access Allowed... ";
if ($resource["file_path"] != "") {
//echo "Got the file path…. ";
if ($staticSyncUseArray) {
$syncPath = get_data_by_field($resource['ref'], $staticSyncSyncDirField);
$found = false;
$lSyncDir = "";
if ($syncPath != "") {
foreach ($staticSyncDirs as $tDir) {
if (!$found) {
if (strpos($syncPath, $tDir['syncdir']) !== false) {
$found = true;
$lSyncDir = $tDir['syncdir'];
}
}
}
if ($found) {
//echo "sync dir found : ". $lSyncDir;
// check the afp path from the config.
if (array_key_exists($lSyncDir, $viewInFinder['multiafpServerPath'])) {
$afp_link = $viewInFinder['multiafpServerPath'][$lSyncDir] . "/" . $resource["file_path"];
} else {
// use the default
$afp_link = $viewInFinder['afpServerPath'] . "/" . $resource["file_path"];
}
//echo $afp_link;
}
} else {
// $syncPath is empty or not fouond, use the default
$afp_link = $viewInFinder['afpServerPath'] . "/" . $resource["file_path"];
$found = true;
}
} else {
if (array_key_exists('afpServerPath', $viewInFinder)) {
$afp_link = $viewInFinder['afpServerPath'] . "/" . $resource["file_path"];
$found = true;
}
}
if ($found) {
echo "<table>";
echo '<tr class="DownloadDBlend">';
echo '<td>Open Original File In Finder</td>';
$fName = explode("/", $resource["file_path"]);
$fid = count($fName) - 1;
echo '<td class="DownloadButton"><a href="' . $afp_link . '">' . $fName[$fid] . '</a></ td>';
echo '</tr>';
echo "</table>";
}
}
}
}
示例13: do_search
<?php
exit;
}
# Fetch videos
$videos = do_search("!collection" . $usercollection);
if (getval("splice", "") != "" && count($videos) > 1) {
$ref = copy_resource($videos[0]["ref"]);
# Base new resource on first video (top copy metadata).
# Set parent resource field details.
global $videosplice_parent_field;
$resources = "";
for ($n = 0; $n < count($videos); $n++) {
if ($n > 0) {
$resources .= ", ";
}
$crop_from = get_data_by_field($videos[$n]["ref"], $videosplice_parent_field);
$resources .= $videos[$n]["ref"] . ($crop_from != "" ? " " . str_replace("%resourceinfo", $crop_from, $lang["cropped_from_resource"]) : "");
}
$history = str_replace("%resources", $resources, $lang["merged_from_resources"]);
update_field($ref, $videosplice_parent_field, $history);
# Establish FFMPEG location.
$ffmpeg_fullpath = get_utility_path("ffmpeg");
$vidlist = "";
# Create FFMpeg syntax to merge all additional videos.
for ($n = 0; $n < count($videos); $n++) {
# Work out source/destination
global $ffmpeg_preview_extension;
if (file_exists(get_resource_path($videos[$n]["ref"], true, "", false, $videos[$n]["file_extension"]))) {
$source = get_resource_path($videos[$n]["ref"], true, "", false, $videos[$n]["file_extension"], -1, 1, false, "", -1, false);
} else {
exit(str_replace(array("%resourceid", "%filetype"), array($videos[$n]["ref"], $videos[$n]["file_extension"]), $lang["error-no-ffmpegpreviewfile"]));
示例14: get_data_by_field
// copies file
if ($tmpfile !== false && file_exists($tmpfile)) {
$p = $tmpfile;
// file already in tmp, just rename it
} else {
if (!$replaced_file) {
$copy = true;
// copy the file from filestore rather than renaming
}
}
# if the tmpfile is made, from here on we are working with that.
# If using original filenames when downloading, copy the file to new location so the name is included.
$filename = '';
if ($original_filenames_when_downloading) {
# Retrieve the original file name
$filename = get_data_by_field($ref, $filename_field);
if (!empty($filename)) {
# Only perform the copy if an original filename is set.
# now you've got original filename, but it may have an extension in a different letter case.
# The system needs to replace the extension to change it to jpg if necessary, but if the original file
# is being downloaded, and it originally used a different case, then it should not come from the file_extension,
# but rather from the original filename itself.
# do an extra check to see if the original filename might have uppercase extension that can be preserved.
# also, set extension to "" if the original filename didn't have an extension (exiftool identification of filetypes)
$pathparts = pathinfo($filename);
if (isset($pathparts['extension'])) {
if (strtolower($pathparts['extension']) == $pextension) {
$pextension = $pathparts['extension'];
}
} else {
$pextension = "jpg";
示例15: extract_exif_comment
//.........这里部分代码省略.........
}
# If not in the options list, do not read this value
$s = trim_array(explode(",", $value));
$value = "";
# blank value
for ($n = 0; $n < count($s); $n++) {
if (trim($s[0]) != "" && in_array(strtolower($s[$n]), $options)) {
$value .= "," . $s[$n];
}
}
#echo($read_from[$i]["ref"] . " = " . $value . "<br>");
}
# Read the data.
if ($read) {
$plugin = dirname(__FILE__) . "/../plugins/exiftool_filter_" . $read_from[$i]['name'] . ".php";
if ($read_from[$i]['exiftool_filter'] != "") {
eval($read_from[$i]['exiftool_filter']);
}
if (file_exists($plugin)) {
include $plugin;
}
# Field 8 is used in a special way for staticsync; don't overwrite field 8 in this case
if (!($omit_title_for_staticsync && $read_from[$i]['ref'] == 8)) {
$exiffieldoption = $exifoption;
if ($exifoption == "custom" || isset($embedded_data_user_select_fields) && in_array($read_from[$i]['ref'], $embedded_data_user_select_fields)) {
debug("EXIF - custom option for field " . $read_from[$i]['ref'] . " : " . $exifoption);
$exiffieldoption = getval("exif_option_" . $read_from[$i]['ref'], $exifoption);
}
debug("EXIF - option for field " . $read_from[$i]['ref'] . " : " . $exiffieldoption);
if ($exiffieldoption == "no") {
continue;
} elseif ($exiffieldoption == "append") {
$spacechar = $read_from[$i]["type"] == 2 || $read_from[$i]["type"] == 3 ? ", " : " ";
$oldval = get_data_by_field($ref, $read_from[$i]['ref']);
if (strpos($oldval, $value) !== false) {
continue;
}
$newval = $oldval . $spacechar . iptc_return_utf8($value);
} elseif ($exiffieldoption == "prepend") {
$spacechar = $read_from[$i]["type"] == 2 || $read_from[$i]["type"] == 3 ? ", " : " ";
$oldval = get_data_by_field($ref, $read_from[$i]['ref']);
if (strpos($oldval, $value) !== false) {
continue;
}
$newval = iptc_return_utf8($value) . $spacechar . $oldval;
} else {
$newval = iptc_return_utf8($value);
}
global $merge_filename_with_title, $lang;
if ($merge_filename_with_title) {
$merge_filename_with_title_option = urlencode(getval('merge_filename_with_title_option', ''));
$merge_filename_with_title_include_extensions = urlencode(getval('merge_filename_with_title_include_extensions', ''));
$merge_filename_with_title_spacer = urlencode(getval('merge_filename_with_title_spacer', ''));
$original_filename = '';
if (isset($_REQUEST['name'])) {
$original_filename = $_REQUEST['name'];
} else {
$original_filename = $processfile['name'];
}
if ($merge_filename_with_title_include_extensions == 'yes') {
$merged_filename = $original_filename;
} else {
$merged_filename = strip_extension($original_filename);
}
$oldval = get_data_by_field($ref, $read_from[$i]['ref']);
if (strpos($oldval, $value) !== FALSE) {