Overview

Classes

  • Api1
  • Array1
  • ArrayObject1
  • Auth1
  • AuthModel1
  • Chat1
  • Class1
  • Color1
  • Console1
  • Controller1
  • Converter1
  • Cookie1
  • Date1
  • DateManager1
  • Db1
  • DbPref1
  • EasyBook
  • EasyCountry
  • EasyGenerator
  • EasyProduct
  • EasyProject
  • EasySchool
  • EasyStatus
  • exApiController1
  • exBlade1
  • exClass
  • exData1
  • exMail1
  • exRoute1
  • exTranslate1
  • exUrl1
  • FileManager1
  • FilePref1
  • Form1
  • Function1
  • Header1
  • Html1
  • HtmlAsset1
  • HtmlForm1
  • HtmlStyle1
  • HtmlWidget1
  • Math1
  • Model1
  • Model1FileLocator
  • Number1
  • Object1
  • Page1
  • Picture1
  • Popup1
  • QUESTION_TYPE
  • RecursiveArrayObject1
  • RegEx1
  • ResultObject1
  • ResultStatus1
  • ServerRequest1
  • Session1
  • SessionPreferenceSave1
  • String1
  • TaskManager1
  • Url1
  • Validation1
  • Value1

Interfaces

  • Controller1RouteInterface
  • Model1ActionInterface
  • Model1PageInterface

Functions

  • __
  • api_and_form_default_route
  • app
  • app_api_list
  • app_class_list
  • app_class_paths
  • app_class_with_interface
  • app_controller_list
  • app_dashboard_list
  • app_db_model_list
  • app_db_table_list
  • app_model_list
  • app_page_list
  • asset
  • csrf_token
  • current_layout_asset
  • current_plugin_asset
  • current_resources_asset_path
  • d
  • dd
  • file_base
  • file_session
  • file_session_get
  • file_session_remove
  • file_session_save
  • form_call_api
  • form_call_controller
  • form_token
  • get_all_view_in_directory
  • get_valid_view_path
  • is_token_valid
  • is_ajax_request
  • layout_asset
  • mailer
  • mailer_send_mail_to_list
  • make_default_route
  • makeRoute
  • normalizeSharedPath
  • now
  • now_date
  • now_time
  • old
  • paginate
  • path_app
  • path_asset
  • path_asset_url
  • path_clear_cache
  • path_main
  • path_main_url
  • path_shared
  • path_shared_app
  • path_shared_asset
  • path_shared_asset_url
  • path_shared_resources
  • path_to_viewpath
  • plugin_asset
  • pre
  • redirect
  • redirect_back
  • redirect_failed
  • redirect_to_view
  • register_path_for_layout_asset
  • request
  • resources_path
  • resources_path_asset
  • resources_path_cache
  • resources_path_plugin
  • resources_path_view
  • resources_path_view_cache
  • resources_path_view_layout
  • route
  • routes
  • shared_asset
  • token
  • translate_language
  • translated_language
  • url
  • view
  • view_exists
  • view_make
  • viewpath_to_path
  • Overview
  • Class
  1:   2:   3:   4:   5:   6:   7:   8:   9:  10:  11:  12:  13:  14:  15:  16:  17:  18:  19:  20:  21:  22:  23:  24:  25:  26:  27:  28:  29:  30:  31:  32:  33:  34:  35:  36:  37:  38:  39:  40:  41:  42:  43:  44:  45:  46:  47:  48:  49:  50:  51:  52:  53:  54:  55:  56:  57:  58:  59:  60:  61:  62:  63:  64:  65:  66:  67:  68:  69:  70:  71:  72:  73:  74:  75:  76:  77:  78:  79:  80:  81:  82:  83:  84:  85:  86:  87:  88:  89:  90:  91:  92:  93:  94:  95:  96:  97:  98:  99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: 259: 260: 261: 262: 263: 264: 265: 266: 267: 268: 269: 270: 271: 272: 273: 274: 275: 276: 277: 278: 279: 280: 281: 282: 283: 284: 285: 286: 287: 288: 289: 290: 291: 292: 293: 294: 295: 296: 297: 298: 299: 300: 301: 302: 303: 304: 305: 306: 307: 308: 309: 310: 311: 312: 313: 314: 315: 316: 317: 318: 319: 320: 321: 322: 323: 324: 325: 326: 327: 328: 329: 330: 331: 332: 333: 334: 335: 336: 337: 338: 339: 340: 341: 342: 343: 344: 345: 346: 347: 348: 349: 350: 351: 352: 353: 354: 355: 356: 357: 358: 359: 360: 361: 362: 363: 364: 365: 366: 367: 368: 369: 370: 371: 372: 373: 374: 375: 376: 377: 378: 379: 380: 381: 382: 383: 384: 385: 386: 387: 388: 389: 390: 391: 392: 393: 394: 395: 396: 397: 398: 399: 400: 401: 402: 403: 404: 405: 406: 407: 408: 409: 410: 411: 412: 413: 414: 415: 416: 417: 418: 419: 420: 421: 422: 423: 424: 425: 426: 427: 428: 429: 430: 431: 432: 433: 434: 435: 436: 437: 438: 439: 440: 441: 442: 443: 444: 445: 446: 447: 448: 449: 450: 451: 452: 453: 454: 455: 456: 457: 458: 459: 460: 461: 462: 463: 464: 465: 466: 467: 468: 469: 470: 471: 472: 473: 474: 475: 476: 477: 478: 479: 480: 481: 482: 483: 484: 485: 486: 487: 488: 489: 490: 491: 
