本文整理汇总了PHP中CUtils::strRight方法的典型用法代码示例。如果您正苦于以下问题:PHP CUtils::strRight方法的具体用法?PHP CUtils::strRight怎么用?PHP CUtils::strRight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUtils
的用法示例。
在下文中一共展示了CUtils::strRight方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getValues
private function getValues()
{
$values = array();
if (array_key_exists('source', $this->params)) {
$source = $this->params['source'];
if (CUtils::strLeft($source, ".") == "class") {
$class = CUtils::strRight($source, ".");
if (array_key_exists('properties', $this->params)) {
$object = new $class(array("properties" => $this->params['properties']));
} else {
$object = new $class();
}
$sourceParams = $this->params['params'];
// для совместимости их надо положить в запрос
foreach ($sourceParams as $key => $value) {
$_POST[$key] = $value;
}
$values = $object->actionGetViewData();
} else {
$taxonomy = CTaxonomyManager::getTaxonomy($this->params['source']);
$values = $taxonomy->getTermsList();
}
} elseif (array_key_exists('values', $this->params)) {
$values = $this->params['values'];
}
return $values;
}
示例2: __callStatic
/**
* Магический метод получения любых классов
*
* @param $name
* @param array $params
* @throws Exception
*/
public static function __callStatic($name, $params = array())
{
/**
* Получаем имя класса из имени функции
*/
$className = "C" . CUtils::strRight($name, "get");
if (!class_exists($className)) {
throw new Exception("В приложении не объявлен класс " . $className);
}
/**
* @var CActiveModel $simpleClass
*/
$simpleClass = new $className();
$table = $simpleClass->getRecord()->getTable();
$id = $params[0];
/**
* Попробуем сначала получить из кэша
*/
$keySeek = $table . "_" . $id;
if (CApp::getApp()->cache->hasCache($keySeek)) {
return CApp::getApp()->cache->get($keySeek);
}
$ar = CActiveRecordProvider::getById($table, $id);
if (!is_null($ar)) {
$obj = new $className($ar);
CApp::getApp()->cache->set($keySeek, $obj, 60);
return $obj;
}
}
示例3: actionGetInfo
/**
* Получение информации о файле
*/
public function actionGetInfo()
{
$storage = $_POST["_storage"];
$file = $_POST["_file"];
$size = $_POST["_size"];
$index = $_POST["_index"];
$result = array("isImage" => false, "previewUrl" => "", "fullUrl" => "", "url" => "", "name" => $file, "index" => $index);
if (file_exists($storage . $file)) {
// заменяем обратный слэш в адресе на прямой
$linkWithBackSlash = CUtils::strRight($storage, CORE_CWD) . $file;
$link = str_replace('\\', '/', $linkWithBackSlash);
$result["fullUrl"] = WEB_ROOT . $link;
$result["url"] = $link;
$result["isImage"] = CUtils::isImage($storage . $file);
if (CUtils::isImage($storage . $file)) {
$result["previewUrl"] = WEB_ROOT . "_modules/_thumbnails/?src=" . $result["url"] . "&w=" . $size;
} else {
$filetype = CUtils::getMimetype($storage . $file);
if (file_exists(CORE_CWD . CORE_DS . "images" . CORE_DS . ICON_THEME . CORE_DS . "64x64" . CORE_DS . "mimetypes" . CORE_DS . $filetype . ".png")) {
$result["previewUrl"] = WEB_ROOT . "images/" . ICON_THEME . "/64x64/mimetypes/" . $filetype . ".png";
} else {
$result["previewUrl"] = WEB_ROOT . "images/" . ICON_THEME . "/64x64/mimetypes/unknown.png";
}
}
}
echo json_encode($result);
}
示例4: actionGetInfo
/**
* Получение информации о файле
*/
public function actionGetInfo()
{
$storage = $_POST["_storage"];
$file = $_POST["_file"];
$size = $_POST["_size"];
$index = $_POST["_index"];
$result = array("isImage" => false, "previewUrl" => "", "fullUrl" => "", "name" => $file, "index" => $index);
if (file_exists($storage . $file)) {
$result["fullUrl"] = WEB_ROOT . CUtils::strRight($storage, CORE_CWD) . $file;
$result["isImage"] = CUtils::isImage($storage . $file);
if (CUtils::isImage($storage . $file)) {
$result["previewUrl"] = WEB_ROOT . "_modules/_thumbnails/?src=" . $result["fullUrl"] . "&w=" . $size;
} else {
$filetype = CUtils::getMimetype($storage . $file);
if (file_exists(CORE_CWD . CORE_DS . "images" . CORE_DS . ICON_THEME . CORE_DS . "64x64" . CORE_DS . "mimetypes" . CORE_DS . $filetype . ".png")) {
$result["previewUrl"] = WEB_ROOT . "images/" . ICON_THEME . "/64x64/mimetypes/" . $filetype . ".png";
} else {
$result["previewUrl"] = WEB_ROOT . "images/" . ICON_THEME . "/64x64/mimetypes/unknown.png";
}
}
}
echo json_encode($result);
}
示例5: getGlobalFilter
/**
* Параметры глобального фильтра
*
* @return array
*/
public static function getGlobalFilter()
{
$result = array("field" => false, "value" => false);
if (CRequest::getString("filter") != "") {
$filter = CUtils::strRight(CRequest::getString("filter"), "=");
$params = explode(":", $filter);
$result["field"] = $params[0];
$result["value"] = $params[1];
}
return $result;
}
示例6: activeAttachPreview
/**
* Предпросмотр вложений со ссылками на оригиналы
*
* @param $name
* @param CModel $model
* @param int $size
* @param bool $addLinkToOriginal
*/
public static function activeAttachPreview($name, CModel $model, $addLinkToOriginal = false, $size = 100)
{
$attributes = $model->fieldsProperty();
$display = false;
if (array_key_exists($name, $attributes)) {
$field = $attributes[$name];
if ($field["type"] == FIELD_UPLOADABLE) {
$storage = $field["upload_dir"];
$file = $model->{$name};
if ($file !== "") {
if (file_exists($storage . $file)) {
$display = true;
}
}
}
}
if ($display) {
// заменяем обратный слэш в адресе на прямой
$linkWithBackSlash = CUtils::strRight($storage, CORE_CWD) . $file;
$link = str_replace('\\', '/', $linkWithBackSlash);
$icon = "";
if (CUtils::isImage($storage . $file)) {
// показываем превью изображения
$icon = WEB_ROOT . "_modules/_thumbnails/?src=" . $link . "&w=" . $size;
} else {
// показываем значок типа документа
$filetype = CUtils::getMimetype($storage . $file);
if (file_exists(CORE_CWD . CORE_DS . "images" . CORE_DS . ICON_THEME . CORE_DS . "64x64" . CORE_DS . "mimetypes" . CORE_DS . $filetype . ".png")) {
$icon = WEB_ROOT . "images/" . ICON_THEME . "/64x64/mimetypes/" . $filetype . ".png";
} else {
$icon = WEB_ROOT . "images/" . ICON_THEME . "/64x64/mimetypes/unknown.png";
}
}
if ($addLinkToOriginal) {
echo '<a href="' . WEB_ROOT . '' . $link . '" target="_blank"';
if (CUtils::isImage($storage . $file)) {
echo ' class="image_clearboxy"';
}
echo '>';
}
echo '<img src="' . $icon . '" />';
if ($addLinkToOriginal) {
echo '</a>';
}
}
if (!self::$_clearboxInit) {
self::$_clearboxInit = true;
?>
<script>
jQuery(document).ready(function(){
jQuery("a.image_clearboxy").colorbox({
maxHeight: "100%",
title: function(){
var url = $(this).attr('href');
return '<a href="' + url + '" target="_blank">Открыть в полном размере</a>';
}
});
});
</script>
<?php
}
}
示例7: searchObjectsFactory
/**
* @param $catalog
* @return ISearchCatalogInterface
* @throws Exception
*/
private function searchObjectsFactory($catalog, $properties = array())
{
if ($catalog == "staff") {
return new CSearchCatalogStaff(array("properties" => $properties));
} elseif ($catalog == "student") {
return new CSearchCatalogStudent(array("properties" => $properties));
} elseif ($catalog == "studentgroup") {
return new CSearchCatalogStudentGroup(array("properties" => $properties));
} elseif ($catalog == "sab_commissions") {
return new CSearchCatalogSABCommission(array());
} elseif (CUtils::strLeft($catalog, ".") == "class") {
$class = CUtils::strRight($catalog, ".");
return new $class(array("properties" => $properties));
} elseif (!is_null(CTaxonomyManager::getTaxonomy($catalog))) {
return new CSearchCatalogTaxonomy(array("taxonomy" => $catalog, "properties" => $properties));
} elseif (!is_null(CTaxonomyManager::getLegacyTaxonomy($catalog))) {
return new CSearchCatalogTaxonomyLegacy(array("taxonomy" => $catalog, "properties" => $properties));
} else {
throw new Exception("Не могу найти каталог для поиска " . $catalog);
}
}