Skip to content

Commit

Permalink
Get rid of the 2nd argument of include_stylesheet()
Browse files Browse the repository at this point in the history
.. make the optional behavior default now.
  • Loading branch information
alecpl committed Nov 20, 2017
1 parent 1cf72fa commit 9ce8948
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 20 deletions.
2 changes: 1 addition & 1 deletion plugins/acl/acl.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ function folder_form($args)
$this->rc->output->add_label('save', 'cancel');
$this->include_script('acl.js');
$this->rc->output->include_script('list.js');
$this->include_stylesheet($this->local_skin_path() . '/acl.css', true);
$this->include_stylesheet($this->local_skin_path() . '/acl.css');

// add Info fieldset if it doesn't exist
if (!isset($args['form']['props']['fieldsets']['info']))
Expand Down
4 changes: 2 additions & 2 deletions plugins/archive/archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function init()
$archive_folder = $rcmail->config->get('archive_mbox');

if ($rcmail->task == 'mail' && ($rcmail->action == '' || $rcmail->action == 'show') && $archive_folder) {
$this->include_stylesheet($this->local_skin_path() . '/archive.css', true);
$this->include_stylesheet($this->local_skin_path() . '/archive.css');
$this->include_script('archive.js');
$this->add_texts('localization', true);
$this->add_button(
Expand Down Expand Up @@ -59,7 +59,7 @@ function init()
$this->add_hook('preferences_save', array($this, 'save_prefs'));

if ($rcmail->action == 'folders' && $archive_folder) {
$this->include_stylesheet($this->local_skin_path() . '/archive.css', true);
$this->include_stylesheet($this->local_skin_path() . '/archive.css');
$this->include_script('archive.js');
// set env variables for client
$rcmail->output->set_env('archive_folder', $archive_folder);
Expand Down
2 changes: 1 addition & 1 deletion plugins/enigma/lib/enigma_ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function add_css()
}

$skin_path = $this->enigma->local_skin_path();
$this->enigma->include_stylesheet("$skin_path/enigma.css", true);
$this->enigma->include_stylesheet("$skin_path/enigma.css");
$this->css_loaded = true;
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/help/help.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function startup($args)
}

// add style for taskbar button (must be here) and Help UI
$this->include_stylesheet($this->local_skin_path() . '/help.css', true);
$this->include_stylesheet($this->local_skin_path() . '/help.css');
}

function action()
Expand Down
2 changes: 1 addition & 1 deletion plugins/hide_blockquote/hide_blockquote.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function init()
&& ($limit = $rcmail->config->get('hide_blockquote_limit'))
) {
// include styles
$this->include_stylesheet($this->local_skin_path() . "/style.css", true);
$this->include_stylesheet($this->local_skin_path() . "/style.css");

// Script and localization
$this->include_script('hide_blockquote.js');
Expand Down
4 changes: 2 additions & 2 deletions plugins/managesieve/managesieve.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ function init_ui()
// include styles
$skin_path = $this->local_skin_path();
if ($sieve_action || ($this->rc->task == 'settings' && empty($_REQUEST['_framed']))) {
$this->include_stylesheet("$skin_path/managesieve.css", true);
$this->include_stylesheet("$skin_path/managesieve.css");
}
else if ($this->rc->task == 'mail') {
$this->include_stylesheet("$skin_path/managesieve_mail.css", true);
$this->include_stylesheet("$skin_path/managesieve_mail.css");
}

$this->ui_initialized = true;
Expand Down
2 changes: 1 addition & 1 deletion plugins/markasjunk/markasjunk.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function init()
if ($rcmail->action == '' || $rcmail->action == 'show') {
$this->add_texts('localization', true);
$this->include_script('markasjunk.js');
$this->include_stylesheet($this->local_skin_path() . '/markasjunk.css', true);
$this->include_stylesheet($this->local_skin_path() . '/markasjunk.css');

$this->add_button(array(
'type' => 'link',
Expand Down
6 changes: 3 additions & 3 deletions plugins/vcard_attachments/vcard_attachments.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function init()
$btn_class = strpos($skin_path, 'classic') ? 'button' : 'listbutton';

$this->add_texts('localization', true);
$this->include_stylesheet($skin_path . '/style.css', true);
$this->include_stylesheet($skin_path . '/style.css');
$this->include_script('vcardattach.js');
$this->add_button(
array(
Expand All @@ -48,7 +48,7 @@ function init()
}
else if (!$rcmail->output->framed && (!$rcmail->action || $rcmail->action == 'list')) {
$skin_path = $this->local_skin_path();
$this->include_stylesheet($skin_path . '/style.css', true);
$this->include_stylesheet($skin_path . '/style.css');
$this->include_script('vcardattach.js');
}

Expand Down Expand Up @@ -123,7 +123,7 @@ function message_objects($p)

if ($attach_script) {
$this->include_script('vcardattach.js');
$this->include_stylesheet($this->local_skin_path() . '/style.css', true);
$this->include_stylesheet($this->local_skin_path() . '/style.css');
}

return $p;
Expand Down
2 changes: 1 addition & 1 deletion plugins/zipdownload/zipdownload.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function attachment_ziplink($p)
break;
}

$this->include_stylesheet($this->local_skin_path() . '/zipdownload.css', true);
$this->include_stylesheet($this->local_skin_path() . '/zipdownload.css');
}

return $p;
Expand Down
5 changes: 2 additions & 3 deletions program/lib/Roundcube/rcube_plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,9 @@ public function include_script($fn)
/**
* Make this stylesheet available on the client
*
* @param string $fn File path; absolute or relative to the plugin directory
* @param bool $if_exists Include the file only if exists
* @param string $fn File path; absolute or relative to the plugin directory
*/
public function include_stylesheet($fn, $if_exists = false)
public function include_stylesheet($fn)
{
$this->api->include_stylesheet($this->resource_url($fn), $if_exists);
}
Expand Down
7 changes: 3 additions & 4 deletions program/lib/Roundcube/rcube_plugin_api.php
Original file line number Diff line number Diff line change
Expand Up @@ -604,13 +604,12 @@ public function include_script($fn)
/**
* Include a plugin stylesheet in the current HTML page
*
* @param string $fn Path to stylesheet
* @param bool $if_exists Include stylesheet only if the file exists
* @param string $fn Path to stylesheet
*/
public function include_stylesheet($fn, $if_exists = false)
public function include_stylesheet($fn)
{
if (is_object($this->output) && $this->output->type == 'html') {
if ($if_exists && $fn[0] != '/' && !preg_match('|^https?://|i', $fn)) {
if ($fn[0] != '/' && !preg_match('|^https?://|i', $fn)) {
$rcube = rcube::get_instance();
$devel_mode = $rcube->config->get('devel_mode');
$assets_dir = $rcube->config->get('assets_dir');
Expand Down

0 comments on commit 9ce8948

Please sign in to comment.