Documentation

Markers

Table of Contents

Tina4/Api/Api.php 5
Tina4/Api/Swagger.php 6
Tina4/Core/Annotation.php 6
Tina4/Core/Cache.php 1
Tina4/Core/Config.php 1
Tina4/Core/Debug.php 1
Tina4/Core/Env.php 4
Tina4/Core/HTMLElement.php 5
Tina4/Core/Module.php 1
Tina4/Core/Test.php 14
Tina4/Core/Utility.php 13
Tina4/Database/Data.php 2
Tina4/Database/DataBase.php 1
Tina4/Database/DatabaseCore.php 2
Tina4/Database/DataError.php 1
Tina4/Database/DataField.php 1
Tina4/Database/DataFirebird.php 12
Tina4/Database/DataMongoDb.php 14
Tina4/Database/DataMySQL.php 12
Tina4/Database/DataRecord.php 2
Tina4/Database/DataResult.php 1
Tina4/Database/DataSQLite3.php 10
Tina4/Database/Migration.php 8
Tina4/Database/SQL.php 12
Tina4/Functions.php 5
Tina4/Initialize.php 18
Tina4/Messaging/Messenger.php 19
Tina4/Messaging/MessengerSettings.php 3
Tina4/ORM/ORM.php 44
Tina4/Routing/Any.php 1
Tina4/Routing/Caller.php 1
Tina4/Routing/Crud.php 19
Tina4/Routing/Delete.php 1
Tina4/Routing/Get.php 1
Tina4/Routing/ParseTemplate.php 11
Tina4/Routing/Patch.php 1
Tina4/Routing/Post.php 1
Tina4/Routing/Put.php 1
Tina4/Routing/Request.php 2
Tina4/Routing/Response.php 4
Tina4/Routing/Route.php 4
Tina4/Routing/RouteCore.php 1
Tina4/Routing/Router.php 54
Tina4/Routing/RouterResponse.php 1
Tina4/Security/Auth.php 9
Tina4/Service/Event.php 1
Tina4/Service/Process.php 3
Tina4/Service/ProcessInterface.php 1
Tina4/Service/Service.php 1
Tina4/Tina4Php.php 15

Api.php

Type Line Description
5 opensource.org/licenses/MIT
24 the-one-api.dev/v2", "Authorization: Bearer 123456") === null,"Could not initialize API"
69 execute the Curl request
70 Assign the response to a variable
73 If an error

Swagger.php

Type Line Description
5 opensource.org/licenses/MIT
45 ", "/", $this->subFolder.$route["routePath"]);
48 echo $method;
241 Get rid of request body if the example is empty
257 php.net/manual/en/jsonserializable.jsonserialize.php
TODO 15 This is a work in progress and may contain many gaps

Annotation.php

Type Line Description
5 opensource.org/licenses/MIT
60 clean *
112 Check if there are any tests on the Class itself.
122 Check for any tests on the methods
152 Get annotations for each function
157 Get annotations for each class and class method

Cache.php

Type Line Description
5 opensource.org/licenses/MIT

Config.php

Type Line Description
5 opensource.org/licenses/MIT

Debug.php

Type Line Description
5 opensource.org/licenses/MIT

Env.php

Type Line Description
5 opensource.org/licenses/MIT
60 Ignore blanks
63 Ignore [Sections] && Comments #
69 echo 'return (defined("'.$variables[1].'") ? '.$variables[1].' : "'.$variables[1].'");';

HTMLElement.php

Type Line Description
5 opensource.org/licenses/MIT
27 elements can be attributes or body parts
38 return $this;
78 Check what type of tag
146 Dynamic code for creating HTML Elements

Module.php

Type Line Description
5 opensource.org/licenses/MIT

Test.php

Type Line Description
5 opensource.org/licenses/MIT
85 check for enclosing method before the ()
113 Check if starts with bracket then we are calling the method
117 ("test") === true
122 add the enclosing method
141 Condition does not have form x === y or x !== y
239 Find all the functions and classes with annotated methods
240 Look for test annotations
248 Run the tests
252 Extracting which group the test belongs to.
258 Check if only a subset group or annotations are being requested.
260 Check if the group on the test declaration is the same as the requested group
264 No groups were appended to the test call
266 Include test unless a tina4 test is running in a tina4 Project

Utility.php

Type Line Description
5 opensource.org/licenses/MIT
136 Hacky fix for weird dates?
176 immediately return back binary if we can get an image size
230 paulund.co.uk/php-delete-directory-and-files-in-directory
236 GLOB_MARK adds a slash to directories returned
257 GLOB_MARK adds a slash to directories returned
283 ", "/", $url[0]);
332 img.icons8.com/metro/26/000000/folder-invoices.png"}\'>' . $fileName;
338 img.icons8.com/metro/26/000000/file.png"}\'>' . $fileName . '</li>';
360 Twig initialization
396 $_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]");
441 Add form Token
TODO 514 finish this implementation

