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


PHP RSFormProHelper::getReplacements方法代码示例

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


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

示例1: rsfp_doPayment

 public function rsfp_doPayment($payValue, $formId, $SubmissionId, $price, $products, $code)
 {
     // execute only for our plugin
     if ($payValue != $this->componentValue) {
         return;
     }
     if ($price > 0) {
         list($replace, $with) = RSFormProHelper::getReplacements($SubmissionId);
         $args = array('cmd' => '_xclick', 'business' => RSFormProHelper::getConfig('paypal.email'), 'item_name' => implode(', ', $products), 'currency_code' => RSFormProHelper::getConfig('payment.currency'), 'amount' => number_format($price, 2, '.', ''), 'notify_url' => JURI::root() . 'index.php?option=com_rsform&formId=' . $formId . '&task=plugin&plugin_task=paypal.notify&code=' . $code, 'charset' => 'utf-8', 'lc' => RSFormProHelper::getConfig('paypal.language') ? RSFormProHelper::getConfig('paypal.language') : 'US', 'bn' => 'RSJoomla_SP');
         // Add cancel URL
         if ($cancel = RSFormProHelper::getConfig('paypal.cancel')) {
             $args['cancel_return'] = str_replace($replace, $with, $cancel);
         }
         // Add return URL
         if ($return = RSFormProHelper::getConfig('paypal.return')) {
             $args['return'] = str_replace($replace, $with, $return);
         }
         // Add tax
         if ($tax = RSFormProHelper::getConfig('paypal.tax.value')) {
             if (RSFormProHelper::getConfig('paypal.tax.type')) {
                 $args['tax'] = $tax;
             } else {
                 $args['tax_rate'] = $tax;
             }
         }
         // Get a new instance of the PayPal object. This is used so that we can programatically change values sent to PayPal through the "Scripts" areas.
         $paypal = RSFormProPayPal::getInstance();
         // If any options have already been set, use this to override the ones used here
         $paypal->args = array_merge($args, $paypal->args);
         $paypal->url = RSFormProHelper::getConfig('paypal.test') ? 'https://www.paypal.com/cgi-bin/webscr' : 'https://www.sandbox.paypal.com/cgi-bin/webscr';
         JFactory::getApplication()->redirect($paypal->url . '?' . http_build_query($paypal->args, '', '&'));
     }
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:33,代码来源:rsfppaypal.php

示例2: getTemplate

 public function getTemplate()
 {
     $app = JFactory::getApplication();
     $Itemid = $this->getItemId();
     $has_suffix = JFactory::getConfig()->get('sef') && JFactory::getConfig()->get('sef_suffix');
     $layout = $app->input->getCmd('layout', 'default');
     // Templates
     $template_module = $this->params->def('template_module', '');
     $template_formdatarow = $this->params->def('template_formdatarow', '');
     $template_formdetail = $this->params->def('template_formdetail', '');
     if ($layout == 'default') {
         $formdata = '';
         $submissions = $this->getSubmissions();
         $headers = $this->getHeaders();
         $pagination = $this->getPagination();
         $i = 0;
         foreach ($submissions as $SubmissionId => $submission) {
             list($replace, $with) = $this->getReplacements($submission['UserId']);
             $pdf_link = JRoute::_('index.php?option=com_rsform&view=submissions&layout=view&cid=' . $SubmissionId . '&format=pdf' . $Itemid);
             if ($has_suffix) {
                 $pdf_link .= strpos($pdf_link, '?') === false ? '?' : '&';
                 $pdf_link .= 'format=pdf';
             }
             $details_link = JRoute::_('index.php?option=com_rsform&view=submissions&layout=view&cid=' . $SubmissionId . $Itemid);
             $replacements = array('{global:userip}' => $submission['UserIp'], '{global:date_added}' => RSFormProHelper::getDate($submission['DateSubmitted']), '{global:submissionid}' => $SubmissionId, '{global:submission_id}' => $SubmissionId, '{global:counter}' => $pagination->getRowOffset($i), '{global:confirmed}' => $submission['confirmed'], '{details}' => '<a href="' . $details_link . '">', '{details_link}' => $details_link, '{detailspdf}' => '<a href="' . $pdf_link . '">', '{detailspdf_link}' => $pdf_link, '{_STATUS:value}' => isset($submission['SubmissionValues']['_STATUS']) ? JText::_('RSFP_PAYPAL_STATUS_' . $submission['SubmissionValues']['_STATUS']['Value']) : '');
             $replace = array_merge($replace, array_keys($replacements));
             $with = array_merge($with, array_values($replacements));
             foreach ($headers as $header) {
                 if (!isset($submission['SubmissionValues'][$header]['Value'])) {
                     $submission['SubmissionValues'][$header]['Value'] = '';
                 }
                 if (!empty($submission['SubmissionValues'][$header]['Path'])) {
                     $replace[] = '{' . $header . ':path}';
                     $with[] = $submission['SubmissionValues'][$header]['Path'];
                 }
             }
             list($replace2, $with2) = RSFormProHelper::getReplacements($SubmissionId, true);
             $replace = array_merge($replace, $replace2);
             $with = array_merge($with, $with2);
             $rowdata = $template_formdatarow;
             // Add scripting
             if (strpos($rowdata, '{/if}') !== false) {
                 require_once JPATH_ADMINISTRATOR . '/components/com_rsform/helpers/scripting.php';
                 RSFormProScripting::compile($rowdata, $replace, $with);
             }
             $formdata .= str_replace($replace, $with, $rowdata);
             $i++;
         }
         $html = str_replace('{formdata}', $formdata, $template_module);
     } else {
         $cid = $app->input->getInt('cid');
         $format = $app->input->getCmd('format');
         $user = JFactory::getUser();
         $userId = $this->params->def('userId', 0);
         if ($userId != 'login' && $userId != 0) {
             $userId = explode(',', $userId);
             JArrayHelper::toInteger($userId);
         }
         // Grab submission
         $this->_db->setQuery("SELECT * FROM #__rsform_submissions WHERE SubmissionId='" . $cid . "'");
         $submission = $this->_db->loadObject();
         // Submission doesn't exist
         if (!$submission) {
             JError::raiseWarning(500, JText::sprintf('RSFP_SUBMISSION_DOES_NOT_EXIST', $cid));
             return $app->redirect(JURI::root());
         }
         // Submission doesn't belong to the configured form ID OR
         // can view only own submissions and not his own OR
         // can view only specified user IDs and this doesn't belong to any of the IDs
         if ($submission->FormId != $this->params->get('formId') || $userId == 'login' && $submission->UserId != $user->get('id') || is_array($userId) && !in_array($user->get('id'), $userId)) {
             JError::raiseWarning(500, JText::sprintf('RSFP_SUBMISSION_NOT_ALLOWED', $cid));
             return $app->redirect(JURI::root());
         }
         if ($this->params->get('show_confirmed', 0) && !$submission->confirmed) {
             JError::raiseWarning(500, JText::sprintf('RSFP_SUBMISSION_NOT_CONFIRMED', $cid));
             return $app->redirect(JURI::root());
         }
         $pdf_link = JRoute::_('index.php?option=com_rsform&view=submissions&layout=view&cid=' . $cid . '&format=pdf' . $Itemid);
         if ($has_suffix) {
             $pdf_link .= strpos($pdf_link, '?') === false ? '?' : '&';
             $pdf_link .= 'format=pdf';
         }
         list($replace, $with) = RSFormProHelper::getReplacements($cid, true);
         list($replace2, $with2) = $this->getReplacements($submission->UserId);
         $replacements = array('{global:userip}' => $submission->UserIp, '{global:date_added}' => RSFormProHelper::getDate($submission->DateSubmitted), '{global:submissionid}' => $cid, '{global:submission_id}' => $cid, '{global:confirmed}' => $submission->confirmed ? JText::_('RSFP_YES') : JText::_('RSFP_NO'), '{detailspdf}' => '<a href="' . $pdf_link . '">', '{detailspdf_link}' => $pdf_link);
         $replace = array_merge($replace, $replace2, array_keys($replacements));
         $with = array_merge($with, $with2, array_values($replacements));
         if ($format == 'pdf' && preg_match_all('#{detailspdf}(.*?){\\/detailspdf}#is', $template_formdetail, $matches)) {
             foreach ($matches[0] as $fullmatch) {
                 $template_formdetail = str_replace($fullmatch, '', $template_formdetail);
             }
         }
         // Add scripting
         if (strpos($template_formdetail, '{/if}') !== false) {
             require_once JPATH_ADMINISTRATOR . '/components/com_rsform/helpers/scripting.php';
             RSFormProScripting::compile($template_formdetail, $replace, $with);
         }
         $html = str_replace($replace, $with, $template_formdetail);
     }
     return $html;
//.........这里部分代码省略.........
开发者ID:knigherrant,项目名称:decopatio,代码行数:101,代码来源:submissions.php

示例3: getTemplate

 function getTemplate()
 {
     $mainframe = JFactory::getApplication();
     $Itemid = '';
     if ($Itemid = JRequest::getInt('Itemid')) {
         $Itemid = '&Itemid=' . $Itemid;
     }
     $template_module = $this->params->def('template_module', '');
     $template_formdatarow = $this->params->def('template_formdatarow', '');
     $template_formdetail = $this->params->def('template_formdetail', '');
     $formdata = '';
     $has_suffix = $mainframe->getCfg('sef') && $mainframe->getCfg('sef_suffix');
     $layout = JRequest::getVar('layout', 'default');
     if ($layout == 'default') {
         $submissions = $this->getSubmissions();
         $headers = $this->getHeaders();
         $pagination = $this->getPagination();
         $i = 0;
         foreach ($submissions as $SubmissionId => $submission) {
             list($replace, $with) = $this->getReplacements($submission['UserId']);
             $pdf_link = JRoute::_('index.php?option=com_rsform&view=submissions&layout=view&cid=' . $SubmissionId . '&format=pdf' . $Itemid);
             if ($has_suffix) {
                 $pdf_link .= strpos($pdf_link, '?') === false ? '?' : '&';
                 $pdf_link .= 'format=pdf';
             }
             $details_link = JRoute::_('index.php?option=com_rsform&view=submissions&layout=view&cid=' . $SubmissionId . $Itemid);
             $replace = array_merge($replace, array('{global:userip}', '{global:date_added}', '{global:submissionid}', '{global:submission_id}', '{global:counter}', '{details}', '{detailspdf}', '{global:confirmed}', '{details_link}', '{detailspdf_link}'));
             $with = array_merge($with, array($submission['UserIp'], $submission['DateSubmitted'], $SubmissionId, $SubmissionId, $pagination->getRowOffset($i), '<a href="' . $details_link . '">', '<a href="' . $pdf_link . '">', $submission['confirmed'], $details_link, $pdf_link));
             $replace[] = '{_STATUS:value}';
             $with[] = isset($submission['SubmissionValues']['_STATUS']) ? JText::_('RSFP_PAYPAL_STATUS_' . $submission['SubmissionValues']['_STATUS']['Value']) : '';
             foreach ($headers as $header) {
                 if (!isset($submission['SubmissionValues'][$header]['Value'])) {
                     $submission['SubmissionValues'][$header]['Value'] = '';
                 }
                 /* $replace[] = '{'.$header.':value}';
                 			$with[] = $submission['SubmissionValues'][$header]['Value']; */
                 if (!empty($submission['SubmissionValues'][$header]['Path'])) {
                     $replace[] = '{' . $header . ':path}';
                     $with[] = $submission['SubmissionValues'][$header]['Path'];
                 }
             }
             list($replace2, $with2) = RSFormProHelper::getReplacements($SubmissionId, true);
             $replace = array_merge($replace, $replace2);
             $with = array_merge($with, $with2);
             $formdata .= str_replace($replace, $with, $template_formdatarow);
             $i++;
         }
         $html = str_replace('{formdata}', $formdata, $template_module);
     } else {
         $cid = JRequest::getInt('cid');
         $user = JFactory::getUser();
         $userId = $this->params->def('userId', 0);
         if ($userId != 'login' && $userId != 0) {
             $userId = explode(',', $userId);
             JArrayHelper::toInteger($userId);
         }
         $this->_db->setQuery("SELECT * FROM #__rsform_submissions WHERE SubmissionId='" . $cid . "'");
         $submission = $this->_db->loadObject();
         if (!$submission || $submission->FormId != $this->params->get('formId') || $userId == 'login' && $submission->UserId != $user->get('id') || is_array($userId) && !in_array($user->get('id'), $userId)) {
             JError::raiseWarning(500, JText::_('ALERTNOTAUTH'));
             $mainframe->redirect(JURI::root());
             return;
         }
         if ($this->params->get('show_confirmed', 0) && !$submission->confirmed) {
             JError::raiseWarning(500, JText::_('ALERTNOTAUTH'));
             $mainframe->redirect(JURI::root());
             return;
         }
         $format = JRequest::getVar('format');
         $pdf_link = JRoute::_('index.php?option=com_rsform&view=submissions&layout=view&cid=' . $cid . '&format=pdf' . $Itemid);
         if ($has_suffix) {
             $pdf_link .= strpos($pdf_link, '?') === false ? '?' : '&';
             $pdf_link .= 'format=pdf';
         }
         $confirmed = $submission->confirmed ? JText::_('RSFP_YES') : JText::_('RSFP_NO');
         list($replace, $with) = RSFormProHelper::getReplacements($cid, true);
         list($replace2, $with2) = $this->getReplacements($submission->UserId);
         $replace = array_merge($replace, $replace2, array('{global:userip}', '{global:date_added}', '{global:submissionid}', '{global:submission_id}', '{detailspdf}', '{global:confirmed}', '{detailspdf_link}'));
         $with = array_merge($with, $with2, array($submission->UserIp, RSFormProHelper::getDate($submission->DateSubmitted), $cid, $cid, '<a href="' . $pdf_link . '">', $confirmed, $pdf_link));
         if ($format == 'pdf' && preg_match_all('#{detailspdf}(.*?){\\/detailspdf}#is', $template_formdetail, $matches)) {
             foreach ($matches[0] as $fullmatch) {
                 $template_formdetail = str_replace($fullmatch, '', $template_formdetail);
             }
         }
         $html = str_replace($replace, $with, $template_formdetail);
     }
     return $html;
 }
开发者ID:alvarovladimir,项目名称:messermeister_ab_rackservers,代码行数:88,代码来源:submissions.php

示例4: str_replace

                $replace[] = '{' . $header . ':path}';
                $with[] = $submission['SubmissionValues'][$header]['Path'];
            }
        }
        $formdata .= str_replace($replace, $with, $template_formdatarow);
        $i++;
    }
    $html = str_replace('{formdata}', $formdata, $template_module);
    $html .= '<div>' . $pagination->getResultsCounter() . '</div>';
    $html .= '<div>' . $pagination->getPagesLinks() . '</div>';
} else {
    $detail = JRequest::getInt('detail' . $formId);
    if ($userId != 'login' && $userId != 0) {
        $userId = explode(',', $userId);
        JArrayHelper::toInteger($userId);
    }
    $db->setQuery("SELECT * FROM #__rsform_submissions WHERE SubmissionId='" . $detail . "'");
    $submission = $db->loadObject();
    if (!$submission || $submission->FormId != $formId || $userId == 'login' && $submission->UserId != $user->get('id') || is_array($userId) && !in_array($user->get('id'), $userId)) {
        JError::raiseWarning(500, JText::_('ALERTNOTAUTH'));
        return;
    }
    $confirmed = $submission->confirmed ? JText::_('RSFP_YES') : JText::_('RSFP_NO');
    list($replace, $with) = RSFormProHelper::getReplacements($detail, true);
    list($replace2, $with2) = $helper->getReplacements($submission->UserId);
    $replace = array_merge($replace, $replace2, array('{global:submission_id}', '{global:date_added}', '{global:confirmed}'));
    $with = array_merge($with, $with2, array($detail, $submission->DateSubmitted, $confirmed));
    $html = str_replace($replace, $with, $template_formdetail);
}
// Display template
require JModuleHelper::getLayoutPath('mod_rsform_list');
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:31,代码来源:mod_rsform_list.php

