本文整理汇总了PHP中FabrikString::stripSpace方法的典型用法代码示例。如果您正苦于以下问题:PHP FabrikString::stripSpace方法的具体用法?PHP FabrikString::stripSpace怎么用?PHP FabrikString::stripSpace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FabrikString
的用法示例。
在下文中一共展示了FabrikString::stripSpace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onAfterProcess
/**
* Run right at the end of the form processing
* form needs to be set to record in database for this to hook to be called
*
* @return bool
*/
public function onAfterProcess()
{
$params = $this->getParams();
$input = $this->app->input;
$formModel = $this->getModel();
if ($params->get('ask-receipt')) {
if (!array_key_exists('fabrik_email_copy', $_POST)) {
return;
}
}
$rowId = $input->get('rowid');
$config = JFactory::getConfig();
$w = new FabrikWorker();
$data = $this->getProcessData();
$message = $params->get('receipt_message');
$editURL = COM_FABRIK_LIVESITE . "index.php?option=com_" . $this->package . "&view=form&fabrik=" . $formModel->get('id') . "&rowid=" . $rowId;
$viewURL = COM_FABRIK_LIVESITE . "index.php?option=com_" . $this->package . "&view=details&fabrik=" . $formModel->get('id') . "&rowid=" . $rowId;
$editLink = "<a href=\"{$editURL}\">" . FText::_('EDIT') . "</a>";
$viewLink = "<a href=\"{$viewURL}\">" . FText::_('VIEW') . "</a>";
$message = str_replace('{fabrik_editlink}', $editLink, $message);
$message = str_replace('{fabrik_viewlink}', $viewLink, $message);
$message = str_replace('{fabrik_editurl}', $editURL, $message);
$message = str_replace('{fabrik_viewurl}', $viewURL, $message);
$message = $w->parseMessageForPlaceHolder($message, $data, false);
$to = $w->parseMessageForPlaceHolder($params->get('receipt_to'), $data, false);
$to = FabrikString::stripSpace($to);
if (empty($to)) {
/* $$$ hugh - not much point trying to send if we don't have a To address
* (happens frequently if folk don't properly validate their form inputs and are using placeholders)
* @TODO - might want to add some feedback about email not being sent
*/
return;
}
$to = explode(',', $to);
$subject = html_entity_decode($params->get('receipt_subject', ''));
$subject = JText::_($w->parseMessageForPlaceHolder($subject, $data, false));
$from = $config->get('mailfrom', '');
$fromName = $config->get('fromname', '');
// Darn silly hack for poor joomfish settings where lang parameters are set to override joomla global config but not mail translations entered
$rawConfig = new JConfig();
if ($from === '') {
$from = $rawConfig->mailfrom;
}
if ($fromName === '') {
$fromName = $rawConfig->fromname;
}
$from = $params->get('from_email', $from);
$res = FabrikWorker::sendMail($from, $fromName, $to, $subject, $message, true);
if (!$res) {
throw new RuntimeException('Couldn\'t send receipt', 500);
}
}
示例2: loadElementJS
/**
* Helper function to decide which js files and shim files should be used
*
* @since 3.1b
*
* @return array (element js files (not used), array of element names, require js shim setup files)
*/
protected function loadElementJS()
{
if (!empty($this->elementJs)) {
return $this->elementJs;
}
$params = $this->getParams();
$input = $this->app->input;
$listModel = JModelLegacy::getInstance('list', 'FabrikFEModel');
$listModel->setId($input->getInt('listid'));
$elements = $listModel->getElements('safecolname');
$pels = FabrikString::stripSpace($params->get('inline_editable_elements', ''));
$use = json_decode($pels);
if (!is_object($use)) {
$aEls = trim($pels) == '' ? array() : explode(",", $pels);
$use = new stdClass();
foreach ($aEls as $e) {
$use->{$e} = array($e);
}
}
$els = array();
$srcs = array();
$test = (array) $use;
$shim = array();
if (!empty($test)) {
foreach ($use as $key => $fields) {
if (array_key_exists($key, $elements)) {
$trigger = $elements[$key];
$els[$key] = new stdClass();
$els[$key]->elid = $trigger->getId();
$els[$key]->plugins = array();
foreach ($fields as $field) {
$val = $elements[$field];
// Load in all element js classes
if (is_object($val)) {
$val->formJavascriptClass($srcs, '', $shim);
$els[$key]->plugins[$field] = $val->getElement()->id;
}
}
}
}
} else {
foreach ($elements as $key => $val) {
// Stop elements such as the password element from incorrectly updating themselves
if ($val->recordInDatabase(array())) {
$key = FabrikString::safeColNameToArrayKey($key);
$els[$key] = new stdClass();
$els[$key]->elid = $val->getId();
$els[$key]->plugins = array();
$els[$key]->plugins[$key] = $val->getElement()->id;
// Load in all element js classes
$val->formJavascriptClass($srcs, '', $shim);
}
}
}
$this->elementJs = array($srcs, $els, $shim);
return $this->elementJs;
}