Data.php

Type Line Description
5 opensource.org/licenses/MIT
55 Check if we have a database connection declared as global , add it to the data class

DataBase.php

Type Line Description
5 opensource.org/licenses/MIT

DatabaseCore.php

Type Line Description
5 opensource.org/licenses/MIT
30 Declare in the implementation

DataError.php

Type Line Description
5 opensource.org/licenses/MIT

DataField.php

Type Line Description
5 opensource.org/licenses/MIT

DataFirebird.php

Type Line Description
5 opensource.org/licenses/MIT
30 Set the returning format to something we can expect to transform
94 inject in the limits for the select - in Firebird select first x skip y
99 select first 10 skip 10 from table
114 Get the blob information
116 Get a handle to the blob
118 Get the blob contents
136 used for insert into or update
142 populate the fields
205 Firebird has commit off by default
227 table name must be in upper case
329 Go through the tables and extract their column information

DataMongoDb.php

Type Line Description
5 opensource.org/licenses/MIT
26 TODO: Implement close() method.
31 TODO: Implement exec() method.
36 TODO: Implement getLastId() method.
41 TODO: Implement tableExists() method.
46 TODO: Implement fetch() method.
51 TODO: Implement rollback() method.
56 TODO: Implement autoCommit() method.
61 TODO: Implement startTransaction() method.
66 TODO: Implement error() method.
71 TODO: Implement getDatabase() method.
76 TODO: Implement getDefaultDatabaseDateFormat() method.
81 TODO: Implement getDefaultDatabasePort() method.
86 TODO: Implement getQueryParam() method.

DataMySQL.php

Type Line Description
5 opensource.org/licenses/MIT
68 Should be b but does not work as expected
80 Fix for reference values https://stackoverflow.com/questions/16120822/mysqli-bind-param-expected-to-be-a-reference-value-given
84 We need the error here!
89 Execute a statement without params
92 We need the error here!
112 Don't add a limit if there is a limit already or if there is a stored procedure call
137 Check to prevent second call of procedure
161 populate the fields
165 $record = $records[0];
179 Ensures the pointer is at the end in order to close the connection - Might be a buggy fix
291 Go through the tables and extract their column information

DataRecord.php

Type Line Description
5 opensource.org/licenses/MIT
130 We have a field which is all uppercase

DataResult.php

Type Line Description
5 opensource.org/licenses/MIT

DataSQLite3.php

Type Line Description
5 opensource.org/licenses/MIT
24 create the new database or open existing one
25 prevent database locks
26 help with concurrency
130 populate the fields
160 No commit for sqlite
171 No transactions for sqlite
181 No transactions for sqlite
192 SQlite has no commits
209 Go through the tables and extract their column information

Migration.php

Type Line Description
5 opensource.org/licenses/MIT
55 Turn off auto commits so we can roll back
107 Get first 14 characters (length of migration id column)
109 Get the rest of the string
130 Re-attach left over migration text just in case of there being a '_' seperator
154 Update the migration with the latest copy
164 before exploding the content, see if it is a stored procedure, trigger or view.
197 we need to make sure the commit resulted in no errors

SQL.php

Type Line Description
5 opensource.org/licenses/MIT
35 Special variable pointing to an anonymous function which takes in a record for manipulation
47 See if we can db connection from global $DBA
109 @todo parse filter
123 @todo parse filter
142 @todo parse filter
175 @todo parse filter
291 run the query
299 transform the records into an array of the ORM if ORM exists
331 Only return what was requested
344 Apply a filter to the record
432 error_log (print_r ($this->error,1));

Functions.php

Type Line Description
5 opensource.org/licenses/MIT
76 Define URL to test from parsed string
79 Check if test URL contains a scheme (http or https) or if it contains a host name
81 Check if the current page uses an alias and if the parsed URL string is an absolute URL
83 Append the prefix to the absolute path

Initialize.php

Type Line Description
5 opensource.org/licenses/MIT
13 DEBUG & ERROR LOG CONSTANTS
24 TINA4 CONSTANTS
118 Initialize error handler
120 Initialize the ENV
141 twig globals are on by default
147 DEFINE EXPIRY FOR TOKENS
153 Initialize Secrets
162 Run the auto loader
258 Initialize the Error handling
259 We only want to fiddle with the defaults if we are developing
273 Add the .htaccess file for redirecting things & copy the default src structure
286 Copy the bin folder if the vendor one has changed
299 Add the icon file for making it look pretty
304 Initialize the Cache
306 On a rerun need to check if we have already instantiated the cache
308 Setup caching options
321 @todo Init Git Here

