class uKnowvaUtility extends JUtility


Located at : UKNOWVA_ROOT/libraries/conv/utilities.php

uKnowvaUtility is a utility functions class which helps you call functions like sendMail, getURLInfo, etc

Methods

static boolean
sendMail(mixed $recipient, string $subject, string $body, boolean $mode, mixed $cc = null, mixed $bcc = null, mixed $attachment = null, mixed $replyto = null, mixed $replytoname = null)

sends an email to the receipent, it uses Jutility::sendmail only, but from and to is directly taken from config

static boolean
sendAdminMail(string $adminName, string $adminEmail, string $email, string $type, string $title, string $author, string $url = null) deprecated

Sends mail to administrator for approval of a user submission

from JUtility
static string
getHash(string $seed) deprecated

Provides a secure hash based on a seed

from JUtility
static string
getToken(boolean $forceNew = false) deprecated

Method to determine a hash for anti-spoofing variable names

from JUtility
static array
parseAttributes(string $string)

Method to extract key/value pairs out of a string with XML style attributes

from JUtility
static boolean
isWinOS() deprecated

Method to determine if the host OS is Windows

from JUtility
static string
dump(mixed $var, boolean $htmlSafe = true) deprecated

Method to dump the structure of a variable for debugging purposes

from JUtility
integer
array_unshift_ref(array $array, mixed $value) deprecated

Prepend a reference to an element to the beginning of an array.

from JUtility
integer
return_bytes(string $val) deprecated

Return the byte value of a particular string

from JUtility
static boolean
sendInstantMail(string $recipient, string $subject, string $body, number $mode, array|string $cc = null, array|string $bcc = null, string $attachment = null, string $replyto = null, string $replytoname = null)

Send instant mail

static 
sendEmailtoAdmins(string $subject, string $body, number $mode, array|string $cc = null, array|string $bcc = null, string $attachment = null, string $replyto = null, string $replytoname = null)

sends an instant email to all admins

static 
sendQueuedEmailtoAdmins($subject, $body, $templateFile = '', $params = '', $status, $email_type = '')

sends ane mail to all admins, but here it uses the mailqueue of com_community You cannot send attachments, et here as it is sent in the next cron run by system

static string
subStrWord(unknown $string, number $length = 100, number $start, string $trailingWith = '', string $wordseparator = ' ')

This kool function was introduced in uknowva 2.4.4 onwards, it limits on basis of words and not characters word limited as discussed here: http://network.convergenceservices.in/forum/19-php/4118-short-description-without-stripping-words.html#4118

static string
subStrHTML(string $string, number $length = 100, number $start, string $trailingWith = '', string $wordseparator = ' ')

This kool function was introduced in uknowva 2.5.1 onwards, it limits on basis of words and not characters, plus it also make sure the HTML structure is retained For example, if the word truncation outputs a string withouth the closing tags, then this will automatically add the closing tags and return a string

mixed
getURLContentInfo(string $url)

Given a URL, this function gets the brief information on its content .i.e. title, description, images, baseurl, author, etc.

exportCSV(array $data, string $filename = null, boolean $return_file_path = false)

this function simply creates a CSV file as per the given data matrix and exports to the browser

exportExcel(array $data, string $filename = null, boolean $return_file_path = false)

this function simply creates a Excel 2007 file as per the given data matrix and exports to the browser

Details

at line 48
static boolean sendMail(mixed $recipient, string $subject, string $body, boolean $mode, mixed $cc = null, mixed $bcc = null, mixed $attachment = null, mixed $replyto = null, mixed $replytoname = null)

sends an email to the receipent, it uses Jutility::sendmail only, but from and to is directly taken from config

Parameters

mixed $recipient Recipient email address(es)
string $subject Email subject
string $body Message body
boolean $mode False = plain text, true = HTML
mixed $cc CC email address(es)
mixed $bcc BCC email address(es)
mixed $attachment Attachment file name(s)
mixed $replyto Reply to email address(es)
mixed $replytoname Reply to name(s)

Return Value

boolean True on success

in JUtility at line 70
static boolean sendAdminMail(string $adminName, string $adminEmail, string $email, string $type, string $title, string $author, string $url = null) deprecated

deprecated 12.1

Sends mail to administrator for approval of a user submission

Parameters

string $adminName Name of administrator
string $adminEmail Email address of administrator
string $email [NOT USED]
string $type Type of item to approve
string $title Title of item to approve
string $author Author of item to approve
string $url url

Return Value

boolean True on success

See also

JMail::sendAdminMail()

in JUtility at line 92
static string getHash(string $seed) deprecated

deprecated 12.1

Provides a secure hash based on a seed

Parameters

string $seed Seed string.

Return Value

string

See also

JApplication:getHash()

in JUtility at line 110
static string getToken(boolean $forceNew = false) deprecated

deprecated 12.1

Method to determine a hash for anti-spoofing variable names

Parameters

boolean $forceNew Force creation of a new token.

Return Value

string Hashed var name

See also

JApplication:getHash()

in JUtility at line 125
static array parseAttributes(string $string)

Method to extract key/value pairs out of a string with XML style attributes

Parameters

