本文整理汇总了PHP中file::load方法的典型用法代码示例。如果您正苦于以下问题:PHP file::load方法的具体用法?PHP file::load怎么用?PHP file::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类file
的用法示例。
在下文中一共展示了file::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
function index($params)
{
$tpl = new template("includes/v");
$tpl->load("configs.html", true, true);
$tpl->setv("formtitle", "Редактирование настроек");
$json = new Services_JSON();
$config = $json->decode(file::load("data/config.ini"));
$tpl->setv(array("itemnum" => $config->itemnum, "daynum" => $config->daynum, "email" => $config->email, "emailpassword" => $config->emailpassword, "emailserver" => $config->emailserver, "outputdir" => $config->outputdir, "numthumbs" => $config->numthumbs, "logemail" => $config->logemail));
$tpl->show();
}
示例2: proc
function proc($params)
{
require_once "MailGrabber.php";
print "<pre>";
if (str::isempty($params["id"])) {
die("<b>Ошибка: Фильтр не выбран</b>\n");
}
set_time_limit(0);
$json = new Services_JSON();
$mailgrabber = new MailGrabber();
$mailgrabber->run($json->decode(file::load("data/config.ini")), true, $params["id"]);
}
示例3: items_form
//.........这里部分代码省略.........
{
url: NAVIGATE_APP + "?fid=" + navigate_query_parameter("fid") + "&act=96&id=" + id,
dataType: "json",
data: {},
success: function(data, textStatus, xhr)
{
item_category_path = data;
}
});
}
');
$navibars->add_tab_content_row(array('<label>' . t(162, 'Embedding') . '</label>', $naviforms->buttonset('embedding', array('1' => t(163, 'Embedded'), '0' => t(164, 'Own path')), empty($item->id) ? '1' : intval($item->embedding), "navigate_change_association();"), '<span id="embedding_info" class="ui-icon ui-icon-info"
data-message-title-1="' . t(163, 'Embedded', false, true) . '"
data-message-content-1="' . t(165, 'Full content is shown on category page. Ex. "Who we are?"', false, true) . '"
data-message-title-2="' . t(164, 'Own path', false, true) . '"
data-message-content-2="' . t(166, 'The content is accessed through its own url. Ex. "News"', false, true) . '"
style="float: left; margin-left: -4px;">
</span>'), 'div_category_embedded');
$navibars->add_tab_content_row(array('<label>' . t(22, 'Elements') . '</label>', '<button style="float: left;">' . t(171, 'Order') . '</button>', '<span id="order_info" class="ui-icon ui-icon-info"
data-message="' . t(425, 'Order elements of a category (unless the template forces other sorting)', false, true) . '"
style="float: left; margin-left: 2px;">
</span>', '<div id="items_order_window" style="display: none;"></div>'), 'div_category_order');
$layout->add_script('
$("#div_category_order button").button(
{
icons:
{
primary: "ui-icon-arrowthick-2-n-s"
}
}).on("click", function(e)
{
e.stopPropagation();
e.preventDefault();
navigate_status(navigate_t(6, "Loading") + "...", "loader");
$("#items_order_window").load("?fid=items&act=items_order&category=" + $("#category").val() + "&_bogus=" + new Date().getTime(), function()
{
navigate_status(navigate_t(42, "Ready"), "ready");
$("#items_order_window").dialog({
modal: true,
title: "' . t(171, 'Order') . '",
width: 600,
height: 500,
buttons:
{
"' . t(58, 'Cancel') . '": function()
{
$(this).dialog("destroy");
},
"' . t(190, 'Ok') . '": function()
{
var dialog = this;
// save
$.post(
"?fid=items&act=items_order&category=" + $("#category").val() + "&_bogus=" + new Date().getTime(),
{
"items-order": $("#items-order").val()
},
function(response)
{
if(response=="true")
{
$(dialog).dialog("destroy");
}
else
{
示例4: header
// output content
header('Connection: close');
//$image = core_http_request($_REQUEST['image']);
$image = file_get_contents($_REQUEST['image']);
file_put_contents($targetDir . '/' . $_REQUEST['id'] . '.pixlr', $image);
if (file_exists($targetDir . '/' . $_REQUEST['id'] . '.pixlr')) {
if (filesize($targetDir . '/' . $_REQUEST['id'] . '.pixlr') != $size) {
@unlink($targetDir . '/' . $_REQUEST['id'] . '.pixlr');
} else {
unlink($targetDir . '/' . $_REQUEST['id']);
rename($targetDir . '/' . $_REQUEST['id'] . '.pixlr', $targetDir . '/' . $_REQUEST['id']);
// update file info and remove old thumbnails
$DB = new database();
$DB->connect();
$file = new file();
$file->load($_REQUEST['id']);
$file->refresh();
$DB->disconnect();
core_terminate();
}
}
}
}
echo false;
core_terminate();
} else {
if ($_REQUEST['engine'] == 'tinymce') {
$DB = new database();
$DB->connect();
$file = file::register_upload($_FILES['file']['tmp_name'], $_FILES['file']['name'], 0, NULL, true);
if (!empty($file)) {
示例5: Services_JSON
<?php
require_once "prepend.php";
require_once "PagesGenerator.php";
require_once "JSON.php";
$json = new Services_JSON();
PagesGenerator::run($json->decode(file::load("data/config.ini")));
示例6: export_sample
public static function export_sample($a_categories, $a_items, $a_block_groups, $a_blocks, $a_comments, $folder)
{
global $website;
global $theme;
global $DB;
@set_time_limit(0);
$categories = array();
$items = array();
$blocks = array();
$block_groups = array();
$comments = array();
$properties = array();
$files = array();
$settings = array();
// structure
for ($c = 0; $c < count($a_categories); $c++) {
$tmp = new structure();
$tmp->load($a_categories[$c]);
//$properties['structure'][$tmp->id] = property::load_properties_associative('structure', $tmp->template, 'structure', $tmp->id);
$properties['structure'][$tmp->id] = property::load_properties('structure', $tmp->template, 'structure', $tmp->id);
$categories[$tmp->id] = $tmp;
// add files referenced in properties
if (is_array($properties['structure'][$tmp->id])) {
foreach ($properties['structure'][$tmp->id] as $property) {
if ($property->type == 'image' || $property->type == 'file') {
$files[] = $property->value;
}
}
}
}
// comments
for ($c = 0; $c < count($a_comments); $c++) {
$tmp = new comment();
$tmp->load($a_comments[$c]);
$comments[$tmp->id] = $tmp;
}
// items
for ($i = 0; $i < count($a_items); $i++) {
$tmp = new item();
$tmp->load($a_items[$i]);
$template_id = $tmp->template;
if ($tmp->association != "free" && $tmp->embedding == 1) {
// we have to get the template set in the category of the item
$template_id = $DB->query_single('template', 'nv_structure', ' id = ' . protect($tmp->category) . ' AND website = ' . $website->id);
}
$properties['item'][$tmp->id] = property::load_properties('item', $template_id, 'item', $tmp->id);
list($tmp->dictionary, $files) = theme::export_sample_parse_dictionary($tmp->dictionary, $files);
// add files referenced in properties
if (is_array($properties['item'][$tmp->id])) {
foreach ($properties['item'][$tmp->id] as $property) {
if ($property->type == 'image' || $property->type == 'file') {
$files[] = $property->value;
}
}
}
// add files referenced in gallery
if (is_array($tmp->galleries[0])) {
$gallery_images = array_keys($tmp->galleries[0]);
$files = array_merge($files, $gallery_images);
}
$items[$tmp->id] = $tmp;
}
// block_groups
for ($i = 0; $i < count($a_block_groups); $i++) {
$tmp = new block_group();
$tmp->load($a_block_groups[$i]);
$block_groups[$tmp->id] = $tmp;
if (is_array($tmp->blocks)) {
foreach ($tmp->blocks as $bgb) {
if ($bgb['type'] == 'block_group_block') {
$properties['block_group_block'][$a_block_groups[$i]][$bgb['uid']] = property::load_properties($bgb['id'], $tmp->code, 'block_group_block', $bgb['id'], $bgb['uid']);
} else {
if ($bgb['type'] == 'extension') {
$properties['block_group_block'][$a_block_groups[$i]][$bgb['uid']] = property::load_properties(NULL, $bgb['id'], "extension_block", NULL, $bgb['uid']);
}
}
}
}
// note: maybe not all blocks in the group have been selected in the "blocks" tab
// here we only export the block group definition, the block group blocks properties and the extension blocks properties, not adding anything else to export
}
// blocks
for ($i = 0; $i < count($a_blocks); $i++) {
$tmp = new block();
$tmp->load($a_blocks[$i]);
$properties['block'][$tmp->id] = property::load_properties('block', $tmp->type, 'block', $tmp->id);
list($tmp->dictionary, $files) = theme::export_sample_parse_dictionary($tmp->dictionary, $files);
list($tmp->trigger['trigger-content'], $files) = theme::export_sample_parse_array($tmp->trigger['trigger-content'], $files);
list($tmp->trigger['trigger-html'], $files) = theme::export_sample_parse_array($tmp->trigger['trigger-html'], $files);
if (!empty($tmp->trigger['trigger-image'])) {
$files = array_merge($files, array_values($tmp->trigger['trigger-image']));
}
if (!empty($tmp->trigger['trigger-rollover'])) {
$files = array_merge($files, array_values($tmp->trigger['trigger-rollover']));
}
if (!empty($tmp->trigger['trigger-rollover-active'])) {
$files = array_merge($files, array_values($tmp->trigger['trigger-rollover-active']));
}
if (!empty($tmp->trigger['trigger-flash'])) {
$files = array_merge($files, array_values($tmp->trigger['trigger-flash']));
//.........这里部分代码省略.........
示例7: embed
public static function embed($provider, $reference, $extra = "")
{
$out = '';
if (($provider == 'file' || empty($provider)) && is_numeric($reference)) {
$file = new file();
$file->load($reference);
$reference = $file;
}
if (is_object($reference)) {
$vsrc = NVWEB_OBJECT . '?type=file&id=' . $reference->id . '&disposition=inline';
$out = '
<video id="video-file-' . $reference->id . '" ' . $extra . ' controls="controls" preload="metadata" poster="">
<source src="' . $vsrc . '" type="' . $reference->mime . '" />
<p>Error loading video</p>
</video>
';
} else {
if ($provider == 'youtube') {
$out = '<iframe src="https://www.youtube.com/embed/' . $reference . '?feature=oembed&rel=0&modestbranding=1" frameborder="0" allowfullscreen ' . $extra . '></iframe>';
} else {
if ($provider == 'vimeo') {
$out = '<iframe src="https://player.vimeo.com/video/' . $reference . '?" frameborder="0" allowfullscreen ' . $extra . '></iframe>';
}
}
}
return $out;
}
示例8: nvweb_gallery_image_caption
function nvweb_gallery_image_caption($image, $gallery)
{
global $current;
$image_title = "";
$image_description = "";
if (is_array($gallery)) {
$image_title = $gallery[$image][$current['lang']];
$image_description = $gallery[$image][$current['lang']];
}
if (empty($image_title)) {
// retrieve title and description from file
$image_selected_obj = new file();
$image_selected_obj->load($image);
if (isset($image_selected_obj->description[$current['lang']])) {
$image_description = $image_selected_obj->description[$current['lang']];
}
if (isset($image_selected_obj->title[$current['lang']])) {
$image_title = $image_selected_obj->title[$current['lang']];
}
}
return array($image_title, $image_description);
}
示例9: isNew
function isNew($msg)
{
static $sanswered = "";
if (strlen($sanswered) == 0) {
$sanswered = file_exists("data/answered") ? file::load("data/answered") : "";
}
return !preg_match("{" . preg_quote($msg->message_id) . "}s", $sanswered);
}
示例10: database
if (empty($_REQUEST['id'])) {
exit;
}
// create database connection
$DB = new database();
if (!$DB->connect()) {
exit;
}
if (empty($_SESSION['APP_USER#' . APP_UNIQUE])) {
exit;
}
$item = new file();
$id = $_REQUEST['id'];
if (!empty($_REQUEST['id'])) {
if (is_int($id)) {
$item->load($id);
} else {
$item->load($_REQUEST['id']);
}
}
if (!$item->id) {
echo 'Error: no item found with id ' . $_REQUEST['id'] . '.';
session_write_close();
$DB->disconnect();
// we don't need the database anymore (we'll see)
exit;
}
$website = new Website();
if (!empty($_GET['wid'])) {
$website->load(intval($_GET['wid']));
} else {
示例11: set_time_limit
<?php
require_once "prepend.php";
require_once "MailGrabber.php";
require_once "JSON.php";
set_time_limit(0);
$json = new Services_JSON();
$mailgrabber = new MailGrabber();
$mailgrabber->run($json->decode(file::load("data/config.ini")), true);
示例12: nvweb_list_parse_tag
function nvweb_list_parse_tag($tag, $item, $source = 'item', $item_relative_position, $item_absolute_position, $total)
{
global $current;
global $website;
global $structure;
global $DB;
$out = '';
switch ($tag['attributes']['source']) {
// special condition, return direct query result values
case 'query':
$out = $item->_query->{$tag}['attributes']['value'];
break;
// special: return element position in list
// special: return element position in list
case 'position':
$position = $item_relative_position;
if ($tag['attributes']['absolute'] == 'true') {
$position = $item_absolute_position;
}
switch ($tag['attributes']['type']) {
case 'alphabetic':
$out = number2alphabet($position);
break;
case 'numeric':
default:
$out = $position + 1;
// first element is 1, but in list is zero
break;
}
break;
// NOTE: the following refers to structure information of an ITEM, useless if the source are categories!
// NOTE: the following refers to structure information of an ITEM, useless if the source are categories!
case 'structure':
case 'category':
nvweb_menu_load_dictionary();
// load menu translations if not already done
nvweb_menu_load_routes();
// load menu paths if not already done
switch ($tag['attributes']['value']) {
case 'title':
if ($source == 'structure' || $source == 'category') {
$out = $structure['dictionary'][$item->id];
} else {
$out = $structure['dictionary'][$item->category];
}
if (!empty($tag['attributes']['length'])) {
$out = core_string_cut($out, $tag['attributes']['length'], '…');
}
break;
case 'slug':
if ($source == 'structure' || $source == 'category') {
$out = $structure['dictionary'][$item->id];
} else {
$out = $structure['dictionary'][$item->category];
}
// remove spaces, special chars, etc.
$out = core_string_clean($out);
$out = slug($out);
break;
case 'property':
$id = $item->id;
if ($source != 'structure' && $source != 'category') {
$id = $item->category;
}
$nvweb_properties_parameters = array_replace($tag['attributes'], array('mode' => !isset($tag['attributes']['mode']) ? 'structure' : $tag['attributes']['mode'], 'id' => $id, 'property' => !empty($tag['attributes']['property']) ? $tag['attributes']['property'] : $tag['attributes']['name']));
$out = nvweb_properties($nvweb_properties_parameters);
break;
case 'url':
case 'path':
if ($source == 'structure' || $source == 'category') {
$out = $structure['routes'][$item->id];
} else {
$out = $structure['routes'][$item->category];
}
$out = nvweb_prepare_link($out);
break;
case 'id':
if ($source == 'structure' || $source == 'category') {
$out = $item->id;
} else {
// source = 'item'?
$out = $item->category;
}
break;
default:
break;
}
break;
// ITEM comments
// ITEM comments
case 'comment':
case 'comments':
switch ($tag['attributes']['value']) {
case 'id':
$out = $item->id;
break;
case 'avatar':
$size = '48';
$extra = '';
if (!empty($tag['attributes']['size'])) {
//.........这里部分代码省略.........
示例13: nvweb_properties_render
//.........这里部分代码省略.........
break;
case 'image':
$add = '';
$extra = '';
if (@$property->multilanguage == 'true' || $property->multilanguage == '1') {
$image_id = $property->value[$session['lang']];
} else {
$image_id = $property->value;
}
if (isset($vars['width'])) {
$add .= ' width="' . $vars['width'] . '" ';
$extra .= '&width=' . $vars['width'];
}
if (isset($vars['height'])) {
$add .= ' height="' . $vars['height'] . '" ';
$extra .= '&height=' . $vars['height'];
}
if (isset($vars['border'])) {
$extra .= '&border=' . $vars['border'];
}
if (isset($vars['quality'])) {
$extra .= '&quality=' . $vars['quality'];
}
$img_url = NVWEB_OBJECT . '?type=image&id=' . $image_id . $extra;
if (empty($image_id)) {
$out = '';
} else {
if ($vars['return'] == 'url') {
$out = $img_url;
} else {
// retrieve additional info (title/alt), if available
if (is_numeric($image_id)) {
$f = new file();
$f->load($image_id);
$ftitle = $f->title[$current['lang']];
$falt = $f->description[$current['lang']];
if (!empty($ftitle)) {
$add .= ' title="' . $ftitle . '" ';
}
if (!empty($falt)) {
$add .= ' alt="' . $falt . '" ';
}
}
$out = '<img class="' . $vars['class'] . '" src="' . $img_url . '" ' . $add . ' />';
}
}
break;
case 'file':
if (!empty($property->value)) {
$file = $DB->query_single('name', 'nv_files', ' id = ' . protect($property->value) . ' AND website = ' . $website->id);
if ($vars['return'] == 'url' || $vars['return'] == 'url-download') {
$out = NVWEB_OBJECT . '?type=file&id=' . $property->value . '&disposition=attachment';
} else {
if ($vars['return'] == 'url-inline') {
$out = NVWEB_OBJECT . '?type=file&id=' . $property->value . '&disposition=inline';
} else {
$out = '<a href="' . NVWEB_OBJECT . '?type=file&id=' . $property->value . '&disposition=attachment">' . $file . '</a>';
}
}
}
break;
case 'comment':
$out = $property->value;
break;
case 'coordinates':
$coordinates = explode('#', $property->value);
示例14: dropbox
public function dropbox($name, $value = 0, $media = "", $disabled = false, $default_value = null, $options = array(), $website_id = null)
{
global $layout;
global $website;
global $theme;
if (empty($website_id)) {
$website_id = $website->id;
}
$out = array();
$out[] = '<div id="' . $name . '-droppable-wrapper" class="navigate-droppable-wrapper">';
$out[] = '<input type="hidden" id="' . $name . '" name="' . $name . '" value="' . $value . '" />';
$out[] = '<div id="' . $name . '-droppable" class="navigate-droppable ui-corner-all" data-media="' . $media . '">';
if (!empty($value)) {
if ($media == 'image') {
$f = new file();
$f->load($value);
$out[] = '<img title="' . $f->name . '" src="' . NAVIGATE_DOWNLOAD . '?wid=' . $website_id . '&id=' . $f->id . '&disposition=inline&width=75&height=75" />';
} else {
if ($media == 'video') {
$layout->add_script('
$(window).load(function() { navigate_dropbox_load_video("' . $name . '", "' . $value . '"); });
');
$out[] = '<figure class="navigatecms_loader"></figure>';
} else {
$f = new file();
$f->load($value);
$out[] = '<img title="' . $f->name . '" src="' . navibrowse::mimeIcon($f->mime, $f->type) . '" width="50" height="50" /><br />' . $f->name;
}
}
} else {
$out[] = ' <img src="img/icons/misc/dropbox.png" vspace="18" />';
}
$out[] = '</div>';
// set parent row as overflow:visible to let the whole contextmenu appear
$layout->add_script('
$(".navigate-droppable-wrapper").parent().css("overflow", "visible");
');
$contextmenu = false;
if (!$disabled) {
$out[] = '<div class="navigate-droppable-cancel"><img src="img/icons/silk/cancel.png" /></div>';
if ($media == 'image') {
if ($options == 'a:0:{}') {
$options = array();
}
if (empty($options) && !empty($default_value)) {
$options = array($default_value => t(199, "Default value"));
} else {
$options = (array) $options;
}
if (!empty($options)) {
$out[] = '
<div class="navigate-droppable-create">
<img src="img/icons/silk/add.png" />
</div>
';
// "create" context menu actions (image picker)
$ws = new website();
if ($website_id == $website->id) {
$ws = $website;
} else {
$ws->load($website_id);
}
$ws_theme = new theme();
if ($website_id == $website->id) {
$ws_theme = $theme;
} else {
$ws_theme->load($ws->theme);
}
$layout->add_content('
<ul id="' . $name . '-image_picker" class="navigate-image-picker navi-ui-widget-shadow">
' . implode("\n", array_map(function ($k, $v) use($website_id, $ws_theme) {
if (!empty($ws_theme)) {
$v = $ws_theme->t($v);
}
return '
<li data-value="' . $k . '" data-src="' . NAVIGATE_DOWNLOAD . '?wid=' . $website_id . '&id=' . $k . '&disposition=inline&width=75&height=75">
<a href="#">
<img title="' . $v . '" src="' . NAVIGATE_DOWNLOAD . '?wid=' . $website_id . '&id=' . $k . '&disposition=inline&width=48&height=48" />
<span>' . $v . '</span>
</a>
</li>
';
}, array_keys($options), array_values($options))) . '
</ul>
');
$layout->add_script('
$("#' . $name . '-droppable").parent().find(".navigate-droppable-create").on(
"click",
function(ev)
{
navigate_hide_context_menus();
setTimeout(function()
{
$("#' . $name . '-image_picker").menu();
$("#' . $name . '-image_picker").css({left: ev.pageX, top: ev.pageY});
$("#' . $name . '-image_picker").show();
if($("#' . $name . '-image_picker").position().top + $("#' . $name . '-image_picker").height() > $(window).height())
$("#' . $name . '-image_picker").css("top", $(window).height() - $("#' . $name . '-image_picker").height() - 8);
//.........这里部分代码省略.........
示例15: run
function run()
{
global $user;
global $layout;
global $DB;
global $website;
$out = '';
$item = new file();
switch ($_REQUEST['act']) {
case 1:
// json retrieval & operations
// json retrieval & operations
case "json":
if ($_REQUEST['op'] == 'upload') {
$tmp_name = $_REQUEST['tmp_name'];
if ($tmp_name == "{{BASE64}}") {
$tmp_name = base64_encode($_REQUEST['name']);
}
$file = file::register_upload($tmp_name, $_REQUEST['name'], $_REQUEST['parent']);
if (!empty($file)) {
echo json_encode(array('id' => $file->id, 'name' => $file->name));
} else {
echo json_encode(false);
}
}
switch ($_REQUEST['op']) {
case 'create_folder':
file::create_folder($_REQUEST['name'], $_REQUEST['mime'], $_REQUEST['parent']);
echo json_encode(true);
break;
case 'edit_folder':
$f = new file();
$f->load(intval($_REQUEST['id']));
$f->name = $_REQUEST['name'];
$f->mime = $_REQUEST['mime'];
$ok = $f->save();
echo json_encode($ok);
break;
case 'edit_file':
$f = new file();
$f->load(intval($_REQUEST['id']));
$f->name = $_REQUEST['name'];
$ok = $f->save();
echo json_encode($ok);
break;
case 'duplicate_file':
//error_reporting(~0);
//ini_set('display_errors', 1);
$status = false;
$f = new file();
$f->load(intval($_REQUEST['id']));
$f->id = 0;
$f->insert();
if (!empty($f->id)) {
$done = copy(NAVIGATE_PRIVATE . '/' . $website->id . '/files/' . intval($_REQUEST['id']), NAVIGATE_PRIVATE . '/' . $website->id . '/files/' . $f->id);
$status = "true";
if (!$done) {
$f->delete();
$status = t(56, "Unexpected error");
}
}
echo $status;
break;
case 'move':
if (is_array($_REQUEST['item'])) {
$ok = true;
for ($i = 0; $i < count($_REQUEST['item']); $i++) {
unset($item);
$item = new file();
$item->load($_REQUEST['item'][$i]);
$item->parent = $_REQUEST['folder'];
$ok = $ok & $item->update();
}
echo json_encode($ok ? true : false);
} else {
$item->load($_REQUEST['item']);
$item->parent = $_REQUEST['folder'];
echo json_encode($item->update());
}
break;
case 'delete':
try {
$item->load($_REQUEST['id']);
$status = $item->delete();
echo json_encode($status);
} catch (Exception $e) {
echo $e->getMessage();
}
break;
case 'permissions':
$item->load($_REQUEST['id']);
if (!empty($_POST)) {
$item->access = intval($_POST['access']);
$item->permission = intval($_POST['permission']);
$item->enabled = intval($_POST['enabled']);
$item->groups = $_POST['groups'];
if ($item->access < 3) {
$item->groups = array();
}
$status = $item->save();
//.........这里部分代码省略.........