Skip to content

Commit

Permalink
Horde::img -> Horde_Themes_Image::tag
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed Feb 5, 2014
1 parent 0f56572 commit 7889544
Show file tree
Hide file tree
Showing 32 changed files with 172 additions and 100 deletions.
2 changes: 1 addition & 1 deletion horde/admin/alarms.php
Expand Up @@ -132,7 +132,7 @@
->add('delete', 1)
->link(array('title' => sprintf(_("Delete \"%s\""), $alarm['title']),
'onclick' => 'return confirm(\'' . addslashes(sprintf(_("Are you sure you want to delete '%s'?"), $alarm['title'])) . '\')'))
. Horde::img('delete.png')
. Horde_Themes_Image::tag('delete.png')
. '</a>';
}
$view->alarms = $alarms;
Expand Down
47 changes: 34 additions & 13 deletions horde/admin/config/index.php
Expand Up @@ -137,9 +137,9 @@ function _uploadFTP($params)
}

/* Set up some icons. */
$success = Horde::img('alerts/success.png');
$warning = Horde::img('alerts/warning.png');
$error = Horde::img('alerts/error.png');
$success = Horde_Themes_Image::tag('alerts/success.png');
$warning = Horde_Themes_Image::tag('alerts/warning.png');
$error = Horde_Themes_Image::tag('alerts/error.png');

