当前位置: 首页>>代码示例>>PHP>>正文


PHP FabrikWorker::parseMessageForPlaceHolder方法代码示例

本文整理汇总了PHP中FabrikWorker::parseMessageForPlaceHolder方法的典型用法代码示例。如果您正苦于以下问题:PHP FabrikWorker::parseMessageForPlaceHolder方法的具体用法?PHP FabrikWorker::parseMessageForPlaceHolder怎么用?PHP FabrikWorker::parseMessageForPlaceHolder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FabrikWorker的用法示例。


在下文中一共展示了FabrikWorker::parseMessageForPlaceHolder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onLastProcess

 /**
  * Process the plugin, called after form is submitted
  *
  * @return  bool
  */
 public function onLastProcess()
 {
     $formModel = $this->getModel();
     $params = $this->getParams();
     $app = JFactory::getApplication();
     $package = $app->getUserState('com_fabrik.package', 'fabrik');
     $session = JFactory::getSession();
     $context = $formModel->getRedirectContext();
     // Get existing session params
     $surl = (array) $session->get($context . 'url', array());
     $stitle = (array) $session->get($context . 'title', array());
     $smsg = (array) $session->get($context . 'msg', array());
     $sshowsystemmsg = (array) $session->get($context . 'showsystemmsg', array());
     $this->formModel = $formModel;
     $w = new FabrikWorker();
     $form = $formModel->getForm();
     $this->data = $this->getProcessData();
     $this->data['append_jump_url'] = $params->get('append_jump_url');
     $this->data['save_in_session'] = $params->get('save_insession');
     $this->data['jump_page'] = $w->parseMessageForPlaceHolder($params->get('jump_page'), $this->data);
     $this->data['thanks_message'] = $w->parseMessageForPlaceHolder($params->get('thanks_message'), $this->data);
     if (!$this->shouldRedirect($params)) {
         // Clear any session redirects
         unset($surl[$this->renderOrder]);
         unset($stitle[$this->renderOrder]);
         unset($smsg[$this->renderOrder]);
         unset($sshowsystemmsg[$this->renderOrder]);
         $session->set($context . 'url', $surl);
         $session->set($context . 'title', $stitle);
         $session->set($context . 'msg', $smsg);
         $session->set($context . 'showsystemmsg', $sshowsystemmsg);
         return true;
     }
     $this->_storeInSession();
     $sshowsystemmsg[$this->renderOrder] = true;
     $session->set($context . 'showsystemmsg', $sshowsystemmsg);
     if ($this->data['jump_page'] != '') {
         $this->data['jump_page'] = $this->buildJumpPage();
         // 3.0 ajax/module redirect logic handled in form controller not in plugin
         $surl[$this->renderOrder] = $this->data['jump_page'];
         $session->set($context . 'url', $surl);
         $session->set($context . 'redirect_content_how', $params->get('redirect_content_how', 'popup'));
         $session->set($context . 'redirect_content_popup_width', $params->get('redirect_content_popup_width', '300'));
         $session->set($context . 'redirect_content_popup_height', $params->get('redirect_content_popup_height', '300'));
         $session->set($context . 'redirect_content_popup_x_offset', $params->get('redirect_content_popup_x_offset', '0'));
         $session->set($context . 'redirect_content_popup_y_offset', $params->get('redirect_content_popup_y_offset', '0'));
         $session->set($context . 'redirect_content_popup_title', $params->get('redirect_content_popup_title', ''));
         $session->set($context . 'redirect_content_popup_reset_form', $params->get('redirect_content_popup_reset_form', '1'));
     } else {
         $sshowsystemmsg[$this->renderOrder] = false;
         $session->set($context . 'showsystemmsg', $sshowsystemmsg);
         $stitle[$this->renderOrder] = $form->label;
         $session->set($context . 'title', $stitle);
         $surl[$this->renderOrder] = 'index.php?option=com_' . $package . '&view=plugin&g=form&plugin=redirect&method=displayThanks&task=pluginAjax';
         $session->set($context . 'url', $surl);
     }
     $smsg[$this->renderOrder] = $this->data['thanks_message'];
     $session->set($context . 'msg', $smsg);
     return true;
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:65,代码来源:redirect.php

示例2: getFabrikItem

 /**
  * Decorate the J2Store product information with its related Fabrik record
  *
  * @param $product
  *
  * @return object
  */
 private function getFabrikItem(&$product)
 {
     list($component, $listId) = explode('.', $product->product_source);
     $key = $listId . '.' . $product->product_source_id;
     static $sets;
     if (!is_array($sets)) {
         $sets = array();
     }
     if (!isset($sets[$key])) {
         JModelLegacy::addIncludePath(COM_FABRIK_FRONTEND . '/models', 'FabrikFEModel');
         /** @var FabrikFEModelList $listModel */
         $listModel = JModelLegacy::getInstance('List', 'FabrikFEModel');
         $listModel->setId($listId);
         $formModel = $listModel->getFormModel();
         $formModel->setRowId($product->product_source_id);
         $row = $formModel->getData();
         $params = $formModel->getParams();
         $index = array_search('j2store', (array) $params->get('plugins', array(), 'array'));
         $w = new FabrikWorker();
         $plugIn = FabrikWorker::getPluginManager()->loadPlugIn('j2store', 'form');
         // Set params relative to plugin render order
         $plugInParams = $plugIn->setParams($params, $index);
         $context = new stdClass();
         $context->title = $w->parseMessageForPlaceHolder($plugInParams->get('j2store_product_name'), $row);
         $context->published = $w->parseMessageForPlaceHolder($plugInParams->get('j2store_enabled'), $row);
         $objectRow = JArrayHelper::toObject($row);
         $context->viewLink = $listModel->viewDetailsLink($objectRow);
         $context->editLink = $listModel->editLink($objectRow);
         $context->id = $objectRow->__pk_val;
         $sets[$key] = $context;
     }
     //echo "<pre>";print_r($sets);echo "</pre>";
     return $sets[$key];
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:41,代码来源:fabrikj2store.php

示例3: display

 /**
  * Main setup routine for displaying the form/detail view
  *
  * @param   string $tpl template
  *
  * @return  void
  */
 public function display($tpl = null)
 {
     if (parent::display($tpl) !== false) {
         $this->output();
         if (!$this->app->isAdmin()) {
             $this->state = $this->get('State');
             $model = $this->getModel();
             $this->params = $this->state->get('params');
             $row = $model->getData();
             $w = new FabrikWorker();
             if ($this->params->get('menu-meta_description')) {
                 $desc = $w->parseMessageForPlaceHolder($this->params->get('menu-meta_description'), $row);
                 $this->doc->setDescription($desc);
             }
             if ($this->params->get('menu-meta_keywords')) {
                 $keywords = $w->parseMessageForPlaceHolder($this->params->get('menu-meta_keywords'), $row);
                 $this->doc->setMetadata('keywords', $keywords);
             }
             if ($this->params->get('robots')) {
                 $this->doc->setMetadata('robots', $this->params->get('robots'));
             }
             // Set the response to indicate a file download
             $this->app->setHeader('Content-Type', 'application/vnd.ms-word');
             $name = $this->getModel()->getTable()->label;
             $name = JStringNormalise::toDashSeparated($name);
             $this->app->setHeader('Content-Disposition', "attachment;filename=\"" . $name . ".doc\"");
             $this->doc->setMimeEncoding('text/html; charset=Windows-1252', false);
         }
     }
 }
开发者ID:LGBGit,项目名称:tierno,代码行数:37,代码来源:view.word.php

示例4: onAfterProcess

 /**
  * process the plugin, called when form is submitted
  *
  * @param object $params
  * @param object form
  */
 function onAfterProcess($params, &$formModel)
 {
     if ($params->get('ask-receipt')) {
         $post = JRequest::get('post');
         if (!array_key_exists('fabrik_email_copy', $post)) {
             return;
         }
     }
     $config =& JFactory::getConfig();
     $w = new FabrikWorker();
     $this->formModel =& $formModel;
     $form =& $formModel->getForm();
     //getEmailData returns correctly formatted {tablename___elementname} keyed results
     //_formData is there for legacy and may allow you to use {elementname} only placeholders for simple forms
     $aData = array_merge($this->getEmailData(), $formModel->_formData);
     $message = $params->get('receipt_message');
     $editURL = COM_FABRIK_LIVESITE . "index.php?option=com_fabrik&amp;view=form&amp;fabrik=" . $formModel->get('id') . "&amp;rowid=" . JRequest::getVar('rowid');
     $viewURL = COM_FABRIK_LIVESITE . "index.php?option=com_fabrik&amp;view=details&amp;fabrik=" . $formModel->get('id') . "&amp;rowid=" . JRequest::getVar('rowid');
     $editlink = "<a href=\"{$editURL}\">" . JText::_('EDIT') . "</a>";
     $viewlink = "<a href=\"{$viewURL}\">" . JText::_('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, $aData, false);
     $to = $w->parseMessageForPlaceHolder($params->get('receipt_to'), $aData, false);
     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;
     }
     /*
     // $$$ hugh - this code doesn't seem to be used?
     // it sets $email, which is then never referenced?
     $receipt_email = $params->get('receipt_to');
     if (!$form->record_in_database) {
     	foreach ($aData as $key=>$val) {
     		$aBits = explode('___', $key);
     		$newKey = array_pop( $aBits);
     		if ($newKey == $receipt_email) {
     			$email = $val;
     		}
     	}
     }
     */
     $subject = html_entity_decode($params->get('receipt_subject', ''));
     $subject = $w->parseMessageForPlaceHolder($subject, null, false);
     $from = $config->getValue('mailfrom');
     $fromname = $config->getValue('fromname');
     //darn silly hack for poor joomfish settings where lang parameters are set to overide joomla global config but not mail translations entered
     $rawconfig = new JConfig();
     if ($from === '') {
         $from = $rawconfig->mailfrom;
     }
     if ($fromname === '') {
         $fromname = $rawconfig->fromname;
     }
     $res = JUTility::sendMail($from, $fromname, $to, $subject, $message, true);
 }
开发者ID:juliano-hallac,项目名称:fabrik,代码行数:66,代码来源:receipt.php

示例5: display

 /**
  * Main setup routine for displaying the form/detail view
  *
  * @param   string $tpl template
  *
  * @return  void
  */
 public function display($tpl = null)
 {
     if (parent::display($tpl) !== false) {
         $this->setCanonicalLink();
         $this->output();
         if (!$this->app->isAdmin()) {
             $this->state = $this->get('State');
             $model = $this->getModel();
             $this->params = $this->state->get('params');
             $row = $model->getData();
             $w = new FabrikWorker();
             if ($this->params->get('menu-meta_description')) {
                 $desc = $w->parseMessageForPlaceHolder($this->params->get('menu-meta_description'), $row);
                 $this->doc->setDescription($desc);
             }
             if ($this->params->get('menu-meta_keywords')) {
                 $keywords = $w->parseMessageForPlaceHolder($this->params->get('menu-meta_keywords'), $row);
                 $this->doc->setMetadata('keywords', $keywords);
             }
             if ($this->params->get('robots')) {
                 $this->doc->setMetadata('robots', $this->params->get('robots'));
             }
         }
     }
 }
开发者ID:glauberm,项目名称:cinevi,代码行数:32,代码来源:view.html.php

示例6: process

	/**
	 * do the plugin action
	 * @return number of records updated
	 */

	function process(&$data)
	{
		$app = JFactory::getApplication();
		jimport('joomla.mail.helper');
		$params = $this->getParams();
		$msg = $params->get('message');
		$to = $params->get('to');
		$w = new FabrikWorker();
		$MailFrom = $app->getCfg('mailfrom');
		$FromName = $app->getCfg('fromname');
		$subject = $params->get('subject', 'Fabrik cron job');
		$eval = $params->get('cronemail-eval');
		$condition = $params->get('cronemail_condition', '');
		$updates = array();
		foreach ($data as $group) {
			if (is_array($group)) {
				foreach ($group as $row) {
					if (!empty($condition)) {
						$this_condition = $w->parseMessageForPlaceHolder($condition, $row);
						if (eval($this_condition === false)) {
							continue;
						}
					}
					$row = JArrayHelper::fromObject($row);
					$thisto = $w->parseMessageForPlaceHolder($to, $row);
					if (JMailHelper::isEmailAddress($thisto)) {
						$thismsg = $w->parseMessageForPlaceHolder($msg, $row);
						if ($eval) {
							$thismsg = eval($thismsg);
						}
						$thissubject = $w->parseMessageForPlaceHolder($subject, $row);
						$res = JUTility::sendMail( $MailFrom, $FromName, $thisto, $thissubject, $thismsg, true);
					}
					$updates[] = $row['__pk_val'];

				}
			}
		}
		$field = $params->get('cronemail-updatefield');
		if (!empty( $updates) && trim($field ) != '') {
			//do any update found
			$listModel = JModel::getInstance('list', 'FabrikFEModel');
			$listModel->setId($params->get('table'));
			$table = $listModel->getTable();

			$connection = $params->get('connection');
			$field = $params->get('cronemail-updatefield');
			$value = $params->get('cronemail-updatefield-value');

			$field = str_replace("___", ".", $field);
			$query = "UPDATE $table->db_table_name set $field = " . $fabrikDb->Quote($value) . " WHERE $table->db_primary_key IN (" . implode(',', $updates) . ")";
			$fabrikDb = $listModel->getDb();
			$fabrikDb->setQuery($query);
			$fabrikDb->query();
		}
		return count($updates);
	}
开发者ID:Jobar87,项目名称:fabrik,代码行数:62,代码来源:email.php

示例7: onLastProcess

 /**
  * process the plugin, called afer form is submitted
  *
  * @param object $params (with the current active plugin values in them)
  * @param object form
  */
 function onLastProcess($params, &$formModel)
 {
     $session = JFactory::getSession();
     $context = 'com_fabrik.form.' . $formModel->get('id') . '.redirect.';
     //get existing session params
     $surl = (array) $session->get($context . 'url', array());
     $stitle = (array) $session->get($context . 'title', array());
     $smsg = (array) $session->get($context . 'msg', array());
     $sshowsystemmsg = (array) $session->get($context . 'showsystemmsg', array());
     $app = JFactory::getApplication();
     $this->formModel =& $formModel;
     $w = new FabrikWorker();
     $this->_data = new stdClass();
     $this->_data->append_jump_url = $params->get('append_jump_url');
     $this->_data->save_in_session = $params->get('save_insession');
     $form =& $formModel->getForm();
     $this->data = array_merge($this->getEmailData(), $formModel->_formData);
     $this->_data->jump_page = $w->parseMessageForPlaceHolder($params->get('jump_page'), $this->data);
     $this->_data->thanks_message = $w->parseMessageForPlaceHolder($params->get('thanks_message'), $this->data);
     if (!$this->shouldRedirect($params)) {
         //clear any sessoin redirects
         unset($surl[$this->renderOrder]);
         unset($stitle[$this->renderOrder]);
         unset($smsg[$this->renderOrder]);
         unset($sshowsystemmsg[$this->renderOrder]);
         $session->set($context . 'url', $surl);
         $session->set($context . 'title', $stitle);
         $session->set($context . 'msg', $smsg);
         $session->set($context . 'showsystemmsg', $sshowsystemmsg);
         /*$session->clear($context.'url');
         	 $session->clear($context.'title');
         	 $session->clear($context.'msg');*/
         return true;
     }
     $this->_storeInSession($formModel);
     $sshowsystemmsg[$this->renderOrder] = true;
     $session->set($context . 'showsystemmsg', $sshowsystemmsg);
     if ($this->_data->jump_page != '') {
         $this->_data->jump_page = $this->_buildJumpPage($formModel);
         //3.0 ajax/module redirect logic handled in form controller not in plugin
         $surl[$this->renderOrder] = $this->_data->jump_page;
         $session->set($context . 'url', $surl);
     } else {
         $sshowsystemmsg[$this->renderOrder] = false;
         $session->set($context . 'showsystemmsg', $sshowsystemmsg);
         $stitle[$this->renderOrder] = $form->label;
         $session->set($context . 'title', $stitle);
         $surl[$this->renderOrder] = 'index.php?option=com_fabrik&view=plugin&g=form&plugin=redirect&method=displayThanks&task=pluginAjax';
         $session->set($context . 'url', $surl);
     }
     $smsg[$this->renderOrder] = $this->_data->thanks_message;
     $session->set($context . 'msg', $smsg);
     return true;
 }
开发者ID:juliano-hallac,项目名称:fabrik,代码行数:60,代码来源:redirect.php

示例8: 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 . "&amp;view=form&amp;fabrik=" . $formModel->get('id') . "&amp;rowid=" . $rowId;
     $viewURL = COM_FABRIK_LIVESITE . "index.php?option=com_" . $this->package . "&amp;view=details&amp;fabrik=" . $formModel->get('id') . "&amp;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);
     }
 }
