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


PHP FabrikWorker::logEval方法代码示例

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


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

示例1: 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

示例2: 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));
     $res = @eval($condition);
     FabrikWorker::logEval($res, 'Caught exception on eval in validation::shouldValidate() ' . $this->_pluginName . ': %s');
     if (is_null($res)) {
         return true;
     }
     return $res;
 }
开发者ID:nikshade,项目名称:fabrik21,代码行数:35,代码来源:validation_rule.php

示例3: 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

示例4: renderTableData

 /**
  * shows the data formatted for the table view
  * @param string data
  * @param object all the data in the tables current row
  * @return string formatted value
  */
 function renderTableData($data, $oAllRowsData)
 {
     $params =& $this->getParams();
     $format = $params->get('text_format_string');
     if ($format != '') {
         $data = @eval(sprintf($format, $data));
         FabrikWorker::logEval($data, 'Caught exception on eval in ' . $this->getElement()->name . '::renderTableData() : %s');
     }
     return parent::renderTableData($data, $oAllRowsData);
 }
开发者ID:nikshade,项目名称:fabrik21,代码行数:16,代码来源:fabrikjsperiodical.php

示例5: onImportCSVRow

 public function onImportCSVRow(&$params, &$listModel)
 {
     $file = JFilterInput::clean($params->get('listcsv_import_php_file'), 'CMD');
     if ($file == -1 || $file == '') {
         $code = @eval($params->get('listcsv_import_php_code'));
         FabrikWorker::logEval($code, 'Caught exception on eval in onImportCSVRow : %s');
     } else {
         @(require JPATH_ROOT . '/plugins/fabrik_list/listcsv/scripts/' . $file);
     }
     return true;
 }
开发者ID:rogeriocc,项目名称:fabrik,代码行数:11,代码来源:listcsv.php

示例6: onImportCSVRow

 public function onImportCSVRow(&$params, &$tableModel)
 {
     $file = JFilterInput::clean($params->get('tablecsv_import_php_file'), 'CMD');
     if ($file == -1 || $file == '') {
         $code = @eval($params->get('tablecsv_import_php_code'));
         FabrikWorker::logEval($code, 'Caught exception on eval in onImportCSVRow : %s');
     } else {
         @(require COM_FABRIK_FRONTEND . DS . 'plugins' . DS . 'table' . DS . 'tablecsv' . DS . 'scripts' . DS . $file);
     }
     return true;
 }
开发者ID:nikshade,项目名称:fabrik21,代码行数:11,代码来源:tablecsv.php

示例7: process

 /**
  * do the plug-in action
  * @param object parameters
  * @param object table model
  * @param array custom options
  */
 function process(&$params, &$model, $opts = array())
 {
     $file = JFilterInput::clean($params->get('table_php_file'), 'CMD');
     if ($file == -1 || $file == '') {
         $code = $params->get('table_php_code');
         $code = @eval($code);
         FabrikWorker::logEval($code, 'Caught exception on eval in tablephp::process() : %s');
     } else {
         require_once COM_FABRIK_FRONTEND . DS . 'plugins' . DS . 'table' . DS . 'tablephp' . DS . 'scripts' . DS . $file;
     }
     return true;
 }
开发者ID:nikshade,项目名称:fabrik21,代码行数:18,代码来源:tablephp.php

示例8: replace

 /**
  * checks if the validation should replace the submitted element data
  * if so then the replaced data is returned otherwise original data returned
  * @param string original data
  * @param model $element
  * @param int $c validation plugin counter
  * @param int repeat group count
  * @return string original or replaced data
  */
 function replace($data, &$element, $c, $repeat_count = 0)
 {
     $params =& $this->getParams();
     $domatch = $params->get('php-match', '_default', 'array', $c);
     $domatch = $domatch[$c];
     if (!$domatch) {
         $php_code = $params->get('php-code', '_default', 'array', $c);
         $php_code = @eval($php_code[$c]);
         FabrikWorker::logEval($php_code, 'Caught exception on eval in php validation::replace() : %s');
         return $php_code;
     }
     return $data;
 }
开发者ID:nikshade,项目名称:fabrik21,代码行数:22,代码来源:php.php

示例9: getDefaultValue

 /**
  * this really does get just the default value (as defined in the element's settings)
  * @return unknown_type
  */
 function getDefaultValue($data = array())
 {
     if (!isset($this->_default)) {
         $w = new FabrikWorker();
         $element =& $this->getElement();
         if ($element->eval) {
             //strip html tags
             $element->label = preg_replace('/<[^>]+>/i', '', $element->label);
             //change htmlencoded chars back
             $element->label = htmlspecialchars_decode($element->label);
             $this->_default = @eval($this->_default);
             FabrikWorker::logEval($this->_default, 'Caught exception on eval in ' . $element->name . '::getDefaultValue() : %s');
         } else {
             $this->_default = $element->label;
         }
         $this->_default = $w->parseMessageForPlaceHolder($this->_default, $data);
     }
     return $this->_default;
 }
