本文整理汇总了PHP中wpl_global::get_upload_base_url方法的典型用法代码示例。如果您正苦于以下问题:PHP wpl_global::get_upload_base_url方法的具体用法?PHP wpl_global::get_upload_base_url怎么用?PHP wpl_global::get_upload_base_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wpl_global
的用法示例。
在下文中一共展示了wpl_global::get_upload_base_url方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upload
public function upload()
{
/** import upload library **/
_wpl_import('assets.packages.ajax_uploader.UploadHandler');
$kind = wpl_request::getVar('kind', 0);
$params = array();
$params['accept_ext'] = wpl_flex::get_field_options(301);
$extentions = explode(',', $params['accept_ext']['ext_file']);
$ext_str = '';
foreach ($extentions as $extention) {
$ext_str .= $extention . '|';
}
// remove last |
$ext_str = substr($ext_str, 0, -1);
$ext_str = rtrim($ext_str, ';');
$custom_op = array('upload_dir' => wpl_global::get_upload_base_path(), 'upload_url' => wpl_global::get_upload_base_url(), 'accept_file_types' => '/\\.(' . $ext_str . ')$/i', 'max_file_size' => $params['accept_ext']['file_size'] * 1000, 'min_file_size' => 1, 'max_number_of_files' => null);
$upload_handler = new UploadHandler($custom_op);
$response = json_decode($upload_handler->json_response);
if (isset($response->files[0]->error)) {
return;
}
$attachment_categories = wpl_items::get_item_categories('attachment', $kind);
// get item category with first index
$item_cat = reset($attachment_categories)->category_name;
$index = floatval(wpl_items::get_maximum_index(wpl_request::getVar('pid'), wpl_request::getVar('type'), $kind, $item_cat)) + 1.0;
$item = array('parent_id' => wpl_request::getVar('pid'), 'parent_kind' => $kind, 'item_type' => wpl_request::getVar('type'), 'item_cat' => $item_cat, 'item_name' => $response->files[0]->name, 'creation_date' => date("Y-m-d H:i:s"), 'index' => $index);
wpl_items::save($item);
}
示例2: get_qr_image
public function get_qr_image($qrfile_prefix = 'qr_', $size = 4, $outer_margin = 2)
{
$url = wpl_global::get_full_url();
$file_name = $qrfile_prefix . md5($url) . '.png';
$file_path = wpl_global::get_upload_base_path() . 'qrcode' . DS . $file_name;
if (!wpl_file::exists($file_path)) {
if (!wpl_file::exists(dirname($file_path))) {
wpl_folder::create(dirname($file_path));
}
$QRcode = new QRcode();
$QRcode->png($url, $file_path, 'L', $size, $outer_margin);
}
return wpl_global::get_upload_base_url() . 'qrcode/' . $file_name;
}
示例3: get_folder
/**
* Returns item directory URL
* @author Howard R <howard@realtyna.com>
* @static
* @param int $parent_id
* @param int $kind
* @return string
*/
public static function get_folder($parent_id, $kind = 0)
{
if ($kind == 2) {
return wpl_global::get_upload_base_url() . 'users/' . $parent_id . '/';
} else {
return wpl_global::get_upload_base_url() . $parent_id . '/';
}
}