diff --git a/action/migration.php b/action/migration.php index ced2696..c107cac 100644 --- a/action/migration.php +++ b/action/migration.php @@ -162,22 +162,34 @@ class action_plugin_struct_migration extends DokuWiki_Action_Plugin $colname = "col$colno"; // lookup fields pointing to pages have to be migrated first! // they rely on a simplistic not-a-number check, and already migrated lookups pass the test! - $f = 'UPDATE data_%s SET %s = \'["\'||%s||\'",0]\' WHERE %s != \'\' AND CAST(%s AS DECIMAL) != %s'; + $f = 'UPDATE data_%s + SET %s = \'["\'||%s||\'",0]\' + WHERE %s != \'\' + AND CAST(%s AS DECIMAL) != %s'; $s = sprintf($f, $name, $colname, $colname, $colname, $colname, $colname); $ok = $ok && $sqlite->query($s); if (!$ok) return false; // multi_ - $f = 'UPDATE multi_%s SET value = \'["\'||value||\'",0]\' WHERE colref = %s AND CAST(value AS DECIMAL) != value'; + $f = 'UPDATE multi_%s + SET value = \'["\'||value||\'",0]\' + WHERE colref = %s + AND CAST(value AS DECIMAL) != value'; $s = sprintf($f, $name, $colno); $ok = $ok && $sqlite->query($s); if (!$ok) return false; // simple lookup fields - $s = "UPDATE data_$name SET col$colno = '[" . '""' . ",'||col$colno||']' WHERE col$colno != '' AND CAST(col$colno AS DECIMAL) = col$colno"; + $s = "UPDATE data_$name + SET col$colno = '[" . '""' . ",'||col$colno||']' + WHERE col$colno != '' + AND CAST(col$colno AS DECIMAL) = col$colno"; $ok = $ok && $sqlite->query($s); if (!$ok) return false; // multi_ - $s = "UPDATE multi_$name SET value = '[" . '""' . ",'||value||']' WHERE colref=$colno AND CAST(value AS DECIMAL) = value"; + $s = "UPDATE multi_$name + SET value = '[" . '""' . ",'||value||']' + WHERE colref=$colno + AND CAST(value AS DECIMAL) = value"; $ok = $ok && $sqlite->query($s); if (!$ok) return false; } @@ -264,7 +276,11 @@ class action_plugin_struct_migration extends DokuWiki_Action_Plugin list($pid, $rid, $rev, $colref, $rowno, $fixes) = $this->getFixedValues($row); // now fix the values if (!empty($fixes)) { - $sql = "UPDATE data_$name SET " . implode(', ', $fixes) . " WHERE pid = ? and rid = ? AND rev = ?"; + $sql = "UPDATE data_$name + SET " . implode(', ', $fixes) . " + WHERE pid = ? + AND rid = ? + AND rev = ?"; $params = [$pid, $rid, $rev]; $ok = $ok && $sqlite->query($sql, $params); } @@ -281,7 +297,13 @@ class action_plugin_struct_migration extends DokuWiki_Action_Plugin list($pid, $rid, $rev, $colref, $rowno, $fixes) = $this->getFixedValues($row); // now fix the values if (!empty($fixes)) { - $sql = "UPDATE multi_$name SET " . implode(', ', $fixes) . " WHERE pid = ? AND rid = ? AND rev = ? AND colref = ? AND row = ?"; + $sql = "UPDATE multi_$name + SET " . implode(', ', $fixes) . " + WHERE pid = ? + AND rid = ? + AND rev = ? + AND colref = ? + AND row = ?"; $params = [$pid, $rid, $rev, $colref, $rowno]; $ok = $ok && $sqlite->query($sql, $params); } diff --git a/action/output.php b/action/output.php index d4cec3b..04a47d6 100644 --- a/action/output.php +++ b/action/output.php @@ -20,7 +20,7 @@ use dokuwiki\plugin\struct\meta\Schema; */ class action_plugin_struct_output extends DokuWiki_Action_Plugin { - const DW2PDF_PLACEHOLDER_PREFIX = 'PLUGIN_STRUCT'; + protected const DW2PDF_PLACEHOLDER_PREFIX = 'PLUGIN_STRUCT'; /** * Registers a callback function for a given event diff --git a/admin/assignments.php b/admin/assignments.php index 9a9397d..988ead5 100644 --- a/admin/assignments.php +++ b/admin/assignments.php @@ -12,8 +12,6 @@ use dokuwiki\plugin\struct\meta\Assignments; use dokuwiki\plugin\struct\meta\Schema; use dokuwiki\plugin\struct\meta\StructException; -if (!defined('DOKU_INC')) die(); - class admin_plugin_struct_assignments extends DokuWiki_Admin_Plugin { /** diff --git a/admin/schemas.php b/admin/schemas.php index 3d66be0..555fdfe 100644 --- a/admin/schemas.php +++ b/admin/schemas.php @@ -236,7 +236,10 @@ class admin_plugin_struct_schemas extends DokuWiki_Admin_Plugin $form->addElement(new \dokuwiki\Form\InputElement('file', 'csvfile'))->attr('accept', '.csv'); $form->addButton('importcsv', $this->getLang('btn_import')); $form->addCheckbox('createPage', 'Create missing pages')->addClass('block edit'); - $form->addHTML('

' . $this->getLang('admin_csvhelp') . '

'); + $form->addHTML( + '

' . + $this->getLang('admin_csvhelp') . '

