M

modHelpers

By Serg Shlokov (sergant210)


Library of the helpfull functions for MODX. Available more than 70 functions.It requires PHP 5.5+.

# Send an email

email('darling@mail.com', 'Subject', 'Email content');

email_user('admin', $subject, $content);  // To user

# Check the user existence

if (user_exists(['email'=>'admin@mail.com']) { // Exists }

# Verify the email

if (!is_email($_POST['email']) { // Validation error }

# Get the data from the cache

$value = cache('key', 'my_data');

# Get lexicon record

$name = lang('language_key');

# Redirect to the page with the id = 5

redirect(5);

# Remove resources of the category with the id = 10

resources()->where(['parent'=>10])->remove();

# Get users from the group "Managers"

$usersArray = users()->members('Managers')->toArray();

Use is_auth() instead of $modx->user->isAuthenticated($modx->context->key)

# Make a list of faked news (using a snippet)

return collection(10)->each(function($item, $idx, $modx){return '

' . faker()->date() . img(faker()->imageUrl(100,100),['class'=>'img-news']) . ' ' . faker()->text(700) . '<.div>';});

See details on GitHub.

Serg Shlokov


New in modHelpers 3.7.0

More

Information

Released
February 13, 2019
Supported Versions
2.3 – Current
Downloads
2,612
License
GPLv2

More from Serg Shlokov

siteStatistics

Page and user visits statistics

View
controlErrorLog

Closing the window by clicking on the icon

View
AdminTools

Adds some features for MODX administrators and developers.

View
tagElementPlugin

An extra to work with MODX tags.

View