OC_Helper::linkToRoute is deprecated

Replaced all calls to OC_Helper::linkToRoute with
OC::$server->getURLGenerator()->linkToRoute
This commit is contained in:
Roeland Jago Douma 2015-12-17 08:19:06 +01:00 committed by Lukas Reschke
parent 792b270f22
commit 9fe3d2f1f8
6 changed files with 12 additions and 12 deletions

View File

@ -380,7 +380,7 @@ class OC_App {
array( array(
"id" => "help", "id" => "help",
"order" => 1000, "order" => 1000,
"href" => OC_Helper::linkToRoute("settings_help"), "href" => \OC::$server->getURLGenerator()->linkToRoute('settings_help'),
"name" => $l->t("Help"), "name" => $l->t("Help"),
"icon" => OC_Helper::imagePath("settings", "help.svg") "icon" => OC_Helper::imagePath("settings", "help.svg")
) )
@ -393,7 +393,7 @@ class OC_App {
$settings[] = array( $settings[] = array(
"id" => "personal", "id" => "personal",
"order" => 1, "order" => 1,
"href" => OC_Helper::linkToRoute("settings_personal"), "href" => \OC::$server->getURLGenerator()->linkToRoute('settings_personal'),
"name" => $l->t("Personal"), "name" => $l->t("Personal"),
"icon" => OC_Helper::imagePath("settings", "personal.svg") "icon" => OC_Helper::imagePath("settings", "personal.svg")
); );
@ -409,7 +409,7 @@ class OC_App {
$settings[] = array( $settings[] = array(
"id" => "core_users", "id" => "core_users",
"order" => 2, "order" => 2,
"href" => OC_Helper::linkToRoute("settings_users"), "href" => \OC::$server->getURLGenerator()->linkToRoute('settings_users'),
"name" => $l->t("Users"), "name" => $l->t("Users"),
"icon" => OC_Helper::imagePath("settings", "users.svg") "icon" => OC_Helper::imagePath("settings", "users.svg")
); );
@ -421,7 +421,7 @@ class OC_App {
$settings[] = array( $settings[] = array(
"id" => "admin", "id" => "admin",
"order" => 1000, "order" => 1000,
"href" => OC_Helper::linkToRoute("settings_admin"), "href" => \OC::$server->getURLGenerator()->linkToRoute('settings_admin'),
"name" => $l->t("Admin"), "name" => $l->t("Admin"),
"icon" => OC_Helper::imagePath("settings", "admin.svg") "icon" => OC_Helper::imagePath("settings", "admin.svg")
); );

View File

@ -170,11 +170,11 @@ class OC_Helper {
* Returns the path to the preview of the file. * Returns the path to the preview of the file.
*/ */
public static function previewIcon($path) { public static function previewIcon($path) {
return self::linkToRoute( 'core_ajax_preview', array('x' => 32, 'y' => 32, 'file' => $path )); return \OC::$server->getURLGenerator()->linkToRoute('core_ajax_preview', ['x' => 32, 'y' => 32, 'file' => $path]);
} }
public static function publicPreviewIcon( $path, $token ) { public static function publicPreviewIcon( $path, $token ) {
return self::linkToRoute( 'core_ajax_public_preview', array('x' => 32, 'y' => 32, 'file' => $path, 't' => $token)); return \OC::$server->getURLGenerator()->linkToRoute('core_ajax_public_preview', ['x' => 32, 'y' => 32, 'file' => $path, 't' => $token]);
} }
/** /**

View File

@ -165,14 +165,14 @@ class OC_TemplateLayout extends OC_Template {
$useAssetPipeline = self::isAssetPipelineEnabled(); $useAssetPipeline = self::isAssetPipelineEnabled();
if ($useAssetPipeline) { if ($useAssetPipeline) {
$this->append( 'jsfiles', OC_Helper::linkToRoute('js_config', array('v' => self::$versionHash))); $this->append( 'jsfiles', \OC::$server->getURLGenerator()->linkToRoute('js_config', ['v' => self::$versionHash]));
$this->generateAssets(); $this->generateAssets();
} else { } else {
// Add the js files // Add the js files
$jsFiles = self::findJavascriptFiles(OC_Util::$scripts); $jsFiles = self::findJavascriptFiles(OC_Util::$scripts);
$this->assign('jsfiles', array()); $this->assign('jsfiles', array());
if ($this->config->getSystemValue('installed', false) && $renderAs != 'error') { if ($this->config->getSystemValue('installed', false) && $renderAs != 'error') {
$this->append( 'jsfiles', OC_Helper::linkToRoute('js_config', array('v' => self::$versionHash))); $this->append( 'jsfiles', \OC::$server->getURLGenerator()->linkToRoute('js_config', ['v' => self::$versionHash]));
} }
foreach($jsFiles as $info) { foreach($jsFiles as $info) {
$web = $info[1]; $web = $info[1];

View File

@ -302,7 +302,7 @@ class Util {
* @since 5.0.0 * @since 5.0.0
*/ */
public static function linkToRoute( $route, $parameters = array() ) { public static function linkToRoute( $route, $parameters = array() ) {
return \OC_Helper::linkToRoute($route, $parameters); return \OC::$server->getURLGenerator()->linkToRoute($route, $parameters);
} }
/** /**

View File

@ -43,8 +43,8 @@ if(isset($_GET['mode']) and $_GET['mode'] === 'admin') {
$style2=''; $style2='';
} }
$url1=OC_Helper::linkToRoute( "settings_help" ).'?mode=user'; $url1=\OC::$server->getURLGenerator()->linkToRoute('settings_help').'?mode=user';
$url2=OC_Helper::linkToRoute( "settings_help" ).'?mode=admin'; $url2=\OC::$server->getURLGenerator()->linkToRoute('settings_help').'?mode=admin';
$tmpl = new OC_Template( "settings", "help", "user" ); $tmpl = new OC_Template( "settings", "help", "user" );
$tmpl->assign( "admin", OC_User::isAdminUser(OC_User::getUser())); $tmpl->assign( "admin", OC_User::isAdminUser(OC_User::getUser()));

View File

@ -149,7 +149,7 @@ if($_['passwordChangeSupported']) {
</div> </div>
<?php if ($_['enableAvatars']): ?> <?php if ($_['enableAvatars']): ?>
<form id="avatar" class="section" method="post" action="<?php p(\OC_Helper::linkToRoute('core.avatar.postAvatar')); ?>"> <form id="avatar" class="section" method="post" action="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.avatar.postAvatar')); ?>">
<h2><?php p($l->t('Profile picture')); ?></h2> <h2><?php p($l->t('Profile picture')); ?></h2>
<div id="displayavatar"> <div id="displayavatar">
<div class="avatardiv"></div><br> <div class="avatardiv"></div><br>