\Csz_model

Summary

Methods
Properties
Constants
__construct()
getVersion()
countData()
getCurPages()
getValue()
getValueArray()
getLastID()
getID()
load_config()
getLang()
getCountryCode()
getPageUrlFromID()
getDefualtPage()
getDefualtLang()
chkLangAlive()
setSiteLang()
loadAllLang()
load_page()
main_menu()
getSocial()
cszCopyright()
coreCss()
coreJs()
coreMetatags()
rw_link()
getHtmlContent()
formTagToHTML()
bannerInHtml()
addBannerToHTML()
carouselInHtml()
addCarouselToHTML()
widgetInHtml()
getWidgetFromID()
replaceTagInWidget()
addWidgetToHTML()
pwidgetInHtml()
getPWidgetFromID()
findFieldInLoop()
fieldTagInPWidget()
findTagBaseURL()
addPWidgetToHTML()
frmNameInHtml()
addFrmToHtml()
encodeURL()
decodeURL()
clear_all_error_log()
clear_all_session()
clear_all_cache()
clear_file_cache()
clear_uri_cache()
chkCaptchaRes()
showCaptcha()
saveLinkStats()
saveBannerStats()
pwdEncypt()
chkPassword()
login()
logout()
saveLogs()
getLabelLang()
createMember()
updateMember()
sendEmail()
get_contents_url()
my_get_headers()
downloadFile()
is_url_exist()
urlencode()
getFBsdk()
getFBChat()
getFBComments()
insertAsCopy()
findNameAsCopy()
cleanEmailFormat()
cleanOSCommand()
findFrmTag()
load_bf_config()
chkBFwhitelistIP()
chkBFblacklistIP()
saveBFloginIP()
chkIPBaned()
getPluginConfig()
base_link()
chkPrivateKey()
chkVerUpdate()
getNextVersion()
findNextVersion()
compress_html()
setJSCSScache()
setJSCSSheader()
rmdir_recursive()
copy_recursive()
photo_xss_clean()
remove_empty_htmltags()
pagesTitle()
timeNow()
$db
$dbforge
$config
$load
$session
No constants found
No protected methods found
No protected properties found
N/A
setcahetime()
getFirstPagesActive()
getCurlreCaptData()
getLabelLangDB()
chkNextVer()
compress_js_css()
$cachetime
N/A

Properties

$db

$db : \CI_DB_query_builder

Type

\CI_DB_query_builder

$dbforge

$dbforge : \CI_DB_forge

Type

\CI_DB_forge

$config

$config : \CI_Config

Type

\CI_Config

$load

$load : \CI_Loader

Type

\CI_Loader

$session

$session : \CI_Session

Type

\CI_Session

$cachetime

$cachetime : 

Type

Methods

__construct()

__construct() 

getVersion()

getVersion(string  $version_test = '') : string

Get Current Version

Function for get current version

Parameters

string $version_test

version to test or NULL

Returns

string

countData()

countData(string  $table, string  $search_sql = '', string  $groupby = '', string|array  $orderby = '', string  $sort = '', string  $join_db = '', string  $join_where = '', string  $join_type = '') : \number

count data from table

Function for count the data from table

Parameters

string $table

DB Table

string $search_sql

For sql where Ex. "field1 = '1' AND field2 = '1'" or NULL

string $groupby

Group by field or NULL

string|array $orderby

Order by field or NULL

string $sort

asc or desc or NULL

string $join_db

Table to join or NULL

string $join_where

Join condition or NULL

string $join_type

Join type ('LEFT', 'RIGHT', 'OUTER', 'INNER', 'LEFT OUTER', 'RIGHT OUTER') or NULL

Returns

\number —

or FALSE

getCurPages()

getCurPages() : String

getCurPages

Function for get current page

Returns

String

getValue()

getValue(string  $sel_field = '*', string  $table, string  $where_field, string  $where_val, integer  $limit, string|array  $orderby = '', string  $sort = '', string  $groupby = '', string  $join_db = '', string  $join_where = '', string  $join_type = '') : Object

getValue

Function get value from table with object

Parameters

string $sel_field

DB field select

string $table

DB table

string $where_field

where field or where condition Ex. "field = '1' AND field2 = '2'"

string $where_val

value of wherer (If $where_field has condition. Please null)

integer $limit

