Merge pull request #21844 from owncloud/drop-image-path

Remove OC_Helper::imagePath and use the proper public interface
This commit is contained in:
Thomas Müller 2016-01-25 10:00:21 +01:00
commit ef4fca22d1
8 changed files with 25 additions and 37 deletions

View File

@ -53,7 +53,7 @@
<span id="selectedActionsList" class="selectedActions"> <span id="selectedActionsList" class="selectedActions">
<a href="" class="download"> <a href="" class="download">
<img class="svg" alt="" <img class="svg" alt=""
src="<?php print_unescaped(OCP\image_path("core", "actions/download.svg")); ?>" /> src="<?php print_unescaped(image_path("core", "actions/download.svg")); ?>" />
<?php p($l->t('Download'))?> <?php p($l->t('Download'))?>
</a> </a>
</span> </span>
@ -67,7 +67,7 @@
<span class="selectedActions"><a href="" class="delete-selected"> <span class="selectedActions"><a href="" class="delete-selected">
<?php p($l->t('Delete'))?> <?php p($l->t('Delete'))?>
<img class="svg" alt="" <img class="svg" alt=""
src="<?php print_unescaped(OCP\image_path("core", "actions/delete.svg")); ?>" /> src="<?php print_unescaped(image_path("core", "actions/delete.svg")); ?>" />
</a></span> </a></span>
</th> </th>
</tr> </tr>

View File

@ -81,7 +81,7 @@ $thumbSize = 1024;
</span> </span>
<?php } ?> <?php } ?>
<a href="<?php p($_['downloadURL']); ?>" id="download" class="button"> <a href="<?php p($_['downloadURL']); ?>" id="download" class="button">
<img class="svg" alt="" src="<?php print_unescaped(OCP\image_path("core", "actions/download.svg")); ?>"/> <img class="svg" alt="" src="<?php print_unescaped(image_path("core", "actions/download.svg")); ?>"/>
<span id="download-text"><?php p($l->t('Download'))?></span> <span id="download-text"><?php p($l->t('Download'))?></span>
</a> </a>
</span> </span>
@ -105,7 +105,7 @@ $thumbSize = 1024;
<?php endif; ?> <?php endif; ?>
<div class="directDownload"> <div class="directDownload">
<a href="<?php p($_['downloadURL']); ?>" id="downloadFile" class="button"> <a href="<?php p($_['downloadURL']); ?>" id="downloadFile" class="button">
<img class="svg" alt="" src="<?php print_unescaped(OCP\image_path("core", "actions/download.svg")); ?>"/> <img class="svg" alt="" src="<?php print_unescaped(image_path("core", "actions/download.svg")); ?>"/>
<?php p($l->t('Download %s', array($_['filename'])))?> (<?php p($_['fileSize']) ?>) <?php p($l->t('Download %s', array($_['filename'])))?> (<?php p($_['fileSize']) ?>)
</a> </a>
</div> </div>

View File

@ -31,7 +31,7 @@
<span id="selectedActionsList" class='selectedActions'> <span id="selectedActionsList" class='selectedActions'>
<a href="" class="undelete"> <a href="" class="undelete">
<img class="svg" alt="" <img class="svg" alt=""
src="<?php print_unescaped(OCP\image_path("core", "actions/history.svg")); ?>" /> src="<?php print_unescaped(image_path("core", "actions/history.svg")); ?>" />
<?php p($l->t('Restore'))?> <?php p($l->t('Restore'))?>
</a> </a>
</span> </span>
@ -43,7 +43,7 @@
<a href="" class="delete-selected"> <a href="" class="delete-selected">
<?php p($l->t('Delete'))?> <?php p($l->t('Delete'))?>
<img class="svg" alt="" <img class="svg" alt=""
src="<?php print_unescaped(OCP\image_path("core", "actions/delete.svg")); ?>" /> src="<?php print_unescaped(image_path("core", "actions/delete.svg")); ?>" />
</a> </a>
</span> </span>
</th> </th>

