本文整理汇总了PHP中FOFInput类的典型用法代码示例。如果您正苦于以下问题:PHP FOFInput类的具体用法?PHP FOFInput怎么用?PHP FOFInput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FOFInput类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/**
*
* @staticvar array $instances
* @param type $option
* @param type $view
* @param type $config
* @return FOFToolbar
*/
public static function &getAnInstance($option = null, $config = array())
{
static $instances = array();
// Make sure $config is an array
if (is_object($config)) {
$config = (array) $config;
} elseif (!is_array($config)) {
$config = array();
}
$hash = $option;
if (!array_key_exists($hash, $instances)) {
if (array_key_exists('input', $config)) {
if ($config['input'] instanceof FOFInput) {
$input = $config['input'];
} else {
$input = new FOFInput($config['input']);
}
} else {
$input = new FOFInput();
}
$config['option'] = !is_null($option) ? $option : $input->getCmd('option', 'com_foobar');
$input->set('option', $config['option']);
$config['input'] = $input;
$className = ucfirst(str_replace('com_', '', $config['option'])) . 'Toolbar';
if (!class_exists($className)) {
list($isCli, $isAdmin) = FOFDispatcher::isCliAdmin();
if ($isAdmin) {
$basePath = JPATH_ADMINISTRATOR;
} elseif ($isCli) {
$basePath = JPATH_ROOT;
} else {
$basePath = JPATH_SITE;
}
$searchPaths = array($basePath . '/components/' . $config['option'], $basePath . '/components/' . $config['option'] . '/toolbars', JPATH_ADMINISTRATOR . '/components/' . $config['option'], JPATH_ADMINISTRATOR . '/components/' . $config['option'] . '/toolbars');
if (array_key_exists('searchpath', $config)) {
array_unshift($searchPaths, $config['searchpath']);
}
JLoader::import('joomla.filesystem.path');
$path = JPath::find($searchPaths, 'toolbar.php');
if ($path) {
require_once $path;
}
}
if (!class_exists($className)) {
$className = 'FOFToolbar';
}
$instance = new $className($config);
$instances[$hash] = $instance;
}
return $instances[$hash];
}
示例2: preRender
/**
* Echoes any HTML to show before the view template
*
* @param string $view The current view
* @param string $task The current task
* @param FOFInput $input The input array (request parameters)
* @param array $config The view configuration array
*
* @return void
*/
public function preRender($view, $task, $input, $config = array())
{
$format = $input->getCmd('format', 'html');
if (empty($format)) {
$format = 'html';
}
if ($format != 'html') {
return;
}
// Render the submenu and toolbar
if ($input->getBool('render_toolbar', true)) {
$this->renderButtons($view, $task, $input, $config);
$this->renderLinkbar($view, $task, $input, $config);
}
}
示例3: postRender
/**
* Echoes any HTML to show after the view template
*
* @param string $view The current view
* @param string $task The current task
* @param FOFInput $input The input array (request parameters)
* @param array $config The view configuration array
*
* @return void
*/
public function postRender($view, $task, $input, $config = array())
{
$format = $input->getCmd('format', 'html');
if (empty($format)) {
$format = 'html';
}
if ($format != 'html') {
return;
}
// Closing tag only if we're not in CLI
if (FOFPlatform::getInstance()->isCli()) {
return;
}
echo "</div>\n";
// Closes akeeba-renderjoomla div
}
示例4: array
/**
* Gets an instance of a component's toolbar
*
* @param string $option The name of the component
* @param array $config The configuration array for the component
*
* @return FOFToolbar The toolbar instance for the component
*/
public static function &getAnInstance($option = null, $config = array())
{
static $instances = array();
// Make sure $config is an array
if (is_object($config)) {
$config = (array) $config;
} elseif (!is_array($config)) {
$config = array();
}
$hash = $option;
if (!array_key_exists($hash, $instances)) {
if (array_key_exists('input', $config)) {
if ($config['input'] instanceof FOFInput) {
$input = $config['input'];
} else {
$input = new FOFInput($config['input']);
}
} else {
$input = new FOFInput();
}
$config['option'] = !is_null($option) ? $option : $input->getCmd('option', 'com_foobar');
$input->set('option', $config['option']);
$config['input'] = $input;
$className = ucfirst(str_replace('com_', '', $config['option'])) . 'Toolbar';
if (!class_exists($className)) {
$componentPaths = FOFPlatform::getInstance()->getComponentBaseDirs($config['option']);
$searchPaths = array($componentPaths['main'], $componentPaths['main'] . '/toolbars', $componentPaths['alt'], $componentPaths['alt'] . '/toolbars');
if (array_key_exists('searchpath', $config)) {
array_unshift($searchPaths, $config['searchpath']);
}
$filesystem = FOFPlatform::getInstance()->getIntegrationObject('filesystem');
$path = $filesystem->pathFind($searchPaths, 'toolbar.php');
if ($path) {
require_once $path;
}
}
if (!class_exists($className)) {
$className = 'FOFToolbar';
}
$instance = new $className($config);
$instances[$hash] = $instance;
}
return $instances[$hash];
}
示例5: setToolbarTitle
private function setToolbarTitle()
{
$subtitle_key = FOFInput::getCmd('option', 'com_overload', $this->input).
'_TITLE_'.strtoupper(FOFInput::getCmd('view', '', $this->input));
JToolBarHelper::title(
JText::_( FOFInput::getCmd('option', 'com_overload', $this->input)).
' – <small>'.JText::_($subtitle_key).'</small>',
'generic.png');
}
示例6: import
/**
* Imports an exported profile .json file
*/
public function import()
{
$this->_csrfProtection();
$user = JFactory::getUser();
if (!$user->authorise('akeeba.configure', 'com_akeeba')) {
return JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
}
// Get the user
$user = JFactory::getUser();
// Get some data from the request
$file = FOFInput::getVar('importfile', '', $_FILES, 'array');
if (isset($file['name'])) {
// Load the file data
$data = JFile::read($file['tmp_name']);
@unlink($file['tmp_name']);
// JSON decode
$data = json_decode($data, true);
// Check for data validity
$isValid = is_array($data) && !empty($data);
if ($isValid) {
$isValid = $isValid && array_key_exists('description', $data);
}
if ($isValid) {
$isValid = $isValid && array_key_exists('configuration', $data);
}
if ($isValid) {
$isValid = $isValid && array_key_exists('filters', $data);
}
if (!$isValid) {
$this->setRedirect('index.php?option=com_akeeba&view=profiles', JText::_('COM_AKEEBA_PROFILES_ERR_IMPORT_INVALID'), 'error');
return false;
}
// Unset the id, if it exists
if (array_key_exists('id', $data)) {
unset($data['id']);
}
// Try saving the profile
$result = $this->getThisModel()->getTable()->save($data);
if ($result) {
$this->setRedirect('index.php?option=com_akeeba&view=profiles', JText::_('COM_AKEEBA_PROFILES_MSG_IMPORT_COMPLETE'));
} else {
$this->setRedirect('index.php?option=com_akeeba&view=profiles', JText::_('COM_AKEEBA_PROFILES_ERR_IMPORT_FAILED'), 'error');
}
} else {
$this->setRedirect('index.php?option=com_akeeba&view=profiles', JText::_('MSG_UPLOAD_INVALID_REQUEST'), 'error');
return false;
}
}
示例7: renderToolbar
/**
* Renders the toolbar for the current view and task
*
* @param string $view The view of the component
* @param string $task The exact task of the view
* @param FOFInput $input An optional input object used to determine the defaults
*
* @return void
*/
public function renderToolbar($view = null, $task = null, $input = null)
{
if (!empty($input)) {
$saveInput = $this->input;
$this->input = $input;
}
// If tmpl=component the default behaviour is to not render the toolbar
if ($this->input->getCmd('tmpl', '') == 'component') {
$render_toolbar = false;
} else {
$render_toolbar = true;
}
// If there is a render_toolbar=0 in the URL, do not render a toolbar
$render_toolbar = $this->input->getBool('render_toolbar', $render_toolbar);
if (!$render_toolbar) {
return;
}
// Get the view and task
if (empty($view)) {
$view = $this->input->getCmd('view', 'cpanel');
}
if (empty($task)) {
$task = $this->input->getCmd('task', 'default');
}
$this->view = $view;
$this->task = $task;
$view = FOFInflector::pluralize($view);
$component = $input->get('option', 'com_foobar', 'cmd');
$configProvider = new FOFConfigProvider();
$toolbar = $configProvider->get($component . '.views.' . '.toolbar');
// If we have a toolbar config specified
if (!empty($toolbar)) {
return $this->renderFromConfig($toolbar);
}
// Check for an onViewTask method
$methodName = 'on' . ucfirst($view) . ucfirst($task);
if (method_exists($this, $methodName)) {
return $this->{$methodName}();
}
// Check for an onView method
$methodName = 'on' . ucfirst($view);
if (method_exists($this, $methodName)) {
return $this->{$methodName}();
}
// Check for an onTask method
$methodName = 'on' . ucfirst($task);
if (method_exists($this, $methodName)) {
return $this->{$methodName}();
}
if (!empty($input)) {
$this->input = $saveInput;
}
}
示例8: getUserStateFromRequest
/**
* This method will try retrieving a variable from the request (input) data.
*
* @param string $key The user state key for the variable
* @param string $request The request variable name for the variable
* @param FOFInput $input The FOFInput object with the request (input) data
* @param mixed $default The default value. Default: null
* @param string $type The filter type for the variable data. Default: none (no filtering)
* @param boolean $setUserState Should I set the user state with the fetched value?
*
* @see FOFPlatformInterface::getUserStateFromRequest()
*
* @return mixed The value of the variable
*/
public function getUserStateFromRequest($key, $request, $input, $default = null, $type = 'none', $setUserState = true)
{
return $input->get($request, $default, $type);
}
示例9: renderButtons
/**
* Renders the toolbar buttons
*
* @param string $view The active view name
* @param string $task The current task
* @param FOFInput $input The input object
* @param array $config Extra configuration variables for the toolbar
*
* @return void
*/
protected function renderButtons($view, $task, $input, $config = array())
{
// On command line don't do anything
if (FOFPlatform::getInstance()->isCli()) {
return;
}
// Do not render buttons unless we are in the the frontend area and we are asked to do so
$toolbar = FOFToolbar::getAnInstance($input->getCmd('option', 'com_foobar'), $config);
$renderFrontendButtons = $toolbar->getRenderFrontendButtons();
if (FOFPlatform::getInstance()->isBackend() || !$renderFrontendButtons) {
return;
}
// Load main backend language, in order to display toolbar strings
// (JTOOLBAR_BACK, JTOOLBAR_PUBLISH etc etc)
FOFPlatform::getInstance()->loadTranslations('joomla');
$title = JFactory::getApplication()->get('JComponentTitle');
$bar = JToolBar::getInstance('toolbar');
// Delete faux links, since if SEF is on, Joomla will follow the link instead of submitting the form
$bar_content = str_replace('href="#"', '', $bar->render());
echo '<div id="FOFHeaderHolder">', $bar_content, $title, '<div style="clear:both"></div>', '</div>';
}
示例10: array
/**
* Gets a temporary instance of a Dispatcher
*
* @param string $option The component name
* @param string $view The View name
* @param array $config Configuration data
*
* @return FOFDispatcher
*/
public static function &getTmpInstance($option = null, $view = null, $config = array())
{
if (array_key_exists('input', $config)) {
if ($config['input'] instanceof FOFInput) {
$input = $config['input'];
} else {
if (!is_array($config['input'])) {
$config['input'] = (array) $config['input'];
}
$config['input'] = array_merge($_REQUEST, $config['input']);
$input = new FOFInput($config['input']);
}
} else {
$input = new FOFInput();
}
$config['option'] = !is_null($option) ? $option : $input->getCmd('option', 'com_foobar');
$config['view'] = !is_null($view) ? $view : $input->getCmd('view', '');
$input->set('option', $config['option']);
$input->set('view', $config['view']);
$config['input'] = $input;
$className = ucfirst(str_replace('com_', '', $config['option'])) . 'Dispatcher';
if (!class_exists($className)) {
$componentPaths = FOFPlatform::getInstance()->getComponentBaseDirs($config['option']);
$searchPaths = array($componentPaths['main'], $componentPaths['main'] . '/dispatchers', $componentPaths['admin'], $componentPaths['admin'] . '/dispatchers');
if (array_key_exists('searchpath', $config)) {
array_unshift($searchPaths, $config['searchpath']);
}
$filesystem = FOFPlatform::getInstance()->getIntegrationObject('filesystem');
$path = $filesystem->pathFind($searchPaths, 'dispatcher.php');
if ($path) {
require_once $path;
}
}
if (!class_exists($className)) {
$className = 'FOFDispatcher';
}
$instance = new $className($config);
return $instance;
}
示例11: getUserStateFromRequest
/**
* This method will try retrieving a variable from the request (input) data.
*
* @param string $key The user state key for the variable
* @param string $request The request variable name for the variable
* @param FOFInput $input The FOFInput object with the request (input) data
* @param mixed $default The default value. Default: null
* @param string $type The filter type for the variable data. Default: none (no filtering)
* @param boolean $setUserState Should I set the user state with the fetched value?
*
* @see FOFPlatformInterface::getUserStateFromRequest()
*
* @return mixed The value of the variable
*/
public function getUserStateFromRequest($key, $request, $input, $default = null, $type = 'none', $setUserState = true)
{
list($isCLI, $isAdmin) = $this->isCliAdmin();
if ($isCLI) {
return $input->get($request, $default, $type);
}
$app = JFactory::getApplication();
if (method_exists($app, 'getUserState')) {
$old_state = $app->getUserState($key, $default);
} else {
$old_state = null;
}
$cur_state = !is_null($old_state) ? $old_state : $default;
$new_state = $input->get($request, null, $type);
// Save the new value only if it was set in this request
if ($setUserState) {
if ($new_state !== null) {
$app->setUserState($key, $new_state);
} else {
$new_state = $cur_state;
}
} elseif (is_null($new_state)) {
$new_state = $cur_state;
}
return $new_state;
}
示例12: renderFormEdit
/**
* Renders a FOFForm for a Browse view and returns the corresponding HTML
*
* @param FOFForm $form The form to render
* @param FOFModel $model The model providing our data
* @param FOFInput $input The input object
*
* @return string The HTML rendering of the form
*/
protected function renderFormEdit(FOFForm &$form, FOFModel $model, FOFInput $input)
{
// Get the key for this model's table
$key = $model->getTable()->getKeyName();
$keyValue = $model->getId();
$html = '';
if ($validate = $form->getAttribute('validate')) {
JHTML::_('behavior.formvalidation');
$class = ' form-validate';
$this->loadValidationScript($form);
} else {
$class = '';
}
// Check form enctype. Use enctype="multipart/form-data" to upload binary files in your form.
$template_form_enctype = $form->getAttribute('enctype');
if (!empty($template_form_enctype)) {
$enctype = ' enctype="' . $form->getAttribute('enctype') . '" ';
} else {
$enctype = '';
}
// Check form name. Use name="yourformname" to modify the name of your form.
$formname = $form->getAttribute('name');
if (empty($formname)) {
$formname = 'adminForm';
}
// Check form ID. Use id="yourformname" to modify the id of your form.
$formid = $form->getAttribute('name');
if (empty($formname)) {
$formid = 'adminForm';
}
$html .= '<form action="index.php" method="post" name="' . $formname . '" id="' . $formid . '"' . $enctype . ' class="form-horizontal' . $class . '">' . PHP_EOL;
$html .= "\t" . '<input type="hidden" name="option" value="' . $input->getCmd('option') . '" />' . PHP_EOL;
$html .= "\t" . '<input type="hidden" name="view" value="' . $input->getCmd('view', 'edit') . '" />' . PHP_EOL;
$html .= "\t" . '<input type="hidden" name="task" value="" />' . PHP_EOL;
$html .= "\t" . '<input type="hidden" name="' . $key . '" value="' . $keyValue . '" />' . PHP_EOL;
$html .= "\t" . '<input type="hidden" name="' . JFactory::getSession()->getFormToken() . '" value="1" />' . PHP_EOL;
foreach ($form->getFieldsets() as $fieldset) {
$fields = $form->getFieldset($fieldset->name);
if (isset($fieldset->class)) {
$class = 'class="' . $fieldset->class . '"';
} else {
$class = '';
}
$html .= "\t" . '<div id="' . $fieldset->name . '" ' . $class . '>' . PHP_EOL;
if (isset($fieldset->label) && !empty($fieldset->label)) {
$html .= "\t\t" . '<h3>' . JText::_($fieldset->label) . '</h3>' . PHP_EOL;
}
foreach ($fields as $field) {
$title = $field->title;
$required = $field->required;
$labelClass = $field->labelClass;
$description = $field->description;
$input = $field->input;
if (!is_null($title)) {
$html .= "\t\t\t" . '<div class="control-group">' . PHP_EOL;
$html .= "\t\t\t\t" . '<label class="control-label ' . $labelClass . '" for="' . $field->id . '">' . PHP_EOL;
$html .= "\t\t\t\t" . JText::_($title) . PHP_EOL;
if ($required) {
$html .= ' *';
}
$html .= "\t\t\t\t" . '</label>' . PHP_EOL;
$html .= "\t\t\t\t" . '<div class="controls">' . PHP_EOL;
$html .= "\t\t\t\t" . $input . PHP_EOL;
if (!empty($description)) {
$html .= "\t\t\t\t" . '<span class="help-block">';
$html .= JText::_($description) . '</span>' . PHP_EOL;
}
$html .= "\t\t\t\t" . '</div>' . PHP_EOL;
$html .= "\t\t\t" . '</div>' . PHP_EOL;
} else {
$html .= "\t\t\t\t" . $input . PHP_EOL;
}
}
$html .= "\t" . '</div>' . PHP_EOL;
}
$html .= '</form>';
return $html;
}
示例13: renderFormRaw
/**
* Renders a raw FOFForm and returns the corresponding HTML
*
* @param FOFForm &$form The form to render
* @param FOFModel $model The model providing our data
* @param FOFInput $input The input object
* @param string $formType The form type e.g. 'edit' or 'read'
*
* @return string The HTML rendering of the form
*/
protected function renderFormRaw(FOFForm &$form, FOFModel $model, FOFInput $input, $formType)
{
$html = '';
foreach ($form->getFieldsets() as $fieldset) {
$fields = $form->getFieldset($fieldset->name);
if (isset($fieldset->class)) {
$class = 'class="' . $fieldset->class . '"';
} else {
$class = '';
}
$html .= "\t" . '<div id="' . $fieldset->name . '" ' . $class . '>' . PHP_EOL;
if (isset($fieldset->label) && !empty($fieldset->label)) {
$html .= "\t\t" . '<h3>' . JText::_($fieldset->label) . '</h3>' . PHP_EOL;
}
foreach ($fields as $field) {
$required = $field->required;
$labelClass = $field->labelClass;
$groupClass = $form->getFieldAttribute($field->fieldname, 'groupclass', '', $field->group);
// Auto-generate label and description if needed
// Field label
$title = $form->getFieldAttribute($field->fieldname, 'label', '', $field->group);
$emptylabel = $form->getFieldAttribute($field->fieldname, 'emptylabel', false, $field->group);
if (empty($title) && !$emptylabel) {
$model->getName();
$title = strtoupper($input->get('option') . '_' . $model->getName() . '_' . $field->id . '_LABEL');
}
// Field description
$description = $form->getFieldAttribute($field->fieldname, 'description', '', $field->group);
/**
* The following code is backwards incompatible. Most forms don't require a description in their form
* fields. Having to use emptydescription="1" on each one of them is an overkill. Removed.
*/
/*
$emptydescription = $form->getFieldAttribute($field->fieldname, 'emptydescription', false, $field->group);
if (empty($description) && !$emptydescription)
{
$description = strtoupper($input->get('option') . '_' . $model->getName() . '_' . $field->id . '_DESC');
}
*/
if ($formType == 'read') {
$inputField = $field->static;
} elseif ($formType == 'edit') {
$inputField = $field->input;
}
if (empty($title)) {
$html .= "\t\t\t" . $inputField . PHP_EOL;
if (!empty($description) && $formType == 'edit') {
$html .= "\t\t\t\t" . '<span class="help-block">';
$html .= JText::_($description) . '</span>' . PHP_EOL;
}
} else {
$html .= "\t\t\t" . '<div class="control-group ' . $groupClass . '">' . PHP_EOL;
$html .= "\t\t\t\t" . '<label class="control-label ' . $labelClass . '" for="' . $field->id . '">' . PHP_EOL;
$html .= "\t\t\t\t" . JText::_($title) . PHP_EOL;
if ($required) {
$html .= ' *';
}
$html .= "\t\t\t\t" . '</label>' . PHP_EOL;
$html .= "\t\t\t\t" . '<div class="controls">' . PHP_EOL;
$html .= "\t\t\t\t" . $inputField . PHP_EOL;
if (!empty($description)) {
$html .= "\t\t\t\t" . '<span class="help-block">';
$html .= JText::_($description) . '</span>' . PHP_EOL;
}
$html .= "\t\t\t\t" . '</div>' . PHP_EOL;
$html .= "\t\t\t" . '</div>' . PHP_EOL;
}
}
$html .= "\t" . '</div>' . PHP_EOL;
}
return $html;
}
示例14: getOptions
/**
* Method to get the field options.
*
* @return array The field option objects.
*/
protected function getOptions()
{
$options = array();
$this->value = array();
$value_field = $this->element['value_field'] ? (string) $this->element['value_field'] : 'title';
$input = new FOFInput();
$component = ucfirst(str_replace('com_', '', $input->getString('option')));
$view = ucfirst($input->getString('view'));
$relation = FOFInflector::pluralize((string) $this->element['name']);
$model = FOFModel::getTmpInstance(ucfirst($relation), $component . 'Model');
$table = $model->getTable();
$key = $table->getKeyName();
$value = $table->getColumnAlias($value_field);
foreach ($model->getItemList(true) as $option) {
$options[] = JHtml::_('select.option', $option->{$key}, $option->{$value});
}
if ($id = FOFModel::getAnInstance($view)->getId()) {
$table = FOFTable::getInstance($view, $component . 'Table');
$table->load($id);
$relations = $table->getRelations()->getMultiple($relation);
foreach ($relations as $item) {
$this->value[] = $item->getId();
}
}
return $options;
}
示例15: findFormFilename
/**
* Guesses the best candidate for the path to use for a particular form.
*
* @param string $source The name of the form file to load, without the .xml extension.
* @param array $paths The paths to look into. You can declare this to override the default FOF paths.
*
* @return mixed A string if the path and filename of the form to load is found, false otherwise.
*
* @since 2.0
*/
public function findFormFilename($source, $paths = array())
{
// TODO Should we read from internal variables instead of the input? With a temp instance we have no input
$option = $this->input->getCmd('option', 'com_foobar');
$view = $this->name;
$componentPaths = FOFPlatform::getInstance()->getComponentBaseDirs($option);
$file_root = $componentPaths['main'];
$alt_file_root = $componentPaths['alt'];
$template_root = FOFPlatform::getInstance()->getTemplateOverridePath($option);
if (empty($paths)) {
// Set up the paths to look into
// PLEASE NOTE: If you ever change this, please update Model Unit tests, too, since we have to
// copy these default folders (we have to add the protocol for the virtual filesystem)
$paths = array($template_root . '/' . $view, $template_root . '/' . FOFInflector::singularize($view), $template_root . '/' . FOFInflector::pluralize($view), $file_root . '/views/' . $view . '/tmpl', $file_root . '/views/' . FOFInflector::singularize($view) . '/tmpl', $file_root . '/views/' . FOFInflector::pluralize($view) . '/tmpl', $alt_file_root . '/views/' . $view . '/tmpl', $alt_file_root . '/views/' . FOFInflector::singularize($view) . '/tmpl', $alt_file_root . '/views/' . FOFInflector::pluralize($view) . '/tmpl', $file_root . '/models/forms', $alt_file_root . '/models/forms');
}
$paths = array_unique($paths);
// Set up the suffixes to look into
$suffixes = array();
$temp_suffixes = FOFPlatform::getInstance()->getTemplateSuffixes();
if (!empty($temp_suffixes)) {
foreach ($temp_suffixes as $suffix) {
$suffixes[] = $suffix . '.xml';
}
}
$suffixes[] = '.xml';
// Look for all suffixes in all paths
$result = false;
$filesystem = FOFPlatform::getInstance()->getIntegrationObject('filesystem');
foreach ($paths as $path) {
foreach ($suffixes as $suffix) {
$filename = $path . '/' . $source . $suffix;
if ($filesystem->fileExists($filename)) {
$result = $filename;
break;
}
}
if ($result) {
break;
}
}
return $result;
}