Core Class

Core class is used to manage all project functions. Not all methods are available at all times, since it depends on the classes that are loaded in the configuration.The class of each method will be explained in a subsequent review of this documentation.



Documentation index



  • Core class manages the following

  • Actual language based on GET, Cookie, browser set, and default set language
  • Skeleton for many domains and websites
  • Virtual pages from a db (no real pages are used)
  • Virtual websites and domains
  • HTML page generation from skeletons and content files
  • Text and rich text content blocks on many languages
  • Dynamic page info from db
  • Dynamic and static sitemaps
  • File cache for speed up static contents


 

Wrapped classes

Classes are initialized automatically within the main container class

$wv->db() - PDO wrapper class compatible with ezSQL syntax
$wv->pdo() - PHP PDO class
$wv->user() - User management class


 

Public functions

Core class is initialized automatically from loader.

$wv->allLanguages() - Returns array with all framework enabled languages
$wv->antiReload() - Avoid to resent post or get on page reloads
$wv->arraySanitize() - Sanitize normal or multidimensional array values
$wv->base64url_decode() - Decode string in base64 URL format
$wv->base64url_encode() - Encode string in base64 URL format
$wv->bruteforceAttemp() - Write a new invalid login attemp to bruteforce table
$wv->bruteforceCheck() - Check bruteforce access
$wv->captureGetVars() - Set global vars captured and filtered from GET with a 
	                    given size 
$wv->captureGlobalGet() - Capture and filter all $_GET vars with $key = value if 
           	           $key is not previously defined.
$wv->captureGlobalPost() - Capture and filter all $_POST vars with $key = value if 
        	               $key is not previously defined.
$wv->capturePostVars() - Set global vars captured and filtered from POST with a 
       	              given size
$wv->chkEmpty() - Check if an array or multidimensiona array is empty
$wv->chkIndexBacktrace() - Detect if class is called from index or other page
$wv->chkLang($iso) - Check if supplied iso lang code is enabled
$wv->cleanString() - Remove any tags, links or multiline comments
$wv->countryNameByISO() - Return Country name of a given ISO3166-1_A2 code
$wv->decVars() - Separate multiple vars received from a single base64 encoded GET 
$wv->detectBotByIP() - isBot method alias
$wv->detectBotByUserAgent() - Detect if the user_agent is from a bot.
$wv->download() - Download a file
$wv->dumpDecode() - Check response contents codified in json and base64-url
$wv->emailSend() - Simple email send function
$wv->encVars() - Encode and encrypt the vars of a GET query string
$wv->extractQueryStr() - Extract all the vars and arrays from GET
$wv->fileCacheChk() - Check if current page must be cached
$wv->fileCacheRead() - Read cache file if exist and delete expired cache files
$wv->fileCacheWrite() - Write the $obcontent to file cache
$wv->filterRecursive() - Recursively filter array or object
$wv->filterUsername() - Filter the login form username POST field
$wv->formatDate() - Returns a formated date, depending on int used in $opt
$wv->getAllText() - Generate array with (key => text) with actual page text on 
     	           selected language
$wv->getAlternateHeader() - Generate alternate link header with all enabled 
    	                    languages
$wv->getBlock() - Get content block in selected language
$wv->getBreadcrumb() - Get breadcrumb to var with bootstrap styles
$wv->getBrowserLang() - Get browser higher score enabled language
$wv->getConfValue() - Get the value of a given cat + key
$wv->getCopyright() - Generate Copyright string in HTML comment format
$wv->getDate() - Get current date for configured default_time_zone
$wv->getDomainTLD() - Return the TLD of given domain
$wv->getFileExtension() - Return the file extension of given file
$wv->getImageSize() - If reference size supplied, calculate the needed width 
	                  and height to keep image proportional. Else, return actual 
	                  image width and height.
$wv->getMIMEType() - Get de MIME type of a given file extension
$wv->getMsg() - Create a system message or error from array
$wv->getMsgIterator() - Recursively show all messages of multidimensional arrays
$wv->getQueryStr() - Create array with (name => value) data of URI query string
$wv->getQueryVars() - Convert from GET query to compresed var without base64 
	                  encode
$wv->getRawBlock() - Get block text of given ID and language
$wv->getRawBlockName() - Get block name of given ID and language
$wv->getReferer() - Returns one array with 
	                |http_referer|referer|uri_str|uri|domain|page|query|
$wv->getShiftDate() - get a shifted date/time by seconds, minutes, hours, days, 
	                  weeks, months or years
$wv->getText() - Return text value for current language for given $key
$wv->getUriAlias() - Get actual alias page from URI
$wv->getUserInfo() - Get all user info and attributes for a given user id
$wv->getVersion() - Get framework version string
$wv->hostIPAuth() - Check if a IP or host IP is in the array toauthorize access
$wv->initClass() - Load classes using spl_autoload_register and conf array
$wv->ip2Country() - Get country code of a given IP using Maxmind
$wv->isBot() - Detect if a IP is from a bot.
$wv->isCountry() - Detect UE and LATAM countries
$wv->langName() -  Return language name for given ISO code
$wv->lcut() - Delete on the left of a string the part that matches literally with 
	          another one.
