Example #1
0
function loadApps()
{
    if (is_dir(DESKUI_PATH_APPS) && is_readable(DESKUI_PATH_APPS)) {
        $dirs = scandir(DESKUI_PATH_APPS);
        foreach ($dirs as $dir) {
            if ($dir != '.' && $dir != '..') {
                loadApp($dir . '/');
            }
        }
    }
}
Example #2
0
function load($classCall)
{
    $names = getNames($classCall);
    if (checkRootNamespace($names)) {
        if (in_array('board', $names)) {
            loadBaseClass(end($names));
        } elseif (in_array('apps', $names)) {
            loadApp(end($names), getAppType($names));
        } else {
            findClass($names);
        }
    }
}
Example #3
0
 function run()
 {
     loadApp($this->getMyComponentPathDefault() . 'class_stepinstall.php');
     //make sure it's not already installed
     if (file_exists(ANWIKI_INSTALL_LOCK)) {
         $sLinkHome = AnwUtils::link(AnwComponent::globalCfgHomePage());
         $sLinkForce = AnwStepInstall::linkStep(AnwStepInstall::getStepDefault());
         $this->out .= $this->tpl()->alreadyInstalled($sLinkHome, $sLinkForce, ANWIKI_INSTALL_LOCK, ANWIKI_INSTALL_STATUS);
         return;
     }
     //make sure writable dir is writable
     if (!file_exists(ANWIKI_INSTALL_STATUS)) {
         @touch(ANWIKI_INSTALL_STATUS);
     }
     if (!is_writable(ANWPATH_WRITABLE) || !is_writable(ANWIKI_INSTALL_STATUS)) {
         $this->out .= $this->tpl()->error($this->t_("err_notwritable_directory_explain", array('directory' => '<br/>' . ANWPATH_WRITABLE)), $this->t_("err_notwritable_t"));
         return;
     }
     //security
     define('ANWIKI_IN_INSTALL', true);
     //read next step
     $nCurrentStepStatus = self::getCurrentStepStatus();
     self::debug("current step status: " . $nCurrentStepStatus);
     //find step to execute
     $nStepOrder = (int) AnwEnv::_GET("step", AnwEnv::_POST("step", $nCurrentStepStatus));
     //do not go to next steps if previous steps were not completed
     if ($nStepOrder > $nCurrentStepStatus) {
         $nStepOrder = $nCurrentStepStatus;
     }
     //make sure step exists
     try {
         $sStepName = AnwStepInstall::getStepForOrder($nStepOrder);
     } catch (AnwException $e) {
         $nStepOrder = $nCurrentStepStatus;
         $sStepName = AnwStepInstall::getStepForOrder($nStepOrder);
     }
     //load the step
     $this->oStepInstall = AnwStepInstall::loadComponent($sStepName);
     AnwStepInstall::setActionInstall($this);
     $nCountSteps = count(AnwStepInstall::getAllSteps());
     $sLinkPrevious = $this->oStepInstall->linkStepPrevious();
     $sLinkNext = $this->oStepInstall->linkStepNext();
     $sTitleStep = $this->oStepInstall->getStepTitle();
     $this->out .= $this->tpl()->headerInstall($sTitleStep, $nStepOrder, $nCountSteps, $sLinkPrevious, $sLinkNext);
     //run the step
     $this->out .= $this->oStepInstall->runStepInstall();
     $this->out .= $this->tpl()->footerInstall($sTitleStep, $nStepOrder, $nCountSteps, $sLinkPrevious, $sLinkNext);
 }
