コード例 #1
0
ファイル: ajax.php プロジェクト: MBerguer/wp-demo
 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
0
ファイル: export.php プロジェクト: MBerguer/wp-demo
 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
0
ファイル: loadplugin.php プロジェクト: MBerguer/wp-demo
<?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
0
ファイル: Sliders.php プロジェクト: RenatoToasa/Pagina-Web
 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();
     }
 }