Make CSS styles configurable #222

Merged
tslocum merged 3 commits from Tortle/tortleib:css-config into master 2021-06-03 00:07:32 +00:00
Contributor

Enable skins by dropping a CSS file in /css and adding the name to settings.php.

Enable skins by dropping a CSS file in /css and adding the name to settings.php.
Tortle added 1 commit 2021-05-30 03:08:04 +00:00
tslocum reviewed 2021-06-02 06:15:58 +00:00
inc/html.php Outdated
@ -628,0 +650,4 @@
if (count($tinyib_skins) > 1) {
$options = ['<option value="">' . $txt_style . '</option>'];
foreach($tinyib_skins as $display_name => $value) {
$options[] = '<option value="' . $value . '">'. $display_name . '</option>';
Owner

Escape $value with htmlentities($var, ENT_QUOTES) and $displayname with htmlentities($var).

Escape $value with `htmlentities($var, ENT_QUOTES)` and $displayname with `htmlentities($var)`.
Tortle marked this conversation as resolved
tslocum requested changes 2021-06-02 06:32:40 +00:00
tslocum left a comment
Owner

Thanks for submitting this. Please include a default value for existing installations by adding TINYIB_DEFAULTSTYLE to inc/defines.php.

Thanks for submitting this. Please include a default value for existing installations by adding TINYIB_DEFAULTSTYLE to inc/defines.php.
inc/html.php Outdated
@ -43,6 +43,24 @@ function pageHeader() {
EOF;
}
function stylesheets() {
Owner

Rename to pageStylesheets.

Rename to pageStylesheets.
Tortle marked this conversation as resolved
inc/html.php Outdated
@ -46,0 +47,4 @@
global $tinyib_skins;
$global_stylesheet = '<link rel="stylesheet" type="text/css" href="css/global.css">';
$default_stylesheet = '<link rel="stylesheet" type="text/css" href="css/' . $tinyib_skins[TINYIB_DEFAULTSKIN] . '.css" title="' . TINYIB_DEFAULTSKIN . '" id="mainStylesheet">';
Owner

Escape $tinyib_skins[TINYIB_DEFAULTSKIN] with htmlentities($var, ENT_QUOTES).

Escape $tinyib_skins[TINYIB_DEFAULTSKIN] with `htmlentities($var, ENT_QUOTES)`.
Tortle marked this conversation as resolved
@ -46,0 +48,4 @@
$global_stylesheet = '<link rel="stylesheet" type="text/css" href="css/global.css">';
$default_stylesheet = '<link rel="stylesheet" type="text/css" href="css/' . $tinyib_skins[TINYIB_DEFAULTSKIN] . '.css" title="' . TINYIB_DEFAULTSKIN . '" id="mainStylesheet">';
$stylesheets = [$global_stylesheet, $default_stylesheet];
Owner

Create a string $return which is appended to and returned instead of an array.

Create a string `$return` which is appended to and returned instead of an array.
Tortle marked this conversation as resolved
inc/html.php Outdated
@ -46,0 +55,4 @@
continue;
}
$stylesheets[] = '<link rel="alternate stylesheet" type="text/css" href="css/' . $value . '.css" title="' . $display_name . '">';
Owner

Escape $value and $display_name with htmlentities($var, ENT_QUOTES).

Escape $value and $display_name with `htmlentities($var, ENT_QUOTES)`.
Tortle marked this conversation as resolved
@ -46,0 +58,4 @@
$stylesheets[] = '<link rel="alternate stylesheet" type="text/css" href="css/' . $value . '.css" title="' . $display_name . '">';
}
return join($stylesheets, '');
Owner

Use implode.

Use implode.
Tortle marked this conversation as resolved
@ -90,2 +90,4 @@
'YouTube' => 'https://www.youtube.com/oembed?url=TINYIBEMBED&format=json');
// CSS skins
Owner

Replace with the following comment:

// Stylesheets (located in css)
//   Format: File name excluding extension => Title
Replace with the following comment: ``` // Stylesheets (located in css) // Format: File name excluding extension => Title ```
Tortle marked this conversation as resolved
@ -91,1 +91,4 @@
// CSS skins
define('TINYIB_DEFAULTSKIN', 'Futaba');
Owner

Define via filename instead: 'futaba'.

Define via filename instead: 'futaba'.
Owner

Rename setting to TINYIB_DEFAULTSTYLE.

Rename setting to TINYIB_DEFAULTSTYLE.
Tortle marked this conversation as resolved
@ -92,0 +92,4 @@
// CSS skins
define('TINYIB_DEFAULTSKIN', 'Futaba');
$tinyib_skins = array('Futaba' => 'futaba',
Owner

Reverse order: 'futaba' => 'Futaba'.

Reverse order: 'futaba' => 'Futaba'.
Owner

Rename variable to $tinyib_stylesheets.

Rename variable to $tinyib_stylesheets.
Tortle marked this conversation as resolved
Tortle added 1 commit 2021-06-02 21:10:08 +00:00
Tortle added 1 commit 2021-06-02 21:10:24 +00:00
Tortle requested review from tslocum 2021-06-02 21:13:19 +00:00
tslocum merged commit 32ae4efbcf into master 2021-06-03 00:07:32 +00:00
Tortle deleted branch css-config 2021-06-03 00:25:17 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: tslocum/tinyib#222
No description provided.