diff options
| author | Lester Caine <lester@lsces.co.uk> | 2026-05-14 09:54:15 +0100 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2026-05-14 09:54:15 +0100 |
| commit | 7e4af642c93da5af9889211cff169c901e35d6b8 (patch) | |
| tree | 9fd6433fcf8e763c97fd8499b2f13e88312bf3ce /plugins | |
| parent | b463af3dd0d69bf659bd0820bd07bebd6358f74c (diff) | |
| download | liberty-7e4af642c93da5af9889211cff169c901e35d6b8.tar.gz liberty-7e4af642c93da5af9889211cff169c901e35d6b8.tar.bz2 liberty-7e4af642c93da5af9889211cff169c901e35d6b8.zip | |
php-cs-fixer tidies to php8.5 standards
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'plugins')
58 files changed, 254 insertions, 249 deletions
diff --git a/plugins/data.addjstabs.php b/plugins/data.addjstabs.php index 61a779b..9e37554 100755 --- a/plugins/data.addjstabs.php +++ b/plugins/data.addjstabs.php @@ -1,7 +1,7 @@ <?php namespace Bitweaver\Liberty; -use Bitweaver\Liberty\LibertyBase; + use Bitweaver\KernelTools; /** @@ -39,7 +39,7 @@ $pluginParams = [ 'description' => KernelTools::tra("Will join the contents from several sources in a Tabbed Interface."), 'help_function' => 'data_addjstabs_help', 'syntax' => "{ADDTABS tab1= tab2= tab3= . . . tab99= }", - 'plugin_type' => DATA_PLUGIN + 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAADDJSTABS, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAADDJSTABS ); @@ -97,7 +97,7 @@ function data_addjstabs($data, $params) { } if( !empty( $html )) { return \Bitweaver\Liberty\smarty_block_jstabs( [], $html, $gBitSmarty, '' ); - } else { - return $html; } + return $html; + } diff --git a/plugins/data.addtabs.php b/plugins/data.addtabs.php index de49b25..f470f67 100755 --- a/plugins/data.addtabs.php +++ b/plugins/data.addtabs.php @@ -1,7 +1,7 @@ <?php namespace Bitweaver\Liberty; -use Bitweaver\Liberty\LibertyBase; + use Bitweaver\KernelTools; /** @@ -38,7 +38,7 @@ $pluginParams = [ 'description' => KernelTools::tra("Will join the contents from several sources in a Tabbed Interface."), 'help_function' => '\data_addtabs_help', 'syntax' => "{ADDTABS tab1= tab2= tab3= . . . tab99= }", - 'plugin_type' => DATA_PLUGIN + 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAADDTABS, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAADDTABS ); diff --git a/plugins/data.adsense.php b/plugins/data.adsense.php index b8af0c9..698a691 100755 --- a/plugins/data.adsense.php +++ b/plugins/data.adsense.php @@ -1,6 +1,7 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; /** @@ -30,7 +31,7 @@ use Bitweaver\KernelTools; ******************/ global $gLibertySystem; define( 'PLUGIN_GUID_DATAADSENSE', 'dataadsense' ); -$pluginParams = array ( +$pluginParams = [ 'tag' => 'ADSENSE', 'auto_activate' => false, 'requires_pair' => false, @@ -40,8 +41,8 @@ $pluginParams = array ( 'description' => KernelTools::tra("This plugin adds Adsense Code to page."), 'help_function' => '\data_adsense_help', 'syntax' => "{ADSENSE}", - 'plugin_type' => DATA_PLUGIN -); + 'plugin_type' => DATA_PLUGIN, +]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAADSENSE, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAADSENSE ); diff --git a/plugins/data.agentinfo.php b/plugins/data.agentinfo.php index b2b7cf5..9d07784 100755 --- a/plugins/data.agentinfo.php +++ b/plugins/data.agentinfo.php @@ -1,6 +1,7 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; /** @@ -38,7 +39,7 @@ $pluginParams = [ 'description' => KernelTools::tra("This plugin will display the viewer's IP address, the Browser they are using, or the info about the site's Server software."), 'help_function' => '\data_agentinfo_help', 'syntax' => "{AGENTINFO info= }", - 'plugin_type' => DATA_PLUGIN + 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAAGENTINFO, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAAGENTINFO ); @@ -69,19 +70,19 @@ function data_agentinfo_help() { // Load Function function data_agentinfo($data, $params) { - $info = 'IP'; + $info = 'IP'; extract ($params, EXTR_SKIP); switch (strtoupper ($info)) { case 'SVRSW': // To maintain Pre-Clyde Parameters - case 'SERVER': - $ret = $_SERVER["SERVER_SOFTWARE"]; - return $ret; - case 'BROWSER': - $ret = $_SERVER["HTTP_USER_AGENT"]; - return $ret; - default: - $ret = $_SERVER["REMOTE_ADDR"]; - return $ret; + case 'SERVER': + $ret = $_SERVER["SERVER_SOFTWARE"]; + return $ret; + case 'BROWSER': + $ret = $_SERVER["HTTP_USER_AGENT"]; + return $ret; + default: + $ret = $_SERVER["REMOTE_ADDR"]; + return $ret; } } diff --git a/plugins/data.alias.php b/plugins/data.alias.php index ea44644..9c3eb75 100755 --- a/plugins/data.alias.php +++ b/plugins/data.alias.php @@ -1,7 +1,7 @@ <?php namespace Bitweaver\Liberty; -use Bitweaver\Liberty\LibertyContent; + use Bitweaver\Wiki\BitPage; use Bitweaver\KernelTools; @@ -30,7 +30,7 @@ $pluginParams = [ 'description' => KernelTools::tra( "This plugin allows you to easily create an alias for a page." ), 'help_function' => '\data_alias_help', 'syntax' => "{alias page='title'}", - 'plugin_type' => DATA_PLUGIN + 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAalias, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAalias ); diff --git a/plugins/data.attachment.php b/plugins/data.attachment.php index f1c0167..b3fcc68 100755 --- a/plugins/data.attachment.php +++ b/plugins/data.attachment.php @@ -1,8 +1,7 @@ <?php namespace Bitweaver; -use Bitweaver\BitBase; -use Bitweaver\KernelTools; + use Bitweaver\Liberty\LibertyBase; use Bitweaver\Liberty\LibertyContent; use Bitweaver\Wiki\BitPage; @@ -48,7 +47,6 @@ $pluginParams = [ $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAATTACHMENT, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAATTACHMENT ); - function data_attachment_help() { $help = '<table class="data help">' diff --git a/plugins/data.biticon.php b/plugins/data.biticon.php index 70462f5..da40c68 100755 --- a/plugins/data.biticon.php +++ b/plugins/data.biticon.php @@ -1,6 +1,7 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; /** @@ -24,7 +25,7 @@ $pluginParams = [ 'description' => KernelTools::tra( "Display any bitweaver icon" ), 'help_function' => '\data_biticon_help', 'syntax' => '{biticon ipackage= iname= iexplain=}', - 'plugin_type' => DATA_PLUGIN + 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATABITICON, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATABITICON ); diff --git a/plugins/data.code.php b/plugins/data.code.php index db070ad..3cf90dd 100755 --- a/plugins/data.code.php +++ b/plugins/data.code.php @@ -1,7 +1,6 @@ <?php namespace Bitweaver; -use Bitweaver\KernelTools; /** * @version $Revision$ @@ -155,7 +154,6 @@ if( !function_exists( 'deCodeHTML' )) { // avoid name collisions } } - // Load Function function data_code( $pData, $pParams ) { // Pre-Clyde Changes global $gBitSystem; @@ -181,7 +179,7 @@ function data_code( $pData, $pParams ) { // Pre-Clyde Changes break; } } - $num = isset( $num ) ? $num : false; + $num = $num ?? false; // trim any trailing spaces $code = ''; @@ -241,7 +239,7 @@ function data_code( $pData, $pParams ) { // Pre-Clyde Changes } $code = highlight_string( $code, true ); // Replacement-map to replace Colors - $convmap = array( + $convmap = [ // The Default Color '#000000">' => '#004A4A">', // Color for Functions/Variables/Numbers/&/Constants @@ -251,8 +249,8 @@ function data_code( $pData, $pParams ) { // Pre-Clyde Changes // Color for Constants '#FF9900">' => '#BB4040">', // Color for Strings - '#CC0000">' => '#903030">' - ); + '#CC0000">' => '#903030">', + ]; // <-- # Assigned by HighLight_String / --> # Color to be Displayed // NOTE: The colors assigned by HighLight_String have changed with different versions of PHP - these are for PHP 4.3.4 // Change the Colors diff --git a/plugins/data.comment.php b/plugins/data.comment.php index b5cbef4..6db25ea 100755 --- a/plugins/data.comment.php +++ b/plugins/data.comment.php @@ -1,6 +1,7 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; /** @@ -25,7 +26,7 @@ $pluginParams = [ 'description' => KernelTools::tra("This plugin allows Comments (Text that will not be displayed) to be added to a page."), 'help_function' => '\data__comment_help', 'syntax' => "{comment}Data Not Displayed{/comment}", - 'plugin_type' => DATA_PLUGIN + 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATACOMMENT, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATACOMMENT ); diff --git a/plugins/data.copyright.php b/plugins/data.copyright.php index 9011acb..eb052e4 100755 --- a/plugins/data.copyright.php +++ b/plugins/data.copyright.php @@ -1,6 +1,7 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; /** @@ -41,7 +42,7 @@ $pluginParams = [ 'description' => KernelTools::tra("This plugin is used to insert CopyRight notices."), 'help_function' => '\data_copyright_help', 'syntax' => "{COPYRIGHT title= year= authors= }", - 'plugin_type' => DATA_PLUGIN + 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATACOPYRIGHT, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATACOPYRIGHT ); @@ -97,9 +98,9 @@ function data_copyright($data, $params) { // Pre-Clyde Changes $pos2 = strlen($data) - $pos1; $authors = substr( $data, $pos1, $pos2); } else { - $title = isset( $title) ? $title : ' '; - $year = isset( $year) ? $year : ' '; - $authors = isset( $authors) ? $authors : ' '; + $title = $title ?? ' '; + $year = $year ?? ' '; + $authors = $authors ?? ' '; } $ret = 'The plugin <strong>"' . $pluginParams['tag'] . '"</strong> has not been completed as yet. '; return $ret; diff --git a/plugins/data.countdown.php b/plugins/data.countdown.php index ecab8a9..330d36c 100755 --- a/plugins/data.countdown.php +++ b/plugins/data.countdown.php @@ -1,6 +1,7 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; /** @@ -28,7 +29,7 @@ use Bitweaver\KernelTools; */ define( 'PLUGIN_GUID_DATACOUNTDOWN', 'datacountdown' ); global $gLibertySystem; -$pluginParams = array ( +$pluginParams = [ 'tag' => 'COUNTDOWN', 'auto_activate' => false, 'requires_pair' => false, @@ -38,8 +39,8 @@ $pluginParams = array ( 'description' => KernelTools::tra("Displays a Count-Down until a date:time is reached - then - negative numbers indicate how long it has been since that date. The Count-Down is displayed in the format of (X days, X hours, X minutes and X seconds)."), 'help_function' => '\data_countdown_help', 'syntax' => "{COUNTDOWN enddate= localtime= class= punct= text=}", - 'plugin_type' => DATA_PLUGIN -); + 'plugin_type' => DATA_PLUGIN, +]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATACOUNTDOWN, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATACOUNTDOWN ); @@ -66,17 +67,17 @@ function data_countdown_help() { .'<td>class</td>' .'<td>' . KernelTools::tra( "string") . '<br />' . KernelTools::tra("(optional)") . '</td>' .'<td>' . KernelTools::tra( "Classname of the SPAN surrounding the countdown. The date/time segments are each wrapped in a VAR-Tag. Default = countdown") . '</td>' - .'</tr>' + .'</tr>' .'<tr class="even">' .'<td>punct</td>' .'<td>' . KernelTools::tra( "string") . '<br />' . KernelTools::tra("(optional)") . '</td>' .'<td>' . KernelTools::tra( "Any kind of punctuation to divide the date/time segments from each other, a comma, a colon, a pipe ... Default = space. To put a non breaking space, use HTML: &nbsp;") . '</td>' - .'</tr>' + .'</tr>' .'<tr class="odd">' .'<td>text</td>' .'<td>' . KernelTools::tra( "string") . '<br />' . KernelTools::tra("(optional)") . '</td>' .'<td>' . KernelTools::tra( "Text to be displayed after the date/time string. It's wrapped in <em>.") . '</td>' - .'</tr>' + .'</tr>' .'</table>' .'<p>' . KernelTools::tra("Example 1: ") . '<input value="{COUNTDOWN enddate=\'8:02pm May 10 2004\' localtime=\'on\' text=\'' . KernelTools::tra(" - Time Passes So Slowly") . '\'}" type="text" size="40" /></p>' .'<p>' . KernelTools::tra("Example 2: ") . '<input value="{COUNTDOWN enddate=\'2012-12-22 00:01\' class=\'alert red\' punct=\', \' text=\'Purple Haze\'}" type="text" size="40" /></p>' @@ -90,26 +91,26 @@ function data_countdown($data,$params) { global $gLibertySystem; $pluginParams = $gLibertySystem->mPlugins[PLUGIN_GUID_DATACOUNTDOWN]; extract ($params, EXTR_SKIP); - + if (!isset($enddate) ) { // The Mandatory Parameter is missing $ret = KernelTools::tra("The required parameter ") . "<strong>enddate</strong>" . KernelTools::tra(" was missing from the plugin ") . '<strong>"' . $pluginParams['tag'] . '"</strong>'; $ret.= data_countdown_help(); return $ret; } - + $then = strtotime ($enddate); - + if ($then == -1) { // strtotime failed so enddate was not a valid date $ret = KernelTools::tra("__Error__ - The plugin ") . '<strong>"' . $pluginParams['tag'] . '"</strong>' . KernelTools::tra(" was not given a valid date. The date given was:\n") . "enddate=$enddate"; return $ret; } - + $tz = isset($localtime) && $localtime == 'on' && isset($_COOKIE['tz_offset']) ? $_COOKIE['tz_offset'] : 0; - + if (!isset($class)) { $class = 'countdown'; } - + if (!isset($punct)) { $punct = " "; } @@ -118,17 +119,16 @@ function data_countdown($data,$params) { $text = ""; } - $now = strtotime ("now") + $tz; $difference = $then - $now; $num = $difference/86400; - $days = intval($num); + $days = (int) $num; $num2 = ($num - $days)*24; - $hours = intval($num2); + $hours = (int) $num2; $num3 = ($num2 - $hours)*60; - $mins = intval($num3); + $mins = (int) $num3; $num4 = ($num3 - $mins)*60; - $secs = intval($num4); + $secs = (int) $num4; $ret = " <span class='".$class."'>" . "<var>" . $days . " " . KernelTools::tra("days") . "</var>" . $punct diff --git a/plugins/data.creationtime.php b/plugins/data.creationtime.php index 7d0b33d..ea3a848 100755 --- a/plugins/data.creationtime.php +++ b/plugins/data.creationtime.php @@ -1,7 +1,6 @@ <?php namespace Bitweaver; -use Bitweaver\KernelTools; /** * @version $Revision$ @@ -37,7 +36,7 @@ $pluginParams = [ 'description' => KernelTools::tra("This plugin will display the creation time of a page."), 'help_function' => '\data_creationtime_help', 'syntax' => "{creationtime}", - 'plugin_type' => DATA_PLUGIN + 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATA_CREATIONTIME, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATA_CREATIONTIME ); @@ -47,7 +46,7 @@ function data_creationtime_help() { return KernelTools::tra( "Example: " )."{creationtime}<br />"; } -//The actual handler for the plugin +//The actual handler for the plugin function data_creationtime( $data, $params, &$pCommonObject ) { return \Bitweaver\Liberty\smarty_modifier_bit_short_datetime( $pCommonObject->mInfo['created'] ); } diff --git a/plugins/data.div.php b/plugins/data.div.php index 1caee93..5c57c67 100755 --- a/plugins/data.div.php +++ b/plugins/data.div.php @@ -1,7 +1,7 @@ <?php namespace Bitweaver; -use Bitweaver\KernelTools; + use Bitweaver\Liberty\LibertyContent; /** @@ -29,7 +29,7 @@ $pluginParams = [ 'description' => KernelTools::tra( "This plugin allows you to easily create a div with a number of optional CSS parameters." ), 'help_function' => '\data_div_help', 'syntax' => "{div border='3px solid blue'}", - 'plugin_type' => DATA_PLUGIN + 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATADIV, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATADIV ); diff --git a/plugins/data.dropdown.php b/plugins/data.dropdown.php index 861b05d..4c1eee6 100755 --- a/plugins/data.dropdown.php +++ b/plugins/data.dropdown.php @@ -1,6 +1,7 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; /** @@ -36,7 +37,7 @@ $pluginParams = [ 'description' => KernelTools::tra("This plugin creates a expandable box of text. All text should be entered between the ") . "{DD} " . KernelTools::tra("blocks."), 'help_function' => '\data_dropdown_help', 'syntax' => "{DD title= width= }" . KernelTools::tra("Text in the Drop-Down box.") . "{DD}", - 'plugin_type' => DATA_PLUGIN + 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATADROPDOWN, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATADROPDOWN ); @@ -73,7 +74,7 @@ function data_dropdown_help() { */ function data_dropdown($data, $params) { extract ($params, EXTR_SKIP); - $title = isset($title) ? $title : KernelTools::tra( 'For More Information, click me.' ); + $title = $title ?? KernelTools::tra( 'For More Information, click me.' ); $id = 'dropdown'.(microtime() * 1000000); $ret = '<div style="text-align:center;font-weight:bold;">' .'<a title="Click to Expand or Contract" href="javascript:flip(\''.$id.'\')">'.$title.'</a>' diff --git a/plugins/data.example.php b/plugins/data.example.php index 7e86407..2b1adfc 100755 --- a/plugins/data.example.php +++ b/plugins/data.example.php @@ -1,6 +1,7 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; /** @@ -36,7 +37,7 @@ $pluginParams = [ 'description' => KernelTools::tra("This Plugin is an Example that does nothing. It functions as a template for the creation of new plugins."), 'help_function' => '\data_example_help', 'syntax' => "{EXAM x1= x2= }", - 'plugin_type' => DATA_PLUGIN + 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAEXAMPLE, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAEXAMPLE ); @@ -65,7 +66,7 @@ function data_example_help() { .'<br />' . KernelTools::tra( "The Default =") . ' <strong>3</strong> ' . KernelTools::tra( "Which means - What") .'</td>' .'</tr>' - .'</table>' + .'</table>' . KernelTools::tra("Example: ") . "{EXAM x1=' ' x2=5 }<br />" . KernelTools::tra("This will display"); return $help; diff --git a/plugins/data.geshidata.php b/plugins/data.geshidata.php index a7ec24b..23ed18c 100755 --- a/plugins/data.geshidata.php +++ b/plugins/data.geshidata.php @@ -1,6 +1,7 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; // $Id$ @@ -31,7 +32,7 @@ $pluginParams = [ 'description' => KernelTools::tra("This plugin is a documentation tool for the bitweaver site. It will display some of information defined in the GeSHi (Generic Syntax Highlighter) package."), 'help_function' => '\data_help_GeshiData', 'syntax' => "{GESHIDATA doall= lang= info= }", - 'plugin_type' => DATA_PLUGIN + 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAGESHIDATA, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAGESHIDATA ); @@ -120,7 +121,7 @@ function data_GeshiData($data, $params) { return $ret; } } } return \pluginError('GeshiData', KernelTools::tra('The value placed in the parameter').' <strong>$info='.$info.'</strong> '.KernelTools::tra("was not a valid Key-word.")); - } else { + } $ret = '<div class="box">'; $ret .= '<div class="error" style="text-align:center;">'; // The Header $ret .= '<big><big><strong>'.KernelTools::tra('Language Properties').'</strong></big></big>'; @@ -161,6 +162,6 @@ function data_GeshiData($data, $params) { } // foreach $ret .= '</div>'; $ret .= '</div>'; - } + return $ret; } diff --git a/plugins/data.googleviewer.php b/plugins/data.googleviewer.php index 89261b3..b2442bf 100755 --- a/plugins/data.googleviewer.php +++ b/plugins/data.googleviewer.php @@ -1,6 +1,7 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; /** @@ -25,7 +26,7 @@ $pluginParams = [ 'description' => KernelTools::tra( "This plugin allows you to simply embed a PDF document in a page using the embeddable Google Viewer." ), 'help_function' => '\data_googleviewer_help', 'syntax' => "{googleviewer url=}", - 'plugin_type' => DATA_PLUGIN + 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAGOOGLEVIEWER, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAGOOGLEVIEWER ); @@ -78,7 +79,7 @@ function data_googleviewer( $pData, $pParams ) { if( !empty( $url )) { return '<!--~np~--><iframe width="'.$width.'" height="'.$height.'" style="border:none;" src="http://docs.google.com/viewer?embedded=true&url='.urlencode($url).'"></iframe><!--~/np~-->'; - } else { - return KernelTools::tra( 'No URL given' ); } + return KernelTools::tra( 'No URL given' ); + } diff --git a/plugins/data.graphviz.php b/plugins/data.graphviz.php index d4d679e..e9db497 100755 --- a/plugins/data.graphviz.php +++ b/plugins/data.graphviz.php @@ -1,6 +1,7 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; /** @@ -37,7 +38,7 @@ $pluginParams = [ 'description' => KernelTools::tra("This plugin renders it's content as a graphviz image (dot or neato). It requies the Image_GraphViz pear plugin and graphviz to be installed: pear install Image_GraphViz"), 'help_function' => '\data_graphviz_help', 'syntax' => "{GRAPHVIZ}digraph ... {/GRAPHVIZ}", - 'plugin_type' => DATA_PLUGIN + 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAGRAPHVIZ, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAGRAPHVIZ ); @@ -66,7 +67,7 @@ function data_graphviz_help() { .'<br />' . KernelTools::tra( "The Default =") . ' <strong>3</strong> ' . KernelTools::tra( "Which means - What") .'</td>' .'</tr>' - .'</table>' + .'</table>' . KernelTools::tra("Example: ") . "{EXAM x1=' ' x2=5 }<br />" . KernelTools::tra("This will display"); return $help; @@ -80,24 +81,24 @@ function data_graphviz($data, $params) { $storageurl = STORAGE_PKG_URL.'GraphViz/'; $storagepath = STORAGE_PKG_PATH.'GraphViz/'; $temppath = TEMP_PKG_PATH.'GraphViz/'; - + if( !is_dir( $temppath ) ) { KernelTools::mkdir_p( $temppath ); } if( !is_dir( $storagepath ) ) { KernelTools::mkdir_p( $storagepath ); } - + $file = md5( $data ); $dotFile = $temppath . $file . '.dot'; $pngFile = $storagepath . $file . '.png'; $pngURL = $storageurl . $file . '.png'; - + if( !file_exists( $pngFile ) ) { if( @include_once 'PEAR.php' ) { if(@include_once UTIL_PKG_INCLUDE_PATH.'pear/Image/GraphViz.php' ) { $graph = new \Image_GraphViz; - $error = '<div class=error>'.KernelTools::tra("Unable to write temporary file. Please check your server configuration.").'</div>'; + $error = '<div class=error>'.KernelTools::tra("Unable to write temporary file. Please check your server configuration.").'</div>'; if (!$fp = fopen($dotFile, 'w')) { return $error; } @@ -108,7 +109,7 @@ function data_graphviz($data, $params) { $graph->renderDotFile( $dotFile, $pngFile, 'png' ); // No need to keep this lying around unlink($dotFile); - + // If it still isn't there.... if (!file_exists($pngFile)) { return '<div class=error>'.KernelTools::tra("Unable to generate graphviz image file. Please check your data.").'</div>'; @@ -118,7 +119,7 @@ function data_graphviz($data, $params) { return "<div class=error>".KernelTools::tra("The Image_Graphviz pear plugin is not installed. Install with `pear install Image_Graphviz`.")."</div>"; } } - else { + else { return "<div class=error>".KernelTools::tra("PEAR and the Image_Graphviz pear plugin are not installed.")."</div>"; } } diff --git a/plugins/data.img.php b/plugins/data.img.php index d8ce09f..8e41af6 100755 --- a/plugins/data.img.php +++ b/plugins/data.img.php @@ -1,7 +1,6 @@ <?php namespace Bitweaver; -use Bitweaver\KernelTools; /** * @version $Revision$ @@ -27,7 +26,7 @@ $pluginParams = [ 'syntax' => "{img src=http://www.google.at/logos/olympics06_ski_jump.gif}", 'plugin_type' => DATA_PLUGIN, 'booticon' => '{booticon iname="icon-picture" iexplain="Web Image"}', - 'taginsert' => '{img src= width= height= align= description= link=}' + 'taginsert' => '{img src= width= height= align= description= link=}', ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAIMG, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAIMG ); diff --git a/plugins/data.include.php b/plugins/data.include.php index 1bbfc61..5d6e13d 100755 --- a/plugins/data.include.php +++ b/plugins/data.include.php @@ -1,8 +1,8 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; -use Bitweaver\Liberty\LibertyBase; use Bitweaver\Wiki\BitPage; /** @@ -40,7 +40,7 @@ $pluginParams = [ 'description' => KernelTools::tra("This plugin is used to include the contents of one Wiki page in another Wiki page."), 'help_function' => '\data_include_help', 'syntax' => "{INCLUDE content_id= }", - 'plugin_type' => DATA_PLUGIN + 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAINCLUDE, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAINCLUDE ); diff --git a/plugins/data.jstabs.php b/plugins/data.jstabs.php index 50493d3..d3e9c15 100755 --- a/plugins/data.jstabs.php +++ b/plugins/data.jstabs.php @@ -1,8 +1,8 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; -use Bitweaver\Liberty\LibertyContent; /** * @version $Revision$ @@ -37,7 +37,6 @@ $pluginParams = [ $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAJSTABS, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAJSTABS ); - function data_jstabs( $pData, $pParams, $pCommonObject ) { global $gBitSmarty; @@ -67,9 +66,9 @@ function data_jstabs( $pData, $pParams, $pCommonObject ) { if( !empty( $html )) { return \Bitweaver\Liberty\smarty_block_jstabs( [], $html, $gBitSmarty, '' ); - } else { - return ' '; } + return ' '; + } function data_jstabs_help() { diff --git a/plugins/data.ledgertable.php b/plugins/data.ledgertable.php index 16554cf..cb3ef06 100755 --- a/plugins/data.ledgertable.php +++ b/plugins/data.ledgertable.php @@ -1,6 +1,7 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; // $Id$ @@ -30,7 +31,7 @@ $pluginParams = [ 'description' => KernelTools::tra("This Plugin creates a ledger-like table with even/odd row colors, optional top- or left-placed headers, and support for row/column spans."), 'help_function' => '\data_ledgertable_help', 'syntax' => "{LEDGERTABLE loc= head= }", - 'plugin_type' => DATA_PLUGIN + 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATALEDGERTABLE, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATALEDGERTABLE ); @@ -60,14 +61,14 @@ function data_ledgertable_help() { .'</table>' . KernelTools::tra("LedgerTable: ") . "{LEDGERTABLE loc=>left head=>Row1~|~Row2~|~Row3}<br />" . KernelTools::tra("This will display") - . data_ledgertable('Example', array('loc' => 'left', 'head' => 'Row1~|~Row2~|~Row3')); + . data_ledgertable('Example', ['loc' => 'left', 'head' => 'Row1~|~Row2~|~Row3']); return $help; } /**************** * Load Function * ****************/ function data_ledgertable($data, $params) { - global $gBitSystem; + global $gBitSystem; if (empty($data)) { return "<!-- Error: No data passed to LEDGERTABLE plugin. -->"; @@ -77,76 +78,76 @@ function data_ledgertable($data, $params) { } $ret = ''; - if (isset($params['loc'])) { + if (isset($params['loc'])) { $ret .= "<!-- Header row set to $params[loc]. -->"; $plugdata_loc = $params['loc']; } else { $ret .= "<!-- Defaulting header row to top. -->"; - $plugdata_loc = 'top'; - } - if (isset($params['head'])) { + $plugdata_loc = 'top'; + } + if (isset($params['head'])) { $ret .= "<!-- Got headers. -->"; $plugdata_head = $params['head']; - } else { + } else { $ret .= "<!-- No headers specified. -->"; - } - if (isset($params['width'])) { + } + if (isset($params['width'])) { $ret .= "<!-- Got width $params[width]. -->"; $plugdata_width = " style=\"width: " . $params['width'] . '"'; - } else { + } else { $plugdata_width = ""; - } + } - $ret .= "<table class=\"ledgertable\"$plugdata_width>"; + $ret .= "<table class=\"ledgertable\"$plugdata_width>"; - if (isset($plugdata_head)) { - $headers = explode('~|~', $plugdata_head); - if ($plugdata_loc == 'top') { - $ret .= " <!-- Placing header row on top. -->"; - $ret .= " <tr class=\"ledgertable header row\">"; - foreach ($headers as $hdr) { - $ret .= " <th class=\"header highlight\">$hdr</td>"; - } - $ret .= " </tr>"; + if (isset($plugdata_head)) { + $headers = explode('~|~', $plugdata_head); + if ($plugdata_loc == 'top') { + $ret .= " <!-- Placing header row on top. -->"; + $ret .= " <tr class=\"ledgertable header row\">"; + foreach ($headers as $hdr) { + $ret .= " <th class=\"header highlight\">$hdr</td>"; + } + $ret .= " </tr>"; } } - $lines = mb_split("\n", $data); - $line_count = 0; - foreach ($lines as $line) { - $line = trim($line); - if (strlen($line) <= 0) { - continue; - } - $line_count++; + $lines = mb_split("\n", $data); + $line_count = 0; + foreach ($lines as $line) { + $line = trim($line); + if (strlen($line) <= 0) { + continue; + } + $line_count++; - $ret .= " <!-- Displaying row $line_count. -->"; - $ret .= " <tr class=\"" . (($line_count % 2) ? "odd" : "even") . "\">"; - if (isset($plugdata_head) && ($plugdata_loc == "left")) { - $ret .= " <!-- Placing header on left. -->"; - $ret .= " <th class=\"header highlight\""; - $header = array_shift($headers); - if (preg_match("/^~(row|col)span:(\d+)~(.*)$/", $header, $matches)) { - $ret .= " $matches[1]span=\"$matches[2]\""; - $header = $matches[3]; - } - $ret .= ">$header</td>"; - } - $cells = explode("~|~", $line); - foreach ($cells as $col) { - $ret .= " <td class=\"" . (($line_count % 2) ? "odd" : "even") . "\""; - $col = trim($col); - if (!strcmp($col, "~blank~")) { - $col = " "; - } else if (preg_match("/^~(row|col)span:(\d+)~(.*)$/", $col, $matches)) { - $ret .= " $matches[1]span=\"$matches[2]\""; - $col = $matches[3]; - } - $ret .= ">$col</td>"; - } - $ret .= " </tr>"; - } - $ret .= "</table>"; + $ret .= " <!-- Displaying row $line_count. -->"; + $ret .= " <tr class=\"" . (($line_count % 2) ? "odd" : "even") . "\">"; + if (isset($plugdata_head) && ($plugdata_loc == "left")) { + $ret .= " <!-- Placing header on left. -->"; + $ret .= " <th class=\"header highlight\""; + $header = array_shift($headers); + if (preg_match("/^~(row|col)span:(\d+)~(.*)$/", $header, $matches)) { + $ret .= " $matches[1]span=\"$matches[2]\""; + $header = $matches[3]; + } + $ret .= ">$header</td>"; + } + $cells = explode("~|~", $line); + foreach ($cells as $col) { + $ret .= " <td class=\"" . (($line_count % 2) ? "odd" : "even") . "\""; + $col = trim($col); + if (!strcmp($col, "~blank~")) { + $col = " "; + } else if (preg_match("/^~(row|col)span:(\d+)~(.*)$/", $col, $matches)) { + $ret .= " $matches[1]span=\"$matches[2]\""; + $col = $matches[3]; + } + $ret .= ">$col</td>"; + } + $ret .= " </tr>"; + } + $ret .= "</table>"; - return $ret; + return $ret; } diff --git a/plugins/data.module.php b/plugins/data.module.php index f692bb8..ccdc7e3 100755 --- a/plugins/data.module.php +++ b/plugins/data.module.php @@ -1,6 +1,7 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; /** @@ -38,7 +39,7 @@ $pluginParams = [ 'description' => KernelTools::tra("Display a module block in content"), 'help_function' => '\datamodule_help', 'syntax' => "{module module= align='right'}", - 'plugin_type' => DATA_PLUGIN + 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAMODULE, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAMODULE ); @@ -115,7 +116,7 @@ function data_datamodule( $pData, $pParams ) { // deal with custom styling $style = ''; - $style_options = array( 'float', 'width', 'background', 'color' ); + $style_options = [ 'float', 'width', 'background', 'color' ]; foreach( $pParams as $param => $value ) { if( in_array( $param, $style_options ) ) { $style .= $param.':'.$value.';'; diff --git a/plugins/data.object.php b/plugins/data.object.php index 642314a..840bc0c 100755 --- a/plugins/data.object.php +++ b/plugins/data.object.php @@ -1,6 +1,7 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; /** @@ -43,12 +44,11 @@ $pluginParams = [ 'description' => KernelTools::tra("This plugin displays a Flash, Tcl or Java applet/object."), 'help_function' => '\data_object_help', 'syntax' => "{OBJECT type= src= width= height=}", - 'plugin_type' => DATA_PLUGIN + 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAOBJECT, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAOBJECT ); - function data_object_help() { $help = '<table class="data help">' @@ -150,10 +150,9 @@ function data_object_help() { return $help; } - function data_object ($data, $params) { // Need these plugin parameters - foreach (array("type", "src") as $parameter) { + foreach (["type", "src"] as $parameter) { if (!array_key_exists($parameter, $params)) return '<span class="warning">'.KernelTools::tra('When using <strong>{object}</strong>, a <strong>type</strong> and <strong>src</strong> parameter is required.').'</span>'; } diff --git a/plugins/data.pluginhelp.php b/plugins/data.pluginhelp.php index c5f914a..043d335 100755 --- a/plugins/data.pluginhelp.php +++ b/plugins/data.pluginhelp.php @@ -1,6 +1,7 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; /** @@ -37,7 +38,7 @@ $pluginParams = [ 'description' => KernelTools::tra("This plugin will display the plugin's Help."), 'help_function' => '\data_pluginhelp_help', 'syntax' => "{PLUGINHELP plugin= }", - 'plugin_type' => DATA_PLUGIN + 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAPLUGINHELP, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAPLUGINHELP ); diff --git a/plugins/data.pre.php b/plugins/data.pre.php index 9bb42d0..c822713 100755 --- a/plugins/data.pre.php +++ b/plugins/data.pre.php @@ -1,8 +1,8 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; -use Bitweaver\Liberty\LibertyContent; /** * assigned_modules @@ -29,7 +29,7 @@ $pluginParams = [ 'description' => KernelTools::tra( "This plugin allows you to easily create a preformatted text block with a number of optional CSS parameters." ), 'help_function' => '\data_pre_help', 'syntax' => "{pre border='3px solid blue'}", - 'plugin_type' => DATA_PLUGIN + 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAPRE, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAPRE ); diff --git a/plugins/data.quote.php b/plugins/data.quote.php index 67e927d..a05d4e2 100755 --- a/plugins/data.quote.php +++ b/plugins/data.quote.php @@ -1,9 +1,9 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; use Bitweaver\Boards\BitBoardPost; -use Bitweaver\Liberty\LibertyComment; use Bitweaver\Users\RoleUser; /** @@ -43,7 +43,7 @@ $pluginParams = [ 'help_page' => 'DataPluginQuote', 'description' => KernelTools::tra( "This plugin allows content to be attributed to other authors and visually indicated." ), 'syntax' => "{quote format_guid= user= comment_id= }.. content ..{/quote}", - 'plugin_type' => DATA_PLUGIN + 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAQUOTE, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAQUOTE ); @@ -100,7 +100,7 @@ function data_quote( $pData, $pParams ) { $user = empty( $pParams['user'] ) ? null : $pParams['user']; if( !empty( $pParams['comment_id'] )) { - + $c = $gBitSystem->getActivePackage() == 'boards' ? new BitBoardPost( preg_replace( '/[^0-9]/', '', $pParams['comment_id'] ) ) : new LibertyComment( preg_replace( '/[^0-9]/', '', $pParams['comment_id'] ) ); diff --git a/plugins/data.renderer.php b/plugins/data.renderer.php index 3966a66..9a07095 100755 --- a/plugins/data.renderer.php +++ b/plugins/data.renderer.php @@ -1,6 +1,7 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; /** @@ -40,7 +41,7 @@ $pluginParams = [ 'help_page' => 'DataPluginRenderer', 'description' => KernelTools::tra( "This plugin will render the given content as described by the content_type given." ), 'syntax' => "{renderer class= format_guid= }.. content ..{/renderer}", - 'plugin_type' => DATA_PLUGIN + 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATARENDERER, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATARENDERER ); diff --git a/plugins/data.sort.php b/plugins/data.sort.php index 0e228a2..998b177 100755 --- a/plugins/data.sort.php +++ b/plugins/data.sort.php @@ -1,8 +1,8 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; -use Bitweaver\Liberty\LibertyContent; /** * @version $Revision$ @@ -25,7 +25,7 @@ $pluginParams = [ 'description' => KernelTools::tra( "This plugin will sort the lines within a {sort} block." ), 'help_function' => '\data_sort_help', 'syntax' => "{sort sort= }".KernelTools::tra( "Lines to be sorted" )."{sort}", - 'plugin_type' => DATA_PLUGIN + 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATASORT, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATASORT ); diff --git a/plugins/data.span.php b/plugins/data.span.php index a16a89f..e7a0df9 100755 --- a/plugins/data.span.php +++ b/plugins/data.span.php @@ -1,8 +1,8 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; -use Bitweaver\Liberty\LibertyContent; /** * assigned_modules @@ -29,7 +29,7 @@ $pluginParams = [ 'description' => KernelTools::tra( "This plugin allows you to easily create a span with a number of optional CSS parameters." ), 'help_function' => '\data_span_help', 'syntax' => "{span border='3px solid blue'}", - 'plugin_type' => DATA_PLUGIN + 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAspan, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAspan ); diff --git a/plugins/data.textarea.php b/plugins/data.textarea.php index a0890ac..107e28a 100755 --- a/plugins/data.textarea.php +++ b/plugins/data.textarea.php @@ -1,8 +1,8 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; -use Bitweaver\Liberty\LibertyContent; /** * assigned_modules @@ -29,7 +29,7 @@ $pluginParams = [ 'description' => KernelTools::tra( "This plugin allows you to easily create a textarea with a number of optional CSS parameters." ), 'help_function' => '\data_textarea_help', 'syntax' => "{textarea}", - 'plugin_type' => DATA_PLUGIN + 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAtextarea, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAtextarea ); diff --git a/plugins/data.toc.php b/plugins/data.toc.php index c40a97d..5428587 100755 --- a/plugins/data.toc.php +++ b/plugins/data.toc.php @@ -1,9 +1,9 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; use Bitweaver\BitBase; -use Bitweaver\Liberty\LibertyStructure; /** * @version $Revision$ @@ -44,7 +44,7 @@ $pluginParams = [ 'plugin_type' => DATA_PLUGIN, 'booticon' => '{booticon iname="icon-list-ol" iexplain="Structure Table of Contents"}', 'taginsert' => '{toc}', - 'structure_id' => 'id of the structure to display' + 'structure_id' => 'id of the structure to display', ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATATOC, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATATOC ); diff --git a/plugins/data.video.php b/plugins/data.video.php index 933886b..5d59520 100755 --- a/plugins/data.video.php +++ b/plugins/data.video.php @@ -1,6 +1,7 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; /** @@ -26,7 +27,7 @@ $pluginParams = [ 'description' => KernelTools::tra( "This plugin allows you to simply and safely insert a video in a page. Currently it only supports Flash Video (.flv) files." ), 'help_function' => '\data_video_help', 'syntax' => "{video video= player=}", - 'plugin_type' => DATA_PLUGIN + 'plugin_type' => DATA_PLUGIN, ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAVIDEO, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAVIDEO ); diff --git a/plugins/data.youtube.php b/plugins/data.youtube.php index ddefc43..cd944b5 100755 --- a/plugins/data.youtube.php +++ b/plugins/data.youtube.php @@ -1,6 +1,7 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; /** @@ -15,7 +16,7 @@ use Bitweaver\KernelTools; global $gLibertySystem; define( 'PLUGIN_GUID_DATAYOUTUBE', 'datayoutube' ); -$pluginParams = array ( +$pluginParams = [ 'tag' => 'YOUTUBE', 'auto_activate' => false, 'requires_pair' => false, @@ -25,8 +26,8 @@ $pluginParams = array ( 'description' => KernelTools::tra( "This plugin allows you to simply and safely insert a YouTube video in a page." ), 'help_function' => '\data_youtube_help', 'syntax' => "{youtube id=}", - 'plugin_type' => DATA_PLUGIN -); + 'plugin_type' => DATA_PLUGIN, +]; $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAYOUTUBE, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAYOUTUBE ); @@ -90,7 +91,7 @@ function data_youtube( $pData, $pParams ) { if( !empty( $id )) { return '<!--~np~--><object width="'.$width.'" height="'.$height.'"><param name="movie" value="http://www.youtube.com/v/'.$id.$lang.$format.'"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/'.$id.$lang.$format.'" type="application/x-shockwave-flash" wmode="transparent" width="'.$width.'" height="'.$height.'""></embed></object><!--~/np~-->'; - } else { - return KernelTools::tra( 'No ID given' ); } + return KernelTools::tra( 'No ID given' ); + } diff --git a/plugins/filter.attachment.php b/plugins/filter.attachment.php index a6b128e..2aa0b4c 100755 --- a/plugins/filter.attachment.php +++ b/plugins/filter.attachment.php @@ -1,5 +1,6 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\BitBase; /** @@ -67,7 +68,7 @@ function attachment_filter_reqirements( $pInstall = false ) { , CONSTRAINT `lib_att_usage_content_ref` FOREIGN KEY (`content_id`) REFERENCES `".BIT_DB_PREFIX."liberty_content`( `content_id` ) , CONSTRAINT `lib_att_usage_attachment_ref` FOREIGN KEY (`attachment_id`) REFERENCES `".BIT_DB_PREFIX."liberty_attachments`( `attachment_id` ) ' - " + ", ], 'indexes' => [ 'lib_att_usage_content_idx' => [ 'table' => 'liberty_attachment_usage', 'cols' => 'content_id', 'opts' => null ], diff --git a/plugins/filter.backtotop.php b/plugins/filter.backtotop.php index 637a44c..f58f8aa 100755 --- a/plugins/filter.backtotop.php +++ b/plugins/filter.backtotop.php @@ -6,8 +6,9 @@ */ namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; - + /** * definitions ( guid character limit is 16 chars ) */ @@ -42,11 +43,11 @@ function backtotop_postparsefilter( &$pData, &$pFilterHash ) { $params['max'] = 6; $params = array_merge( $params, KernelTools::parse_xml_attributes( $backtotop[1] )); - $biticon = array( + $biticon = [ 'ipackage' => 'icons', 'iname' => 'go-top', 'iexplain' => 'Back to top', - ); + ]; // get all headers into an array preg_match_all( "/<h(\d[^>]*)>.*?<\/h\d>/i", $pData, $headers ); diff --git a/plugins/filter.bitlinks.php b/plugins/filter.bitlinks.php index f448af9..593453b 100755 --- a/plugins/filter.bitlinks.php +++ b/plugins/filter.bitlinks.php @@ -1,9 +1,9 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; use Bitweaver\BitBase; -use Bitweaver\Liberty\LibertyContent; use Bitweaver\Wiki\BitPage; /** @@ -11,7 +11,6 @@ use Bitweaver\Wiki\BitPage; * @package liberty */ - /** * definitions ( guid character limit is 16 chars ) */ @@ -136,10 +135,6 @@ function bitlinks_expungefilter( &$pData, &$pFilterHash, $pObject ) { $sBitLinks->expungeLinks( $pObject->mContentId ); } - - - - /** * BitLinks class * @@ -312,8 +307,8 @@ class BitLinks extends BitBase { } } - // Process ((Wiki Page|Wiki Page Description)) type links first. Here - // we don't handle plurals and the like since the user should know what + // Process ((Wiki Page|Wiki Page Description)) type links first. Here + // we don't handle plurals and the like since the user should know what // he's linking to when using these links preg_match_all( "@\({2}({$this->mWikiWordRegex})\|(.+?)\){2}@", $pData, $pages ); for( $i = 0; $i < count( $pages[1] ); $i++ ) { @@ -588,7 +583,6 @@ class BitLinks extends BitBase { // - replace with new name leaving description in tact $replace[] = "(($pNewName|$1))"; - // --- ((Wiki Page)) or WikiPage // (\([2])? # check for (( - optional - put this in $1 // \b$pOldName\b # make sure the old name is on it's own diff --git a/plugins/filter.htmlpurifier.php b/plugins/filter.htmlpurifier.php index bfbfaa6..abed4e1 100755 --- a/plugins/filter.htmlpurifier.php +++ b/plugins/filter.htmlpurifier.php @@ -6,8 +6,7 @@ */ namespace Bitweaver\Liberty; - use Bitweaver\KernelTools; - + /** * definitions ( guid character limit is 16 chars ) */ @@ -15,7 +14,7 @@ define( 'PLUGIN_GUID_FILTERHTMLPURIFIER', 'filterhtmlpure' ); global $gLibertySystem; -$pluginParams = array ( +$pluginParams = [ // plugin title 'title' => 'HTMLPurifier', // help page on bitweaver org that explains this plugin @@ -38,7 +37,7 @@ $pluginParams = array ( // 'presplit_function' => '\Bitweaver\Liberty\htmlpure_filter', // called after the data has been parsed if there is a split 'postsplit_function' => '\Bitweaver\Liberty\htmlpure_filter', -); +]; $gLibertySystem->registerPlugin( PLUGIN_GUID_FILTERHTMLPURIFIER, $pluginParams ); function htmlpure_filter( &$pString, &$pFilterHash, $pObject ) { @@ -47,7 +46,7 @@ function htmlpure_filter( &$pString, &$pFilterHash, $pObject ) { if (!isset($gHtmlPurifier)) { $pear_version = false; - if (@include_once "PEAR.php") { + if (@include_once "PEAR.php") { if(@include_once UTIL_PKG_INCLUDE_PATH."/htmlpurifier-4.15.0/library/HTMLPurifier.php") { // for backward compatibility checks $htmlp_version = null; @@ -61,11 +60,10 @@ function htmlpure_filter( &$pString, &$pFilterHash, $pObject ) { $config = htmlpure_getDefaultConfig( $htmlp_version, $pObject ); - // As suggested here: https://www.bitweaver.org/forums/index.php?t=8554 $gHtmlPurifier = new \HTMLPurifier($config); - // how plugins are registered changed in v3.1 + // how plugins are registered changed in v3.1 // old way of adding plugins before v3.1 if ( !$htmlp_version >= 3.1 ) { htmlpure_legacyAddFilters(); @@ -75,7 +73,7 @@ function htmlpure_filter( &$pString, &$pFilterHash, $pObject ) { } // Did we manage to create one? - if (isset($gHtmlPurifier)) { + if (isset($gHtmlPurifier)) { /* Clean up the paragraphs a bit */ // $start = $pData; $pString = htmlpure_cleanupPeeTags($pString); @@ -103,8 +101,8 @@ function htmlpure_filter( &$pString, &$pFilterHash, $pObject ) { // If we have another parse step they may be escaping // entities so change quotes back. - if (empty($pFilterHash['format_guid']) || - $pFilterHash['format_guid'] != 'bithtml') { + if (empty($pFilterHash['format_guid']) || + $pFilterHash['format_guid'] != 'bithtml') { $pString = preg_replace('|"|', '"', $pString); $pString = preg_replace('|'|', "'", $pString); } @@ -140,7 +138,6 @@ function htmlpure_getDefaultConfig( &$htmlp_version, $pObject=null ){ //$config->set('HTML.DefinitionRev', 1); //$config->set('Cache.DefinitionImpl', null); // remove this later! - // Set the cache path $config->set('Cache.SerializerPath', rtrim( TEMP_PKG_PATH, '/' ) ); @@ -171,7 +168,7 @@ function htmlpure_getDefaultConfig( &$htmlp_version, $pObject=null ){ INNER JOIN `".BIT_DB_PREFIX."users_group_permissions` ugp ON (ugp.`group_id`=ugm.`group_id`) WHERE ugm.`user_id`=? AND (ugp.`perm_name`=? OR ugp.`perm_name`='p_admin')"; // cache for 15 minutes - $hasAdmin = $pObject->mDb->getOne( $query, array( $pObject->getField( 'modifier_user_id' ), $pObject->mAdminContentPerm ), null, null, 900 ); + $hasAdmin = $pObject->mDb->getOne( $query, [ $pObject->getField( 'modifier_user_id' ), $pObject->mAdminContentPerm ], null, null, 900 ); } if( $hasAdmin ) { @@ -179,11 +176,11 @@ function htmlpure_getDefaultConfig( &$htmlp_version, $pObject=null ){ $config->set( 'CSS.AllowTricky', true ); $css = $config->getCSSDefinition(); - $css->info['position'] = new \HTMLPurifier_AttrDef_CSS_Composite([ new \HTMLPurifier_AttrDef_Enum(['absolute', 'fixed', 'relative', 'static', 'inherit'] ) ] ); - $css->info['top'] = new \HTMLPurifier_AttrDef_CSS_Composite([ new \HTMLPurifier_AttrDef_CSS_Length() ] ); - $css->info['left'] = new \HTMLPurifier_AttrDef_CSS_Composite([ new \HTMLPurifier_AttrDef_CSS_Length() ] ); - $css->info['bottom'] = new \HTMLPurifier_AttrDef_CSS_Composite([ new \HTMLPurifier_AttrDef_CSS_Length() ] ); - $css->info['right'] = new \HTMLPurifier_AttrDef_CSS_Composite([ new \HTMLPurifier_AttrDef_CSS_Length() ] ); + $css->info['position'] = new \HTMLPurifier_AttrDef_CSS_Composite([ new \HTMLPurifier_AttrDef_Enum(['absolute', 'fixed', 'relative', 'static', 'inherit'] ) ] ); + $css->info['top'] = new \HTMLPurifier_AttrDef_CSS_Composite([ new \HTMLPurifier_AttrDef_CSS_Length() ] ); + $css->info['left'] = new \HTMLPurifier_AttrDef_CSS_Composite([ new \HTMLPurifier_AttrDef_CSS_Length() ] ); + $css->info['bottom'] = new \HTMLPurifier_AttrDef_CSS_Composite([ new \HTMLPurifier_AttrDef_CSS_Length() ] ); + $css->info['right'] = new \HTMLPurifier_AttrDef_CSS_Composite([ new \HTMLPurifier_AttrDef_CSS_Length() ] ); //$def =& $config->getHTMLDefinition(); //$def->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top'); } else { @@ -277,7 +274,7 @@ function htmlpure_legacyAddFilters(){ function htmlpure_cleanupPeeTags( $pee ) { // Convert us some form feeds for better cross platform support - $pee = str_replace(array("\r\n", "\r"), "\n", $pee); + $pee = str_replace(["\r\n", "\r"], "\n", $pee); // Strip out lots of duplicate newlines now $pee = preg_replace("#\n\n+#", "\n\n", $pee); @@ -292,7 +289,7 @@ function htmlpure_cleanupPeeTags( $pee ) { $pee = preg_replace('#(<pre.*?(?:[^>]*)>)(.*?)</pre>#si', " '$1' . preg_replace('#<br[\s/]*(?:[^>]*)/>#', '"."\n"."', preg_replace('#<p[\s]*(?:[^>]*)>#', '"."\n"."', - preg_replace('#</p[\s]*(?:[^>]*)>#', '', '$2'))). '</pre>'", $pee); + preg_replace('#</p[\s]*(?:[^>]*)>#', '', '$2'))). '</pre>'", $pee, ); // Fixup align divs so we can keep them. $pee = preg_replace('#<div(.*?)align="(.*?)"(.*?)>#', '<div$1style="text-align:$2;"$3>', $pee); diff --git a/plugins/filter.maketoc.php b/plugins/filter.maketoc.php index 7daa56e..04b3467 100755 --- a/plugins/filter.maketoc.php +++ b/plugins/filter.maketoc.php @@ -1,5 +1,6 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; use function in_array; @@ -53,8 +54,8 @@ function maketoc_postparsefilter( &$pData, &$pFilterHash ) { // get all headers into an array preg_match_all( "/<h(\d)[^>]*>(.*?)<\/h\d>/i", $pData, $headers ); - // clumsy way of finding out if index is set. since we can't allow - // duplicate settings of index in one page, we either index everything + // clumsy way of finding out if index is set. since we can't allow + // duplicate settings of index in one page, we either index everything // or nothing. foreach( $params as $p ) { if( empty( $index )) { @@ -125,7 +126,7 @@ function maketoc_postparsefilter( &$pData, &$pFilterHash ) { } } - $pData = isset( $ret ) ? $ret : preg_replace( "/\{maketoc[^\}]*\}\s*(<br[^>]*>)*/i", "", $pData ); + $pData = $ret ?? preg_replace( "/\{maketoc[^\}]*\}\s*(<br[^>]*>)*/i", "", $pData ); } function maketoc_create_list( $pTocHash, $pParams ) { diff --git a/plugins/filter.simplepurifier.php b/plugins/filter.simplepurifier.php index ba829b3..313a956 100755 --- a/plugins/filter.simplepurifier.php +++ b/plugins/filter.simplepurifier.php @@ -17,7 +17,7 @@ global $gLibertySystem; // Set of default acceptable HTML tags define( 'DEFAULT_ACCEPTABLE_TAGS', '<a><br><blockquote><cite><code><div><dd><dl><dt><em><h1><h2><h3><h4><hr>' .'<it><img><li><ol><p><pre><span><strong><table><tbody><div><tr><td><th><u><ul>' - .'<button><fieldset><form><label><input><option><select><textarea>' ); + .'<button><fieldset><form><label><input><option><select><textarea>', ); $pluginParams = [ // plugin title diff --git a/plugins/filter.stylepurifier.php b/plugins/filter.stylepurifier.php index be54698..3385c39 100755 --- a/plugins/filter.stylepurifier.php +++ b/plugins/filter.stylepurifier.php @@ -41,10 +41,10 @@ function stylepure_filter( &$pData, &$pFilterHash ) { // strip_tags has doesn't recognize that css within the style tags are not document text. To fix this do something similar to the following: if( !$gBitUser->hasPermission( 'p_liberty_edit_html_style' )) { $pattern = [ - "!<style[^>]*>.*</style>!siU", // <style>...</style> - '![\s\n]*(style|class)\s*=\s*"[^">]*"?!i', // style="..." | class="..." - "![\s\n]*(style|class)\s*=\s*'[^'>]*'?!i", // style='...' | class='...' - "![\s\n]*(style|class)\s*=\s*[^\s>]*!i", // style=... | class=... + "!<style[^>]*>.*</style>!siU", // <style>...</style> + '![\s\n]*(style|class)\s*=\s*"[^">]*"?!i', // style="..." | class="..." + "![\s\n]*(style|class)\s*=\s*'[^'>]*'?!i", // style='...' | class='...' + "![\s\n]*(style|class)\s*=\s*[^\s>]*!i", // style=... | class=... ]; $pData = preg_replace( $pattern, '', $pData ); } diff --git a/plugins/filter.urlcache.php b/plugins/filter.urlcache.php index 9398cde..f0a4432 100755 --- a/plugins/filter.urlcache.php +++ b/plugins/filter.urlcache.php @@ -1,5 +1,6 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; /** @@ -28,7 +29,6 @@ use Bitweaver\KernelTools; * best to move all this stuff to a separate package - xing */ - /** * definitions ( guid character limit is 16 chars ) */ @@ -113,9 +113,9 @@ function urlcache_store($url, $data = '') { $query = "insert into `".BIT_DB_PREFIX."liberty_link_cache`(`url`,`data`,`refresh`) values(?,?,?)"; $result = $this->mDb->query($query, [ $url,BitDb::db_byte_encode($data),$refresh ] ); return !isset( $error ); - } else { - return false; } + return false; + } function urlcache_postparsefilter( $pData, $pFilterHash ) { @@ -146,7 +146,7 @@ function list_cache($offset, $max_records, $sort_mode, $find) { $findesc = '%' . $find . '%'; $mid = " where (`url` like ?) "; - $bindvars=array($findesc); + $bindvars=[$findesc]; } else { $mid = ""; $bindvars=[]; diff --git a/plugins/format.bbcode.php b/plugins/format.bbcode.php index e6ca2e3..8b8caf4 100755 --- a/plugins/format.bbcode.php +++ b/plugins/format.bbcode.php @@ -10,7 +10,7 @@ global $gLibertySystem; /** * run 'pear install Text_Wiki_BBCode-alpha' to install the library, - */ + */ if( @include_once 'doc/Text_Wiki_BBCode/doc/BBCodeParser.php' ) { /** @@ -26,7 +26,7 @@ $pluginParams = [ 'edit_field' => PLUGIN_GUID_BBCODE, 'help_page' => 'BBCodeSyntax', 'plugin_type' => FORMAT_PLUGIN, - 'linebreak' => "\r\n" + 'linebreak' => "\r\n", ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_BBCODE, $pluginParams ); @@ -40,7 +40,7 @@ function bbcode_parse_data( &$pParseHash, &$pCommonObject ) { $data = preg_replace( '/\[(quote|code):[0-9a-f]+=/', '[\1=', $data ); $data = preg_replace( '/:[0-9a-f]+\]/', ']', $data ); - // get options from the ini file + // get options from the ini file // $config = parse_ini_file('BBCodeParser.ini', true); $config = parse_ini_file('doc/Text_Wiki_BBCode/doc/BBCodeParser_V2.ini', true); $options = \PEAR::getStaticProperty('HTML_BBCodeParser', '_options'); diff --git a/plugins/format.bithtml.php b/plugins/format.bithtml.php index 3f1805a..fd11c25 100755 --- a/plugins/format.bithtml.php +++ b/plugins/format.bithtml.php @@ -22,7 +22,7 @@ $pluginParams = [ 'edit_field' => PLUGIN_GUID_BITHTML, 'help_page' => 'HTMLSyntax', 'plugin_type' => FORMAT_PLUGIN, - 'linebreak' => '<br />' + 'linebreak' => '<br />', ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_BITHTML, $pluginParams ); diff --git a/plugins/format.markdown.php b/plugins/format.markdown.php index 9bb5d30..c9e7a6b 100755 --- a/plugins/format.markdown.php +++ b/plugins/format.markdown.php @@ -25,7 +25,7 @@ $pluginParams = [ 'edit_label' => 'Markdown', 'edit_field' => PLUGIN_GUID_MARKDOWN, 'plugin_type' => FORMAT_PLUGIN, - 'linebreak' => "\r\n" + 'linebreak' => "\r\n", ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_MARKDOWN, $pluginParams ); diff --git a/plugins/format.simpletext.php b/plugins/format.simpletext.php index edfc7ea..ed046fc 100755 --- a/plugins/format.simpletext.php +++ b/plugins/format.simpletext.php @@ -22,7 +22,7 @@ $pluginParams = [ 'edit_field' => PLUGIN_GUID_SIMPLETEXT, 'help_page' => 'SimpleTextSyntax', 'plugin_type' => FORMAT_PLUGIN, - 'linebreak' => '<br />' + 'linebreak' => '<br />', ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_SIMPLETEXT, $pluginParams ); diff --git a/plugins/format.tikiwiki.php b/plugins/format.tikiwiki.php index c5ad92a..4455006 100755 --- a/plugins/format.tikiwiki.php +++ b/plugins/format.tikiwiki.php @@ -1,6 +1,7 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\BitBase; use Bitweaver\KernelTools; use Bitweaver\BitSystem; @@ -27,7 +28,7 @@ $pluginParams = [ 'edit_field' => PLUGIN_GUID_TIKIWIKI, 'help_page' => 'TikiWikiSyntax', 'plugin_type' => FORMAT_PLUGIN, - 'linebreak' => "\r\n" + 'linebreak' => "\r\n", ]; $gLibertySystem->registerPlugin( PLUGIN_GUID_TIKIWIKI, $pluginParams ); @@ -223,7 +224,6 @@ class TikiWikiParser extends BitBase { $gLibertySystem->getContentClassName( 'bitpage' ); } - // only strip out html if needed if( $gBitSystem->isFeatureActive( 'content_allow_html' ) || $gBitSystem->isFeatureActive( 'content_force_allow_html' )) { // we allow html unconditionally with this parser @@ -339,7 +339,7 @@ class TikiWikiParser extends BitBase { $attributes = strstr( $link, $_SERVER["SERVER_NAME"] ) || !strstr( $link, '//' ) ? '' : 'class="external"'; // comments and anonymously created pages get nofollow - if( is_object( $pCommonObject ) && ( get_class( $pCommonObject ) == 'comments' || ( isset( $pCommonObject->mInfo['user_id'] ) && $pCommonObject->mInfo['user_id'] == ANONYMOUS_USER_ID ))) { + if( is_object( $pCommonObject ) && ( $pCommonObject::class == 'comments' || ( isset( $pCommonObject->mInfo['user_id'] ) && $pCommonObject->mInfo['user_id'] == ANONYMOUS_USER_ID ))) { $attributes .= ' rel="nofollow" '; } @@ -546,7 +546,7 @@ class TikiWikiParser extends BitBase { $listate = substr($line, $listlevel, 1); if (($listate == '+' || $listate == '-') && !($litype == '*' && !strstr(current($listbeg), '</ul>') || $litype == '#' && !strstr(current($listbeg), '</ol>'))) { - $thisid = 'id' . intval( microtime(true) * 1000000 ); + $thisid = 'id' . (int) ( microtime(true) * 1000000 ); $data .= '<br /><a id="flipper' . $thisid . '" href="javascript:BitBase.flipWithSign(\'' . $thisid . '\',1)">[' . ($listate == '-' ? '+' : '-') . ']</a>'; $listyle = ' id="' . $thisid . '" style="display:' . ($listate == '+' ? 'block' : 'none') . ';"'; $addremove = 1; diff --git a/plugins/mime.application.php b/plugins/mime.application.php index 087a32b..ade2c03 100755 --- a/plugins/mime.application.php +++ b/plugins/mime.application.php @@ -18,7 +18,6 @@ namespace Bitweaver\Liberty; * where plugins can insert their own tables<br> **/ - /** * setup */ @@ -55,9 +54,9 @@ $pluginParams = [ // Here you can use a perl regular expression to pick out file extensions you want to handle // e.g.: Some image types: '#^image/(jpe?g|gif|png)#i' // This plugin will be picked if nothing matches. - 'mimetypes' => array( + 'mimetypes' => [ '#application/.*#i', - ), + ], ]; $gLibertySystem->registerPlugin( PLUGIN_MIME_GUID_APPLICATION, $pluginParams ); diff --git a/plugins/mime.audio.php b/plugins/mime.audio.php index a274e8a..6ba7908 100755 --- a/plugins/mime.audio.php +++ b/plugins/mime.audio.php @@ -1,6 +1,7 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\BitBase; use Bitweaver\KernelTools; diff --git a/plugins/mime.default.php b/plugins/mime.default.php index 3d3dbad..0de1fa5 100755 --- a/plugins/mime.default.php +++ b/plugins/mime.default.php @@ -15,11 +15,11 @@ * where plugins can insert their own tables<br> **/ - /** * setup */ namespace Bitweaver\Liberty; + use Bitweaver\BitBase; use Bitweaver\KernelTools; @@ -105,7 +105,7 @@ if( !function_exists( '\Bitweaver\Liberty\mime_default_verify' )) { $pStoreRow['attachment_id'] = $gBitSystem->mDb->GenID( 'liberty_attachments_id_seq' ); } // try to generate thumbnails for the upload - $pStoreRow['upload']['thumbnail'] = isset( $pStoreRow['upload']['thumbnail'] ) ? $pStoreRow['upload']['thumbnail'] : true; + $pStoreRow['upload']['thumbnail'] = $pStoreRow['upload']['thumbnail'] ?? true; // Generic values needed by the storing mechanism $pStoreRow['upload']['source_file'] = $pStoreRow['upload']['tmp_name']; @@ -184,7 +184,7 @@ if( !function_exists( '\Bitweaver\Liberty\mime_default_update' )) { $gBitSystem->mDb->associateUpdate( BIT_DB_PREFIX."liberty_attachments", [ 'attachment_plugin_guid' => $pStoreRow['attachment_plugin_guid'] ], - [ 'attachment_id' => $pStoreRow['attachment_id'] ] + [ 'attachment_id' => $pStoreRow['attachment_id'] ], ); } } diff --git a/plugins/mime.image.php b/plugins/mime.image.php index 65f2ef0..b0abb45 100755 --- a/plugins/mime.image.php +++ b/plugins/mime.image.php @@ -1,6 +1,7 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\BitBase; use Bitweaver\KernelTools; use Holiday\Metadata; @@ -199,11 +200,11 @@ function mime_image_store_exif_data( $pFileHash ) { if( BitBase::verifyId( $pFileHash['attachment_id'] ) && $exifHash = mime_image_get_exif_data( $upload ) ) { // only makes sense to store the GPS data if we at least have latitude and longitude if( !empty( $exifHash['GPS'] )) { - LibertyMime::storeMetaData( $pFileHash['attachment_id'], $exifHash['GPS'], 'GPS' ); + LibertyMime::storeMetaData( $pFileHash['attachment_id'], $exifHash['GPS'], 'GPS' ); } if( !empty( $exifHash['EXIF'] )) { - LibertyMime::storeMetaData( $pFileHash['attachment_id'], $exifHash['EXIF'], 'EXIF' ); + LibertyMime::storeMetaData( $pFileHash['attachment_id'], $exifHash['EXIF'], 'EXIF' ); } } diff --git a/plugins/mime.pbase.php b/plugins/mime.pbase.php index 8b75b8e..388d25c 100755 --- a/plugins/mime.pbase.php +++ b/plugins/mime.pbase.php @@ -1,6 +1,7 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\BitBase; /** diff --git a/plugins/mime.pdf.php b/plugins/mime.pdf.php index b5cfee3..567f7cf 100644 --- a/plugins/mime.pdf.php +++ b/plugins/mime.pdf.php @@ -1,8 +1,8 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\BitBase; -use Bitweaver\KernelTools; /** * @version $Header$ @@ -224,7 +224,7 @@ function mime_pdf_thumbnail( $pFileHash ) { if( liberty_generate_thumbnails( $genHash )) { } $mask = "$dest_branch/thumb*.jpg"; - array_map( "unlink", glob( $mask ) ); + array_map( "unlink", glob( $mask ) ); } return empty( $pFileHash['log'] ); } diff --git a/plugins/mime.video.php b/plugins/mime.video.php index 28bbe01..cff98e8 100755 --- a/plugins/mime.video.php +++ b/plugins/mime.video.php @@ -1,9 +1,9 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\BitBase; use Bitweaver\BitDate; -use Bitweaver\KernelTools; /** * @version $Header$ @@ -193,7 +193,7 @@ function mime_video_add_process( $pStoreRow ) { UPDATE `".BIT_DB_PREFIX."liberty_process_queue` SET `process_status`=? WHERE `content_id`=? AND `process_status`=?"; - $gBitSystem->mDb->query( $query, array( 'defunkt', $pStoreRow['content_id'], 'pending' )); + $gBitSystem->mDb->query( $query, [ 'defunkt', $pStoreRow['content_id'], 'pending' ]); $storeHash = [ 'content_id' => $pStoreRow['content_id'], @@ -266,7 +266,7 @@ function mime_video_converter( &$pParamHash, $pOnlyGetParameters = false ) { ]; // make sure audio sample rate is valid - if( !empty( $info['audio_samplerate'] ) && !in_array( $info['audio_samplerate'], array( 11025, 22050, 44100 ))) { + if( !empty( $info['audio_samplerate'] ) && !in_array( $info['audio_samplerate'], [ 11025, 22050, 44100 ])) { unset( $info['audio_samplerate'] ); } } else { @@ -430,7 +430,7 @@ function mime_video_converter( &$pParamHash, $pOnlyGetParameters = false ) { if( $pOnlyGetParameters ) { return $parameters; - } else { + } // we keep the output of this that we can store it to the error file if we need to do so $debug = shell_exec( "$ffmpeg $parameters 2>&1" ); if( !empty( $parameters2 )) { @@ -438,7 +438,6 @@ function mime_video_converter( &$pParamHash, $pOnlyGetParameters = false ) { // change back to whence we came chdir( $cwd ); } - } // make sure the conversion was successfull if( is_file( $dest_file ) && filesize( $dest_file ) > 48 ) { diff --git a/plugins/processor.gd.php b/plugins/processor.gd.php index cd6b23a..3c3d7dd 100755 --- a/plugins/processor.gd.php +++ b/plugins/processor.gd.php @@ -1,6 +1,7 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; /** @@ -68,7 +69,6 @@ function liberty_gd_resize_image( &$pFileHash ) { //$imagegallib->ImageCopyResampleBicubic($t, $img, 0, 0, 0, 0, $tw, $ty, $size_x, $size_y); } - // override $mimeExt if we have a custom setting for it if( $gBitSystem->isFeatureActive( 'liberty_thumbnail_format' )) { $mimeExt = $gBitSystem->getConfig( 'liberty_thumbnail_format' ); @@ -194,9 +194,9 @@ function get_gd_version( $pFullVersion = false ) { if( $pFullVersion ) { return $_SESSION['gd_version']; - } else { - return preg_replace( "!^(\d)+.*$!", "$1", $_SESSION['gd_version'] ); } + return preg_replace( "!^(\d)+.*$!", "$1", $_SESSION['gd_version'] ); + } // nicked from http://at2.php.net/manual/en/function.gd-info.php @@ -212,7 +212,7 @@ if( !function_exists( 'gd_info' )) { "JPG Support" => 0, "PNG Support" => 0, "WBMP Support" => 0, - "XBM Support" => 0 + "XBM Support" => 0, ]; $gif_support = 0; diff --git a/plugins/processor.imagick.php b/plugins/processor.imagick.php index 03c53d6..e85c6ff 100755 --- a/plugins/processor.imagick.php +++ b/plugins/processor.imagick.php @@ -1,6 +1,7 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; use Imagick; use ImagickPixel; @@ -42,7 +43,7 @@ function liberty_imagick_resize_image( &$pFileHash ) { $pFileHash['error'] = null; $ret = null; if( !empty( $pFileHash['source_file'] ) && file_exists( $pFileHash['source_file'] ) && is_file( $pFileHash['source_file'] ) && (filesize( $pFileHash['source_file'] ) > 0) ) { - try { + try { $im = new Imagick(); $im->readImage( $pFileHash['source_file'] ); if( !$im->valid()) { diff --git a/plugins/processor.magickwand.php b/plugins/processor.magickwand.php index 64a9556..8ce6e55 100755 --- a/plugins/processor.magickwand.php +++ b/plugins/processor.magickwand.php @@ -1,6 +1,7 @@ <?php namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; /** diff --git a/plugins/storage.bitfile.php b/plugins/storage.bitfile.php index da4018b..5a0a201 100755 --- a/plugins/storage.bitfile.php +++ b/plugins/storage.bitfile.php @@ -6,6 +6,7 @@ */ namespace Bitweaver\Liberty; + use Bitweaver\BitBase; global $gLibertySystem, $gBitSystem, $gBitSmarty, $gBitThemes; @@ -25,7 +26,7 @@ $pluginParams = [ 'edit_label' => 'Upload File', 'primary_edit_field' => '<input type="file" name="primary_attachment" size="40" />', 'edit_field' => '<input type="file" name="upload" size="40" />', - 'edit_help' => 'After selecting the file you want to upload, please return to the edit area and click the save button.' + 'edit_help' => 'After selecting the file you want to upload, please return to the edit area and click the save button.', ]; if( isset( $gBitSystem )) { @@ -53,7 +54,6 @@ if( isset( $gBitSystem )) { //$gLibertySystem->registerPlugin( STORAGE_TYPE_BIT_FILES, $pluginParams ); $gLibertySystem->registerPlugin( PLUGIN_GUID_BIT_FILES, $pluginParams ); - function bit_files_verify( &$pStoreRow ) { $pStoreRow['plugin_guid'] = PLUGIN_GUID_BIT_FILES; $pStoreRow['foreign_id'] = null; @@ -79,7 +79,7 @@ function bit_files_store( &$pStoreRow ) { if( BitBase::verifyId( $pStoreRow['foreign_id'] ) ) { $sql = "UPDATE `".BIT_DB_PREFIX."liberty_files` SET `file_name`=?, `mime_type`=?, `file_size`=? WHERE `file_id` = ?"; - $gBitSystem->mDb->query( $sql, array( $pStoreRow['upload']['name'], $pStoreRow['upload']['type'], $pStoreRow['upload']['size'], $pStoreRow['foreign_id'] ) ); + $gBitSystem->mDb->query( $sql, [ $pStoreRow['upload']['name'], $pStoreRow['upload']['type'], $pStoreRow['upload']['size'], $pStoreRow['foreign_id'] ] ); } else { $pStoreRow['foreign_id'] = $gBitSystem->mDb->GenID( 'liberty_files_id_seq' ); $sql = "INSERT INTO `".BIT_DB_PREFIX."liberty_files` ( `file_name`, `file_id`, `mime_type`, `file_size`, `user_id` ) VALUES ( ?, ?, ?, ?, ? )"; @@ -122,7 +122,7 @@ function bit_files_expunge( $pStorageId ) { $sql = "SELECT * FROM `".BIT_DB_PREFIX."liberty_attachments` la INNER JOIN `".BIT_DB_PREFIX."liberty_files` lf ON (lf.`file_id`=la.`foreign_id`) WHERE la.`attachment_id` = ?"; - if( $row = $gBitSystem->mDb->getRow( $sql, array( $pStorageId ))) { + if( $row = $gBitSystem->mDb->getRow( $sql, [ $pStorageId ])) { $sourceFile = liberty_mime_get_source_file( $row ); if( $gBitUser->isAdmin() || $gBitUser->mUserId == $row['user_id'] ) { if( file_exists( $sourceFile )) { @@ -134,7 +134,7 @@ function bit_files_expunge( $pStorageId ) { } } $query = "DELETE FROM `".BIT_DB_PREFIX."liberty_files` WHERE `file_id` = ?"; - $gBitSystem->mDb->query($query, array($row['foreign_id']) ); + $gBitSystem->mDb->query($query, [$row['foreign_id']] ); $ret = true; } } |
