';
}
@@ -349,14 +355,15 @@ class AggregationTable
// each column gets a form
foreach ($this->columns as $column) {
$this->renderer->doc .= '
';
- {
- $form = new \Doku_Form(array('method' => 'GET', 'action' => wl($this->id)));
- unset($form->_hidden['sectok']); // we don't need it here
- if (!$conf['userewrite']) $form->addHidden('id', $this->id);
- // current value
- $dynamic = $this->searchConfig->getDynamicParameters();
- $filters = $dynamic->getFilters();
+ // BEGIN FORM
+ $form = new \Doku_Form(array('method' => 'GET', 'action' => wl($this->id)));
+ unset($form->_hidden['sectok']); // we don't need it here
+ if (!$conf['userewrite']) $form->addHidden('id', $this->id);
+
+ // current value
+ $dynamic = $this->searchConfig->getDynamicParameters();
+ $filters = $dynamic->getFilters();
if (isset($filters[$column->getFullQualifiedLabel()])) {
list(, $current) = $filters[$column->getFullQualifiedLabel()];
$dynamic->removeFilter($column);
@@ -364,17 +371,20 @@ class AggregationTable
$current = '';
}
- // Add current request params
- $params = $dynamic->getURLParameters();
+ // Add current request params
+ $params = $dynamic->getURLParameters();
foreach ($params as $key => $val) {
$form->addHidden($key, $val);
}
- // add input field
- $key = $column->getFullQualifiedLabel() . $column->getType()->getDefaultComparator();
- $form->addElement(form_makeField('text', SearchConfigParameters::$PARAM_FILTER . '[' . $key . ']', $current, ''));
- $this->renderer->doc .= $form->getForm();
- }
+ // add input field
+ $key = $column->getFullQualifiedLabel() . $column->getType()->getDefaultComparator();
+ $form->addElement(
+ form_makeField('text', SearchConfigParameters::$PARAM_FILTER . '[' . $key . ']', $current, '')
+ );
+ $this->renderer->doc .= $form->getForm();
+ // END FORM
+
$this->renderer->doc .= '
';
}
$this->renderer->doc .= '';
@@ -553,6 +563,7 @@ class AggregationTable
// FIXME apply dynamic filters
$link = exportlink($this->id, 'struct_csv', $params);
- $this->renderer->doc .= '' . $this->helper->getLang('csvexport') . '';
+ $this->renderer->doc .= '' .
+ $this->helper->getLang('csvexport') . '';
}
}
diff --git a/meta/Assignments.php b/meta/Assignments.php
index 28bb330..01374d1 100644
--- a/meta/Assignments.php
+++ b/meta/Assignments.php
@@ -351,7 +351,8 @@ class Assignments
}
/**
- * fetch all pages where the schema isn't assigned, yet and reevaluate the page assignments for those pages and assign when needed
+ * fetch all pages where the schema isn't assigned, yet
+ * and reevaluate the page assignments for those pages and assign when needed
*
* @param $table
*/
diff --git a/meta/CSVExporter.php b/meta/CSVExporter.php
index abd6b23..d457e00 100644
--- a/meta/CSVExporter.php
+++ b/meta/CSVExporter.php
@@ -13,9 +13,9 @@ namespace dokuwiki\plugin\struct\meta;
*/
class CSVExporter
{
- const DATATYPE_PAGE = 'page';
- const DATATYPE_GLOBAL = 'global';
- const DATATYPE_SERIAL = 'serial';
+ public const DATATYPE_PAGE = 'page';
+ public const DATATYPE_GLOBAL = 'global';
+ public const DATATYPE_SERIAL = 'serial';
protected $type = '';
diff --git a/meta/CSVPageImporter.php b/meta/CSVPageImporter.php
index 469b1ed..875aec4 100644
--- a/meta/CSVPageImporter.php
+++ b/meta/CSVPageImporter.php
@@ -15,7 +15,8 @@ class CSVPageImporter extends CSVImporter
protected function readHeaders()
{
parent::readHeaders();
- if (!in_array('pid', $this->header)) throw new StructException('There is no "pid" header in the CSV. Schema not imported.');
+ if (!in_array('pid', $this->header))
+ throw new StructException('There is no "pid" header in the CSV. Schema not imported.');
}
/**
diff --git a/meta/CSVSerialImporter.php b/meta/CSVSerialImporter.php
index 9a2273b..809449b 100644
--- a/meta/CSVSerialImporter.php
+++ b/meta/CSVSerialImporter.php
@@ -13,7 +13,8 @@ class CSVSerialImporter extends CSVImporter
protected function readHeaders()
{
parent::readHeaders();
- if (!in_array('pid', $this->header)) throw new StructException('There is no "pid" header in the CSV. Schema not imported.');
+ if (!in_array('pid', $this->header))
+ throw new StructException('There is no "pid" header in the CSV. Schema not imported.');
}
/**
diff --git a/meta/Column.php b/meta/Column.php
index 427b454..7993ce3 100644
--- a/meta/Column.php
+++ b/meta/Column.php
@@ -118,7 +118,8 @@ class Column
*/
public function getColName($enforceSingleColumn = true)
{
- if ($enforceSingleColumn && $this->isMulti()) throw new StructException('Calling getColName on a multi value column makes no sense.');
+ if ($enforceSingleColumn && $this->isMulti())
+ throw new StructException('Calling getColName on a multi value column makes no sense.');
return 'col' . $this->colref;
}
diff --git a/meta/DateFormatConverter.php b/meta/DateFormatConverter.php
index a7133ef..d4afb86 100644
--- a/meta/DateFormatConverter.php
+++ b/meta/DateFormatConverter.php
@@ -1,5 +1,7 @@
sqlite->query($sql, array($this->pid, $this->title, $this->lasteditor, $this->lastrev, $this->lastsummary));
+ $this->sqlite->query($sql, [$this->pid, $this->title, $this->lasteditor, $this->lastrev, $this->lastsummary]);
$this->saveNeeded = false;
}
diff --git a/meta/Schema.php b/meta/Schema.php
index 3c79280..ab5d52c 100644
--- a/meta/Schema.php
+++ b/meta/Schema.php
@@ -4,8 +4,6 @@ namespace dokuwiki\plugin\struct\meta;
use dokuwiki\plugin\struct\types\AbstractBaseType;
-if (!defined('JSON_PRETTY_PRINT')) define('JSON_PRETTY_PRINT', 0); // PHP 5.3 compatibility
-
/**
* Class Schema
*
diff --git a/meta/SchemaBuilder.php b/meta/SchemaBuilder.php
index 21c0200..7470a14 100644
--- a/meta/SchemaBuilder.php
+++ b/meta/SchemaBuilder.php
@@ -170,7 +170,8 @@ class SchemaBuilder
$newTid = $oldTid;
$sort = $column->getSort();
if (isset($this->data['cols'][$column->getColref()])) {
- // todo I'm not too happy with this hardcoded here - we should probably have a list of fields at one place
+ // todo I'm not too happy with this hardcoded here -
+ // we should probably have a list of fields at one place
$newEntry['config'] = $this->data['cols'][$column->getColref()]['config'];
$newEntry['label'] = $this->data['cols'][$column->getColref()]['label'];
$newEntry['ismulti'] = $this->data['cols'][$column->getColref()]['ismulti'];
diff --git a/meta/SchemaEditor.php b/meta/SchemaEditor.php
index 6f819a4..6fa147b 100644
--- a/meta/SchemaEditor.php
+++ b/meta/SchemaEditor.php
@@ -5,8 +5,6 @@ namespace dokuwiki\plugin\struct\meta;
use dokuwiki\Form\Form;
use dokuwiki\plugin\struct\types\Text;
-if (!defined('JSON_PRETTY_PRINT')) define('JSON_PRETTY_PRINT', 0); // PHP 5.3 compatibility
-
/**
* Class SchemaEditor
*
@@ -71,7 +69,11 @@ class SchemaEditor
$form->addFieldsetOpen();
$config = json_encode($this->schema->getConfig(), JSON_PRETTY_PRINT);
- $form->addHTML('');
+ $form->addHTML(
+ ''
+ );
$form->addFieldsetClose();
@@ -88,10 +90,14 @@ class SchemaEditor
protected function initJSONEditor()
{
$html = '';
- $html .= '';
- $html .= '';
- $html .= '';
- $html .= '';
+ $html .= '';
+ $html .= '';
+ $html .= '';
+ $html .= '';
return $html;
}
@@ -127,7 +133,9 @@ class SchemaEditor
$html .= '
';
$types = array_keys(Column::allTypes());
diff --git a/meta/SchemaImporter.php b/meta/SchemaImporter.php
index 05e9c8d..41e7b3b 100644
--- a/meta/SchemaImporter.php
+++ b/meta/SchemaImporter.php
@@ -2,8 +2,6 @@
namespace dokuwiki\plugin\struct\meta;
-if (!defined('JSON_PRETTY_PRINT')) define('JSON_PRETTY_PRINT', 0); // PHP 5.3 compatibility
-
/**
* Class SchemaImporter
*
diff --git a/meta/Search.php b/meta/Search.php
index f92579f..c1a66e3 100755
--- a/meta/Search.php
+++ b/meta/Search.php
@@ -13,7 +13,7 @@ class Search
/**
* This separator will be used to concat multi values to flatten them in the result set
*/
- const CONCAT_SEPARATOR = "\n!_-_-_-_-_!\n";
+ public const CONCAT_SEPARATOR = "\n!_-_-_-_-_!\n";
/**
* The list of known and allowed comparators
@@ -156,8 +156,10 @@ class Search
$comp = '!=';
}
- if (!in_array($comp, self::$COMPARATORS)) throw new StructException("Bad comperator. Use " . join(',', self::$COMPARATORS));
- if ($op != 'OR' && $op != 'AND') throw new StructException('Bad filter type . Only AND or OR allowed');
+ if (!in_array($comp, self::$COMPARATORS))
+ throw new StructException("Bad comperator. Use " . join(',', self::$COMPARATORS));
+ if ($op != 'OR' && $op != 'AND')
+ throw new StructException('Bad filter type . Only AND or OR allowed');
$col = $this->findColumn($colname);
if (!$col) return; // ignore missing columns, filter might have been for different schema
@@ -323,7 +325,8 @@ class Search
*/
public function getPids()
{
- if ($this->result_pids === null) throw new StructException('PIDs are only accessible after executing the search');
+ if ($this->result_pids === null)
+ throw new StructException('PIDs are only accessible after executing the search');
return $this->result_pids;
}
@@ -336,7 +339,8 @@ class Search
*/
public function getRids()
{
- if ($this->result_rids === null) throw new StructException('rids are only accessible after executing the search');
+ if ($this->result_rids === null)
+ throw new StructException('rids are only accessible after executing the search');
return $this->result_rids;
}
@@ -349,7 +353,8 @@ class Search
*/
public function getRevs()
{
- if ($this->result_revs === null) throw new StructException('revs are only accessible after executing the search');
+ if ($this->result_revs === null)
+ throw new StructException('revs are only accessible after executing the search');
return $this->result_revs;
}
diff --git a/meta/UserColumn.php b/meta/UserColumn.php
index 799c3ba..339a528 100644
--- a/meta/UserColumn.php
+++ b/meta/UserColumn.php
@@ -7,7 +7,8 @@ use dokuwiki\plugin\struct\types\User;
/**
* Class UserColumn
*
- * Just like a column, but does not reference one of the col* data columns but the lasteditor column in the titles table.
+ * Just like a column, but does not reference one of the col* data columns
+ * but the lasteditor column in the titles table.
*
* @package dokuwiki\plugin\struct\meta
*/
diff --git a/remote.php b/remote.php
index 057559a..34aa292 100644
--- a/remote.php
+++ b/remote.php
@@ -12,9 +12,6 @@ use dokuwiki\plugin\struct\meta\ConfigParser;
use dokuwiki\plugin\struct\meta\SearchConfig;
use dokuwiki\plugin\struct\meta\StructException;
-if (!defined('DOKU_INC')) die();
-
-
class remote_plugin_struct extends DokuWiki_Remote_Plugin
{
/** @var helper_plugin_struct hlp */
diff --git a/renderer/csv.php b/renderer/csv.php
index 05f3b7a..a1d68ef 100644
--- a/renderer/csv.php
+++ b/renderer/csv.php
@@ -1,5 +1,7 @@
doOutput()) return;
$this->first = true;
@@ -76,8 +78,9 @@ class renderer_plugin_struct_csv extends Doku_Renderer
* @param int $colspan ignored
* @param null $align ignored
* @param int $rowspan ignored
+ *
*/
- public function tablecell_open($colspan = 1, $align = null, $rowspan = 1) // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
+ public function tablecell_open($colspan = 1, $align = null, $rowspan = 1)
{
if (!$this->doOutput()) return;
if (!$this->first) {
@@ -91,7 +94,7 @@ class renderer_plugin_struct_csv extends Doku_Renderer
/**
* Close the text wrapper
*/
- public function tablecell_close() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
+ public function tablecell_close()
{
if (!$this->doOutput()) return;
$this->doc .= '"';
@@ -104,7 +107,7 @@ class renderer_plugin_struct_csv extends Doku_Renderer
* @param null $align ignored
* @param int $rowspan ignored
*/
- public function tableheader_open($colspan = 1, $align = null, $rowspan = 1) // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
+ public function tableheader_open($colspan = 1, $align = null, $rowspan = 1)
{
$this->tablecell_open($colspan, $align, $rowspan);
}
@@ -112,7 +115,7 @@ class renderer_plugin_struct_csv extends Doku_Renderer
/**
* Alias for tablecell_close
*/
- public function tableheader_close() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
+ public function tableheader_close()
{
$this->tablecell_close();
}
@@ -120,7 +123,7 @@ class renderer_plugin_struct_csv extends Doku_Renderer
/**
* Add CRLF newline at the end of one line
*/
- public function tablerow_close() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
+ public function tablerow_close()
{
if (!$this->doOutput()) return;
$this->doc .= "\r\n";
diff --git a/syntax/global.php b/syntax/global.php
index 6ec7a3f..c492007 100644
--- a/syntax/global.php
+++ b/syntax/global.php
@@ -9,9 +9,6 @@
use dokuwiki\plugin\struct\meta\AggregationEditorTable;
-// must be run within Dokuwiki
-if (!defined('DOKU_INC')) die();
-
class syntax_plugin_struct_global extends syntax_plugin_struct_table
{
/** @var string which class to use for output */
@@ -59,7 +56,10 @@ class syntax_plugin_struct_global extends syntax_plugin_struct_table
*/
protected function addTypeFilter($config)
{
- $config['filter'][] = ['%rowid%', '!=', (string)\dokuwiki\plugin\struct\meta\AccessTablePage::DEFAULT_PAGE_RID, 'AND'];
+ $config['filter'][] = [
+ '%rowid%', '!=',
+ (string)\dokuwiki\plugin\struct\meta\AccessTablePage::DEFAULT_PAGE_RID, 'AND'
+ ];
$config['filter'][] = ['%pageid%', '=*', '^(?![\s\S])', 'AND'];
$config['withpid'] = 0; // flag for the editor to distinguish data types
return $config;
diff --git a/syntax/list.php b/syntax/list.php
index 46a7d79..6703243 100644
--- a/syntax/list.php
+++ b/syntax/list.php
@@ -12,9 +12,6 @@ use dokuwiki\plugin\struct\meta\ConfigParser;
use dokuwiki\plugin\struct\meta\SearchConfig;
use dokuwiki\plugin\struct\meta\StructException;
-// must be run within Dokuwiki
-if (!defined('DOKU_INC')) die();
-
class syntax_plugin_struct_list extends DokuWiki_Syntax_Plugin
{
/** @var string which class to use for output */
diff --git a/syntax/output.php b/syntax/output.php
index da7abb8..1c2e565 100644
--- a/syntax/output.php
+++ b/syntax/output.php
@@ -15,13 +15,13 @@ class syntax_plugin_struct_output extends DokuWiki_Syntax_Plugin
{
protected $hasBeenRendered = false;
- const XHTML_OPEN = '
';
- const XHTML_CLOSE = '
';
+ protected const XHTML_OPEN = '
';
+ protected const XHTML_CLOSE = '
';
/**
* Regexp to check on which actions the struct data may be rendered
*/
- const WHITELIST_ACTIONS = '/^(show|export_.*)$/';
+ protected const WHITELIST_ACTIONS = '/^(show|export_.*)$/';
/**
* @return string Syntax mode type
diff --git a/types/AbstractBaseType.php b/types/AbstractBaseType.php
index 257a61c..bc01919 100644
--- a/types/AbstractBaseType.php
+++ b/types/AbstractBaseType.php
@@ -201,8 +201,11 @@ abstract class AbstractBaseType
*/
public function getContext()
{
- if (is_null($this->context))
- throw new StructException('Empty column context requested. Type was probably initialized outside of Schema.');
+ if (is_null($this->context)) {
+ throw new StructException(
+ 'Empty column context requested. Type was probably initialized outside of Schema.'
+ );
+ }
return $this->context;
}
@@ -345,7 +348,7 @@ abstract class AbstractBaseType
* @param string $mode The mode the output is rendered in (eg. XHTML)
* @param string $page the target to which should be linked
* @param string $filter the filter to apply to the aggregations on $page
- * @param int $weight the scaled weight of the item. Will already be implemented as css font-size on the outside container
+ * @param int $weight the scaled weight of the item. implemented as css font-size on the outside container
*/
public function renderTagCloudLink($value, \Doku_Renderer $R, $mode, $page, $filter, $weight)
{
diff --git a/types/Color.php b/types/Color.php
index e75dbb5..cf77846 100644
--- a/types/Color.php
+++ b/types/Color.php
@@ -34,7 +34,8 @@ class Color extends AbstractBaseType
public function renderValue($value, \Doku_Renderer $R, $mode)
{
if ($mode == 'xhtml') {
- $R->doc .= '';
+ $R->doc .= '';
} else {
$R->cdata($value);
}
@@ -87,7 +88,9 @@ class Color extends AbstractBaseType
if ($mode == 'xhtml') {
$url = wl($page, $filter);
$style = "background-color:$color;";
- $R->doc .= "$color";
+ $R->doc .= "
+ $color
+ ";
return;
}
$R->internallink("$page?$filter", $color);
diff --git a/types/Lookup.php b/types/Lookup.php
index 03a0687..ef98bed 100644
--- a/types/Lookup.php
+++ b/types/Lookup.php
@@ -248,7 +248,8 @@ class Lookup extends Dropdown
$tablealias,
$schema,
$rightalias,
- "$tablealias.$colname = STRUCT_JSON($rightalias.pid, CAST($rightalias.rid AS DECIMAL)) AND $rightalias.latest = 1"
+ "$tablealias.$colname = STRUCT_JSON($rightalias.pid, CAST($rightalias.rid AS DECIMAL)) " .
+ "AND $rightalias.latest = 1"
);
$column->getType()->select($QB, $rightalias, $field, $alias);
$sql = $QB->getSelectStatement($alias);
@@ -282,7 +283,8 @@ class Lookup extends Dropdown
$tablealias,
$schema,
$rightalias,
- "$tablealias.$colname = STRUCT_JSON($rightalias.pid, CAST($rightalias.rid AS DECIMAL)) AND $rightalias.latest = 1"
+ "$tablealias.$colname = STRUCT_JSON($rightalias.pid, CAST($rightalias.rid AS DECIMAL)) AND " .
+ "$rightalias.latest = 1"
);
$column->getType()->filter($add, $rightalias, $field, $comp, $value, $op);
}
@@ -310,7 +312,8 @@ class Lookup extends Dropdown
$tablealias,
$schema,
$rightalias,
- "$tablealias.$colname = STRUCT_JSON($rightalias.pid, CAST($rightalias.rid AS DECIMAL)) AND $rightalias.latest = 1"
+ "$tablealias.$colname = STRUCT_JSON($rightalias.pid, CAST($rightalias.rid AS DECIMAL)) AND " .
+ "$rightalias.latest = 1"
);
$column->getType()->sort($QB, $rightalias, $field, $order);
}
diff --git a/types/Media.php b/types/Media.php
index 3772cba..f4c2721 100644
--- a/types/Media.php
+++ b/types/Media.php
@@ -134,7 +134,8 @@ class Media extends AbstractBaseType
$image = ml($media, ['h' => $weight, 'w' => $weight]);
$media_escaped = hsc($media);
$R->doc .= "