Beispiel #1
0
 /**
  * Method to convert a string into camel case.
  *
  * @param   string  $input  The string input.
  *
  * @return  string  The camel case string.
  *
  * @since   11.3
  */
 public static function toCamelCase($input)
 {
     // Convert words to uppercase and then remove spaces.
     $input = self::toSpaceSeparated($input);
     $input = JString::ucwords($input);
     $input = JString::str_ireplace(' ', '', $input);
     return $input;
 }
 public function display($tpl = null)
 {
     $user = JFactory::getUser();
     JToolbarHelper::title(JString::ucwords(implode(' ', JStringNormalise::fromCamelCase($this->view, true))));
     if ($user->authorise('core.admin', 'com_fileuploadform')) {
         JToolbarHelper::preferences('com_fileuploadform');
     }
     parent::display($tpl);
 }
Beispiel #3
0
 /**
  * @group String
  * @covers JString::ucwords
  * @dataProvider ucwordsData
  */
 public function testUcwords($string, $expect)
 {
     $actual = JString::ucwords($string);
     $this->assertEquals($expect, $actual);
 }
Beispiel #4
0
function addLayout(&$title, $view, $layout)
{
    $title[] = JString::ucwords(JText::_('COM_EASYSOCIAL_ROUTER_' . strtoupper($view) . '_LAYOUT_' . strtoupper($layout)));
    shRemoveFromGETVarsList('layout');
}
Beispiel #5
0
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
defined('_JEXEC') or die('Unauthorized Access');
// Determine how is the user's current id being set.
if (isset($userid)) {
    $title[] = getUserAlias($userid);
    shRemoveFromGETVarsList('userid');
}
// Add the view to the list of titles
if (isset($view)) {
    addView($title, $view);
}
// Determine which type does the photo belong to
if (isset($type)) {
    $title[] = JString::ucwords(JText::_('COM_EASYSOCIAL_SH404_PHOTOS_TYPE_' . strtoupper($type)));
    if (isset($uid)) {
        if ($type == SOCIAL_TYPE_USER) {
            $alias = getUserAlias($uid);
        }
        if ($type == SOCIAL_TYPE_GROUP) {
            $alias = getGroupAlias($uid);
        }
        if ($type == SOCIAL_TYPE_EVENT) {
            $alias = getEventAlias($uid);
        }
        $title[] = $alias;
        shRemoveFromGETVarsList('uid');
    }
    shRemoveFromGETVarsList('type');
}
Beispiel #6
0
 /**
  * Get avatar galleries and make them select option list.
  *
  * @return array|string[]  List of options.
  */
 protected function getGalleryOptions()
 {
     $options = array();
     foreach ($this->galleries as $gallery => $files) {
         $text = $gallery ? JString::ucwords(str_replace('/', ' / ', $gallery)) : JText::_('COM_KUNENA_DEFAULT_GALLERY');
         $options[] = JHtml::_('select.option', $gallery, $text);
     }
     return count($options) > 1 ? $options : array();
 }
