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
/* | |
* XSS filter | |
* | |
* This was built from numerous sources | |
* (thanks all, sorry I didn't track to credit you) | |
* | |
* It was tested against *most* exploits here: http://ha.ckers.org/xss.html | |
* WARNING: Some weren't tested!!! | |
* Those include the Actionscript and SSI samples, or any newer than Jan 2011 | |
* |
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
// Generate migration file | |
s doctrine:migrations:generate | |
// Применить миграцию up | |
s doctrine:migrations:execute YYYYMMDDHHMMSS --up | |
// Откатить миграцию down | |
s doctrine:migrations:execute YYYYMMDDHHMMSS --down |
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 | |
// Snippet for Symfony 2 application that uses Doctrine 2 to handle transactions | |
// It uses the names of the objects/doctrine repositories from the Beta 4 Manual of Symfony 2. | |
// Get the entity manager | |
$em = $this->getDoctrine()->getEntityManager(); | |
// suspend auto-commit | |
$em->getConnection()->beginTransaction(); |
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
// Возвращает ассоциативный массив если запос удался. | |
// Если не удался - пустой массив | |
// Если возникла ошибка - Ексепшен | |
->getArrayResult() | |
// Выполняет запрос созданные в билдере | |
// В случае выполнения запорса - возвращает int 'n', где n = количеству выполненных запросов | |
// В случае НЕ выполнения запорса - возвращает int '0' | |
// В случае ошибки - возывает Ексепшен | |
->execute() |
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 function **/ | |
function array_to_tree(array $array, $parent_id = 0) | |
{ | |
$array = array_combine(array_column ($array, 'id'), array_values($array)); | |
foreach ($array as $k => &$v) { | |
if (isset($array[$v['parent_id']])) { | |
$array[$v['parent_id']]['children'][$k] = &$v; | |
} |
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 getSubOrgsForTranspnakl(Entity $topitem) | |
{ | |
$childrenArray = array(); | |
$iterate = true; | |
$listOfParents = array(); | |
$listOfParents = array_push($listOfParents, $topitem); | |
while ($iterate){ | |
$q = $this | |
->createQueryBuilder('o') |
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 | |
/** | |
* Class for working with wood Adjacency List | |
* see down sql 'show create table' | |
* | |
* @author Alexander Kapliy <[email protected]> | |
*/ | |
class AdjacencyList { | |
protected $tbl; |
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 | |
$tree = [ | |
[ | |
"id" => "1", | |
"name" => "test 1", | |
"parent" => null, | |
"_children" => [ | |
[ | |
"id" => "1.1", |
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 app/console doctrine:fixtures:load --append --no-debug --fixtures=/path/to/fixture1 |
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
$dateNow = "04/28/2016"; | |
$timestamp = strtotime($dateNow); | |
$currDayOfWeek = date("w", $timestamp); | |
$startDayOflastWeekT = strtotime(-($currDayOfWeek + 7) . " days", $timestamp); | |
$startDayOflastWeek = date("m/d/Y", $startDayOflastWeekT); | |
$endDayOflastWeekT = strtotime("+ 6 days", $startDayOflastWeekT); | |
$endDayOflastWeek = date("m/d/Y", $endDayOflastWeekT); | |
$startDayOfMiddleWeekT = strtotime("+ 7 days", $startDayOflastWeekT); |
OlderNewer