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
function url_to_link($text) | |
{ | |
$text = preg_replace("@\b(https?://)?(([0-9a-zA-Z_!~*'().&=+$%-]+:)?[0-9a-zA-Z_!~*'().&=+$%-]+\@)?(([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-zA-Z_!~*'()-]+\.)*([0-9a-zA-Z][0-9a-zA-Z-]{0,61})?[0-9a-zA-Z]\.[a-zA-Z]{2,6})(:[0-9]{1,4})?((/[0-9a-zA-Z_!~*'().;?:\@&=+$,%#-]+)*/?)@", '<a href="\0" target="_blank">\0</a>', $text); | |
$text = preg_replace("/href=\"([0-9a-zA-Z_\-]+\.)/U", 'href="http://$1', $text); | |
return $text; | |
} |
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
function word_form($value, $one_form, $two_form, $five_form){ | |
$form = null; | |
$han_value = $value%100; | |
$ten_value = $value%10; | |
// x05 - x20, x0, x5 - x9, | |
if( ($han_value >= 5 && $han_value <= 20) || in_array( $ten_value, array(0, 5, 6, 7, 8, 9) ) ){ | |
$form = $five_form; |
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
function date_format_ago($timestamp) | |
{ | |
$diff = time() - $timestamp; | |
if ($diff < 5) | |
{ | |
return 'только что'; | |
} | |
if ($diff < 60) |
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
function localized_current_url($sf_culture = null) | |
{ | |
if (! $sf_culture) | |
{ | |
throw new sfException(sprintf('Invalid parameter $sf_culture "%s".', $sf_culture)); | |
} | |
$routing = sfContext::getInstance()->getRouting(); | |
$request = sfContext::getInstance()->getRequest(); | |
$controller = sfContext::getInstance()->getController(); |
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
jQuery(function($) { | |
var | |
$body = $('body'), | |
$formStart = $('.b-formStart'), | |
$formStartOne = $formStart.find('.column_one'), | |
$formStartTwo = $formStart.find('.column_two'); | |
$(function() { | |
var ids_hash = {}; | |
$('[data-replace=name], [data-replace=image]').each(function(i, el) { |
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 executeVkUploadFile(sfWebRequest $request) | |
{ | |
$this->forward404Unless($request->isXmlHttpRequest() && $request->isMethod(sfRequest::POST)); | |
$this->forward404Unless($t_participant = Doctrine::getTable('TParticipant')->find($request->getParameter('id'))); | |
$url = $request->getParameter('url'); | |
$file = $t_participant->getResizedPath(); | |
$curl = new cURL($url); | |
$response = $curl->post([ 'photo' => '@' . $file ]); |
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 | |
/** | |
* @author Philip Sturgeon | |
* @created 9 Dec 2008 | |
*/ | |
class cURL { | |
private $session; // Contains the cURL handler for a session |