Make CSS styles configurable #222

Merged
tslocum merged 3 commits from Tortle/tortleib:css-config into master 6 months ago
Tortle commented 6 months ago

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 6 months ago
tslocum reviewed 6 months ago
inc/html.php Outdated
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>';
Poster
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 6 months ago
tslocum left a comment

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

inc/html.php Outdated
EOF;
}
function stylesheets() {
Poster
Owner

Rename to pageStylesheets.

Rename to pageStylesheets.
Tortle marked this conversation as resolved
inc/html.php Outdated
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">';
Poster
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
$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];
Poster
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
continue;
}
$stylesheets[] = '<link rel="alternate stylesheet" type="text/css" href="css/' . $value . '.css" title="' . $display_name . '">';
Poster
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
$stylesheets[] = '<link rel="alternate stylesheet" type="text/css" href="css/' . $value . '.css" title="' . $display_name . '">';
}
return join($stylesheets, '');
Poster
Owner

Use implode.

Use implode.
Tortle marked this conversation as resolved
'YouTube' => 'https://www.youtube.com/oembed?url=TINYIBEMBED&format=json');
// CSS skins
Poster
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
// CSS skins
define('TINYIB_DEFAULTSKIN', 'Futaba');
Poster
Owner

Define via filename instead: 'futaba'.

Define via filename instead: 'futaba'.
Poster
Owner

Rename setting to TINYIB_DEFAULTSTYLE.

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

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

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

Rename variable to $tinyib_stylesheets.

Rename variable to $tinyib_stylesheets.
Tortle marked this conversation as resolved
Tortle added 1 commit 6 months ago
Tortle added 1 commit 6 months ago
Tortle requested review from tslocum 6 months ago
tslocum merged commit 32ae4efbcf into master 6 months ago
tslocum referenced this issue from a commit 6 months ago
Tortle deleted branch css-config 6 months ago

Reviewers

tslocum was requested for review 6 months ago
The pull request has been merged as 32ae4efbcf.
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This pull request currently doesn't have any dependencies.

Loading…
There is no content yet.