示例5: sendEmails

 public function sendEmails($formId, $SubmissionId)
 {
     $directory = $this->getDirectory();
     $this->_db->setQuery("SELECT Lang FROM #__rsform_submissions WHERE FormId='" . $formId . "' AND SubmissionId='" . $SubmissionId . "'");
     $lang = $this->_db->loadResult();
     list($placeholders, $values) = RSFormProHelper::getReplacements($SubmissionId);
     $this->_db->setQuery("SELECT * FROM #__rsform_emails WHERE `type` = 'directory' AND `formId` = " . $formId . " AND `from` != ''");
     if ($emails = $this->_db->loadObjectList()) {
         $etranslations = RSFormProHelper::getTranslations('emails', $formId, $lang);
         foreach ($emails as $email) {
             if (isset($etranslations[$email->id . '.fromname'])) {
                 $email->fromname = $etranslations[$email->id . '.fromname'];
             }
             if (isset($etranslations[$email->id . '.subject'])) {
                 $email->subject = $etranslations[$email->id . '.subject'];
             }
             if (isset($etranslations[$email->id . '.message'])) {
                 $email->message = $etranslations[$email->id . '.message'];
             }
             if (empty($email->fromname) || empty($email->subject) || empty($email->message)) {
                 continue;
             }
             // RSForm! Pro Scripting - Additional Email Text
             // performance check
             if (strpos($email->message, '{/if}') !== false) {
                 require_once JPATH_ADMINISTRATOR . '/components/com_rsform/helpers/scripting.php';
                 RSFormProScripting::compile($email->message, $placeholders, $values);
             }
             $directoryEmail = array('to' => str_replace($placeholders, $values, $email->to), 'cc' => str_replace($placeholders, $values, $email->cc), 'bcc' => str_replace($placeholders, $values, $email->bcc), 'from' => str_replace($placeholders, $values, $email->from), 'replyto' => str_replace($placeholders, $values, $email->replyto), 'fromName' => str_replace($placeholders, $values, $email->fromname), 'text' => str_replace($placeholders, $values, $email->message), 'subject' => str_replace($placeholders, $values, $email->subject), 'mode' => $email->mode, 'files' => array());
             // additional cc
             if (strpos($directoryEmail['cc'], ',') !== false) {
                 $directoryEmail['cc'] = explode(',', $directoryEmail['cc']);
             }
             // additional bcc
             if (strpos($directoryEmail['bcc'], ',') !== false) {
                 $directoryEmail['bcc'] = explode(',', $directoryEmail['bcc']);
             }
             //Trigger Event - beforeDirectoryEmail
             $this->_app->triggerEvent('rsfp_beforeDirectoryEmail', array(array('directory' => &$directory, 'placeholders' => &$placeholders, 'values' => &$values, 'submissionId' => $SubmissionId, 'directoryEmail' => &$directoryEmail)));
             eval($directory->EmailsScript);
             // mail users
             $recipients = explode(',', $directoryEmail['to']);
             if (!empty($recipients)) {
                 foreach ($recipients as $recipient) {
                     if (!empty($recipient)) {
                         RSFormProHelper::sendMail($directoryEmail['from'], $directoryEmail['fromName'], $recipient, $directoryEmail['subject'], $directoryEmail['text'], $directoryEmail['mode'], !empty($directoryEmail['cc']) ? $directoryEmail['cc'] : null, !empty($directoryEmail['bcc']) ? $directoryEmail['bcc'] : null, $directoryEmail['files'], !empty($directoryEmail['replyto']) ? $directoryEmail['replyto'] : '');
                     }
                 }
             }
         }
     }
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:52,代码来源:directory.php


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