Example #4
0
 protected static function requireCustomOrDefault($sFile, $sDir, $sClassNamePrefix, $bIsAddon = -1)
 {
     $sClassNameDefault = str_replace('%%', 'Default', $sClassNamePrefix);
     //from ANWPATH_DEFAULT and ANWPATH_ADDONS
     $sClassNameOverride = str_replace('%%', 'Override', $sClassNamePrefix);
     //skip if already loaded
     //TODO: (in some case, we may have already loaded a contentclass
     //when several contentclasses are defined in the same file)
     if (class_exists($sClassNameOverride, false)) {
         //throw new AnwUnexpectedException("requireCustomOrDefault : ".$sClassNameOverride." is ALREADY LOADED!");
         AnwDebug::log("requireCustomOrDefault : " . $sClassNameOverride . " is ALREADY LOADED!");
         list($null, $bIsAddon) = AnwUtils::getFileDefault($sFile, $sDir);
         return array($sClassNameOverride, $bIsAddon);
     } else {
         if (class_exists($sClassNameDefault, false)) {
             //throw new AnwUnexpectedException("requireCustomOrDefault : ".$sClassNameDefault." is ALREADY LOADED!");
             AnwDebug::log("requireCustomOrDefault : " . $sClassNameDefault . " is ALREADY LOADED!");
             list($null, $bIsAddon) = AnwUtils::getFileDefault($sFile, $sDir);
             return array($sClassNameDefault, $bIsAddon);
         }
     }
     //firstly, load default
     if ($bIsAddon != -1) {
         //we already know where is the default file
         $sFileName = ($bIsAddon ? ANWPATH_ADDONS : ANWPATH_DEFAULT) . $sDir . $sFile;
     } else {
         //we don't know where is the default file... let's search in ADDONS and DEFAULT directories
         list($sFileName, $bIsAddon) = AnwUtils::getFileDefault($sFile, $sDir);
     }
     AnwDebug::log("Loading default : " . $sFileName);
     loadApp($sFileName);
     $classname = $sClassNameDefault;
     //load override if any
     try {
         $sFileName = AnwUtils::getFileOverride($sFile, $sDir);
         AnwDebug::log("Loading override : " . $sFileName);
         loadApp($sFileName);
         $classname = $sClassNameOverride;
     } catch (AnwException $e) {
     }
     return array($classname, $bIsAddon);
 }
