本文整理汇总了PHP中Files::delete_file方法的典型用法代码示例。如果您正苦于以下问题:PHP Files::delete_file方法的具体用法?PHP Files::delete_file怎么用?PHP Files::delete_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Files
的用法示例。
在下文中一共展示了Files::delete_file方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filter_images
/**
* return formated files and delete updated files
*/
public function filter_images($entries_files = null, $field_files = null)
{
$this->CI->load->library('files/files');
if ($entries_files) {
$entries_parts = explode('|', $entries_files);
$field_parts = explode('|', $field_files);
if (is_array($entries_parts) && count($entries_parts) > 0) {
foreach ($entries_parts as $field) {
if (!in_array($field, (array) $field_parts)) {
Files::delete_file($field);
}
}
return $field_parts;
}
return null;
} else {
return null;
}
}
示例2: delete_file
/**
* Delete a file
*
* @access public
* @return void
*/
public function delete_file()
{
// this is just a safeguard if they circumvent the JS permissions
if (!in_array('delete_file', Files::allowed_actions())) {
show_error(lang('files:no_permissions'));
}
if ($id = $this->input->post('file_id')) {
$result = Files::delete_file($id);
$result['status'] and Events::trigger('file_deleted', $id);
echo json_encode($result);
}
}
示例3: delete_product
/**
* Deletes a product, the images and Files folder related to it.
*
* @param integer $id The Product ID to delete
* @return boolean TRUE or FALSE on success of failure
* @access public
*/
public function delete_product($id)
{
$product = $this->get_product($id);
if ($this->db->delete('firesale_products', array('id' => $id))) {
// Remove files folder
if ($product !== FALSE) {
$folder = $this->get_file_folder_by_slug($product->slug);
if ($folder != FALSE) {
$images = Files::folder_contents($folder->id);
$images = $images['data']['file'];
foreach ($images as $image) {
Files::delete_file($image->id);
}
Files::delete_folder($folder->id);
}
}
return TRUE;
} else {
return FALSE;
}
}
示例4: save_gallery_images
/**
* Save / Upload gallery images
*
* @param string $type insert|update
* @param int $gallery_id
* @return bool
*/
private function save_gallery_images($type = 'insert', $gallery_id)
{
if (!is_numeric($gallery_id)) {
return FALSE;
}
$folder_id = $this->gallery_m->get($gallery_id)->folder_id;
$max_images = $this->input->post('max_images');
$image_name = $this->current_user->username . "Image ";
$img_data = NULL;
$img_id = array();
for ($i = 1; $i <= $max_images; $i++) {
$img = Files::upload($folder_id, $image_name . $i, $field = 'image' . $i, $width = 800, $height = 800, $ratio = TRUE);
if ($img['status'] === TRUE) {
$img_data = array('gallery_id' => $gallery_id, 'file_id' => $img['data']['id']);
if ($file_id = $this->input->post('image' . $i)) {
Files::delete_file($file_id);
$img_id[] = $this->gallery_image_m->update_by('file_id', $file_id, $img_data);
} else {
$img_id[] = $this->gallery_image_m->insert($img_data);
}
}
}
return count($img_id);
}
示例5: Files
<?php
require 'checkallowed.php';
// No direct access
$url_id = $GPXIN['id'];
$url_do = $GPXIN['do'];
$file_name = $GPXIN['file'];
require DOCROOT . '/includes/classes/files.php';
$Files = new Files();
// Delete a file
if ($url_do == 'delete') {
echo $Files->delete_file($url_id, $file_name);
} elseif ($url_do == 'delete_dir') {
echo $Files->delete_dir($url_id, $file_name);
} elseif ($url_do == 'savecontent') {
if (empty($url_id) || empty($file_name)) {
die('No ID or filename given!');
}
$file_content = $GPXIN['content'];
echo $Files->save_file($url_id, $file_name, $file_content);
exit;
} elseif ($url_do == 'show_addfile') {
echo '<b>' . $lang['new_filename'] . ':</b> <input type="text" class="inputs" id="newfilename" /><br />
<textarea id="filecontent" class="txteditor" style="width:715px;height:370px;white-space:pre;"></textarea><br />
<div align="center"><div class="button" onClick="javascript:file_savenewfile(' . $url_id . ');">' . $lang['save'] . '</div></div>';
exit;
} elseif ($url_do == 'show_add_dir') {
echo '<b>' . $lang['new_dirname'] . ':</b> <input type="text" class="inputs" id="new_dirname" /><br />
<div align="center"><div class="button" onClick="javascript:file_add_newdir(' . $url_id . ');">' . $lang['save'] . '</div></div>';
exit;
} elseif ($url_do == 'create_newdir') {
示例6: delete_file
/**
* Delete a file
*
* @access public
* @return void
*/
public function delete_file()
{
// this is just a safeguard if they circumvent the JS permissions
if (!in_array('delete_file', Files::allowed_actions())) {
show_error(lang('files:no_permissions'));
}
if ($id = $this->input->post('file_id')) {
echo json_encode(Files::delete_file($id));
}
}
示例7: field_assignment_destruct
/**
* Deletes the table and clean files
* @param type $field
* @param type $stream
*/
public function field_assignment_destruct($field, $stream)
{
$this->CI->load->library('files/files');
$table_data = $this->_table_data($field, $stream);
/** first lets get the images that we need to delete * */
$rows = $this->CI->db->get($table_data->table)->result();
/** lets remove the files * */
foreach ($rows as $r) {
Files::delete_file($r->{$table_data->file_id_column});
}
/** Drop the table! * */
$this->CI->dbforge->drop_table($table_data->table);
}