本文整理汇总了PHP中Requirements::block方法的典型用法代码示例。如果您正苦于以下问题:PHP Requirements::block方法的具体用法?PHP Requirements::block怎么用?PHP Requirements::block使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Requirements
的用法示例。
在下文中一共展示了Requirements::block方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FieldHolder
function FieldHolder() {
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/prototype/prototype.js');
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/behaviour/behaviour.js');
Requirements::javascript(SAPPHIRE_DIR . '/javascript/prototype_improvements.js');
Requirements::javascript(THIRDPARTY_DIR . '/scriptaculous/effects.js');
Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang');
Requirements::javascript(SAPPHIRE_DIR . '/javascript/TableListField.js');
// swap the js file
Requirements::block(SAPPHIRE_DIR . '/javascript/TableField.js');
Requirements::javascript('modifiedtablefield/javascript/ModifiedTableField.js');
Requirements::css(SAPPHIRE_DIR . '/css/TableListField.css');
$defaults = $this->fieldDefaults;
if ($this->fieldDefaults == null && !is_array($this->fieldDefaults)) {
$sourceClass = $this->sourceClass;
$defaults = singleton($sourceClass)->stat('defaults');
}
if (count($defaults) > 0) {
Requirements::customScript("var ".$this->name."_fieldDefaults = ".Convert::array2json($defaults));
}
return $this->renderWith($this->template);
}
示例2: init
public function init()
{
parent::init();
Requirements::css(CB_DIR . '/css/CodeBank.css');
Requirements::block(CB_DIR . '/javascript/CodeBank.Tree.js');
Requirements::javascript(CB_DIR . '/javascript/CodeBank.Settings.js');
}
示例3: init
public function init()
{
parent::init();
Requirements::block("summit/css/combined.css");
Requirements::css("themes/openstack/static/css/combined.css");
Requirements::javascript("themes/openstack/static/js/guide.js");
}
示例4: init
public function init()
{
if (!$this->currentDashboard) {
Restrictable::set_enabled(false);
if (Member::currentUserID()) {
Restrictable::set_enabled(true);
$this->currentDashboard = $this->getDashboard();
}
Restrictable::set_enabled(true);
}
parent::init();
if ($this->currentDashboard && !$this->currentDashboard->checkPerm('View')) {
if (!Member::currentUserID() && !$this->redirectedTo()) {
Security::permissionFailure($this, "You must be logged in");
return;
}
}
Requirements::block(THIRDPARTY_DIR . '/jquery/jquery.js');
Requirements::javascript('frontend-dashboards/javascript/jquery-1.10.2.min.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-form/jquery.form.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js');
Requirements::javascript('frontend-dashboards/thirdparty/jquery-cookie/jquery.cookie.js');
Requirements::javascript(FRAMEWORK_DIR . '/javascript/jquery-ondemand/jquery.ondemand.js');
Requirements::javascript('frontend-dashboards/javascript/dashboards.js');
Requirements::javascript('frontend-dashboards/javascript/dashboard-dialogs.js');
Requirements::css('frontend-dashboards/css/dashboards.css');
Requirements::javascript('frontend-dashboards/javascript/jquery.gridster.js');
Requirements::css('frontend-dashboards/css/jquery.gridster.css');
// Requirements::javascript('frontend-dashboards/javascript/jquery.gridly.js');
// Requirements::css('frontend-dashboards/css/jquery.gridly.css');
}
示例5: init
public function init()
{
// In LeftAndMain::init() the current theme is unset.
// we need to restore the current theme here for make the dropdown of template list.
$theme = SSViewer::current_theme();
parent::init();
if (isset($theme) && $theme) {
SSViewer::set_theme($theme);
}
Requirements::javascript(MCE_ROOT . 'tiny_mce_src.js');
Requirements::javascript(SAPPHIRE_DIR . '/javascript/tiny_mce_improvements.js');
//TODO what is going on here? where did that hover.js go? can't find it.
//TODO We need to reimplement a hover.js?
Requirements::javascript(CMS_DIR . '/javascript/hover.js');
Requirements::javascript(THIRDPARTY_DIR . '/scriptaculous/controls.js');
Requirements::javascript(CMS_DIR . '/javascript/LeftAndMain_left.js');
Requirements::javascript(CMS_DIR . '/javascript/LeftAndMain_right.js');
Requirements::javascript(CMS_DIR . '/javascript/CMSMain_left.js');
Requirements::javascript(CMS_DIR . '/javascript/SecurityAdmin.js');
Requirements::javascript(NEWSLETTER_DIR . '/javascript/NewsletterAdmin_left.js');
Requirements::javascript(NEWSLETTER_DIR . '/javascript/NewsletterAdmin_right.js');
Requirements::javascript(NEWSLETTER_DIR . '/javascript/ProgressBar.js');
// We don't want this showing up in every ajax-response, it should always be present in a CMS-environment
if (!Director::is_ajax()) {
Requirements::javascript(MCE_ROOT . 'tiny_mce_src.js');
HtmlEditorConfig::get('cms')->setOption('ContentCSS', project() . '/css/editor.css');
HtmlEditorConfig::get('cms')->setOption('Lang', i18n::get_tinymce_lang());
}
// Always block the HtmlEditorField.js otherwise it will be sent with an ajax request
Requirements::block(SAPPHIRE_DIR . '/javascript/HtmlEditorField.js');
Requirements::css(NEWSLETTER_DIR . '/css/NewsletterAdmin.css');
}
示例6: __construct
/**
* Constructor.
*
* @param Controller $controller
* @param string $name method on the $controller
* @param FieldList $fields
* @param FieldList $actions
* @param bool $checkCurrentUser - show logout button if logged in
*/
public function __construct($controller, $name, $fields = null, $actions = null, $checkCurrentUser = true)
{
parent::__construct($controller, $name, $fields, $actions, $checkCurrentUser);
// will be used to get correct Link()
$this->ldapSecController = Injector::inst()->create('LDAPSecurityController');
$usernameField = new TextField('Username', _t('Member.USERNAME', 'Username'), null, null, $this);
$this->Fields()->replaceField('Email', $usernameField);
$this->setValidator(new RequiredFields('Username', 'Password'));
if (Security::config()->remember_username) {
$usernameField->setValue(Session::get('SessionForms.MemberLoginForm.Email'));
} else {
// Some browsers won't respect this attribute unless it's added to the form
$this->setAttribute('autocomplete', 'off');
$usernameField->setAttribute('autocomplete', 'off');
}
// Users can't change passwords unless appropriate a LDAP user with write permissions is
// configured the LDAP connection binding
$this->Actions()->remove($this->Actions()->fieldByName('forgotPassword'));
$allowPasswordChange = Config::inst()->get('LDAPService', 'allow_password_change');
if ($allowPasswordChange && $name != 'LostPasswordForm' && !Member::currentUser()) {
$forgotPasswordLink = sprintf('<p id="ForgotPassword"><a href="%s">%s</a></p>', $this->ldapSecController->Link('lostpassword'), _t('Member.BUTTONLOSTPASSWORD', "I've lost my password"));
$forgotPassword = new LiteralField('forgotPassword', $forgotPasswordLink);
$this->Actions()->add($forgotPassword);
}
// Focus on the Username field when the page is loaded
Requirements::block('MemberLoginFormFieldFocus');
$js = <<<JS
\t\t\t(function() {
\t\t\t\tvar el = document.getElementById("Username");
\t\t\t\tif(el && el.focus && (typeof jQuery == 'undefined' || jQuery(el).is(':visible'))) el.focus();
\t\t\t})();
JS;
Requirements::customScript($js, 'LDAPLoginFormFieldFocus');
}
示例7: onBeforeInit
/**
* add requirements for frontend editing only when logged in
* @todo Use TinyMCEs Compressor 4.0.2 PHP
*/
public function onBeforeInit()
{
$canEdit = FrontendEditing::ShowAdmin();
$editingEnabled = FrontendEditing::editingEnabled();
$minExt = Director::isDev() ? "" : ".min";
if ($canEdit) {
// Enable front-end fly-out menu
//
//Flexslider imports easing, which breaks?
Requirements::block('flexslider/javascript/jquery.easing.1.3.js');
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js');
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery-ui/jquery-ui.js');
Requirements::javascript(FRAMEWORK_ADMIN_DIR . '/javascript/ssui.core.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js');
Requirements::javascriptTemplate(FRONTEND_ADMIN_DIR . '/javascript/dist/FrontEndAdminTemplate' . $minExt . '.js', $this->getConfig($this->owner->data()));
Requirements::css(FRAMEWORK_DIR . '/thirdparty/jquery-ui-themes/smoothness/jquery-ui.css');
Requirements::javascript(FRONTEND_ADMIN_DIR . '/javascript/dist/FrontEndAdmin' . $minExt . '.js');
Requirements::css(FRONTEND_ADMIN_DIR . '/css/frontend-admin' . $minExt . '.css');
$this->owner->getResponse()->addHeader("X-DynamicCache-OptOut", true);
}
if ($canEdit && $editingEnabled) {
// Disable mode pagespeed while editing
$this->owner->getResponse()->addHeader("PageSpeed", "off");
// Disable HTTP cache while editing
HTTP::set_cache_age(0);
// Enable TinyMCE when editing has been enabled
Requirements::javascript(FRONTEND_ADMIN_DIR . '/bower_components/tinymce/jquery.tinymce.min.js');
Requirements::javascript(FRONTEND_ADMIN_DIR . '/javascript/dist/FrontEndEditor' . $minExt . '.js');
Requirements::css(FRONTEND_ADMIN_DIR . '/css/frontend-editor' . $minExt . '.css');
}
}
开发者ID:helpfulrobot,项目名称:gdmedia-silverstripe-frontend-admin,代码行数:35,代码来源:FrontendEditingControllerExtension.php
示例8: testBlockedCombinedJavascript
function testBlockedCombinedJavascript()
{
$combinedFilePath = Director::baseFolder() . '/' . 'RequirementsTest_bc.js';
/* BLOCKED COMBINED FILES ARE NOT INCLUDED */
$this->setupCombinedRequirements();
Requirements::block('RequirementsTest_bc.js');
Requirements::delete_combined_files('RequirementsTest_bc.js');
clearstatcache();
// needed to get accurate file_exists() results
$html = Requirements::includeInHTML(false, self::$html_template);
$this->assertFalse((bool) preg_match('/src=".*\\/RequirementsTest_bc\\.js/', $html), 'blocked combined files are not included ');
Requirements::unblock('RequirementsTest_bc.js');
/* BLOCKED UNCOMBINED FILES ARE NOT INCLUDED */
// need to re-add requirements, as Requirements::process_combined_includes() alters the
// original arrays grml...
$this->setupCombinedRequirements();
Requirements::block('sapphire/tests/forms/RequirementsTest_b.js');
Requirements::delete_combined_files('RequirementsTest_bc.js');
clearstatcache();
// needed to get accurate file_exists() results
$html = Requirements::includeInHTML(false, self::$html_template);
$this->assertFalse(strpos(file_get_contents($combinedFilePath), "alert('b')") !== false, 'blocked uncombined files are not included');
Requirements::unblock('RequirementsTest_b.js');
/* A SINGLE FILE CAN'T BE INCLUDED IN TWO COMBINED FILES */
$this->setupCombinedRequirements();
clearstatcache();
// needed to get accurate file_exists() results
// This throws a notice-level error, so we prefix with @
@Requirements::combine_files('RequirementsTest_ac.js', array('sapphire/tests/forms/RequirementsTest_a.js', 'sapphire/tests/forms/RequirementsTest_c.js'));
$combinedFiles = Requirements::get_combine_files();
$this->assertEquals(array_keys($combinedFiles), array('RequirementsTest_bc.js'), "A single file can't be included in two combined files");
Requirements::delete_combined_files('RequirementsTest_bc.js');
}
示例9: init
public function init()
{
$this->top_section = 'full';
parent::init();
Requirements::block("summit/css/combined.css");
Requirements::css("themes/openstack/static/css/combined.css");
}
示例10: onAfterInit
public function onAfterInit()
{
$config = Config::inst();
$theme = $config->get('SSViewer', 'theme');
$supported = $config->get('PageControllerThemeExtension', 'supported_themes');
if (Config::inst()->get('PageControllerThemeExtension', 'include_requirements') && in_array($theme, $supported)) {
// we'll use the frontend dashboard jquery
Requirements::block(THIRDPARTY_DIR . '/jquery/jquery.js');
// block frontend dashboards' js, we have our own
Requirements::block('frontend-dashboards/javascript/dashboards.js');
Requirements::javascript('frontend-dashboards/javascript/jquery-1.10.2.min.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-cookie/jquery.cookie.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
Requirements::javascript('frontend-dashboards/javascript/jquery-migrate-1.2.1.min.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js');
Requirements::javascript("themes/{$theme}/js/modernizr.js");
Requirements::javascript("themes/{$theme}/js/foundation.min.js");
Requirements::javascript("themes/{$theme}/js/jquery.slides.min.js");
Requirements::javascript("themes/{$theme}/js/general.js");
if (defined('BA_SIS_COMMUNITY_PATH')) {
Requirements::javascript(BA_SIS_COMMUNITY_PATH . '/javascript/info-lists.js');
Requirements::javascript(BA_SIS_COMMUNITY_PATH . '/javascript/info-lists-foundation.js');
}
if ($this->owner instanceof DashboardController) {
Requirements::javascript("themes/{$theme}/js/dashboards.js");
}
}
}
开发者ID:helpfulrobot,项目名称:silverstripe-australia-minimalist-theme-helper,代码行数:28,代码来源:MinimalistThemeExtensions.php
示例11: onBeforeInit
public function onBeforeInit()
{
$url = explode('/', $this->owner->request->getURL());
// Set Requirements for all custom Controllers
if (!in_array($url[0], array('admin', 'dev', 'interactive'))) {
Requirements::css("themes/bootstrap/css/bootstrap/sandstone/bootstrap.min.css");
//Requirements::css("//netdna.bootstrapcdn.com/bootswatch/3.3.5/sandstone/bootstrap.min.css");
// http://daneden.github.io/animate.css/
Requirements::css("themes/bootstrap/css/animate/animate.min.css");
//Requirements::css("//cdnjs.cloudflare.com/ajax/libs/animate.css/3.4.0/animate.min.css");
Requirements::css("themes/bootstrap/css/animate/animationdelay.css");
//http://fortawesome.github.io/Font-Awesome/
Requirements::css("themes/bootstrap/css/font-awesome/css/font-awesome.min.css");
//Requirements::css("//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css");
//https://useiconic.com/open/
Requirements::css("themes/bootstrap/css/open-iconic/css/open-iconic-bootstrap.min.css");
//Requirements::css("//cdn.jsdelivr.net/open-iconic/1.1.0/font/css/open-iconic-bootstrap.min.css");
//http://ionicons.com/
Requirements::css("themes/bootstrap/css/ionicons/css/ionicons.min.css");
//Requirements::css("//code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css");
// App CSS
Requirements::css("app_config/css/app.css");
// Load JQuery From bootstap theme
Requirements::block(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js');
Requirements::block(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.min.js');
Requirements::javascript("themes/bootstrap/javascript/jquery/jquery.min.js");
//Requirements::javascript("//code.jquery.com/jquery.min.js");
Requirements::javascript("themes/bootstrap/javascript/bootstrap/bootstrap.min.js");
//Requirements::javascript("//netdna.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js");
}
}
示例12: block
static function block()
{
Requirements::block('superfish/javascript/hoverIntent.js');
Requirements::block('superfish/javascript/superfish.js');
Requirements::block('superfish/css/superfish.css');
Requirements::block('superfishconfig');
}
示例13: GerritStatisticsReport
public function GerritStatisticsReport()
{
Requirements::block(SAPPHIRE_DIR . "/javascript/jquery_improvements.js");
Requirements::block(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js');
Requirements::block(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.min.js');
Requirements::block(THIRDPARTY_DIR . '/jquery-cookie/jquery.cookie.js');
if (Director::isLive()) {
Requirements::javascript('themes/openstack/javascript/jquery.min.js');
} else {
Requirements::javascript('themes/openstack/javascript/jquery.js');
}
Requirements::javascript('themes/openstack/javascript/jquery-migrate-1.2.1.min.js');
Requirements::javascript("themes/openstack/javascript/jquery.cookie.js");
Requirements::javascript("themes/openstack/javascript/bootstrap.min.js");
Requirements::css('themes/openstack/css/bootstrap.min.css');
Requirements::javascript(Director::protocol() . "maps.googleapis.com/maps/api/js?sensor=false");
Requirements::javascript("marketplace/code/ui/admin/js/utils.js");
Requirements::javascript("marketplace/code/ui/frontend/js/markerclusterer.js");
Requirements::javascript("marketplace/code/ui/frontend/js/oms.min.js");
Requirements::javascript("marketplace/code/ui/frontend/js/infobubble-compiled.js");
Requirements::javascript("marketplace/code/ui/frontend/js/google.maps.jquery.js");
Requirements::javascript('themes/openstack/javascript/Chart.js');
Requirements::javascript("gerrit_ingest/js/sangria.page.gerrit.statistics.report.js");
Requirements::css('gerrit_ingest/css/sangria.page.gerrit.statistics.report.css');
return $this->owner->getViewer('GerritStatisticsReport')->process($this->owner);
}
示例14: __construct
public function __construct($controller, $name, FieldList $fields, FieldList $actions, $validator = null, $Title = '', BootstrapModalFormAction $ModalFormAction)
{
parent::__construct($controller, $name, $fields, $actions, $validator, $Title, $ModalFormAction);
Requirements::block('BootstrapModalForm_hasErrorJs_' . $this->FormName());
Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery-form/jquery.form.js');
$name = $this->FormName();
$action = $this->FormAction();
$loading = _t('BootstrapAjaxModalForm.LOADING', 'BootstrapAjaxModalForm.LOADING');
$js = <<<JS
(function(\$){
\$(function(){
\$('#{$name}').ajaxForm({
delegation: true,
target: '#Modal_{$name} .modal-dialog .modal-content',
beforeSubmit: function(data, form, options){
\$('#{$name} [type=submit]').prop("disabled", true).html('{$loading}');
}
\t});
});
\$(function(){
\$('#Modal_{$name}').on('show.bs.modal', function(e){
\$('#Modal_{$name} .modal-dialog .modal-content').load('{$action}');
});
\$('#Modal_{$name}').on('hidden.bs.modal', function(e){
\$('#Modal_{$name} .modal-dialog .modal-content').html('');
});
});
})(jQuery);
JS;
Requirements::customScript($js, 'BootstrapAjaxModalForm_Js_' . $this->FormName());
if (Director::is_ajax()) {
$this->setTemplate('BootstrapAjaxModalForm');
}
}
示例15: init
function init()
{
parent::init();
// somehow themed css gets mixed in, remove it
$reqbe = Requirements::backend();
foreach ($reqbe->get_css() as $file => $val) {
if (preg_match('/^themes\\//', $file)) {
Requirements::block($file);
}
}
Requirements::javascript(THIRDPARTY_DIR . '/jquery-form/jquery.form.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-livequery/jquery.livequery.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.core.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.widget.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.mouse.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.tabs.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.button.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.position.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.dialog.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.draggable.js');
Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/base/jquery.ui.core.css');
Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/base/jquery.ui.dialog.css');
Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/base/jquery.ui.theme.css');
Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/base/jquery.ui.tabs.css');
Requirements::clear('jsparty/prototype.js');
Requirements::javascript(SAPPHIRE_DIR . "/javascript/i18n.js");
Requirements::add_i18n_javascript('dbplumber/javascript/lang');
Requirements::javascript("dbplumber/javascript/DatabaseBrowser.js");
Requirements::javascript("dbplumber/thirdparty/jquery.event.drag-1.4.js");
Requirements::javascript("dbplumber/thirdparty/jquery.kiketable.colsizable-1.1.js");
Requirements::javascript("dbplumber/thirdparty/jquery.textarea-expander.js");
Requirements::css("dbplumber/thirdparty/jquery.kiketable.colsizable-1.1.css");
Requirements::css("dbplumber/css/DatabaseBrowser_left.css");
Requirements::css("dbplumber/css/DatabaseBrowser_right.css");
}