Created
July 22, 2012 11:25
-
-
Save christianhanvey/3159370 to your computer and use it in GitHub Desktop.
modx revo object debug helper snippet
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 | |
/** | |
* File viewRevoObjects.php (requires MODx Revolution 2.1) | |
* Created on: 9/17/11 at 9:49 AM | |
* Project shawn_wilkerson | |
* @elements | |
* @version 1.0 | |
* @category | |
* @author W. Shawn Wilkerson | |
* @link http://www.shawnWilkerson.com | |
* @copyright Copyright (c) 2011, Sanity LLC. All rights reserved. | |
* @license | |
* | |
*/ | |
if (!function_exists('retrieveObject')) { | |
function retrieveObject($name) | |
{ | |
$rt = ''; | |
global $modx; | |
$tblName = 'mod' . $name; | |
$rt .= '<h1>' . $tblName . ' ([[++settings_version]])</h1>'; | |
$rt .= '<h2>Table Fields</h2>'; | |
$rt .= '<pre>' . print_r($modx->getFields($tblName), true) . '</pre>'; | |
$rt .= '<h2>Table Construction (meta defined in schema)</h2>'; | |
$rt .= '<pre>' . print_r($modx->getFieldMeta($tblName), true) . '</pre>'; | |
$rt .= '<h2>Aggregate Relations</h2>'; | |
$rt .= '<pre>' . print_r($modx->getAggregates($tblName), true) . '</pre>'; | |
$rt .= '<h2>Composite Relations</h2>'; | |
$rt .= '<pre>' . print_r($modx->getComposites($tblName), true) . '</pre>'; | |
$rt .= '<h2>Ancestors</h2>'; | |
$rt .= '<pre>' . print_r($modx->getAncestry($tblName), true) . '</pre>'; | |
return $rt; | |
} | |
} | |
$wsw = ''; | |
$modxObjects = array('Chunk', 'Plugin', 'Resource', 'Snippet', 'Template', 'TemplateVar', 'User'); | |
$objType = $modx->getOption('objectType', $scriptProperties, 'User'); | |
if ($objType == "ALL") { | |
foreach ($modxObjects as $name) { | |
$wsw .= retrieveObject($name); | |
} | |
} else { | |
if (in_array($objType, $modxObjects)) { | |
$wsw = retrieveObject($objType); | |
} | |
} | |
$wsw = str_replace(array('(', ')', 'Array'), '', $wsw); | |
return $wsw; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment