Functions
These functions are helpers that do not directly affect Zaroc; they just help us achieve certain results efficiently.
Feel free (just in Functions) to add, edit, or delete functions as you wish.
Date
getAge
- Put Date time in quotes and in DD-MM-YYYY
- PHP
$datetime;
$age = getAge($datetime);
getDay
- Receives a Date, retrieves the day number of the month
- PHP
$currentDate;
$today = getDay($currentDate);
getFormatDate
- Receives a Date, a format in string format and outputs that Date in the specified format.
- PHP
$date;
$formatedDate = getFormatDate($date,'d-m-Y');
addDaysWithDate
- Receives a number of Days, the specified date, returns the date plus the days added.
- PHP
$date;
$days = 3;
$newDate = addDaysWithDate($date,$days);
addDaysWithDateSpanish
- Does the same that the function listed before, just changes the format.
- PHP
$date;
$days = 3;
$newDate = addDaysWithDateSpanish($date,$days);
getSpanishDays
- Receives a Date and returns a day in String and Spanish Language.
- PHP
$date;
$dia = getSpanishDays($date);
getNextDays
- Receives a number of days, returns the current day plus the number of days.
- PHP
$number = 5;
$newDay = getNextDays($number);
getNextMonths
- Receives a number of months, returns the current month plus the number of days.
- PHP
$number;
$newMonth = getNextMonths($number);
getNextTimes
- Receives a number of days, returns the current date plus the number of days.
- PHP
$number = 4;
$newDate = getNextTimes($number);
getCompositeTime
- Receives a Day and returns in a specific format.
- PHP
$day;
$newtime = getCompositeTime($day);
changeDateOrder
- String Example $3-$2-$1 to DD-MM-YYYY
- PHP
$originalDate;
$order = 'DD-MM-YYYY';
$newDate = changeDateOrder($originalDate,$order);
getIntegerNextDays
- Returns a single day with plus numbers of days added
- PHP
$number = 4;
$newDay = getIntegerNextDays($number);
getSpanishNextDays
- Returns a complete format of Spanish Date
- PHP
$number = 5;
$newDate = getSpanishNextDays($number);
getSpanishCompositeTime
- Get composite Time in Spanish
- PHP
$day;
$newDate = getSpanishCompositeTime($day);
tsToDateTime
- Converts TS format to a Y-m-d H:i A format
- PHP
$ts;
$dateTime = tsToDateTime($ts)
Text
id
- Returns a little Random ID
- PHP
$id = id();
id2
- Returns a stronger Random ID
- PHP
$id = id2();
createSpan
- Help us to create a Span, this span works adding Styles to text on webBlocks
- PHP
$text = array("Title");
$properties = array("style='color:red';");
$span = createSpan($text,$properties);
endsWith
- Checks if a String ends with an specific Letter
- PHP
$result = endsWith($haystack, $needle);
startsWith
- Checks if a String starts with specific string
- PHP
$string = "hello world";
$startString = "he";
$result = startsWith ($string, $startString);
reduce
- Removes blank spaces
- PHP
$text = "Hey There how are you ";
$newText = reduce($text);
lower
- Changes to lowerCase
- PHP
$text = "HEy THERE";
$newText = lower($text);
reduceLower
- Chantes to lowerCase and removes blank spaces
- PHP
$text = "HEy THERE";
$newText = reduceLower($text);
titleAdjust
- Removes blank spaces and changes to uppercase
- PHP
$text = "HEy THERE";
$title = titleAdjust($text);
whatsAppLink
- Creates a WhatsAppLink with a Prefered Opening Text
- PHP
$phone = array("XXXXXX");
$text = array("Hey there, welcome to my whatsapp chat");
$wsLink = whatsAppLink($text,$phone)
textToUrlEncode
- Changes the Text to a Url Format
- PHP
$text = array("Text ready to be encoded");
$nexText = textToUrlEncode($text);
prepareEmail
- Help us to prepare a Email (Change its variables and more).
- PHP
$variables = array(
'variable1' => 'value1',
'variable2' => 'value2'
);
$emailFileUrl = array("./../email/testEmail.html");
$email = prepareEmail($variables, $emailFileUrl);
Api
getJSONVariable
- Help us to retrieve information from a JSON
- PHP
$variableName = array("color");
$jsonBody;
$variable = getJsonVariable($jsonBody, $variableName);
adaptJSON
- Adapts Json.Stringify format to a readable format to PHP
- PHP
$jsonBody = '" { "format" : "nice" } "';
$newJSON = adaptJson($jsonBody);
openWeatherAPI
- Help us consume openWeatherAPI
- PHP
$apiKey = array("XXXXXXXXXXXXXXXXXXXXXXXX");
$country = array("-MX");
$location = array("Mexico City");
$url = openWeatherAPI($apiKey,$country,$location);
internationalNewsAPI
- Help us consume internationalNewsAPI
- PHP
$apiKey = array("XXXXXXXXXXXXXXXXXXXXXXXX");
$category = array("Health");
$country = array("-MX");
$page = array("1");
$url = internationalNewsApi($apiKey,$category,$country,$page);