This file contains hidden or 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
//== Spacing | |
// | |
$grid-breakpoints: ( | |
xs: 0, | |
sm: $screen-sm-min, | |
md: $screen-md-min, | |
lg: $screen-lg-min | |
); | |
$spacer-x-0: 0rem; | |
$spacer-y-0: 0rem; |
This file contains hidden or 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 | |
$img_src = $modx->getOption('src', $scriptProperties); | |
$img_alt = $modx->getOption('alt', $scriptProperties); | |
$img_width = $modx->getOption('width', $scriptProperties,640); | |
$is_lazy = $modx->getOption('lazy', $scriptProperties, false); | |
$img_class = $modx->getOption('class', $scriptProperties, 'img-fluid'); | |
$colums = $modx->getOption('cols', $scriptProperties, '{"xs":12,"sm":12,"md":8,"lg":6,"xl":6}'); | |
$img_type = $modx->getOption('type', $scriptProperties, 'jpg'); | |
$dataAttr = ''; |
This file contains hidden or 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 getAspectRatio(int $width, int $height) | |
{ | |
// search for greatest common divisor | |
$greatestCommonDivisor = static function($width, $height) use (&$greatestCommonDivisor) { | |
return ($width % $height) ? $greatestCommonDivisor($height, $width % $height) : $height; | |
}; | |
$divisor = $greatestCommonDivisor($width, $height); |
This file contains hidden or 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
<div class="row"> | |
[[!pdoPage? | |
&parents=`3` | |
&depth=`0` | |
&tpl=`tpl-podcat` | |
&includeTVs=`image` | |
&sortdir=`ASC` | |
&limit=`4` | |
&tplPageWrapper=`@INLINE <nav aria-label="pagination"><ul class="pagination">[[+first]][[+prev]][[+pages]][[+next]][[+last]]</ul></nav>` | |
&tplPageFirst=`@INLINE <li class="page-item"><a class="page-link" href="[[+href]]">Первая</a></li>` |
This file contains hidden or 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
Collections.renderer.imageplus = function(value, metaData, record, rowIndex, colIndex, store) { | |
if (value != '' && value != null) { | |
var data = Ext.decode(value); | |
var url = MODx.config.connectors_url + 'system/phpthumb.php?imageplus=1'; | |
var params = {}; | |
params.src = MODx.config['collections.renderer_image_path'] + data.sourceImg.src; | |
params.w = 100; | |
if (data.sourceImg.src.indexOf('.png') !== -1) { | |
params.f = 'png'; |
This file contains hidden or 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
@echo off | |
set dbUser=root | |
set dbPassword=password | |
set backupDir="F:\AdityaSatrioNugroho\testbackupDb-bat\" | |
set mysqldump="C:\xampp\mysql\bin\mysqldump.exe" | |
set mysqlDataDir="C:\xampp\mysql\data" | |
set zip="C:\Program Files\7-Zip\7z.exe" | |
:: get date |
This file contains hidden or 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
Все примеры расположены в порядке уменьшения нагрузки на БД и при равенстве кол-ва запросов в порядке уменьшения кол-ва строк кода. Сверху самый ресурсоёмкий по кол-ву запросов к БД. | |
/////////////////////////////////////////////////////////// | |
Пустая страница MODX при отключенном кэше: | |
кол-во зпросов/время запросов/время выполнения PHP кода/общее время | |
6/0.0002 s/0.0336 s/0.0338 s | |
*********************************************************** | |
1-ый код с pdoFetch, все методы: | |
$pdo = $modx->getService('pdoFetch'); | |
$pdo->setConfig(array( |
This file contains hidden or 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
@ECHO off | |
SETLOCAL | |
IF [%1]==[] goto s_start | |
ECHO GETDATE.cmd | |
ECHO Returns the date independent of regional settings | |
ECHO Creates the environment variables %v_year% %v_month% %v_day% | |
ECHO. | |
ECHO SYNTAX | |
ECHO GETDATE |
This file contains hidden or 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 | |
switch($modx->event->name) { | |
case 'OnFileManagerDirCreate': | |
$modx->log(modX::LOG_LEVEL_ERROR, 'fix folder permissions for: '.$directory.'/'); | |
chmod($directory.'/', octdec($modx->getOption('new_folder_permissions'))); | |
break; | |
case 'OnFileManagerFileCreate': | |
$modx->log(modX::LOG_LEVEL_ERROR, 'fix file permissions for: '.$path); | |
chmod($path, octdec($modx->getOption('new_file_permissions'))); | |
break; |
This file contains hidden or 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 | |
/** | |
* Redirect users to custom URL based on their role after login | |
* | |
* @param string $redirect | |
* @param object $user | |
* @return string | |
*/ | |
function wc_custom_user_redirect( $redirect, $user ) { | |
// Get the first of all the roles assigned to the user |
NewerOlder