Example #5
0
function anwiki__autoload($sClassName)
{
    static $asClasses;
    if (!$asClasses) {
        $asClasses = array();
        $asClasses['AnwMysql'] = ANWPATH_CLASSES_ABSTRACTION . "class_mysql.php";
        $asClasses['AnwOutput'] = ANWPATH_CLASSES . "class_output.php";
        $asClasses['AnwOutputHtml'] = ANWPATH_CLASSES . "class_output.php";
        $asClasses['AnwParser'] = ANWPATH_CLASSES . "class_parser.php";
        $asClasses['AnwAutoSync'] = ANWPATH_CLASSES . "diff/class_autosync.php";
        $asClasses['AnwXml'] = ANWPATH_CLASSES . "class_xml.php";
        $asClasses['AnwDiffAdded'] = ANWPATH_CLASSES . "diff/class_diffadded.php";
        $asClasses['AnwDiffDeleted'] = ANWPATH_CLASSES . "diff/class_diffdeleted.php";
        $asClasses['AnwDiffEdited'] = ANWPATH_CLASSES . "diff/class_diffedited.php";
        $asClasses['AnwDiffKept'] = ANWPATH_CLASSES . "diff/class_diffkept.php";
        $asClasses['AnwDiffMoved'] = ANWPATH_CLASSES . "diff/class_diffmoved.php";
        $asClasses['AnwDiff'] = ANWPATH_CLASSES . "diff/class_diffs.php";
        $asClasses['AnwDiffs'] = ANWPATH_CLASSES . "diff/class_diffs.php";
        $asClasses['AnwFeed'] = ANWPATH_CLASSES . "class_feed.php";
        $asClasses['AnwFeedItem'] = ANWPATH_CLASSES . "class_feed.php";
        $asClasses['AnwActionGlobal'] = ANWPATH_CLASSES . "class_actionglobal.php";
        $asClasses['AnwActionPage'] = ANWPATH_CLASSES . "class_actionpage.php";
        $asClasses['AnwActionMinimal'] = ANWPATH_CLASSES . "class_actionminimal.php";
        $asClasses['AnwChange'] = ANWPATH_CLASSES . "class_change.php";
        $asClasses['AnwLock'] = ANWPATH_CLASSES . "class_lock.php";
        $asClasses['AnWiki'] = ANWPATH_CLASSES . "class_anwiki.php";
        $asClasses['AnwDependancy'] = ANWPATH_CLASSES . "dependancy/class_dependancy.php";
        $asClasses['AnwDependancyConflict'] = ANWPATH_CLASSES . "dependancy/class_dependancy.php";
        $asClasses['AnwDependancyRequirement'] = ANWPATH_CLASSES . "dependancy/class_dependancy.php";
        $asClasses['AnwGoogleMap'] = ANWPATH_CLASSES . "external/google/maps/class_googlemap.php";
    }
    if (class_exists('AnwDebug')) {
        AnwDebug::log("***AUTOLOAD***: " . $sClassName);
    }
    /*if ($sClassName == "AnwContentClasses") {
    		try{
    			throw new Exception();
    		}
    		catch(Exception $e){
    		print_r($e->getTrace());
    		}
    	}*/
    if (isset($asClasses[$sClassName])) {
        loadApp($asClasses[$sClassName]);
    } else {
        //interface of contentclass
        $sPattern = '!AnwIContentFieldPage_([^_]*?)_(.*?)$!i';
        //ie: AnwIContentFieldPage_menu_menuSubItem belongs to "menu"
        if (preg_match($sPattern, $sClassName, $asMatches)) {
            $sContentClassName = $asMatches[1];
            //AnwContentClasses::loadContentClassInterface($sContentClassName);
            AnwUtils::loadContentClassInterfaceFaster($sContentClassName);
        } else {
            $sPattern = '!AnwIContentClassPageDefault_(.*?)$!i';
            //ie: AnwIContentClassPageDefault_menu belongs to "menu"
            if (preg_match($sPattern, $sClassName, $asMatches)) {
                $sContentClassName = $asMatches[1];
                //AnwContentClasses::loadContentClassInterface($sContentClassName);
                AnwUtils::loadContentClassInterfaceFaster($sContentClassName);
            } else {
                //contentclass: default
                $sPattern = '!AnwContentClassPageDefault_(.*)$!i';
                if (preg_match($sPattern, $sClassName, $asMatches)) {
                    $sContentClassName = $asMatches[1];
                    AnwContentClasses::loadContentClass($sContentClassName);
                } else {
                    //contentclass: override
                    $sPattern = '!AnwContentClassPageOverride_(.*)$!i';
                    if (preg_match($sPattern, $sClassName, $asMatches)) {
                        $sContentClassName = $asMatches[1];
                        AnwContentClasses::loadContentClass($sContentClassName);
                    } else {
                        $sPattern = '!AnwDatatype(.*)$!i';
                        if (preg_match($sPattern, $sClassName)) {
                            loadApp(ANWPATH_CLASSES . "class_datatype.php");
                        } else {
                            //__autoload is called for {AnwContentField, AnwContentMultiplicity...} althought we don't really need it
                            $sPattern = '!(AnwStructuredContentFieldsContainer|AnwContent|AnwContentPage|AnwSettingsContent|AnwContentClasses|AnwStructuredContent(.*)|AnwContentSettings)$!i';
                            if (preg_match($sPattern, $sClassName)) {
                                loadApp(ANWPATH_CLASSES . "contentclass/class_contentclasses.php");
                                loadApp(ANWPATH_CLASSES . "contentclass/class_contentclass.php");
                                loadApp(ANWPATH_CLASSES . "contentclass/class_content.php");
                                loadApp(ANWPATH_CLASSES . "contentclass/class_contentfield.php");
                                loadApp(ANWPATH_CLASSES . "contentclass/class_contentmultiplicity.php");
                            } else {
                                if (preg_match('!(AnwStructuredContentFieldsContainerPage|AnwContentClassPage)$!i', $sClassName)) {
                                    loadApp(ANWPATH_CLASSES . "contentclass/class_contentclass_page.php");
                                } else {
                                    if (preg_match('!(AnwStructuredContentFieldsContainerSettings|AnwContentClassSettings)$!i', $sClassName)) {
                                        loadApp(ANWPATH_CLASSES . "contentclass/class_contentclass_settings.php");
                                    } else {
                                        if (preg_match('!(AnwContentFieldPage(.*)|AnwContentFieldPage_(.*))$!i', $sClassName)) {
                                            loadApp(ANWPATH_CLASSES . "contentclass/class_contentfield_page.php");
                                        } else {
                                            if (preg_match('!(AnwContentFieldSettings(.*))$!i', $sClassName)) {
                                                loadApp(ANWPATH_CLASSES . "contentclass/class_contentfield_settings.php");
                                            } else {
                                                if (preg_match('!(AnwISettings_(.*))$!i', $sClassName)) {
                                                    loadApp(ANWPATH_CLASSES . "contentclass/class_contentfield_settings_interface.php");
                                                } else {
                                                    if (preg_match('!(AnwIPage_(.*))$!i', $sClassName)) {
                                                        loadApp(ANWPATH_CLASSES . "contentclass/class_contentfield_page_interface.php");
                                                    } else {
                                                        if (class_exists('AnwDebug')) {
                                                            AnwDebug::log('***AUTOLOAD*** failed');
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
 static function loadComponentInterface($sName)
 {
     $sFile = 'contentclass_' . $sName . '-interface.php';
     $sDir = self::getComponentDir($sName);
     try {
         list($sFileDefault, $bIsAddon) = AnwUtils::getFileDefault($sFile, $sDir);
         loadApp($sFileDefault);
     } catch (AnwFileNotFoundException $e) {
         //no interface found for this class
     }
 }
Example #7
0
function loadApp()
{
    // Loaded as a dependency
    if (file_exists(__DIR__ . '/../../../autoload.php')) {
        return require_once __DIR__ . '/../../../autoload.php';
    }
    // Loaded in the project itself
    if (file_exists(__DIR__ . '/../vendor/autoload.php')) {
        return require_once __DIR__ . '/../vendor/autoload.php';
    }
    // Loaded in the project itself, when vendor isn't installed
    if (file_exists(__DIR__ . '/../daux.phar')) {
        define('PHAR_DIR', __DIR__ . '/..');
        return require_once 'phar://' . __DIR__ . '/../daux.phar/vendor/autoload.php';
    }
    throw new Exception('Impossible to load Daux, missing vendor/ or daux.phar');
}
$loader = loadApp();
if ($loader) {
    $ext = __DIR__ . '/../daux';
    if (is_dir(getcwd() . "/daux")) {
        $ext = getcwd() . "/daux";
    }
    $env = getenv('DAUX_EXTENSION');
    if ($env && is_dir($env)) {
        $ext = $env;
    }
    define('DAUX_EXTENSION', $ext);
    $loader->setPsr4("Todaymade\\Daux\\Extension\\", $ext);
}
Author: Cyonite Systems
Author URI: http://cyonitesystems.com/
*/
//add_action('aoisora-loaded','register_CrushedDirectory');
if (!class_exists("AoiSora")) {
    if (is_admin()) {
        add_action('after_plugin_row_' . plugin_basename(__FILE__), 'after_cr_plugin_row', 10, 2);
        function after_cr_plugin_row($plugin_file, $plugin_data)
        {
            echo '<tr class="error" style=""><td colspan="3" class="" style=""><div class="" style="padding:3px 3px 3px 3px;font-weight:bold;font-size:8pt;border:solid 1px #CC0000;background-color:#FFEBE8">Crushed Directory requires <a style="color:blue;text-decoration:underline;" href="http://artofwp.com/aoisora">PHP MVC For WordPress (AoiSora)</a></div></td></tr>';
            //deactivate_plugins(plugin_basename(__FILE__));
        }
    }
    return;
}
loadApp(plugin_dir_path(__FILE__));
class CrushedDirectory extends WpApplicationBase
{
    function CrushedDirectory()
    {
        parent::WpApplicationBase('CrushedDirectory', __FILE__, false, false);
        add_shortcode('yourplugins', array(&$this, 'your_plugins_shortcode'));
        add_shortcode('plugin', array(&$this, 'plugin_file_shortcode'));
        add_shortcode('your_profile', array(&$this, 'your_profile_shortcode'));
        wp_register_style('crushed-directory', plugins_url('crushed-directory/css/style.css'));
        wp_enqueue_style('crushed-directory');
        add_action('init', array(&$this, 'on_init'));
    }
    function on_admin_menu()
    {
        add_menu_page('Overview', 'CrushedDir', 'activate_plugins', 'crusheddirectory', array($this, 'view_overview'));
Example #9
0
 static function loadContentClassInterfaceFaster($sName)
 {
     $sFile = 'contentclass_' . $sName . '-interface.php';
     $sDir = ANWDIR_CONTENTCLASSES . 'contentclass_' . $sName . '/';
     try {
         list($sFileDefault, $bIsAddon) = AnwUtils::getFileDefault($sFile, $sDir);
         loadApp($sFileDefault);
     } catch (AnwFileNotFoundException $e) {
         //no interface found for this class
     }
 }