function renderListOfPresets()
 {
     $presetDirs = array($this->getMyPresetsDir() => __('My PhotoQ Presets', 'PhotoQ'));
     foreach ($this->_presetCategories as $key => $value) {
         $presetDirs[$this->getPresetsDir() . $key . '/'] = $value;
     }
     _e('Choose your Theme Preset: ', 'PhotoQ');
     echo '<select name="presetFile" id="presetFile">';
     foreach ($presetDirs as $path => $displayName) {
         $presetFilePaths = PhotoQHelper::getMatchingDirContent($path, '#\\.xml$#');
         if (count($presetFilePaths)) {
             echo '<optgroup label="' . $displayName . '">';
         }
         foreach ($presetFilePaths as $presetPath) {
             echo '<option value="' . $presetPath . '">' . PhotoQHelper::niceDisplayNameFromFileName(basename($presetPath)) . '</option>';
         }
         if (count($presetFilePaths)) {
             echo '</optgroup>';
         }
     }
     echo '</select>';
 }
Esempio n. 2
0
 function showFtpFileList()
 {
     $ftpDir = $this->_oc->getFtpDir();
     echo '<p>' . sprintf(__('Import the following photos from: %s', 'PhotoQ'), "<code> {$ftpDir} </code>") . '</p>';
     if (!is_dir($ftpDir)) {
         $errMsg = new PhotoQErrorMessage("The directory <code>" . $ftpDir . "</code> does not exist on your server.");
         $errMsg->show();
     } else {
         $ftpDirContent = PhotoQHelper::getMatchingDirContent($ftpDir, '#.*\\.(jpg|jpeg|png|gif)$#i');
         foreach ($ftpDirContent as $file) {
             echo '<input type="checkbox" name="ftpFiles[]" value="' . $file . '" checked="checked" /> ' . basename($file) . '<br/>';
         }
     }
 }
Esempio n. 3
0
 function mergeDirs($oldfile, $newfile)
 {
     if (!file_exists($newfile)) {
         return PhotoQHelper::moveFile($oldfile, $newfile);
     } else {
         if (is_dir($oldfile) && is_dir($newfile)) {
             $oldfile = rtrim($oldfile, '/') . '/';
             $newfile = rtrim($newfile, '/') . '/';
             //get all visible files from old img dir
             $match = '#^[^\\.]#';
             //exclude hidden files starting with .
             $visibleFiles = PhotoQHelper::getMatchingDirContent($oldfile, $match);
             foreach ($visibleFiles as $file2merge) {
                 PhotoQHelper::mergeDirs($file2merge, str_replace($oldfile, $newfile, $file2merge));
                 /*if(!$res){
                 	 return false;
                 		}*/
             }
         } else {
             return false;
         }
     }
 }