Limit the result. Default is 0

string|array $orderby

Order by field or NULL

string $sort

asc or desc or NULL

string $groupby

Group by field or NULL

string $join_db

Table to join or NULL

string $join_where

Join condition or NULL

string $join_type

Join type ('LEFT', 'RIGHT', 'OUTER', 'INNER', 'LEFT OUTER', 'RIGHT OUTER') or NULL

Returns

Object —

or FALSE

getValueArray()

getValueArray(string  $sel_field = '*', string  $table, string  $where_field, string  $where_val, integer  $limit, string|array  $orderby = '', string  $sort = '', string  $groupby = '', string  $join_db = '', string  $join_where = '', string  $join_type = '', boolean  $onlyone = FALSE) : Array

getValueArray

Function get value from table with array

Parameters

string $sel_field

DB field select

string $table

DB table

string $where_field

where field or where condition Ex. "field = '1' AND field2 = '2'"

string $where_val

value of wherer (If $where_field has condition. Please null)

integer $limit

Limit the result. Default is 0

string|array $orderby

Order by field or NULL

string $sort

asc or desc or NULL

string $groupby

Group by field or NULL

string $join_db

Table to join or NULL

string $join_where

Join condition or NULL

string $join_type

Join type ('LEFT', 'RIGHT', 'OUTER', 'INNER', 'LEFT OUTER', 'RIGHT OUTER') or NULL

boolean $onlyone

TRUE for get only one result with out loop, FALSE get result with loop

Returns

Array —

or FALSE

getLastID()

getLastID(string  $table, string  $field_id,   $search_sql = '') : \number

getLastID

Function for get last id from db

Parameters

string $table

db table name

string $field_id

field id (primary key)

$search_sql

Returns

\number

getID()

getID(string  $table, string  $field_id_name, string|array  $search_sql) : integer

getID

Function for get id from db

Parameters

string $table

db table name

string $field_id_name

field id (primary key)

string|array $search_sql

search value

Returns

integer —

or FALSE

load_config()

load_config() : Object

load_config

Function for get settings from settings table

Returns

Object —

or FALSE

getLang()

getLang() : String

getLang()

Function for get admin language

Returns

String

getCountryCode()

getCountryCode(string  $lang) : String

getCountryCode

Function for get country code from language code

Parameters

string $lang

language code

Returns

String

getPageUrlFromID()

getPageUrlFromID(string  $id) : String

getPageUrlFromID

Function for get page url_rewrite from page id

Parameters

string $id

pages id

Returns

String

getDefualtPage()

getDefualtPage(string  $lang) : String

getDefualtPage

Function for get defualt page url_rewrite from language code

Parameters

string $lang

language code

Returns

String —

or FALSE if not found

getDefualtLang()

getDefualtLang() : String

getDefualtLang

Function for get defualt language code

Returns

String

chkLangAlive()

chkLangAlive(string  $lang_iso) : \number

chkLangAlive

Function for check language code is active

Parameters

string $lang_iso

language code

Returns

\number

setSiteLang()

setSiteLang(string  $lang_iso = '') 

setSiteLang

Function for set language code into session

Parameters

string $lang_iso

language code

loadAllLang()

loadAllLang(integer  $active) : Object

loadAllLang

Function for load all language

Parameters

integer $active

(1 = active only, 0 or null = all)

Returns

Object —

or FALSE id not found

load_page()

load_page(string  $pageurl) : Object

load_page

Function for load page data from page url_rewrite

Parameters

string $pageurl

page url_rewrite

Returns

Object —

or FALSE id not found

main_menu()

main_menu(integer  $drop_page_menu_id, string  $lang = '', integer  $position, boolean  $backend = FALSE) : Object

main_menu

Function for load main menu

Parameters

integer $drop_page_menu_id

1 = drop menu, 0 = main menu

string $lang

language code

integer $position

menu position 0 = Top, 1 = Bottom

boolean $backend

get value for backend, Default is FALSE

Returns

Object —

or FALSE id not found

getSocial()

getSocial(boolean  $activeonly = TRUE) : Object

getSocial

Function for get social link

Parameters

boolean $activeonly

TRUE for get the social with active only, FALSE is get all data

Returns

Object —

or FALSE id not found

cszCopyright()

cszCopyright(  $copyright_txt = '') 

cszCopyright

