本文整理汇总了PHP中ProductDownload::checkWritableDir方法的典型用法代码示例。如果您正苦于以下问题:PHP ProductDownload::checkWritableDir方法的具体用法?PHP ProductDownload::checkWritableDir怎么用?PHP ProductDownload::checkWritableDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProductDownload
的用法示例。
在下文中一共展示了ProductDownload::checkWritableDir方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayFormInformations
//.........这里部分代码省略.........
var required = \'' . $this->l('required') . '\';
var customizationUploadableFileNumber = ' . intval($this->getFieldValue($obj, 'uploadable_files')) . ';
var customizationTextFieldNumber = ' . intval($this->getFieldValue($obj, 'text_fields')) . ';
var uploadableFileLabel = 0;
var textFieldLabel = 0;
var defaultLanguage = ' . intval($defaultLanguage) . ';
var languages = new Array();';
$i = 0;
foreach ($languages as $language) {
echo 'languages[' . $i++ . '] = new Array(' . intval($language['id_lang']) . ', \'' . $language['iso_code'] . '\', \'' . htmlentities($language['name'], ENT_COMPAT, 'UTF-8') . '\');' . "\n";
}
echo '
</script>';
?>
<tr>
<td colspan="2">
<input type="checkbox" id="is_virtual_good" name="is_virtual_good" value="true" onchange="toggleVirtualProduct(this)" onclick="toggleVirtualProduct(this);" <?php
if (($productDownload->id or Tools::getValue('is_virtual_good') == 'true') and $productDownload->active) {
echo 'checked="checked"';
}
?>
/>
<label for="is_virtual_good" class="t bold"><?php
echo $this->l('Is this a downloadable product?');
?>
</label>
<div id="virtual_good" <?php
if (!$productDownload->id or !$productDownload->active) {
echo 'style="display:none;"';
}
?>
>
<?php
if (!ProductDownload::checkWritableDir()) {
?>
<p class="alert">
<?php
echo $this->l('Your download repository is not writable.');
?>
<br/>
<?php
echo realpath(_PS_DOWNLOAD_DIR_);
?>
</p>
<?php
} else {
?>
<?php
if ($productDownload->id) {
echo '<input type="hidden" id="virtual_product_id" name="virtual_product_id" value="' . $productDownload->id . '" />';
}
?>
<p class="block">
<?php
if (!$productDownload->checkFile()) {
?>
<?php
if ($productDownload->id) {
?>
<p class="alert">
<?php
echo $this->l('This product is missing');
?>
:<br/>
<?php
echo realpath(_PS_DOWNLOAD_DIR_) . '/' . $productDownload->physically_filename;
示例2: displayFormInformations
//.........这里部分代码省略.........
</script>
<?php
echo '
<script type="text/javascript" src="../js/price.js"></script>
<script type="text/javascript">
var newLabel = \'' . $this->l('New label') . '\';
var choose_language = \'' . $this->l('Choose language:') . '\';
var required = \'' . $this->l('required') . '\';
var customizationUploadableFileNumber = ' . (int) $this->getFieldValue($obj, 'uploadable_files') . ';
var customizationTextFieldNumber = ' . (int) $this->getFieldValue($obj, 'text_fields') . ';
var uploadableFileLabel = 0;
var textFieldLabel = 0;
</script>';
?>
<tr>
<td colspan="2">
<p><input type="checkbox" id="is_virtual_good" name="is_virtual_good" value="true" onclick="toggleVirtualProduct(this);" <?php
if (($productDownload->id or Tools::getValue('is_virtual_good') == 'true') and $productDownload->active) {
echo 'checked="checked"';
}
?>
/>
<label for="is_virtual_good" class="t bold" style="color: black;"><?php
echo $this->l('Is this a downloadable product?');
?>
</label></p>
<div id="virtual_good" <?php
if (!$productDownload->id or !$productDownload->active) {
echo 'style="display:none;"';
}
?>
>
<?php
if (!ProductDownload::checkWritableDir()) {
?>
<p class="alert">
<?php
echo $this->l('Your download repository is not writable.');
?>
<br/>
<?php
echo realpath(_PS_DOWNLOAD_DIR_);
?>
</p>
<?php
} else {
?>
<?php
if ($productDownload->id) {
echo '<input type="hidden" id="virtual_product_id" name="virtual_product_id" value="' . $productDownload->id . '" />';
}
?>
<p class="block">
<?php
if (!$productDownload->checkFile()) {
?>
<div style="padding:5px;width:50%;float:left;margin-right:20px;border-right:1px solid #E0D0B1">
<?php
if ($productDownload->id) {
?>
<p class="alert" id="file_missing">
<?php
echo $this->l('This product is missing');
?>
:<br/>
示例3: initFormVirtualProduct
public function initFormVirtualProduct($product)
{
$data = $this->createTemplate($this->tpl_form);
$currency = $this->context->currency;
/*
* Form for adding a virtual product like software, mp3, etc...
*/
$product_download = new ProductDownload();
if ($id_product_download = $product_download->getIdFromIdProduct($this->getFieldValue($product, 'id'))) {
$product_download = new ProductDownload($id_product_download);
}
$product->{'productDownload'} = $product_download;
// @todo handle is_virtual with the value of the product
$exists_file = realpath(_PS_DOWNLOAD_DIR_) . '/' . $product->productDownload->filename;
$data->assign('product_downloaded', $product->productDownload->id && !empty($product->productDownload->display_filename));
if (!file_exists($exists_file) && !empty($product->productDownload->display_filename) && empty($product->cache_default_attribute)) {
$msg = sprintf(Tools::displayError('This file "%s" is missing.'), $product->productDownload->display_filename);
} else {
$msg = '';
}
$data->assign('download_product_file_missing', $msg);
$data->assign('download_dir_writable', ProductDownload::checkWritableDir());
$data->assign('up_filename', strval(Tools::getValue('virtual_product_filename')));
$product->productDownload->nb_downloadable = $product->productDownload->id > 0 ? $product->productDownload->nb_downloadable : htmlentities(Tools::getValue('virtual_product_nb_downloable'), ENT_COMPAT, 'UTF-8');
$product->productDownload->date_expiration = $product->productDownload->id > 0 ? !empty($product->productDownload->date_expiration) && $product->productDownload->date_expiration != '0000-00-00 00:00:00' ? date('Y-m-d', strtotime($product->productDownload->date_expiration)) : '' : htmlentities(Tools::getValue('virtual_product_expiration_date'), ENT_COMPAT, 'UTF-8');
$product->productDownload->nb_days_accessible = $product->productDownload->id > 0 ? $product->productDownload->nb_days_accessible : htmlentities(Tools::getValue('virtual_product_nb_days'), ENT_COMPAT, 'UTF-8');
$product->productDownload->is_shareable = $product->productDownload->id > 0 && $product->productDownload->is_shareable;
$data->assign('ad', dirname($_SERVER['PHP_SELF']));
$data->assign('product', $product);
$data->assign('token', $this->token);
$data->assign('currency', $currency);
$data->assign($this->tpl_form_vars);
$data->assign('link', $this->context->link);
$data->assign('is_file', $product->productDownload->checkFile());
$this->tpl_form_vars['product'] = $product;
$this->tpl_form_vars['custom_form'] = $data->fetch();
}
示例4: initContentVirtualProduct
public function initContentVirtualProduct()
{
$ifqrqnfl = "id_product_download";
$satpetgggdq = "product";
$uvtmgqwfb = "product_download";
$odpjsjcw = "product_download";
${"GLOBALS"}["dixhgmcc"] = "id_product_download";
$epxbkxu = "currency";
${$satpetgggdq} = $this->object;
${$epxbkxu} = new Currency((int) Configuration::get("PS_CURRENCY_DEFAULT"));
${$uvtmgqwfb} = new ProductDownload();
if (${$ifqrqnfl} = $product_download->getIdFromIdProduct($this->getFieldValue(${${"GLOBALS"}["vmqqtmkyw"]}, "id"))) {
${$odpjsjcw} = new ProductDownload(${${"GLOBALS"}["dixhgmcc"]});
}
$product->{"productDownload"} = ${${"GLOBALS"}["pctudmr"]};
$product->cache_default_attribute = (int) Product::getDefaultAttribute($product->id);
${${"GLOBALS"}["nnybqqo"]} = realpath(_PS_DOWNLOAD_DIR_) . "/" . $product->productDownload->filename;
self::$smarty->assign("product_downloaded", $product->productDownload->id && !empty($product->productDownload->display_filename));
if (!file_exists(${${"GLOBALS"}["nnybqqo"]}) && !empty($product->productDownload->display_filename) && empty($product->cache_default_attribute)) {
${${"GLOBALS"}["ygidwjibrt"]} = sprintf(Tools::displayError("This file \"%s\" is missing"), $product->productDownload->display_filename);
} else {
${${"GLOBALS"}["ygidwjibrt"]} = "";
}
self::$smarty->assign("download_product_file_missing", ${${"GLOBALS"}["ygidwjibrt"]});
self::$smarty->assign("download_dir_writable", ProductDownload::checkWritableDir());
self::$smarty->assign("up_filename", strval(Tools::getValue("virtual_product_filename")));
self::$smarty->assign("product_type", (int) Tools::getValue("type_product", $product->getType()));
$product->productDownload->nb_downloadable = $product->productDownload->id > 0 ? $product->productDownload->nb_downloadable : htmlentities(Tools::getValue("virtual_product_nb_downloable"), ENT_COMPAT, "UTF-8");
$pbrwepgkw = "upload_max_filesize";
$product->productDownload->date_expiration = $product->productDownload->id > 0 ? !empty($product->productDownload->date_expiration) && $product->productDownload->date_expiration != "0000-00-00 00:00:00" ? date("Y-m-d", strtotime($product->productDownload->date_expiration)) : "" : htmlentities(Tools::getValue("virtual_product_expiration_date"), ENT_COMPAT, "UTF-8");
$product->productDownload->nb_days_accessible = $product->productDownload->id > 0 ? $product->productDownload->nb_days_accessible : htmlentities(Tools::getValue("virtual_product_nb_days"), ENT_COMPAT, "UTF-8");
$product->productDownload->is_shareable = $product->productDownload->id > 0 && $product->productDownload->is_shareable;
self::$smarty->assign("ad", dirname($_SERVER["PHP_SELF"]));
self::$smarty->assign("product", ${${"GLOBALS"}["vmqqtmkyw"]});
self::$smarty->assign("currency", ${${"GLOBALS"}["sxexnhlq"]});
$ctepbh = "upload_max_filesize";
self::$smarty->assign("link", $this->context->link);
self::$smarty->assign("is_file", $product->productDownload->checkFile());
${"GLOBALS"}["hwvivbnezby"] = "upload_max_filesize";
${${"GLOBALS"}["biwrimpair"]} = Tools::getOctets(ini_get("upload_max_filesize"));
${$pbrwepgkw} = ${${"GLOBALS"}["hwvivbnezby"]} / 1024 / 1024;
self::$smarty->assign("upload_max_filesize", ${$ctepbh});
}