/**
  * PHP5 type constructor
  */
 function __construct($name, $defaultValue = '', $label = '', $textBefore = '', $textAfter = '')
 {
     $args = array('orderby' => 'ID', 'order' => 'ASC', 'hide_empty' => 0, 'hierarchical' => 1);
     $categories = get_categories($args);
     parent::__construct($name, $defaultValue, $label, $textBefore, $textAfter);
     //populate the list with all available categories
     foreach ($categories as $cat) {
         $this->addChild(new DropDownOption($cat->name, $cat->cat_ID));
     }
 }
 protected function getList()
 {
     $list = parent::getList();
     if (!$this->hasOwnerField()) {
         unset($list[3]);
         unset($list[4]);
         unset($list[5]);
     }
     return $list;
 }
Beispiel #3
0
 /**
  * PHP5 type constructor
  */
 function __construct($name, $defaultValue = '', $label = '', $textBefore = '', $textAfter = '')
 {
     global $wpdb;
     /** @todo Move select to get_authors(). */
     $authors = $wpdb->get_results("SELECT ID, user_nicename from {$wpdb->users} ORDER BY display_name");
     parent::__construct($name, $defaultValue, $label, $textBefore, $textAfter);
     //populate the list with all registered authors
     foreach ($authors as $author) {
         $this->addChild(new DropDownOption($author->user_nicename, $author->ID));
     }
 }
    /**
     * Defines all the plugin options and registers them with the OptionController.
     *
     * @access private
     */
    function _defineAndRegisterOptions()
    {
        //define general tests not associated to options but that should be passed
        $this->addTest(new RO_SafeModeOffInputTest());
        $this->addTest(new RO_GDAvailableInputTest());
        $this->addTest(new RO_WordPressVersionInputTest('2.8.1', '2.9'));
        //exif related settings
        //first the reorderable list of discovered exif tags
        $exifTags =& new RO_ReorderableList('exifTags');
        if ($tags = get_option("wimpq_exif_tags")) {
            foreach ($tags as $key => $value) {
                $exifTags->addChild(new PhotoQExifTagOption($key, $value));
            }
        }
        //localize strings
        $exifTags->localizeStrings(array("selectedListLabel" => __('selected', 'PhotoQ'), "deselectedListLabel" => __('deselected', 'PhotoQ')));
        $this->registerOption($exifTags);
        //now the exif display options
        $exifDisplayOptions =& new CompositeOption('exifDisplay');
        $exifDisplayOptions->addChild(new TextFieldOption('exifBefore', attribute_escape('<ul class="photoQExifInfo">'), '', '<table class="optionTable"><tr><td>' . __('Before List', 'PhotoQ') . ': </td><td>', sprintf(__('Default is %s', 'PhotoQ'), '<code>' . attribute_escape('<ul class="photoQExifInfo">') . '</code>') . '</td></tr>', '30'));
        $exifDisplayOptions->addChild(new TextFieldOption('exifAfter', attribute_escape('</ul>'), '', '<tr><td>' . __('After List', 'PhotoQ') . ': </td><td>', sprintf(__('Default is %s', 'PhotoQ'), '<code>' . attribute_escape('</ul>') . '</code>') . '</td></tr>', '30'));
        $exifDisplayOptions->addChild(new TextFieldOption('exifElementBetween', '', '', '<tr><td>' . __('Between Elements', 'PhotoQ') . ': </td><td>', '</td></tr>', '30'));
        $exifDisplayOptions->addChild(new TextAreaOption('exifElementFormatting', attribute_escape('<li class="photoQExifInfoItem"><span class="photoQExifTag">[key]:</span> <span class="photoQExifValue">[value]</span></li>'), '', '<tr><td>' . __('Element Formatting', 'PhotoQ') . ': </td><td>
				<span class="setting-description">' . sprintf(__('You can specify the HTML that should be printed for each element here. Two shortags %1$s and %2$s are available. %1$s is replaced with the name of the EXIF tag, %2$s with its value. Here is an example, showing the default value: %3$s', 'PhotoQ'), '[key]', '[value]', '<code>' . attribute_escape('<li class="photoQExifInfoItem"><span class="photoQExifTag">[key]:</span> <span class="photoQExifValue">[value]</span></li>') . '</code>') . '
				</span></td></tr><tr><td/><td>', '</td></tr></table>', 2, 75));
        $this->registerOption($exifDisplayOptions);
        //watermark options
        $watermark =& new CompositeOption('watermarkOptions');
        $watermarkPosition =& new RadioButtonList('watermarkPosition', 'BL', '', '<tr valign="top"><th scope="row">' . __('Position', 'PhotoQ') . ': </th><td>', '</td></tr>');
        $valueLabelArray = array('BR' => __('Bottom Right', 'PhotoQ'), 'BL' => __('Bottom Left', 'PhotoQ'), 'TR' => __('Top Right', 'PhotoQ'), 'TL' => __('Top Left', 'PhotoQ'), 'C|' => __('Center', 'PhotoQ'), 'R|' => __('Right', 'PhotoQ'), 'L|' => __('Left', 'PhotoQ'), 'T|' => __('Top', 'PhotoQ'), 'B|' => __('Bottom', 'PhotoQ'), '*' => __('Tile', 'PhotoQ'));
        $watermarkPosition->populate($valueLabelArray);
        $watermark->addChild($watermarkPosition);
        $watermark->addChild(new TextFieldOption('watermarkOpacity', '100', '', '<tr valign="top"><th scope="row">' . __('Opacity', 'PhotoQ') . ': </th><td>', '%</td></tr>', '2'));
        $watermark->addChild(new TextFieldOption('watermarkXMargin', '20', __('left/right', 'PhotoQ') . ':', '<tr valign="top"><th scope="row">' . __('Margins', 'PhotoQ') . ': </th><td>', 'px, ', '2', '2'));
        $watermark->addChild(new TextFieldOption('watermarkYMargin', '20', __('top/bottom', 'PhotoQ') . ':', '', 'px<br/>(' . __('Values smaller than one are interpreted as percentages instead of pixels.', 'PhotoQ') . ')</td></tr>', '2', '2'));
        $this->registerOption($watermark);
        //build field checkbox options
        $this->registerOption(new CheckBoxOption('fieldAddPosted', '1', __('Add to already posted as well.', 'PhotoQ')));
        $this->registerOption(new CheckBoxOption('fieldDeletePosted', '0', __('Delete from already posted as well.', 'PhotoQ')));
        $this->registerOption(new CheckBoxOption('fieldRenamePosted', '1', __('Rename already posted as well.', 'PhotoQ')));
        //build and register further options
        //$imgDirOption =& new RO_ChangeTrackingContainer('imgDirOption');
        $imgdir =& new TextFieldOption('imgdir', 'wp-content', '', '', '<br />' . sprintf(__('Default is %s', 'PhotoQ'), '<code>wp-content</code>'));
        $imgdir->addTest(new DirExistsInputTest('', __('Image Directory not found', 'PhotoQ') . ': '));
        $imgdir->addTest(new FileWritableInputTest('', __('Image Directory not writable', 'PhotoQ') . ': '));
        //$imgDirOption->addChild($imgdir);
        $this->registerOption($imgdir);
        $imagemagickPath =& new TextFieldOption('imagemagickPath', '', sprintf(_c('Absolute path to the ImageMagick convert executable. (e.g. %1$s ). Leave empty if %2$s is in the path.| example programname', 'PhotoQ'), '<code>/usr/bin/convert</code>', '"convert"'));
        $this->registerOption($imagemagickPath);
        $cronOptions =& new CompositeOption('cronJobs');
        $cronOptions->addChild(new TextFieldOption('cronFreq', '23', __('Cronjob runs every', 'PhotoQ') . ' ', '', __('hours', 'PhotoQ'), '3', '5'));
        $cronOptions->addChild(new CheckBoxOption('cronPostMulti', '0', __('Use settings of second post button for automatic posting.', 'PhotoQ'), '<p>', '</p>'));
        $cronOptions->addChild(new CheckBoxOption('cronFtpToQueue', '0', __('When cronjob runs, automatically add FTP uploads to queue.', 'PhotoQ'), '<p>', '</p>'));
        $this->registerOption($cronOptions);
        $adminThumbs =& new CompositeOption('showThumbs', '1', '', '<table>', '</table>');
        $adminThumbs->addChild(new TextFieldOption('showThumbs-Width', '120', '', '<tr><td>' . _c('Thumbs shown in list of published photos are maximum | ends with: px wide', 'PhotoQ') . '</td><td>', _c('px wide| starts with: thumbs ... are', 'PhotoQ') . ', ', '3', '3'));
        $adminThumbs->addChild(new TextFieldOption('showThumbs-Height', '60', '', ' ', __('px high', 'PhotoQ') . '. <br/></td></tr>', '3', '3'));
        $adminThumbs->addChild(new TextFieldOption('photoQAdminThumbs-Width', '200', '', '<tr><td>' . __('Thumbs shown in PhotoQ edit dialogs are maximum', 'PhotoQ') . '</td><td>', __('px wide', 'PhotoQ') . ', ', '3', '3'));
        $adminThumbs->addChild(new TextFieldOption('photoQAdminThumbs-Height', '90', '', ' ', __('px high', 'PhotoQ') . '. <br/></td></tr>', '3', '3'));
        $adminThumbs->addChild(new TextFieldOption('editPostThumbs-Width', '300', '', '<tr><td>' . __('Thumbs shown in WordPress post editing dialog are maximum', 'PhotoQ') . '</td><td>', __('px wide', 'PhotoQ') . ', ', '3', '3'));
        $adminThumbs->addChild(new TextFieldOption('editPostThumbs-Height', '400', '', ' ', __('px high', 'PhotoQ') . '.</td></tr>', '3', '3'));
        $this->registerOption($adminThumbs);
        $autoTitles = new CompositeOption('autoTitles');
        $autoTitles->addChild(new TextFieldOption('autoTitleRegex', '', __('Custom Filter', 'PhotoQ') . ':', '', '<br/>
				<span class="setting-description">' . sprintf(__('An auto title is a title that is generated automatically from the filename. By default PhotoQ creates auto titles by removing the suffix from the filename, replacing hyphens and underscores with spaces and by capitalizing the first letter of every word. You can specify an additional custom filter to remove more from the filename above. Perl regular expressions are allowed, parts of filenames that match the regex are removed (regex special chars %s need to be escaped with a backslash). Note that the custom filter is applied first, before any of the default replacements.', 'PhotoQ'), '<code>. \\ + * ? [ ^ ] $ ( ) { } = ! < > | :</code>') . '<br/>' . __('Examples: <code>IMG</code> to remove the string "IMG" from anywhere within the filename, <code>^IMG</code> to remove "IMG" from beginning of filename.', 'PhotoQ') . '</span>'));
        $autoTitles->addChild(new TextFieldOption('autoTitleNoCapsShortWords', '2', '<br/><br/>' . __('Do not capitalize words with', 'PhotoQ') . ' ', '', ' ' . __('characters or less,', 'PhotoQ'), 2, 2));
        $autoTitles->addChild(new TextFieldOption('autoTitleCaps', 'I', ' ' . __('except for the following words', 'PhotoQ') . ':<br/>', '', '
				<span class="setting-description">' . __('(Separate words with commas)', 'PhotoQ') . '</span><br/><br/>', 100, 200));
        $autoTitles->addChild(new TextAreaOption('autoTitleNoCaps', _c('for, and, nor, but, yet, both, either, neither, the, for, with, from, because, after, when, although, while|english words that are not capitalized', 'PhotoQ'), ' ' . __('Do not capitalize any of the following words (Separate words with commas)', 'PhotoQ') . ':<br/>', '', '', 2, 100));
        $this->registerOption($autoTitles);
        $enableFtp =& new CheckBoxOption('enableFtpUploads', '0', __('Allow importing of photos from the following directory on the server', 'PhotoQ') . ': ');
        $enableFtp->addChild(new TextFieldOption('ftpDir', '', '', '', '<br />' . sprintf(__('Full path (e.g., %s)', 'PhotoQ'), '<code>' . ABSPATH . 'wp-content/ftp</code>')));
        $this->registerOption($enableFtp);
        $this->registerOption(new TextFieldOption('postMulti', '999', __('Second post button posts ', 'PhotoQ'), '', __(' photos at once.', 'PhotoQ'), '3', '3'));
        $this->registerOption(new CheckBoxOption('foldCats', '0', __('Fold away category lists per default.', 'PhotoQ')));
        $this->registerOption(new CheckBoxOption('deleteImgs', '1', __('Delete image files from server when deleting post.', 'PhotoQ')));
        $this->registerOption(new CheckBoxOption('enableBatchUploads', '1', __('Enable Batch Uploads.', 'PhotoQ')));
        $statusArray = array("draft", "private", "publish");
        $postStatus = new DropDownList('qPostStatus', 'publish', __('This is the default status of posts posted via PhotoQ.', 'PhotoQ'));
        $postStatus->populate(PhotoQHelper::arrayCombine($statusArray, $statusArray));
        $this->registerOption($postStatus);
        $this->registerOption(new AuthorDropDownList('qPostAuthor', '1', __('PhotoQ will fall back to this author if no author can be determined by any other means. This is for example the case if photos are automatically added to the queue through cronjobs.', 'PhotoQ')));
        $this->registerOption(new CategoryDropDownList('qPostDefaultCat', '1', __('This is the default category for posts posted via PhotoQ.', 'PhotoQ')));
        $this->registerOption(new TextFieldOption('qPostDefaultTags', '', __('Every post posted via PhotoQ has these default tags:', 'PhotoQ')));
        $roleOptions = new CompositeOption('specialCaps', '', '', '<table><tr>', '</tr></table>');
        $roleOptions->addChild(new PhotoQRoleOption('editorCaps', 'editor', array('use_primary_photoq_post_button', 'use_secondary_photoq_post_button', 'reorder_photoq'), __('Editor', 'PhotoQ'), '<td>', '</td>'));
        $roleOptions->addChild(new PhotoQRoleOption('authorCaps', 'author', array('use_primary_photoq_post_button', 'use_secondary_photoq_post_button', 'reorder_photoq'), __('Author', 'PhotoQ'), '<td>', '</td>'));
        $this->registerOption($roleOptions);
        $imageSizes =& new ImageSizeContainer('imageSizes', 'ImageSizeOption', array(&$this, 'addImageSizeCallback'), array(&$this, 'delImageSizeCallback'), array('original'), array(), '', '<table width="100%" cellspacing="2" cellpadding="5" class="form-table noborder"><tr valign="top">
					<th scope="row">
						<label for="newExpComp-imageSizes">' . __('Name of new image size', 'PhotoQ') . ':</label>
					</th>
					<td>', '</td></tr></table>');
        $imageSizes->addChild(new ImageSizeOption($this->THUMB_IDENTIFIER, '', '80', '60'), 0);
        $imageSizes->addChild(new ImageSizeOption($this->MAIN_IDENTIFIER), 0);
        $this->registerOption($imageSizes);
        $originalFolder =& new CompositeOption('originalFolder');
        $originalFolder->addChild(new CheckBoxOption('hideOriginals', '0', __('Hide folder containing original photos. If checked, PhotoQ will attribute a random name to the folder.', 'PhotoQ'), '', ''));
        $this->registerOption($originalFolder);
        //next we define the views
        $contentView =& new PhotoQViewOption('content', true);
        $contentView->addChild(new CheckBoxOption('inlineDescr', '1', __('Include photo description in post content (does not apply to freeform mode).', 'PhotoQ'), '<tr><th>' . __('Photo Description', 'PhotoQ') . ':</th><td>', '</td></tr>'));
        $contentView->addChild(new CheckBoxOption('inlineExif', '0', __('Include Exif data in post content (does not apply to freeform mode).', 'PhotoQ'), '<tr><th>' . __('Exif Meta Data', 'PhotoQ') . ':</th><td>', '</td></tr>'));
        $excerptView =& new PhotoQViewOption('excerpt', true);
        $photoQViews = new RO_ExpandableCompositeOption('views', 'PhotoQViewOption', array(&$this, 'addViewCallback'), array(&$this, 'delViewCallback'), array(), array());
        $photoQViews->addChild($contentView, 0);
        $photoQViews->addChild($excerptView, 0);
        $this->registerOption($photoQViews);
        //overwrite default options with saved options from database
        $this->load();
        //populate lists of image sizes that depend on runtime stuff and cannot be populated before
        $this->_populateAllViews();
        //$contentView->populate($this->getImageSizeNames(),$this->ORIGINAL_IDENTIFIER == 'original');
        //$excerptView->populate($this->getImageSizeNames(),$this->ORIGINAL_IDENTIFIER == 'original');
        //check for existence of cache directory
        //convert backslashes (windows) to slashes
        $cleanAbs = str_replace('\\', '/', ABSPATH);
        $this->addTest(new DirExistsInputTest(preg_replace('#' . $cleanAbs . '#', '', $this->getCacheDir()), __('Cache Directory not found', 'PhotoQ') . ': '));
        $this->addTest(new FileWritableInputTest(preg_replace('#' . $cleanAbs . '#', '', $this->getCacheDir()), __('Cache Directory not writeable', 'PhotoQ') . ': '));
    }
Beispiel #5
0
<?php 
$panel1 = new MasterPanel('panel1');
$panel1->create();
$panel1->start();
$row1 = new RowPanel('row1');
$row1->create();
$row1->start();
$column1 = new ColumnPanel('column1', 6, 'md');
$column1->create();
$column1->start();
?>
<h1>This is a drop down list.</h1>
<?php 
$newddlSource = new DataSource('articles', null);
$ddlValues = $newddlSource->select();
$newddl = new DropDownList('test1', 'test2', 'test3', $ddlValues, "title", "id");
$newddl->create();
$newddl->display();
$column1->close();
$column2 = new ColumnPanel('column2', 6, 'md');
$column2->create();
$column2->start();
?>
<h1>This is a text box.</h1>
<?php 
$newTB = new TextBox('test1', 'test2', 'test3', 'test4');
$newTB->create();
$newTB->display();
$column2->close();
$row1->close();
$panel1->close();