2013-06-12 09:15:08 -04:00
< ? php
2013-06-12 10:33:09 -04:00
/**
* Default strings and values which differ between the enterprise and the
* community edition . Use the get methods to always get the right strings .
*/
2013-07-03 08:21:51 -04:00
2013-06-27 10:24:03 -04:00
if ( file_exists ( OC :: $SERVERROOT . '/themes/' . OC_Util :: getTheme () . '/defaults.php' )) {
require_once 'themes/' . OC_Util :: getTheme () . '/defaults.php' ;
}
2013-06-12 09:15:08 -04:00
class OC_Defaults {
2013-07-03 08:21:51 -04:00
private $theme ;
2013-08-30 07:53:49 -04:00
private $l ;
2013-07-03 08:21:51 -04:00
private $defaultEntity ;
private $defaultName ;
2013-07-11 10:38:07 -04:00
private $defaultTitle ;
2013-07-03 08:21:51 -04:00
private $defaultBaseUrl ;
private $defaultSyncClientUrl ;
private $defaultDocBaseUrl ;
private $defaultSlogan ;
private $defaultLogoClaim ;
2013-07-03 06:38:20 -04:00
2013-07-03 08:21:51 -04:00
function __construct () {
2013-08-30 07:53:49 -04:00
$this -> l = OC_L10N :: get ( 'core' );
2013-07-03 06:38:20 -04:00
2013-07-11 10:38:07 -04:00
$this -> defaultEntity = " ownCloud " ; /* e.g. company name, used for footers and copyright notices */
$this -> defaultName = " ownCloud " ; /* short name, used when referring to the software */
$this -> defaultTitle = " ownCloud " ; /* can be a longer name, for titles */
2013-07-03 08:21:51 -04:00
$this -> defaultBaseUrl = " http://owncloud.org " ;
$this -> defaultSyncClientUrl = " http://owncloud.org/sync-clients/ " ;
$this -> defaultDocBaseUrl = " http://doc.owncloud.org " ;
2013-08-30 07:53:49 -04:00
$this -> defaultSlogan = $this -> l -> t ( " web services under your control " );
2013-07-03 08:21:51 -04:00
$this -> defaultLogoClaim = " " ;
2013-07-03 06:38:20 -04:00
if ( class_exists ( " OC_Theme " )) {
2013-07-03 08:21:51 -04:00
$this -> theme = new OC_Theme ();
2013-07-03 06:38:20 -04:00
}
}
2013-06-12 09:15:08 -04:00
2013-07-03 08:21:51 -04:00
private function themeExist ( $method ) {
2013-06-27 10:28:45 -04:00
if ( OC_Util :: getTheme () !== '' && method_exists ( 'OC_Theme' , $method )) {
2013-06-27 10:24:03 -04:00
return true ;
}
return false ;
}
2013-06-12 09:15:08 -04:00
2013-08-30 07:53:49 -04:00
/**
*
* @ param string $itemType typically " file " or " folder "
*/
public function getShareNotificationSubject ( $itemType ) {
if ( $this -> themeExist ( 'getShareNotificationSubject' )) {
return $this -> theme -> getShareNotificationSubject ( $itemType );
} else {
return $this -> l -> t ( " A %s was shared with you " , array ( $itemType ));
}
}
/**
* @ param string $sender owner of the file / folder
* @ param string $itemName name of the file / folder
* @ param string $itemType typically " file " or " folder "
* @ param string $link link directly to the file / folder in your ownCloud
2013-08-30 11:20:10 -04:00
* @ param string $expiration expiration date
2013-08-30 07:53:49 -04:00
*/
2013-08-30 11:20:10 -04:00
public function getShareNotificationText ( $sender , $itemName , $itemType , $link , $expiration = null ) {
2013-08-30 07:53:49 -04:00
if ( $this -> themeExist ( 'getShareNotificationText' )) {
2013-08-30 11:20:10 -04:00
return $this -> theme -> getShareNotificationText ( $sender , $itemName , $itemType , $link , $expiration );
2013-08-30 07:53:49 -04:00
} else {
2013-08-30 11:20:10 -04:00
if ( $expiration ) {
return $this -> l -> t ( " %s shared a %s called %s with you. The share will expire at %s. You can find the %s here: %s " , array ( $sender , $itemType , $itemName , $expiration , $itemType , $link ));
} else {
return $this -> l -> t ( " %s shared a %s called %s with you. You can find the %s here: %s " , array ( $sender , $itemType , $itemName , $itemType , $link ));
}
2013-08-30 07:53:49 -04:00
}
}
2013-07-03 08:21:51 -04:00
public function getBaseUrl () {
if ( $this -> themeExist ( 'getBaseUrl' )) {
return $this -> theme -> getBaseUrl ();
2013-06-12 09:15:08 -04:00
} else {
2013-07-03 08:21:51 -04:00
return $this -> defaultBaseUrl ;
2013-06-12 09:15:08 -04:00
}
}
2013-07-03 08:21:51 -04:00
public function getSyncClientUrl () {
if ( $this -> themeExist ( 'getSyncClientUrl' )) {
return $this -> theme -> getSyncClientUrl ();
2013-06-12 09:44:11 -04:00
} else {
2013-07-03 08:21:51 -04:00
return $this -> defaultSyncClientUrl ;
2013-06-12 09:44:11 -04:00
}
}
2013-07-03 08:21:51 -04:00
public function getDocBaseUrl () {
if ( $this -> themeExist ( 'getDocBaseUrl' )) {
return $this -> theme -> getDocBaseUrl ();
2013-06-12 10:19:28 -04:00
} else {
2013-07-03 08:21:51 -04:00
return $this -> defaultDocBaseUrl ;
2013-06-12 10:19:28 -04:00
}
}
2013-07-11 10:38:07 -04:00
public function getTitle () {
if ( $this -> themeExist ( 'getTitle' )) {
return $this -> theme -> getTitle ();
} else {
return $this -> defaultTitle ;
}
}
2013-07-03 08:21:51 -04:00
public function getName () {
if ( $this -> themeExist ( 'getName' )) {
return $this -> theme -> getName ();
2013-06-12 09:15:08 -04:00
} else {
2013-07-03 08:21:51 -04:00
return $this -> defaultName ;
2013-06-12 09:15:08 -04:00
}
}
2013-07-03 08:21:51 -04:00
public function getEntity () {
if ( $this -> themeExist ( 'getEntity' )) {
return $this -> theme -> getEntity ();
2013-06-12 09:15:08 -04:00
} else {
2013-07-03 08:21:51 -04:00
return $this -> defaultEntity ;
2013-06-12 09:15:08 -04:00
}
}
2013-07-03 08:21:51 -04:00
public function getSlogan () {
if ( $this -> themeExist ( 'getSlogan' )) {
return $this -> theme -> getSlogan ();
2013-06-12 09:15:08 -04:00
} else {
2013-07-03 08:21:51 -04:00
return $this -> defaultSlogan ;
2013-06-12 09:15:08 -04:00
}
}
2013-07-03 08:21:51 -04:00
public function getLogoClaim () {
if ( $this -> themeExist ( 'getLogoClaim' )) {
return $this -> theme -> getLogoClaim ();
2013-06-28 04:06:57 -04:00
} else {
2013-07-03 08:21:51 -04:00
return $this -> defaultLogoClaim ;
2013-06-28 04:06:57 -04:00
}
}
2013-07-03 08:21:51 -04:00
public function getShortFooter () {
if ( $this -> themeExist ( 'getShortFooter' )) {
$footer = $this -> theme -> getShortFooter ();
2013-06-27 10:24:03 -04:00
} else {
2013-07-03 08:21:51 -04:00
$footer = " <a href= \" " . $this -> getBaseUrl () . " \" target= \" _blank \" > " . $this -> getEntity () . " </a> " .
' – ' . $this -> getSlogan ();
2013-06-26 11:56:19 -04:00
}
return $footer ;
}
2013-07-03 08:21:51 -04:00
public function getLongFooter () {
if ( $this -> themeExist ( 'getLongFooter' )) {
$footer = $this -> theme -> getLongFooter ();
2013-06-26 11:56:19 -04:00
} else {
2013-07-03 08:21:51 -04:00
$footer = $this -> getShortFooter ();
2013-06-26 11:56:19 -04:00
}
2013-06-27 10:24:03 -04:00
2013-06-26 11:56:19 -04:00
return $footer ;
}
}