$wv->logException() - Log exceptions.
$wv->login() - Try to login if credentials and login order was sent
$wv->loginByHash() - Try to login if a login HASH is detected
$wv->loginHash() - Generate a login HASH to identify a user from a URL GET
$wv->logout() - Disconect user session
$wv->move2SSL() - If not https, redirect domain to SSL and viceversa if switch 
	              active
$wv->object2List() - Get a comma separated list from object to use as 
	                 "WHERE $value IN ($list)"
$wv->pageBenchmark() - Measure the page loading speed and memory consumption
$wv->pageId2Alias() - Generate array with (page id => page alias) of all virtual 
	                  pages
$wv->putConfValue() - Update a conf value
$wv->queryStr() - Used by getQueryStr() to capture all vars to an array
$wv->queryStrVar() - Used by getQueryStr() to return a single var instead all the 
	                 query string
$wv->randPass() - Password generator
$wv->rcut() - Delete on the right of a string the part that matches literally with 
	          another one.
$wv->readCookiesAgree() - Read cookies_agree cookie
$wv->redir() - Redirect to a given URI and type or redirect.
$wv->redirect301() - Redirect old pages to new ones using configuration array
$wv->reduceArray() - Reduce multidimensional array/object to simple array
$wv->removeAccents() - Remove accents from a text string
$wv->rowOrder() - Change numeric order field to move up or down sql rows
$wv->setCookiesAgree() - Set de cookies_agree cookie
$wv->setVar() - Check if var is unset and set it as null, else return original value
$wv->showBlock() - Show content block in selected language
$wv->showBreadcrumb() - Show breadcrumb with bootstrap styles
$wv->showMsg() - Show the message created by createMsg
$wv->showText() - Show text value for current language for given $key
$wv->ssl() - Check if page is loaded using https protocol
$wv->urlizer() - Convert string to use in URLs, page names and similar.
$wv->userGroupName() - Get user group name for current user
$wv->validateEncryptionHash() - Validate encryption hashes
$wv->vardump() - Enhanced var dump with prism styles for debugging purposes


 

Public objects

Objects generated automatically on every page loaded

$wv->allLanguages; //Object - All enabled framework languages
$wv->classFileName; //Var - File name of actual loaded class
$wv->conf; //Array - All the configuration values of framework
$wv->date; //Var - Actual date and time
$wv->defLang; //Var - Default framework language
$wv->dirWSCache; //Var - Path to db cache directory
$wv->dirWSConf; //Var - Full path to local conf directory
$wv->dirWSLib; //Var - Full path to WebSite optional classes directory
$wv->dirWSDoc; //Var - Full path to WebSite document root directory
$wv->dirWSRoot; //Var - Full path to WebSite html documents parent
$wv->dirWSSkel; //Var - Full path to skeleton directory
$wv->dirWSTmp; //Var - Full path to tmp directory
$wv->dirWV; //Var - Full path to WebVivo root directory
$wv->dirWVLib; //Var - Full path to WebVivo lib directory
$wv->dirWVPanel; //Var - Full path to WebVivo panel directory
$wv->dirWVBase; //Var - Full path to WebVivo basic framework files directory
$wv->_dirWSCache; //Var - Path to db cache directory without trailing slash
$wv->_dirWSConf; //Var - Full path to local conf directory without trailing slash
$wv->_dirWSLib; //Var - Full path to WebSite optional classes directory without trailing slash
$wv->_dirWSDoc; //Var - Full path to WebSite document root directory without trailing slash
$wv->_dirWSRoot; //Var - Full path to WebSite html documents parent without trailing slash
$wv->_dirWSSkel; //Var - Full path to skeleton directory without trailing slash
$wv->_dirWSTmp; //Var - Full path to tmp directory without trailing slash
$wv->_dirWV; //Var - Full path to WebVivo root directory without trailing slash
$wv->_dirWVLib; //Var - Full path to WebVivo lib directory without trailing slash
$wv->_dirWVPanel; //Var - Full path to WebVivo panel directory without trailing slash
$wv->_dirWVBase; //Var - Full path to WebVivo basic framework files directory without trailing slash
$wv->files; //Object - Actual virtual page info
$wv->formAuto; //Var - Login form auto-login cookie
$wv->formPassword; //Var - Login form password
$wv->formUsername; //Var - Login form username
$wv->fqdn; //Var - Filtered SERVER_NAME without www
$wv->_fqdn; //Var - Filtered SERVER_NAME with www
$wv->home; //Object - Website home page id and alias
$wv->ip; //Var - Remote user IP
$wv->lang; //Var - Selected language ISO code
$wv->loginHash; //Var - Login hash value used to login without credentials
$wv->loginResult; //Object - Actual login result info
$wv->pageAlias; //Var - Filtered actual page aliass name of URI
$wv->pageInfo; //Object - Actual page file info
$wv->redirToPage; //Var - Name alias of page to redir after login
$wv->releaseDate; //Framework actual release date
$wv->releaseVersion; //Framework actual release version
$wv->setLang; //Var - Language ISO code to set language cookie
$wv->skeletonDir; //Var - Framework local skeleton directory name
$wv->ssl; //Bool - true if SSL activated
$wv->ua; //Var - Filtered browser user_agent
$wv->user_agent; //Var - $wv->ua alias
$wv->uniqID; //Var - Website Uniq ID
$wv->uri; //Var - Filtered  REQUEST_URI
$wv->userGroup; //Var - User session group ID
$wv->userGroupName; //Var - User session group name
$wv->userID; //Var - User session ID
$wv->userName; //Var - User session username
$wv->version; //Var - Framework verbose version text



