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


PHP FabrikString::iclean方法代码示例

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


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

示例1: save

 /**
  * Method to save the form data.
  *
  * @param   array $data The form data.
  *
  * @return  boolean  True on success, False on error.
  */
 public function save($data)
 {
     $config = JComponentHelper::getParams('com_fabrik');
     if ($config->get('fbConf_wysiwyg_label', 0) == 0) {
         // Ensure the data is in the same format as when saved by the wysiwyg element e.g. < becomes &lt;
         $data['label'] = htmlspecialchars($data['label']);
     }
     jimport('joomla.utilities.date');
     $input = $this->app->input;
     $new = $data['id'] == 0 ? true : false;
     $params = $data['params'];
     $data['name'] = FabrikString::iclean($data['name']);
     $name = $data['name'];
     $params['validations'] = FArrayHelper::getValue($data, 'validationrule', array());
     $elementModel = $this->getElementPluginModel($data);
     $elementModel->getElement()->bind($data);
     $origId = $input->getInt('id');
     $row = $elementModel->getElement();
     if ($new) {
         // Have to forcefully set group id otherwise listmodel id is blank
         $elementModel->getElement()->group_id = $data['group_id'];
     }
     $listModel = $elementModel->getListModel();
     $item = $listModel->getTable();
     // Are we updating the name of the primary key element?
     if ($row->name === FabrikString::shortColName($item->db_primary_key)) {
         if ($name !== $row->name) {
             // Yes we are so update the table
             $item->db_primary_key = str_replace($row->name, $name, $item->db_primary_key);
             $item->store();
         }
     }
     $jsons = array('sub_values', 'sub_labels', 'sub_initial_selection');
     foreach ($jsons as $json) {
         if (array_key_exists($json, $data)) {
             $data[$json] = json_encode($data[$json]);
         }
     }
     // Only update the element name if we can alter existing columns, otherwise the name and field name become out of sync
     $data['name'] = $listModel->canAlterFields() || $new || $listModel->noTable() ? $name : $input->get('name_orig', '');
     $ar = array('published', 'use_in_page_title', 'show_in_list_summary', 'link_to_detail', 'can_order', 'filter_exact_match');
     foreach ($ar as $a) {
         if (!array_key_exists($a, $data)) {
             $data[$a] = 0;
         }
     }
     /**
      * $$$ rob - test for change in element type
      * (eg if changing from db join to field we need to remove the join
      * entry from the #__{package}_joins table
      */
     $elementModel->beforeSave($row);
     // Unlink linked elements
     if ($input->get('unlink') == 'on') {
         $data['parent_id'] = 0;
     }
     $dateNow = new JDate();
     if ($row->id != 0) {
         $data['modified'] = $dateNow->toSql();
         $data['modified_by'] = $this->user->get('id');
     } else {
         $data['created'] = $dateNow->toSql();
         $data['created_by'] = $this->user->get('id');
         $data['created_by_alias'] = $this->user->get('username');
     }
     /**
      * $$$ hugh
      * This insane chunk of code is needed because the validation rule params are not in sequential,
      * completely indexed arrays.  What we have is single item arrays, with specific numeric
      * keys, like foo-something[0], bar-otherthing[2], etc.  And if you json_encode an array with incomplete
      * or out of sequence numeric indexes, it encodes it as an object instead of an array.  Which means the first
      * validation plugin will encode as an array, as it's params are single [0] index, and the rest as objects.
      * This foobars things, as we then don't know if validation params are arrays or objects!
      *
      * One option would be to modify every validation, and test every param we use, and if necessary convert it,
      * but that would be a major pain in the ass.
      *
      * So ... we need to fill in the blanks in the arrays, and ksort them.  But, we need to know the param names
      * for each validation.  But as they are just stuck in with the rest of the element params, there is no easy
      * way of knowing which are validation params and which are element params.
      *
      * So ... we need to load the validation objects, then load the XML file for each one, and iterate through
      * the fieldsets!  Well, that's the only way I could come up with doing it.  Hopefully Rob can come up with
      * a quicker and simpler way of doing this!
      */
     $validations = FArrayHelper::getValue($params['validations'], 'plugin', array());
     $num_validations = count($validations);
     $validation_plugins = $this->getValidations($elementModel, $validations);
     foreach ($validation_plugins as $plugin) {
         $plugin_form = $plugin->getJForm();
         JForm::addFormPath(JPATH_SITE . '/plugins/fabrik_validationrule/' . $plugin->get('pluginName'));
         $xmlFile = JPATH_SITE . '/plugins/fabrik_validationrule/' . $plugin->get('pluginName') . '/forms/fields.xml';
         $xml = $plugin->jform->loadFile($xmlFile, false);
//.........这里部分代码省略.........
开发者ID:LGBGit,项目名称:tierno,代码行数:101,代码来源:element.php

示例2: save

 function save($data)
 {
     jimport('joomla.utilities.date');
     $user = JFactory::getUser();
     $app = JFactory::getApplication();
     $new = $data['id'] == 0 ? true : false;
     $params = $data['params'];
     $data['name'] = FabrikString::iclean($data['name']);
     $name = $data['name'];
     $params['validations'] = JArrayHelper::getValue($data, 'validationrule', array());
     $elementModel = $this->getElementPluginModel($data);
     $row = $elementModel->getElement();
     if ($new) {
         //have to forcefully set group id otherwise listmodel id is blank
         $elementModel->getElement()->group_id = $data['group_id'];
     }
     $listModel = $elementModel->getListModel();
     $item = $listModel->getTable();
     //are we updating the name of the primary key element?
     if ($row->name === FabrikString::shortColName($item->db_primary_key)) {
         if ($name !== $row->name) {
             //yes we are so update the table
             $item->db_primary_key = str_replace($row->name, $name, $item->db_primary_key);
             $item->store();
         }
     }
     $jsons = array('sub_values', 'sub_labels', 'sub_initial_selection');
     foreach ($jsons as $json) {
         if (array_key_exists($json, $data)) {
             $data[$json] = json_encode($data[$json]);
         }
     }
     //only update the element name if we can alter existing columns, otherwise the name and
     //field name become out of sync
     $data['name'] = $listModel->canAlterFields() || $new ? $name : JRequest::getVar('name_orig', '', 'post', 'cmd');
     $ar = array('published', 'use_in_page_title', 'show_in_list_summary', 'link_to_detail', 'can_order', 'filter_exact_match');
     foreach ($ar as $a) {
         if (!array_key_exists($a, $data)) {
             $data[$a] = 0;
         }
     }
     // $$$ rob - test for change in element type
     //(eg if changing from db join to field we need to remove the join
     //entry from the #__{package}_joins table
     // @TODO test this for j1.6
     $elementModel->beforeSave($row);
     //unlink linked elements
     if (JRequest::getVar('unlink') == 'on') {
         $data['parent_id'] = 0;
     }
     $datenow = new JDate();
     if ($row->id != 0) {
         $data['modified'] = $datenow->toSql();
         $data['modified_by'] = $user->get('id');
     } else {
         $data['created'] = $datenow->toSql();
         $data['created_by'] = $user->get('id');
         $data['created_by_alias'] = $user->get('username');
     }
     $data['params'] = json_encode($params);
     $cond = 'group_id = ' . (int) $row->group_id;
     if ($new) {
         $data['ordering'] = $row->getNextOrder($cond);
     }
     $row->reorder($cond);
     $this->updateChildIds($row);
     $elementModel->getElement()->bind($data);
     $origName = JRequest::getVar('name_orig', '', 'post', 'cmd');
     list($update, $q, $oldName, $newdesc, $origDesc) = $listModel->shouldUpdateElement($elementModel, $origName);
     if ($update) {
         $origplugin = JRequest::getVar('plugin_orig');
         $config = JFactory::getConfig();
         $prefix = $config->getValue('dbprefix');
         $tablename = $listModel->getTable()->db_table_name;
         $hasprefix = strstr($tablename, $prefix) === false ? false : true;
         $tablename = str_replace($prefix, '#__', $tablename);
         if (in_array($tablename, $this->core)) {
             $app->enqueueMessage(JText::_('COM_FABRIK_WARNING_UPDATE_CORE_TABLE'), 'notice');
         } else {
             if ($hasprefix) {
                 $app->enqueueMessage(JText::_('COM_FABRIK_WARNING_UPDATE_TABLE_WITH_PREFIX'), 'notice');
             }
         }
         $app->setUserState('com_fabrik.confirmUpdate', 1);
         $app->setUserState('com_fabrik.plugin_orig', $origplugin);
         $app->setUserState('com_fabrik.q', $q);
         $app->setUserState('com_fabrik.newdesc', $newdesc);
         $app->setUserState('com_fabrik.origDesc', $origDesc);
         $app->setUserState('com_fabrik.origplugin', $origplugin);
         $app->setUserState('com_fabrik.oldname', $oldName);
         $app->setUserState('com_fabrik.origtask', JRequest::getCmd('task'));
         $app->setUserState('com_fabrik.plugin', $data['plugin']);
         $task = JRequest::getCmd('task');
         $app->setUserState('com_fabrik.redirect', 'index.php?option=com_fabrik&view=element&layout=confirmupdate&id=' . (int) $row->id . "&origplugin={$origplugin}&&origtaks={$task}&plugin={$row->plugin}");
     } else {
         $app->setUserState('com_fabrik.confirmUpdate', 0);
     }
     if ((int) $listModel->getTable()->id !== 0) {
         $this->updateIndexes($elementModel, $listModel, $row);
     }
//.........这里部分代码省略.........
开发者ID:rhotog,项目名称:fabrik,代码行数:101,代码来源:element.php

示例3: clean

 /**
  * Wrapper for iclean(), that does strtolower on output of clean()
  *
  * @param   $str      string  to clean
  * @param   $fromEnc  string  from encoding
  * @param   $toEnc    string  to encoding
  *
  * @return  string  cleaned
  */
 public static function clean($str, $fromEnc = "UTF-8", $toEnc = "ASCII//IGNORE//TRANSLIT")
 {
     return JString::strtolower(FabrikString::iclean($str, $fromEnc, $toEnc));
 }
开发者ID:rogeriocc,项目名称:fabrik,代码行数:13,代码来源:string.php


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