Skip to content

Instantly share code, notes, and snippets.

//p.obj_header_insert.before( t.param.htmltable.header_cell.replace( '<!--ph-->', p.data.h[ i ].c.replace( /xxx&quot/g, '"' ) ) );
// input-v4.js
<?php
$id = $_GET['id'];
if ($res = $modx->getObject('modResource',intval($id))) {
if(intval($res->get('template')) == 2)
{
$js ="
<script type='text/javascript'>
Ext.onReady(function () {
var tb = Ext.getCmp('modx-action-buttons');
<?php
// Скрипт формирования уникального ключа формы
session_start();
if($_SESSION["verify"])
{
unset($_SESSION["verify"]);
}
$_SESSION["verify"]=md5(uniqid(rand(),1));
// Изменяем функцию сохранения контента в файл
public function onSave()
{
if (!$this->checkEditor())
return;
$fileName = post('file');
// Format <p> delete
// Вторым параметро указываем те теги, которые разрешаем к допуску
$formattedContent = strip_tags(post("content"), '<a></a>');
Установить Docker CE и docker-compose на систему, если у вас MacOS или Windows
вы можете скачать установщик с офф. сайта
https://www.docker.com/get-started
Если же у вас Linux проводим установку как указано здесь:
https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-docker-ce
Далее устанавливаем docker-compose
https://www.digitalocean.com/community/tutorials/how-to-install-docker-compose-on-ubuntu-16-04
mongorestore --gzip --db $DB_NAME --drop $PATH/
@webbash
webbash / laravel-builder-where-json-fields.php
Last active June 25, 2019 13:57
Laravel Eloquent JSON fields where query
<?php
return $query->whereJsonContains('fields', ['sub-field' => 'value'])
@webbash
webbash / install-php-extensions-in-docker
Created August 1, 2019 10:13
Add php extension to existing container
docker-compose exec <your-php-container> docker-php-ext-install <extension1> <extension2>
1) Удаляем из vendor папку которую хотим назначить как рабочую
2) composer install --prefer-source
3) Добавляем эту папку в Settings -> VCS вместе с .git
4) Обновляем индексацию
@webbash
webbash / Laravel Nova Action - conflict between canSee and canRun
Created January 30, 2020 11:25
Фикс Action в Laravel Nova - конфликт canSee и canRun когда используешь showOnTableRow
(new ActionName())
->canSee(function () {
return ! $this->resource->exists || ($this->field === 'some') === true;
})
->canRun(function () {
return true;
}),