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 | |
$doc = $modx->newObject('modResource'); | |
$doc->set('createdby', $modx->user->get('id')); | |
$allFormFields = $hook->getValues(); | |
foreach ($allFormFields as $field=>$value) | |
{ | |
$doc->set($field, $value); | |
} |
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 | |
/* Set plugin to run on "OnManagerPageBeforeRender" | |
*/ | |
$user = $modx->getUser(); | |
$restricted = true; | |
if($user) { | |
$restricted = (!$user->isMember(array('Administrator'))); | |
} | |
if($restricted){ | |
$modx->regClientStartupHTMLBlock('<style type="text/css">.deleted{display:none;}</style>'); |
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 | |
/** devChunk MODX Output Modifier ** | |
** | |
** Returns an alternate chunk to users in the groups defined below | |
** Usage [[$livechunk:devChunk=`alternatechunk`]] | |
** | |
**/ | |
$user = $modx->getUser(); | |
$restricted = true; |
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 | |
/* | |
** richIntro | |
** Plugin checks if introtext is filled in yet, and hides it if not. Run 'onDocFormRender' | |
** http://g.recordit.co/VOYqBC3CnS.gif | |
*/ | |
$introtext = empty($resource->get('introtext')); | |
if($introtext){ | |
$modx->regClientStartupHTMLBlock('<script>Ext.onReady(function() { | |
var introtext = Ext.getCmp("modx-resource-introtext"); |
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
archey | |
# | |
# Sections: | |
# 1. Environment Configuration | |
# 2. Make Terminal Better (remapping defaults and adding functionality) | |
# 3. File and Folder Management | |
# 4. Searching | |
# 5. Process Management | |
# 6. Networking | |
# 7. System Operations & Information |
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 | |
/* Based on https://gist.github.com/OptimusCrime/dac5deec0d65872740c9d7bccdc5e336 | |
** Add system setting named "max_image_dimension" to set a max height or width for images | |
*/ | |
if(!function_exists(autoRotateImage)) { | |
function autoRotateImage($image,$max_image_dimension = 0) { | |
$orientation = $image->getImageOrientation(); | |
switch($orientation) { | |
case imagick::ORIENTATION_BOTTOMRIGHT: |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<policy> | |
<template> | |
<name>AdministratorTemplate</name> | |
<description>Context administration policy template with all permissions.</description> | |
<lexicon>permissions</lexicon> | |
<template_group>Admin</template_group> | |
<permissions> | |
<permission> | |
<name>about</name> |
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
[ | |
{ name: 'document', items : [ 'Source','-','Save','NewPage','DocProps','Preview','Print','-','Templates' ] }, | |
{ name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] }, | |
{ name: 'editing', items : [ 'Find','Replace','-','SelectAll','-','SpellChecker', 'Scayt' ] }, | |
{ name: 'forms', items : [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ] }, | |
{ name: 'styles', items : [ 'Styles','Format','Font','FontSize' ] }, | |
{ name: 'colors', items : [ 'TextColor','BGColor' ] }, | |
{ name: 'tools', items : [ 'Maximize', 'ShowBlocks','-','About' ] } | |
'/', | |
{ name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] }, |
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 // PHP код должен быть заключен в теги <?php | |
// Если ваш файл содержит только PHP-код, то можно | |
пропустить закрывающий ?> | |
// А так начинаются комментарии | |
# Это тоже комментарий но // предпочтительнее |
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
wget -r -k -l 7 -p -E -nc http://site.com/ | |
-r — указывает на то, что нужно рекурсивно переходить по ссылкам на сайте, чтобы скачивать страницы. | |
-k — используется для того, чтобы wget преобразовал все ссылки в скаченных файлах таким образом, чтобы по ним можно было переходить на локальном компьютере (в автономном режиме). | |
-p — указывает на то, что нужно загрузить все файлы, которые требуются для отображения страниц (изображения, css и т.д.). | |
-l — определяет максимальную глубину вложенности страниц, которые wget должен скачать (по умолчанию значение равно 5, в примере мы установили 7). В большинстве случаев сайты имеют страницы с большой степенью вложенности и wget может просто «закопаться», скачивая новые страницы. Чтобы этого не произошло можно использовать параметр -l. | |
-E — добавлять к загруженным файлам расширение .html. | |
-nc — при использовании данного параметра существующие файлы не будут перезаписаны. Это удобно, когда нужно продолжить загрузку сайта, прерванную в предыдущий раз. |