Beispiel #7
0
* @package		EasyBlog
* @copyright	Copyright (C) 2010 - 2015 Stack Ideas Sdn Bhd. All rights reserved.
* @license		GNU/GPL, see LICENSE.php
* EasyBlog is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
defined('_JEXEC') or die('Unauthorized Access');
if (isset($uid) && $uid) {
    // Get the preview post alias
    $post = EB::post($uid);
    if (isset($layout) && $layout == 'preview') {
        // Add the view to the list of titles
        $title[] = JString::ucwords(JText::_('COM_EASYBLOG_SH404_ROUTER_' . strtoupper($layout)));
        $title[] = ucfirst($post->getAlias());
    }
    shRemoveFromGETVarsList('view');
    shRemoveFromGETVarsList('layout');
    shRemoveFromGETVarsList('uid');
}
if (isset($id) && $id) {
    // Get the category alias
    $post = EB::post($id);
    // For entry links, we do not want to include the /Entry/ portion
    $title[] = ucfirst($post->getAlias());
    shRemoveFromGETVarsList('view');
    shRemoveFromGETVarsList('layout');
    shRemoveFromGETVarsList('id');
}
Beispiel #8
0
 /**
  * Method to get a list of items.
  *
  * @return	mixed	An array of objects on success, false on failure.
  */
 public function getItems()
 {
     $params = $this->getState()->get('params');
     $limit = $this->getState('list.limit');
     if ($params->get('items_to_display') and $params->get('items_to_display') != '') {
         $object_upper_case = str_replace(' ', '', JString::ucwords($params->get('items_to_display')));
         if ($this->_items === null and $category = $this->getCategory()) {
             $model = JModelLegacy::getInstance($object_upper_case, 'KnvbapiModel', array('ignore_request' => true));
             $model->setState('params', $params);
             $model->setState('filter.category_id', $category->id);
             $model->setState('filter.published', $this->getState('filter.published'));
             $model->setState('filter.archived', $this->getState('filter.archived'));
             $model->setState('filter.featured', $this->getState('filter.featured'));
             $model->setState('filter.language', $this->getState('filter.language'));
             $model->setState('filter.access', $this->getState('filter.access'));
             $model->setState('list.ordering', $this->buildOrderBy());
             $model->setState('list.start', $this->getState('list.start'));
             $model->setState('list.limit', $limit);
             $model->setState('list.direction', $this->getState('list.direction'));
             $model->setState('filter.search', $this->getState('filter.search'));
             $model->setState('filter.subcategories', $this->getState('filter.subcategories'));
             $model->setState('filter.max_category_levels', $this->getState('filter.max_category_levels'));
             $model->setState('list.links', $this->getState('list.links'));
             if ($limit >= 0) {
                 $this->_items = $model->getItems();
                 if ($this->_items === false) {
                     $this->setError($model->getError());
                 }
             } else {
                 $this->_items = array();
             }
             $this->_pagination = $model->getPagination();
         }
         // Convert the params field into an object, saving original in _params
         for ($i = 0, $n = count($this->_items); $i < $n; $i++) {
             $item =& $this->_items[$i];
             if (isset($item->params)) {
                 $params = new Registry();
                 $params->loadString($item->params);
                 $item->params = $params;
             }
         }
     }
     return $this->_items;
 }
