| 1: | <?php |
| 2: | namespace Sphp\tools { |
| 3: | /** |
| 4: | * Description of FrontFile |
| 5: | * |
| 6: | * @author Sartaj Singh |
| 7: | */ |
| 8: | class FrontFile { |
| 9: | public $data = ""; |
| 10: | public $filePath = ""; |
| 11: | public $fileDir = ""; |
| 12: | public $mypath = ""; |
| 13: | public $myrespath = ""; |
| 14: | protected $compList = array(); |
| 15: | protected $extraCompList = array(); |
| 16: | public $name = ""; |
| 17: | public $backend_gate = null; |
| 18: | /** |
| 19: | * @var \Sphp\tools\BasicGate |
| 20: | */ |
| 21: | public $parentgate = null; |
| 22: | public $metadata = array(); |
| 23: | public $blncodebehind = false; |
| 24: | public $blncodefront = false; |
| 25: | public $blnshowFront = true; |
| 26: | public $backend_gate_dir_path = ""; |
| 27: | public $sjspath = ""; |
| 28: | public $registergate = ""; |
| 29: | public $gate_file_path = ""; |
| 30: | public $HTMLParser = null; |
| 31: | public $frontFileTag = ""; |
| 32: | public $frontFileTagE = ""; |
| 33: | public $prefixName = ""; |
| 34: | public $intPHPLevel = 1; |
| 35: | /** |
| 36: | * Advance Function |
| 37: | * Set File Path of FrontFile |
| 38: | * @param string $filePath |
| 39: | */ |
| 40: | /** |
| 41: | * Advance Function |
| 42: | * Bind with back-end type Gate or front-end type Gate. |
| 43: | * Remember BasicGate is front-end Gate type which |
| 44: | * can manage more then one front file or run without any front file like in case of API. |
| 45: | * Back-end Gate like WebGate always requires FrontFile |
| 46: | * for run. Like PSP Gate is a back-end Gate type. |
| 47: | * @param \Sphp\tools\WebGate $backend_gate |
| 48: | */ |
| 49: | /** |
| 50: | * Advance Function |
| 51: | * Set bound Gate file path |
| 52: | * @param string $backend_gate_dir_path |
| 53: | */ |
| 54: | /** |
| 55: | * Advance Function |
| 56: | * Set FrontFile can bind with back-end Gate type |
| 57: | * @param boolean $blncodebehind True mean, bound with back-end Gate |
| 58: | */ |
| 59: | /** |
| 60: | * Advance Function |
| 61: | * Set FrontFile can bind with front-end Gate type |
| 62: | * @param boolean $blncodebehind True mean, bound with back-end Gate |
| 63: | */ |
| 64: | /** |
| 65: | * Advance Function |
| 66: | * Set Parent Gate Name |
| 67: | * @param string $registergate |
| 68: | */ |
| 69: | /** |
| 70: | * Advance Function |
| 71: | * Add component object in FrontFile |
| 72: | * @param string $key component name or id in HTML code |
| 73: | * @param \Sphp\tools\Component $obj |
| 74: | */ |
| 75: | /** |
| 76: | * Advance Function |
| 77: | * Add component object in FrontFile as Reference. This reference Components are created |
| 78: | * in other Front File so you can just use as reference in Gate or in this Front File. This used in parent child |
| 79: | * Front Files. Front File can't process these Components. |
| 80: | * @param string $key component name or id in HTML code |
| 81: | * @param \Sphp\tools\Component $obj |
| 82: | */ |
| 83: | /** |
| 84: | * Add FrontFile as JS Variable to store the JS Objects of components. |
| 85: | * name of frontfile is used as variable name in JS |
| 86: | */ |
| 87: | public function addAsJSVar() {} |
| 88: | /** |
| 89: | * Advance Function |
| 90: | * Register FrontFile with SphpApi |
| 91: | */ |
| 92: | /** |
| 93: | * |
| 94: | * Advance Function |
| 95: | * @param string $FrontFilePath File path of FrontFile Or Direct code as string |
| 96: | * @param boolean $blnStringData Optional Default=false, If true then $FrontFilePath= string code |
| 97: | * @param \Sphp\tools\BasicGate $backfileobj Optional Default=null, bind Gate with FrontFile |
| 98: | * @param string $use_sjs_file Optional Default=false true mean use sjs file bind with front file |
| 99: | * @param \Sphp\tools\BasicGate $parentgateobj Optional Default=null, Parent Gate of FrontFile |
| 100: | */ |
| 101: | /** |
| 102: | * Advance Function |
| 103: | * Gate Event handler trigger by Gate. |
| 104: | */ |
| 105: | /** |
| 106: | * Advance Function |
| 107: | * Process FrontFile |
| 108: | * also run and render back-end Gate if any |
| 109: | */ |
| 110: | /** |
| 111: | * Advance Function |
| 112: | * echo FrontFile Front-End code |
| 113: | */ |
| 114: | public function render() {} |
| 115: | /** |
| 116: | * Advance Function |
| 117: | * get FrontFile Front-End code |
| 118: | * @return string HTML Output |
| 119: | */ |
| 120: | public function getOutput() {} |
| 121: | /** |
| 122: | * Advance Function |
| 123: | * get FrontFile Front-End code |
| 124: | * @return string HTML Output |
| 125: | */ |
| 126: | public function ProcessMe() {} |
| 127: | /** |
| 128: | * Advance Function |
| 129: | * Process FrontFile |
| 130: | */ |
| 131: | /** |
| 132: | * Advance Function |
| 133: | * echo FrontFile data |
| 134: | */ |
| 135: | public function renderit() {} |
| 136: | /** |
| 137: | * File Path of FrontFile |
| 138: | * @return string |
| 139: | */ |
| 140: | public function getFilePath() {} |
| 141: | /** |
| 142: | * Get Name(id) of front file |
| 143: | * @return string |
| 144: | */ |
| 145: | public function getName() {} |
| 146: | /** |
| 147: | * Get Parent Gate or Bind Gate with front file. It return bound Gate if FrontFile bound with Gate |
| 148: | * @return \Sphp\tools\BasicGate |
| 149: | */ |
| 150: | public function getBindGate() {} |
| 151: | /** |
| 152: | * Get Gate that is bound with front file |
| 153: | * @return \Sphp\tools\BackEndGate |
| 154: | */ |
| 155: | public function getBackEndGate() {} |
| 156: | /** |
| 157: | * Get Gate Path which is bound with this front file |
| 158: | * @return string |
| 159: | */ |
| 160: | public function getBackEndGateDirPath() {} |
| 161: | /** |
| 162: | * Get SJS File Path which is bound with this front file |
| 163: | * @return string |
| 164: | */ |
| 165: | public function getSjspath() {} |
| 166: | /** |
| 167: | * Get Parent Gate Name |
| 168: | * @return string |
| 169: | */ |
| 170: | public function getRegisterGate() {} |
| 171: | /** |
| 172: | * Disable PHP execution set $intPHPLevel=0, Default it is enable. |
| 173: | * PHP can only executed by a Custom Evaluator not by EVAL. So |
| 174: | * It can execute only few PHP syntax.PHP tags are not allowed. |
| 175: | * Only use Expression Tags for output ##{} and silent #{}# |
| 176: | * Enable php execution in front file. 0= no php execution, |
| 177: | * 1 = Allowed |
| 178: | */ |
| 179: | public function disablePHP($level=0) {} |
| 180: | /** |
| 181: | * Set SJS file path |
| 182: | * @param string $backend_gate_dir_path |
| 183: | */ |
| 184: | /** |
| 185: | * Enable rendering for front file |
| 186: | * @param boolean $blnshowFront |
| 187: | */ |
| 188: | public function setBlnshowFront($blnshowFront) {} |
| 189: | /** |
| 190: | * Check if FrontFile can render |
| 191: | * @return boolean |
| 192: | */ |
| 193: | public function getBlnshowFront() {} |
| 194: | /** |
| 195: | * Check if FrontFile is bound with any front-end Gate type |
| 196: | * @return boolean |
| 197: | */ |
| 198: | public function getBlncodefront() {} |
| 199: | /** |
| 200: | * Check if FrontFile is bound with any back-end Gate type |
| 201: | * @return boolean |
| 202: | */ |
| 203: | public function getBlncodebehind() {} |
| 204: | /** |
| 205: | * |
| 206: | * @param string $FrontFilePath File path of FrontFile Or Direct code as string |
| 207: | * @param boolean $blnStringData Optional Default=false, If true then $FrontFilePath= string code |
| 208: | * @param \Sphp\tools\BasicGate $backfileobj Optional Default=null, bind Gate with FrontFile |
| 209: | * @param \Sphp\tools\BasicGate $parentgateobj Optional Default=null, Parent Gate of FrontFile |
| 210: | * @param boolean $dhtml Optional Default=false, if true then use different frontlate engine |
| 211: | * @param string $prefixNameadd Optional Default='', prefix for component id |
| 212: | */ |
| 213: | /** |
| 214: | * Execute PHP code in Limited Container. Use only Template Tags ##{ }# or #{ }# |
| 215: | * @param string $strPHPCode PHP Template code |
| 216: | * @param \Sphp\tools\Component $compobj default null, Show debug information if Component |
| 217: | * run code |
| 218: | * @return string |
| 219: | */ |
| 220: | public function executePHPCode($strPHPCode,$compobj=null) {} |
| 221: | /** |
| 222: | * Add Meta Data attached to FrontFile. Only available after Parse Phase. |
| 223: | * @param string $key |
| 224: | * @param string|array $value |
| 225: | */ |
| 226: | public function addMetaData($key, $value) {} |
| 227: | /** |
| 228: | * Alias of addMetaData |
| 229: | * Add Meta Data attached to FrontFile. Only available after Parse Phase. |
| 230: | * @param string $key |
| 231: | * @param string|array $value |
| 232: | */ |
| 233: | public function addProp($key, $value) {} |
| 234: | /** |
| 235: | * Read Meta Data attached with FrontFile |
| 236: | * @param string $key |
| 237: | * @return string|array |
| 238: | */ |
| 239: | public function getMetaData($key) {} |
| 240: | /** |
| 241: | * Get Component Object |
| 242: | * @param string $name |
| 243: | * @return \Sphp\tools\Component |
| 244: | */ |
| 245: | /** |
| 246: | * Check if Component Exist in FrontFile |
| 247: | * @param string $key component name or id in HTML code |
| 248: | * @return boolean |
| 249: | */ |
| 250: | public function isComponent($key) {} |
| 251: | /** |
| 252: | * Get Component |
| 253: | * @param string $key component name or id in HTML code |
| 254: | * @return \Sphp\tools\Component |
| 255: | */ |
| 256: | public function getComponent($key) {} |
| 257: | /** |
| 258: | * Get Component if exist |
| 259: | * @param string $key component name or id in HTML code |
| 260: | * @return \Sphp\tools\Component|null |
| 261: | */ |
| 262: | public function getComponentSafe($key) {} |
| 263: | /** |
| 264: | * Get Children Components Only |
| 265: | * @return array |
| 266: | */ |
| 267: | public function getComponents() {} |
| 268: | /** |
| 269: | * Get All Children + References Components |
| 270: | * @return array |
| 271: | */ |
| 272: | public function getAllComponents() {} |
| 273: | /** |
| 274: | * Generate HTML for Component Object |
| 275: | * $frontobj = new Sphp\tools\FrontFile("Gates/forms/front1.front"); |
| 276: | * $div1 = $frontobj->getComponent('div1'); |
| 277: | * echo $frontobj->parseComponent($div1); |
| 278: | * @param \Sphp\tools\Component $obj |
| 279: | * @param boolean $innerHTML Optional Default=false, |
| 280: | * if true then it will not generate component tag in html |
| 281: | * @return string |
| 282: | */ |
| 283: | public function parseComponent($obj,$innerHTML = false) {} |
| 284: | /** |
| 285: | * Wrap All Children of Component as Node Object. |
| 286: | * $frontobj = new Sphp\tools\FrontFile("Gates/forms/front1.front"); |
| 287: | * $div1 = $frontobj->getComponent('div1'); |
| 288: | * $node1 = $frontobj->getChildrenWrapper($div1); |
| 289: | * echo $frontobj->parseComponentChildren($node1); |
| 290: | * @param \Sphp\tools\Component $obj |
| 291: | * @return Sphp\tools\NodeTag |
| 292: | */ |
| 293: | public function getChildrenWrapper($compobj) {} |
| 294: | /** |
| 295: | * Generate HTML for Component Children |
| 296: | * @param \Sphp\tools\NodeTag $obj |
| 297: | * @return string |
| 298: | */ |
| 299: | public function parseComponentChildren($obj) {} |
| 300: | } |
| 301: | /** |
| 302: | * Child Front File Share Components and meta data with parent as reference not a copy. So changes in child |
| 303: | * effect in parent also. |
| 304: | */ |
| 305: | class FrontFileChild extends FrontFile { |
| 306: | /** |
| 307: | * Advance Function |
| 308: | * Add component object in FrontFile |
| 309: | * @param string $key component name or id in HTML code |
| 310: | * @param \Sphp\tools\Component $obj |
| 311: | */ |
| 312: | } |
| 313: | class FrontFileComp extends FrontFile { |
| 314: | } |
| 315: | /** |
| 316: | * Description of FrontPlace |
| 317: | * Parent Class for create PHP Class as Front Place Object. |
| 318: | * Front Place is generate dynamic content in Master File and it can enable, disable by Master File. |
| 319: | * For Example you can generate a slider with PHP file rather then FrontFile. |
| 320: | */ |
| 321: | abstract class FrontPlace{ |
| 322: | abstract protected function _run(); |
| 323: | abstract protected function render(); |
| 324: | } |
| 325: | } |
| 326: |