Messenger.php

Type Line Description
5 opensource.org/licenses/MIT
46 define the headers we want passed. Note that they are separated with \r\n
55 We are using twig so we need to render the message
93 Check if class exists
105 Server settings
107 Enable verbose debug output
109 Send using SMTP
110 Set the SMTP server to send through
111 Enable SMTP authentication
112 SMTP username
113 SMTP password
114 Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
115 TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above
124 Recipients
128 Add a recipient
135 Add a BCC recipient
144 Content
145 Set email format to HTML
188 ") === false) {

MessengerSettings.php

Type Line Description
5 opensource.org/licenses/MIT
18 bulksms.2way.co.za:5567/eapi/submission/send_sms/2/2.0";
25 off the templates or public folder

ORM.php

Type Line Description
5 opensource.org/licenses/MIT
21 Comma separated fields used for primary key
25 May be used to filter table records for quicker updating
29 Used to set the table name for an object that doesn't look like the table in question
35 Specify a database connection
158 Add to virtual and excluded fields anything that isn't in the object
167 map fields like first_name to firstName
308 use first field as primary if not specified
315 Now we need to add the foreign keys hasMany & hasOne
393 See if the record exists already using the primary key
397 See if we can get the fetch from the cached data
409 @todo this next piece needs to standardize the errors from the different database sources - perhaps with a getNoneError on the database abstraction
411 insert
414 update
421 Return can be a DataResult or a DataError. We need to pickup the difference
431 get last id
444 @todo test on other database engines (Firebird works)
495 Check to see if the table exists
502 Make a migration for it
507 $this->DBA->exec($sql);
530 @todo fix
580 form token is reserved
610 Create a new primary key because we are not using a generator or auto increment
657 form token is reserved
705 We ignore mapping because we want to use this to determine the virtual fields in the class
720 work out the virtual fields here from the load
770 See if we have exclude fields for parsing
887 Translate filter
926 See if we can get the fetch from the cached data
940 Get the first record
944 load up the has one
949 load up the has many
1065 Creates a variable on the ORM object of the same name as the ORM Object which is an array / result set of that object
1116 Return back a form to be submitted to the create
1131 Return a dataset to be consumed by the grid with a filter
1143 Manipulate the $object here
1146 return needed
1150 Manipulate the $object here
1153 return needed
1157 Manipulate the $object here
1160 return needed
1177 create a crud grid and form
1201 create the grid
1206 create the form

Any.php

Type Line Description
5 opensource.org/licenses/MIT

Caller.php

Type Line Description
5 opensource.org/licenses/MIT

Crud.php

Type Line Description
5 opensource.org/licenses/MIT
18 Common inputs, firstName,lastName,email,mobileNo,address1,address2,cityTown,postalCode,Country
148 What if the path has ids in it ? /store/{id}/{hash}
196 get the id on the last param
213 get the id on the last param
233 get the id on the last param
276 Add each searchable column to array
278 Split search phrase into individual searchable words
281 Iterate searchable words
283 Check that the values aren't whitespaces
286 Check if $filer is already an array
289 Check if filter value is already in $filer array
313 Check that filter isn't empty
317 Concatenate row columns into a single searchable string
319 Check for type of database
321 Mysql
329 Non-mysql
333 Create check statement per searched word
338 Glue each searchable phrase with "and" to ensure that it contains all searched words

Delete.php

Type Line Description
5 opensource.org/licenses/MIT

Get.php

Type Line Description
5 opensource.org/licenses/MIT

ParseTemplate.php

Type Line Description
5 opensource.org/licenses/MIT
49 set the working folder for the site
53 parse the file for objects and tags
66 Trim off the first char if /
70 find a file in the public or templates folder which matches the route given
86 @todo refactor
109 Render a twig file if the extension is twig
122 1 hour expiry time
231 basic - needs to be enhanced
233 check for strings
244 parse files

Patch.php

Type Line Description
5 opensource.org/licenses/MIT

Post.php

Type Line Description
5 opensource.org/licenses/MIT

Put.php

Type Line Description
5 opensource.org/licenses/MIT

Request.php

Type Line Description
5 opensource.org/licenses/MIT
45 pass raw request anyway

Response.php

Type Line Description
5 opensource.org/licenses/MIT
47 Try determine the content type
60 XML Serialize taken from Stack Overflow
61 https://stackoverflow.com/questions/137021/php-object-as-xml-document

Route.php

