jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/332963 )

Change subject: Remove unused form functions
......................................................................


Remove unused form functions

Not using the logger, form_errors, or getEscapedValue.

i10n TODO is done.

noScript is properly templatized now.
TODO: same thing with the verisign seal, if we're keeping it.

Change-Id: If1ca1ff53b949036ff427127e23b9b74f9e2353b
---
M gateway_forms/Form.php
M gateway_forms/Mustache.php
2 files changed, 2 insertions(+), 53 deletions(-)

Approvals:
  Cdentinger: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/gateway_forms/Form.php b/gateway_forms/Form.php
index 83bafd8..88032ea 100644
--- a/gateway_forms/Form.php
+++ b/gateway_forms/Form.php
@@ -1,17 +1,6 @@
 <?php
 
 abstract class Gateway_Form {
-       /**
-        * An array of form errors, passed from the gateway form object
-        * @var array
-        */
-       public $form_errors;
-
-       /**
-        * Gateway-specific logger
-        * @var \Psr\Log\LoggerInterface
-        */
-       protected $logger;
 
        /**
         * @var GatewayAdapter
@@ -22,6 +11,8 @@
         * @var GatewayPage
         */
        protected $gatewayPage;
+       // FIXME: decouple form rendering from both of the above.
+       // Instead, make a FormParameters class with errors, donor info, 
settings, etc.
 
        /**
         * @var string
@@ -46,40 +37,11 @@
 
        public function setGateway( GatewayType $gateway ) {
                $this->gateway = $gateway;
-               $this->logger = DonationLoggerFactory::getLogger( $gateway );
-               $gateway_errors = $this->gateway->getAllErrors();
-
-               // @codeCoverageIgnoreStart
-               if ( !is_array( $gateway_errors ) ){
-                       $gateway_errors = array();
-               }
-               // @codeCoverageIgnoreEnd
-
-               $this->form_errors = array_merge( 
DataValidator::getEmptyErrorArray(), $gateway_errors );
        }
 
        public function setGatewayPage( GatewayPage $gatewayPage ) {
                $this->gatewayPage = $gatewayPage;
                $this->scriptPath = 
$gatewayPage->getContext()->getConfig()->get( 'ScriptPath' );
-       }
-
-       /**
-        * Generate HTML for <noscript> tags
-        * For displaying when a user does not have Javascript enabled in their 
browser.
-        */
-       protected function getNoScript() {
-               $noScriptRedirect = $this->gateway->getGlobal( 
'NoScriptRedirect' );
-
-               $form = '<noscript>';
-               $form .= '<div id="noscript">';
-               $form .= '<p id="noscript-msg">' . wfMessage( 
'donate_interface-noscript-msg' )->escaped() . '</p>';
-               if ( $noScriptRedirect ) {
-                       $form .= '<p id="noscript-redirect-msg">' . wfMessage( 
'donate_interface-noscript-redirect-msg' )->escaped() . '</p>';
-                       $form .= '<p id="noscript-redirect-link"><a href="' . 
htmlspecialchars( $noScriptRedirect ) . '">' . htmlspecialchars( 
$noScriptRedirect ) . '</a></p>';
-               }
-               $form .= '</div>';
-               $form .= '</noscript>';
-               return $form;
        }
 
        /**
@@ -140,18 +102,6 @@
                $form .= '</tr>';
                $form .= '</table>';
                return $form;
-       }
-
-       /**
-        * Pulls normalized and escaped data from the $gateway object.
-        * For more information, see GatewayAdapter::getData_Unstaged_Escaped in
-        * $IP/extensions/DonationData/gateway_common/gateway.adapter.php
-        * @param string $key The value to fetch from the adapter.
-        * @return mixed The escaped value in the adapter, or null if none 
exists.
-        * Note: The value could still be a blank string in some cases.
-        */
-       protected function getEscapedValue( $key ) {
-               return $this->gateway->getData_Unstaged_Escaped( $key );
        }
 
        public function getResources() {
diff --git a/gateway_forms/Mustache.php b/gateway_forms/Mustache.php
index c23de07..7101c55 100644
--- a/gateway_forms/Mustache.php
+++ b/gateway_forms/Mustache.php
@@ -299,7 +299,6 @@
         * Get a message value specific to the donor's country and language.
         *
         * @param array $params first value is used as message key
-        * TODO: use the rest as message parameters
         * @return string
         */
        public static function l10n( $params ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/332963
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If1ca1ff53b949036ff427127e23b9b74f9e2353b
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg <eeggles...@wikimedia.org>
Gerrit-Reviewer: AndyRussG <andrew.green...@gmail.com>
Gerrit-Reviewer: Awight <awi...@wikimedia.org>
Gerrit-Reviewer: Cdentinger <cdentin...@wikimedia.org>
Gerrit-Reviewer: Ssmith <ssm...@wikimedia.org>
Gerrit-Reviewer: XenoRyet <dkozlow...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to