View File

@ -131,7 +131,7 @@
<li id="apps-management"> <li id="apps-management">
<a href="<?php print_unescaped(\OC::$server->getURLGenerator()->linkToRoute('settings.AppSettings.viewApps')); ?>" tabindex="4" <a href="<?php print_unescaped(\OC::$server->getURLGenerator()->linkToRoute('settings.AppSettings.viewApps')); ?>" tabindex="4"
<?php if( $_['appsmanagement_active'] ): ?> class="active"<?php endif; ?>> <?php if( $_['appsmanagement_active'] ): ?> class="active"<?php endif; ?>>
<img class="app-icon svg" alt="" src="<?php print_unescaped(OC_Helper::imagePath('settings', 'apps.svg')); ?>"> <img class="app-icon svg" alt="" src="<?php print_unescaped(image_path('settings', 'apps.svg')); ?>">
<div class="icon-loading-dark" style="display:none;"></div> <div class="icon-loading-dark" style="display:none;"></div>
<span> <span>
<?php p($l->t('Apps')); ?> <?php p($l->t('Apps')); ?>

View File

@ -371,6 +371,7 @@ class OC_App {
*/ */
public static function getSettingsNavigation() { public static function getSettingsNavigation() {
$l = \OC::$server->getL10N('lib'); $l = \OC::$server->getL10N('lib');
$urlGenerator = \OC::$server->getURLGenerator();
$settings = array(); $settings = array();
// by default, settings only contain the help menu // by default, settings only contain the help menu
@ -381,9 +382,9 @@ class OC_App {
array( array(
"id" => "help", "id" => "help",
"order" => 1000, "order" => 1000,
"href" => \OC::$server->getURLGenerator()->linkToRoute('settings_help'), "href" => $urlGenerator->linkToRoute('settings_help'),
"name" => $l->t("Help"), "name" => $l->t("Help"),
"icon" => OC_Helper::imagePath("settings", "help.svg") "icon" => $urlGenerator->imagePath("settings", "help.svg")
) )
); );
} }
@ -394,9 +395,9 @@ class OC_App {
$settings[] = array( $settings[] = array(
"id" => "personal", "id" => "personal",
"order" => 1, "order" => 1,
"href" => \OC::$server->getURLGenerator()->linkToRoute('settings_personal'), "href" => $urlGenerator->linkToRoute('settings_personal'),
"name" => $l->t("Personal"), "name" => $l->t("Personal"),
"icon" => OC_Helper::imagePath("settings", "personal.svg") "icon" => $urlGenerator->imagePath("settings", "personal.svg")
); );
//SubAdmins are also allowed to access user management //SubAdmins are also allowed to access user management
@ -410,9 +411,9 @@ class OC_App {
$settings[] = array( $settings[] = array(
"id" => "core_users", "id" => "core_users",
"order" => 2, "order" => 2,
"href" => \OC::$server->getURLGenerator()->linkToRoute('settings_users'), "href" => $urlGenerator->linkToRoute('settings_users'),
"name" => $l->t("Users"), "name" => $l->t("Users"),
"icon" => OC_Helper::imagePath("settings", "users.svg") "icon" => $urlGenerator->imagePath("settings", "users.svg")
); );
} }
@ -422,9 +423,9 @@ class OC_App {
$settings[] = array( $settings[] = array(
"id" => "admin", "id" => "admin",
"order" => 1000, "order" => 1000,
"href" => \OC::$server->getURLGenerator()->linkToRoute('settings_admin'), "href" => $urlGenerator->linkToRoute('settings_admin'),
"name" => $l->t("Admin"), "name" => $l->t("Admin"),
"icon" => OC_Helper::imagePath("settings", "admin.svg") "icon" => $urlGenerator->imagePath("settings", "admin.svg")
); );
} }
} }
@ -813,12 +814,12 @@ class OC_App {
$appIcon = self::getAppPath($app) . '/img/' . $app . '.svg'; $appIcon = self::getAppPath($app) . '/img/' . $app . '.svg';
if (file_exists($appIcon)) { if (file_exists($appIcon)) {
$info['preview'] = OC_Helper::imagePath($app, $app . '.svg'); $info['preview'] = \OC::$server->getURLGenerator()->imagePath($app, $app . '.svg');
$info['previewAsIcon'] = true; $info['previewAsIcon'] = true;
} else { } else {
$appIcon = self::getAppPath($app) . '/img/app.svg'; $appIcon = self::getAppPath($app) . '/img/app.svg';
if (file_exists($appIcon)) { if (file_exists($appIcon)) {
$info['preview'] = OC_Helper::imagePath($app, 'app.svg'); $info['preview'] = \OC::$server->getURLGenerator()->imagePath($app, 'app.svg');
$info['previewAsIcon'] = true; $info['previewAsIcon'] = true;
} }
} }

View File

@ -68,19 +68,6 @@ class OC_Helper {
return $url . (($add_slash && $service[strlen($service) - 1] != '/') ? '/' : ''); return $url . (($add_slash && $service[strlen($service) - 1] != '/') ? '/' : '');
} }
/**
* Creates path to an image
* @param string $app app
* @param string $image image name
* @return string the url
* @deprecated Use \OC::$server->getURLGenerator()->imagePath($app, $image)
*
* Returns the path to the image.
*/
public static function imagePath($app, $image) {
return OC::$server->getURLGenerator()->imagePath($app, $image);
}
/** /**
* get path to preview of file * get path to preview of file
* @param string $path path * @param string $path path

View File

@ -138,13 +138,13 @@ function component($app, $file) {
} }
/** /**
* make OC_Helper::linkTo available as a simple function * make \OCP\IURLGenerator::linkTo available as a simple function
* @param string $app app * @param string $app app
* @param string $file file * @param string $file file
* @param array $args array with param=>value, will be appended to the returned url * @param array $args array with param=>value, will be appended to the returned url
* @return string link to the file * @return string link to the file
* *
* For further information have a look at OC_Helper::linkTo * For further information have a look at \OCP\IURLGenerator::linkTo
*/ */
function link_to( $app, $file, $args = array() ) { function link_to( $app, $file, $args = array() ) {
return \OC::$server->getURLGenerator()->linkTo($app, $file, $args); return \OC::$server->getURLGenerator()->linkTo($app, $file, $args);
@ -159,15 +159,15 @@ function link_to_docs($key) {
} }
/** /**
* make OC_Helper::imagePath available as a simple function * make \OCP\IURLGenerator::imagePath available as a simple function
* @param string $app app * @param string $app app
* @param string $image image * @param string $image image
* @return string link to the image * @return string link to the image
* *
* For further information have a look at OC_Helper::imagePath * For further information have a look at \OCP\IURLGenerator::imagePath
*/ */
function image_path( $app, $image ) { function image_path( $app, $image ) {
return OC_Helper::imagePath( $app, $image ); return \OC::$server->getURLGenerator()->imagePath( $app, $image );
} }
/** /**

View File

@ -45,7 +45,7 @@ namespace OCP;
* @param string $image * @param string $image
* @return string to the image * @return string to the image
* *
* @see OC_Helper::imagePath * @see \OCP\IURLGenerator::imagePath
* @deprecated 8.0.0 Use \OCP\Template::image_path() instead * @deprecated 8.0.0 Use \OCP\Template::image_path() instead
*/ */
function image_path( $app, $image ) { function image_path( $app, $image ) {
@ -144,7 +144,7 @@ class Template extends \OC_Template {
/** /**
* Make OC_Helper::imagePath available as a simple function * Make OC_Helper::imagePath available as a simple function
* *
* @see OC_Helper::imagePath * @see \OCP\IURLGenerator::imagePath
* *
* @param string $app * @param string $app
* @param string $image * @param string $image