File manager - Edit - /home/opticamezl/www/newok/Helpers.zip
Back
PK �6�\=R�e e Googlemap.phpnu &1i� <?php /** * Google Map helper class * * @package Joomla * @subpackage Fabrik.helpers * @copyright Copyright (C) 2005-2016 Media A-Team, Inc. - All rights reserved. * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html */ namespace Fabrik\Helpers; // No direct access defined('_JEXEC') or die('Restricted access'); use \stdClass; /** * Google Map class * * @package Joomla * @subpackage Fabrik.helpers * @since 3.0 */ class Googlemap { /** * Set the google map style * * @param object $params Element/vis parameters (contains gmap_styles property as json string) * * @since 3.0.7 * * @return array Styles */ public static function styleJs($params) { $styles = $params->get('gmap_styles'); $styles = is_string($styles) ? json_decode($styles) : $styles; if (!$styles) { return array(); } // Map Feature type to style $features = $styles->style_feature; // What exactly to style in the feature type (road, fill, border etc) $elements = $styles->style_element; $styleKeys = $styles->style_styler_key; $styleValues = $styles->style_styler_value; // First merge any identical feature styles $stylers = array(); for ($i = 0; $i < count($features); $i ++) { $feature = ArrayHelper::getValue($features, $i); $element = ArrayHelper::getValue($elements, $i); $key = $feature . '|' . $element; if (!array_key_exists($key, $stylers)) { $stylers[$key] = array(); } $aStyle = new \stdClass; $styleKey = ArrayHelper::getValue($styleKeys, $i); $styleValue = ArrayHelper::getValue($styleValues, $i); if ($styleKey && $styleValue) { $aStyle->$styleKey = $styleValue; $stylers[$key][] = $aStyle; } } $return = array(); foreach ($stylers as $styleKey => $styler) { $o = new \stdClass; $bits = explode('|', $styleKey); if ( $bits[0] !== 'all') { $o->featureType = $bits[0]; } $o->elementType = $bits[1]; $o->stylers = $styler; $return[] = $o; } return $return; } } PK �6�\ CB�. �. ArrayHelper.phpnu &1i� <?php /** * Array helper class * * @package Joomla * @subpackage Fabrik.helpers * @copyright Copyright (C) 2005-2016 Media A-Team, Inc. - All rights reserved. * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html */ namespace Fabrik\Helpers; // No direct access defined('_JEXEC') or die('Restricted access'); use \stdClass; /** * Array helper class * * @package Joomla * @subpackage Fabrik.helpers * @since 3.0 */ class ArrayHelper { /** * Get a value from a nested array * * @param array $array Data to search * @param string $key Search key, use key.dot.format to get nested value * @param string $default Default value if key not found * @param bool $allowObjects Should objects found in $array be converted into arrays * * @return mixed */ public static function getNestedValue($array, $key, $default = null, $allowObjects = false) { $keys = explode('.', $key); foreach ($keys as $key) { if (is_object($array) && $allowObjects) { $array = self::fromObject($array); } if (!is_array($array)) { return $default; } if (array_key_exists($key, $array)) { $array = $array[$key]; } else { return $default; } } return $array; } /** * update the data that gets posted via the form and stored by the form * model. Used in elements to modify posted data see fabrikfileupload * * @param array &$array array to set value for * @param string $key (in key.dot.format) to set a recursive array * @param string $val value to set key to * * @return null */ public static function setValue(&$array, $key, $val) { if (strstr($key, '.')) { $nodes = explode('.', $key); $count = count($nodes); $pathNodes = $count - 1; if ($pathNodes < 0) { $pathNodes = 0; } $ns = $array; for ($i = 0; $i <= $pathNodes; $i++) { /** * If any node along the registry path does not exist, create it * if (!isset($this->formData[$nodes[$i]])) { //this messed up for joined data */ if (!isset($ns[$nodes[$i]])) { $ns[$nodes[$i]] = array(); } $ns = $ns[$nodes[$i]]; } $ns = $val; $ns = $array; for ($i = 0; $i <= $pathNodes; $i++) { /** * If any node along the registry path does not exist, create it * if (!isset($this->formData[$nodes[$i]])) { //this messed up for joined data */ if (!isset($ns[$nodes[$i]])) { $ns[$nodes[$i]] = array(); } $ns = $ns[$nodes[$i]]; } $ns = $val; } else { $array[$key] = $val; } } /** * Utility function to map an array to a stdClass object. * * @param array &$array The array to map. * @param string $class Name of the class to create * @param bool $recurse into each value and set any arrays to objects * * @return object The object mapped from the given array * * @since 1.5 */ public static function toObject(&$array, $class = 'stdClass', $recurse = true) { $obj = null; if (is_array($array)) { $obj = new $class; foreach ($array as $k => $v) { if (is_array($v) && $recurse) { $obj->$k = self::toObject($v, $class); } else { $obj->$k = $v; } } } return $obj; } /** * returns copy of array $ar1 with those entries removed * whose keys appear as keys in any of the other function args * * @param array $ar1 first array * @param array $ar2 second array * * @return array */ public function array_key_diff($ar1, $ar2) { /** * , $ar3, $ar4, ... * */ $aSubtrahends = array_slice(func_get_args(), 1); foreach ($ar1 as $key => $val) { foreach ($aSubtrahends as $aSubtrahend) { if (array_key_exists($key, $aSubtrahend)) { unset($ar1[$key]); } } } return $ar1; } /** * filters array of objects removing those when key does not match * the value * * @param array &$array of objects - passed by ref * @param string $key to search on * @param string $value of key to keep from array * * @return unknown_type */ public static function filter(&$array, $key, $value) { for ($i = count($array) - 1; $i >= 0; $i--) { if ($array[$i]->$key !== $value) { unset($array[$i]); } } } /** * get the first object in an array whose key = value * * @param array $array of objects * @param string $key to search on * @param string $value to search on * * @return mixed value or false */ public function get($array, $key, $value) { for ($i = count($array) - 1; $i >= 0; $i--) { if ($array[$i]->$key == $value) { return $array[$i]; } } return false; } /** * Extract an array of single property values from an array of objects * * @param array $array the array of objects to search * @param string $key the key to extract the values on. * * @return array of single key values */ public static function extract($array, $key) { $return = array(); foreach ($array as $object) { $return[] = $object->$key; } return $return; } /** * Returns first key in an array, used if we aren't sure if array is assoc or * not, and just want the first row. * * @param array $array the array to get the first key for * * @since 3.0.6 * * @return string the first array key. */ public static function firstKey($array) { reset($array); return key($array); } /** * Array is empty, or only has one entry which itself is an empty string * * @param array $array The array to test * @param bool $even_emptierish If true, use empty() to test single key, if false only count empty string or null as empty * * @since 3.0.8 * * @return bool is array empty(ish) */ public static function emptyIsh($array, $even_emptierish = false) { if (empty($array)) { return true; } if (count($array) > 1) { return false; } $val = self::getValue($array, self::firstKey($array), ''); return $even_emptierish ? empty($val) : $val === '' || !isset($val); } /** * Workaround for J! 3.4 change in FArrayHelper::getValue(), which now forces $array to be, well, an array. * We've been a bit naughty and using it for things like SimpleXMLElement. So for J! 3.4 release, 2/25/2015, * globally replaced all use of JArrayHelper::getValue() with FArrayHelper::getValue(). This code is just a * copy of the J! code, it just doesn't specify "array $array". * * @param array &$array A named array * @param string $name The key to search for * @param mixed $default The default value to give if no key found * @param string $type Return type for the variable (INT, FLOAT, STRING, WORD, BOOLEAN, ARRAY) * * @return mixed The value from the source array */ public static function getValue(&$array, $name, $default = null, $type = '') { if (is_object($array)) { $array = self::fromObject($array); } $result = null; if (isset($array[$name])) { $result = $array[$name]; } // Handle the default case if (is_null($result)) { $result = $default; } // Handle the type constraint switch (strtoupper($type)) { case 'INT': case 'INTEGER': // Only use the first integer value @preg_match('/-?[0-9]+/', $result, $matches); $result = @(int) $matches[0]; break; case 'FLOAT': case 'DOUBLE': // Only use the first floating point value @preg_match('/-?[0-9]+(\.[0-9]+)?/', $result, $matches); $result = @(float) $matches[0]; break; case 'BOOL': case 'BOOLEAN': $result = (bool) $result; break; case 'ARRAY': if (!is_array($result)) { $result = array($result); } break; case 'STRING': $result = (string) $result; break; case 'WORD': $result = (string) preg_replace('#\W#', '', $result); break; case 'NONE': default: // No casting necessary break; } return $result; } /** * * Wrapper for srray_fill, 'cos PHP <5.6 tosses a warning if $num is not positive, * and we often call it with 0 length * * @param int $start_index * @param int $num * @param mixed $value * * @return array */ public static function array_fill($start_index, $num, $value) { if ($num > 0) { return array_fill($start_index, $num, $value); } else { return array(); } } /** * Utility function to map an object to an array * * @param object $p_obj The source object * @param boolean $recurse True to recurse through multi-level objects * @param string $regex An optional regular expression to match on field names * * @return array * * @since 1.0 */ public static function fromObject($p_obj, $recurse = true, $regex = null) { if (is_object($p_obj) || is_array($p_obj)) { return self::arrayFromObject($p_obj, $recurse, $regex); } return array(); } /** * Utility function to map an object or array to an array * * @param mixed $item The source object or array * @param boolean $recurse True to recurse through multi-level objects * @param string $regex An optional regular expression to match on field names * * @return array * * @since 1.0 */ private static function arrayFromObject($item, $recurse, $regex) { if (is_object($item)) { $result = array(); foreach (get_object_vars($item) as $k => $v) { if (!$regex || preg_match($regex, $k)) { if ($recurse) { $result[$k] = self::arrayFromObject($v, $recurse, $regex); } else { $result[$k] = $v; } } } return $result; } if (is_array($item)) { $result = array(); foreach ($item as $k => $v) { $result[$k] = self::arrayFromObject($v, $recurse, $regex); } return $result; } return $item; } /** * Wrapper for standard array_chunk that allows for flipping a grid. So without flipping, chunking ... * * 1, 2, 3, 4, 5 * * ... into a chunksize of 2 becomes ... * * 1, 2 * 3, 4 * 5 * * With flipping, it becomes ... * * 1, 4 * 2, 5 * 3 * * This is useful for building Bootstrap style grids from unchunked arrays. * * @param $array * @param $cols * @param bool $flip * * @return array * * @since 3.8 */ public static function chunk($array, $cols, $flip = false) { $chunked = array_chunk($array, $cols); if ($flip) { $rows = count($chunked); $ridx = 0; $cidx = 0; $flipped = array(); foreach($chunked as $row) { foreach($row as $val) { $flipped[$ridx][$cidx] = $val; $ridx++; if($ridx >= $rows) { $cidx++; $ridx = 0; } } } return $flipped; } return $chunked; } } PK �6�\ ��}� � Uploader.phpnu &1i� <?php /** * Fabrik upload helper * * @package Joomla * @subpackage Fabrik * @copyright Copyright (C) 2005-2016 Media A-Team, Inc. - All rights reserved. * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html */ namespace Fabrik\Helpers; // No direct access defined('_JEXEC') or die('Restricted access'); use JFactory; use JFile; use JFolder; use Joomla\Registry\Registry; use RuntimeException; /** * Fabrik upload helper * * @package Joomla * @subpackage Fabrik * @since 3.0 */ class Uploader extends \JObject { /** * Form model * * @var object */ protected $form = null; /** * Move uploaded file error * * @var bool */ public $moveError = false; /** * Upload * * @param object $formModel form model */ public function __construct($formModel) { $this->form = $formModel; } /** * Perform upload of files * * @return bool true if error occurred */ public function upload() { $groups = $this->form->getGroupsHiarachy(); foreach ($groups as $groupModel) { $elementModels = $groupModel->getPublishedElements(); foreach ($elementModels as $elementModel) { if ($elementModel->isUpload()) { $elementModel->processUpload(); } } } } /** * Moves a file from one location to another * * @param string $pathFrom File to move * @param string $pathTo Location to move file to * @param bool $overwrite Should we overwrite existing files * * @deprecated (don't think its used) * * @return bool do we overwrite any existing files found at pathTo? */ public function move($pathFrom, $pathTo, $overwrite = true) { if (file_exists($pathTo)) { if ($overwrite) { unlink($pathTo); $ok = rename($pathFrom, $pathTo); } else { $ok = false; } } else { $ok = rename($pathFrom, $pathTo); } return $ok; } /** * Make a recursive folder structure * * @param string $folderPath Path to folder - e.g. /images/stories * @param hex $mode Folder permissions * * @return void */ public function _makeRecursiveFolders($folderPath, $mode = 0755) { if (!JFolder::exists($folderPath)) { if (!JFolder::create($folderPath, $mode)) { throw new RuntimeException("Could not make dir $folderPath "); } } } /** * Iterates through $_FILE data to see if any files have been uploaded * * @deprecated (don't see it being used) * * @return bool true if files uploaded */ public function check() { if (isset($_FILES) and !empty($_FILES)) { foreach ($_FILES as $f) { if ($f['name'] != '') { return true; } } } return false; } /** * Checks if the file can be uploaded * * @param array $file File information * @param string &$err An error message to be returned * @param Registry &$params Params * * @return bool */ public static function canUpload($file, &$err, &$params) { if (empty($file['name'])) { $err = 'Please input a file for upload'; return false; } if (!is_uploaded_file($file['tmp_name'])) { // Handle potential malicious attack $err = Text::_('File has not been uploaded'); return false; } jimport('joomla.filesystem.file'); $format = StringHelper::strtolower(JFile::getExt($file['name'])); $allowable = explode(',', StringHelper::strtolower($params->get('ul_file_types'))); $format = StringHelper::ltrimword($format, '.'); $format2 = ".$format"; if (!in_array($format, $allowable) && !in_array($format2, $allowable)) { $err = 'WARNFILETYPE'; return false; } $maxSize = (int) $params->get('upload_maxsize', 0); if ($maxSize > 0 && (int) $file['size'] > $maxSize) { $err = 'WARNFILETOOLARGE'; return false; } $ignored = array(); $user = JFactory::getUser(); $imginfo = null; if ($params->get('restrict_uploads', 1)) { $images = explode(',', $params->get('image_extensions')); if (in_array($format, $images)) { // If its an image run it through getimagesize if (($imginfo = getimagesize($file['tmp_name'])) === false) { $err = 'WARNINVALIDIMG'; return false; } } elseif (!in_array($format, $ignored)) { // If its not an image...and we're not ignoring it } } $xss_check = file_get_contents($file['tmp_name'], false, null, 0, 256); $html_tags = array('abbr', 'acronym', 'address', 'applet', 'area', 'audioscope', 'base', 'basefont', 'bdo', 'bgsound', 'big', 'blackface', 'blink', 'blockquote', 'body', 'bq', 'br', 'button', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'comment', 'custom', 'dd', 'del', 'dfn', 'dir', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'fn', 'font', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'hr', 'html', 'iframe', 'ilayer', 'img', 'input', 'ins', 'isindex', 'keygen', 'kbd', 'label', 'layer', 'legend', 'li', 'limittext', 'link', 'listing', 'map', 'marquee', 'menu', 'meta', 'multicol', 'nobr', 'noembed', 'noframes', 'noscript', 'nosmartquotes', 'object', 'ol', 'optgroup', 'option', 'param', 'plaintext', 'pre', 'rt', 'ruby', 's', 'samp', 'script', 'select', 'server', 'shadow', 'sidebar', 'small', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'tt', 'ul', 'var', 'wbr', 'xml', 'xmp', '!DOCTYPE', '!--'); foreach ($html_tags as $tag) { // A tag is '<tagname ', so we need to add < and a space or '<tagname>' if (StringHelper::stristr($xss_check, '<' . $tag . ' ') || StringHelper::stristr($xss_check, '<' . $tag . '>')) { $err = 'WARNIEXSS'; return false; } } return true; } /** * Recursive file name incrementation until no file with existing name * exists * * @param string $origFileName Initial file name * @param string $newFileName This recursions file name * @param int $version File version * @params object $storage Storage adapter * * @return string New file name */ public static function incrementFileName($origFileName, $newFileName, $version, $storage) { if ($storage->exists($newFileName)) { $bits = explode('.', $newFileName); $ext = array_pop($bits); $f = implode('.', $bits); $f = StringHelper::rtrim($f, $version - 1); $newFileName = $f . $version . "." . $ext; $version++; $newFileName = self::incrementFileName($origFileName, $newFileName, $version, $storage); } return $newFileName; } } PK �6�\Ӛ��� � Lizt.phpnu &1i� <?php /** * List Helper class * * @package Joomla * @subpackage Fabrik.helpers * @copyright Copyright (C) 2005-2016 Media A-Team, Inc. - All rights reserved. * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html */ namespace Fabrik\Helpers; // No direct access defined('_JEXEC') or die('Restricted access'); /** * List Helper class * * @package Joomla * @subpackage Fabrik.helpers * @since 3.0.6 */ class Lizt { /** * Get a list of elements which match a set of criteria * * @param object $listModel list model to search * @param array $filter array of element properties to match on * * @throws \Exception * * @return array */ public static function getElements($listModel, $filter = array()) { $found = array(); $groups = $listModel->getFormGroupElementData(); foreach ($groups as $groupModel) { $elementModels = $groupModel->getMyElements(); foreach ($elementModels as $elementModel) { $item = $elementModel->getElement(); $ok = true; foreach ($filter as $key => $val) { if ($item->$key != $val) { $ok = false; } } if ($ok) { $found[] = $elementModel; } } } if (empty($found)) { $filterNames = implode(', ', $filter); throw new \Exception(Text::sprintf('COM_FABRIK_ERR_NO_ELEMENTS_MATCHED_FILTER', $filterNames)); } return $found; } } PK �6�\��\?* * LayoutFile.phpnu &1i� <?php /** * @package Joomla.Libraries * @subpackage Layout * * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Fabrik\Helpers; use Joomla\CMS\Layout\FileLayout; use \JLoader; use \JPath; defined('JPATH_BASE') or die; /** * Base class for rendering a display layout * loaded from from a layout file * * @package Joomla.Libraries * @subpackage Layout * @see http://docs.joomla.org/Sharing_layouts_across_views_or_extensions_with_JLayout * @since 3.0 */ class LayoutFile extends \JLayoutFile { /** * Method to finds the full real file path, checking possible overrides * * @return string The full path to the layout file * * @since 3.0 */ protected function getPath() { \JLoader::import('joomla.filesystem.path'); $layoutId = $this->getLayoutId(); $includePaths = $this->getIncludePaths(); $suffixes = $this->getSuffixes(); $this->addDebugMessage('<strong>Layout:</strong> ' . $this->layoutId); if (!$layoutId) { $this->addDebugMessage('<strong>There is no active layout</strong>'); return; } if (!$includePaths) { $this->addDebugMessage('<strong>There are no folders to search for layouts:</strong> ' . $layoutId); return; } $hash = md5( json_encode( array( 'paths' => $includePaths, 'suffixes' => $suffixes, ) ) ); if (isset(static::$cache[$layoutId][$hash])) { $this->addDebugMessage('<strong>Cached path:</strong> ' . static::$cache[$layoutId][$hash]); return static::$cache[$layoutId][$hash]; } $this->addDebugMessage('<strong>Include Paths:</strong> ' . print_r($includePaths, true)); // Search for suffixed versions. Example: tags.j31.php if ($suffixes) { $this->addDebugMessage('<strong>Suffixes:</strong> ' . print_r($suffixes, true)); foreach ($suffixes as $suffix) { $rawPath = str_replace('.', '/', $this->layoutId) . '.' . $suffix . '.php'; $this->addDebugMessage('<strong>Searching layout for:</strong> ' . $rawPath); if ($foundLayout = \JPath::find($this->includePaths, $rawPath)) { $this->addDebugMessage('<strong>Found layout:</strong> ' . $this->fullPath); static::$cache[$layoutId][$hash] = $foundLayout; return static::$cache[$layoutId][$hash]; } } } // Standard version $rawPath = str_replace('.', '/', $this->layoutId) . '.php'; $this->addDebugMessage('<strong>Searching layout for:</strong> ' . $rawPath); $foundLayout = \JPath::find($this->includePaths, $rawPath); if (!$foundLayout) { $this->addDebugMessage('<strong>Unable to find layout: </strong> ' . $layoutId); static::$cache[$layoutId][$hash] = ''; return; } $this->addDebugMessage('<strong>Found layout:</strong> ' . $foundLayout); static::$cache[$layoutId][$hash] = $foundLayout; return static::$cache[$layoutId][$hash]; } } PK �6�\�gZw� � Image.phpnu &1i� <?php /** * Image manipulation helper * * @package Joomla * @subpackage Fabrik.helpers * @copyright Copyright (C) 2005-2015 fabrikar.com - All rights reserved. * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html */ namespace Fabrik\Helpers; // No direct access use \RuntimeException; use \JHtml; /** * Image manipulation class * * @package Joomla * @subpackage Fabrik.helpers * @copyright Copyright (C) 2005-2015 fabrikar.com - All rights reserved. * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html * @since 1.0 */ class Image { /** * Get an array of available graphics libraries * * @return array */ public static function getLibs() { $libs = array(); $gds = self::testGD(); foreach ($gds as $key => $val) { $libs[] = JHtml::_('select.option', $key, $val); } $im = self::testImagemagick(); foreach ($im as $key => $val) { $libs[] = JHtml::_('select.option', $key, $val); } return $libs; } /** * load in the correct image library * * @param string $lib image lib to load * * @throws RuntimeException * * @return \Fabrik\Helpers\Image\Image image lib */ public static function loadLib($lib) { if ($lib === 'value') { throw new RuntimeException("Fabrik: No image image processing library is available, make sure GD is installed in PHP and check your upload element settings!"); } $className = '\Fabrik\Helpers\Image\Image' . strtolower($lib); try { $class = new $className; } catch (RuntimeException $e) { throw new RuntimeException("Fabrik: can't load image class: $className"); } return $class; } /** * Test if the GD library is available * * @return array */ protected static function testGD() { $gd = array(); $gdVersion = null; $gdInfo = null; if (function_exists('gd_info')) { $gdInfo = gd_info(); $gdVersion = $gdInfo['GD Version']; } else { ob_start(); @phpinfo(INFO_MODULES); $output = ob_get_contents(); ob_end_clean(); $matches[1] = ''; if ($output !== '') { if (preg_match("/GD Version[ \t]*(<[^>]+>[ \t]*)+([^<>]+)/s", $output, $matches)) { $gdVersion = $matches[2]; } else { return $gd; } } } if (function_exists('imagecreatetruecolor') && function_exists('imagecreatefromjpeg')) { $gdVersion = isset($gdVersion) ? $gdVersion : 2; $gd['gd2'] = "GD: " . $gdVersion; } elseif (function_exists('imagecreatefromjpeg')) { $gdVersion = isset($gdVersion) ? $gdVersion : 1; $gd['gd1'] = "GD: " . $gdVersion; } return $gd; } /** * Test if Imagemagick is installed on the server * * @return array */ protected static function testImagemagick() { $im = array(); if (function_exists('NewMagickWand')) { $im['IM'] = 'Magick wand'; } else { /* $status = ''; $output = array(); @exec('convert -version', $output, $status); $im = array(); if ($status && class_exists('Imagick')) { if (preg_match("/imagemagick[ \t]+([0-9\.]+)/i", $output[0], $matches)) { $im['IM'] = $matches[0]; } } unset($output, $status); */ if (class_exists('Imagick')) { $im['IM'] = 'Imagick'; } } return $im; } } PK �6�\K��)h h Stripe.phpnu &1i� <?php /** * PDF Set up helper * * @package Joomla * @subpackage Fabrik.helpers * @copyright Copyright (C) 2005-2016 Media A-Team, Inc. - All rights reserved. * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html */ namespace Fabrik\Helpers; // No direct access defined('_JEXEC') or die('Restricted access'); /** * Stripe set up helper * * @package Joomla * @subpackage Fabrik.helpers * @since 3.1rc3 */ class Stripe { /** * Setup Stripe API * * @param object $puke throw exception if not installed (true) or just return false * * @return bool */ public static function setupStripe(\Joomla\Registry\Registry $params, $plugin) { $testMode = $params->get($plugin . '_test_mode', '0') === '1'; if ($testMode) { $secretKey = trim($params->get($plugin . '_test_secret_key', '')); } else { $secretKey = trim($params->get($plugin . '_secret_key', '')); } if (empty($secretKey)) { return false; } \Stripe\Stripe::setApiKey($secretKey); \Stripe\Stripe::setApiVersion('2018-01-23'); \Stripe\Stripe::setAppInfo( "Joomla Fabrik " . $plugin, "3.8.0", "http://fabrikar.com" ); /* try { $balance = \Stripe\Balance::retrieve(); } catch (\Exception $e) { return false; } */ return true; } } PK �6�\�b��"