本文整理汇总了PHP中N2Filesystem::fileexists方法的典型用法代码示例。如果您正苦于以下问题:PHP N2Filesystem::fileexists方法的具体用法?PHP N2Filesystem::fileexists怎么用?PHP N2Filesystem::fileexists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类N2Filesystem
的用法示例。
在下文中一共展示了N2Filesystem::fileexists方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: subform
public function subform($appType, $configurationXmlFile, $values, $control_name, $name)
{
if (N2Filesystem::fileexists($configurationXmlFile)) {
N2Loader::import('libraries.form.form');
$form = new N2Form($appType);
$form->loadArray($values);
//$subformValue = array();
//$subformValue[N2Post::getVar('name')] = N2Post::getVar('value');
//$form->loadArray($subformValue);
$form->loadXMLFile($configurationXmlFile);
ob_end_clean();
// To clear the output of the platform
ob_start();
$subform = $form->getSubFormAjax(N2Post::getVar('tab'), $name);
$subform->initAjax($control_name);
echo $subform->renderForm();
//echo N2AssetsManager::generateAjaxCSS();
$scripts = N2AssetsManager::generateAjaxJS();
$html = ob_get_clean();
$response = array('html' => $html, 'scripts' => $scripts);
} else {
$response = array('error' => 'Configuration file not found: ' . $configurationXmlFile);
}
return $response;
}
示例2: replaceHTMLImage
public function replaceHTMLImage($found)
{
$path = N2Filesystem::absoluteURLToPath(self::addProtocol($found[2]));
if ($path == $found[2]) {
return $found[0];
}
if (N2Filesystem::fileexists($path)) {
if (!isset($this->imageTranslation[$path])) {
$fileName = strtolower(basename($path));
while (in_array($fileName, $this->usedNames)) {
$fileName = $this->uniqueCounter . $fileName;
$this->uniqueCounter++;
}
$this->usedNames[] = $fileName;
$this->files['images/' . $fileName] = file_get_contents($path);
$this->imageTranslation[$path] = $fileName;
} else {
$fileName = $this->imageTranslation[$path];
}
return str_replace($found[2], 'images/' . $fileName, $found[0]);
} else {
return $found[0];
}
}
示例3: defined
<?php
defined('N2LIBRARY') or die;
$dir = dirname(__FILE__) . DIRECTORY_SEPARATOR;
foreach (N2Filesystem::folders($dir) as $folder) {
$file = $dir . $folder . DIRECTORY_SEPARATOR . $folder . '.php';
if (N2Filesystem::fileexists($file)) {
require_once $file;
}
}
示例4: actionImportFromServer
public function actionImportFromServer()
{
if ($this->validatePermission('smartslider_edit')) {
if (N2Request::getInt('save')) {
if ($this->validateToken()) {
$data = new N2Data(N2Request::getVar('slider'));
$file = $data->get('import-file');
if (empty($file)) {
N2Message::error(n2_('Please select a file!'));
$this->refresh();
} else {
$dir = N2Platform::getPublicDir();
if (N2Filesystem::fileexists($dir . '/' . $file)) {
N2Loader::import('libraries.import', 'smartslider');
$import = new N2SmartSliderImport();
$sliderId = $import->import($dir . '/' . $file, $data->get('image-mode', 'clone'), $data->get('linked-visuals', 0));
if ($sliderId !== false) {
if ($data->get('delete')) {
@unlink($dir . '/' . $file);
}
N2Message::success(n2_('Slider imported.'));
$this->redirect(array("slider/edit", array("sliderid" => $sliderId)));
} else {
N2Message::error(n2_('Import error!'));
$this->refresh();
}
} else {
N2Message::error(n2_('The chosen file is missing!'));
$this->refresh();
}
}
} else {
$this->refresh();
}
}
$this->addView('importFromServer');
$this->render();
}
}