Beispiel #9
0
 /**
  * Method to set the search/replace pairs for a component object
  *
  * @param	template_object_name		string	Used for template source search strings
  * @param	component_object			object	Used for component object replacement strings	
  * @param	make_child_pairs			boolean	When object is achild object then add Child search pairs	
  *
  * @return	search_replace_pairs		array	search/replace pairs for the component		
  */
 protected function _getComponentObjectSearchPairs($template_object_name, $component_object, $make_child_pairs = false)
 {
     $db = JFactory::getDbo();
     $object_name = $component_object->name;
     $object_description = $component_object->description;
     if (isset($component_object->intro)) {
         $object_intro = $component_object->intro;
     } else {
         $object_intro = $component_object->description;
     }
     $object_plural_name = $component_object->plural_name;
     $object_short_name = $component_object->short_name;
     $object_short_plural_name = $component_object->short_plural_name;
     $object_code_name = str_replace(" ", "", $component_object->code_name);
     $object_plural_code_name = str_replace(" ", "", $component_object->plural_code_name);
     $object_ordering = $component_object->ordering;
     if ($make_child_pairs) {
         $template_object_name = 'child ' . $template_object_name;
     }
     $search_replace_pairs = array();
     // e.g. 'search' => '[%%CompObject_name%%]', 'replace' => 'Discussion Group'
     array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::ucwords($template_object_name)) . '_name'), 'replace' => JString::ucwords($object_name)));
     // e.g. 'search' => '[%%CompObject_plural_name%%]', 'replace' => 'Discussion Groups'
     array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::ucwords($template_object_name)) . '_plural_name'), 'replace' => JString::ucwords($object_plural_name)));
     // e.g. 'search' => '[%%Compobject_name%%]', 'replace' => 'Discussion group'
     array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::ucfirst(JString::strtolower($template_object_name))) . '_name'), 'replace' => JString::ucfirst(JString::strtolower($object_name))));
     // e.g. 'search' => '[%%Compobject_plural_name%%]', 'replace' => 'Discussion groups'
     array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::ucfirst(JString::strtolower($template_object_name))) . '_plural_name'), 'replace' => JString::ucfirst(JString::strtolower($object_plural_name))));
     // e.g. 'search' => '[%%compobject_name%%]', 'replace' => 'discussion group'
     array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::strtolower($template_object_name)) . '_name'), 'replace' => JString::strtolower($object_name)));
     // e.g. 'search' => '[%%compobject_plural_name%%]', 'replace' => 'discussion groups'
     array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::strtolower($template_object_name)) . '_plural_name'), 'replace' => JString::strtolower($object_plural_name)));
     // e.g. 'search' => '[%%CompObject_short_name%%]', 'replace' => 'Group'
     array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::ucwords($template_object_name)) . '_short_name'), 'replace' => JString::ucwords($object_short_name)));
     // e.g. 'search' => '[%%CompObject_short_plural_name%%]', 'replace' => 'Groups'
     array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::ucwords($template_object_name)) . '_short_plural_name'), 'replace' => JString::ucwords($object_short_plural_name)));
     // e.g. 'search' => '[%%Compobject_short_name%%]', 'replace' => 'Group'
     array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::ucfirst(JString::strtolower($template_object_name))) . '_short_name'), 'replace' => JString::ucfirst(JString::strtolower($object_short_name))));
     // e.g. 'search' => '[%%Compobject_short_plural_name%%]', 'replace' => 'Groups'
     array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::ucfirst(JString::strtolower($template_object_name))) . '_short_plural_name'), 'replace' => JString::ucfirst(JString::strtolower($object_short_plural_name))));
     // e.g. 'search' => '[%%compobject_short_name%%]', 'replace' => 'group'
     array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::strtolower($template_object_name)) . '_short_name'), 'replace' => JString::strtolower($object_short_name)));
     // e.g. 'search' => '[%%compobject_short_plural_name%%]', 'replace' => 'groups'
     array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::strtolower($template_object_name)) . '_short_plural_name'), 'replace' => JString::strtolower($object_short_plural_name)));
     // e.g. 'search' => '[%%compobject_code_name%%]', 'replace' => 'discussion_group'
     array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::strtolower($template_object_name)) . '_code_name'), 'replace' => JString::strtolower($object_code_name)));
     // e.g. 'search' => '[%%compobject_plural_code_name%%]', 'replace' => 'discussion_groups'
     array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::strtolower($template_object_name)) . '_plural_code_name'), 'replace' => JString::strtolower($object_plural_code_name)));
     // e.g. 'search' => '[%%Compobject_description%%]', 'replace' => 'free text'
     array_push($search_replace_pairs, array('search' => $this->_markupText(JString::ucfirst(JString::strtolower(str_replace(" ", "", $template_object_name))) . '_description'), 'replace' => $object_description));
     // e.g. 'search' => '[%%Compobject_description_ini%%]', 'replace' => 'free text'
     array_push($search_replace_pairs, array('search' => $this->_markupText(JString::ucfirst(JString::strtolower(str_replace(" ", "", $template_object_name))) . '_description_ini'), 'replace' => str_replace('"', '"_QQ_"', $object_description)));
     // e.g. 'search' => '[%%Compobject_description_escaped%%]', 'replace' => 'free text'
     array_push($search_replace_pairs, array('search' => $this->_markupText(JString::ucfirst(JString::strtolower(str_replace(" ", "", $template_object_name))) . '_description_escaped'), 'replace' => $db->escape($object_description)));
     // e.g. 'search' => '[%%Compobject_intro%%]', 'replace' => 'free text'
     array_push($search_replace_pairs, array('search' => $this->_markupText(JString::ucfirst(JString::strtolower(str_replace(" ", "", $template_object_name))) . '_intro'), 'replace' => $object_intro));
     // e.g. 'search' => '[%%Compobject_intro_ini%%]', 'replace' => 'free text'
     array_push($search_replace_pairs, array('search' => $this->_markupText(JString::ucfirst(JString::strtolower(str_replace(" ", "", $template_object_name))) . '_intro_ini'), 'replace' => str_replace('"', '"_QQ_"', $object_intro)));
     // e.g. 'search' => '[%%Compobject_intro_escaped%%]', 'replace' => 'free text'
     array_push($search_replace_pairs, array('search' => $this->_markupText(JString::ucfirst(JString::strtolower(str_replace(" ", "", $template_object_name))) . '_intro_escaped'), 'replace' => $db->escape($object_intro)));
     // e.g. 'search' => '[%%compobject_ordering%%]', 'replace' => '1'
     array_push($search_replace_pairs, array('search' => $this->_markupText(JString::strtolower(str_replace(" ", "", $template_object_name)) . '_ordering'), 'replace' => $object_ordering));
     // e.g. 'search' => '[%%COMPOBJECTPLURAL%%]', 'replace' => 'DISCUSSIONGROUPS'
     array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::strtoupper($template_object_name)) . 'PLURAL'), 'replace' => str_replace("_", "", JString::strtoupper($object_plural_code_name))));
     // e.g. 'search' => '[%%Compobjectplural%%]', 'replace' => 'Discussiongroups'
     array_push($search_replace_pairs, array('search' => $this->_markupText(JString::ucfirst(JString::strtolower(str_replace(" ", "", $template_object_name)) . 'plural')), 'replace' => JString::ucfirst(JString::strtolower(str_replace("_", "", $object_plural_code_name)))));
     // e.g. 'search' => '[%%CompObjectPlural%%]', 'replace' => 'DiscussionGroups'
     array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::ucwords(JString::strtolower($template_object_name)) . 'Plural')), 'replace' => str_replace(" ", "", JString::ucwords(JString::strtolower(str_replace("_", " ", $object_plural_code_name))))));
     // e.g. 'search' => '[%%CompObjectplural%%]', 'replace' => 'DiscussionGroups'
     array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::ucwords(JString::strtolower($template_object_name)) . 'plural')), 'replace' => str_replace("_", "", JString::ucwords(JString::strtolower($object_plural_code_name)))));
     // e.g. 'search' => '[%%compobjectplural%%]', 'replace' => 'discussiongroups'
     array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::strtolower($template_object_name)) . 'plural'), 'replace' => str_replace("_", "", JString::strtolower($object_plural_code_name))));
     // e.g. 'search' => '[%%COMPOBJECT%%]', 'replace' => 'DISCUSSIONGROUP'
     array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::strtoupper($template_object_name))), 'replace' => str_replace("_", "", JString::strtoupper($object_code_name))));
     // e.g. 'search' => '[%%CompObject%%]', 'replace' => 'DiscussionGroup'
     array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::ucwords(JString::strtolower($template_object_name)))), 'replace' => str_replace(" ", "", JString::ucwords(JString::strtolower(str_replace("_", " ", $object_code_name))))));
     // e.g. 'search' => '[%%Compobject%%]', 'replace' => 'Discussiongroup'
     array_push($search_replace_pairs, array('search' => $this->_markupText(JString::ucfirst(JString::strtolower(str_replace(" ", "", $template_object_name)))), 'replace' => JString::ucfirst(JString::strtolower(str_replace("_", "", $object_code_name)))));
     // e.g. 'search' => '[%%compobject%%]', 'replace' => 'discussiongroup'
     array_push($search_replace_pairs, array('search' => $this->_markupText(str_replace(" ", "", JString::strtolower($template_object_name))), 'replace' => str_replace("_", "", JString::strtolower($object_code_name))));
     return $search_replace_pairs;
 }