Function for show website footer Please do not remove or change the fuction $this->Csz_admin_model->cszCopyright()

Parameters

$copyright_txt

coreCss()

coreCss(string  $more_css = '', boolean  $more_include = TRUE) : String

coreCss

Function for load core css and more css

Parameters

string $more_css

additional css (string type for single css file or text style only. If you have many css file please use array)

boolean $more_include

for include the css file or FALSE

Returns

String

coreJs()

coreJs(string  $more_js = '', boolean  $more_include = TRUE) : String

coreJs

Function for load core js and more js

Parameters

string $more_js

additional js (string type for single js file or text style only. If you hve many js file please use array)

boolean $more_include

for include the js file or FALSE

Returns

String

coreMetatags()

coreMetatags(string  $desc_txt, string  $keywords, string  $title, string  $img_path = '', string  $more_meta = '') : String

coreMetatags

Function for load core metatag

Parameters

string $desc_txt

page description

string $keywords

page keyword

string $title

page title

string $img_path

page article image url path without base_url() . 'photo/'

string $more_meta

more meta tag text

Returns

String

rw_link()

rw_link(string  $val, integer  $char_limit = 2048) : String

rw_link

Function for url rewrite from string

Parameters

string $val

Title name or string

integer $char_limit

Charector limit default is 2048

Returns

String

getHtmlContent()

getHtmlContent(string  $ori_content, string  $url_segment) : string

getHtmlContent

Function for convert HTML for form linkstats and widget

Parameters

string $ori_content

Original content

string $url_segment

Form status paramiter return

Returns

string

formTagToHTML()

formTagToHTML(string  $content) : string

formTagToHTML

Function for find form tag with only post [?startform_post:form_name{action_url}][/?endform] AND [?startform_get:form_name{action_url}][/?endform] Action url without base url Ex. [?startform_post:formtest{member/login/check}] Your html form [/?endform] And set the current url into session (cszfrm_cururl) for use to return page.

Parameters

string $content

Original content

Returns

string

bannerInHtml()

bannerInHtml(string  $content) : string

bannerInHtml

Function for find banner tag

Parameters

string $content

Original content

Returns

string

addBannerToHTML()

addBannerToHTML(string  $content, string  $id) : string

addBannerToHTML

Function for add banner into html

Parameters

string $content

Original content

string $id

banner id

Returns

string

carouselInHtml()

carouselInHtml(string  $content) : string

carouselInHtml

Function for find carousel tag

Parameters

string $content

Original content

Returns

string

addCarouselToHTML()

addCarouselToHTML(string  $content, string  $id) : string

addCarouselToHTML

Function for add carousel into html

Parameters

string $content

Original content

string $id

carousel id

Returns

string

widgetInHtml()

widgetInHtml(string  $content) : string

widgetInHtml

Function for find widget tag

Parameters

string $content

Original content

Returns

string

getWidgetFromID()

getWidgetFromID(string  $wid_id) : object

getWidgetFromID

Function for get widget from id

Parameters

string $wid_id

Widget id

Returns

object —

or FALSE

replaceTagInWidget()

replaceTagInWidget(string  $html, object  $item) : string

replaceTagInWidget

Function for check and replace tag in widget html

Parameters

string $html

html input

object $item

the item object get from xml

Returns

string

addWidgetToHTML()

addWidgetToHTML(string  $content, string  $wid_id) : string

addWidgetToHTML

Function for add widget into html

Parameters

string $content

Original content

string $wid_id

Widget name

Returns

string

pwidgetInHtml()

pwidgetInHtml(string  $content) : string

pwidgetInHtml

Function for find plugin widget tag

Parameters

string $content

Original content

Returns

string

getPWidgetFromID()

getPWidgetFromID(string  $wid_id) : object

getWidgetFromID

Function for get widget from id

Parameters

string $wid_id

Widget id

Returns

object —

or FALSE

findFieldInLoop()

findFieldInLoop(string  $html, array  $item) : string

findFieldInLoop

Function for file field insode the loop tag

Parameters

string $html

html input

array $item

the item object or array get data from getValue

Returns

string

fieldTagInPWidget()

fieldTagInPWidget(string  $html, array  $item) : string

fieldTagInPWidget

Function for check and replace tag in plugin widget html

Parameters

string $html

html input

array $item