开发者ID:glauberm,项目名称:cinevi,代码行数:58,代码来源:receipt.php

示例9: 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
  *
  * @param   object  $params      plugin params
  * @param   object  &$formModel  form model
  *
  * @return	bool
  */
 public function onAfterProcess($params, &$formModel)
 {
     jimport('joomla.filesystem.file');
     $files[] = COM_FABRIK_BASE . 'components/com_kunena/class.kunena.php';
     $define = COM_FABRIK_BASE . 'components/com_kunena/lib/kunena.defines.php';
     $files[] = COM_FABRIK_BASE . 'components/com_kunena/lib/kunena.defines.php';
     $files[] = COM_FABRIK_BASE . 'components/com_kunena/lib/kunena.link.class.php';
     $files[] = COM_FABRIK_BASE . 'components/com_kunena/lib/kunena.smile.class.php';
     if (!JFile::exists($define)) {
         return JError::raiseError(500, 'could not find the Kunena component');
     }
     require_once $define;
     foreach ($files as $file) {
         require_once $file;
     }
     if (JFile::exists(KUNENA_PATH_FUNCS . '/post.php')) {
         $postfile = KUNENA_PATH_FUNCS . '/post.php';
     } else {
         $postfile = KUNENA_PATH_TEMPLATE_DEFAULT . '/post.php';
     }
     $w = new FabrikWorker();
     // $fbSession = CKunenaSession::getInstance();
     // Don't need this, session is loaded in CKunenaPost
     $catid = $params->get('kunena_category', 0);
     $parentid = 0;
     $action = 'post';
     // Added action in request
     JRequest::setVar('action', $action);
     $func = 'post';
     $contentURL = 'empty';
     JRequest::setVar('catid', $catid);
     $msg = $w->parseMessageForPlaceHolder($params->get('kunena_content'), $formModel->_fullFormData);
     $subject = $params->get('kunena_title');
     JRequest::SetVar('message', $msg);
     $subject = $w->parseMessageForPlaceHolder($subject, $formModel->_fullFormData);
     // Added subject in request
     JRequest::SetVar('subject', $subject);
     $origId = JRequest::getVar('id');
     JRequest::setVar('id', 0);
     /*
     		ob_start();
     		include ($postfile);
     		ob_end_clean();
     */
     ob_start();
     include $postfile;
     $mypost = new CKunenaPost();
     // Public CKunenaPost::display() will call protected method CKunenaPost::post() if JRequest action is 'post'
     $mypost->display();
     ob_end_clean();
     JRequest::setVar('id', $origId);
 }
