本文整理汇总了PHP中OCP\Util::addScript方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::addScript方法的具体用法?PHP Util::addScript怎么用?PHP Util::addScript使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCP\Util
的用法示例。
在下文中一共展示了Util::addScript方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* @NoAdminRequired
* @NoCSRFRequired
*/
public function index()
{
if (defined('DEBUG') && DEBUG) {
\OCP\Util::addScript('tasks', 'vendor/angularjs/angular');
\OCP\Util::addScript('tasks', 'vendor/angularjs/angular-route');
\OCP\Util::addScript('tasks', 'vendor/angularjs/angular-animate');
\OCP\Util::addScript('tasks', 'vendor/momentjs/moment');
\OCP\Util::addScript('tasks', 'vendor/bootstrap/ui-bootstrap-custom-tpls-0.10.0');
} else {
\OCP\Util::addScript('tasks', 'vendor/angularjs/angular.min');
\OCP\Util::addScript('tasks', 'vendor/angularjs/angular-route.min');
\OCP\Util::addScript('tasks', 'vendor/angularjs/angular-animate.min');
\OCP\Util::addScript('tasks', 'vendor/momentjs/moment.min');
\OCP\Util::addScript('tasks', 'vendor/bootstrap/ui-bootstrap-custom-tpls-0.10.0.min');
}
\OCP\Util::addScript('tasks', 'public/app');
\OCP\Util::addScript('tasks', 'vendor/appframework/app');
\OCP\Util::addScript('tasks', 'vendor/timepicker/jquery.ui.timepicker');
\OCP\Util::addStyle('tasks', 'style');
\OCP\Util::addStyle('tasks', 'vendor/bootstrap/bootstrap');
$date = new \DateTimeZone(\OC_Calendar_App::getTimezone());
$day = new \DateTime('today', $date);
$day = $day->format('d');
// TODO: Make a HTMLTemplateResponse class
$response = new TemplateResponse('tasks', 'main');
$response->setParams(array('DOM' => $day));
return $response;
}
示例2: loadFrontend
/**
* Load the frontend files needed
*/
public function loadFrontend()
{
\OCP\Util::addStyle('ocusagecharts', 'c3js/c3');
\OCP\Util::addScript('ocusagecharts', 'c3js/d3.min');
\OCP\Util::addScript('ocusagecharts', 'c3js/c3.min');
\OCP\Util::addScript('ocusagecharts', 'c3js/initGraphs');
}
示例3: onLoadFilesAppScripts
/**
* Load additional scripts when the files app is visible
*/
public static function onLoadFilesAppScripts()
{
Util::addScript('snannyowncloudapi', 'tabview');
Util::addScript('snannyowncloudapi', 'filesplugin');
Util::addScript('snannyowncloudapi', 'fileupload');
Util::addScript('snannyowncloudapi', 'templateutil');
Util::addStyle('snannyowncloudapi', 'style');
}
示例4: vendor_script
function vendor_script($app, $files)
{
if (is_array($files)) {
foreach ($files as $file) {
\OCP\Util::addScript('chat', '../vendor/' . $file);
}
} else {
\OCP\Util::addScript('chat', '../vendor/' . $files);
}
}
示例5: init
public static function init()
{
//check if curl extension installed
if (!in_array('curl', get_loaded_extensions())) {
\OCP\Util::writeLog(self::APP_ID, 'This app needs cUrl PHP extension', \OCP\Util::DEBUG);
return false;
}
\OC::$CLASSPATH['OCA\\User_persona\\Policy'] = self::APP_PATH . 'lib/policy.php';
\OCP\App::registerAdmin(self::APP_ID, 'settings');
if (!\OCP\User::isLoggedIn()) {
\OC::$CLASSPATH['OCA\\User_persona\\Validator'] = self::APP_PATH . 'lib/validator.php';
\OC::$CLASSPATH['OC_USER_PERSONA'] = self::APP_PATH . 'user_persona.php';
\OC_User::useBackend('persona');
\OCP\Util::connectHook('OC_User', 'post_login', "OCA\\User_persona\\Validator", "postlogin_hook");
\OCP\Util::addScript(self::APP_ID, 'utils');
}
}
示例6: index
/**
* @NoAdminRequired
* @NoCSRFRequired
*/
public function index()
{
$imppTypes = Properties::getTypesForProperty('IMPP');
$adrTypes = Properties::getTypesForProperty('ADR');
$phoneTypes = Properties::getTypesForProperty('TEL');
$emailTypes = Properties::getTypesForProperty('EMAIL');
$cloudTypes = Properties::getTypesForProperty('CLOUD');
$ims = Properties::getIMOptions();
$imProtocols = array();
foreach ($ims as $name => $values) {
$imProtocols[$name] = $values['displayname'];
}
$maxUploadFilesize = $this->utilFactory->maxUploadFilesize('/');
\OCP\Util::addScript('placeholder', null);
\OCP\Util::addScript('../vendor/blueimp-md5/js/md5', null);
\OCP\Util::addScript('jquery.avatar', null);
\OCP\Util::addScript('avatar', null);
$response = new TemplateResponse($this->appName, 'contacts');
$response->setParams(['uploadMaxFilesize' => $maxUploadFilesize, 'uploadMaxHumanFilesize' => $this->utilFactory->humanFileSize($maxUploadFilesize), 'phoneTypes' => $phoneTypes, 'emailTypes' => $emailTypes, 'cloudTypes' => $cloudTypes, 'adrTypes' => $adrTypes, 'imppTypes' => $imppTypes, 'imProtocols' => $imProtocols, 'importManager' => $this->importManager]);
return $response;
}
示例7: redirect
/**
* @NoAdminRequired
* @NoCSRFRequired
*
* @throws \Exception If the URL is not valid.
* @return TemplateResponse
*/
public function redirect()
{
$templateName = 'redirect';
$route = 'mail.page.index';
$mailURL = $this->urlGenerator->linkToRoute($route);
$url = $this->request->getParam('src');
$authorizedRedirect = false;
if (strpos($url, 'http://') !== 0 && strpos($url, 'https://') !== 0) {
throw new \Exception('URL is not valid.', 1);
}
// If the request has a referrer from this domain redirect the user without interaction
// this is there to prevent an open redirector.
// Since we can't prevent the referrer from being added with a HTTP only header we rely on an
// additional JS file here.
if (parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST) === Util::getServerHostName()) {
Util::addScript('mail', 'autoredirect');
$authorizedRedirect = true;
}
$params = ['authorizedRedirect' => $authorizedRedirect, 'url' => $url, 'urlHost' => parse_url($url, PHP_URL_HOST), 'mailURL' => $mailURL];
return new TemplateResponse($this->appName, $templateName, $params, 'guest');
}
示例8: index
/**
* @NoAdminRequired
* @NoCSRFRequired
*/
public function index()
{
\OC::$server->getNavigationManager()->setActiveEntry($this->appName);
$importManager = new ImportManager();
$imppTypes = Properties::getTypesForProperty('IMPP');
$adrTypes = Properties::getTypesForProperty('ADR');
$phoneTypes = Properties::getTypesForProperty('TEL');
$emailTypes = Properties::getTypesForProperty('EMAIL');
$ims = Properties::getIMOptions();
$imProtocols = array();
foreach ($ims as $name => $values) {
$imProtocols[$name] = $values['displayname'];
}
$maxUploadFilesize = \OCP\Util::maxUploadFilesize('/');
\OCP\Util::addScript('', 'jquery.multiselect');
\OCP\Util::addScript('', 'tags');
\OCP\Util::addScript('placeholder');
\OCP\Util::addScript('3rdparty', 'md5/md5.min');
\OCP\Util::addScript('jquery.avatar');
\OCP\Util::addScript('avatar');
\OCP\Util::addScript('contacts', 'jquery.combobox');
\OCP\Util::addScript('contacts', 'modernizr.custom');
\OCP\Util::addScript('contacts', 'app');
\OCP\Util::addScript('contacts', 'addressbooks');
\OCP\Util::addScript('contacts', 'contacts');
\OCP\Util::addScript('contacts', 'storage');
\OCP\Util::addScript('contacts', 'groups');
\OCP\Util::addScript('contacts', 'jquery.ocaddnew');
\OCP\Util::addScript('contacts', 'otherbackendconfig');
\OCP\Util::addScript('files', 'jquery.fileupload');
\OCP\Util::addScript('3rdparty/Jcrop', 'jquery.Jcrop');
\OCP\Util::addStyle('', 'jquery.multiselect');
\OCP\Util::addStyle('contacts', 'jquery.combobox');
\OCP\Util::addStyle('contacts', 'jquery.ocaddnew');
\OCP\Util::addStyle('3rdparty/Jcrop', 'jquery.Jcrop');
\OCP\Util::addStyle('contacts', 'contacts');
$response = new TemplateResponse($this->appName, 'contacts');
$response->setParams(array('uploadMaxFilesize' => $maxUploadFilesize, 'uploadMaxHumanFilesize' => \OCP\Util::humanFileSize($maxUploadFilesize), 'phoneTypes' => $phoneTypes, 'emailTypes' => $emailTypes, 'adrTypes' => $adrTypes, 'imppTypes' => $imppTypes, 'imProtocols' => $imProtocols, 'importManager' => $importManager));
return $response;
}
示例9: __construct
/**
* @param string $renderAs
* @param string $appId application id
*/
public function __construct($renderAs, $appId = '')
{
// yes - should be injected ....
$this->config = \OC::$server->getConfig();
// Decide which page we show
if ($renderAs == 'user') {
parent::__construct('core', 'layout.user');
if (in_array(\OC_App::getCurrentApp(), ['settings', 'admin', 'help']) !== false) {
$this->assign('bodyid', 'body-settings');
} else {
$this->assign('bodyid', 'body-user');
}
// Code integrity notification
$integrityChecker = \OC::$server->getIntegrityCodeChecker();
if (!$integrityChecker->hasPassedCheck()) {
\OCP\Util::addScript('core', 'integritycheck-failed-notification');
}
// Add navigation entry
$this->assign('application', '');
$this->assign('appid', $appId);
$navigation = \OC_App::getNavigation();
$this->assign('navigation', $navigation);
$settingsNavigation = \OC_App::getSettingsNavigation();
$this->assign('settingsnavigation', $settingsNavigation);
foreach ($navigation as $entry) {
if ($entry['active']) {
$this->assign('application', $entry['name']);
break;
}
}
foreach ($settingsNavigation as $entry) {
if ($entry['active']) {
$this->assign('application', $entry['name']);
break;
}
}
$userDisplayName = \OC_User::getDisplayName();
$appsMgmtActive = strpos(\OC::$server->getRequest()->getRequestUri(), \OC::$server->getURLGenerator()->linkToRoute('settings.AppSettings.viewApps')) === 0;
if ($appsMgmtActive) {
$l = \OC::$server->getL10N('lib');
$this->assign('application', $l->t('Apps'));
}
$this->assign('user_displayname', $userDisplayName);
$this->assign('user_uid', \OC_User::getUser());
$this->assign('appsmanagement_active', $appsMgmtActive);
$this->assign('enableAvatars', $this->config->getSystemValue('enable_avatars', true) === true);
if (\OC_User::getUser() === false) {
$this->assign('userAvatarSet', false);
} else {
$this->assign('userAvatarSet', \OC::$server->getAvatarManager()->getAvatar(\OC_User::getUser())->exists());
}
} else {
if ($renderAs == 'error') {
parent::__construct('core', 'layout.guest', '', false);
$this->assign('bodyid', 'body-login');
} else {
if ($renderAs == 'guest') {
parent::__construct('core', 'layout.guest');
$this->assign('bodyid', 'body-login');
} else {
parent::__construct('core', 'layout.base');
}
}
}
// Send the language to our layouts
$this->assign('language', \OC_L10N::findLanguage());
if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
if (empty(self::$versionHash)) {
$v = \OC_App::getAppVersions();
$v['core'] = implode('.', \OCP\Util::getVersion());
self::$versionHash = md5(implode(',', $v));
}
} else {
self::$versionHash = md5('not installed');
}
$useAssetPipeline = self::isAssetPipelineEnabled();
if ($useAssetPipeline) {
$this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('js_config', ['v' => self::$versionHash]));
$this->generateAssets();
} else {
// Add the js files
$jsFiles = self::findJavascriptFiles(\OC_Util::$scripts);
$this->assign('jsfiles', array());
if ($this->config->getSystemValue('installed', false) && $renderAs != 'error') {
$this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('js_config', ['v' => self::$versionHash]));
}
foreach ($jsFiles as $info) {
$web = $info[1];
$file = $info[2];
$this->append('jsfiles', $web . '/' . $file . '?v=' . self::$versionHash);
}
// Add the css files
$cssFiles = self::findStylesheetFiles(\OC_Util::$styles);
$this->assign('cssfiles', array());
foreach ($cssFiles as $info) {
$web = $info[1];
//.........这里部分代码省略.........
示例10:
<?php
\OCP\Util::addScript('music', 'vendor/underscore/underscore-min');
\OCP\Util::addScript('music', 'vendor/angular/angular.min');
\OCP\Util::addScript('music', 'vendor/angular/angular-route.min');
\OCP\Util::addScript('music', 'vendor/soundmanager/soundmanager2');
\OCP\Util::addScript('music', 'vendor/restangular/restangular.min');
\OCP\Util::addScript('music', 'vendor/angular-gettext/angular-gettext.min');
\OCP\Util::addScript('music', 'public/app');
\OCP\Util::addStyle('music', 'style-playerbar');
\OCP\Util::addStyle('music', 'style-sidebar');
\OCP\Util::addStyle('music', 'style');
\OCP\Util::addStyle('music', 'mobile');
\OCP\Util::addStyle('music', 'tablet');
?>
<div id="app" ng-app="Music" ng-cloak ng-init="started = false; lang = '<?php
p($_['lang']);
?>
'">
<div ng-controller="MainController">
<!-- this will be used to display the flash element to give the user a chance to unblock flash -->
<div id="sm2-container" ng-class="{started: started}"></div>
<div id="playerbar" ng-controller="PlayerController" ng-class="{started: started}">
<div id="play-controls">
<img ng-click="prev()" class="control small svg" alt="{{'Previous' | translate }}"
src="<?php
p(OCP\image_path('music', 'play-previous.svg'));
?>
示例11: initTemplateEngine
public static function initTemplateEngine($renderAs)
{
if (self::$initTemplateEngineFirstRun) {
//apps that started before the template initialization can load their own scripts/styles
//so to make sure this scripts/styles here are loaded first we use OC_Util::addScript() with $prepend=true
//meaning the last script/style in this list will be loaded first
if (\OC::$server->getSystemConfig()->getValue('installed', false) && $renderAs !== 'error' && !\OCP\Util::needUpgrade()) {
if (\OC::$server->getConfig()->getAppValue('core', 'backgroundjobs_mode', 'ajax') == 'ajax') {
OC_Util::addScript('backgroundjobs', null, true);
}
}
OC_Util::addStyle("tooltip", null, true);
OC_Util::addStyle('jquery-ui-fixes', null, true);
OC_Util::addVendorStyle('jquery-ui/themes/base/jquery-ui', null, true);
OC_Util::addStyle("multiselect", null, true);
OC_Util::addStyle("fixes", null, true);
OC_Util::addStyle("global", null, true);
OC_Util::addStyle("apps", null, true);
OC_Util::addStyle("fonts", null, true);
OC_Util::addStyle("icons", null, true);
OC_Util::addStyle("mobile", null, true);
OC_Util::addStyle("header", null, true);
OC_Util::addStyle("inputs", null, true);
OC_Util::addStyle("styles", null, true);
// avatars
if (\OC::$server->getSystemConfig()->getValue('enable_avatars', true) === true) {
\OC_Util::addScript('avatar', null, true);
\OC_Util::addScript('jquery.avatar', null, true);
\OC_Util::addScript('placeholder', null, true);
}
OC_Util::addScript('oc-backbone', null, true);
OC_Util::addVendorScript('core', 'backbone/backbone', true);
OC_Util::addVendorScript('snapjs/dist/latest/snap', null, true);
OC_Util::addScript('mimetypelist', null, true);
OC_Util::addScript('mimetype', null, true);
OC_Util::addScript("apps", null, true);
OC_Util::addScript("oc-requesttoken", null, true);
OC_Util::addScript('search', 'search', true);
OC_Util::addScript("config", null, true);
OC_Util::addScript("eventsource", null, true);
OC_Util::addScript("octemplate", null, true);
OC_Util::addTranslations("core", null, true);
OC_Util::addScript("l10n", null, true);
OC_Util::addScript("js", null, true);
OC_Util::addScript("oc-dialogs", null, true);
OC_Util::addScript("jquery.ocdialog", null, true);
OC_Util::addStyle("jquery.ocdialog");
OC_Util::addScript("compatibility", null, true);
OC_Util::addScript("placeholders", null, true);
OC_Util::addScript('files/fileinfo');
OC_Util::addScript('files/client');
// Add the stuff we need always
// following logic will import all vendor libraries that are
// specified in core/js/core.json
$fileContent = file_get_contents(OC::$SERVERROOT . '/core/js/core.json');
if ($fileContent !== false) {
$coreDependencies = json_decode($fileContent, true);
foreach (array_reverse($coreDependencies['vendor']) as $vendorLibrary) {
// remove trailing ".js" as addVendorScript will append it
OC_Util::addVendorScript(substr($vendorLibrary, 0, strlen($vendorLibrary) - 3), null, true);
}
} else {
throw new \Exception('Cannot read core/js/core.json');
}
if (\OC::$server->getRequest()->isUserAgent([\OC\AppFramework\Http\Request::USER_AGENT_IE])) {
// shim for the davclient.js library
\OCP\Util::addScript('files/iedavclient');
}
self::$initTemplateEngineFirstRun = false;
}
}
示例12: function
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
$eventDispatcher = \OC::$server->getEventDispatcher();
$eventDispatcher->addListener('OCA\\Files::loadAdditionalScripts', function () {
\OCP\Util::addScript('oc-backbone-webdav');
\OCP\Util::addScript('comments', 'app');
\OCP\Util::addScript('comments', 'commentmodel');
\OCP\Util::addScript('comments', 'commentcollection');
\OCP\Util::addScript('comments', 'commentsummarymodel');
\OCP\Util::addScript('comments', 'commentstabview');
\OCP\Util::addScript('comments', 'filesplugin');
\OCP\Util::addStyle('comments', 'comments');
});
$activityManager = \OC::$server->getActivityManager();
$activityManager->registerExtension(function () {
$application = new \OCP\AppFramework\App('comments');
/** @var \OCA\Comments\Activity\Extension $extension */
$extension = $application->getContainer()->query('OCA\\Comments\\Activity\\Extension');
return $extension;
});
$managerListener = function (\OCP\Comments\CommentsEvent $event) use($activityManager) {
$application = new \OCP\AppFramework\App('comments');
/** @var \OCA\Comments\Activity\Listener $listener */
$listener = $application->getContainer()->query('OCA\\Comments\\Activity\\Listener');
$listener->commentEvent($event);
};
示例13:
<?php
/**
* ownCloud - gsync plugin
*
* @author Victor Dubiniuk
* @copyright 2012-2013 Victor Dubiniuk victor.dubiniuk@gmail.com
*
* This file is licensed under the Affero General Public License version 3 or
* later.
*/
namespace OCA_Gsync;
App::initController();
\OCP\Util::addScript(App::APP_ID, 'settings');
$info = \OCP\App::getAppInfo(App::APP_ID);
$tmpl = new \OCP\Template(App::APP_ID, 'settings');
$tmpl->assign(App::GOOGLE_CLIENT_ID, App::getClientId());
$tmpl->assign(App::GOOGLE_SECRET, App::getSecret());
$tmpl->assign(App::GOOGLE_REFRESH_TOKEN, App::getRefreshToken());
$tmpl->assign('gsync_redirect', App::getRedirectUri());
$tmpl->assign('app_version', @$info['version']);
return $tmpl->fetchPage();
示例14: printUpgradePage
/**
* Prints the upgrade page
*/
private static function printUpgradePage()
{
$systemConfig = \OC::$server->getSystemConfig();
$oldTheme = $systemConfig->getValue('theme');
$systemConfig->setValue('theme', '');
\OCP\Util::addScript('config');
// needed for web root
\OCP\Util::addScript('update');
// check whether this is a core update or apps update
$installedVersion = $systemConfig->getValue('version', '0.0.0');
$currentVersion = implode('.', OC_Util::getVersion());
$appManager = \OC::$server->getAppManager();
$tmpl = new OC_Template('', 'update.admin', 'guest');
$tmpl->assign('version', OC_Util::getVersionString());
// if not a core upgrade, then it's apps upgrade
if (version_compare($currentVersion, $installedVersion, '=')) {
$tmpl->assign('isAppsOnlyUpgrade', true);
} else {
$tmpl->assign('isAppsOnlyUpgrade', false);
}
// get third party apps
$ocVersion = OC_Util::getVersion();
$tmpl->assign('appsToUpgrade', $appManager->getAppsNeedingUpgrade($ocVersion));
$tmpl->assign('incompatibleAppsList', $appManager->getIncompatibleApps($ocVersion));
$tmpl->assign('productName', 'ownCloud');
// for now
$tmpl->assign('oldTheme', $oldTheme);
$tmpl->printPage();
}
示例15: isset
<?php
/**
* ownCloud - Updater plugin
*
* @author Victor Dubiniuk
* @copyright 2012-2013 Victor Dubiniuk victor.dubiniuk@gmail.com
*
* This file is licensed under the Affero General Public License version 3 or
* later.
*/
namespace OCA\Updater;
\OCP\User::checkAdminUser();
\OCP\Util::addScript(App::APP_ID, '3rdparty/angular');
\OCP\Util::addScript(App::APP_ID, 'app');
\OCP\Util::addScript(App::APP_ID, 'controllers');
\OCP\Util::addStyle(App::APP_ID, 'updater');
if (!@file_exists(App::getBackupBase())) {
Helper::mkdir(App::getBackupBase());
}
$data = App::getFeed();
$isNewVersionAvailable = isset($data['version']) && $data['version'] != '' && $data['version'] !== array();
$tmpl = new \OCP\Template(App::APP_ID, 'admin');
$lastCheck = \OC_Appconfig::getValue('core', 'lastupdatedat');
$tmpl->assign('checkedAt', \OCP\Util::formatDate($lastCheck));
$tmpl->assign('isNewVersionAvailable', $isNewVersionAvailable ? 'true' : 'false');
$tmpl->assign('channels', Channel::getChannels());
$tmpl->assign('currentChannel', Channel::getCurrentChannel());
$tmpl->assign('version', isset($data['versionstring']) ? $data['versionstring'] : '');
return $tmpl->fetchPage();