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


PHP FabrikString::ltrimiword方法代码示例

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


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

示例1: onStoreRow

 /**
  * Trigger called when a row is stored.
  * If toggle_others on then set other records yesno value to 0
  *
  * @param   array  &$data          Data to store
  * @param   int    $repeatCounter  Repeat group index
  *
  * @return  void
  */
 public function onStoreRow(&$data, $repeatCounter = 0)
 {
     if (!parent::onStoreRow($data, $repeatCounter)) {
         return false;
     }
     $value = $this->getValue($data, $repeatCounter);
     if ($value == '1') {
         $params = $this->getParams();
         $toggle = (bool) $params->get('toggle_others', false);
         if ($toggle === false) {
             return;
         }
         $listModel = $this->getListModel();
         $name = $this->getElement()->name;
         $db = $listModel->getDb();
         $query = $db->getQuery(true);
         if ($this->isJoin()) {
             $joinModel = $this->getJoinModel();
             $pk = $joinModel->getJoinedToTablePk('.');
         } else {
             $pk = $listModel->getPrimaryKey();
         }
         $shortPk = FabrikString::shortColName($pk);
         $rowId = FArrayHelper::getValue($data, $shortPk, null);
         $query->update($this->actualTableName())->set($name . ' = 0');
         if (!empty($rowId)) {
             $query->where($pk . ' <> ' . $rowId);
         }
         $toggle_where = $params->get('toggle_where', '');
         FabrikString::ltrimiword($toggle_where, 'where');
         if (!empty($toggle_where)) {
             $w = new FabrikWorker();
             $toggle_where = $w->parseMessageForPlaceHolder($toggle_where);
             $query->where($toggle_where);
         }
         $db->setQuery($query);
         $db->execute();
     }
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:48,代码来源:yesno.php

示例2: getPluginHTML

 /**
  * Get html form fields for a plugin (filled with
  * current element's plugin data
  *
  * @param   string $plugin plugin name
  *
  * @return  string    html form fields
  */
 public function getPluginHTML($plugin = null)
 {
     $item = $this->getItem();
     if (is_null($plugin)) {
         $plugin = $item->plugin;
     }
     JPluginHelper::importPlugin('fabrik_cron');
     // Trim old f2 cron prefix.
     $plugin = FabrikString::ltrimiword($plugin, 'cron');
     if ($plugin == '') {
         $str = '<div class="alert">' . FText::_('COM_FABRIK_SELECT_A_PLUGIN') . '</div>';
     } else {
         $plugin = $this->pluginManager->getPlugIn($plugin, 'Cron');
         $mode = FabrikWorker::j3() ? 'nav-tabs' : '';
         $str = $plugin->onRenderAdminSettings(ArrayHelper::fromObject($item), null, $mode);
     }
     return $str;
 }
开发者ID:glauberm,项目名称:cinevi,代码行数:26,代码来源:cron.php

示例3: getEvents

 /**
  * Query all tables linked to the calendar and return them
  *
  * @return  string	javascript array containing json objects
  */
 public function getEvents()
 {
     $itemId = FabrikWorker::itemId();
     $tzOffset = $this->config->get('offset');
     $tz = new DateTimeZone($tzOffset);
     $w = new FabrikWorker();
     $this->setupEvents();
     $jsEvents = array();
     $input = $this->app->input;
     $where = $input->get('where', array(), 'array');
     foreach ($this->events as $listId => $record) {
         $this_where = FArrayHelper::getValue($where, $listId, '');
         $this_where = html_entity_decode($this_where, ENT_QUOTES);
         /** @var FabrikFEModelList $listModel */
         $listModel = JModelLegacy::getInstance('list', 'FabrikFEModel');
         $listModel->setId($listId);
         if (!$listModel->canView()) {
             continue;
         }
         $table = $listModel->getTable();
         $els = $listModel->getElements();
         $formModel = $listModel->getFormModel();
         foreach ($record as $data) {
             $db = $listModel->getDb();
             $startDate = trim($data['startdate']) !== '' ? FabrikString::safeColName($data['startdate']) : '\'\'';
             if ($data['startdate'] == '') {
                 throw new RuntimeException('No start date selected ', 500);
                 return;
             }
             $startElement = $formModel->getElement($data['startdate']);
             $endDate = trim($data['enddate']) !== '' ? FabrikString::safeColName($data['enddate']) : "''";
             $endElement = trim($data['enddate']) !== '' ? $formModel->getElement($data['enddate']) : $startElement;
             $startLocal = $store_as_local = (bool) $startElement->getParams()->get('date_store_as_local', false);
             $endLocal = $store_as_local = (bool) $endElement->getParams()->get('date_store_as_local', false);
             $label = trim($data['label']) !== '' ? FabrikString::safeColName($data['label']) : "''";
             $customUrl = $data['customUrl'];
             $qLabel = $label;
             if (array_key_exists($qLabel, $els)) {
                 // If db join selected for the label we need to get the label element and not the value
                 if (method_exists($els[$qLabel], 'getJoinLabelColumn')) {
                     $label = $els[$qLabel]->getJoinLabelColumn();
                 } else {
                     $label = FabrikString::safeColName($els[$qLabel]->getOrderByName());
                 }
             }
             $pk = $listModel->getPrimaryKey();
             $query = $db->getQuery(true);
             $query = $listModel->buildQuerySelect('list', $query);
             $status = trim($data['status']) !== '' ? FabrikString::safeColName($data['status']) : "''";
             $query->select($pk . ' AS id, ' . $pk . ' AS rowid, ' . $startDate . ' AS startdate, ' . $endDate . ' AS enddate')->select('"" AS link, ' . $label . ' AS label, ' . $db->q($data['colour']) . ' AS colour, 0 AS formid')->select($status . ' AS status')->order($startDate . ' ASC');
             $query = $listModel->buildQueryJoin($query);
             //$this_where = trim(str_replace('WHERE', '', $this_where));
             $this_where = FabrikString::ltrimiword($this_where, 'WHERE');
             $query = $this_where === '' ? $listModel->buildQueryWhere(true, $query) : $query->where($this_where);
             $db->setQuery($query);
             $formData = $db->loadObjectList();
             if (is_array($formData)) {
                 foreach ($formData as $row) {
                     if ($row->startdate != '') {
                         $defaultURL = 'index.php?option=com_' . $this->package . '&Itemid=' . $itemId . '&view=form&formid=' . $table->form_id . '&rowid=' . $row->id . '&tmpl=component';
                         $thisCustomUrl = $w->parseMessageForPlaceHolder($customUrl, $row);
                         $row->link = $thisCustomUrl !== '' ? $thisCustomUrl : $defaultURL;
                         $row->custom = $customUrl != '';
                         $row->_listid = $table->id;
                         $row->_canDelete = (bool) $listModel->canDelete();
                         $row->_canEdit = (bool) $listModel->canEdit($row);
                         $row->_canView = (bool) $listModel->canViewDetails();
                         //Format local dates toISO8601
                         $myDate = new DateTime($row->startdate);
                         $row->startdate_locale = $myDate->format(DateTime::RFC3339);
                         $myDate = new DateTime($row->enddate);
                         $row->enddate_locale = $myDate->format(DateTime::RFC3339);
                         // Added timezone offset
                         if ($row->startdate !== $db->getNullDate() && $data['startShowTime'] == true) {
                             $date = JFactory::getDate($row->startdate);
                             $row->startdate = $date->format('Y-m-d H:i:s', true);
                             if ($startLocal) {
                                 //Format local dates toISO8601
                                 $myDate = new DateTime($row->startdate);
                                 $row->startdate_locale = $myDate->format(DateTime::RFC3339);
                             } else {
                                 $date->setTimezone($tz);
                                 $row->startdate_locale = $date->toISO8601(true);
                             }
                         }
                         if ($row->enddate !== $db->getNullDate() && (string) $row->enddate !== '') {
                             if ($data['endShowTime'] == true) {
                                 $date = JFactory::getDate($row->enddate);
                                 $row->enddate = $date->format('Y-m-d H:i:d');
                                 if ($endLocal) {
                                     //Format local dates toISO8601
                                     $myDate = new DateTime($row->enddate);
                                     $row->enddate_locale = $myDate->format(DateTime::RFC3339);
                                 } else {
                                     $date->setTimezone($tz);
//.........这里部分代码省略.........
开发者ID:glauberm,项目名称:cinevi,代码行数:101,代码来源:calendar.php

示例4: getPluginHTML

 /**
  * Get html form fields for a plugin (filled with
  * current element's plugin data
  *
  * @param   string  $plugin  plugin name
  *
  * @return  string	html form fields
  */
 public function getPluginHTML($plugin = null)
 {
     $item = $this->getItem();
     if (is_null($plugin)) {
         $plugin = $item->plugin;
     }
     JPluginHelper::importPlugin('fabrik_cron');
     $pluginManager = JModel::getInstance('Pluginmanager', 'FabrikFEModel');
     // Trim old f2 cron prefix.
     $plugin = FabrikString::ltrimiword($plugin, 'cron');
     if ($plugin == '') {
         $str = JText::_('COM_FABRIK_SELECT_A_PLUGIN');
     } else {
         $plugin = $pluginManager->getPlugIn($plugin, 'Cron');
         $str = $plugin->onRenderAdminSettings(JArrayHelper::fromObject($item));
     }
     return $str;
 }
开发者ID:rogeriocc,项目名称:fabrik,代码行数:26,代码来源:cron.php

示例5: pathToURL

 /**
  * Convert a full server path into a full url
  *
  * @param   string  $path  Server path
  *
  * @return  string  url
  */
 public function pathToURL($path)
 {
     $path = str_replace(COM_FABRIK_BASE, '', $path);
     $path = FabrikString::ltrimiword($path, '/');
     $path = COM_FABRIK_LIVESITE . $path;
     $path = str_replace('\\', '/', $path);
     // Some servers do not like double slashes in the URL.
     $path = str_replace('\\/\\/', '/', $path);
     return $path;
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:17,代码来源:adaptor.php

示例6: setImage

 /**
  * Get thumb/cropped/full image paths
  *
  * @param   int    $elementId Element id
  * @param   string $size      Type of file to find (cropped/thumb/full)
  *
  * @return  array   ($image, $placeholder)
  */
 protected function setImage($elementId, $size)
 {
     $file = $this->findElementData($elementId);
     if ($file === '') {
         return array('', '');
     }
     // Initial upload $file is json data / ajax upload?
     if ($f = json_decode($file)) {
         if (array_key_exists(0, $f)) {
             $file = $f[0]->file;
         }
     }
     /** @var FabrikFEModelForm $formModel */
     $formModel = $this->getModel();
     /** @var PlgFabrik_ElementFileupload $elementModel */
     $elementModel = $formModel->getElement($elementId, true);
     if (get_class($elementModel) === 'PlgFabrik_ElementFileupload') {
         $name = $elementModel->getHTMLName();
         $data[$name] = $file;
         $elementModel->setEditable(false);
         $placeholder = $elementModel->render($data);
         $storage = $elementModel->getStorage();
         $file = $storage->clean(JPATH_SITE . '/' . $file);
         $file = $storage->pathToURL($file);
         switch ($size) {
             case 'cropped':
                 $file = $storage->_getCropped($file);
                 break;
             case 'thumb':
                 $file = $storage->_getThumb($file);
                 break;
         }
         $file = $storage->urlToPath($file);
         $file = str_replace(JPATH_SITE, '', $file);
         $first = substr($file, 0, 1);
         if ($first === '\\' || $first == '/') {
             $file = FabrikString::ltrimiword($file, $first);
         }
     }
     return array($file, $placeholder);
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:49,代码来源:article.php


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