Beispiel #10
0
 function _beautifyWord($word)
 {
     if ($word == 'hash_md') {
         $word = 'md5 hash';
     }
     $pos = JString::strpos($word, '|');
     if ($pos !== false) {
         return JString::substr($word, $pos + 1);
     }
     return JString::ucwords(str_replace('_', ' ', $word));
 }
 function _decorateWord($word)
 {
     switch ($word) {
         case 'hash_md':
             return JText::_('MD5 Hash');
         case 'ctime':
             return JText::_('Created time');
         case 'mtime':
             return JText::_('Modified');
         case 'size':
             return JText::_('Size');
         default:
             return JString::ucwords(JText::_(str_replace('_', ' ', $word)));
     }
 }
Beispiel #12
0
 function beautifyString($str, $translate = false)
 {
     $result = str_replace('_', ' ', $str);
     $result = JString::ucwords($result);
     return $translate ? JText::_($result) : $result;
 }
Beispiel #13
0
		<?php 
foreach ($this->validatorGroups as $group => $validators) {
    ?>
			<?php 
    if ($group != 'filesystem') {
        continue;
    }
    ?>
			<?php 
    foreach ($validators as $validator) {
        ?>
				<?php 
        if ($this->validatorParams[$group]->getParams('', $validator)) {
            ?>
					<?php 
            $title = JString::ucwords(str_replace('_', ' ', JText::_($validator)));
            if ($title == 'Php') {
                $title = 'PHP';
            }
            if ($count == '2') {
                echo '</td><td>';
            }
            ?>
					<fieldset>
						<legend><?php 
            echo $title;
            ?>
</legend>
						<?php 
            $this->renderValidatorParamGroup($this->validatorParams[$group], $validator);
            ?>
Beispiel #14
0
 static function ucwords($word)
 {
     if (CedTagsHelper::param('capitalize')) {
         return JString::ucwords($word);
     } else {
         return $word;
     }
 }
Beispiel #15
0
 function getThumbnails($title, $path, $width, $height, $resize, $prefix, $cache_dir, $cache_time)
 {
     $thumbs = array();
     $files = $this->getFiles($this->jroot . $path);
     // set default thumbnail size, if incorrect sizes defined
     $width = intval($width);
     $height = intval($height);
     if ($width < 1 && $height < 1) {
         $width = 100;
         $height = null;
     }
     foreach ($files as $file) {
         $filename = basename($file);
         $thumb = $this->jroot . $path . $cache_dir . '/' . $prefix . $filename;
         // create or re-cache thumbnail
         if (!is_file($thumb) || $cache_time > 0 && time() > filemtime($thumb) + $cache_time) {
             $thumbnail = new YOOThumbnail($file);
             // set thumbnail size
             if ($width && $height) {
                 $thumbnail->setSize($width, $height);
             } elseif ($height) {
                 $thumbnail->sizeHeight($height);
             } else {
                 $thumbnail->sizeWidth($width);
             }
             $thumbnail->setResize($resize);
             $thumbnail->save($thumb);
         }
         // if thumbnail exists, add it to return value
         if (is_file($thumb)) {
             // set image name or title if exsist
             if ($title != '') {
                 $name = $title;
             } else {
                 $name = JFile::stripExt($filename);
                 $name = JString::str_ireplace('_', ' ', $name);
                 $name = JString::ucwords($name);
             }
             // get image info
             list($thumb_width, $thumb_height) = @getimagesize($thumb);
             $thumbs[] = array('name' => $name, 'filename' => $filename, 'img' => $this->juri . ltrim($path, '/') . $filename, 'img_file' => $file, 'thumb' => $this->juri . ltrim($path, '/') . $cache_dir . '/' . $prefix . $filename, 'thumb_width' => $thumb_width, 'thumb_height' => $thumb_height);
         }
     }
     return $thumbs;
 }
Beispiel #16
0
 function getAvatarGalleries($path, $select_name)
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.utilities.string');
     $folders = JFolder::folders($path, '.', true, true);
     foreach ($folders as $key => $folder) {
         $folder = substr($folder, strlen($path) + 1);
         $folders[$key] = $folder;
     }
     $selected = JString::trim($this->gallery);
     $str = "<select name=\" {$this->escape($select_name)}\" id=\"avatar_category_select\" onchange=\"switch_avatar_category(this.options[this.selectedIndex].value)\">\n";
     $str .= "<option value=\"default\"";
     if ($selected == "") {
         $str .= " selected=\"selected\"";
     }
     $str .= ">" . JText::_('COM_KUNENA_DEFAULT_GALLERY') . "</option>\n";
     asort($folders);
     foreach ($folders as $key => $val) {
         $str .= '<option value="' . urlencode($val) . '"';
         if ($selected == $val) {
             $str .= " selected=\"selected\"";
         }
         $str .= ">{$this->escape(JString::ucwords(str_replace('/', ' / ', $val)))}</option>\n";
     }
     $str .= "</select>\n";
     return $str;
 }
Beispiel #17
0
 /**
  * @param $path
  * @param $select_name
  *
  * @return mixed|null
  */
 function getAvatarGalleries($path, $select_name)
 {
     jimport('joomla.utilities.string');
     $folders = KunenaFolder::folders($path, '.', true, true);
     $galleries = array();
     if ($this->getAvatarGallery($path)) {
         $galleries[] = JHtml::_('select.option', 'default', JText::_('COM_KUNENA_DEFAULT_GALLERY'));
     }
     foreach ($folders as $folder) {
         $folder = substr($folder, strlen($path) + 1);
         if (!$this->getAvatarGallery($path . '/' . $folder)) {
             continue;
         }
         $galleries[] = JHtml::_('select.option', $folder, JString::ucwords(str_replace('/', ' / ', $folder)));
     }
     $selected = JString::trim($this->gallery);
     return $galleries ? JHtml::_('select.genericlist', $galleries, $this->escape($select_name), '', 'value', 'text', $selected, 'avatar_category_select') : null;
 }
Beispiel #18
0
<?php

/**
* @package    EasySocial
* @copyright  Copyright (C) 2010 - 2014 Stack Ideas Sdn Bhd. All rights reserved.
* @license    GNU/GPL, see LICENSE.php
* EasySocial is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
defined('_JEXEC') or die('Unauthorized Access');
// Determine how is the user's current id being set.
if (isset($userid)) {
    $title[] = getUserAlias($userid);
    shRemoveFromGETVarsList('userid');
}
if (isset($view)) {
    addView($title, $view);
}
if (isset($filter)) {
    $title[] = JString::ucwords(JText::_('COM_EASYSOCIAL_ROUTER_FRIENDS_FILTER_' . strtoupper($filter)));
    shRemoveFromGETVarsList('filter');
}
 /**
  * Task used for processing events.
  *
  * @throws Exception
  */
 public function process()
 {
     // Get the task.
     $task = JString::strtolower($this->input->getCmd('task'));
     if (!$task) {
         throw new Exception(JText::_('COM_CROWDFUNDINGFINANCE_ERROR_INVALID_TASK'));
     }
     // Check for request forgeries.
     if (in_array($task, $this->tokenTasks, true)) {
         if (strcmp('POST', $this->app->input->getMethod()) !== 0) {
             JSession::checkToken('GET') or jexit(JText::_('JINVALID_TOKEN'));
         } else {
             JSession::checkToken('POST') or jexit(JText::_('JINVALID_TOKEN'));
         }
     }
     // Get component parameters
     $params = JComponentHelper::getParams('com_crowdfunding');
     /** @var  $params Joomla\Registry\Registry */
     // Check for disabled payment functionality
     if ($params->get('debug_payment_disabled', 0)) {
         throw new Exception(JText::_('COM_CROWDFUNDINGFINANCE_ERROR_PAYMENT_HAS_BEEN_DISABLED_MESSAGE'));
     }
     // Get payment gateway name.
     $paymentService = $this->input->getCmd('payment_service');
     if (!$paymentService) {
         throw new UnexpectedValueException(JText::_('COM_CROWDFUNDINGFINANCE_ERROR_INVALID_PAYMENT_GATEWAY'));
     }
     $output = array();
     // Trigger the event
     try {
         $context = 'com_crowdfundingfinance.payouts.' . $task . '.' . JString::strtolower($paymentService);
         // Import Crowdfunding Payment Plugins
         $dispatcher = JEventDispatcher::getInstance();
         JPluginHelper::importPlugin('crowdfunding');
         // Trigger the event.
         $results = $dispatcher->trigger('onPayouts' . JString::ucwords($task), array($context, &$params));
         // Get the result, that comes from the plugin.
         if (is_array($results) and count($results) > 0) {
             foreach ($results as $result) {
                 if ($result !== null and is_array($result)) {
                     $output = $result;
                     break;
                 }
             }
         }
     } catch (UnexpectedValueException $e) {
         $this->setMessage($e->getMessage(), 'notice');
         $this->setRedirect(JRoute::_(CrowdfundingHelperRoute::getDiscoverRoute(), false));
         return;
     } catch (Exception $e) {
         // Store log data in the database
         JLog::add($e->getMessage());
         throw new Exception(JText::_('COM_CROWDFUNDINGFINANCE_ERROR_SYSTEM'));
     }
     $redirectUrl = Joomla\Utilities\ArrayHelper::getValue($output, 'redirect_url');
     $message = Joomla\Utilities\ArrayHelper::getValue($output, 'message');
     if (!$redirectUrl) {
         throw new UnexpectedValueException(JText::_('COM_CROWDFUNDINGFINANCE_ERROR_INVALID_REDIRECT_URL'));
     }
     if (!$message) {
         $this->setRedirect($redirectUrl);
     } else {
         $this->setRedirect($redirectUrl, $message, 'notice');
     }
 }
Beispiel #20
0
 protected function _getThumbnails($params)
 {
     $thumbs = array();
     $width = $params->get('width');
     $height = $params->get('height');
     $resize = $params->get('resize', 1);
     $title = $this->_data->get('title', '');
     $files = JFolder::files($this->_path, '.', false, true, array('.svn', 'CVS', '.DS_Store'));
     $files = array_filter($files, create_function('$file', 'return preg_match("#(\\.bmp|\\.gif|\\.jpg|\\.jpeg|\\.png)$#i", $file);'));
     // set default thumbnail size, if incorrect sizes defined
     $width = intval($width);
     $height = intval($height);
     if ($width < 1 && $height < 1) {
         $width = 100;
         $height = null;
     }
     foreach ($files as $file) {
         $filename = basename($file);
         $thumb = ZooHelper::resizeImage($file, $width, $height);
         // if thumbnail exists, add it to return value
         if (is_file($thumb)) {
             // set image name or title if exsist
             if ($title != '') {
                 $name = $title;
             } else {
                 $name = JFile::stripExt($filename);
                 $name = JString::str_ireplace('_', ' ', $name);
                 $name = JString::ucwords($name);
             }
             // get image info
             list($thumb_width, $thumb_height) = @getimagesize($thumb);
             $thumbs[] = array('name' => $name, 'filename' => $filename, 'img' => $this->_uri . $this->_getRelativePath($file), 'img_file' => $file, 'thumb' => $this->_uri . $this->_getRelativePath($thumb), 'thumb_width' => $thumb_width, 'thumb_height' => $thumb_height);
         }
     }
     return $thumbs;
 }