开发者ID:nikshade,项目名称:fabrik21,代码行数:23,代码来源:fabrikdisplaytext.php

示例10: getDefaultValue

 /**
  * this really does get just the default value (as defined in the element's settings)
  * @return unknown_type
  */
 function getDefaultValue($data = array())
 {
     if (!isset($this->_default)) {
         $params =& $this->getParams();
         $element = $this->getElement();
         $w = new FabrikWorker();
         $this->_default = $params->get('imagefile');
         // $$$ hugh - this gets us the default image, with the root folder prepended.
         // But ... if the root folder option is set, we need to strip it.
         $rootFolder = $params->get('selectImage_root_folder', '/');
         $rootFolder = ltrim($rootFolder, '/');
         $this->_default = preg_replace("#^{$rootFolder}#", '', $this->_default);
         $this->_default = $w->parseMessageForPlaceHolder($this->_default, $data);
         if ($element->eval == "1") {
             $this->_default = @eval(stripslashes($this->_default));
             FabrikWorker::logEval($this->_default, 'Caught exception on eval in ' . $element->name . '::getDefaultValue() : %s');
         }
     }
     return $this->_default;
 }
开发者ID:juliano-hallac,项目名称:fabrik,代码行数:24,代码来源:image.php

示例11: 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
  *
  * @throws Exception
  *
  * @return	bool
  */
 public function onAfterProcess()
 {
     $params = $this->getParams();
     $api_AUP = JPATH_SITE . '/components/com_alphauserpoints/helper.php';
     if (JFile::exists($api_AUP)) {
         $w = new FabrikWorker();
         $this->data = $this->getProcessData();
         require_once $api_AUP;
         $aup = new AlphaUserPointsHelper();
         // Define which user will receive the points.
         $userId = $params->get('user_id', '');
         $userId = (int) $w->parseMessageForPlaceholder($userId, $this->data, false);
         $aupId = $aup->getAnyUserReferreID($userId);
         // Replace these if you want to show a specific reference for the attributed points - doesn't seem to effect anything
         $keyReference = '';
         // Shown in the user details page - description of what the point is for
         $dataReference = $params->get('data_reference', '');
         $dataReference = $w->parseMessageForPlaceholder($dataReference, $this->data, false);
         // Override the plugin default points
         $randomPoints = $params->get('random_points', 0);
         if ($params->get('random_points_eval', '0') == '1') {
             if (!empty($randomPoints)) {
                 $randomPoints = $w->parseMessageForPlaceholder($randomPoints, $this->data, false);
                 $randomPoints = @eval($randomPoints);
                 FabrikWorker::logEval($randomPoints, 'Caught exception on eval in aup plugin : %s');
             }
             $randomPoints = (double) $randomPoints;
         } else {
             $randomPoints = (double) $w->parseMessageForPlaceholder($randomPoints, $this->data, false);
         }
         // If set to be greater than $randompoints then this is the # of points assigned (not sure when this would be used - commenting out for now)
         $referralUserPoints = 0;
         $aupPlugin = $params->get('aup_plugin', 'plgaup_fabrik');
         $aupPlugin = $w->parseMessageForPlaceholder($aupPlugin, $this->data, false);
         if (!$aup->checkRuleEnabled($aupPlugin, 0, $aupId)) {
             throw new Exception('Alpha User Points plugin not published');
         }
         $aup->userpoints($aupPlugin, $aupId, $referralUserPoints, $keyReference, $dataReference, $randomPoints);
     }
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:48,代码来源:alphauserpoints.php

示例12: getDefaultValue

 /**
  * this really does get just the default value (as defined in the element's settings)
  * @param array data to use as parsemessage for placeholder
  * @return unknown}_type
  */
 function getDefaultValue($data = array())
 {
     if (!isset($this->_default)) {
         $w = new FabrikWorker();
         $params =& $this->getParams();
         $element =& $this->getElement();
         $default = $w->parseMessageForPlaceHolder($element->default, $data);
         if ($element->eval == "1") {
             $default = @eval(stripslashes($default));
             FabrikWorker::logEval($default, 'Caught exception on eval in ' . $element->name . '::getDefaultValue() : %s');
         }
         $this->_default = $default;
     }
     return $this->_default;
 }
开发者ID:nikshade,项目名称:fabrik21,代码行数:20,代码来源:fabrikweather.php

示例13: onStartImportCSV

 /**
  * Called before import is started
  *
  * @return boolean
  */
 public function onStartImportCSV()
 {
     $params = $this->getParams();
     $filter = JFilterInput::getInstance();
     $file = $params->get('listcsv_import_start_php_file');
     $file = $filter->clean($file, 'CMD');
     if ($file != -1 && $file != '') {
         require JPATH_ROOT . '/plugins/fabrik_list/listcsv/scripts/' . $file;
     }
     $code = trim($params->get('listcsv_import_start_php_code', ''));
     if (!empty($code)) {
         $ret = @eval($code);
         FabrikWorker::logEval($ret, 'Caught exception on eval in onStartImportCSV : %s');
         if ($ret === false) {
             return false;
         }
     }
     return true;
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:24,代码来源:listcsv.php

示例14: array


//.........这里部分代码省略.........
             //bool match
             $this->filters['origvalue'][$i] = $value;
             $this->filters['sqlCond'][$i] = $key . ' ' . $condition . ' (' . $db->Quote($value) . ' IN BOOLEAN MODE)';
             continue;
         }
         //table plug-in filter found - it should have set its own sql in onGetPostFilter();
         if (in_array($elid, $pluginKeys)) {
             $this->filters['origvalue'][$i] = $value;
             $this->filters['sqlCond'][$i] = $this->filters['sqlCond'][$i];
             continue;
         }
         $elementModel = JArrayHelper::getValue($elements, $elid);
         // $$$ rob key2 if set is in format  `countries_0`.`label` rather than  `countries`.`label`
         // used for search all filter on 2nd db join element pointing to the same table
         if (strval($key2) !== '') {
             $key = $key2;
         }
         $eval = $this->filters['eval'][$i];
         $fullWordsOnly = $this->filters['full_words_only'][$i];
         $exactMatch = $this->filters['match'][$i];
         if (!is_a($elementModel, 'plgFabrik_Element')) {
             continue;
         }
         $elementModel->_rawFilter = $raw;
         // $$ hugh - testing allowing {QS} replacements in pre-filter values
         $w->replaceRequest($value);
         $value = $this->_prefilterParse($value);
         $value = $w->parseMessageForPlaceHolder($value);
         if ($filterEval == '1') {
             // $$$ rob hehe if you set $i in the eval'd code all sorts of chaos ensues
             $origi = $i;
             $value = stripslashes(htmlspecialchars_decode($value, ENT_QUOTES));
             $value = @eval($value);
             FabrikWorker::logEval($value, 'Caught exception on eval of tableModel::getFilterArray() ' . $key . ': %s');
             $i = $origi;
         }
         if ($condition == 'regexp') {
             $condition = 'REGEXP';
             // $$$ 30/06/2011 rob dont escape the search as it may contain \\\ from preg_escape (e.g. search all on 'c+b)
             $value = $db->quote($value, false);
         } else {
             if ($condition == 'like') {
                 $condition = 'LIKE';
                 $value = $db->Quote($value);
             } else {
                 if ($condition == 'laterthisyear' || $condition == 'earlierthisyear') {
                     $value = $db->Quote($value);
                 }
             }
         }
         if ($fullWordsOnly == '1') {
             $condition = 'REGEXP';
         }
         $originalValue = $this->filters['value'][$i];
         list($value, $condition) = $elementModel->getFilterValue($value, $condition, $eval);
         if ($fullWordsOnly == '1') {
             if (is_array($value)) {
                 foreach ($value as &$v) {
                     $v = "\"[[:<:]]" . $v . "[[:>:]]\"";
                 }
             } else {
                 $value = "\"[[:<:]]" . $value . "[[:>:]]\"";
             }
         }
         if (!array_key_exists($i, $sqlCond) || $sqlCond[$i] == '') {
             $query = $elementModel->getFilterQuery($key, $condition, $value, $originalValue, $this->filters['search_type'][$i]);
开发者ID:juliano-hallac,项目名称:fabrik,代码行数:67,代码来源:list.php

示例15: onAfterProcess

 /**
  * process the plugin, called at end of form submission
  *
  * @param object $params
  * @param object form model
  */
 function onAfterProcess(&$params, &$formModel)
 {
     $app =& JFactory::getApplication();
     $data =& $formModel->_fullFormData;
     $this->data = $data;
     if (!$this->shouldProcess('paypal_conditon')) {
         return true;
     }
     $this->formModel = $formModel;
     $emailData =& $this->getEmailData();
     $w = new FabrikWorker();
     $user =& JFactory::getUser();
     $userid = $user->get('id');
     $ipn = $this->getIPNHandler($params);
     if ($ipn !== false) {
         if (method_exists($ipn, 'createInvoice')) {
             $ipn->createInvoice();
         }
     }
     $paypal_testmode = $params->get('paypal_testmode', false);
     $url = $paypal_testmode == 1 ? 'https://www.sandbox.paypal.com/us/cgi-bin/webscr?' : 'https://www.paypal.com/cgi-bin/webscr?';
     $opts = array();
     $opts['cmd'] = $params->get('paypal_cmd', "_xclick");
     $opts['business'] = $this->getAccountEmail($params);
     $amount = $params->get('paypal_cost');
     $amount = $w->parseMessageForPlaceHolder($amount, $data);
     //@TODO Hugh/Rob check $$$tom: Adding eval option on cost field
     // Useful if you use a cart system which will calculate on total shipping or tax fee and apply it. You can return it in the Cost field.
     if ($params->get('paypal_cost_eval', 0) == 1) {
         $amount = @eval($amount);
         FabrikWorker::logEval($amount, 'Caught exception on eval in paypal cost_eval : %s');
     }
     if (trim($amount) == '') {
         $amount = JArrayHelper::getValue($emailData, FabrikString::safeColNameToArrayKey($params->get('paypal_cost_element')));
         if (is_array($amount)) {
             $amount = array_shift($amount);
         }
     }
     $opts['amount'] = "{$amount}";
     //$$$tom added Shipping Cost params
     $shipping_amount = $params->get('paypal_shipping_cost');
     if ($params->get('paypal_shipping_cost_eval', 0) == 1) {
         $shipping_amount = @eval($shipping_amount);
     }
     if (trim($shipping_amount) == '') {
         $shipping_amount = JArrayHelper::getValue($emailData, FabrikString::safeColNameToArrayKey($params->get('paypal_shipping_cost_element')));
         if (is_array($shipping_amount)) {
             $shipping_amount = array_shift($shipping_amount);
         }
     }
     $opts['shipping'] = "{$shipping_amount}";
     $item = $params->get('paypal_item');
     if ($params->get('paypal_item_eval', 0) == 1) {
         $item = @eval($item);
         FabrikWorker::logEval($item, 'Caught exception on eval in paypal item_eval : %s');
         $item_raw = $item;
     }
     if (trim($item) == '') {
         $item_raw = JArrayHelper::getValue($emailData, FabrikString::safeColNameToArrayKey($params->get('paypal_item_element') . '_raw'));
         $item = $emailData[FabrikString::safeColNameToArrayKey($params->get('paypal_item_element'))];
         if (is_array($item)) {
             $item = array_shift($item);
         }
     }
     $opts['item_name'] = "{$item}";
     //$$$ rob add in subscription variables
     if ($opts['cmd'] === '_xclick-subscriptions') {
         $subTable = JModel::getInstance('Table', 'FabrikModel');
         $subTable->setId((int) $params->get('paypal_subs_table'));
         $idEl = FabrikString::safeColName($params->get('paypal_subs_id', ''));
         $durationEl = FabrikString::safeColName($params->get('paypal_subs_duration', ''));
         $durationPerEl = FabrikString::safeColName($params->get('paypal_subs_duration_period', ''));
         $name = $params->get('paypal_subs_name', '');
         $subDb =& $subTable->getDb();
         $subDb->setQuery("SELECT *, {$durationEl} AS p3, {$durationPerEl} AS t3, " . $subDb->Quote($item_raw) . " AS item_number  FROM " . $subTable->getTable()->db_table_name . " WHERE {$idEl} = " . $subDb->Quote($item_raw));
         $sub = $subDb->loadObject();
         if (is_object($sub)) {
             $opts['p3'] = $sub->p3;
             $opts['t3'] = $sub->t3;
             $opts['a3'] = $amount;
             //$opts['src'] = 1;
             $opts['no_note'] = 1;
             $opts['custom'] = '';
             $tmp = array_merge(JRequest::get('data'), JArrayHelper::fromObject($sub));
             $opts['item_name'] = $w->parseMessageForPlaceHolder($name, $tmp);
             //'http://fabrikar.com/ '.$sub->item_name.' - User: subtest26012010 (subtest26012010)';
             $opts['invoice'] = $w->parseMessageForPlaceHolder($params->get('paypal_subs_invoice'), $tmp, false);
             if ($opts['invoice'] == '') {
                 $opts['invoice'] = uniqid('', true);
             }
             $opts['src'] = $w->parseMessageForPlaceHolder($params->get('paypal_subs_recurring'), $tmp);
             $amount = $opts['amount'];
             unset($opts['amount']);
         } else {
//.........这里部分代码省略.........
开发者ID:nikshade,项目名称:fabrik21,代码行数:101,代码来源:fabrikpaypal.php


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