<?php

/**
 * @version     backend/classes/integrity.php 2015-02-16 14:15:00 UTC pav
 * @authorUrl   https://watchful.li
 * @copyright   Copyright (c) 2012-2015 watchful.li
 * @license     GNU/GPL v3 or later
 * @copyright   Copyright (c) 2012-2015 watchful.li
 * @license     GNU/GPL v3 or later
 */
defined('_JEXEC') or die('Restricted access');

class WatchfulliHelper
{

    function getMemoryLimitInBytes()
    {
        $memory_limit = ini_get('memory_limit');
        switch (substr($memory_limit, -1))
        {
            case 'K':
                $memory_limit = (int) $memory_limit * 1024;
                break;

            case 'M':
                $memory_limit = (int) $memory_limit * 1024 * 1024;
                break;

            case 'G':
                $memory_limit = (int) $memory_limit * 1024 * 1024 * 1024;
                break;
        }
        return $memory_limit;
    }
    
    function getCurrentJoomlaVersion()
    {
        $jversion = new JVersion();
        $current = $jversion->getShortVersion();
// workaround for DutchJoomla! and other variations
        if (strpos($current, ' ') !== false)
        {
            $current = reset(explode(' ', $current));
        }

        return $current;
    }

}