<?php
/**
 * Created by PhpStorm.
 * User: samtax
 * Date: 08/07/2018
 * Time: 11:00 AM
 */


class exClass{
    /**
     * @param bool $removePage
     * @return array
     */
    static function appModelList($removePage = true){        return app_model_list($removePage); }

    /**
     * @return array
     */
    static function appControllerList(){   return app_controller_list(); }

    /**
     * @return array
     */
    static function appApiList(){          return app_api_list(); }

    /**
     * @return array
     */
    static function appPageList(){         return app_page_list(); }

    /**
     * @return array
     */
    static function appDashboardList(){    return app_dashboard_list(); }
}

class exBlade1 {
    // View
    static $LOADED_VIEW_AND_CACHE_LIST = [];
    static $CURRENT_LAYOUT_PATH = null; // editted in Blade->Compiler.php or Factory.php

    /**
     * return active theme path
     * @see /Applications/MAMP/htdocs/Project-Ehex/includes/__PhpLibrary/blade-5.4/src/Compilers/Concerns/CompilesLayouts.php
     */
    static function getLoadedViewAndCachedPath(){  return self::$LOADED_VIEW_AND_CACHE_LIST; }

    /**
     * get Compiled View
     * @param $view_name
     * @param array $param
     * @return string
     * @throws Throwable
     */
    static function getCompiledView($view_name, $param = []){  return view_make($view_name, $param); }

    /**
     * Show and Render Compiled View
     * @param $view_name
     * @param array $param
     */
    static function renderView($view_name, $param = []){  view($view_name, $param); }

    /**
     * Convert a normal file Path to View (. including view path), Used when you are getting all view and you needs to convert them to real view path for route to access
     * @see get_all_view_in_directory()
     * @see exBlade1::getAllViewInDirectory()
     * @see exBlade1::convertViewPathToPath()
     * @param $fileFullPath
     * @return mixed
     */
    static function convertPathToViewPath($fileFullPath){  return path_to_viewpath($fileFullPath); }

    /**
     * Opposite of path_to_viewpath() convert view to it equal file system path
     * @see exBlade1::convertPathToViewPath()
     * @param $viewPath
     * @return string
     */
    static function convertViewPathToPath($viewPath){  return viewpath_to_path($viewPath); }

    /**
     * Used to list all view in certain directory
     * @param $fileFullPath
     * @param bool $viewNameOnly
     * @param bool $recursive
     * @return array|null
     */
    static function getAllViewInDirectory($fileFullPath, $viewNameOnly = false, $recursive = false){  return get_all_view_in_directory($fileFullPath, $viewNameOnly, $recursive); }
}







class exUrl1 extends Url1 {


