Skip to content

Commit

Permalink
Updated with JCB v2.10.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Llewellynvdm committed Jan 5, 2020
1 parent 0ea8a25 commit 8275919
Show file tree
Hide file tree
Showing 39 changed files with 1,314 additions and 237 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,38 @@ The best way to see all your options is to install this component on you Joomla
+ *Author*: [Llewellyn van der Merwe](mailto:[email protected])
+ *Name*: [Sermon Distributor](https://www.vdm.io/)
+ *First Build*: 22nd October, 2015
+ *Last Build*: 14th August, 2019
+ *Last Build*: 5th January, 2020
+ *Version*: 2.0.x
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html

## Build Time :hourglass:

**189 Hours** or **24 Eight Hour Days** (actual time the author saved -
**192 Hours** or **24 Eight Hour Days** (actual time the author saved -
due to [Automated Component Builder](https://www.vdm.io/joomla-component-builder))

> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> never making one mistake or taking any coffee break.)
+ *Line count*: **67680**
+ *Line count*: **68757**
+ *File count*: **445**
+ *Folder count*: **93**

**124 Hours** or **15 Eight Hour Days** (the actual time the author spent)
**126 Hours** or **16 Eight Hour Days** (the actual time the author spent)

> (with the following break down:
> **debugging @47hours** = codingtime / 4;
> **debugging @48hours** = codingtime / 4;
> **planning @27hours** = codingtime / 7;
> **mapping @19hours** = codingtime / 10;
> **office @31hours** = codingtime / 6;)
> **office @32hours** = codingtime / 6;)
**313 Hours** or **39 Eight Hour Days**
**318 Hours** or **40 Eight Hour Days**
(a total of the realistic time frame for this project)

> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)
Project duration: **7.8 weeks** or **1.6 months**
Project duration: **8 weeks** or **1.7 months**

> This **component** was build with a Joomla [Automated Component Builder](https://www.vdm.io/joomla-component-builder).
> Developed by [Llewellyn van der Merwe](mailto:[email protected])
Expand Down
16 changes: 8 additions & 8 deletions admin/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,38 @@ The best way to see all your options is to install this component on you Joomla
+ *Author*: [Llewellyn van der Merwe](mailto:[email protected])
+ *Name*: [Sermon Distributor](https://www.vdm.io/)
+ *First Build*: 22nd October, 2015
+ *Last Build*: 14th August, 2019
+ *Last Build*: 5th January, 2020
+ *Version*: 2.0.x
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html

## Build Time :hourglass:

**189 Hours** or **24 Eight Hour Days** (actual time the author saved -
**192 Hours** or **24 Eight Hour Days** (actual time the author saved -
due to [Automated Component Builder](https://www.vdm.io/joomla-component-builder))

> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> never making one mistake or taking any coffee break.)

+ *Line count*: **67680**
+ *Line count*: **68757**
+ *File count*: **445**
+ *Folder count*: **93**

**124 Hours** or **15 Eight Hour Days** (the actual time the author spent)
**126 Hours** or **16 Eight Hour Days** (the actual time the author spent)

> (with the following break down:
> **debugging @47hours** = codingtime / 4;
> **debugging @48hours** = codingtime / 4;
> **planning @27hours** = codingtime / 7;
> **mapping @19hours** = codingtime / 10;
> **office @31hours** = codingtime / 6;)
> **office @32hours** = codingtime / 6;)

**313 Hours** or **39 Eight Hour Days**
**318 Hours** or **40 Eight Hour Days**
(a total of the realistic time frame for this project)

> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)

Project duration: **7.8 weeks** or **1.6 months**
Project duration: **8 weeks** or **1.7 months**

> This **component** was build with a Joomla [Automated Component Builder](https://www.vdm.io/joomla-component-builder).
> Developed by [Llewellyn van der Merwe](mailto:[email protected])
Expand Down
4 changes: 2 additions & 2 deletions admin/controllers/ajax.json.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public function ajax()
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
$idNameValue = $jinput->get('idName', NULL, 'WORD');
$ojectValue = $jinput->get('oject', NULL, 'STRING');
if($idNameValue && $ojectValue && $user->id != 0)
if($idNameValue && $user->id != 0 && $ojectValue)
{
$result = $this->getModel('ajax')->getBuildTable($idNameValue, $ojectValue);
}
Expand Down Expand Up @@ -257,7 +257,7 @@ public function ajax()
$targetValue = $jinput->get('target', NULL, 'INT');
$typeValue = $jinput->get('type', NULL, 'INT');
$sleutelValue = $jinput->get('sleutel', NULL, 'CMD');
if($idValue && $targetValue && $typeValue && $sleutelValue && $user->id != 0)
if($idValue && $user->id != 0 && $targetValue && $typeValue && $sleutelValue)
{
$result = $this->getModel('ajax')->updateLocalListingExternal($idValue, $targetValue, $typeValue, $sleutelValue);
}
Expand Down
146 changes: 131 additions & 15 deletions admin/helpers/sermondistributor.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,21 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');

use Joomla\CMS\Language\Language;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;

/**
* Sermondistributor component helper.
*/
abstract class SermondistributorHelper
{
{
/**
* The Main Active Language
*
* @var string
*/
public static $langTag;

/**
* The global params
Expand Down Expand Up @@ -673,7 +683,7 @@ public static function getFileInfo($key)
*
* @var array
**/
protected static $fileExtentionToMimeType = array(
protected static $fileExtensionToMimeType = array(
'123' => 'application/vnd.lotus-1-2-3',
'3dml' => 'text/vnd.in3d.3dml',
'3ds' => 'image/x-3ds',
Expand Down Expand Up @@ -1680,9 +1690,9 @@ public static function mimeType($file)
// get the extension form file
$extension = \strtolower(\pathinfo($file, \PATHINFO_EXTENSION));
// check if we have the extension listed
if (isset(self::$fileExtentionToMimeType[$extension]))
if (isset(self::$fileExtensionToMimeType[$extension]))
{
return self::$fileExtentionToMimeType[$extension];
return self::$fileExtensionToMimeType[$extension];
}
elseif (function_exists('mime_content_type'))
{
Expand All @@ -1698,6 +1708,61 @@ public static function mimeType($file)
return 'application/octet-stream';
}

/**
* Get the file extensions
*
* @param string $target The targeted/filter option
* @param boolean $sorted The multidimensional grouping sort (only if targeted filter is used)
*
* @return array All the extensions (targeted & sorted)
*
*/
public static function getFileExtensions($target = null, $sorted = false)
{
// we have some in-house grouping/filters :)
$filters = array(
'image' => array('image', 'font', 'model'),
'document' => array('application', 'text', 'chemical', 'message'),
'media' => array('video', 'audio'),
'file' => array('image', 'application', 'text', 'video', 'audio'),
'all' => array('application', 'text', 'chemical', 'message', 'image', 'font', 'model', 'video', 'audio', 'x-conference')
);
// sould we filter
if ($target)
{
// the bucket to get extensions
$fileextensions = array();
// check if filter exist (if not return empty array)
if (isset($filters[$target]))
{
foreach (self::$fileExtensionToMimeType as $extension => $mimetype)
{
// get the key mime type
$mimearr = explode("/", $mimetype, 2);
// check if this file extension should be added
if (in_array($mimearr[0], $filters[$target]))
{
if ($sorted)
{
if (!isset($fileextensions[$mimearr[0]]))
{
$fileextensions[$mimearr[0]] = array();
}
$fileextensions[$mimearr[0]][$extension] = $extension;
}
else
{
$fileextensions[$extension] = $extension;
}
}
}
}
return $fileextensions;
}
// we just return all file extensions
return array_keys(self::$fileExtensionToMimeType);
}

protected static function getDownloadFileName(&$sermon, $file, $type)
{
// first get file name and file type
Expand Down Expand Up @@ -2681,6 +2746,7 @@ public static function openPublicProtocol($SECRET, $ID, $PUBLIC)
// return opened values
return $open;
}

/**
* Load the Component xml manifest.
**/
Expand Down Expand Up @@ -2834,7 +2900,7 @@ public static function addSubmenu($submenu)
if ($user->authorise('sermon.access', 'com_sermondistributor') && $user->authorise('sermon.submenu', 'com_sermondistributor'))
{
JHtmlSidebar::addEntry(JText::_('COM_SERMONDISTRIBUTOR_SUBMENU_SERMONS'), 'index.php?option=com_sermondistributor&view=sermons', $submenu === 'sermons');
JHtmlSidebar::addEntry(JText::_('COM_SERMONDISTRIBUTOR_SERMON_SERMON_CATEGORY'), 'index.php?option=com_categories&view=categories&extension=com_sermondistributor.sermons', $submenu === 'categories.sermons');
JHtmlSidebar::addEntry(JText::_('COM_SERMONDISTRIBUTOR_SERMON_SERMONS_CATEGORIES'), 'index.php?option=com_categories&view=categories&extension=com_sermondistributor.sermons', $submenu === 'categories.sermons');
}
if ($user->authorise('series.access', 'com_sermondistributor') && $user->authorise('series.submenu', 'com_sermondistributor'))
{
Expand Down Expand Up @@ -3243,7 +3309,15 @@ public static function getVars($table, $where = null, $whereString = 'user', $wh
{
$query->from($db->quoteName('#_'.$main.'_'.$table));
}
$query->where($db->quoteName($whereString) . ' '.$operator.' (' . implode(',',$where) . ')');
// add strings to array search
if ('IN_STRINGS' === $operator || 'NOT IN_STRINGS' === $operator)
{
$query->where($db->quoteName($whereString) . ' ' . str_replace('_STRINGS', '', $operator) . ' ("' . implode('","',$where) . '")');
}
else
{
$query->where($db->quoteName($whereString) . ' ' . $operator . ' (' . implode(',',$where) . ')');
}
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
Expand Down Expand Up @@ -3353,14 +3427,19 @@ public static function getGroupName($id)
* @param string $views The related list view name
* @param mixed $target Only get this permission (like edit, create, delete)
* @param string $component The target component
* @param object $user The user whose permissions we are loading
*
* @return object The JObject of permission/authorised actions
*
**/
public static function getActions($view, &$record = null, $views = null, $target = null, $component = 'sermondistributor')
public static function getActions($view, &$record = null, $views = null, $target = null, $component = 'sermondistributor', $user = 'null')
{
// get the user object
$user = JFactory::getUser();
// load the user if not given
if (!self::checkObject($user))
{
// get the user object
$user = JFactory::getUser();
}
// load the JObject
$result = new JObject;
// make view name safe (just incase)
Expand Down Expand Up @@ -3694,7 +3773,7 @@ protected static function getDefaultAssetRules($component, $view, $inherit = tru
}
}
// check if there are any view values remaining
if (count($_result))
if (count((array) $_result))
{
$_result = json_encode($_result);
$_result = array($_result);
Expand Down Expand Up @@ -3819,7 +3898,31 @@ public static function getFieldObject(&$attributes, $default = '', $options = nu
jimport('joomla.form.form');
}
// get field type
$field = JFormHelper::loadFieldType($attributes['type'],true);
$field = JFormHelper::loadFieldType($attributes['type'], true);
// get field xml
$XML = self::getFieldXML($attributes, $options);
// setup the field
$field->setup($XML, $default);
// return the field object
return $field;
}
return false;
}

/**
* get the field xml
*
* @param array $attributes The array of attributes
* @param array $options The options to apply to the XML element
*
* @return object
*
*/
public static function getFieldXML(&$attributes, $options = null)
{
// make sure we have attributes and a type value
if (self::checkArray($attributes))
{
// start field xml
$XML = new SimpleXMLElement('<field/>');
// load the attributes
Expand All @@ -3830,10 +3933,8 @@ public static function getFieldObject(&$attributes, $default = '', $options = nu
// load the options
self::xmlAddOptions($XML, $options);
}
// setup the field
$field->setup($XML, $default);
// return the field object
return $field;
// return the field xml
return $XML;
}
return false;
}
Expand Down Expand Up @@ -4081,6 +4182,8 @@ public static function safeString($string, $type = 'L', $spacer = '_', $replaceN
$string = trim($string);
$string = preg_replace('/'.$spacer.'+/', ' ', $string);
$string = preg_replace('/\s+/', ' ', $string);
// Transliterate string
$string = self::transliterate($string);
// remove all and keep only characters
if ($keepOnlyCharacters)
{
Expand Down Expand Up @@ -4149,6 +4252,19 @@ public static function safeString($string, $type = 'L', $spacer = '_', $replaceN
return '';
}

public static function transliterate($string)
{
// set tag only once
if (!self::checkString(self::$langTag))
{
// get global value
self::$langTag = JComponentHelper::getParams('com_sermondistributor')->get('language', 'en-GB');
}
// Transliterate on the language requested
$lang = Language::getInstance(self::$langTag);
return $lang->transliterate($string);
}

public static function htmlEscape($var, $charset = 'UTF-8', $shorten = false, $length = 40)
{
if (self::checkString($var))
Expand Down
Loading

0 comments on commit 8275919

Please sign in to comment.