* Return whether user JavaScript is allowed for this page
* @deprecated since 1.18 Load modules with ResourceLoader, and origin and
* trustworthiness is identified and enforced automagically.
+ * Will be removed in 1.20.
* @return Boolean
*/
public function isUserJsAllowed() {
+ wfDeprecated( __METHOD__, '1.18' );
return $this->getAllowedModules( ResourceLoaderModule::TYPE_SCRIPTS ) >= ResourceLoaderModule::ORIGIN_USER_INDIVIDUAL;
}
$tpl->set( 'pagecss', false );
$tpl->set( 'usercss', false );
- $this->userjs = $this->userjsprev = false;
- # @todo FIXME: This is the only use of OutputPage::isUserJsAllowed() anywhere; can we
- # get rid of it? For that matter, why is any of this here at all?
- $this->setupUserJs( $out->isUserJsAllowed() );
- $tpl->setRef( 'userjs', $this->userjs );
- $tpl->setRef( 'userjsprev', $this->userjsprev );
+ $tpl->set( 'userjs', false );
+ $tpl->set( 'userjsprev', false );
$tpl->set( 'jsvarurl', false );
return $this->getTitle()->getNamespaceKey();
}
- /**
- * @private
- * @todo FIXME: Why is this duplicated in/from OutputPage::getHeadScripts()??
- */
- function setupUserJs( $allowUserJs ) {
- global $wgJsMimeType;
- wfProfileIn( __METHOD__ );
-
- if( $allowUserJs && $this->loggedin ) {
- if( $this->getTitle()->isJsSubpage() and $this->getOutput()->userCanPreview() ) {
- # XXX: additional security check/prompt?
- $this->userjsprev = '/*<![CDATA[*/ ' . $this->getRequest()->getText( 'wpTextbox1' ) . ' /*]]>*/';
- } else {
- $this->userjs = self::makeUrl( $this->userpage . '/' . $this->skinname . '.js', 'action=raw&ctype=' . $wgJsMimeType );
- }
- }
- wfProfileOut( __METHOD__ );
- }
-
public function commonPrintStylesheet() {
return false;
}