当前位置: 首页>>代码示例>>PHP>>正文


PHP UploadBase::stashSession方法代码示例

本文整理汇总了PHP中UploadBase::stashSession方法的典型用法代码示例。如果您正苦于以下问题:PHP UploadBase::stashSession方法的具体用法?PHP UploadBase::stashSession怎么用?PHP UploadBase::stashSession使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UploadBase的用法示例。


在下文中一共展示了UploadBase::stashSession方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: stashSession

 /**
  * There is no need to stash the image twice
  */
 public function stashSession($key = null)
 {
     if (!empty($this->mSessionKey)) {
         return $this->mSessionKey;
     }
     return parent::stashSession();
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:10,代码来源:UploadFromStash.php

示例2: showUploadWarning

 /**
  * Stashes the upload, shows the main form, but adds a "continue anyway button".
  * Also checks whether there are actually warnings to display.
  *
  * @param array $warnings
  * @return bool True if warnings were displayed, false if there are no
  *   warnings and it should continue processing
  */
 protected function showUploadWarning($warnings)
 {
     # If there are no warnings, or warnings we can ignore, return early.
     # mDestWarningAck is set when some javascript has shown the warning
     # to the user. mForReUpload is set when the user clicks the "upload a
     # new version" link.
     if (!$warnings || count($warnings) == 1 && isset($warnings['exists']) && ($this->mDestWarningAck || $this->mForReUpload)) {
         return false;
     }
     $sessionKey = $this->mUpload->stashSession();
     // Add styles for the warning, reused from the live preview
     $this->getOutput()->addModuleStyles('mediawiki.special.upload');
     $warningHtml = '<h2>' . $this->msg('uploadwarning')->escaped() . "</h2>\n" . '<div class="mw-destfile-warning"><ul>';
     foreach ($warnings as $warning => $args) {
         if ($warning == 'badfilename') {
             $this->mDesiredDestName = Title::makeTitle(NS_FILE, $args)->getText();
         }
         if ($warning == 'exists') {
             $msg = "\t<li>" . self::getExistsWarning($args) . "</li>\n";
         } elseif ($warning == 'was-deleted') {
             # If the file existed before and was deleted, warn the user of this
             $ltitle = SpecialPage::getTitleFor('Log');
             $llink = Linker::linkKnown($ltitle, wfMessage('deletionlog')->escaped(), [], ['type' => 'delete', 'page' => Title::makeTitle(NS_FILE, $args)->getPrefixedText()]);
             $msg = "\t<li>" . wfMessage('filewasdeleted')->rawParams($llink)->parse() . "</li>\n";
         } elseif ($warning == 'duplicate') {
             $msg = $this->getDupeWarning($args);
         } elseif ($warning == 'duplicate-archive') {
             if ($args === '') {
                 $msg = "\t<li>" . $this->msg('file-deleted-duplicate-notitle')->parse() . "</li>\n";
             } else {
                 $msg = "\t<li>" . $this->msg('file-deleted-duplicate', Title::makeTitle(NS_FILE, $args)->getPrefixedText())->parse() . "</li>\n";
             }
         } else {
             if ($args === true) {
                 $args = [];
             } elseif (!is_array($args)) {
                 $args = [$args];
             }
             $msg = "\t<li>" . $this->msg($warning, $args)->parse() . "</li>\n";
         }
         $warningHtml .= $msg;
     }
     $warningHtml .= "</ul></div>\n";
     $warningHtml .= $this->msg('uploadwarning-text')->parseAsBlock();
     $form = $this->getUploadForm($warningHtml, $sessionKey, true);
     $form->setSubmitText($this->msg('upload-tryagain')->text());
     $form->addButton(['name' => 'wpUploadIgnoreWarning', 'value' => $this->msg('ignorewarning')->text()]);
     $form->addButton(['name' => 'wpCancelUpload', 'value' => $this->msg('reuploaddesc')->text()]);
     $this->showUploadForm($form);
     # Indicate that we showed a form
     return true;
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:60,代码来源:SpecialUpload.php

示例3: showUploadWarning

	/**
	 * Stashes the upload, shows the main form, but adds a "continue anyway button".
	 * Also checks whether there are actually warnings to display.
	 *
	 * @param $warnings Array
	 * @return boolean true if warnings were displayed, false if there are no
	 *         warnings and it should continue processing
	 */
	protected function showUploadWarning( $warnings ) {
		# If there are no warnings, or warnings we can ignore, return early.
		# mDestWarningAck is set when some javascript has shown the warning
		# to the user. mForReUpload is set when the user clicks the "upload a
		# new version" link.
		if ( !$warnings || ( count( $warnings ) == 1 &&
			isset( $warnings['exists'] ) &&
			( $this->mDestWarningAck || $this->mForReUpload ) ) )
		{
			return false;
		}

		$sessionKey = $this->mUpload->stashSession();

		$warningHtml = '<h2>' . $this->msg( 'uploadwarning' )->escaped() . "</h2>\n"
			. '<ul class="warning">';
		foreach ( $warnings as $warning => $args ) {
			if ( $warning == 'badfilename' ) {
				$this->mDesiredDestName = Title::makeTitle( NS_FILE, $args )->getText();
			}
			if ( $warning == 'exists' ) {
				$msg = "\t<li>" . self::getExistsWarning( $args ) . "</li>\n";
			} elseif ( $warning == 'duplicate' ) {
				$msg = $this->getDupeWarning( $args );
			} elseif ( $warning == 'duplicate-archive' ) {
				$msg = "\t<li>" . $this->msg( 'file-deleted-duplicate',
						Title::makeTitle( NS_FILE, $args )->getPrefixedText() )->parse()
					. "</li>\n";
			} else {
				if ( $args === true ) {
					$args = array();
				} elseif ( !is_array( $args ) ) {
					$args = array( $args );
				}
				$msg = "\t<li>" . $this->msg( $warning, $args )->parse() . "</li>\n";
			}
			$warningHtml .= $msg;
		}
		$warningHtml .= "</ul>\n";
		$warningHtml .= $this->msg( 'uploadwarning-text' )->parseAsBlock();

		$form = $this->getUploadForm( $warningHtml, $sessionKey, /* $hideIgnoreWarning */ true );
		$form->setSubmitText( $this->msg( 'upload-tryagain' )->text() );
		$form->addButton( 'wpUploadIgnoreWarning', $this->msg( 'ignorewarning' )->text() );
		$form->addButton( 'wpCancelUpload', $this->msg( 'reuploaddesc' )->text() );

		$this->showUploadForm( $form );

		# Indicate that we showed a form
		return true;
	}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:59,代码来源:SpecialUpload.php


注:本文中的UploadBase::stashSession方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。