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 | |
// Remember create column hits with type int | |
// Create plugin with any name and check in events OnWebPageInit | |
$e = &$modx->Event; | |
if($e->name == 'OnWebPageInit') { | |
if(!isset($_SESSION['usertype'])) { | |
$_SESSION['usertype'] = ''; | |
} | |
if($_SESSION['usertype'] != 'manager') { |
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
[!DLMenu? | |
&parents=`0` | |
&maxDepth=`1` | |
&outerTpl=`@CODE:<ul id="nav" class="cont">[+wrap+]</ul>` | |
&rowTpl=`@CODE:<li><a href="[+url+]" title="[+title+]">[+title+]</a></li>` | |
&rowHereTpl=`@CODE:<li class="active"><a href="[+url+]" title="[+title+]">[+title+]</a></li>` | |
!] |
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 | |
$settings['display'] = 'horizontal'; | |
$settings['fields'] = array( | |
'key' => array( | |
'caption' => 'User', | |
'type' => 'dropdown', | |
'elements' => '@SELECT pagetitle, id FROM [+PREFIX+]site_content WHERE parent = 10 AND `published` = 1 ORDER BY menuindex ASC' | |
), | |
'value' => array( | |
'caption' => 'Desc', |
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
//<?Hits % OnLogPageHit, OnBeforeDocFormSave, OnDocFormRender | |
if(!defined('MODX_BASE_PATH')){die('What are you doing? Get out of here!');} | |
/* | |
Hits 1.0.3 by Yurik Dertlyan | yurik@unix.am | |
update by Dmi3yy@gmail.com | |
Plugin for Evolution CMS to register and output page hits | |
Installation: | |
- SQL 'ALTER TABLE modx_site_content ADD COLUMN `hits` INT(10) UNSIGNED NOT NULL'; | |
- Create plugin with name "Hits" and description "1.0.3" |
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 | |
// Get last 20 photos from instagram, running from cron, write preview urls (150*150) in {{prefix}}_insta_photos table (id, url) | |
function rudr_instagram_api_curl_connect( $api_url ){ | |
$connection_c = curl_init(); // initializing | |
curl_setopt( $connection_c, CURLOPT_URL, $api_url ); // API URL to connect | |
curl_setopt( $connection_c, CURLOPT_RETURNTRANSFER, 1 ); // return the result, do not print | |
curl_setopt( $connection_c, CURLOPT_TIMEOUT, 20 ); | |
$json_return = curl_exec( $connection_c ); // connect and get json data | |
curl_close( $connection_c ); // close connection | |
return json_decode( $json_return ); // decode and return |
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 | |
$e = &$modx->Event; | |
switch($e->name){ | |
case 'OnManagerWelcomeHome': | |
//if($_SESSION['mgrRole']!=='2') return; | |
//$widgets['welcome']['hide']='1'; | |
$widgets['onlineinfo']['hide']='1'; | |
$widgets['recentinfo']['hide']='1'; | |
$widgets['news']['hide']='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 | |
[[DocLister? | |
&prepare=`thumb` | |
&thumbOptions=`w=100,h100,zc=1` | |
&tpl=`@CODE: <a href="[+tv.image+]"><img src="[+thumb+]"></a>` | |
]] | |
// thumb snippet | |
$data['thumb'] = $modx->runSnippet('phpthumb', Array( | |
'input' => $data['tv.image'], |
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 | |
$e = &$modx->Event; | |
switch($e->name){ | |
case 'OnManagerNodePrerender': | |
if($ph['id'] == '2'){ | |
//Change icons for doc with id 2 | |
$ph['icon'] = "<i class="fa fa-address-card-o"></i>"; | |
$ph['icon_folder_open'] = "<i class="fa fa-address-card-o"></i>"; | |
$ph['icon_folder_close'] = "<i class="fa fa-address-card-o"></i>"; | |
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 | |
/* Add in Http\Kernel.php after protected $routeMiddleware -> 'isActive' => \App\Http\Middleware\CheckUserActive::class, */ | |
namespace App\Http\Middleware; | |
use Closure; | |
use Illuminate\Support\Facades\Lang; | |
use Illuminate\Support\Facades\Auth; |
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 | |
// For non blocking write logs by job | |
CalendarLogJob::dispatch($data_log); | |
// Get data and send calendar in ics | |
$date = Carbon::now()->timezone($hotel_data->timezone)->format("Y-m-d H:i:s"); | |
$date_end = Carbon::now()->addYear(1)->timezone($hotel_data->timezone)->format("Y-m-d H:i:s"); | |
// None Eloquent select | |
$data = DB::select("SELECT * FROM records WHERE room_id = $room_id AND status != 'canceled' |
OlderNewer