the item object or array get data from getValue

Returns

string

findTagBaseURL()

findTagBaseURL(string  $html, string  $plugin_filename = '') : string

findTagBaseURL

Function for check and replace base url tag in plugin widget html

Parameters

string $html

html input

string $plugin_filename

plugin filename from config

Returns

string

addPWidgetToHTML()

addPWidgetToHTML(string  $content, string  $wid_id) : string

addPWidgetToHTML

Function for add plugin widget into html

Parameters

string $content

Original content

string $wid_id

Widget id

Returns

string

frmNameInHtml()

frmNameInHtml(string  $content, string  $url_segment) : string

frmNameInHtml

Function for find form tag from html

Parameters

string $content

Original content

string $url_segment

Form status paramiter return

Returns

string

addFrmToHtml()

addFrmToHtml(string  $content, string  $frm_name, string  $status = '') : string

addFrmToHtml

Function for add form into html

Parameters

string $content

Original content

string $frm_name

Form name

string $status

Form status paramiter return

Returns

string

encodeURL()

encodeURL(string  $val) : string

encodeURL

Function for encode the url

Parameters

string $val

Original url

Returns

string

decodeURL()

decodeURL(string  $val) : string

decodeURL

Function for decode the url

Parameters

string $val

Encode url

Returns

string

clear_all_error_log()

clear_all_error_log() 

clear_all_error_log

Function for clear all log file

clear_all_session()

clear_all_session() 

clear_all_session

Function for clear all session file

clear_all_cache()

clear_all_cache() 

clear_all_cache

Function for clear all cache file

clear_file_cache()

clear_file_cache(string  $filename, boolean  $search = FALSE) 

clear_file_cache

Function for clear all cache file

Parameters

string $filename

File name

boolean $search

TRUE for search filename with *, FALSE is not

clear_uri_cache()

clear_uri_cache(string  $uri = '') 

clear_uri_cache

Function for clear uri cache file

Parameters

string $uri

page uri or NULL for remove the base_url cache

chkCaptchaRes()

chkCaptchaRes() : string

chkCaptchaRes

Function for check the reCaptcha

Returns

string

showCaptcha()

showCaptcha() : string

showCaptcha

Function for show the reCaptcha

Returns

string

saveLinkStats()

saveLinkStats(string  $link) 

saveLinkStats

Function for save link stats

Parameters

string $link

url for save into database

saveBannerStats()

saveBannerStats(string  $banner_mgt_id) 

saveBannerStats

Function for save banner stats

Parameters

string $banner_mgt_id

banner id for save into database

pwdEncypt()

pwdEncypt(string  $password) : string

pwdEncypt

Function for encyption the password with password_hash (BCRYPT)

Parameters

string $password

password

Returns

string

chkPassword()

chkPassword(string  $email, string  $password, boolean  $backend) : object

chkPassword

Function for check the email and password

Parameters

string $email

email address

string $password

password

boolean $backend

TRUE for login on backend

Returns

object

login()

login(string  $email, string  $password, boolean  $backend = FALSE) : string

login

Function for check the email and password

Parameters

string $email

email address

string $password

password

boolean $backend

TRUE for login on backend

Returns

string

logout()

logout(string  $url = '') 

logout

Function for logout

Parameters

string $url

Url to redirect

saveLogs()

saveLogs(string  $email = '', string  $note = '', string  $result = '', string  $user_agent = '', string  $ip_address = '') 

saveLogs

Function for save the login log into database

Parameters

string $email

email address

string $note

note text

string $result

result text

string $user_agent

user agent

string $ip_address

ip address

getLabelLang()

getLabelLang(string  $name) : string

getLabelLang

Function for get the label language for frontend

Parameters

string $name

label name

Returns

string —

or FALSE

createMember()

createMember() 

createMember

Function for create new member

updateMember()

updateMember(string  $id, boolean  $backend = FALSE) : TRUE

updateMember

Function for update the member

Parameters

string $id

member id

boolean $backend

TRUE for login on backend

Returns

TRUE —

or FALSE

sendEmail()

sendEmail(string  $to_email, string  $subject, string  $message, string  $from_email, string  $from_name = '', string  $bcc = '', string  $reply_to = '', string  $alt_message = '', array  $attach_file = array(), boolean  $save_log = TRUE) : string

sendEmail

