Ejemplo n.º 1
0
 /**
  * Get plugin status
  *
  * - Check compatibility
  * - Check Mollie API connectivity
  *
  * @return string
  */
 protected function getPluginStatus()
 {
     $status = Mollie_WC_Plugin::getStatusHelper();
     if (!$status->isCompatible()) {
         // Just stop here!
         return '' . '<div id="message" class="error fade">' . ' <strong>' . __('Error', 'mollie-payments-for-woocommerce') . ':</strong> ' . implode('<br/>', $status->getErrors()) . '</div>';
     }
     try {
         // Check compatibility
         $status->getMollieApiStatus();
         $api_status = '' . '<p>' . __('Mollie status:', 'mollie-payments-for-woocommerce') . ' <span style="color:green; font-weight:bold;">' . __('Connected', 'mollie-payments-for-woocommerce') . '</span>' . '</p>';
         $api_status_type = 'updated';
     } catch (Mollie_WC_Exception_CouldNotConnectToMollie $e) {
         $api_status = '' . '<p style="font-weight:bold;"><span style="color:red;">Communicating with Mollie failed:</span> ' . esc_html($e->getMessage()) . '</p>' . '<p>Please check the following conditions. You can ask your system administrator to help with this.</p>' . '<ul style="color: #2D60B0;">' . ' <li>Please check if you\'ve inserted your API key correctly.</li>' . ' <li>Make sure outside connections to <strong>' . esc_html(Mollie_WC_Helper_Api::getApiEndpoint()) . '</strong> are not blocked.</li>' . ' <li>Make sure SSL v3 is disabled on your server. Mollie does not support SSL v3.</li>' . ' <li>Make sure your server is up-to-date and the latest security patches have been installed.</li>' . '</ul><br/>' . '<p>Please contact <a href="mailto:info@mollie.com">info@mollie.com</a> if this still does not fix your problem.</p>';
         $api_status_type = 'error';
     } catch (Mollie_WC_Exception_InvalidApiKey $e) {
         $api_status = '<p style="color:red; font-weight:bold;">' . esc_html($e->getMessage()) . '</p>';
         $api_status_type = 'error';
     }
     return '' . '<div id="message" class="' . $api_status_type . ' fade">' . $api_status . '</div>';
 }