/** * Check if we have a gateway subscription switch set up. This is for sites where * you can toggle between a subscription or a single payment. E.g. fabrikar com * if 'paypal_subscription_switch' is blank then use the $opts['cmd'] setting * if not empty it should be some eval'd PHP which needs to return true for the payment * to be treated as a subscription * We want to do this so that single payments can make use of Paypals option to pay via credit card * without a paypal account (subscriptions require a Paypal account) * We do this after the subscription code has been run as this code is still needed to look up the correct item_name * * @param JParameters $params Params * * @since 3.0.10 * * @return boolean */ protected function isSubscription($params) { $data = $this->data; $subSwitch = $params->get('paypal_subscription_switch'); if (trim($subSwitch) !== '') { $w = new FabrikWorker(); $subSwitch = $w->parseMessageForPlaceHolder($subSwitch, $data); return @eval($subSwitch); } else { return $params->get('paypal_cmd') === '_xclick-subscriptions'; } }
/** * Get the values to update the list with. * Can be either/or preset values from plugin params, or user selected from popup form. * If both are specified, values from user selects override those from plug-in parameters, * so the plugin parameter pre-sets basically become defaults. * * @param JParameters $params Plugin parameters * * @since 3.0.7 * * @return object|false */ protected function getUpdateCols($params) { $model = $this->getModel(); // get the pre-set updates $update = json_decode($params->get('update_col_updates')); // if we allow user selected updates ... if ($params->get('update_user_select', 0)) { // get the values from the form inputs $formModel = $model->getFormModel(); $qs = $this->app->input->get('fabrik_update_col', '', 'string'); parse_str($qs, $output); $key = 'list_' . $model->getRenderContext(); $values = FArrayHelper::getValue($output, 'fabrik___filter', array()); $values = FArrayHelper::getValue($values, $key, array()); for ($i = 0; $i < count($values['elementid']); $i++) { $id = $values['elementid'][$i]; $elementModel = $formModel->getElement($id, true); $elementName = $elementModel->getFullName(false, false); // Was this element already pre-set? Use array_search() rather than in_array() as we'll need the index if it exists. $index = array_search($elementName, $update->coltoupdate); if ($index === false) { // nope, wasn't preset, so just add it to the updates $update->coltoupdate[] = $elementName; $update->update_value[] = $values['value'][$i]; $update->udate_eval[] = '0'; } else { // yes it was preset, so use the $index to modify the existing value $update->update_value[$index] = $values['value'][$i]; $update->udate_eval[$index] = '0'; } } } // If no update input found return false to stop processing if (empty($update->coltoupdate) && empty($update->update_value)) { return false; } return $update; }