本文整理汇总了PHP中N2Loader::importPath方法的典型用法代码示例。如果您正苦于以下问题:PHP N2Loader::importPath方法的具体用法?PHP N2Loader::importPath怎么用?PHP N2Loader::importPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类N2Loader
的用法示例。
在下文中一共展示了N2Loader::importPath方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSliderTypeResource
public function getSliderTypeResource($resourceName)
{
$type = $this->data->get('type', 'simple');
$class = 'N2SSPluginType' . $type;
N2Loader::importPath(call_user_func(array($class, "getPath")) . NDS . $resourceName);
$class = 'N2SmartSlider' . $resourceName . $type;
return new $class($this);
}
示例2: array
?>
</div>
</div>
<div class="n2-slides-tab" style="display:none;">
<?php
$this->renderInline("_sliders");
?>
</div>
<div class="n2-layers-tab" style="display:block;">
<div id="smartslider-slide-toolbox-layer">
<?php
$class = 'N2SSPluginType' . $slider['type'];
N2Loader::importPath(call_user_func(array($class, "getPath")) . NDS . 'type');
$itemDefaults = call_user_func(array('N2SmartSliderType' . $slider['type'], 'getItemDefaults'));
?>
<script type="text/javascript">
window.ssitemmarker = true;
</script>
<div id="n2-ss-item-container" class="n2-sidebar-list-bg">
<?php
$items = array();
N2Plugin::callPlugin('ssitem', 'onNextendSliderItemList', array(&$items));
N2SSPluginItemAbstract::sortItems($items);
foreach ($items as $type => $item) {
echo N2Html::tag('div', array('class' => 'n2-h5 n2-ss-core-item n2-ss-core-item-' . $type, 'data-layerproperties' => json_encode((object) array_merge($item[5], $itemDefaults)), 'data-item' => $type), N2Html::tag('div', array(), $item[0]));
}
?>
</div>
示例3: create
public function create($saveAsFile = false)
{
$this->backup = new N2SmartSliderBackup();
$slidersModel = new N2SmartsliderSlidersModel();
if ($this->backup->slider = $slidersModel->get($this->sliderId)) {
$this->backup->slider['params'] = new N2Data($this->backup->slider['params'], true);
$slidesModel = new N2SmartsliderSlidesModel();
$this->backup->slides = $slidesModel->getAll($this->backup->slider['id']);
if (empty($this->backup->slider['type'])) {
$this->backup->slider['type'] = 'simple';
}
$class = 'N2SSPluginType' . $this->backup->slider['type'];
N2Loader::importPath(call_user_func(array($class, "getPath")) . NDS . 'backup');
$class = 'N2SmartSliderBackup' . $this->backup->slider['type'];
call_user_func_array(array($class, 'export'), array($this, $this->backup->slider));
$enabledWidgets = array();
$plugins = array();
N2Plugin::callPlugin('sswidget', 'onWidgetList', array(&$plugins));
$params = $this->backup->slider['params'];
foreach ($plugins as $k => $v) {
$widget = $params->get('widget' . $k);
if ($widget && $widget != 'disabled') {
$enabledWidgets[$k] = $widget;
}
}
foreach ($enabledWidgets as $k => $v) {
$class = 'N2SSPluginWidget' . $k . $v;
if (class_exists($class, false)) {
$params->fillDefault(call_user_func(array($class, 'getDefaults')));
call_user_func_array(array($class, 'prepareExport'), array($this, &$params));
} else {
unset($enabledWidgets);
}
}
for ($i = 0; $i < count($this->backup->slides); $i++) {
$slide = $this->backup->slides[$i];
self::addImage($slide['thumbnail']);
$slide['params'] = new N2Data($slide['params'], true);
self::addImage($slide['params']->get('backgroundImage'));
self::addLightbox($slide['params']->get('link'));
N2SmartSliderLayer::prepareExport($this, $slide['slide']);
if (!empty($slide['generator_id'])) {
N2Loader::import("models.generator", "smartslider");
$generatorModel = new N2SmartsliderGeneratorModel();
$this->backup->generators[] = $generatorModel->get($slide['generator_id']);
}
}
$zip = new N2ZipFile();
$this->images = array_unique($this->images);
$this->visuals = array_unique($this->visuals);
foreach ($this->images as $image) {
$this->backup->NextendImageManager_ImageData[$image] = N2ImageManager::getImageData($image, true);
if ($this->backup->NextendImageManager_ImageData[$image]) {
self::addImage($this->backup->NextendImageManager_ImageData[$image]['tablet']['image']);
self::addImage($this->backup->NextendImageManager_ImageData[$image]['mobile']['image']);
} else {
unset($this->backup->NextendImageManager_ImageData[$image]);
}
}
$this->images = array_unique($this->images);
$usedNames = array();
foreach ($this->images as $image) {
$file = N2ImageHelper::fixed($image, true);
if (N2Filesystem::fileexists($file)) {
$fileName = strtolower(basename($file));
while (in_array($fileName, $usedNames)) {
$fileName = $this->uniqueCounter . $fileName;
$this->uniqueCounter++;
}
$usedNames[] = $fileName;
$this->backup->imageTranslation[$image] = $fileName;
$zip->addFile(file_get_contents($file), 'images/' . $fileName);
}
}
foreach ($this->visuals as $visual) {
$this->backup->visuals[] = N2StorageSectionAdmin::getById($visual);
}
$zip->addFile(serialize($this->backup), 'data');
if (!$saveAsFile) {
ob_end_clean();
header('Content-disposition: attachment; filename=' . preg_replace('/[^a-zA-Z0-9_-]/', '', $this->backup->slider['title']) . '.ss3');
header('Content-type: application/zip');
echo $zip->file();
n2_exit(true);
} else {
$file = preg_replace('/[^a-zA-Z0-9_-]/', '', $this->backup->slider['title']) . '.ss3';
$folder = N2Platform::getPublicDir();
$folder .= '/export/';
if (!N2Filesystem::existsFolder($folder)) {
N2Filesystem::createFolder($folder);
}
N2Filesystem::createFile($folder . $file, $zip->file());
}
}
}
示例4: import
public function import($filePathOrData, $imageImportMode = 'clone', $linkedVisuals = 1, $isFilePath = true)
{
$zip = new N2ZipRead();
$importData = $zip->read_zip($filePathOrData, $isFilePath);
if (!isset($importData['data'])) {
if (array_key_exists("slider.ss2", $importData)) {
N2Message::error(n2_('You can\'t import sliders from Smart Slider 2.'));
}
return false;
}
$this->backup = unserialize($importData['data']);
$this->sectionTranslation = array();
$this->importVisuals($this->backup->visuals, $linkedVisuals);
$sliderModel = new N2SmartsliderSlidersModel();
if ($this->restore) {
$this->sliderId = $sliderModel->restore($this->backup->slider);
} else {
$this->sliderId = $sliderModel->import($this->backup->slider);
}
if (!$this->sliderId) {
return false;
}
switch ($imageImportMode) {
case 'clone':
$images = $importData['images'];
$imageStore = new N2StoreImage('slider' . $this->sliderId, true);
foreach ($images as $file => $content) {
$localImage = $imageStore->makeCache($file, $content);
if ($localImage) {
$this->imageTranslation[$file] = N2ImageHelper::dynamic(N2Uri::pathToUri($localImage));
} else {
$this->imageTranslation[$file] = $file;
}
if (!$this->imageTranslation[$file]) {
$this->imageTranslation[$file] = array_search($file, $this->backup->imageTranslation);
}
}
break;
case 'update':
$keys = array_keys($this->backup->NextendImageHelper_Export);
$values = array_values($this->backup->NextendImageHelper_Export);
foreach ($this->backup->imageTranslation as $image => $value) {
$this->imageTranslation[$value] = str_replace($keys, $values, $image);
}
break;
default:
break;
}
foreach ($this->backup->NextendImageManager_ImageData as $image => $data) {
$data['tablet']['image'] = $this->fixImage($data['tablet']['image']);
$data['mobile']['image'] = $this->fixImage($data['mobile']['image']);
N2ImageManager::addImageData($this->fixImage($image), $data);
}
unset($importData);
if (empty($this->backup->slider['type'])) {
$this->backup->slider['type'] = 'simple';
}
$class = 'N2SSPluginType' . $this->backup->slider['type'];
N2Loader::importPath(call_user_func(array($class, "getPath")) . NDS . 'backup');
$class = 'N2SmartSliderBackup' . $this->backup->slider['type'];
call_user_func_array(array($class, 'import'), array($this, &$this->backup->slider));
$enabledWidgets = array();
$plugins = array();
N2Plugin::callPlugin('sswidget', 'onWidgetList', array(&$plugins));
$params = $this->backup->slider['params'];
foreach ($plugins as $k => $v) {
$widget = $params->get('widget' . $k);
if ($widget && $widget != 'disabled') {
$enabledWidgets[$k] = $widget;
}
}
foreach ($enabledWidgets as $k => $v) {
$class = 'N2SSPluginWidget' . $k . $v;
if (class_exists($class, false)) {
$params->fillDefault(call_user_func(array($class, 'getDefaults')));
call_user_func_array(array($class, 'prepareImport'), array($this, $params));
} else {
unset($enabledWidgets);
}
}
$sliderModel->importUpdate($this->sliderId, $params);
$generatorTranslation = array();
N2Loader::import("models.generator", "smartslider");
$generatorModel = new N2SmartsliderGeneratorModel();
foreach ($this->backup->generators as $generator) {
$generatorTranslation[$generator['id']] = $generatorModel->import($generator);
}
$slidesModel = new N2SmartsliderSlidesModel();
for ($i = 0; $i < count($this->backup->slides); $i++) {
$slide = $this->backup->slides[$i];
$slide['params'] = new N2Data($slide['params'], true);
$slide['thumbnail'] = $this->fixImage($slide['thumbnail']);
$slide['params']->set('backgroundImage', $this->fixImage($slide['params']->get('backgroundImage')));
$slide['params']->set('link', $this->fixLightbox($slide['params']->get('link')));
$slide['slide'] = N2SmartSliderLayer::prepareImport($this, $slide['slide']);
if (isset($generatorTranslation[$slide['generator_id']])) {
$slide['generator_id'] = $generatorTranslation[$slide['generator_id']];
}
$slidesModel->import($slide, $this->sliderId);
}
//.........这里部分代码省略.........
示例5: importElement
public static function importElement($type)
{
$class = 'N2Element' . $type;
if (!class_exists($class, false)) {
for ($i = count(N2Form::$importPaths) - 1; $i >= 0; $i--) {
if (N2Loader::importPath(N2Form::$importPaths[$i] . '/element/' . $type)) {
break;
}
}
}
return $class;
}