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