开发者ID:rogeriocc,项目名称:fabrik,代码行数:61,代码来源:kunena.php

示例10: render

 /**
  * Draws the form element
  *
  * @param   array  $data           to pre-populate element with
  * @param   int    $repeatCounter  repeat group counter
  *
  * @return  string  returns element html
  */
 public function render($data, $repeatCounter = 0)
 {
     $params = $this->getParams();
     $displayData = new stdClass();
     $displayData->num = $params->get('fbcomment_number_of_comments', 10);
     $displayData->width = $params->get('fbcomment_width', 300);
     $displayData->colour = $params->get('fb_comment_scheme') == '' ? '' : ' colorscheme="dark" ';
     $displayData->href = $params->get('fbcomment_href', '');
     if (empty($data->href)) {
         $rowId = $this->app->input->getString('rowid', '', 'string');
         if ($rowId != '') {
             $formModel = $this->getFormModel();
             $formId = $formModel->getId();
             $href = 'index.php?option=com_fabrik&view=form&formid=' . $formId . '&rowid=' . $rowId;
             $href = JRoute::_($href);
             $displayData->href = COM_FABRIK_LIVESITE_ROOT . $href;
         }
     }
     if (!empty($displayData->href)) {
         $w = new FabrikWorker();
         $displayData->href = $w->parseMessageForPlaceHolder($data->href, $data);
         $locale = $params->get('fbcomment_locale', 'en_US');
         if (empty($locale)) {
             $locale = 'en_US';
         }
         $displayData->graphApi = FabrikHelperHTML::facebookGraphAPI($params->get('opengraph_applicationid'), $locale);
     }
     $layout = $this->getLayout('form');
     return $layout->render($displayData);
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:38,代码来源:fbcomment.php

示例11: onCanEdit

 /**
  * Can the row be edited
  *
  * @param   object  $params     plugin params
  * @param   object  $listModel  list model
  * @param   object  $row        current row to test
  *
  * @return boolean
  */
 public function onCanEdit($params, $listModel, $row)
 {
     // If $row is null, we were called from the table's canEdit() in a per-table rather than per-row context,
     // and we don't have an opinion on per-table edit permissions, so just return true.
     if (is_null($row) || is_null($row[0])) {
         return true;
     }
     if (is_array($row[0])) {
         $data = JArrayHelper::toObject($row[0]);
     } else {
         $data = $row[0];
     }
     $field = str_replace('.', '___', $params->get('caneditrow_field'));
     // If they provided some PHP to eval, we ignore the other settings and just run their code
     $caneditrow_eval = $params->get('caneditrow_eval', '');
     // $$$ rob if no can edit field selected in admin return true
     if (trim($field) == '' && trim($caneditrow_eval) == '') {
         return true;
     }
     if (!empty($caneditrow_eval)) {
         $w = new FabrikWorker();
         $data = JArrayHelper::fromObject($data);
         $caneditrow_eval = $w->parseMessageForPlaceHolder($caneditrow_eval, $data);
         $caneditrow_eval = @eval($caneditrow_eval);
         FabrikWorker::logEval($caneditrow_eval, 'Caught exception on eval in can edit row : %s');
         return $caneditrow_eval;
     } else {
         // No PHP given, so just do a simple match on the specified element and value settings.
         if ($params->get('caneditrow_useraw', '0') == '1') {
             $field .= '_raw';
         }
         $value = $params->get('caneditrow_value');
         return $data->{$field} == $value;
     }
 }
开发者ID:rogeriocc,项目名称:fabrik,代码行数:44,代码来源:caneditrow.php

示例12: shouldValidate

	/**
	 * looks at the validation condition & evaulates it
	 * if evaulation is true then the validation rule is applied
	 *@return bol apply validation
	 */

	function shouldValidate($data, $c)
	{
		$params = $this->getParams();
		$post	= JRequest::get('post');
		$v = (array)$params->get($this->_pluginName .'-validation_condition');
		if (!array_key_exists($c, $v)) {
			return true;
		}
		$condition = $v[$c];
		if ($condition == '') {
			return true;
		}
		
		$w = new FabrikWorker();

		// $$$ rob merge join data into main array so we can access them in parseMessageForPlaceHolder()
		$joindata = JArrayHelper::getValue($post, 'join', array());
		foreach ($joindata as $joinid => $joind) {
			foreach ($joind as $k => $v) {
				if ($k !== 'rowid') {
					$post[$k] = $v;
				}
			}
		}

		$condition = trim($w->parseMessageForPlaceHolder($condition, $post));
		
		$res = @eval($condition);
		if (is_null($res)) {
			return true;
		}
		return $res;
	}
开发者ID:Jobar87,项目名称:fabrik,代码行数:39,代码来源:validation_rule.php

示例13: shouldValidate

 /**
  * looks at the validation condition & evaulates it
  * if evaulation is true then the validation rule is applied
  *@return bol apply validation
  */
 function shouldValidate($data, $c)
 {
     $params =& $this->getParams();
     $post = JRequest::get('post');
     $v = $params->get($this->_pluginName . '-validation_condition', '', '_default', 'array', $c);
     if (!array_key_exists($c, $v)) {
         return true;
     }
     $condition = $v[$c];
     if ($condition == '') {
         return true;
     }
     $w = new FabrikWorker();
     // $$$ rob merge join data into main array so we can access them in parseMessageForPlaceHolder()
     $joindata = JArrayHelper::getValue($post, 'join', array());
     foreach ($joindata as $joinid => $joind) {
         foreach ($joind as $k => $v) {
             if ($k !== 'rowid') {
                 $post[$k] = $v;
             }
         }
     }
     $condition = trim($w->parseMessageForPlaceHolder($condition, $post));
     // $$$ hugh - this screws things up if it's more than one line of code.
     /*
     if (substr(strtolower($condition ), 0, 6) !== 'return') {
     	$condition = "return $condition";
     }
     */
     $res = @eval($condition);
     if (is_null($res)) {
         return true;
     }
     return $res;
 }
开发者ID:juliano-hallac,项目名称:fabrik,代码行数:40,代码来源:validation_rule.php

示例14: onCanEdit

 /**
  * Can the row be edited
  *
  * @param   object  $row  Current row to test
  *
  * @return boolean
  */
 public function onCanEdit($row)
 {
     $params = $this->getParams();
     // If $row is null, we were called from the list's canEdit() in a per-table rather than per-row context,
     // and we don't have an opinion on per-table edit permissions, so just return true.
     if (is_null($row) || is_null($row[0])) {
         return true;
     }
     if (is_array($row[0])) {
         $data = ArrayHelper::toObject($row[0]);
     } else {
         $data = $row[0];
     }
     /**
      * If __pk_val is not set or empty, then we've probably been called from somewhere in form processing,
      * and this is a new row.  In which case this plugin cannot offer any opinion!
      */
     if (!isset($data->__pk_val) || empty($data->__pk_val)) {
         return true;
     }
     $field = str_replace('.', '___', $params->get('caneditrow_field'));
     // If they provided some PHP to eval, we ignore the other settings and just run their code
     $caneditrow_eval = $params->get('caneditrow_eval', '');
     // $$$ rob if no can edit field selected in admin return true
     if (trim($field) == '' && trim($caneditrow_eval) == '') {
         $this->acl[$data->__pk_val] = true;
         return true;
     }
     if (!empty($caneditrow_eval)) {
         $w = new FabrikWorker();
         $data = ArrayHelper::fromObject($data);
         $caneditrow_eval = $w->parseMessageForPlaceHolder($caneditrow_eval, $data);
         FabrikWorker::clearEval();
         $caneditrow_eval = @eval($caneditrow_eval);
         FabrikWorker::logEval($caneditrow_eval, 'Caught exception on eval in can edit row : %s');
         $this->acl[$data['__pk_val']] = $caneditrow_eval;
         return $caneditrow_eval;
     } else {
         // No PHP given, so just do a simple match on the specified element and value settings.
         if ($params->get('caneditrow_useraw', '0') == '1') {
             $field .= '_raw';
         }
         $value = $params->get('caneditrow_value');
         $operator = $params->get('operator', '=');
         if (is_object($data->{$field})) {
             $data->{$field} = ArrayHelper::fromObject($data->{$field});
         }
         switch ($operator) {
             case '=':
             default:
                 $return = is_array($data->{$field}) ? in_array($value, $data->{$field}) : $data->{$field} == $value;
                 break;
             case "!=":
                 $return = is_array($data->{$field}) ? !in_array($value, $data->{$field}) : $data->{$field} != $value;
                 break;
         }
         $this->acl[$data->__pk_val] = $return;
         return $return;
     }
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:67,代码来源:caneditrow.php

示例15: onBeforeStore

	/**
	 * process the plugin, called when form is submitted
	 *
	 * @param object $params
	 * @param object form
	 */

	function onBeforeStore( &$params, &$formModel )
	{
		return;
		jimport('joomla.filesystem.file');
		$files[]  = COM_FABRIK_BASE.'administrator'.DS.'components'.DS.'com_kunena'.DS.'language'.DS.'kunena.english.php';
		$files[] = COM_FABRIK_BASE.'components'.DS.'com_kunena'.DS.'class.kunena.php';
		$define = COM_FABRIK_BASE.'components'.DS.'com_kunena'.DS.'lib'.DS.'kunena.defines.php';
		$files[]  = COM_FABRIK_BASE.'components'.DS.'com_kunena'.DS.'lib'.DS.'kunena.defines.php';
		$files[]  = COM_FABRIK_BASE.'components'.DS.'com_kunena'.DS.'lib'.DS.'kunena.session.class.php';
		$files[]  = COM_FABRIK_BASE.'components'.DS.'com_kunena'.DS.'lib'.DS.'kunena.link.class.php';
		$files[]  = COM_FABRIK_BASE.'components'.DS.'com_kunena'.DS.'lib'.DS.'kunena.link.class.php';
		$files[]  = COM_FABRIK_BASE.'components'.DS.'com_kunena'.DS.'template'.DS.'default'.DS.'smile.class.php';
		if (!JFile::exists($define)) {
			return JError::raiseError(500, 'could not find the Kunena component');
		}
		require_once($define);
		foreach ($files as $file) {
			require_once($file);
		}
		if (JFile::exists(KUNENA_ABSTMPLTPATH . '/post.php')) {
			$postfile = KUNENA_ABSTMPLTPATH . '/post.php';
		}
		else {
			$postfile = KUNENA_PATH_TEMPLATE_DEFAULT .DS. 'post.php';
		}
		$w = new FabrikWorker();
		$fbSession = CKunenaSession::getInstance();


		$catid =$params->get('kunena_category', 0);
		$parentid = 0;
		$action = 'post';
		$func = 'post';
		$contentURL = 'empty';
		JRequest::setVar('catid', $catid);
		$msg = $w->parseMessageForPlaceHolder($params->get('kunena_content'), $formModel->_fullFormData);
		$subject = $params->get('kunena_title');
		JRequest::SetVar('message', $msg);
		$subject = $w->parseMessageForPlaceHolder($subject, $formModel->_fullFormData);
		$origId = JRequest::getVar('id');
		JRequest::setVar('id', 0);
		ob_start();
		include ($postfile);
		ob_end_clean();
		JRequest::setVar('id', $origId);
	}
开发者ID:Jobar87,项目名称:fabrik,代码行数:53,代码来源:kunena.php


注:本文中的FabrikWorker::parseMessageForPlaceHolder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。