    /**
     * Get any sent request like $_GET, $_POST and $_FILES... Also all value are being normalized.
     * Checkbox value are set to either true of false, and files are well arrange, in Parameter, Set the Names
     * @param array $insertOrReplaceKeyValue :override any request data or add new one to it
     * @param array $filterCheckBoxNameList : convert boolean on and off to php boolean true and false
     * @param array $filterFileUploadNameList ; normalize file name very well, use in Ehex Sample blog
     * @return mixed
     */
    static function request(array $insertOrReplaceKeyValue = [], array $filterCheckBoxNameList = [], array $filterFileUploadNameList = []){ return request($insertOrReplaceKeyValue, $filterCheckBoxNameList, $filterFileUploadNameList); }


    /**
     * Create Route
     * @param $name
     * @param $function\
     */
    static function makeRoute($name, $function){ makeRoute($name, $function); }

    /**
     * Return all Menu, can be accessed through routes()->login
     * @param array $except
     * @param bool $listAsMenu
     * @param array $renameLinkName_oldName_equals_newName
     * @return ArrayObject|mixed
     */
    static function routes($except = [], $listAsMenu = false, $renameLinkName_oldName_equals_newName = []){ return routes($except, $listAsMenu, $renameLinkName_oldName_equals_newName); }

    /**
     * @param null $path
     * @return string
     */
    static function url($path = null){ return url($path); }

    /**
     * @param $viewPageName
     * @param array $param
     * @param bool $actionResult
     * @param array $trueMessage
     * @param array $falseMessage
     * @return string
     */
    static function redirectToView($viewPageName, array $param = [], $actionResult = false, $trueMessage = [], $falseMessage = []){ return redirect_to_view($viewPageName, $param, $actionResult, $trueMessage, $falseMessage); }

    /**
     * Navigate to any menu
     * @param $name
     * @param array $param_data
     * @return Route|RouteSystem|string
     */
    static function route($name, $param_data = []){ return route($name, $param_data); }

    /**
     * @return RouteRequest
     */
    static function getCurrentRoute(){ return RouteRequest::instance(); }

    /**
     * @param $inputVariable
     * @param $default
     * @return mixed|string
     */
    static function old($inputVariable, $default){ return old($inputVariable, $default); }

    /**
     * @param $view_name
     * @param array $param
     */
    static function view($view_name, $param = []){  view($view_name, $param); }


    /**
     * delete all cache
     */
    static function pathClearCache(){ path_clear_cache(); }

    /**
     * Get Assets files
     * @param string $path
     * @param bool $findInSharedAssets
     * @return string
     */
    static function asset($path = '', $findInSharedAssets = false){ return asset($path, $findInSharedAssets); }

    /**
     * Add to Every Template to Register Template/assets folder for layout_assets(...) method use.
     * @return string
     */
    static function registerPathForLayoutAsset($optional_layoutViewPath_or_layoutFullPath = null, $backtrace_index = 0){ return register_path_for_layout_asset(null, 1); }

    /**
     * Locate Layout assets path automatically with the help of passed in exUrl1::registerPathForLayoutAsset()
     * @see exUrl1::registerPathForLayoutAsset()
     * @param string $filename
     * @param null $layout_name
     * @param string $assets_folder_name
     * @return string
     *
     */
    static function layoutAsset($filename = '', $layout_name = null, $assets_folder_name = 'assets'){ return layout_asset($filename, $layout_name, $assets_folder_name); }

    /**
     * Use in your layout  to get current location of layout assets
     * @see current_layout_asset()
     * @param string $file_path_name
     * @param string $assets_folder_name
     * @return mixed
     *
     */
    static function currentLayoutAsset($file_path_name = '', $assets_folder_name = 'assets'){  return current_resources_asset_path($file_path_name, $assets_folder_name, '/resources/views/layouts/',  '/shared/resources/views/',  'layout_list', 1); }

    /**
     * Use in your plugin to get current location of plugin assets
     * @see current_plugin_asset()
     * @param string $file_path_name
     * @param string $assets_folder_name
     * @return mixed
     *
     */
    static function currentPluginAsset($file_path_name = '', $assets_folder_name = 'assets'){  return current_resources_asset_path($file_path_name, $assets_folder_name, '/resources/plugins/', '/shared/resources/plugins/', 'plugin_list', 1); }

