本文整理汇总了PHP中Files::list_for_anchor_and_name方法的典型用法代码示例。如果您正苦于以下问题:PHP Files::list_for_anchor_and_name方法的具体用法?PHP Files::list_for_anchor_and_name怎么用?PHP Files::list_for_anchor_and_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Files
的用法示例。
在下文中一共展示了Files::list_for_anchor_and_name方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sprintf
$file_path = Files::get_path($_REQUEST['anchor']);
// update an existing file record
if (isset($item['id'])) {
Files::set_uploaded('upload', 'id', $item['id']);
}
// attach some file
if ($uploaded = Files::upload(Files::get_uploaded('upload'), $file_path, $anchor->get_reference(), $overlay)) {
// actually, a new file
if (!isset($item['id'])) {
$action = 'file:create';
} else {
$action = 'file:upload';
}
// several files have been added
if (is_array($uploaded)) {
$compact_list = Skin::build_list(Files::list_for_anchor_and_name($anchor->get_reference(), $uploaded, 'compact'), 'compact');
$context['text'] .= '<p>' . i18n::s('Following files have been added:') . '</p>' . $compact_list;
// log multiple upload
$label = sprintf(i18n::c('New files in %s'), strip_tags($anchor->get_title()));
Logger::notify('files/edit.php: ' . $label, $compact_list);
// push the list of uploaded files to the notification
$attributes = array();
$attributes['message'] = '<p>' . i18n::s('Following files have been added:') . '</p>' . $compact_list;
$attributes['anchor'] = $anchor->get_reference();
// notification to send by e-mail
$mail = array();
$mail['subject'] = sprintf(i18n::c('%s: %s'), i18n::c('Contribution'), strip_tags($anchor->get_title()));
$mail['notification'] = Files::build_notification('multiple', $attributes);
// one file has been added
} elseif ($item =& Files::get_by_anchor_and_name($anchor->get_reference(), $uploaded)) {
$context['text'] .= '<p>' . i18n::s('Following file has been added:') . '</p>' . Codes::render_object('file', $item['id']);
示例2: elseif
} elseif (Surfer::is_empowered()) {
$context['text'] .= i18n::s('<p>Don\'t forget to publish the new page someday. Review the page, enhance it and then click on the Publish command to make it publicly available.</p>');
} elseif (isset($context['users_with_auto_publish']) && $context['users_with_auto_publish'] == 'Y' || is_object($anchor) && $anchor->has_option('auto_publish')) {
$context['text'] .= i18n::s('<p>Don\'t forget to publish the new page someday. Review the page, enhance it and then click on the Publish command to make it publicly available.</p>');
} else {
$context['text'] .= i18n::s('<p>The new page will now be reviewed before its publication. It is likely that this will be done within the next 24 hours at the latest.</p>');
}
if (!isset($_REQUEST['first_comment'])) {
$_REQUEST['first_comment'] = '';
}
// attach some file
$file_path = Files::get_path('article:' . $_REQUEST['id']);
if (isset($_FILES['upload']) && ($uploaded = Files::upload($_FILES['upload'], $file_path, 'article:' . $_REQUEST['id']))) {
// several files have been added
if (is_array($uploaded)) {
$_REQUEST['first_comment'] .= '<div>' . Skin::build_list(Files::list_for_anchor_and_name('article:' . $_REQUEST['id'], $uploaded, 'compact'), 'compact') . '</div>';
} elseif ($file =& Files::get_by_anchor_and_name('article:' . $_REQUEST['id'], $uploaded)) {
$_REQUEST['first_comment'] .= '<div>' . Codes::render_object('file', $file['id']) . '</div>';
// silently delete the previous file if the name has changed
if (isset($file['file_name']) && $file['file_name'] != $uploaded) {
Safe::unlink($file_path . '/' . $file['file_name']);
}
}
}
// capture first comment too
if (isset($_REQUEST['first_comment']) && $_REQUEST['first_comment']) {
include_once $context['path_to_root'] . 'comments/comments.php';
$fields = array();
$fields['anchor'] = 'article:' . $_REQUEST['id'];
$fields['description'] = $_REQUEST['first_comment'];
Comments::post($fields);
示例3: elseif
$_REQUEST['create_id'] = $newest['create_id'];
$_REQUEST['create_name'] = $newest['create_name'];
$_REQUEST['description'] = $newest['description'] . BR . $_REQUEST['description'];
$_REQUEST['previous_id'] = $newest['previous_id'];
$_REQUEST['type'] = $newest['type'];
}
// attach some file
$file_path = Files::get_path($anchor->get_reference());
if (isset($_FILES['upload']) && ($uploaded = Files::upload($_FILES['upload'], $file_path, $anchor->get_reference()))) {
// sanity check
if (!$_REQUEST['description']) {
$_REQUEST['description'] = '';
}
// several files have been added
if (is_array($uploaded)) {
$_REQUEST['description'] .= '<div style="margin-top: 1em;">' . Skin::build_list(Files::list_for_anchor_and_name($anchor->get_reference(), $uploaded, 'compact'), 'compact') . '</div>';
} elseif ($file =& Files::get_by_anchor_and_name($anchor->get_reference(), $uploaded)) {
$_REQUEST['description'] .= '<div style="margin-top: 1em;">[file=' . $file['id'] . ',' . $file['file_name'] . ']</div>';
// silently delete the previous file if the name has changed
if (isset($file['file_name']) && $file['file_name'] != $uploaded) {
Safe::unlink($file_path . '/' . $file['file_name']);
}
}
}
// preview mode
if (isset($_REQUEST['preview']) && $_REQUEST['preview'] == 'Y') {
$item = $_REQUEST;
$with_form = TRUE;
// display the form on error
} elseif (!($_REQUEST['id'] = Comments::post($_REQUEST))) {
$item = $_REQUEST;