$wv->pageInfo object

Page info object contains info about the current page

$wv->pageInfo->skeleton_above; //Full path skeleton page above the content (heder)
$wv->pageInfo->skeletonAbove; //Alias of skeleton_above
$wv->pageInfo->skeleton_below; //Full path skeleton page below the content (footer)
$wv->pageInfo->skeletonBelow; //Alias of skeleton_below
$wv->pageInfo->content; //Full path content page
$wv->pageInfo->page_id; //ID of page
$wv->pageInfo->pageId; //Alias of page_id
$wv->pageInfo->pageID; //Alias of page_id
$wv->pageInfo->file_name; //Page file name
$wv->pageInfo->fileName; //Alias of fileName
$wv->pageInfo->alias; //Page alias name, i.e. https://domain.tld/alias
$wv->pageInfo->group; //Page group ID
$wv->pageInfo->group_up; //Precedent group
$wv->pageInfo->groupUp; //Alias of group_up
$wv->pageInfo->dir; //Full path of page with trailing slash
$wv->pageInfo->_dir; //Full path of page without trailing slash
$wv->pageInfo->last_dir; //Parent directory of page
$wv->pageInfo->lastDir; //Alias of last_dir
$wv->pageInfo->page_title; //Page title
$wv->pageInfo->pageTitle; //Alias of page_title
$wv->pageInfo->meta_description; //Page meta description
$wv->pageInfo->metaDescription; //Alias of meta_description
$wv->pageInfo->meta_keyword; //Page meta keyword (deprecated)
$wv->pageInfo->metaKeyword; //Alias of metaKeyword
$wv->pageInfo->http_header; //HTTP status headersent to browser
$wv->pageInfo->httpHeader; //Alias of http_header
$wv->pageInfo->trail_id; //Page ID of precedent page (if any)
$wv->pageInfo->trailId; //Alias of trail_id
$wv->pageInfo->owner_id; //User ID of the owner of the page
$wv->pageInfo->ownerId; //Alias of owner_id
$wv->pageInfo->priority; //Priority of page in sitemap.xlm 
$wv->pageInfo->no_header; //Page must be generated without headers
$wv->pageInfo->noHeader; //Alias of no_header
$wv->pageInfo->https; //SSL loadig: 0 = no change | 1 = force https | 2 = force http
$wv->pageInfo->virtual; //If the page is called through virtual alias page, 
                        //contains the real page query string or any custom string 


$wv->pageInfo object example of (https://domain.tld/example)

(
    [skeleton_above] => /var/www/virtual/domain.tld/htdocs/skeleton/above.php
    [skeletonAbove] => /var/www/virtual/domain.tld/htdocs/skeleton/above.php
    [skeleton_below] => /var/www/virtual/domain.tld/htdocs/skeleton/below.php
    [skeletonBelow] => /var/www/virtual/domain.tld/htdocs/skeleton/below.php
    [content] => /var/www/virtual/domain.tld/htdocs/phpfiles/example.php
    [page_id] => 100
    [pageId] => 100
    [pageID] => 100
    [file_name] => example.php
    [fileName] => example.php
    [alias] => doc
    [group] => 3
    [group_up] => 0
    [groupUp] => 0
    [dir] => /var/www/virtual/domain.tld/htdocs/phpfiles/
    [_dir] => /var/www/virtual/domain.tld/htdocs/phpfiles
    [last_dir] => phpfiles
    [lastDir] => phpfiles
    [page_title] => Example PHP file
    [pageTitle] => Example PHP file
    [meta_description] => Some exaplme page
    [metaDescription] => Some exaplme page
    [meta_keyword] => example, webvivo, page
    [metaKeyword] => example, webvivo, page
    [http_header] => 200 OK
    [httpHeader] => 200 OK
    [trail_id] => 0
    [trailId] => 0
    [owner_id] => 1
    [ownerId] => 1
    [priority] => 5
    [no_header] => 0
    [noHeader] => 0
    [https] => 0
    [virtual] => ?var=somevalue&othervar=othervalue
)