Пример #1
0
 public static function getAdvancedForm()
 {
     $form = new \Ip\Form();
     $form->addClass('ipsConfigForm');
     $form->addClass('ipsConfigFormAdvanced');
     $form->addClass('hidden');
     $form->setAjaxSubmit(0);
     $field = new \Ip\Form\Field\Checkbox(array('name' => 'automaticCron', 'value' => ipGetOption('Config.automaticCron', 1), 'label' => __('Execute cron automatically', 'Ip-admin', false), 'hint' => __('ImpressPages execute cron once every hour on randomly selected visitor page load. I you have setup cron manually, you can disable automatic cron functionality.', 'Ip-admin')));
     $field->addClass('ipsAutoSave');
     $field->addAttribute('data-fieldid', $field->getName());
     $field->addAttribute('id', $field->getName());
     $field->addAttribute('data-fieldname', $field->getName());
     $form->addField($field);
     $field = new \Ip\Form\Field\Text(array('name' => 'cronPassword', 'value' => ipGetOption('Config.cronPassword', 1), 'label' => __('Cron password', 'Ip-admin', false), 'hint' => __('Protect cron from being abusively executed by the strangers.', 'Ip-admin', false), 'note' => '<span class="ipsUrlLabel">' . __('Cron URL: ', 'Ip-admin') . '</span><a target="_blank" class="ipsUrl"></a>'));
     $field->addClass('ipsAutoSave');
     $field->addAttribute('data-fieldid', $field->getName());
     $field->addAttribute('id', $field->getName());
     $field->addAttribute('data-fieldname', $field->getName());
     $form->addField($field);
     $field = new \Ip\Form\Field\Checkbox(array('name' => 'removeOldEmails', 'value' => ipGetOption('Config.removeOldEmails', 0), 'label' => __('Remove old emails from the log', 'Ip-admin', false)));
     $field->addClass('ipsAutoSave');
     $field->addAttribute('data-fieldid', $field->getName());
     $field->addAttribute('id', $field->getName());
     $field->addAttribute('data-fieldname', $field->getName());
     $form->addField($field);
     $field = new \Ip\Form\Field\Text(array('name' => 'removeOldEmailsDays', 'value' => ipGetOption('Config.removeOldEmailsDays', 720), 'label' => __('Days to keep emails', 'Ip-admin', false), 'hint' => __('Meaningful only if "Remove old emails" is on.', 'Ip-admin', false)));
     $field->addClass('ipsAutoSave');
     $field->addAttribute('data-fieldid', $field->getName());
     $field->addAttribute('id', $field->getName());
     $field->addAttribute('data-fieldname', $field->getName());
     $form->addField($field);
     $field = new \Ip\Form\Field\Checkbox(array('name' => 'removeOldRevisions', 'value' => ipGetOption('Config.removeOldRevisions', 0), 'label' => __('Remove old page revisions', 'Ip-admin', false)));
     $field->addClass('ipsAutoSave');
     $field->addAttribute('data-fieldid', $field->getName());
     $field->addAttribute('id', $field->getName());
     $field->addAttribute('data-fieldname', $field->getName());
     $form->addField($field);
     $field = new \Ip\Form\Field\Text(array('name' => 'removeOldRevisionsDays', 'value' => ipGetOption('Config.removeOldRevisionsDays', 720), 'label' => __('Days to keep revisions', 'Ip-admin', false), 'hint' => __('Meaningful only if "Remove old page revisions" is on.', 'Ip-admin', false)));
     $field->addClass('ipsAutoSave');
     $field->addAttribute('data-fieldid', $field->getName());
     $field->addAttribute('id', $field->getName());
     $field->addAttribute('data-fieldname', $field->getName());
     $form->addField($field);
     $field = new \Ip\Form\Field\Checkbox(array('name' => 'allowAnonymousUploads', 'value' => ipGetOption('Config.allowAnonymousUploads', 1), 'label' => __('Allow anonymous uploads', 'Ip-admin', false), 'hint' => __('Disabling this feature will prevent users from uploading files to your website. E.g. in contact forms.', 'Ip-admin')));
     $field->addClass('ipsAutoSave');
     $field->addAttribute('data-fieldid', $field->getName());
     $field->addAttribute('id', $field->getName());
     $field->addAttribute('data-fieldname', $field->getName());
     $form->addField($field);
     $field = new \Ip\Form\Field\Checkbox(array('name' => 'trailingSlash', 'value' => ipGetOption('Config.trailingSlash', 1), 'label' => __('Add trailing slash at the end of page URL', 'Ip-admin', false), 'hint' => __('This won\'t change existing URLs. Only new and updated pages will get slash at the end.', 'Ip-admin')));
     $field->addClass('ipsAutoSave');
     $field->addAttribute('data-fieldid', $field->getName());
     $field->addAttribute('id', $field->getName());
     $field->addAttribute('data-fieldname', $field->getName());
     $form->addField($field);
     return $form;
 }
Пример #2
0
 public static function createForm()
 {
     $form = new \Ip\Form();
     // Password input
     $field = new \Ip\Form\Field\Password(array('layout' => \Ip\Form\Field::LAYOUT_NO_LABEL, 'name' => 'pagePassword', 'label' => __('Password', 'PagePassword', false), 'validators' => array('Required')));
     $field->addAttribute('id', 'auth_password');
     $field->addClass('auth_password');
     $form->addField($field);
     // Submit Button
     $field = new \Ip\Form\Field\Submit(array('value' => __('Authenticate', 'PagePassword', false)));
     $field->addAttribute('id', 'auth_submit');
     $field->addClass('auth_submit');
     $form->addField($field);
     $form->addAttribute('id', 'auth_form');
     $form->addClass('auth_form');
     $curUrl = \Ip\Internal\UrlHelper::getCurrentUrl();
     $form->setAction($curUrl);
     $form->setAjaxSubmit(false);
     return $form;
 }
Пример #3
0
 public static function addPageForm()
 {
     $form = new \Ip\Form();
     $form->setEnvironment(\Ip\Form::ENVIRONMENT_ADMIN);
     $form->setAjaxSubmit(false);
     $field = new \Ip\Form\Field\Text(array('name' => 'title', 'label' => __('Title', 'Ip-admin', false)));
     $form->addField($field);
     $field = new \Ip\Form\Field\Checkbox(array('name' => 'isVisible', 'label' => __('Visible', 'Ip-admin', false), 'value' => !ipGetOption('Pages.hideNewPages', 0)));
     $form->addField($field);
     $values = array(array('top', __('Top', 'Ip-admin', false)), array('above', __('Above selected', 'Ip-admin', false)), array('child', __('Child of selected', 'Ip-admin', false)), array('below', __('Below selected', 'Ip-admin', false)), array('bottom', __('Bottom', 'Ip-admin', false)));
     $field = new \Ip\Form\Field\Select(array('name' => 'position', 'label' => __('Position', 'Ip-admin', false), 'values' => $values, 'value' => 'below'));
     $form->addField($field);
     return $form;
 }