diff options
39 files changed, 1629 insertions, 55 deletions
diff --git a/_test/tests/inc/form/checkableelement.test.php b/_test/tests/inc/form/checkableelement.test.php new file mode 100644 index 000000000..a0e4173e8 --- /dev/null +++ b/_test/tests/inc/form/checkableelement.test.php @@ -0,0 +1,49 @@ +<?php + +use dokuwiki\Form; + +class form_checkableelement_test extends DokuWikiTest { + + function test_defaults() { + $form = new Form\Form(); + $form->addRadioButton('foo', 'label text first')->val('first')->attr('checked', 'checked'); + $form->addRadioButton('foo', 'label text second')->val('second'); + + $html = $form->toHTML(); + $pq = phpQuery::newDocumentXHTML($html); + + $input = $pq->find('input[name=foo]'); + $this->assertTrue($input->length == 2); + + $label = $pq->find('label'); + $this->assertTrue($label->length == 2); + + $inputs = $pq->find('input[name=foo]'); + $this->assertEquals('first', pq($inputs->elements[0])->val()); + $this->assertEquals('second', pq($inputs->elements[1])->val()); + $this->assertEquals('checked', pq($inputs->elements[0])->attr('checked')); + $this->assertEquals('', pq($inputs->elements[1])->attr('checked')); + } + + /** + * check that posted values overwrite preset default + */ + function test_prefill() { + global $INPUT; + $INPUT->post->set('foo', 'second'); + + + $form = new Form\Form(); + $form->addRadioButton('foo', 'label text first')->val('first')->attr('checked', 'checked'); + $form->addRadioButton('foo', 'label text second')->val('second'); + + $html = $form->toHTML(); + $pq = phpQuery::newDocumentXHTML($html); + + $inputs = $pq->find('input[name=foo]'); + $this->assertEquals('first', pq($inputs->elements[0])->val()); + $this->assertEquals('second', pq($inputs->elements[1])->val()); + $this->assertEquals('', pq($inputs->elements[0])->attr('checked')); + $this->assertEquals('checked', pq($inputs->elements[1])->attr('checked')); + } +} diff --git a/_test/tests/inc/form/form.test.php b/_test/tests/inc/form/form.test.php new file mode 100644 index 000000000..3ae832b2c --- /dev/null +++ b/_test/tests/inc/form/form.test.php @@ -0,0 +1,115 @@ +<?php + +use dokuwiki\Form; + +/** + * makes form internals accessible for testing + */ +class TestForm extends Form\Form { + /** + * @return array list of element types + */ + function getElementTypeList() { + $list = array(); + foreach($this->elements as $element) $list[] = $element->getType(); + return $list; + } + + public function balanceFieldsets() { + parent::balanceFieldsets(); + } + +} + +class form_form_test extends DokuWikiTest { + + /** + * checks that an empty form is initialized correctly + */ + function test_defaults() { + global $INPUT; + global $ID; + $ID = 'some:test'; + $INPUT->get->set('id', $ID); + $INPUT->get->set('foo', 'bar'); + + $form = new Form\Form(); + $html = $form->toHTML(); + $pq = phpQuery::newDocumentXHTML($html); + + $this->assertTrue($pq->find('form')->hasClass('doku_form')); + $this->assertEquals(wl($ID, array('foo' => 'bar'), false, '&'), $pq->find('form')->attr('action')); + $this->assertEquals('post', $pq->find('form')->attr('method')); + + $this->assertTrue($pq->find('input[name=sectok]')->length == 1); + } + + + function test_fieldsetbalance() { + $form = new TestForm(); + $form->addFieldsetOpen(); + $form->addHTML('ignored'); + $form->addFieldsetClose(); + $form->balanceFieldsets(); + + $this->assertEquals( + array( + 'fieldsetopen', + 'html', + 'fieldsetclose' + ), + $form->getElementTypeList() + ); + + $form = new TestForm(); + $form->addHTML('ignored'); + $form->addFieldsetClose(); + $form->balanceFieldsets(); + + $this->assertEquals( + array( + 'fieldsetopen', + 'html', + 'fieldsetclose' + ), + $form->getElementTypeList() + ); + + + $form = new TestForm(); + $form->addFieldsetOpen(); + $form->addHTML('ignored'); + $form->balanceFieldsets(); + + $this->assertEquals( + array( + 'fieldsetopen', + 'html', + 'fieldsetclose' + ), + $form->getElementTypeList() + ); + + $form = new TestForm(); + $form->addHTML('ignored'); + $form->addFieldsetClose(); + $form->addHTML('ignored'); + $form->addFieldsetOpen(); + $form->addHTML('ignored'); + $form->balanceFieldsets(); + + $this->assertEquals( + array( + 'fieldsetopen', + 'html', + 'fieldsetclose', + 'html', + 'fieldsetopen', + 'html', + 'fieldsetclose' + ), + $form->getElementTypeList() + ); + } + +} diff --git a/_test/tests/inc/form/inputelement.test.php b/_test/tests/inc/form/inputelement.test.php new file mode 100644 index 000000000..7a5e6d2ea --- /dev/null +++ b/_test/tests/inc/form/inputelement.test.php @@ -0,0 +1,41 @@ +<?php + +use dokuwiki\Form; + +class form_inputelement_test extends DokuWikiTest { + + function test_defaults() { + $form = new Form\Form(); + $form->addTextInput('foo', 'label text')->val('this is text'); + + $html = $form->toHTML(); + $pq = phpQuery::newDocumentXHTML($html); + + $input = $pq->find('input[name=foo]'); + $this->assertTrue($input->length == 1); + $this->assertEquals('this is text', $input->val()); + + $label = $pq->find('label'); + $this->assertTrue($label->length == 1); + $this->assertEquals('label text', $label->find('span')->text()); + } + + /** + * check that posted values overwrite preset default + */ + function test_prefill() { + global $INPUT; + $INPUT->post->set('foo', 'a new text'); + + $form = new Form\Form(); + $form->addTextInput('foo', 'label text')->val('this is text'); + + $html = $form->toHTML(); + $pq = phpQuery::newDocumentXHTML($html); + + $input = $pq->find('input[name=foo]'); + $this->assertTrue($input->length == 1); + $this->assertEquals('a new text', $input->val()); + } + +} diff --git a/inc/Form/CheckableElement.php b/inc/Form/CheckableElement.php new file mode 100644 index 000000000..a57bbc1f6 --- /dev/null +++ b/inc/Form/CheckableElement.php @@ -0,0 +1,62 @@ +<?php +namespace dokuwiki\Form; + +/** + * Class CheckableElement + * + * For Radio- and Checkboxes + * + * @package DokuForm + */ +class CheckableElement extends InputElement { + + /** + * @param string $type The type of this element + * @param string $name The name of this form element + * @param string $label The label text for this element + */ + public function __construct($type, $name, $label) { + parent::__construct($type, $name, $label); + // default value is 1 + $this->attr('value', 1); + } + + /** + * Handles the useInput flag and sets the checked attribute accordingly + */ + protected function prefillInput() { + global $INPUT; + list($name, $key) = $this->getInputName(); + $myvalue = $this->val(); + + if(!$INPUT->has($name)) return; + + if($key === null) { + // no key - single value + $value = $INPUT->str($name); + if($value == $myvalue) { + $this->attr('checked', 'checked'); + } else { + $this->rmattr('checked'); + } + } else { + // we have an array, there might be several values in it + $input = $INPUT->arr($name); + if(isset($input[$key])) { + $this->rmattr('checked'); + + // values seem to be in another sub array + if(is_array($input[$key])) { + $input = $input[$key]; + } + + foreach($input as $value) { + if($value == $myvalue) { + $this->attr('checked', 'checked'); + } + } + } + } + } + +} diff --git a/inc/Form/Element.php b/inc/Form/Element.php new file mode 100644 index 000000000..7938ee009 --- /dev/null +++ b/inc/Form/Element.php @@ -0,0 +1,151 @@ +<?php +namespace dokuwiki\Form; + +/** + * Class Element + * + * The basic building block of a form + * + * @package dokuwiki\Form + */ +abstract class Element { + + /** + * @var array the attributes of this element + */ + protected $attributes = array(); + + /** + * @var string The type of this element + */ + protected $type; + + /** + * @param string $type The type of this element + * @param array $attributes + */ + public function __construct($type, $attributes = array()) { + $this->type = $type; + $this->attributes = $attributes; + } + + /** + * Type of this element + * + * @return string + */ + public function getType() { + return $this->type; + } + + /** + * Gets or sets an attribute + * + * When no $value is given, the current content of the attribute is returned. + * An empty string is returned for unset attributes. + * + * When a $value is given, the content is set to that value and the Element + * itself is returned for easy chaining + * + * @param string $name Name of the attribute to access + * @param null|string $value New value to set + * @return string|$this + */ + public function attr($name, $value = null) { + // set + if($value !== null) { + $this->attributes[$name] = $value; + return $this; + } + + // get + if(isset($this->attributes[$name])) { + return $this->attributes[$name]; + } else { + return ''; + } + } + + /** + * Removes the given attribute if it exists + * + * @param $name + * @return $this + */ + public function rmattr($name) { + if(isset($this->attributes[$name])) { + unset($this->attributes[$name]); + } + return $this; + } + + /** + * Gets or adds a all given attributes at once + * + * @param array|null $attributes + * @return array|$this + */ + public function attrs($attributes = null) { + // set + if($attributes) { + foreach((array) $attributes as $key => $val) { + $this->attr($key, $val); + } + return $this; + } + // get + return $this->attributes; + } + + /** + * Adds a class to the class attribute + * + * This is the preferred method of setting the element's class + * + * @param string $class the new class to add + * @return $this + */ + public function addClass($class) { + $classes = explode(' ', $this->attr('class')); + $classes[] = $class; + $classes = array_unique($classes); + $classes = array_filter($classes); + $this->attr('class', join(' ', $classes)); + return $this; + } + + /** + * Get or set the element's ID + * + * This is the preferred way of setting the element's ID + * + * @param null|string $id + * @return string|$this + */ + public function id($id = null) { + if(strpos($id, '__') === false) { + throw new \InvalidArgumentException('IDs in DokuWiki have to contain two subsequent underscores'); + } + + return $this->attr('id', $id); + } + + /** + * Get or set the element's value + * + * This is the preferred way of setting the element's value + * + * @param null|string $value + * @return string|$this + */ + public function val($value = null) { + return $this->attr('value', $value); + } + + /** + * The HTML representation of this element + * + * @return string + */ + abstract public function toHTML(); +} diff --git a/inc/Form/FieldsetCloseElement.php b/inc/Form/FieldsetCloseElement.php new file mode 100644 index 000000000..8f26717aa --- /dev/null +++ b/inc/Form/FieldsetCloseElement.php @@ -0,0 +1,30 @@ +<?php +namespace dokuwiki\Form; + +/** + * Class FieldsetCloseElement + * + * Closes an open Fieldset + * + * @package dokuwiki\Form + */ +class FieldsetCloseElement extends TagCloseElement { + + /** + * @param array $attributes + */ + public function __construct($attributes = array()) { + parent::__construct('', $attributes); + $this->type = 'fieldsetclose'; + } + + + /** + * The HTML representation of this element + * + * @return string + */ + public function toHTML() { + return '</fieldset>'; + } +} diff --git a/inc/Form/FieldsetOpenElement.php b/inc/Form/FieldsetOpenElement.php new file mode 100644 index 000000000..a7de461fa --- /dev/null +++ b/inc/Form/FieldsetOpenElement.php @@ -0,0 +1,36 @@ +<?php +namespace dokuwiki\Form; + +/** + * Class FieldsetOpenElement + * + * Opens a Fieldset with an optional legend + * + * @package dokuwiki\Form + */ +class FieldsetOpenElement extends TagOpenElement { + + /** + * @param string $legend + * @param array $attributes + */ + public function __construct($legend='', $attributes = array()) { + // this is a bit messy and we just do it for the nicer class hierarchy + // the parent would expect the tag in $value but we're storing the + // legend there, so we have to set the type manually + parent::__construct($legend, $attributes); + $this->type = 'fieldsetopen'; + } + + /** + * The HTML representation of this element + * + * @return string + */ + public function toHTML() { + $html = '<fieldset '.buildAttributes($this->attrs()).'>'; + $legend = $this->val(); + if($legend) $html .= DOKU_LF.'<legend>'.hsc($legend).'</legend>'; + return $html; + } +} diff --git a/inc/Form/Form.php b/inc/Form/Form.php new file mode 100644 index 000000000..625557fa1 --- /dev/null +++ b/inc/Form/Form.php @@ -0,0 +1,367 @@ +<?php +namespace dokuwiki\Form; + +/** + * Class Form + * + * Represents the whole Form. This is what you work on, and add Elements to + * + * @package dokuwiki\Form + */ +class Form extends Element { + + /** + * @var array name value pairs for hidden values + */ + protected $hidden = array(); + + /** + * @var Element[] the elements of the form + */ + protected $elements = array(); + + /** + * Creates a new, empty form with some default attributes + * + * @param array $attributes + */ + public function __construct($attributes = array()) { + global $ID; + + parent::__construct('form', $attributes); + + // use the current URL as default action + if(!$this->attr('action')) { + $get = $_GET; + if(isset($get['id'])) unset($get['id']); + $self = wl($ID, $get, false, '&'); //attributes are escaped later + $this->attr('action', $self); + } + + // post is default + if(!$this->attr('method')) { + $this->attr('method', 'post'); + } + + // we like UTF-8 + if(!$this->attr('accept-charset')) { + $this->attr('accept-charset', 'utf-8'); + } + + // add the security token by default + $this->setHiddenField('sectok', getSecurityToken()); + + // identify this as a new form based form in HTML + $this->addClass('doku_form'); + } + + /** + * Sets a hidden field + * + * @param $name + * @param $value + * @return $this + */ + public function setHiddenField($name, $value) { + $this->hidden[$name] = $value; + return $this; + } + + #region element query function + + /** + * Returns the numbers of elements in the form + * + * @return int + */ + public function elementCount() { + return count($this->elements); + } + + /** + * Returns a reference to the element at a position. + * A position out-of-bounds will return either the + * first (underflow) or last (overflow) element. + * + * @param $pos + * @return Element + */ + public function getElementAt($pos) { + if($pos < 0) $pos = count($this->elements) + $pos; + if($pos < 0) $pos = 0; + if($pos >= count($this->elements)) $pos = count($this->elements) - 1; + return $this->elements[$pos]; + } + + /** + * Gets the position of the first of a type of element + * + * @param string $type Element type to look for. + * @param int $offset search from this position onward + * @return false|int position of element if found, otherwise false + */ + public function findPositionByType($type, $offset = 0) { + $len = $this->elementCount(); + for($pos = $offset; $pos < $len; $pos++) { + if($this->elements[$pos]->getType() == $type) { + return $pos; + } + } + return false; + } + + /** + * Gets the position of the first element matching the attribute + * + * @param string $name Name of the attribute + * @param string $value Value the attribute should have + * @param int $offset search from this position onward + * @return false|int position of element if found, otherwise false + */ + public function findPositionByAttribute($name, $value, $offset = 0) { + $len = $this->elementCount(); + for($pos = $offset; $pos < $len; $pos++) { + if($this->elements[$pos]->attr($name) == $value) { + return $pos; + } + } + return false; + } + + #endregion + + #region Element positioning functions + + /** + * Adds or inserts an element to the form + * + * @param Element $element + * @param int $pos 0-based position in the form, -1 for at the end + * @return Element + */ + public function addElement(Element $element, $pos = -1) { + if(is_a($element, '\dokuwiki\Form')) throw new \InvalidArgumentException('You can\'t add a form to a form'); + if($pos < 0) { + $this->elements[] = $element; + } else { + array_splice($this->elements, $pos, 0, array($element)); + } + return $element; + } + + /** + * Replaces an existing element with a new one + * + * @param Element $element the new element + * @param $pos 0-based position of the element to replace + */ + public function replaceElement(Element $element, $pos) { + if(is_a($element, '\dokuwiki\Form')) throw new \InvalidArgumentException('You can\'t add a form to a form'); + array_splice($this->elements, $pos, 1, array($element)); + } + + /** + * Remove an element from the form completely + * + * @param $pos 0-based position of the element to remove + */ + public function removeElement($pos) { + array_splice($this->elements, $pos, 1); + } + + #endregion + + #region Element adding functions + + /** + * Adds a text input field + * + * @param $name + * @param $label + * @param int $pos + * @return InputElement + */ + public function addTextInput($name, $label = '', $pos = -1) { + return $this->addElement(new InputElement('text', $name, $label), $pos); + } + + /** + * Adds a password input field + * + * @param $name + * @param $label + * @param int $pos + * @return InputElement + */ + public function addPasswordInput($name, $label = '', $pos = -1) { + return $this->addElement(new InputElement('password', $name, $label), $pos); + } + + /** + * Adds a radio button field + * + * @param $name + * @param $label + * @param int $pos + * @return CheckableElement + */ + public function addRadioButton($name, $label = '', $pos = -1) { + return $this->addElement(new CheckableElement('radio', $name, $label), $pos); + } + + /** + * Adds a checkbox field + * + * @param $name + * @param $label + * @param int $pos + * @return CheckableElement + */ + public function addCheckbox($name, $label = '', $pos = -1) { + return $this->addElement(new CheckableElement('checkbox', $name, $label), $pos); + } + + /** + * Adds a textarea field + * + * @param $name + * @param $label + * @param int $pos + * @return TextareaElement + */ + public function addTextarea($name, $label = '', $pos = -1) { + return $this->addElement(new TextareaElement($name, $label), $pos); + } + + /** + * Add fixed HTML to the form + * + * @param $html + * @param int $pos + * @return HTMLElement + */ + public function addHTML($html, $pos = -1) { + return $this->addElement(new HTMLElement($html), $pos); + } + + /** + * Add a closed HTML tag to the form + * + * @param $tag + * @param int $pos + * @return TagElement + */ + public function addTag($tag, $pos = -1) { + return $this->addElement(new TagElement($tag), $pos); + } + + /** + * Add an open HTML tag to the form + * + * Be sure to close it again! + * + * @param $tag + * @param int $pos + * @return TagOpenElement + */ + public function addTagOpen($tag, $pos = -1) { + return $this->addElement(new TagOpenElement($tag), $pos); + } + + /** + * Add a closing HTML tag to the form + * + * Be sure it had been opened before + * + * @param $tag + * @param int $pos + * @return TagCloseElement + */ + public function addTagClose($tag, $pos = -1) { + return $this->addElement(new TagCloseElement($tag), $pos); + } + + /** + * Open a Fieldset + * + * @param $legend + * @param int $pos + * @return FieldsetOpenElement + */ + public function addFieldsetOpen($legend = '', $pos = -1) { + return $this->addElement(new FieldsetOpenElement($legend), $pos); + } + + /** + * Close a fieldset + * + * @param int $pos + * @return TagCloseElement + */ + public function addFieldsetClose($pos = -1) { + return $this->addElement(new FieldsetCloseElement(), $pos); + } + + #endregion + + /** + * Adjust the elements so that fieldset open and closes are matching + */ + protected function balanceFieldsets() { + $lastclose = 0; + $isopen = false; + $len = count($this->elements); + + for($pos = 0; $pos < $len; $pos++) { + $type = $this->elements[$pos]->getType(); + if($type == 'fieldsetopen') { + if($isopen) { + //close previous fieldset + $this->addFieldsetClose($pos); + $lastclose = $pos + 1; + $pos++; + $len++; + } + $isopen = true; + } else if($type == 'fieldsetclose') { + if(!$isopen) { + // make sure there was a fieldsetopen + // either right after the last close or at the begining + $this->addFieldsetOpen('', $lastclose); + $len++; + $pos++; + } + $lastclose = $pos; + $isopen = false; + } + } + + // close open fieldset at the end + if($isopen) { + $this->addFieldsetClose(); + } + } + + /** + * The HTML representation of the whole form + * + * @return string + */ + public function toHTML() { + $this->balanceFieldsets(); + + $html = '<form ' . buildAttributes($this->attrs()) . '>' . DOKU_LF; + + foreach($this->hidden as $name => $value) { + $html .= '<input type="hidden" name="' . $name . '" value="' . formText($value) . '" />' . DOKU_LF; + } + + foreach($this->elements as $element) { + $html .= $element->toHTML() . DOKU_LF; + } + + $html .= '</form>' . DOKU_LF; + + return $html; + } +} diff --git a/inc/Form/HTMLElement.php b/inc/Form/HTMLElement.php new file mode 100644 index 000000000..591cf472f --- /dev/null +++ b/inc/Form/HTMLElement.php @@ -0,0 +1,29 @@ +<?php +namespace dokuwiki\Form; + +/** + * Class HTMLElement + * + * Holds arbitrary HTML that is added as is to the Form + * + * @package dokuwiki\Form + */ +class HTMLElement extends ValueElement { + + + /** + * @param string $html + */ + public function __construct($html) { + parent::__construct('html', $html); + } + + /** + * The HTML representation of this element + * + * @return string + */ + public function toHTML() { + return $this->val(); + } +} diff --git a/inc/Form/InputElement.php b/inc/Form/InputElement.php new file mode 100644 index 000000000..5908f7d11 --- /dev/null +++ b/inc/Form/InputElement.php @@ -0,0 +1,160 @@ +<?php +namespace dokuwiki\Form; + +/** + * Class InputElement + * + * Base class for all input elements. Uses a wrapping label when label + * text is given. + * + * @todo figure out how to make wrapping or related label configurable + * @package dokuwiki\Form + */ +class InputElement extends Element { + /** + * @var Label + */ + protected $label = null; + + /** + * @var bool if the element should reflect posted values + */ + protected $useInput = true; + + /** + * @param string $type The type of this element + * @param string $name The name of this form element + * @param string $label The label text for this element + */ + public function __construct($type, $name, $label = '') { + parent::__construct($type, array('name' => $name)); + $this->attr('name', $name); + if($label) $this->label = new Label($label); + } + + /** + * Returns the label element if there's one set + * + * @return Label|null + */ + public function getLabel() { + return $this->label; + } + + /** + * Should the user sent input be used to initialize the input field + * + * The default is true. Any set values will be overwritten by the INPUT + * provided values. + * + * @param bool $useinput + * @return $this + */ + public function useInput($useinput) { + $this->useInput = (bool) $useinput; + return $this; + } + + /** + * Get or set the element's ID + * + * @param null|string $id + * @return string|$this + */ + public function id($id = null) { + if($this->label) $this->label->attr('for', $id); + return parent::id($id); + } + + /** + * Adds a class to the class attribute + * + * This is the preferred method of setting the element's class + * + * @param string $class the new class to add + * @return $this + */ + public function addClass($class) { + if($this->label) $this->label->addClass($class); + return parent::addClass($class); + } + + /** + * Figures out how to access the value for this field from INPUT data + * + * The element's name could have been given as a simple string ('foo') + * or in array notation ('foo[bar]'). + * + * Note: this function only handles one level of arrays. If your data + * is nested deeper, you should call useInput(false) and set the + * correct value yourself + * + * @return array name and array key (null if not an array) + */ + protected function getInputName() { + $name = $this->attr('name'); + parse_str("$name=1", $parsed); + + $name = array_keys($parsed); + $name = array_shift($name); + + if(is_array($parsed[$name])) { + $key = array_keys($parsed[$name]); + $key = array_shift($key); + } else { + $key = null; + } + + return array($name, $key); + } + + /** + * Handles the useInput flag and set the value attribute accordingly + */ + protected function prefillInput() { + global $INPUT; + + list($name, $key) = $this->getInputName(); + if(!$INPUT->has($name)) return; + + if($key === null) { + $value = $INPUT->str($name); + } else { + $value = $INPUT->arr($name); + if(isset($value[$key])) { + $value = $value[$key]; + } else { + $value = ''; + } + } + if($value !== '') { + $this->val($value); + } + } + + /** + * The HTML representation of this element + * + * @return string + */ + protected function mainElementHTML() { + if($this->useInput) $this->prefillInput(); + return '<input ' . buildAttributes($this->attrs()) . ' />'; + } + + /** + * The HTML representation of this element wrapped in a label + * + * @return string + */ + public function toHTML() { + if($this->label) { + return '<label ' . buildAttributes($this->label->attrs()) . '>' . DOKU_LF . + '<span>' . hsc($this->label->val()) . '</span>' . DOKU_LF . + $this->mainElementHTML() . DOKU_LF . + '</label>'; + } else { + return $this->mainElementHTML(); + } + } +} diff --git a/inc/Form/Label.php b/inc/Form/Label.php new file mode 100644 index 000000000..8dcd7cd5f --- /dev/null +++ b/inc/Form/Label.php @@ -0,0 +1,27 @@ +<?php +namespace dokuwiki\Form; + +/** + * Class Label + * @package dokuwiki\Form + */ +class Label extends ValueElement { + + /** + * Creates a new Label + * + * @param string $label + */ + public function __construct($label) { + parent::__construct('label', $label); + } + + /** + * The HTML representation of this element + * + * @return string + */ + public function toHTML() { + return '<label ' . buildAttributes($this->attrs()) . '>' . hsc($this->val()) . '</label>'; + } +} diff --git a/inc/Form/LegacyForm.php b/inc/Form/LegacyForm.php new file mode 100644 index 000000000..1b47ba204 --- /dev/null +++ b/inc/Form/LegacyForm.php @@ -0,0 +1,181 @@ +<?php +namespace dokuwiki\Form; + +/** + * Class LegacyForm + * + * Provides a compatibility layer to the old Doku_Form API + * + * This can be used to work with the modern API on forms provided by old events for + * example. When you start new forms, just use Form\Form + * + * @package dokuwiki\Form + */ +class LegacyForm extends Form { + + /** + * Creates a new modern form from an old legacy Doku_Form + * + * @param \Doku_Form $oldform + */ + public function __construct(\Doku_Form $oldform) { + parent::__construct($oldform->params); + + $this->hidden = $oldform->_hidden; + + foreach($oldform->_content as $element) { + list($ctl, $attr) = $this->parseLegacyAttr($element); + + if(is_array($element)) { + switch($ctl['elem']) { + case 'wikitext': + $this->addTextarea('wikitext') + ->attrs($attr) + ->id('wiki__text') + ->val($ctl['text']) + ->addClass($ctl['class']); + break; + case 'textfield': + $this->addTextInput($ctl['name'], $ctl['text']) + ->attrs($attr) + ->id($ctl['id']) + ->addClass($ctl['class']); + break; + case 'passwordfield': + $this->addPasswordInput($ctl['name'], $ctl['text']) + ->attrs($attr) + ->id($ctl['id']) + ->addClass($ctl['class']); + break; + case 'checkboxfield': + $this->addCheckbox($ctl['name'], $ctl['text']) + ->attrs($attr) + ->id($ctl['id']) + ->addClass($ctl['class']); + break; + case 'radiofield': + $this->addRadioButton($ctl['name'], $ctl['text']) + ->attrs($attr) + ->id($ctl['id']) + ->addClass($ctl['class']); + break; + case 'tag': + $this->addTag($ctl['tag']) + ->attrs($attr) + ->attr('name', $ctl['name']) + ->id($ctl['id']) + ->addClass($ctl['class']); + break; + case 'opentag': + $this->addTagOpen($ctl['tag']) + ->attrs($attr) + ->attr('name', $ctl['name']) + ->id($ctl['id']) + ->addClass($ctl['class']); + break; + case 'closetag': + $this->addTagClose($ctl['tag']); + break; + case 'openfieldset': + $this->addFieldsetOpen($ctl['legend']) + ->attrs($attr) + ->attr('name', $ctl['name']) + ->id($ctl['id']) + ->addClass($ctl['class']); + break; + case 'closefieldset': + $this->addFieldsetClose(); + break; + case 'button': + case 'field': + case 'fieldright': + case 'filefield': + case 'menufield': + case 'listboxfield': + throw new \UnexpectedValueException('Unsupported legacy field ' . $ctl['elem']); + break; + default: + throw new \UnexpectedValueException('Unknown legacy field ' . $ctl['elem']); + + } + } else { + $this->addHTML($element); + } + } + + } + + /** + * Parses out what is the elements attributes and what is control info + * + * @param array $legacy + * @return array + */ + protected function parseLegacyAttr($legacy) { + $attributes = array(); + $control = array(); + + foreach($legacy as $key => $val) { + if($key{0} == '_') { + $control[substr($key, 1)] = $val; + } elseif($key == 'name') { + $control[$key] = $val; + } elseif($key == 'id') { + $control[$key] = $val; + } else { + $attributes[$key] = $val; + } + } + + return array($control, $attributes); + } + + /** + * Translates our types to the legacy types + * + * @param string $type + * @return string + */ + protected function legacyType($type) { + static $types = array( + 'text' => 'textfield', + 'password' => 'passwordfield', + 'checkbox' => 'checkboxfield', + 'radio' => 'radiofield', + 'tagopen' => 'opentag', + 'tagclose' => 'closetag', + 'fieldsetopen' => 'openfieldset', + 'fieldsetclose' => 'closefieldset', + ); + if(isset($types[$type])) return $types[$type]; + return $type; + } + + /** + * Creates an old legacy form from this modern form's data + * + * @return \Doku_Form + */ + public function toLegacy() { + $this->balanceFieldsets(); + + $legacy = new \Doku_Form($this->attrs()); + $legacy->_hidden = $this->hidden; + foreach($this->elements as $element) { + if(is_a($element, 'dokuwiki\Form\HTMLElement')) { + $legacy->_content[] = $element->toHTML(); + } elseif(is_a($element, 'dokuwiki\Form\InputElement')) { + /** @var InputElement $element */ + $data = $element->attrs(); + $data['_elem'] = $this->legacyType($element->getType()); + $label = $element->getLabel(); + if($label) { + $data['_class'] = $label->attr('class'); + } + $legacy->_content[] = $data; + } + } + + return $legacy; + } +} diff --git a/inc/Form/TagCloseElement.php b/inc/Form/TagCloseElement.php new file mode 100644 index 000000000..dc0264c21 --- /dev/null +++ b/inc/Form/TagCloseElement.php @@ -0,0 +1,76 @@ +<?php +namespace dokuwiki\Form; + +/** + * Class TagCloseElement + * + * Creates an HTML close tag. You have to make sure it has been opened + * before or this will produce invalid HTML + * + * @package dokuwiki\Form + */ +class TagCloseElement extends ValueElement { + + /** + * @param string $tag + * @param array $attributes + */ + public function __construct($tag, $attributes = array()) { + parent::__construct('tagclose', $tag, $attributes); + } + + /** + * do not call this + * + * @param $class + * @return void + * @throws \BadMethodCallException + */ + public function addClass($class) { + throw new \BadMethodCallException('You can\t add classes to closing tag'); + } + + /** + * do not call this + * + * @param $id + * @return void + * @throws \BadMethodCallException + */ + public function id($id = null) { + throw new \BadMethodCallException('You can\t add ID to closing tag'); + } + + /** + * do not call this + * + * @param $name + * @param $value + * @return void + * @throws \BadMethodCallException + */ + public function attr($name, $value = null) { + throw new \BadMethodCallException('You can\t add attributes to closing tag'); + } + + /** + * do not call this + * + * @param $attributes + * @return void + * @throws \BadMethodCallException + */ + public function attrs($attributes = null) { + throw new \BadMethodCallException('You can\t add attributes to closing tag'); + } + + /** + * The HTML representation of this element + * + * @return string + */ + public function toHTML() { + return '</'.$this->val().'>'; + } + +} diff --git a/inc/Form/TagElement.php b/inc/Form/TagElement.php new file mode 100644 index 000000000..ea5144c9c --- /dev/null +++ b/inc/Form/TagElement.php @@ -0,0 +1,29 @@ +<?php +namespace dokuwiki\Form; + +/** + * Class TagElement + * + * Creates a self closing HTML tag + * + * @package dokuwiki\Form + */ +class TagElement extends ValueElement { + + /** + * @param string $tag + * @param array $attributes + */ + public function __construct($tag, $attributes = array()) { + parent::__construct('tag', $tag, $attributes); + } + + /** + * The HTML representation of this element + * + * @return string + */ + public function toHTML() { + return '<'.$this->val().' '.buildAttributes($this->attrs()).' />'; + } +} diff --git a/inc/Form/TagOpenElement.php b/inc/Form/TagOpenElement.php new file mode 100644 index 000000000..0afe97b45 --- /dev/null +++ b/inc/Form/TagOpenElement.php @@ -0,0 +1,30 @@ +<?php +namespace dokuwiki\Form; + +/** + * Class TagOpenElement + * + * Creates an open HTML tag. You have to make sure you close it + * again or this will produce invalid HTML + * + * @package dokuwiki\Form + */ +class TagOpenElement extends ValueElement { + + /** + * @param string $tag + * @param array $attributes + */ + public function __construct($tag, $attributes = array()) { + parent::__construct('tagopen', $tag, $attributes); + } + + /** + * The HTML representation of this element + * + * @return string + */ + public function toHTML() { + return '<'.$this->val().' '.buildAttributes($this->attrs()).'>'; + } +} diff --git a/inc/Form/TextareaElement.php b/inc/Form/TextareaElement.php new file mode 100644 index 000000000..9d461fdf5 --- /dev/null +++ b/inc/Form/TextareaElement.php @@ -0,0 +1,51 @@ +<?php +namespace dokuwiki\Form; + +/** + * Class TextareaElement + * @package dokuwiki\Form + */ +class TextareaElement extends InputElement { + + /** + * @var string the actual text within the area + */ + protected $text; + + /** + * @param string $name The name of this form element + * @param string $label The label text for this element + */ + public function __construct($name, $label) { + parent::__construct('textarea', $name, $label); + $this->attr('dir', 'auto'); + } + + /** + * Get or set the element's value + * + * This is the preferred way of setting the element's value + * + * @param null|string $value + * @return string|$this + */ + public function val($value = null) { + if($value !== null) { + $this->text = $value; + return $this; + } + return $this->text; + } + + /** + * The HTML representation of this element + * + * @return string + */ + protected function mainElementHTML() { + if($this->useInput) $this->prefillInput(); + return '<textarea ' . buildAttributes($this->attrs()) . '>' . + formText($this->val()) . '</textarea>'; + } + +} diff --git a/inc/Form/ValueElement.php b/inc/Form/ValueElement.php new file mode 100644 index 000000000..9dc2fd0df --- /dev/null +++ b/inc/Form/ValueElement.php @@ -0,0 +1,45 @@ +<?php + +namespace dokuwiki\Form; + +/** + * Class ValueElement + * + * Just like an Element but it's value is not part of its attributes + * + * What the value is (tag name, content, etc) is defined by the actual implementations + * + * @package dokuwiki\Form + */ +abstract class ValueElement extends Element { + + /** + * @var string holds the element's value + */ + protected $value = ''; + + /** + * @param string $type + * @param array|string $value + * @param array $attributes + */ + public function __construct($type, $value, $attributes = array()) { + parent::__construct($type, $attributes); + $this->val($value); + } + + /** + * Get or set the element's value + * + * @param null|string $value + * @return string|$this + */ + public function val($value = null) { + if($value !== null) { + $this->value = $value; + return $this; + } + return $this->value; + } + +} diff --git a/inc/lang/bg/lang.php b/inc/lang/bg/lang.php index daeaf9bd6..f12b66a62 100644 --- a/inc/lang/bg/lang.php +++ b/inc/lang/bg/lang.php @@ -286,7 +286,7 @@ $lang['i_confexists'] = '<code>%s</code> вече съществува' $lang['i_writeerr'] = '<code>%s</code> не можа да бъде създаден. Трябва да проверите правата за достъп до директорията/файла и да създадете файла ръчно.'; $lang['i_badhash'] = 'Файлът dokuwiki.php не може да бъде разпознат или е променен (hash=<code>%s</code>)'; $lang['i_badval'] = '<code>%s</code> - непозволена или празна стойност'; -$lang['i_success'] = 'Настройването приключи успешно. Вече можете да изтриете файла install.php. Продължете към <a href="doku.php?id=wiki:welcome">Вашето ново DokuWiki</a>.'; +$lang['i_success'] = 'Настройването приключи успешно. Вече можете да изтриете файла install.php. Продължете към <a href="doku.php?id=wiki:welcome">Вашето новата инсталация на DokuWiki</a>.'; $lang['i_failure'] = 'Възникнаха грешки при записването на файловете с настройки. Вероятно ще се наложи да ги поправите ръчно, за да можете да ползвате <a href="doku.php?id=wiki:welcome">Вашето ново DokuWiki</a>.'; $lang['i_policy'] = 'Първоначална политика за достъп'; diff --git a/inc/lang/fr/lang.php b/inc/lang/fr/lang.php index 8663c035f..c737862fc 100644 --- a/inc/lang/fr/lang.php +++ b/inc/lang/fr/lang.php @@ -37,6 +37,7 @@ * @author YoBoY <yoboy@ubuntu-fr.org> * @author james <j.mccann@celcat.com> * @author Pietroni <pietroni@informatique.univ-paris-diderot.fr> + * @author Floriang <antispam@floriang.eu> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -68,7 +69,7 @@ $lang['btn_update'] = 'Mettre à jour'; $lang['btn_delete'] = 'Effacer'; $lang['btn_back'] = 'Retour'; $lang['btn_backlink'] = 'Liens de retour'; -$lang['btn_subscribe'] = 'Gérer souscriptions'; +$lang['btn_subscribe'] = 'Gérer les abonnements'; $lang['btn_profile'] = 'Mettre à jour le profil'; $lang['btn_reset'] = 'Réinitialiser'; $lang['btn_resendpwd'] = 'Définir un nouveau mot de passe'; @@ -285,18 +286,18 @@ $lang['img_camera'] = 'Appareil photo:'; $lang['img_keywords'] = 'Mots-clés:'; $lang['img_width'] = 'Largeur:'; $lang['img_height'] = 'Hauteur:'; -$lang['subscr_subscribe_success'] = '%s a été ajouté à la liste de souscription de %s'; -$lang['subscr_subscribe_error'] = 'Erreur à l\'ajout de %s à la liste de souscription de %s'; -$lang['subscr_subscribe_noaddress'] = 'Il n\'y a pas d\'adresse associée à votre identifiant, vous ne pouvez pas être ajouté à la liste de souscription'; -$lang['subscr_unsubscribe_success'] = '%s a été supprimé de la liste de souscription de %s'; -$lang['subscr_unsubscribe_error'] = 'Erreur au retrait de %s de la liste de souscription de %s'; -$lang['subscr_already_subscribed'] = '%s est déjà souscrit à %s'; -$lang['subscr_not_subscribed'] = '%s n\'est pas souscrit à %s'; -$lang['subscr_m_not_subscribed'] = 'Vous n\'avez pas souscrit pour l\'instant à la page actuelle ou à la catégorie'; -$lang['subscr_m_new_header'] = 'Ajouter une souscription'; -$lang['subscr_m_current_header'] = 'Souscriptions actives'; -$lang['subscr_m_unsubscribe'] = 'Annuler la souscription'; -$lang['subscr_m_subscribe'] = 'Souscrire'; +$lang['subscr_subscribe_success'] = '%s a été ajouté à la liste des abonnés de %s'; +$lang['subscr_subscribe_error'] = 'Erreur à l\'ajout de %s à la liste des abonnés de %s'; +$lang['subscr_subscribe_noaddress'] = 'Il n\'y a pas d\'adresse associée à votre identifiant, vous ne pouvez pas être ajouté à la liste des abonnés.'; +$lang['subscr_unsubscribe_success'] = '%s a été supprimé de la liste des abonnés de %s'; +$lang['subscr_unsubscribe_error'] = 'Erreur au retrait de %s de la liste des abonnés de %s'; +$lang['subscr_already_subscribed'] = '%s est déjà abonné à %s'; +$lang['subscr_not_subscribed'] = '%s n\'est pas abonné à %s'; +$lang['subscr_m_not_subscribed'] = 'Vous n\'êtes pour l\'instant pas abonné à la page actuelle ou à la catégorie'; +$lang['subscr_m_new_header'] = 'Ajouter un abonnement'; +$lang['subscr_m_current_header'] = 'Abonnements actifs'; +$lang['subscr_m_unsubscribe'] = 'Annuler l\'abonnement'; +$lang['subscr_m_subscribe'] = 'S\'abonner'; $lang['subscr_m_receive'] = 'Recevoir'; $lang['subscr_style_every'] = 'Recevoir un courriel à chaque modification'; $lang['subscr_style_digest'] = 'Courriel, tous les %.2f jours, résumant les modifications de chaque page'; diff --git a/inc/lang/fr/subscr_digest.txt b/inc/lang/fr/subscr_digest.txt index 7ec75ca76..8c21e5787 100644 --- a/inc/lang/fr/subscr_digest.txt +++ b/inc/lang/fr/subscr_digest.txt @@ -14,6 +14,6 @@ Pour annuler les notifications de page, connectez-vous au wiki à l'adresse @SUBSCRIBE@ et désabonnez-vous de la page ou de la catégorie. --- +-- Ce courriel a été généré par DokuWiki depuis @DOKUWIKIURL@
\ No newline at end of file diff --git a/inc/lang/fr/subscr_form.txt b/inc/lang/fr/subscr_form.txt index d68c05e6a..f14832e07 100644 --- a/inc/lang/fr/subscr_form.txt +++ b/inc/lang/fr/subscr_form.txt @@ -1,3 +1,3 @@ ====== Gestion des souscriptions ====== -Cette page vous permet de gérer vos souscriptions pour suivre les modifications sur la page et sur la catégorie courante.
\ No newline at end of file +Cette page vous permet de gérer vos abonnements pour suivre les modifications sur la page et sur la catégorie courante.
\ No newline at end of file diff --git a/inc/lang/fr/subscr_list.txt b/inc/lang/fr/subscr_list.txt index d8c6b68e4..38d76d8cc 100644 --- a/inc/lang/fr/subscr_list.txt +++ b/inc/lang/fr/subscr_list.txt @@ -11,6 +11,6 @@ Pour annuler les notifications de page, connectez-vous au wiki à l'adresse @SUBSCRIBE@ et désabonnez-vous de la page ou de la catégorie. --- +-- Ce courriel a été généré par Dokuwiki : @DOKUWIKIURL@
\ No newline at end of file diff --git a/inc/lang/fr/subscr_single.txt b/inc/lang/fr/subscr_single.txt index 236d45e8f..13f2998d3 100644 --- a/inc/lang/fr/subscr_single.txt +++ b/inc/lang/fr/subscr_single.txt @@ -17,6 +17,6 @@ Pour annuler les notifications de page, connectez-vous au wiki à l'adresse @SUBSCRIBE@ et désabonnez-vous de la page ou de la catégorie. --- +-- Ce courriel a été généré par Dokuwiki depuis @DOKUWIKIURL@
\ No newline at end of file diff --git a/inc/lang/ja/lang.php b/inc/lang/ja/lang.php index 290bb175b..38df66d1f 100644 --- a/inc/lang/ja/lang.php +++ b/inc/lang/ja/lang.php @@ -330,7 +330,7 @@ $lang['media_files'] = '%s 内のファイル'; $lang['media_upload'] = '%s にアップロード'; $lang['media_search'] = '%s 内で検索'; $lang['media_view'] = '%s'; -$lang['media_viewold'] = '%s at %s'; +$lang['media_viewold'] = '%2$s に %1$s'; $lang['media_edit'] = '%s を編集'; $lang['media_history'] = '%s の履歴'; $lang['media_meta_edited'] = 'メタデータが編集されました'; diff --git a/inc/lang/ko/backlinks.txt b/inc/lang/ko/backlinks.txt index 6a6ad48a4..457974d86 100644 --- a/inc/lang/ko/backlinks.txt +++ b/inc/lang/ko/backlinks.txt @@ -1,3 +1,3 @@ -====== 백링크 ====== +====== 역링크 ====== 현재 문서를 가리키는 링크가 있는 문서 목록입니다.
\ No newline at end of file diff --git a/inc/lang/ko/draft.txt b/inc/lang/ko/draft.txt index 7e700f725..bb6dc8c00 100644 --- a/inc/lang/ko/draft.txt +++ b/inc/lang/ko/draft.txt @@ -2,4 +2,4 @@ 이 문서의 마지막 편집 세션은 올바르게 끝나지 않았습니다. 도쿠위키는 작업 도중 자동으로 저장된 초안을 사용해 편집을 계속 할 수 있습니다. 마지막 세션 동안 저장된 초안을 아래에서 볼 수 있습니다. -비정상적으로 끝난 편집 세션을 **되돌릴**지 여부를 결정하고, 자동으로 저장되었던 초안을 **삭제**하거나 편집 과정을 **취소**하세요.
\ No newline at end of file +비정상적으로 끝난 편집 세션을 **복구**할지 여부를 결정하고, 자동으로 저장되었던 초안을 **삭제**하거나 편집 과정을 **취소**하세요.
\ No newline at end of file diff --git a/inc/lang/ko/lang.php b/inc/lang/ko/lang.php index beec62aa9..5ee0df829 100644 --- a/inc/lang/ko/lang.php +++ b/inc/lang/ko/lang.php @@ -30,8 +30,8 @@ $lang['btn_search'] = '검색'; $lang['btn_save'] = '저장'; $lang['btn_preview'] = '미리 보기'; $lang['btn_top'] = '맨 위로'; -$lang['btn_newer'] = '<< 최근 바뀜 더 보기'; -$lang['btn_older'] = '최근 바뀜 덜 보기 >>'; +$lang['btn_newer'] = '<< 더 최근'; +$lang['btn_older'] = '덜 최근 >>'; $lang['btn_revs'] = '이전 판'; $lang['btn_recent'] = '최근 바뀜'; $lang['btn_upload'] = '올리기'; @@ -41,16 +41,16 @@ $lang['btn_secedit'] = '편집'; $lang['btn_login'] = '로그인'; $lang['btn_logout'] = '로그아웃'; $lang['btn_admin'] = '관리'; -$lang['btn_update'] = '바꾸기'; +$lang['btn_update'] = '업데이트'; $lang['btn_delete'] = '삭제'; $lang['btn_back'] = '뒤로'; -$lang['btn_backlink'] = '백링크'; +$lang['btn_backlink'] = '역링크'; $lang['btn_subscribe'] = '구독 관리'; $lang['btn_profile'] = '프로필 업데이트'; $lang['btn_reset'] = '재설정'; $lang['btn_resendpwd'] = '새 비밀번호 설정'; $lang['btn_draft'] = '초안 편집'; -$lang['btn_recover'] = '초안 되돌리기'; +$lang['btn_recover'] = '초안 복구'; $lang['btn_draftdel'] = '초안 삭제'; $lang['btn_revert'] = '되돌리기'; $lang['btn_register'] = '등록'; diff --git a/inc/lang/ml/admin.txt b/inc/lang/ml/admin.txt new file mode 100644 index 000000000..0f9c81486 --- /dev/null +++ b/inc/lang/ml/admin.txt @@ -0,0 +1,3 @@ +====== പൊതു സെറ്റിംഗ്സ് ====== + +താഴെ കാണുന്ന പട്ടിക ഡോക്കുവിക്കിയിൽ ഉള്ള പൊതു സെറ്റിംഗ്സ് ആണ് .
\ No newline at end of file diff --git a/inc/load.php b/inc/load.php index b78a9ee38..42a6a6362 100644 --- a/inc/load.php +++ b/inc/load.php @@ -111,6 +111,12 @@ function load_autoload($name){ return; } + // our own namespace + $name = str_replace('\\', '/', $name); + if(substr($name, 0, 9) == 'dokuwiki/') { + require_once(substr($name, 9) . '.php'); + } + // Plugin loading if(preg_match('/^(auth|helper|syntax|action|admin|renderer|remote)_plugin_('.DOKU_PLUGIN_NAME_REGEX.')(?:_([^_]+))?$/', $name, $m)) { diff --git a/inc/template.php b/inc/template.php index 4433c508a..a1bdc8d64 100644 --- a/inc/template.php +++ b/inc/template.php @@ -1998,5 +1998,27 @@ function tpl_classes() { return join(' ', $classes); } +/** + * Create event for tools menues + * + * @author Anika Henke <anika@selfthinker.org> + * @param string $toolsname name of menu + * @param array $items + * @param string $view e.g. 'main', 'detail', ... + */ +function tpl_toolsevent($toolsname, $items, $view = 'main') { + $data = array( + 'view' => $view, + 'items' => $items + ); + + $hook = 'TEMPLATE_' . strtoupper($toolsname) . '_DISPLAY'; + $evt = new Doku_Event($hook, $data); + if($evt->advise_before()) { + foreach($evt->data['items'] as $k => $html) echo $html; + } + $evt->advise_after(); +} + //Setup VIM: ex: et ts=4 : diff --git a/lib/plugins/acl/lang/ko/lang.php b/lib/plugins/acl/lang/ko/lang.php index 35563ff6c..40b6ff351 100644 --- a/lib/plugins/acl/lang/ko/lang.php +++ b/lib/plugins/acl/lang/ko/lang.php @@ -21,10 +21,10 @@ $lang['acl_perms'] = '권한'; $lang['page'] = '문서'; $lang['namespace'] = '이름공간'; $lang['btn_select'] = '선택'; -$lang['p_user_id'] = '<b class="acluser">%s</b> 사용자는 현재 <b class="aclpage">%s</b>: <i>%s</i> 문서 접근이 가능합니다.'; -$lang['p_user_ns'] = '<b class="acluser">%s</b> 사용자는 현재 <b class="aclns">%s</b>: <i>%s</i> 이름공간 접근이 가능합니다.'; -$lang['p_group_id'] = '<b class="aclgroup">%s</b> 그룹 구성원은 현재 <b class="aclpage">%s</b>: <i>%s</i> 문서 접근이 가능합니다.'; -$lang['p_group_ns'] = '<b class="aclgroup">%s</b> 그룹 구성원은 현재 <b class="aclns">%s</b>: <i>%s</i> 이름공간 접근이 가능합니다.'; +$lang['p_user_id'] = '<b class="acluser">%s</b> 사용자는 현재 <b class="aclpage">%s</b>: <i>%s</i> 문서에 접근이 가능합니다.'; +$lang['p_user_ns'] = '<b class="acluser">%s</b> 사용자는 현재 <b class="aclns">%s</b>: <i>%s</i> 이름공간에 접근이 가능합니다.'; +$lang['p_group_id'] = '<b class="aclgroup">%s</b> 그룹 구성원은 현재 <b class="aclpage">%s</b>: <i>%s</i> 문서에 접근이 가능합니다.'; +$lang['p_group_ns'] = '<b class="aclgroup">%s</b> 그룹 구성원은 현재 <b class="aclns">%s</b>: <i>%s</i> 이름공간에 접근이 가능합니다.'; $lang['p_choose_id'] = '<b class="aclpage">%s</b> 문서 접근 권한을 보거나 바꾸려면 <b>사용자</b>나 <b>그룹</b>을 위 양식에 입력하세요.'; $lang['p_choose_ns'] = '<b class="aclns">%s</b> 이름공간 접근 권한을 보거나 바꾸려면 <b>사용자</b>나 <b>그룹</b>을 위 양식에 입력하세요.'; $lang['p_inherited'] = '참고: 권한이 명시적으로 설정되지 않았으므로 다른 그룹이나 상위 이름공간으로부터 가져왔습니다.'; diff --git a/lib/plugins/config/lang/fr/lang.php b/lib/plugins/config/lang/fr/lang.php index 8a51c2b34..69e58f731 100644 --- a/lib/plugins/config/lang/fr/lang.php +++ b/lib/plugins/config/lang/fr/lang.php @@ -23,6 +23,7 @@ * @author Bruno Veilleux <bruno.vey@gmail.com> * @author Carbain Frédéric <fcarbain@yahoo.fr> * @author Nicolas Friedli <nicolas@theologique.ch> + * @author Floriang <antispam@floriang.eu> */ $lang['menu'] = 'Paramètres de configuration'; $lang['error'] = 'Paramètres non modifiés en raison d\'une valeur invalide, vérifiez vos réglages puis réessayez. <br />Les valeurs erronées sont entourées d\'une bordure rouge.'; diff --git a/lib/plugins/config/lang/ko/lang.php b/lib/plugins/config/lang/ko/lang.php index 85326241b..420946f84 100644 --- a/lib/plugins/config/lang/ko/lang.php +++ b/lib/plugins/config/lang/ko/lang.php @@ -136,20 +136,20 @@ $lang['autoplural'] = '링크에서 복수형 검사'; $lang['compression'] = '첨부 파일의 압축 방법'; $lang['gzip_output'] = 'xhtml에 대해 gzip 내용 인코딩 사용'; $lang['compress'] = 'CSS 및 자바스크립트를 압축하여 출력'; -$lang['cssdatauri'] = '그림이 렌더링될 최대 용량 크기를 CSS에 규정해야 HTTP 요청 헤더 오버헤드 크기를 감소시킬 수 있습니다. 이 기술은 IE 7 이하에서는 작동하지 않습니다! <code>400</code>에서 <code>600</code> 정도면 좋은 효율을 가져옵니다. <code>0</code>로 지정할 경우 비활성화 됩니다.'; +$lang['cssdatauri'] = 'CSS 파일에서 그림이 참조되는 최대 바이트 크기를 스타일시트에 규정해야 HTTP 요청 헤더 오버헤드 크기를 줄일 수 있습니다. 이 기술은 IE 7 이하에서는 작동하지 않습니다! <code>400</code>에서 <code>600</code> 바이트 정도면 좋은 효율을 가져옵니다. 비활성화하려면 <code>0</code>으로 설정하세요.'; $lang['send404'] = '존재하지 않는 문서에 "HTTP 404/페이지를 찾을 수 없습니다" 보내기'; -$lang['broken_iua'] = '설치된 시스템에서 ignore_user_abort 기능에 문제가 있습니까? 문제가 있다면 검색 색인이 정상적으로 동작하지 않습니다. 이 기능이 IIS+PHP/CGI에서 문제가 있는 것으로 알려졌습니다. 자세한 정보는 <a href="http://bugs.dokuwiki.org/?do=details&task_id=852">버그 852</a>를 참고하시기 바랍니다.'; -$lang['xsendfile'] = '웹 서버가 정적 파일을 제공하도록 X-Sendfile 헤더를 사용하겠습니까? 웹 서버가 이 기능을 지원해야 합니다.'; +$lang['broken_iua'] = '시스템에서 ignore_user_abort 함수에 문제가 있습니까? 문제가 있다면 검색 색인이 동작하지 않는 원인이 됩니다. 이 함수가 IIS+PHP/CGI에서 문제가 있는 것으로 알려져 있습니다. 자세한 정보는 <a href="http://bugs.dokuwiki.org/?do=details&task_id=852">버그 852</a>를 참조하시기 바랍니다.'; +$lang['xsendfile'] = '웹 서버가 정적 파일을 제공할 수 있도록 X-Sendfile 헤더를 사용하겠습니까? 웹 서버가 이 기능을 지원해야 합니다.'; $lang['renderer_xhtml'] = '주요 (xhtml) 위키 출력에 사용할 렌더러'; $lang['renderer__core'] = '%s (도쿠위키 코어)'; $lang['renderer__plugin'] = '%s (플러그인)'; -$lang['dnslookups'] = '이 옵션을 활성화하면 도쿠위키가 문서를 편집하는 사용자의 호스트 네임과 원격 IP 주소를 확인합니다. 서버가 느리거나, DNS를 운영하지 않거나 이 기능을 원치 않으면 비활성화하세요'; +$lang['dnslookups'] = '도쿠위키가 문서를 편집하는 사용자의 원격 IP 주소에 대한 호스트 이름을 조회합니다. 서버가 느리거나 DNS 서버를 작동하지 않거나 이 기능을 원하지 않으면, 이 옵션을 비활성화하세요'; $lang['proxy____host'] = '프록시 서버 이름'; $lang['proxy____port'] = '프록시 포트'; $lang['proxy____user'] = '프록시 사용자 이름'; $lang['proxy____pass'] = '프록시 비밀번호'; $lang['proxy____ssl'] = '프록시로 연결하는 데 SSL 사용'; -$lang['proxy____except'] = '프록시 설정이 무시될 URL주소의 정규 표현식'; +$lang['proxy____except'] = '프록시가 건너뛰어야 할 일치하는 URL의 정규 표현식.'; $lang['safemodehack'] = 'safemode hack 활성화'; $lang['ftp____host'] = 'safemode hack의 FTP 서버'; $lang['ftp____port'] = 'safemode hack의 FTP 포트'; @@ -158,8 +158,8 @@ $lang['ftp____pass'] = 'safemode hack의 FTP 비밀번호'; $lang['ftp____root'] = 'safemode hack의 FTP 루트 디렉터리'; $lang['license_o_'] = '선택하지 않음'; $lang['typography_o_0'] = '없음'; -$lang['typography_o_1'] = '이중 인용부호("")만 지원'; -$lang['typography_o_2'] = '모든 가능한 인용 부호 (동작 안될 수도 있음)'; +$lang['typography_o_1'] = '작은따옴표를 제외'; +$lang['typography_o_2'] = '작은따옴표를 포함 (항상 동작하지 않을 수도 있음)'; $lang['userewrite_o_0'] = '없음'; $lang['userewrite_o_1'] = '.htaccess'; $lang['userewrite_o_2'] = '도쿠위키 내부'; @@ -175,20 +175,20 @@ $lang['rss_type_o_rss2'] = 'RSS 2.0'; $lang['rss_type_o_atom'] = 'Atom 0.3'; $lang['rss_type_o_atom1'] = 'Atom 1.0'; $lang['rss_content_o_abstract'] = '개요'; -$lang['rss_content_o_diff'] = '통합 차이 목록'; -$lang['rss_content_o_htmldiff'] = 'HTML 차이 목록 형식'; -$lang['rss_content_o_html'] = '최대 HTML 페이지 내용'; +$lang['rss_content_o_diff'] = '통합 차이'; +$lang['rss_content_o_htmldiff'] = 'HTML 형식의 차이 표'; +$lang['rss_content_o_html'] = '전체 HTML 페이지 내용'; $lang['rss_linkto_o_diff'] = '차이 보기'; -$lang['rss_linkto_o_page'] = '바뀐 문서 보기'; +$lang['rss_linkto_o_page'] = '개정된 문서'; $lang['rss_linkto_o_rev'] = '판의 목록'; $lang['rss_linkto_o_current'] = '현재 문서'; $lang['compression_o_0'] = '없음'; $lang['compression_o_gz'] = 'gzip'; $lang['compression_o_bz2'] = 'bz2'; $lang['xsendfile_o_0'] = '사용하지 않음'; -$lang['xsendfile_o_1'] = '비공개 lighttpd 헤더 (1.5 이전 버전)'; +$lang['xsendfile_o_1'] = '사유 lighttpd 헤더 (릴리스 1.5 이전)'; $lang['xsendfile_o_2'] = '표준 X-Sendfile 헤더'; -$lang['xsendfile_o_3'] = '비공개 Nginx X-Accel-Redirect 헤더'; +$lang['xsendfile_o_3'] = '사유 Nginx X-Accel-Redirect 헤더'; $lang['showuseras_o_loginname'] = '로그인 이름'; $lang['showuseras_o_username'] = '사용자의 실명'; $lang['showuseras_o_username_link'] = '인터위키 사용자 링크로 된 사용자의 실명'; @@ -198,4 +198,4 @@ $lang['useheading_o_0'] = '전혀 없음'; $lang['useheading_o_navigation'] = '둘러보기에만'; $lang['useheading_o_content'] = '위키 내용에만'; $lang['useheading_o_1'] = '항상'; -$lang['readdircache'] = 'readdir 캐시를 위한 최대 시간 (초)'; +$lang['readdircache'] = 'readdir 캐시의 최대 시간 (초)'; diff --git a/lib/plugins/extension/lang/bg/lang.php b/lib/plugins/extension/lang/bg/lang.php index 430516dd1..b14442c55 100644 --- a/lib/plugins/extension/lang/bg/lang.php +++ b/lib/plugins/extension/lang/bg/lang.php @@ -5,22 +5,69 @@ * * @author Kiril <neohidra@gmail.com> */ +$lang['menu'] = 'Диспечер на приставки'; +$lang['tab_plugins'] = 'Инсталирани приставки'; +$lang['tab_templates'] = 'Инсталирани шаблони'; $lang['tab_search'] = 'Търсене и инсталиране'; $lang['tab_install'] = 'Ръчно инсталиране'; $lang['notimplemented'] = 'Функционалността все още не реализирана'; +$lang['notinstalled'] = 'Приставката не е инсталирана'; +$lang['alreadyenabled'] = 'Приставката е включена'; +$lang['alreadydisabled'] = 'Приставката е изключена'; +$lang['pluginlistsaveerror'] = 'Възникна грешка при записването на списъка с приставки'; $lang['unknownauthor'] = 'Неизвестен автор'; $lang['unknownversion'] = 'Неизвестна версия'; $lang['btn_info'] = 'Повече информация'; $lang['btn_update'] = 'Актуализиране'; $lang['btn_uninstall'] = 'Деинсталиране'; +$lang['btn_enable'] = 'Включване'; +$lang['btn_disable'] = 'Изключване'; $lang['btn_install'] = 'Инсталиране'; $lang['btn_reinstall'] = 'Преинсталиране'; +$lang['js']['reallydel'] = 'Наистина ли желаете приставката да бъде деинсталирана?'; +$lang['js']['display_viewoptions'] = 'Филтриране:'; +$lang['js']['display_enabled'] = 'включени'; +$lang['js']['display_disabled'] = 'изключени'; +$lang['js']['display_updatable'] = 'с налични актуализации'; +$lang['search_for'] = 'Търсене за приставки:'; +$lang['search'] = 'Търсене'; +$lang['extensionby'] = '<strong>%s</strong> от %s'; $lang['popularity'] = 'Популярност: %s%%'; +$lang['homepage_link'] = 'Документи'; +$lang['tags'] = 'Етикети:'; +$lang['author_hint'] = 'Търсене за други приставки от този автор'; +$lang['downloadurl'] = 'Сваляне от URL:'; $lang['repository'] = 'Хранилище:'; $lang['installed_version'] = 'Инсталирана версия:'; +$lang['install_date'] = 'Последна актуализирана на:'; $lang['available_version'] = 'Налична версия:'; $lang['compatible'] = 'Съвместимост с:'; +$lang['depends'] = 'Изисква:'; +$lang['similar'] = 'Наподобява:'; +$lang['conflicts'] = 'В кофликт с:'; +$lang['repo_retry'] = 'Повторен опит'; $lang['provides'] = 'Осигурява:'; +$lang['status'] = 'Състояние:'; +$lang['status_installed'] = 'инсталирана'; +$lang['status_not_installed'] = 'неинсталирана'; +$lang['status_protected'] = 'защитена'; +$lang['status_enabled'] = 'включена'; +$lang['status_disabled'] = 'изключена'; +$lang['status_plugin'] = 'приставка'; +$lang['status_template'] = 'шаблон'; +$lang['msg_enabled'] = 'Приставката "%s" е включена'; +$lang['msg_disabled'] = 'Приставката "%s" е изключена'; +$lang['msg_delete_success'] = 'Приставката "%s" е деинсталирана'; +$lang['msg_delete_failed'] = 'Деинсталирането на приставката "%s" се провали '; +$lang['msg_template_install_success'] = 'Шаблонът "%s" е инсталиран успешно'; +$lang['msg_template_update_success'] = 'Шаблонът "%s" е актуализиран успешно'; +$lang['msg_plugin_install_success'] = 'Приставката "%s" е инсталирана успешно'; +$lang['msg_plugin_update_success'] = 'Приставката "%s" е актуализирана успешно'; +$lang['msg_upload_failed'] = 'Качването на файлът се провали'; +$lang['missing_dependency'] = '<strong>Изискван компонент липсва или е изключен:</strong> %s'; +$lang['update_available'] = '<strong>Актуализация:</strong> Налична е нова версия - %s'; +$lang['wrong_folder'] = '<strong>Некоректно инсталирана приставка:</strong> Преименувайте директорията "%s" на "%s".'; $lang['error_badurl'] = 'URL адресите трябва да започват с http или https'; +$lang['error_dircreate'] = 'Създаването на временна поапка за получаване на файла не е възможно'; $lang['error_download'] = 'Невъзможност за сваляне на файл: %s'; $lang['install_url'] = 'Инсталиране от URL:'; diff --git a/lib/plugins/usermanager/lang/bg/lang.php b/lib/plugins/usermanager/lang/bg/lang.php index aadf76512..f98cc8c40 100644 --- a/lib/plugins/usermanager/lang/bg/lang.php +++ b/lib/plugins/usermanager/lang/bg/lang.php @@ -28,6 +28,10 @@ $lang['search'] = 'Търсене'; $lang['search_prompt'] = 'Търси'; $lang['clear'] = 'Обновяване на търсенето'; $lang['filter'] = 'Филтър'; +$lang['export_all'] = 'Износ на всички потребители (CSV)'; +$lang['import'] = 'Импорт на нови потребители'; +$lang['line'] = 'Ред №'; +$lang['error'] = 'Съобщение за грешка'; $lang['summary'] = 'Показване на потребители %1$d-%2$d от %3$d намерени. Общо %4$d потребителя.'; $lang['nonefound'] = 'Не са намерени потребители. Общо %d потребителя.'; $lang['delete_ok'] = '%d изтрити потребителя'; @@ -48,3 +52,8 @@ $lang['add_ok'] = 'Добавянето на потребител $lang['add_fail'] = 'Добавянето на потребителя се провали'; $lang['notify_ok'] = 'Изпратено е осведомителен имейл'; $lang['notify_fail'] = 'Изпращането на осведомителен имейл не е възможно'; +$lang['import_error_badname'] = 'Грешно потребителско име'; +$lang['import_error_badmail'] = 'Грешен имейл адрес'; +$lang['import_error_upload'] = 'Внасянето се провали. CSV файлът не може да бъде качен или е празен.'; +$lang['import_error_readfail'] = 'Внасянето се провали. Каченият файл не може да бъде прочетен.'; +$lang['import_error_create'] = 'Потребителят не може да бъде съдаден'; diff --git a/lib/plugins/usermanager/lang/ko/lang.php b/lib/plugins/usermanager/lang/ko/lang.php index e8f846ce6..ec55d5586 100644 --- a/lib/plugins/usermanager/lang/ko/lang.php +++ b/lib/plugins/usermanager/lang/ko/lang.php @@ -53,7 +53,7 @@ $lang['edit_usermissing'] = '선택된 사용자를 찾을 수 없습니다 $lang['user_notify'] = '사용자에게 알림'; $lang['note_notify'] = '사용자에게 새로운 비밀번호를 준 경우에만 알림 이메일이 보내집니다.'; $lang['note_group'] = '새로운 사용자는 어떤 그룹도 설정하지 않은 경우에 기본 그룹(%s)에 추가됩니다.'; -$lang['note_pass'] = '사용자 알림이 지정되어 있을 때 필드에 아무 값도 입력하지 않으면 비밀번호가 자동으로 만들어집니다.'; +$lang['note_pass'] = '사용자 알림이 지정되어 있을 때 필드에 아무 값도 입력하지 않으면 비밀번호가 자동으로 생성됩니다.'; $lang['add_ok'] = '사용자를 성공적으로 추가했습니다'; $lang['add_fail'] = '사용자 추가를 실패했습니다'; $lang['notify_ok'] = '알림 이메일을 성공적으로 보냈습니다'; diff --git a/lib/tpl/dokuwiki/css/_media_fullscreen.css b/lib/tpl/dokuwiki/css/_media_fullscreen.css index 71308ec85..92a9d0730 100644 --- a/lib/tpl/dokuwiki/css/_media_fullscreen.css +++ b/lib/tpl/dokuwiki/css/_media_fullscreen.css @@ -407,19 +407,19 @@ /* file revisions form */ -#mediamanager__page #page__revisions ul { +#mediamanager__page form.changes ul { margin-left: 10px; padding: 0; list-style-type: none; } -#mediamanager__page #page__revisions ul li div.li div { +#mediamanager__page form.changes ul li div.li div { font-size: 90%; color: @ini_text_neu; padding-left: 18px; } -#mediamanager__page #page__revisions ul li div.li input { +#mediamanager__page form.changes ul li div.li input { position: relative; top: 1px; } diff --git a/lib/tpl/dokuwiki/images/pagetools-build.php b/lib/tpl/dokuwiki/images/pagetools-build.php index 3cf35b2ea..eaceeb257 100644 --- a/lib/tpl/dokuwiki/images/pagetools-build.php +++ b/lib/tpl/dokuwiki/images/pagetools-build.php @@ -15,6 +15,8 @@ $GAMMA = 0.8; $OPTIPNG = '/usr/bin/optipng'; +if('cli' != php_sapi_name()) die('please run from commandline'); + // load input images $input = glob('pagetools/*.png'); sort($input); diff --git a/lib/tpl/dokuwiki/tpl_header.php b/lib/tpl/dokuwiki/tpl_header.php index ee51cbd01..5b092c564 100644 --- a/lib/tpl/dokuwiki/tpl_header.php +++ b/lib/tpl/dokuwiki/tpl_header.php @@ -46,10 +46,12 @@ if (!defined('DOKU_INC')) die(); tpl_userinfo(); /* 'Logged in as ...' */ echo '</li>'; } - tpl_action('admin', true, 'li'); - tpl_action('profile', true, 'li'); - tpl_action('register', true, 'li'); - tpl_action('login', true, 'li'); + tpl_toolsevent('usertools', array( + tpl_action('admin', true, 'li', true), + tpl_action('profile', true, 'li', true), + tpl_action('register', true, 'li', true), + tpl_action('login', true, 'li', true) + )); ?> </ul> </div> @@ -64,9 +66,11 @@ if (!defined('DOKU_INC')) die(); </div> <ul> <?php - tpl_action('recent', true, 'li'); - tpl_action('media', true, 'li'); - tpl_action('index', true, 'li'); + tpl_toolsevent('sitetools', array( + tpl_action('recent', true, 'li', true), + tpl_action('media', true, 'li', true), + tpl_action('index', true, 'li', true) + )); ?> </ul> </div> |