How To Retrieve MODX Revolution System Settings By Area

How To Retrieve MODX Revolution System Settings By Area

Directly Target Specific Areas of the MODX Revolution Settings

Posted on February 26, 2012 at 21:13:00
Tags: settings, tags
Words: 177
Level: Advanced
Dependencies: None

Possible System Settings Areas

authentication
caching
editor
email
file
furls
gateway
language
mail
manager
phpthumb
proxy
reCaptcha
session
site
system

Snippet Call

[[getSystemSettingsByArea?settingsarea=`furls`]]

Code

<?php

/**
 * File getMODXSystemSettings.php (requires MODx Revolution 2.1+)
 * Created on: 9/5/11 at 10:38 AM
 * Project shawn_wilkerson
 * @package
 * @version 1.0
 * @category
 * @author W. Shawn Wilkerson
 * @link http://www.shawnWilkerson.com
 * @copyright Copyright (c) 2011, Shawn Wilkerson. All rights reserved.
 * @license
 *
Target a specific area of the settings by passing its name here

 */
$area = $modx->getOption('settingsarea', $scriptProperties, 'furls');
$criteria = array('area' => $area);
$systemSettings = $modx->getCollection('modSystemSetting', $criteria);
foreach ($systemSettings as $setting) {
    $key = $setting->get('key');
    $val = htmlspecialchars($setting->get('value'));
    $out .= $key . '=>' . $val . "\n";
}
return $out;

Sample Output

automatic_alias=>1
container_suffix=>/
friendly_alias_lowercase_only=>1
friendly_alias_max_length=>0
friendly_alias_restrict_chars=>pattern
friendly_alias_restrict_chars_pattern=>/[\0\x0B\t\n\r\f\a&=+%#<>"~:`@\?\[\]\{\}\|\^'\\]/
friendly_alias_strip_element_tags=>1
friendly_alias_translit=>none
friendly_alias_translit_class=>translit.modTransliterate
friendly_alias_translit_class_path=>{core_path}components/
friendly_alias_trim_chars=>/.-_
friendly_alias_word_delimiter=>-
friendly_alias_word_delimiters=>-_
friendly_urls=>1
friendly_urls_strict=>0
global_duplicate_uri_check=>0
use_alias_path=>1
friendly_alias_realtime=>0
use_frozen_parent_uris=>0

MODX:
Website development platform combining security, power, and innovation.