Function for send the email (effect with settings on backend)

Parameters

string $to_email

to email address

string $subject

email subject

string $message

email body message

string $from_email

from email address

string $from_name

from name

string $bcc

bcc to email address

string $reply_to

reply email address

string $alt_message

alternate message when html not working

array $attach_file

attach files with array

boolean $save_log

for save email logs into db

Returns

string

get_contents_url()

get_contents_url(string  $url = '') : string

get_contents_url

Function for get the content from url

Parameters

string $url

content full url path

Returns

string —

or FALSE

my_get_headers()

my_get_headers(string  $url) : ARRAY

my_get_headers

Function for check url is exist

Parameters

string $url

url file

Returns

ARRAY —

or FALSE

downloadFile()

downloadFile(string  $url, string  $newfname) : FALSE

downloadFile From url

Function for download file from url

Parameters

string $url

url for file download

string $newfname

path for file save

Returns

FALSE —

if can't download

is_url_exist()

is_url_exist(string  $url) : TRUE

is_url_exist

Function for check url is exist

Parameters

string $url

url file

Returns

TRUE —

or FALSE

urlencode()

urlencode(string  $url) : string

urlencode

Function for url encode

Parameters

string $url

url

Returns

string

getFBsdk()

getFBsdk() : string

getFBsdk

Function for get facebook SDK javascript

Returns

string —

or FALSE if not have fbapp_id

getFBChat()

getFBChat() : string

getFBChat

Function for get facebook messager chat

Returns

string —

or FALSE if not have facebook_page_id or fb_messenger setting not active

getFBComments()

getFBComments(string  $url, integer  $limit, string  $sort) : string

getFBComments

Function for get facebook comments code from settings

Parameters

string $url

page url for show comment

integer $limit

comment show limit

string $sort

comment sort ("social", "reverse_time", or "time".)

Returns

string —

or FALSE if not have fbapp_id

insertAsCopy()

insertAsCopy(string  $table, array  $data = array()) : TRUE

insertAsCopy

Function for create new content as copy

Parameters

string $table

for database table

array $data

for all data with array into database

Returns

TRUE —

or FALSE if not insert

findNameAsCopy()

findNameAsCopy(string  $table, string  $field_id, string  $value, boolean  $is_url = FALSE, string  $separator = '-') : string

findNameAsCopy

Function for find the name to create new content as copy with new name

Parameters

string $table

for database table

string $field_id

ID field

string $value

Value to replace name

boolean $is_url

Value is url. Default is FALSE

string $separator

What should the duplicate number be appended with

Returns

string —

or FALSE

cleanEmailFormat()

cleanEmailFormat(string  $email) : string

cleanEmailFormat

Function for clean email format

Parameters

string $email

for email address input

Returns

string

cleanOSCommand()

cleanOSCommand(string  $string) : string

cleanOSCommand

Function for clean any string with security (OS Command injection)

Parameters

string $string

for any string

Returns

string

findFrmTag()

findFrmTag(string  $content, boolean  $html = FALSE) : TRUE

findFormsTag

Function for find forms tag from content html

Parameters

string $content

for content html

boolean $html

for use html tag or [?] tag. Default FALSE is use [?] tag

Returns

TRUE —

or FALSE

load_bf_config()

load_bf_config() : Object

load_bf_config

Function for get settings from brute force login protection setting

Returns

Object —

or FALSE

chkBFwhitelistIP()

chkBFwhitelistIP(string  $ip_address = '') : TRUE

chkBFwhitelistIP

Function for check the IP from whitelist

Parameters

string $ip_address

for ip address

Returns

TRUE —

or FALSE

chkBFblacklistIP()

chkBFblacklistIP(string  $ip_address = '') : TRUE

chkBFblacklistIP

Function for check the IP from whitelist

Parameters

string $ip_address

for ip address

Returns

TRUE —

or FALSE

saveBFloginIP()

saveBFloginIP(string  $ip_address = '', string  $email = '') 

saveBFloginIP

Function for automatic add the IP blacklist from brute force login protection

Parameters

string $ip_address

for ip address

string $email

for email address

chkIPBaned()

chkIPBaned(string  $email = '') : TRUE

chkIPBaned

Function for check the IP from blacklist

Parameters

string $email

for email address or NULL

Returns

TRUE —

