/ // +-- app-defs/ // +-- this-app.app/ <-- $app_defs_dir // +-- plugin.stuff/ // +-- custom.pages/ // +-- this-custom-page.cp/ // | +-- page-display-file.php // | +-- page-data.php // | +-- ...other custom page files... // +-- that-custom-page.cp/ // | +-- page-display-file.php // | +-- page-data.php // | +-- ...other custom page files... // +-- ... // +-- the-other-custom-page.cp/ // +-- page-display-file.php // +-- page-data.php // +-- ...other custom page files... // // ------------------------------------------------------------------------- // ------------------------------------------------------------------------- // Here we should have (eg):- // // $core_plugapp_dirs = array( // 'plugin_root_dir' => "xxx" , // 'plugins_includes_dir' => "xxx" , // 'plugins_app_defs_dir' => "xxx" , // 'dataset_manager_includes_dir' => "xxx" , // 'apps_dot_app_dir' => "xxx" , // 'apps_plugin_stuff_dir' => "xxx" // 'custom_pages_dir' => "xxx" // ) // // ------------------------------------------------------------------------- // ========================================================================= // Init. // ========================================================================= $ns = __NAMESPACE__ ; $fn = __FUNCTION__ ; // ========================================================================= // Get the target application's:- // "custom_pages" // // dir. // ========================================================================= $target_apps_custom_pages_dir = $app_defs_dir . '/plugin.stuff/custom.pages' ; // ========================================================================= // ANY CUSTOM PAGES ? // ========================================================================= if ( ! is_dir( $target_apps_custom_pages_dir ) ) { return array() ; } // ========================================================================= // Load the DIRS/FILES in the plugin's "CUSTOM PAGES" dir... // ========================================================================= require_once( $core_plugapp_dirs['plugins_includes_dir'] . '/scandir.php' ) ; // ----------------------------------------------------------------------- // \greatKiwi_byFernTec_adSwapper_local_v0x1x210_dirsFiles\ // super_scandir( // $target_directory // ) // - - - - - - - - - - -- // Returns an array of the file and directory basenames from the // specified directory. // // Works in PHP 4 and above. // // PARAMETERS // $target_directory // The directory that will be scanned. // // RETURN VALUES // Returns the following array on success, or FALSE on failure. // // array( // 'dirs' => array( // [dir_FDE0] => 'dir_filespec0' , // [dir_FDE1] => 'dir_filespec1' , // [dir_FDE2] => 'dir_filespec2' , // ... ... // [dir_FDEn] => 'dir_filespecN' // ) // 'files' => array( // [file_FDE0] => 'file_filespec0' , // [file_FDE1] => 'file_filespec1' , // [file_FDE2] => 'file_filespec2' , // ... ... // [file_FDEn] => 'file_filespecN' // ) // 'other' => array( // [other_FDE0] => 'other_filespec0' , // [other_FDE1] => 'other_filespec1' , // [other_FDE2] => 'other_filespec2' , // ... ... // [other_FDEn] => 'other_filespecN' // ) // ) // // If directory is not a directory, then boolean FALSE is returned, // and an error of level E_WARNING is generated. // ----------------------------------------------------------------------- $dirs_and_files = \greatKiwi_byFernTec_adSwapper_local_v0x1x210_dirsFiles\super_scandir( $target_apps_custom_pages_dir ) ; // ----------------------------------------------------------------------- if ( $dirs_and_files === FALSE ) { return <</ // +-- this-custom-page.cp/ // | +-- page-display-file.php // | +-- page-data.php // | +-- ...other custom page files... // +-- that-custom-page.cp/ // | +-- page-display-file.php // | +-- page-data.php // | +-- ...other custom page files... // +-- ... // +-- the-other-custom-page.cp/ // +-- page-display-file.php // +-- page-data.php // +-- ...other custom page files... // // ------------------------------------------------------------------------- // ========================================================================= // LOAD the CUSTOM PAGES... // ========================================================================= $custom_pages = array() ; // ------------------------------------------------------------------------- foreach ( $dirs_and_files['dirs'] as $dir_basename => $dir_pathspec ) { // ===================================================================== // Is this dir a "CUSTOM PAGE" dir ? // ===================================================================== // --------------------------------------------------------------------- // Only dirs whose basename:- // // 1. Ends in ".cp" // // 2. Is otherwise lowercase alphnumeric and dash only (and // at least 1 char long) // // are custom page dirs.... // --------------------------------------------------------------------- if ( strlen( $dir_basename ) < 4 || substr( $dir_basename , -3 ) !== '.cp' ) { continue ; // Skip this dir... } // ===================================================================== // PROBABLY a "CUSTOM PAGE" DIR (if the custom page name/slug is OK)... // ===================================================================== $custom_page_name_slash_slug = substr( $dir_basename , 0 , -3 ) ; // --------------------------------------------------------------------- if ( ! \greatKiwi_byFernTec_adSwapper_local_v0x1x210_stringUtils\ctype_alphanumeric_dash( $custom_page_name_slash_slug ) || strtolower( $custom_page_name_slash_slug ) !== $custom_page_name_slash_slug ) { return << $menu_title , 'general_title' => $general_title , 'dirspec' => $dir_pathspec , 'page_display_filespec' => $page_display_filespec , 'page_data_filespec' => $page_data_filespec , 'page_data' => $page_data ) ; // ===================================================================== // Repeat with the next "CUSTOM PAGES" sub-directory (if there is // one)... // ===================================================================== } // ========================================================================= // SUCCESS! // ========================================================================= return $custom_pages ; // ========================================================================= // That's that! // ========================================================================= } // ============================================================================= // That's that! // =============================================================================