string $string String containing XML style attributes

Return Value

array Key/Value pairs for the attributes

in JUtility at line 154
static boolean isWinOS() deprecated

deprecated 12.1

Method to determine if the host OS is Windows

Return Value

boolean True if Windows OS.

See also

JApplication::isWinOS()

in JUtility at line 172
static string dump(mixed $var, boolean $htmlSafe = true) deprecated

deprecated 12.1

Method to dump the structure of a variable for debugging purposes

Parameters

mixed $var &$var A variable
boolean $htmlSafe True to ensure all characters are htmlsafe

Return Value

string

in JUtility at line 192
integer array_unshift_ref(array $array, mixed $value) deprecated

deprecated 12.1

Prepend a reference to an element to the beginning of an array.

Renumbers numeric keys, so $value is always inserted to $array[0]

Parameters

array $array &$array Array to be modified
mixed $value &$value Value to add

Return Value

integer

See also

http://www.php.net/manual/en/function.array-unshift.php#40270

in JUtility at line 211
integer return_bytes(string $val) deprecated

deprecated 12.1

Return the byte value of a particular string

Parameters

string $val String optionally with G, M or K suffix

Return Value

integer size in bytes

See also

JHtmlNumber::bytes

at line 30
static boolean sendInstantMail(string $recipient, string $subject, string $body, number $mode, array|string $cc = null, array|string $bcc = null, string $attachment = null, string $replyto = null, string $replytoname = null)

Send instant mail

Parameters

string $recipient Recipient e-mail address(es)
string $subject E-mail subject
string $body Message body
number $mode false = plain text, true = HTML
array|string $cc CC e-mail address(es), default = NULL
array|string $bcc BCC e-mail address(es), default = NULL
string $attachment Attachment file name(s), defualt = NULL
string $replyto Reply to email address(es), default = NULL
string $replytoname Reply to name(s), default = NULL

Return Value

boolean returns true is success or else false

at line 65
static sendEmailtoAdmins(string $subject, string $body, number $mode, array|string $cc = null, array|string $bcc = null, string $attachment = null, string $replyto = null, string $replytoname = null)

sends an instant email to all admins

Parameters

string $subject E-mail subject
string $body Message body
number $mode false = plain text, true = HTML
array|string $cc CC e-mail address(es), default = NULL
array|string $bcc BCC e-mail address(es), default = NULL
string $attachment Attachment file name(s), defualt = NULL
string $replyto Reply to email address(es), default = NULL
string $replytoname Reply to name(s), default = NULLs

at line 82
static sendQueuedEmailtoAdmins($subject, $body, $templateFile = '', $params = '', $status, $email_type = '')

sends ane mail to all admins, but here it uses the mailqueue of com_community You cannot send attachments, et here as it is sent in the next cron run by system

Parameters

$subject
$body
$templateFile
$params
$status
$email_type

at line 98
static string subStrWord(unknown $string, number $length = 100, number $start, string $trailingWith = '', string $wordseparator = ' ')

This kool function was introduced in uknowva 2.4.4 onwards, it limits on basis of words and not characters word limited as discussed here: http://network.convergenceservices.in/forum/19-php/4118-short-description-without-stripping-words.html#4118

Parameters

unknown $string is your string to be limited
number $length is the number of characters to limit
number $start is the place to start with in the string
string $trailingWith will add a text at the end like a ...
string $wordseparator is the character which separates the words

Return Value

string returns the string with words in it with specific length

at line 122
static string subStrHTML(string $string, number $length = 100, number $start, string $trailingWith = '', string $wordseparator = ' ')

This kool function was introduced in uknowva 2.5.1 onwards, it limits on basis of words and not characters, plus it also make sure the HTML structure is retained For example, if the word truncation outputs a string withouth the closing tags, then this will automatically add the closing tags and return a string

Parameters

string $string is your string to be limited
number $length is the number of characters to limit
number $start is the place to start with in the string
string $trailingWith will add a text at the end like a ...
string $wordseparator is the character which separates the words

Return Value

string returns returns the purified HTML

at line 142
mixed getURLContentInfo(string $url)

Given a URL, this function gets the brief information on its content .i.e. title, description, images, baseurl, author, etc.

It parses the meta tags and page contents/images to get this informction This function is used by the URL share feature of uKnowva

Parameters

string $url The url whose content needs to be retrieved

Return Value

mixed An associative array with following keys url: The given URL title: The page Title images: An array of images with their absolute paths description: The description of the page host: The hostname like www.uknowva.com, etc. baseurl: The base url author: The author of the page if any OR Null in case of failure

at line 151
exportCSV(array $data, string $filename = null, boolean $return_file_path = false)

this function simply creates a CSV file as per the given data matrix and exports to the browser

Parameters

array $data data
string $filename name of the file
boolean $return_file_path if true, then this function will return the path of the file, else it will just output the file and exit

at line 175
exportExcel(array $data, string $filename = null, boolean $return_file_path = false)

this function simply creates a Excel 2007 file as per the given data matrix and exports to the browser

Parameters

array $data data
string $filename name of the file
boolean $return_file_path if true, then this function will return the path of the file, else it will just output the file and exit