This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.ajaxSelector = function(offset, limit, callback) { | |
var page_id = this.data('page-id'); | |
var template = this.data('template'); | |
var data = this.find(":input[value != '']").serialize(); | |
var params = $.param({ | |
id: page_id, | |
offset: offset, | |
limit: limit, | |
template: template | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function grayscale($img_path) { | |
$umiImg = new umiFile('.'.$img_path); | |
$gray_name = '/images/gray/'.str_replace('.'.$umiImg->getExt(), '', $umiImg->getFileName()).'_gray.jpg'; | |
if (!file_exists('.'.$gray_name)) { | |
switch ($umiImg->getExt()) { | |
case 'jpg': $img = imagecreatefromjpeg($umiImg->getFilePath()); break; | |
case 'gif': $img = imagecreatefromgif($umiImg->getFilePath()); break; | |
case 'png': $img = imagecreatefrompng($umiImg->getFilePath()); break; | |
} | |
imagefilter($img, IMG_FILTER_GRAYSCALE); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function getYouTubeImg($id_video) { | |
$apiKey = 'AIzaSyCGlOkSZitdA33mnUhmW3hmqdPalusV5GQ'; | |
$url = 'https://www.googleapis.com/youtube/v3/videos?id='.$id_video.'&key='.$apiKey.'&part=snippet'; | |
$data = json_decode(file_get_contents($url), true); | |
$thumbnails = $data['items'][0]['snippet']['thumbnails']; | |
$thumb = array_pop($thumbnails); | |
$name = $_SERVER['DOCUMENT_ROOT'].'/images/youtube/'.$id_video.'_image.jpg'; | |
if (file_exists($name)) { | |
return str_replace('./', '/', $name); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function getYouTubeIdFromURL($url) { | |
$pattern = | |
'%^ # Match any youtube URL | |
(?:https?://)? # Optional scheme. Either http or https | |
(?:www\.)? # Optional www subdomain | |
(?: # Group host alternatives | |
youtu\.be/ # Either youtu.be, | |
| youtube\.com # or youtube.com | |
(?: # Group path alternatives | |
/embed/ # Either /embed/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function getYoutubePreview($id, $field) { | |
$hierarchy = umiHierarchy::getInstance(); | |
$video = $hierarchy->getElement($id); | |
if ($video instanceof umiHierarchyElement) { | |
if ($video->$field instanceof umiImageFile) { // если изображение уже записано | |
return substr($video->$field->getFilePath(), 1); | |
} else { // если поле пустое | |
$link = $video->youtube; | |
if ($youtube_id = $this->getYouTubeIdFromURL($link)) { // получаем изображение с сервера youtube | |
$photo = $this->getYouTubeImg($youtube_id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function onPaymentWaiting(iUmiEventPoint $event) { | |
$object = $event->getRef("object"); | |
// выполняем действия только для определённого типа объектов | |
if($object->getTypeId() == umiObjectTypesCollection::getInstance()->getBaseType('emarket', 'order')) { | |
// объяввим переменную, в которую будем запоминать значение поля до его изменения | |
static $old_status_id = 0; | |
switch ($event->getMode()) { | |
case 'before' : { | |
// запомним старое значение |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<selection> | |
<target result="objects"> | |
<type id="{1}" /> | |
</target> | |
<limit page="{3}">{2}</limit> | |
</selection> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Текст | Вторая строка | |
Текст | |
Вторая строка |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xsl:for-each select="items/item[position() mod 5 = 1]"> | |
<div class="line"> | |
<xsl:for-each select=".|following-sibling::item[position() < 5]"> | |
<p><xsl:value-of select="@name" /></p> | |
</xsl:for-each> | |
</div> | |
</xsl:for-each> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xsl:template name="declension"> | |
<xsl:param name="number" /> | |
<xsl:param name="f0" /> | |
<xsl:param name="f1" /> | |
<xsl:param name="f2" /> | |
<xsl:variable name="absnum"> | |
<xsl:choose> | |
<xsl:when test="$number < 0"><xsl:value-of select="0 - $number" /></xsl:when> | |
<xsl:otherwise><xsl:value-of select="$number" /></xsl:otherwise> | |
</xsl:choose> |
OlderNewer