    /**
     * Get APp Path
     * @param string $path
     * @return string
     */
    static function pathApp($path = ''){ return path_app($path); }

    /**
     * Main Project DIrectory
     * @param string $path
     * @return string
     */
    static function pathMain($path = ''){ return path_main($path); }

    /**
     * @param string $path
     * @return string
     */
    static function pathAsset($path = ''){ return path_asset($path); }

    /**
     * @param string $path
     * @param bool $findInSharedAssets
     * @return string
     */
    static function pathAssetUrl($path = '', $findInSharedAssets = false){ return path_asset_url($path, $findInSharedAssets); }

    /**
     * @param string $path
     * @return string
     */
    static function pathMainUrl($path = ''){ return path_main_url($path); }


    /**
     * shared path
     * @param string $path
     * @param string $directory
     * @return string
     */
    static function pathShared($path = '', $directory = ''){ return path_shared($path, $directory); }

    /**
     * @param string $path
     * @return string
     */
    static function pathSharedResources($path = ''){ return path_shared_resources($path); }


    /**
     * @param string $path
     * @return string
     */
    static function pathSharedApp($path = ''){ return path_shared_app($path); }

    /**
     * @param string $path
     * @return string
     */
    static function pathSharedAssetUrl($path = ''){ return path_shared_asset_url($path); }


    // resource path
    static function resourcesPath() { return resources_path(); }

    /**
     * @return string
     */
    static function resourcesPathView() { return resources_path_view(); }

    /**
     * @return string
     */
    static function resourcesPathCache() { return resources_path_cache(); }

    /**
     * @return string
     */
    static function resourcesPathAsset() { return resources_path_asset(); }

    /**
     * @param string $isShared
     * @return string
     */
    static function resourcesPathPlugin($isShared = ''){ return resources_path_plugin($isShared); }

   /**
     * @param string $isShared
     * @return string
     */
    static function resourcesPathViewLayout($isShared = ''){ return resources_path_view_layout($isShared); }


    /**
     * get all model path
     * @return array
     */
    static function appClassPaths(){ return app_class_paths(); }

    /**
     * get all list of class type in app
     * @param array $typeList
     * @return array
     */
    static function appClassList($typeList = [Model1::class, Controller1::class, Api1::class]){ return app_class_list($typeList); }


    /**
     * @param $path
     * @return mixed
     *  convert PATH: /application/htdoc/project/image.jpg
     *      to  URL: http://mysite.com/image.jpg
     */
    static function convertPathToUrl($path){ return String1::replaceStart($path, path_main(), path_main_url()); }

    /**
     *  convert URL: http://mysite.com/image.jpg
     *      to  PATH: /application/htdoc/project/image.jpg
     * @param $url
     * @return mixed
     */
    static function convertUrlToPath($url){ return String1::replaceStart($url, path_main_url(), path_main()); }
}

class exRoute1{
    /**
     * @return exRoute1|RouteSystem
     */
    static function getRoute(){ return route(); }
    static function any($name, $action){ return route()->any($name, $action); }
    static function get($name, $action){  return route()->get($name, $action); }
    static function post($name, $action){  return route()->post($name, $action); }
    static function view($name, $viewName){ return route()->view($name, $viewName); }
    static function fixed($arrayList = ['error404'=>'pages.common.error404', 'maintenance'=>'layouts.coming_soon.index']){ return route()->fixed($arrayList); }

    /**
     * Use Model Controller To Fill Route Name Automatically, Your class must implement Controller1RouteInterface
     *  modelName/,   modelName/{id},   modelName/search/{name},   modelName/create,  modelName/{id}/edit, e.t.c
     * @param $name
     * @param string $controllerOrModelClassName
     * @param array $option
     * @return \Illuminate\Routing\PendingResourceRegistration|string
     */
    static function resource($name, $controllerOrModelClassName = '', array $option = []){ return route()->resource($name,  $controllerOrModelClassName, $option); }

    /**
     * Convert all View in Directory to Route. Using the view name as route name
     * @param $viewPath_or_fullPath (path of view e.g pages.auth)
     * @param bool $recursive (allow deep convert)
     */
    static function directory($viewPath_or_fullPath, $recursive = false){  route()->directory($viewPath_or_fullPath, $recursive); }

