本文整理汇总了PHP中fn_mkdir函数的典型用法代码示例。如果您正苦于以下问题:PHP fn_mkdir函数的具体用法?PHP fn_mkdir怎么用?PHP fn_mkdir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fn_mkdir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: downloadDistr
public static function downloadDistr()
{
// Get needed version
$version_info = self::GetNextVersionInfo();
if (!$version_info['next_version'] || !$version_info['update_url']) {
return false;
}
$download_file_dir = TWIGMO_UPGRADE_DIR . $version_info['next_version'] . '/';
$download_file_path = $download_file_dir . 'twigmo.tgz';
$unpack_path = $download_file_path . '_unpacked';
fn_rm($download_file_dir);
fn_mkdir($download_file_dir);
fn_mkdir($unpack_path);
$data = fn_get_contents($version_info['update_url']);
if (!fn_is_empty($data)) {
fn_put_contents($download_file_path, $data);
$res = fn_decompress_files($download_file_path, $unpack_path);
if (!$res) {
fn_set_notification('E', __('error'), __('twgadmin_failed_to_decompress_files'));
return false;
}
return $unpack_path . '/';
} else {
fn_set_notification('E', __('error'), __('text_uc_cant_download_package'));
return false;
}
}
示例2: generate
public function generate($force = false)
{
$filename = $this->getFileName();
if (!is_dir(dirname($filename))) {
fn_mkdir(dirname($filename));
}
if ($force) {
fn_rm($filename);
}
if (!file_exists($filename)) {
fn_set_progress('echo', __('generating_xls'), false);
$header = $data = array();
$currencies = Registry::get('currencies');
$currency = $currencies[CART_SECONDARY_CURRENCY];
$currency_format = '#' . $currency['thousands_separator'] . '##0.' . str_repeat('0', $currency['decimals']);
$currency_format = $currency['after'] == 'Y' ? $currency_format . $currency['symbol'] : $currency['symbol'] . $currency_format;
foreach ($this->selected_fields as $field_id => $field_value) {
$header[$this->price_schema['fields'][$field_id]['title']] = $field_id == 'price' ? $currency_format : 'string';
}
$this->writer->writeSheetHeader($this->sheet, $header);
$this->render();
$this->writer->writeToFile($filename);
}
return $filename;
}
示例3: smarty_function_script
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
function smarty_function_script($params, &$smarty)
{
static $scripts = array();
static $packer_loaded = false;
/*if (!empty($params['include'])) {
return implode("\n", $scripts);
}*/
if (!isset($scripts[$params['src']])) {
$path = Registry::get('config.current_path');
if (Registry::get('config.tweaks.js_compression') == true && strpos($params['src'], 'lib/') === false) {
if (!file_exists(DIR_CACHE . $params['src'])) {
if ($packer_loaded == false) {
include_once DIR_LIB . 'packer/class.JavaScriptPacker.php';
$packer_loaded = true;
}
fn_mkdir(dirname(DIR_CACHE . $params['src']));
$packer = new JavaScriptPacker(fn_get_contents(DIR_ROOT . '/' . $params['src']));
fn_put_contents(DIR_CACHE . $params['src'], $packer->pack());
}
$path = Registry::get('config.cache_path');
}
$scripts[$params['src']] = '<script type="text/javascript" src="' . $path . '/' . $params['src'] . '"></script>';
// If output is captured, don't print script tag in the buffer, it will be printed directly to the screen
if (!empty($smarty->_in_capture)) {
$buff = array_pop($smarty->_in_capture);
$smarty->_in_capture[] = $buff;
$smarty->_scripts[$buff][] = $scripts[$params['src']];
return '';
}
return $scripts[$params['src']];
}
}
示例4: __construct
public function __construct($config)
{
$this->_config = array('store_prefix' => !empty($config['store_prefix']) ? $config['store_prefix'] : null, 'dir_cache' => $config['dir']['cache_registry']);
if (fn_mkdir($this->_mapTags('')) == false) {
throw new PermissionsException('Cache: "' . $this->_mapTags('') . '" directory is not writable');
}
parent::__construct($config);
return true;
}
示例5: init
static function init()
{
if (!is_dir(DIR_CACHE)) {
fn_mkdir(DIR_CACHE);
}
$ch = fn_get_contents(DIR_CACHE . self::$_handlers_name);
self::$_cache_handlers = !empty($ch) ? @unserialize($ch) : array();
return true;
}
示例6: export
/**
* Copy file outside the storage
*
* @param string $src file path in storage
* @param string $dest path to local file
* @return int number of bytes copied
*/
public function export($src, $dest)
{
if (!fn_mkdir(dirname($dest))) {
return false;
}
$res = $this->s3()->get_object($this->getOption('bucket'), $this->prefix($src), array('fileDownload' => $dest));
if ($res->isOK()) {
return true;
}
return false;
}
示例7: generate
public function generate($filename)
{
@ignore_user_abort(1);
@set_time_limit(0);
fn_mkdir(dirname($filename));
$file = fopen($filename, 'wb');
$this->head($file);
$this->body($file);
$this->bottom($file);
fclose($file);
}
示例8: __construct
public function __construct($format = 'csv', $price_id = 0)
{
$this->format = $format;
$this->price_id = $price_id;
$this->filename = 'log_tmp_' . $price_id . '.' . $this->format;
$this->path = fn_get_files_dir_path() . 'yml/logs/';
fn_mkdir($this->path);
$file_is_new = !file_exists($this->path . $this->filename);
$this->file = fopen($this->path . $this->filename, 'ab');
if ($file_is_new && $this->format == 'csv') {
fwrite($this->file, 'Type; Object ID; Message;' . PHP_EOL);
}
}
示例9: __construct
public function __construct()
{
$this->filename = 'log_commerceml.txt';
list($this->path, $url_commerceml, $url_images) = RusEximCommerceml::getDirCommerceML();
if (!is_dir($this->path)) {
fn_mkdir($this->path);
@chmod($this->path, 0777);
}
$file_is_new = !file_exists($this->path . $this->filename);
$this->file = fopen($this->path . $this->filename, 'ab');
if ($file_is_new) {
fwrite($this->file, 'Message: ' . PHP_EOL);
@chmod($this->file, 0777);
}
}
示例10: save
/**
* Saves uploaded pattern to theme
* @param string $style_id style ID
* @param array $style style
* @param array $uploaded_data uploaded data
* @return array modified style
*/
public static function save($style_id, $style, $uploaded_data)
{
$style_id = fn_basename($style_id);
$patterns = self::getPath($style_id);
if (!is_dir($patterns)) {
fn_mkdir($patterns);
}
foreach ($uploaded_data as $var => $file) {
$fname = $var . '.' . fn_get_file_ext($file['name']);
if (fn_copy($file['path'], $patterns . '/' . $fname)) {
$style['data'][$var] = "url('" . self::getRelPath($style_id) . '/' . $fname . '?' . TIME . "')";
}
}
return $style;
}
示例11: downloadPackage
public function downloadPackage($schema, $package_path)
{
if (!empty($schema['download_key'])) {
$upgrade_path = $this->settings['packages_server'] . $this->settings['addon'] . '/' . $schema['file'];
$addon_upgrades_dir = Registry::get('config.dir.addons') . $this->settings['addon'] . '/upgrades/';
$addon_upgrades_path = $addon_upgrades_dir . $schema['file'];
if (!file_exists($addon_upgrades_path)) {
fn_mkdir($addon_upgrades_dir);
$addon_upgrade_data = fn_get_contents($upgrade_path);
fn_put_contents($addon_upgrades_path, $addon_upgrade_data);
}
$result = fn_copy($addon_upgrades_path, $package_path);
if ($result) {
fn_rm($addon_upgrades_path);
}
//cleanup
$message = $result ? '' : __('failed') . '-' . $addon_upgrades_path;
return array($result, $message);
} else {
return array(false, __($schema['error_message']));
}
}
示例12: generate
public function generate($force = false)
{
$filename = $this->getFileName();
if (!is_dir(dirname($filename))) {
fn_mkdir(dirname($filename));
}
if ($force) {
fn_rm($filename);
}
// Min column width in percent
$min_width = array('product' => 50, 'product_code' => 13, 'image' => 10);
if (!file_exists($filename)) {
$max_perc = 100;
$field_count = count($this->selected_fields);
// First step. Check for the min width.
$perc = intval($max_perc / $field_count);
foreach ($this->selected_fields as $field_name => $active) {
if (isset($min_width[$field_name])) {
if ($min_width[$field_name] > $perc) {
$max_perc -= $min_width[$field_name];
$field_count--;
}
}
}
// Second step. Set up the new width values.
$perc = intval($max_perc / $field_count);
foreach ($this->selected_fields as $field_name => $active) {
if (!isset($min_width[$field_name]) || $min_width[$field_name] < $perc) {
$this->price_schema['fields'][$field_name]['min_width'] = $perc;
} else {
$this->price_schema['fields'][$field_name]['min_width'] = $min_width[$field_name];
}
}
fn_set_progress('echo', __('generating_pdf'), false);
$this->render();
}
return $filename;
}
示例13: fn_sdek_get_ticket_order
function fn_sdek_get_ticket_order($data_auth, $order_id, $chek_id)
{
unset($data_auth['Number']);
$xml = ' ' . RusSdek::arraySimpleXml('OrdersPrint', $data_auth, 'open');
$order_sdek = array('Number' => $order_id . '_' . $chek_id, 'Date' => $data_auth['Date']);
$xml .= ' ' . RusSdek::arraySimpleXml('Order', $order_sdek);
$xml .= ' ' . '</OrdersPrint>';
$response = RusSdek::xmlRequest('http://gw.edostavka.ru:11443/orders_print.php', $xml, $data_auth);
$download_file_dir = fn_get_files_dir_path() . '/sdek' . '/' . $chek_id . '/';
fn_rm($download_file_dir);
fn_mkdir($download_file_dir);
$name = $order_id . '.pdf';
$download_file_path = $download_file_dir . $name;
if (!fn_is_empty($response)) {
fn_put_contents($download_file_path, $response);
}
}
示例14: die
die('Access denied');
}
if (Registry::get('config.demo_mode')) {
// ElFinder should not work in demo mode
$message = json_encode(array('error' => __('error_demo_mode')));
exit($message);
}
if (AREA == 'C') {
if (!Registry::get('runtime.customization_mode.live_editor')) {
die('Access denied');
}
}
$private_files_path = fn_get_files_dir_path();
$public_files_path = fn_get_public_files_path();
fn_mkdir($private_files_path);
fn_mkdir($public_files_path);
$start_path = '';
if (!empty($_REQUEST['init']) && !empty($_REQUEST['start_path'])) {
unset($_GET['target']);
$start_path = fn_normalize_path($private_files_path . $_REQUEST['start_path']);
if (strpos($start_path, $private_files_path) !== 0) {
$start_path = '';
}
}
$extra_path = str_replace(Storage::instance('images')->getAbsolutePath(''), '', $public_files_path);
$opts = array('roots' => array(array('driver' => 'Tygh\\ElFinder\\Volume', 'uploadDeny' => Registry::get('config.forbidden_mime_types'), 'fileMode' => DEFAULT_FILE_PERMISSIONS, 'dirMode' => DEFAULT_DIR_PERMISSIONS, 'uploadMaxSize' => Bootstrap::getIniParam('upload_max_filesize', true), 'alias' => __('private_files'), 'tmbPath' => '', 'path' => $private_files_path, 'startPath' => $start_path, 'mimeDetect' => 'internal', 'archiveMimes' => array('application/zip'), 'icon' => Registry::get('config.current_location') . '/js/lib/elfinder/img/volume_icon_local.png'), array('driver' => 'Tygh\\ElFinder\\Volume', 'uploadDeny' => Registry::get('config.forbidden_mime_types'), 'fileMode' => DEFAULT_FILE_PERMISSIONS, 'dirMode' => DEFAULT_DIR_PERMISSIONS, 'uploadMaxSize' => Bootstrap::getIniParam('upload_max_filesize', true), 'alias' => __('public_files'), 'tmbPath' => '', 'path' => $public_files_path, 'URL' => Storage::instance('images')->getUrl($extra_path), 'mimeDetect' => 'internal', 'archiveMimes' => array('application/zip'), 'icon' => Registry::get('config.current_location') . '/js/lib/elfinder/img/volume_icon_local.png')));
if ($mode == 'images') {
unset($opts['roots'][0]);
}
$connector = new \elFinderConnector(new Core($opts));
$connector->run();
示例15: substr
$rub = substr($for_rub, 0, -$length_for_rub);
$length_for_kop = $currency['decimals'];
$kop = substr($for_rub, -$length_for_kop);
$total_print = '<strong>' . $rub . '</strong> ' . __("sbrf_rub") . ' <strong>' . $kop . '</strong> ' . __("sbrf_kop");
} else {
$total_print = '<strong>' . $for_rub . '</strong> ' . __("sbrf_rub");
}
} else {
$total_print = fn_format_price_by_currency($order_info['total']);
}
$view = Tygh::$app['view'];
$view->assign('total_print', $total_print);
$view->assign('order_info', $order_info);
$view->assign('fonts_path', fn_get_theme_path('[relative]/[theme]/media/fonts'));
$temp_dir = Registry::get('config.dir.cache_misc') . 'tmp/';
fn_mkdir($temp_dir);
$path = fn_qr_generate($order_info, '|', $temp_dir);
$url_qr_code = Registry::get('config.http_location') . '/' . fn_get_rel_dir($path);
$view->assign('url_qr_code', $url_qr_code);
if ($mode == "send_sbrf_receipt") {
if (!empty($order_info['email'])) {
fn_disable_live_editor_mode();
$html = array($view->displayMail('addons/rus_payments/print_sbrf_receipt.tpl', false, 'C'));
Pdf::render($html, fn_get_files_dir_path() . 'sberbank_receipt.pdf', 'save');
$data = array('order_info' => $order_info, 'total_print' => $total_print, 'fonts_path' => fn_get_theme_path('[relative]/[theme]/media/fonts'), 'url_qr_code' => $url_qr_code, 'email_subj' => __("sbrf_receipt_for_payment", array('[order_id]' => $order_info['order_id'])));
Mailer::sendMail(array('to' => $order_info['email'], 'from' => 'default_company_orders_department', 'data' => $data, 'attachments' => array(fn_get_files_dir_path() . 'sberbank_receipt.pdf'), 'tpl' => 'addons/rus_payments/print_sbrf_receipt.tpl', 'is_html' => true), 'A');
fn_set_notification('N', __('notice'), __('text_email_sent'));
}
} else {
$view->assign('show_print_button', true);
$view->displayMail('addons/rus_payments/print_sbrf_receipt.tpl', true, 'C');