本文整理汇总了PHP中FabrikString::ltrim方法的典型用法代码示例。如果您正苦于以下问题:PHP FabrikString::ltrim方法的具体用法?PHP FabrikString::ltrim怎么用?PHP FabrikString::ltrim使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FabrikString
的用法示例。
在下文中一共展示了FabrikString::ltrim方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setRowClass
/**
* Set row class
*
* @param array &$data row data to set class for
*
* @return null
*/
public function setRowClass(&$data)
{
$rowclass = $this->getParams()->get('use_as_row_class');
if ($rowclass == 1) {
$col = $this->getFullName(false, true, false);
$rawcol = $col . '_raw';
foreach ($data as $groupk => $group) {
for ($i = 0; $i < count($group); $i++) {
$c = false;
if (isset($data[$groupk][$i]->data->{$rawcol})) {
$c = $data[$groupk][$i]->data->{$rawcol};
} elseif (isset($data[$groupk][$i]->data->{$col})) {
$c = $data[$groupk][$i]->data->{$col};
}
if ($c !== false) {
$c = preg_replace('/[^A-Z|a-z|0-9]/', '-', $c);
$c = FabrikString::ltrim($c, '-');
$c = FabrikString::rtrim($c, '-');
// $$$ rob 24/02/2011 can't have numeric class names so prefix with element name
if (is_numeric($c)) {
$c = $this->getElement()->name . $c;
}
$data[$groupk][$i]->class .= ' ' . $c;
}
}
}
}
}
示例2: deleteFile
/**
* Delete the file
*
* @param string $filename Path to file (not including JPATH)
*
* @return void
*/
protected function deleteFile($filename)
{
if (empty($filename)) {
return;
}
$storage = $this->getStorage();
$file = $storage->clean(JPATH_SITE . '/' . $filename);
$thumb = $storage->clean(JPATH_SITE . '/' . $storage->_getThumb($filename));
$cropped = $storage->clean(JPATH_SITE . '/' . $storage->_getCropped($filename));
$logMsg = 'Delete files: ' . $file . ' , ' . $thumb . ', ' . $cropped . '; user = ' . $this->user->get('id');
JLog::add($logMsg, JLog::WARNING, 'com_fabrik.element.fileupload');
if ($storage->exists($file)) {
$storage->delete($file);
}
if ($storage->exists($thumb)) {
$storage->delete($thumb);
} else {
if ($storage->exists(JPATH_SITE . '/' . FabrikString::ltrim($thumb, '/'))) {
$storage->delete(JPATH_SITE . '/' . FabrikString::ltrim($thumb, '/'));
}
}
if ($storage->exists($cropped)) {
$storage->delete($cropped);
} else {
if ($storage->exists(JPATH_SITE . '/' . FabrikString::ltrim($cropped, '/'))) {
$storage->delete(JPATH_SITE . '/' . FabrikString::ltrim($cropped, '/'));
}
}
}