Example #1
0
<?php

/**
 * Orphans
 *
 * Copyright 2013 by Bob Ray <http://bobsguides.com>
 *
 * This file is part of Orphans, a utility for finding unused elements.
 *
 * Orphans is free software; you can redistribute it and/or modify it under the
 * terms of the GNU General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option) any later
 * version.
 *
 * Orphans is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * Orphans; if not, write to the Free Software Foundation, Inc., 59 Temple
 * Place, Suite 330, Boston, MA 02111-1307 USA
 *
 * @package orphans
 */
/**
 * @package orphans
 * @subpackage controllers
 */
require_once dirname(dirname(__FILE__)) . '/model/orphans/orphans.class.php';
$orphans = new Orphans($modx);
return $orphans->initialize('mgr');
Example #2
0
        $modx->user = $myUser;
    }
}
@(include MODX_CORE_PATH . 'components/orphans/model/orphans/orphans.class.php');
$types = array('modChunk', 'modTemplate', 'modTemplateVar', 'modSnippet');
function output($msg, $suppressCr = false)
{
    if (php_sapi_name() === 'cli') {
        $output = "\n" . $msg;
    } else {
        $output = "<br />" . $msg;
    }
    echo $output;
}
$logLevel = $modx->setLogLevel(MODX::LOG_LEVEL_ERROR);
$orphans = new Orphans($modx);
if ($orphans instanceof Orphans) {
    $orphans->initialize();
} else {
    die('No Orphans class');
}
if (php_sapi_name() !== 'cli') {
    output('<pre>');
}
foreach ($types as $type) {
    output('--------------------------------');
    output(strtoupper(substr($type, 3) . 'S'));
    $results = $orphans->process($type);
    if (empty($results)) {
        $output('    No orphans found');
    } else {