Type Line Description
5 opensource.org/licenses/MIT
33 ", "/", $url[0]);
47 These methods are used for mostly CRUD and dynamic routes not for code readability, the inline params are passed into the request
66 pipe is an or operator for the routing which will allow multiple routes for one anonymous function

RouteCore.php

Type Line Description
5 opensource.org/licenses/MIT

Router.php

Type Line Description
5 opensource.org/licenses/MIT
22 ";
52 Clean the URL
58 FIRST OPTIONS
64 SECOND STATIC FILES - ONLY GET
68 The most obvious request
78 Initialize only after statics, initialize the twig engine
86 THIRD ROUTING
95 LAST RESORT -> GO LOOKING IN TEMPLATES FOR FILE BY THE NAME
101 GO THROUGH ALL THE TEMPLATE INCLUDE LOCATIONS AND SEE IF WE CAN FIND SOMETHING
167 do it for any device that supports byte-ranges not only iPhone
173 1 hour expiry time
222 iterate through the routes
228 Look to see if we are a secure route
245 call closure with & without params
246 clear the auth
255 Check for the formToken request variable
259 clear the auth
263 clear the auth
270 check for an empty result
319 File size
320 Content length
321 Start byte
322 End byte
323 Now that we've gotten so far without errors we send the accept range header
326 www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.2
336 header('Accept-Ranges: bytes');
337 multipart/byteranges
338 http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.2
341 Extract the range string
343 Make sure the client hasn't sent us a multibyte range
346 (?) Should this be issued here, or should the first
347 range be used? Or should the header be ignored and
348 we output the whole content?
351 (?) Echo some info to the client?
354 If the range starts with an '-' we start from the beginning
355 If not, we forward the file pointer
356 And make sure to get the end byte if specified
358 The n-number of the last bytes is requested
367 www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
369 End bytes can not be larger than $end.
371 Validate the requested range and return an error if it's not correct.
376 (?) Echo some info to the client?
381 Calculate new content length
386 Notify the client the byte range we'll be outputting
390 Start buffered download
397 In case we're only outputtin a chunk, make sure we don't
398 read past the length
401 Reset time limit for big files
403 Free up memory. Otherwise large files will trigger PHP's memory limit.
450 The path was totally different from the route
471 input"));
473 Pull the inlineParams into the request by resetting the params
479 Check if header is JSON

RouterResponse.php

Type Line Description
5 opensource.org/licenses/MIT

Auth.php

Type Line Description
5 opensource.org/licenses/MIT
55 Check security
61 Load secrets
86 make sure the session is started
186 Handle token not trusted
190 Handle other validation exceptions
265 take care of expires if the user forgets to set it
311 Handle token not trusted
315 Handle other validation exceptions

Event.php

Type Line Description
5 opensource.org/licenses/MIT

Process.php

Type Line Description
5 opensource.org/licenses/MIT
36 TODO: Implement canRun() method.
44 TODO: Implement run() method.

ProcessInterface.php

Type Line Description
5 opensource.org/licenses/MIT

Service.php

Type Line Description
5 opensource.org/licenses/MIT

Tina4Php.php

Type Line Description
5 opensource.org/licenses/MIT
27 Get all the include folders
63 Modules have absolute paths
74 Modules have absolute paths
83 Check the configs for each module
94 Add built in Tina4 functions
173 try give back a response based on the error code - first templates then public
210 Migration routes
225 Some routes only are available with debugging
230 code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
231 cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ace.js" integrity="sha512-GZ1RIgZaSc8rnco/8CXfRdCpDxRCphenIiZ2ztLy3XQfCbQUSCuk8IudvNHxkRA3oUg6q0qejgN/qqyG1duv5Q==" crossorigin="anonymous"></script>
232 cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/mode-twig.min.js" integrity="sha512-ZtTfixyUItifC8wzQ1PwinttMP5W02H6zYeC/cAU+YPCA88vcrIUMI+fCk27yWN5k92zm32PWjpKYPYR/npZzg==" crossorigin="anonymous"></script>
233 cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/theme-monokai.min.js" integrity="sha512-S4i/WUGRs22+8rjUVu4kBjfNuBNp8GVsgcK2lbaFdws4q6TF3Nd00LxqnHhuxS9iVDfNcUh0h6OxFUMP5DBD+g==" crossorigin="anonymous"></script>
234 cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/theme-sqlserver.min.js" integrity="sha512-TkNvDZzCp+GGiwfXNAOxt6JDzuELz8qquDcZrUzPXuKRvOcUA6kSZu2/uPhKbbjqeJIjoevYn10yrt8TS+qUXQ==" crossorigin="anonymous"></script>
291 Test for SCSS and existing default.css, only compile if it does not exist

Search results