or FALSE

getPluginConfig()

getPluginConfig(string  $config_filename, string  $index_name) : string

getPluginConfig

Function for get plugin config

Parameters

string $config_filename

for plugin config file name

string $index_name

for plugin config file name

Returns

string —

or FALSE

base_link()

base_link(boolean  $static = FALSE, boolean  $htaccess = TRUE) : string

base_link

Function for get the base url link

Parameters

boolean $static

for assets static resources from a different cdn domain

boolean $htaccess

for htaccess config

Returns

string

chkPrivateKey()

chkPrivateKey(string  $private_key = '') : boolean

chkPrivateKey

Function for check the private key

Parameters

string $private_key

private key

Returns

boolean

chkVerUpdate()

chkVerUpdate(string  $cur_ver, string  $last_ver) : boolean

chkVerUpdate

Function for check version for update

Parameters

string $cur_ver

current version

string $last_ver

latest version

Returns

boolean

getNextVersion()

getNextVersion(string  $cur_ver, integer  $inc_dec = 1) : string

getNextVersion

Function for get the next version

Parameters

string $cur_ver

current version

integer $inc_dec

For increase the version number is '1' and decrease the version number is '-1'

Returns

string

findNextVersion()

findNextVersion(string  $cur_txt, string  $last_ver,   $previous_ver) : string

findNextVersion

Function for check version for update

Parameters

string $cur_txt

current version

string $last_ver

latest version

$previous_ver

Returns

string —

or false

compress_html()

compress_html(string  $html) : string

compress_html

Function for compress the html

Parameters

string $html

html text

Returns

string

setJSCSScache()

setJSCSScache(array  $files, string  $cache_name, string  $type, integer  $expires) : string

setJSCSScache

Function for set js or css cache file

Parameters

array $files

file path

string $cache_name

cache filename

string $type

file type [js or css]

integer $expires

expire time

Returns

string

setJSCSSheader()

setJSCSSheader(integer  $modefied, integer  $expires, string  $etag, string  $type) : void

setJSCSSheader

Function for set js or css http header

Parameters

integer $modefied

file modified time

integer $expires

expire time

string $etag

etag MD5 from file

string $type

file type [text/js or application/javascript or text/css]

rmdir_recursive()

rmdir_recursive(string  $dir) 

rmdir_recursive

Function for remove directory with recursive

Parameters

string $dir

Directory path want to remove with recursive

copy_recursive()

copy_recursive(string  $src, string  $dst) 

copy_recursive

Function for copy directory and file with recursive

Parameters

string $src

Source full path want to copy with recursive

string $dst

Destination full path want to paste with recursive

photo_xss_clean()

photo_xss_clean(\srting  $file) : string

Runs the file through the XSS clean function (Only images)

This prevents people from embedding malicious code in their files. I'm not sure that it won't negatively affect certain files in unexpected ways, but so far I haven't found that it causes trouble.

Parameters

\srting $file

From $_FILE['fieldname']['tmp_name']

Returns

string —

or FALSE

remove_empty_htmltags()

remove_empty_htmltags(string  $string) : mixed

Remove the nested HTML empty tags from the string.

Parameters

string $string

String to remove tags

Returns

mixed —

Cleaned string

pagesTitle()

pagesTitle(string  $title) : string

Title for page

Parameters

string $title

title text

Returns

string

timeNow()

timeNow() : string

Time now into database

Returns

string

setcahetime()

setcahetime(integer  $minute) 

setcahetime Set the cache time (In minute)

Parameters

integer $minute

the minute of cache time

getFirstPagesActive()

getFirstPagesActive() : String

getFirstPagesActive

Private function for get first page active for default

Returns

String —

or FALSE if not found

getCurlreCaptData()

getCurlreCaptData(string  $url) : string

getCurlreCaptData

Function for get the reCaptcha respone data from json

Parameters

string $url

reCaptcha json respone url

Returns

string —

or FALSE if reCaptcha wrong

getLabelLangDB()

getLabelLangDB(  $name,   $sel_name = 'lang_en') 

Parameters

$name
$sel_name

chkNextVer()

chkNextVer(  $cur_ver,   $last_ver,   $previous_ver) 

Parameters

$cur_ver
$last_ver
$previous_ver

compress_js_css()

compress_js_css(  $val) 

Parameters

$val