$self_url = Horde::url('admin/config/');
$conf_url = Horde::url('admin/config/config.php');
Expand All @@ -148,7 +148,9 @@ function _uploadFTP($params)
$config_outdated = $schema_outdated = false;
if (class_exists('Horde_Bundle')) {
$apps[0] = array(
'icon' => Horde::img($registry->get('icon', 'horde'), Horde_Bundle::FULLNAME, '', ''),
'icon' => Horde_Themes_Image::tag($registry->get('icon', 'horde'), array(
'alt' => Horde_Bundle::FULLNAME
)),
'name' => '<strong>' . Horde_Bundle::FULLNAME . '</strong>',
'sort' => '00',
'version' => '<strong>' . Horde_Bundle::VERSION . '</strong>'
Expand Down Expand Up @@ -190,7 +192,10 @@ function _uploadFTP($params)
} else {
$apps[$i]['name'] = $apps[$i]['sort'];
}
$apps[$i]['icon'] = Horde::img($registry->get('icon', $app), $registry->get('name', $app), '', '');
$apps[$i]['icon'] = Horde_Themes_Image::tag(
$registry->get('icon', $app),
array('alt' => $registry->get('name', $app))
);
$apps[$i]['version'] = '';
if ($version = $registry->getVersion($app, true)) {
$apps[$i]['version'] = $version;
Expand Down Expand Up @@ -376,18 +381,30 @@ function _uploadFTP($params)
if ($session->get('horde', 'config/')) {
$url = Horde::url('admin/config/diff.php');
$action = _("Show differences between currently saved and the newly generated configuration.");
$actions[] = array('icon' => Horde::img('search.png', '', 'align="middle"'),
'link' => Horde::link('#', '', '', '', Horde::popupJs($url, array('height' => 480, 'width' => 640, 'urlencode' => true)) . 'return false;') . $action . '</a>');
$actions[] = array(
'icon' => Horde_Themes_Image::tag('search.png', array(
'attr' => array('align' => 'middle')
)),
'link' => Horde::link('#', '', '', '', Horde::popupJs($url, array('height' => 480, 'width' => 640, 'urlencode' => true)) . 'return false;') . $action . '</a>'
);

/* Action to download the configuration upgrade PHP script. */
$url = Horde::url('admin/config/scripts.php')->add(array('setup' => 'conf', 'type' => 'php'));
$action = _("Download generated configuration as PHP script.");
$actions[] = array('icon' => Horde::img('download.png', '', 'align="middle"'),
'link' => Horde::link($url) . $action . '</a>');
$actions[] = array(
'icon' => Horde_Themes_Image::tag('download.png', array(
'attr' => array('align' => 'middle')
)),
'link' => Horde::link($url) . $action . '</a>'
);
/* Action to save the configuration upgrade PHP script. */
$action = _("Save generated configuration as a PHP script to your server's temporary directory.");
$actions[] = array('icon' => Horde::img('save.png', '', 'align="middle"'),
'link' => Horde::link($url->add('save', 'tmp')) . $action . '</a>');
$actions[] = array(
'icon' => Horde_Themes_Image::tag('save.png', array(
'attr' => array('align' => 'middle')
)),
'link' => Horde::link($url->add('save', 'tmp')) . $action . '</a>'
);

/* Set up the form for FTP upload of scripts. */
$vars = Horde_Variables::getDefaultVariables();
Expand All @@ -414,8 +431,12 @@ function _uploadFTP($params)
/* Action to remove the configuration upgrade PHP script. */
$url = Horde::url('admin/config/scripts.php')->add('clean', 'tmp');
$action = _("Remove saved script from server's temporary directory.");
$actions[] = array('icon' => Horde::img('delete.png', '', 'align="middle"'),
'link' => Horde::link($url) . $action . '</a>');
$actions[] = array(
'icon' => Horde_Themes_Image::tag('delete.png', array(
'attr' => array('align' => 'middle')
)),
'link' => Horde::link($url) . $action . '</a>'
);
}

$view = new Horde_View(array(
Expand Down
6 changes: 4 additions & 2 deletions horde/admin/groups.php
Expand Up @@ -175,9 +175,11 @@
$edit = $group_url->copy()->add('actionID', 'edit');
if (!$groups->readOnly()) {
$add = $group_url->copy()->add('actionID', 'addchild');
$add_img = Horde::img('add_group.png');
$add_img = Horde_Themes_Image::tag('add_group.png');
$delete = $group_url->copy()->add('actionID', 'delete');
$delete_img = Horde::img('delete.png', _("Delete Group"));
$delete_img = Horde_Themes_Image::tag('delete.png', array(
'alt' => _("Delete Group")
));
}

/* Set up the tree. */
Expand Down
2 changes: 1 addition & 1 deletion horde/admin/perms/index.php
Expand Up @@ -26,7 +26,7 @@

$ui = new Horde_Core_Perms_Ui($injector->getInstance('Horde_Perms'), $injector->getInstance('Horde_Core_Perms'));

echo '<h1 class="header">' . Horde::img('perms.png') . ' ' . _("Permissions") . '</h1>';
echo '<h1 class="header">' . Horde_Themes_Image::tag('perms.png') . ' ' . _("Permissions") . '</h1>';
$ui->renderTree($perm_id);

$page_output->footer();
12 changes: 10 additions & 2 deletions horde/docs/CODING_STANDARDS
Expand Up @@ -381,12 +381,20 @@ after all other output.
All images must have an ``alt`` attribute::

<img src="example.gif" alt="<?php echo _("Example") ?>" />
<?php echo Horde::img('example.gif', _("Example")) ?>
<?php
echo Horde_Themes_Image::tag('example.gif', array(
'alt' => _("Example")
));
?>

Input fields of type "image" do not allow the border attribute and may render
with a border on some browsers. Use the following instead::

<a href="" onclick="document.formname.submit(); return false;"><?php echo Horde::img("example.gif", _("Example")) ?></a>
<a href="" onclick="document.formname.submit(); return false;"><?php
echo Horde_Themes_Image::tag("example.gif", array(
'alt' => _("Example")
));
?></a>


Database Conventions
Expand Down
2 changes: 1 addition & 1 deletion horde/lib/Block/Account.php
Expand Up @@ -93,7 +93,7 @@ protected function _content()

if ($status) {
$output .= '<tr><td colspan="2"><p class="notice">' .
Horde::img('alerts/warning.png', _("Warning")) .
Horde_Themes_Image::tag('alerts/warning.png', array('alt' => _("Warning"))) .
'&nbsp;&nbsp;' . $status . '</p></td></tr>';
}

Expand Down
7 changes: 6 additions & 1 deletion horde/lib/Block/Cloud.php
Expand Up @@ -29,7 +29,12 @@ protected function _content()

return Horde::endBuffer()
. '<div>&nbsp;'
. Horde::img('loading.gif', '', array('style' => 'display:none;', 'id' => 'cloudloadingimg'))
. Horde_Themes_Image::tag('loading.gif', array(
'attr' => array(
'id' => 'cloudloadingimg',
'style' => 'display:none;'
)
))
. '</div>' . $cloud->buildHTML()
. '<div id="cloudsearch"></div>';
}
Expand Down
7 changes: 6 additions & 1 deletion horde/lib/Block/FbStream.php
Expand Up @@ -141,7 +141,12 @@ protected function _content()
if (!empty($fbperms[Horde_Service_Facebook_Auth::EXTEND_PERMS_PUBLISHSTREAM])) {
$html .= '<input style="width:98%;margin-top:4px;margin-bottom:4px;" type="text" class="fbinput" id="' . $instance . '_newStatus" name="newStatus" />'
. '<div><a class="horde-default" href="#" id="' . $instance . '_button">' . _("Post") . '</a></div>'
. Horde::img('loading.gif', '', array('id' => $instance. '_loading', 'style' => 'display:none;'));
. Horde_Themes_Image::tag('loading.gif', array(
'attr' => array(
'id' => $instance. '_loading',
'style' => 'display:none;'
)
));
}
} catch (Horde_Service_Facebook_Exception $e) {
$prefs = $GLOBALS['registry']->getServiceLink('prefs');
Expand Down
6 changes: 5 additions & 1 deletion horde/lib/Block/Iframe.php
Expand Up @@ -52,7 +52,11 @@ protected function _title()

return htmlspecialchars($title) .
$url->link(array('target' => '_blank')) .
Horde::img('external.png', '', array('style' => 'vertical-align:middle;padding-left:.3em')) . '</a>';
Horde_Themes_Image::tag('external.png', array(
'attr' => array(
'style' => 'vertical-align:middle;padding-left:.3em'
)
)) . '</a>';
}

/**
Expand Down
34 changes: 16 additions & 18 deletions horde/lib/Block/Moon.php
Expand Up @@ -51,42 +51,40 @@ protected function _content()
$offset++;
}

if (isset($this->_params['phase']) && $this->_params['phase'] == 'next') {
$dates = array_slice(array_keys($phases), $lastNew + 4, 4);
} else {
$dates = array_slice(array_keys($phases), $lastNew, 4);
}
$dates = (isset($this->_params['phase']) && ($this->_params['phase'] == 'next'))
? array_slice(array_keys($phases), $lastNew + 4, 4)
: array_slice(array_keys($phases), $lastNew, 4);

if (isset($this->_params['hemisphere']) && $this->_params['hemisphere'] == 'northern') {
$location = _("Northern Hemisphere");
} else {
$location = _("Southern Hemisphere");
}
$location = (isset($this->_params['hemisphere']) && ($this->_params['hemisphere'] == 'northern'))
? _("Northern Hemisphere")
: _("Southern Hemisphere");

$html = '<table width="100%" height="100%" cellspacing="0">' .
'<tr><td colspan="4" class="control"><strong>' . $location . '</strong></td></tr>' .
'<tr height="100%"><td width="25%" align="center">' .
Horde::img('block/moon/newmoon.png', _("New Moon")) .
Horde_Themes_Image::tag('block/moon/newmoon.png', array('alt' => _("New Moon"))) .
'<br />' . strftime('%d %b', $dates[0]) .
'</td>';

$html .= '<td width="25%" align="center">';
if (isset($this->_params['hemisphere']) && $this->_params['hemisphere'] == 'northern') {
$html .= Horde::img('block/moon/lastquarter.png', _("First Quarter"));
if (isset($this->_params['hemisphere']) &&
($this->_params['hemisphere'] == 'northern')) {
$html .= Horde_Themes_Image::tag('block/moon/lastquarter.png', array('alt' => _("First Quarter")));
} else {
$html .= Horde::img('block/moon/firstquarter.png', _("First Quarter"));
$html .= Horde_Themes_Image::tag('block/moon/firstquarter.png', array('alt' => _("First Quarter")));
}
$html .= '<br />' . strftime('%d %b', $dates[1]) . '</td>';

$html .= '<td width="25%" align="center">' .
Horde::img('block/moon/fullmoon.png', _("Full Moon")) .
Horde_Themes_Image::tag('block/moon/fullmoon.png', array('alt' => _("Full Moon"))) .
'<br />' . strftime('%d %b', $dates[2]) . '</td>';

$html .= '<td width="25%" align="center">';
if (isset($this->_params['hemisphere']) && $this->_params['hemisphere'] == 'northern') {
$html .= Horde::img('block/moon/firstquarter.png', _("Last Quarter"));
if (isset($this->_params['hemisphere']) &&
($this->_params['hemisphere'] == 'northern')) {
$html .= Horde_Themes_Image::tag('block/moon/firstquarter.png', array('alt' => _("Last Quarter")));
} else {
$html .= Horde::img('block/moon/lastquarter.png', _("Last Quarter"));
$html .= Horde_Themes_Image::tag('block/moon/lastquarter.png', array('alt' => _("Last Quarter")));
}
$html .= '<br />' . strftime('%d %b', $dates[3]) . '</td></tr></table>';

Expand Down
4 changes: 2 additions & 2 deletions horde/lib/Block/Sunrise.php
Expand Up @@ -67,10 +67,10 @@ protected function _content()
return '<table width="100%" height="100%" cellspacing="0"><tr>' .
'<td colspan="2" class="control"><strong>' . $location . '</strong></td></tr><tr height="100%">' .
'<td width="50%" align="center">' .
Horde::img('block/sunrise/sunrise.png', _("Sun Rise")) .
Horde_Themes_Image::tag('block/sunrise/sunrise.png', array('alt' => _("Sun Rise"))) .
'<br />' . $rise . '</td>' .
'<td width="50%" align="center">' .
Horde::img('block/sunrise/sunset.png', _("Sun Set")) .
Horde_Themes_Image::tag('block/sunrise/sunset.png', array('alt' => _("Sun Set"))) .
'<br />' . $set . '</td>' . '</tr></table>';
}

Expand Down
7 changes: 6 additions & 1 deletion horde/lib/Block/TwitterTimeline.php
Expand Up @@ -145,7 +145,12 @@ protected function _content()
$view->addHelper('Tag');
$view->instance = $instance;
$view->defaultText = $defaultText;
$view->loadingImg = Horde::img('loading.gif', '', array('id' => $instance . '_loading', 'style' => 'display:none;'));
$view->loadingImg = Horde_Themes_Image::tag('loading.gif', array(
'attr' => array(
'id' => $instance . '_loading',
'style' => 'display:none;'
)
));
$view->latestStatus = !empty($this->_profile->status) ? htmlspecialchars($this->_profile->status->text) : '';
$view->latestDate = !empty($this->_profile->status) ? Horde_Date_Utils::relativeDateTime(strtotime($this->_profile->status->created_at), $GLOBALS['prefs']->getValue('date_format'), ($GLOBALS['prefs']->getValue('twentyFour') ? "%H:%M" : "%I:%M %P")) : '';
$view->bodyHeight = empty($this->_params['height']) ? 350 : $this->_params['height'];
Expand Down
5 changes: 4 additions & 1 deletion horde/lib/Block/Vatid.php
Expand Up @@ -41,7 +41,10 @@ protected function _content()
'<br /><input type="text" length="14" name="vatid" />' .
'<br /><input type="submit" id="vatbutton" value="' . _("Check") .
'" class="horde-default" /> ' .
Horde::img('loading.gif', _("Checking"), array('style' => 'display:none')) .
Horde_Themes_Image::tag('loading.gif', array(
'alt' => _("Checking"),
'attr' => array('style' => 'display:none')
)) .
'<div class="vatidResults"></div>' .
'</form>';
}
Expand Down
12 changes: 6 additions & 6 deletions horde/lib/Block/Weather.php
Expand Up @@ -126,7 +126,7 @@ protected function _content()

$html = '<div class="horde-content"><input id="location' . $instance . '" name="location' . $instance . '"> <input type="button" id="button' . $instance . '" class="horde-default" value="'
. _("Change Location") . '" /><span style="display:none;" id="location' . $instance . '_loading_img">'
. Horde::img('loading.gif') . '</span></div>';
. Horde_Themes_Image::tag('loading.gif') . '</span></div>';
$location = $this->_params['location'];
}

Expand Down Expand Up @@ -172,10 +172,10 @@ protected function _content()
// Sunrise/sunset.
if ($station->sunrise) {
$html .= '<strong>' . _("Sunrise") . ': </strong>'
. Horde::img('block/sunrise/sunrise.png', _("Sunrise"))
. Horde_Themes_Image::tag('block/sunrise/sunrise.png', array('alt' => _("Sunrise")))
. sprintf("%s %s", $station->sunrise->strftime($GLOBALS['prefs']->getValue('date_format')), $station->sunrise->strftime($GLOBALS['prefs']->getValue('time_format')));
$html .= ' <strong>' . _("Sunset") . ': </strong>'
. Horde::img('block/sunrise/sunset.png', _("Sunset"))
. Horde_Themes_Image::tag('block/sunrise/sunset.png', array('alt' => _("Sunset")))
. sprintf("%s %s", $station->sunset->strftime($GLOBALS['prefs']->getValue('date_format')), $station->sunset->strftime($GLOBALS['prefs']->getValue('time_format')));
$html .= '<br />';
}
Expand Down Expand Up @@ -236,7 +236,7 @@ protected function _content()
// Current condition.
$condition = $current->condition;
$html .= '<br /><strong>' . _("Current condition") . ': </strong>'
. Horde::img(Horde_Themes::img('weather/32x32/' . $current->icon))
. Horde_Themes_Image::tag('weather/32x32/' . $current->icon)
. ' ' . $condition
. '</div>';

Expand Down Expand Up @@ -307,7 +307,7 @@ protected function _content()

// Condition.
$html .= '<td>'
. Horde::img(Horde_Themes::img('weather/32x32/' . $day->icon))
. Horde_Themes_Image::tag('weather/32x32/' . $day->icon)
. '<br />' . $condition . '</td>';

if (isset($this->_params['detailedForecast'])) {
Expand Down Expand Up @@ -349,7 +349,7 @@ protected function _content()
. Horde::link(
Horde::externalUrl($weather->link),
$weather->title, '', '_blank', '', $weather->title)
. Horde::img(new Horde_Themes_Image($weather->logo))
. Horde_Themes_Image::tag($weather->logo)
. '</a></div>';
} else {
$html .= '<div class="rightAlign">'
Expand Down
8 changes: 5 additions & 3 deletions horde/services/obrowser/index.php
Expand Up @@ -42,11 +42,13 @@

// Set the icon.
if (!empty($values['icon'])) {
$row['icon'] = Horde::img($values['icon'], $values['name'], '', '');
$row['icon'] = Horde_Themes_Image::tag($values['icon'], array(
'alt' => $values['name']
));
} elseif (!empty($values['browseable'])) {
$row['icon'] = Horde::img('tree/folder.png');
$row['icon'] = Horde_Themes_Image::tag('tree/folder.png');
} else {
$row['icon'] = Horde::img('tree/leaf.png');
$row['icon'] = Horde_Themes_Image::tag('tree/leaf.png');
}

// Set the name/link.
Expand Down
2 changes: 1 addition & 1 deletion horde/services/portal/cloud_search.php
Expand Up @@ -41,7 +41,7 @@

foreach ($results as $result) {
echo '<li class="linedRow"><span style="width:50%"> ' .
(empty($result['icon']) ? Horde::img(Horde_Themes::img($result['app'] . '.png', $result['app'])) : '') .
(empty($result['icon']) ? Horde_Themes_Image::tag($result['app'] . '.png', array('alt' => $result['app'])) : '') .
Horde::link($result['view_url'], '', '', '', '', '', '', array('style' => 'margin:4px')) .
(empty($result['icon']) ? $result['title'] : '<img src="' . $result['icon'] . '" />') .
'</a></span><span style="width:50%;font-style:italic;">' . $result['desc'] . '</span></li>';
Expand Down
2 changes: 1 addition & 1 deletion horde/templates/admin/groups/add.inc
Expand Up @@ -3,7 +3,7 @@
<?php Horde_Util::pformInput() ?>

<h1 class="header">
<?php echo Horde::img('group.png') ?>&nbsp;<?php echo _("Add a group") ?>
<?php echo Horde_Themes_Image::tag('group.png') ?>&nbsp;<?php echo _("Add a group") ?>
</h1>

<p class="horde-content">
Expand Down
2 changes: 1 addition & 1 deletion horde/templates/admin/groups/delete.inc
Expand Up @@ -4,7 +4,7 @@
<?php Horde_Util::pformInput() ?>

<h1 class="header">
<?php echo Horde::img('group.png') ?>&nbsp;<?php printf(_("Are you sure you wish to delete \"%s\"?"), htmlspecialchars($group)) ?>
<?php echo Horde_Themes_Image::tag('group.png') ?>&nbsp;<?php printf(_("Are you sure you wish to delete \"%s\"?"), htmlspecialchars($group)) ?>
</h1>

<p class="horde-form-buttons">
Expand Down

0 comments on commit 7889544

Please sign in to comment.