' + ); $form->addFieldsetClose(); return $form->toHTML(); diff --git a/helper.php b/helper.php index c1d9fc2..faae0c3 100644 --- a/helper.php +++ b/helper.php @@ -30,7 +30,7 @@ class helper_plugin_struct extends DokuWiki_Plugin * Class names of renderers which should NOT render struct data. * All descendants are also blacklisted. */ - const BLACKLIST_RENDERER = [ + public const BLACKLIST_RENDERER = [ 'Doku_Renderer_metadata', '\renderer_plugin_qc' ]; diff --git a/meta/AccessTable.php b/meta/AccessTable.php index 385321e..6f2188a 100644 --- a/meta/AccessTable.php +++ b/meta/AccessTable.php @@ -11,8 +11,8 @@ namespace dokuwiki\plugin\struct\meta; */ abstract class AccessTable { - const DEFAULT_REV = 0; - const DEFAULT_LATEST = 1; + public const DEFAULT_REV = 0; + public const DEFAULT_LATEST = 1; /** @var Schema */ protected $schema; diff --git a/meta/AccessTableGlobal.php b/meta/AccessTableGlobal.php index 8b013c9..ea9295b 100644 --- a/meta/AccessTableGlobal.php +++ b/meta/AccessTableGlobal.php @@ -52,7 +52,8 @@ class AccessTableGlobal extends AccessTable $vals = array_merge($this->getSingleNoninputValues(), $this->singleValues); $rid = $this->getRid() ?: "(SELECT (COALESCE(MAX(rid), 0 ) + 1) FROM $this->stable)"; - return "REPLACE INTO $this->stable (rid, $cols) VALUES ($rid," . trim(str_repeat('?,', count($vals)), ',') . ');'; + return "REPLACE INTO $this->stable (rid, $cols) + VALUES ($rid," . trim(str_repeat('?,', count($vals)), ',') . ');'; } /** diff --git a/meta/AccessTablePage.php b/meta/AccessTablePage.php index 8ee02c0..772f077 100644 --- a/meta/AccessTablePage.php +++ b/meta/AccessTablePage.php @@ -11,7 +11,7 @@ namespace dokuwiki\plugin\struct\meta; */ class AccessTablePage extends AccessTable { - const DEFAULT_PAGE_RID = 0; + public const DEFAULT_PAGE_RID = 0; public function __construct($schema, $pid, $ts = 0, $rid = 0) { diff --git a/meta/AggregationCloud.php b/meta/AggregationCloud.php index 891f6d8..66e0a56 100644 --- a/meta/AggregationCloud.php +++ b/meta/AggregationCloud.php @@ -143,7 +143,8 @@ class AggregationCloud $this->renderer->listcontent_open(); if ($this->mode == 'xhtml') { - $this->renderer->doc .= "
"; + $this->renderer->doc .= + "
"; } $value->renderAsTagCloudLink($this->renderer, $this->mode, $target, $filter, $weight); diff --git a/meta/AggregationEditorTable.php b/meta/AggregationEditorTable.php index 56f03ee..ff88761 100644 --- a/meta/AggregationEditorTable.php +++ b/meta/AggregationEditorTable.php @@ -37,7 +37,8 @@ class AggregationEditorTable extends AggregationTable $config = hsc(json_encode($config)); // wrapping div - $this->renderer->doc .= "
"; + $this->renderer->doc .= "
"; // unique identifier for this aggregation $this->renderer->info['struct_table_hash'] = md5(var_export($this->data, true)); diff --git a/meta/AggregationTable.php b/meta/AggregationTable.php index 1d5e33d..db31ebb 100644 --- a/meta/AggregationTable.php +++ b/meta/AggregationTable.php @@ -225,7 +225,12 @@ class AggregationTable } $this->renderer->doc .= '
'; - $this->renderer->doc .= '

' . sprintf($this->helper->getLang('tablefilteredby'), hsc(implode(' & ', $fltrs))) . '

'; + $this->renderer->doc .= '

' . + sprintf( + $this->helper->getLang('tablefilteredby'), + hsc(implode(' & ', $fltrs)) + ) . + '

'; $this->renderer->doc .= '
'; $this->renderer->internallink($this->id, $this->helper->getLang('tableresetfilter')); $this->renderer->doc .= '
'; @@ -307,7 +312,8 @@ class AggregationTable // output XHTML header $this->renderer->doc .= ""; - $this->renderer->doc .= '' . hsc($header) . ''; + $this->renderer->doc .= '' . hsc($header) . ''; $this->renderer->doc .= ''; } @@ -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 .= ''; $config = json_encode($col->getType()->getConfig(), JSON_PRETTY_PRINT); - $html .= ''; + $html .= ''; $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 .= ""; diff --git a/types/Tag.php b/types/Tag.php index ecc9a54..51a3f79 100644 --- a/types/Tag.php +++ b/types/Tag.php @@ -26,7 +26,8 @@ class Tag extends AbstractMultiBaseType public function renderValue($value, \Doku_Renderer $R, $mode) { $context = $this->getContext(); - $filter = SearchConfigParameters::$PARAM_FILTER . '[' . $context->getTable() . '.' . $context->getLabel() . '*~]=' . $value; + $filter = SearchConfigParameters::$PARAM_FILTER . + '[' . $context->getTable() . '.' . $context->getLabel() . '*~]=' . $value; $page = trim($this->config['page']); if (!$page) $page = cleanID($context->getLabel());