<?php
defined('_JEXEC') or die('Restricted access');

/**
* @package OS CCK
* @copyright OrdaSoft.
* @author Andrey Kvasnevskiy(akbet@mail.ru),Roman Akoev (akoevroman@gmail.com)
* @link http://ordasoft.com/cck-content-construction-kit-for-joomla.html
* @description OrdaSoft Content Construction Kit
*/

require_once(JPATH_SITE . "/components/com_os_cck/functions.php");

//JHTML::_('behavior.modal', 'a.modal-button');
$doc = JFactory::getDocument();
includeJavaScriptCCK('components/com_os_cck/assets/js/functions.js');
includeStylesCCK('components/com_os_cck/assets/css/admin_style.css');

if (version_compare(JVERSION, "4.0.0-alpha10", "ge")) {
    includeStylesCCK("components/com_os_cck/assets/css/admin_style-j4.css");
}else{
    includeStylesCCK("components/com_os_cck/assets/css/admin_style-j3.css");
}
 

class JFormFieldStripeStatus extends JFormField{
  protected function getInput(){
    $db = JFactory::getDBO();
    $query = "SELECT name,enabled FROM #__extensions WHERE element='stripe'";
    $db->setQuery($query);
    $status = $db->loadObjectList();
    if(!isset($status[0])){
      $status = '<b style="color:red;">'.cck_lang_text("COM_OS_CCK_PARAMS_PAYPAL_NOT_INSTALL").'</b>';
    }else if($status[0]->enabled == 0){
      $status = '<b style="color:red;">'.cck_lang_text("COM_OS_CCK_PARAMS_2CHO_PLUGIN_NOT_ENABLE").'</b>';
    }else{
      $status = '<b style="color:green;">'.cck_lang_text("COM_OS_CCK_PARAMS_PAYPAL_PLUGIN_ENABLE").' [ '.$status[0]->name.' ]</b>';
    }
    return $status;
  }
}