    /**
     * Get Route Information
     * @see exUrl1::getCurrentRoute() for current route information
     * @return Route|RouteSystem|string
     */
    static function getRoutes(){ return route(); }

    /**
     * Is Certain Route name Exists
     * @param $route
     * @return false|int
     */
    static function isExists($route){ return route()->isExists($route); }
}




class exData1 {

    /**
     * Output
     * @param $records
     * @param int $perPage
     * @param bool $asInfiniteLoad
     * @param array $infiniteLoadConfig
     * @return Paginator|\Strana\RecordSet
     */
    static function paginate($records, $perPage = 10, $asInfiniteLoad = false, $infiniteLoadConfig = []){ return paginate($records, $perPage, $asInfiniteLoad, $infiniteLoadConfig); }

}


class exTranslate1{
    // Translate Language
    static function translateLanguage($languageText_or_translateKey, $toLanguage = 'auto', $fromLanguage = 'en'){ return translate_language($languageText_or_translateKey, $toLanguage, $fromLanguage); }
    static function translatedLanguage($selectedLanguage = 'auto', $fromLanguage = 'en'){ return translated_language($selectedLanguage, $fromLanguage); }
}


class exMail1{
    /**
     * Get View From Template
     * @param string $view_name
     * @param array $param
     * @return string
     * @throws Throwable
     */
    static function getTemplate($view_name = 'emails.welcome', $param = ['userName'=>'Samson Iyanu', 'password'=>'12345']){ return view_make($view_name, $param);  }

    /**
     * @param null $path
     * @return Mailer|\PHPMailer\PHPMailer\PHPMailer
     */
    static function mailer($path = null){ return mailer($path); }

    /**
     * @param array $toUserEmail_and_UserName_keyValue
     * @param $subject
     * @param $htmlMessageContent
     * @param null $attachmentPath
     * @param null $fromEmail
     * @param null $fromUserName
     * @param bool $exception
     * @return ResultStatus1
     */
    static function mailerSendMailToList($toUserEmail_and_UserName_keyValue = [], $subject, $htmlMessageContent, $attachmentPath = null, $fromEmail = null, $fromUserName = null, $exception = false){ return mailer_send_mail_to_list($toUserEmail_and_UserName_keyValue, $subject, $htmlMessageContent, $attachmentPath, $fromEmail, $fromUserName, $exception); }

    /**
     * @param $emailName
     * @return string
     */
    static function fakeMailAddress_fromSiteAddress($emailName){ return $emailName.'@'.explode('//', Url1::getSiteMainAddress())[1]; }
}









/**
 * Class exApiController1
 *  Inbuilt Secured Api caller. because it is using controller1, therefore, it cannot be accessed from outside the app.
 *  Because token is always required.
 */
class exApiController1 extends Controller1{

    /**
     * Auto delete Controller used in deleting model assets. HtmlWidget1::fileDeleteBox()
     * Required :
     *      file_locator_id=$model1FileLocatorId
     *      file_path=/public_html/image.png
     * @return bool
     */
    static function deleteFile(){
        $result = (isset($_REQUEST['file_locator_id']) && $_REQUEST['file_locator_id'] > 0)? Model1FileLocator::delete_fromDb_byFieldName($_REQUEST['file_locator_id'], 'id'): true;
        return  FileManager1::delete(urldecode($_REQUEST['file_path'])) || $result;
    }

    /**
     * could be used to refresh used Model1FileLocator on the go like in exDropZone Plugins
     * Required  model_name, model_id
     * @return bool
     */
    static function fileLocatorReSaveLocalFilesToDb(){ return !!(Model1FileLocator::insertAll_fromFile_toDb( $_REQUEST['model_name']::withId($_REQUEST['model_id']) )); }

    /**
     * could be used to delete all Model1FileLocator image for model on the go like in exDropZone Plugins
     * @return bool
     */
    static function fileLocatorDeleteAllFiles(){ return !!(Model1FileLocator::deleteAll( $_REQUEST['model_name']::withId($_REQUEST['model_id']) )); }



}
API documentation generated by ApiGen