|
dolibarr 21.0.4
|
Library for website module. More...
Go to the source code of this file.
Functions | |
| dolStripPhpCode ($str, $replacewith='') | |
| Remove PHP code part from a string. | |
| dolKeepOnlyPhpCode ($str) | |
| Keep only PHP code part from a HTML string page. | |
| dolWebsiteReplacementOfLinks ($website, $content, $removephppart=0, $contenttype='html', $containerid=0) | |
| Convert a page content to have correct links (based on DOL_URL_ROOT) into an html content. | |
| dolReplaceSmileyCodeWithUTF8 ($content) | |
| Converts smiley string into the utf8 sequence. | |
| dolWebsiteOutput ($content, $contenttype='html', $containerid=0) | |
| Render a string of an HTML content and output it. | |
| dolWebsiteIncrementCounter ($websiteid, $websitepagetype, $websitepageid) | |
| Increase the website counter of page access. | |
| redirectToContainer ($containerref, $containeraliasalt='', $containerid=0, $permanent=0, $parameters=array(), $parampropagation=1) | |
| Format img tags to introduce viewimage on img src. | |
| includeContainer ($containerref, $once=0, $cachedelay=0, $cachekey='') | |
| Execute content of a php page and report result to be included into another page. | |
| getStructuredData ($type, $data=array()) | |
| Return HTML content to add structured data for an article, news or Blog Post. | |
| getSocialNetworkHeaderCards ($params=null) | |
| Return HTML content to add as header card for an article, news or Blog Post or home page. | |
| getSocialNetworkSharingLinks ($socialnetworks='') | |
| Return HTML content to add structured data for an article, news or Blog Post. | |
| getNbOfImagePublicURLOfObject ($object) | |
| Return nb of images known into inde files for an object;. | |
| getImagePublicURLOfObject ($object, $no=1, $extName='', $cover=1) | |
| Return the public image URL of an object. | |
| getPublicFilesOfObject ($object) | |
| Return array with list of all public files of a given object. | |
| getPagesFromSearchCriterias ($type, $algo, $searchstring, $max=25, $sortfield='date_creation', $sortorder='DESC', $langcode='', $otherfilters=[], $status=1) | |
| Return list of containers object that match a criteria. | |
| getImageFromHtmlContent ($htmlContent, $imageNumber=1) | |
| Return the URL of an image found into a HTML content. | |
| getAllImages ($object, $objectpage, $urltograb, &$tmp, &$action, $modifylinks=0, $grabimages=1, $grabimagesinto='subpage') | |
| Download all images found into an external URL. | |
| getNewsDetailsById ($postId) | |
| Retrieves the details of a news post by its ID. | |
Library for website module.
Definition in file website.lib.php.
| dolKeepOnlyPhpCode | ( | $str | ) |
Keep only PHP code part from a HTML string page.
| string | $str | String to clean |
Definition at line 78 of file website.lib.php.
Referenced by run_sql().
| dolReplaceSmileyCodeWithUTF8 | ( | $content | ) |
Converts smiley string into the utf8 sequence.
| string | $content | Content to replace |
Definition at line 233 of file website.lib.php.
Referenced by dolWebsiteOutput().
| dolStripPhpCode | ( | $str, | |
| $replacewith = '' ) |
Remove PHP code part from a string.
| string | $str | String to clean |
| string | $replacewith | String to use as replacement |
Definition at line 34 of file website.lib.php.
Referenced by dolWebsiteReplacementOfLinks(), and getStructuredData().
| dolWebsiteIncrementCounter | ( | $websiteid, | |
| $websitepagetype, | |||
| $websitepageid ) |
Increase the website counter of page access.
| int | $websiteid | ID of website |
| string | $websitepagetype | Type of page ('blogpost', 'page', ...) |
| int | $websitepageid | ID of page |
Definition at line 453 of file website.lib.php.
References dol_getdate(), dol_mktime(), dol_now(), and getDolGlobalInt().
| dolWebsiteOutput | ( | $content, | |
| $contenttype = 'html', | |||
| $containerid = 0 ) |
Render a string of an HTML content and output it.
Used to output the page when viewed from a server (Dolibarr or Apache).
| string | $content | Content string |
| string | $contenttype | Content type |
| int | $containerid | Contenair id |
Definition at line 284 of file website.lib.php.
References $conf, dol_syslog(), dolReplaceSmileyCodeWithUTF8(), and getDolGlobalString().
| dolWebsiteReplacementOfLinks | ( | $website, | |
| $content, | |||
| $removephppart = 0, | |||
| $contenttype = 'html', | |||
| $containerid = 0 ) |
Convert a page content to have correct links (based on DOL_URL_ROOT) into an html content.
It replaces also dynamic content with '...php...' Used to output the page on the Preview from backoffice.
| Website | $website | Web site object |
| string | $content | Content to replace |
| int | $removephppart | 0=Replace PHP sections with a PHP badge. 1=Remove completely PHP sections. |
| string | $contenttype | Content type |
| int | $containerid | Contenair id |
Definition at line 123 of file website.lib.php.
References dol_syslog(), and dolStripPhpCode().
| getAllImages | ( | $object, | |
| $objectpage, | |||
| $urltograb, | |||
| & | $tmp, | ||
| & | $action, | ||
| $modifylinks = 0, | |||
| $grabimages = 1, | |||
| $grabimagesinto = 'subpage' ) |
Download all images found into an external URL.
It using a text regex parsing solution, not a DOM analysis. If $modifylinks is set, links to images will be replace with a link to viewimage wrapper. To extract an URL from a HTML text content, see instead getImageFromHtmlContent().
| Website | $object | Object website |
| WebsitePage | $objectpage | Object website page |
| string | $urltograb | URL to grab (example: https://www.nltechno.com/ or s://www.nltechno.com/dir1/ or https://www.nltechno.com/dir1/mapage1) |
| string | $tmp | Content to parse |
| string | $action | Var $action |
| int<0,1> | $modifylinks 0=Do not modify content, 1=Replace links with a link to viewimage | |
| int<0,1> | $grabimages 0=Do not grab images, 1=Grab images | |
| 'root'|'subpage' | $grabimagesinto 'root' or 'subpage' |
Definition at line 1446 of file website.lib.php.
References $conf, $object, dol_mkdir(), dol_syslog(), dolChmod(), getRootURLFromURL(), getURLContent(), and setEventMessages().
| getImageFromHtmlContent | ( | $htmlContent, | |
| $imageNumber = 1 ) |
Return the URL of an image found into a HTML content.
To get image from an external URL to download first, see getAllImages()
| string | $htmlContent | HTML content |
| int | $imageNumber | The position of image. 1 by default = first image found |
Definition at line 1395 of file website.lib.php.
Referenced by build_rssfile(), and getStructuredData().
| getImagePublicURLOfObject | ( | $object, | |
| $no = 1, | |||
| $extName = '', | |||
| $cover = 1 ) |
Return the public image URL of an object.
For example, you can get the public image URL of a product (image that is shared).
| Object | $object | Object |
| int | $no | Numero of image (if there is several images. 1st one by default) |
| string | $extName | Extension to differentiate thumb file name ('', '_small', '_mini') |
| int | $cover | 1=Sort with cover then position, -1=Filter on cover last then position, 0=Exclude cover and filter on position first |
Definition at line 1087 of file website.lib.php.
References $object, and getListOfPossibleImageExt().
| getNbOfImagePublicURLOfObject | ( | $object | ) |
Return nb of images known into inde files for an object;.
| Object | $object | Object |
Definition at line 1048 of file website.lib.php.
References $object, and getListOfPossibleImageExt().
| getNewsDetailsById | ( | $postId | ) |
Retrieves the details of a news post by its ID.
| string | $postId | The ID of the news post to retrieve. |
Definition at line 1603 of file website.lib.php.
| getPagesFromSearchCriterias | ( | $type, | |
| $algo, | |||
| $searchstring, | |||
| $max = 25, | |||
| $sortfield = 'date_creation', | |||
| $sortorder = 'DESC', | |||
| $langcode = '', | |||
| $otherfilters = [], | |||
| $status = 1 ) |
Return list of containers object that match a criteria.
WARNING: This function can be used by websites.
| string | $type | Type of container to search into (Example: '', 'page', 'blogpost', 'page,blogpost', ...) |
| string | $algo | Algorithm used for search (Example: 'meta' is searching into meta information like title and description, 'content', 'sitefiles', or any combination 'meta,content,sitefiles') |
| string | $searchstring | Search string |
| int | $max | Max number of answers |
| string | $sortfield | Sort Fields |
| 'DESC'|'ASC' | $sortorder Sort order ('DESC' or 'ASC') | |
| string | $langcode | Language code ('' or 'en', 'fr', 'es', ...) |
| array<string,mixed> | $otherfilters Other filters | |
| int<-1,1> | $status 0 or 1, or -1 for both |
Definition at line 1226 of file website.lib.php.
References $conf.
| getPublicFilesOfObject | ( | $object | ) |
Return array with list of all public files of a given object.
| Object | $object | Object |
Definition at line 1166 of file website.lib.php.
References $object, and getListOfPossibleImageExt().
| getSocialNetworkHeaderCards | ( | $params = null | ) |
Return HTML content to add as header card for an article, news or Blog Post or home page.
| ?array<string,mixed> | $params Array of parameters |
Definition at line 916 of file website.lib.php.
References $conf.
| getSocialNetworkSharingLinks | ( | $socialnetworks = '' | ) |
Return HTML content to add structured data for an article, news or Blog Post.
| string | $socialnetworks | '' or list of social networks |
Definition at line 992 of file website.lib.php.
References dol_escape_htmltag().
| getStructuredData | ( | $type, | |
| $data = array() ) |
Return HTML content to add structured data for an article, news or Blog Post.
Use the json-ld format. Example: <?php getStructureData('blogpost'); ?> <?php getStructureData('software', array('name'=>'Name', 'os'=>'Windows', 'price'=>10)); ?>
| string | $type | 'blogpost', 'product', 'software', 'organization', 'qa', ... |
| array<string,mixed> | $data Array of data parameters for structured data |
Definition at line 704 of file website.lib.php.
References $conf, dol_escape_json(), dol_print_date(), dol_string_nohtmltag(), dolStripPhpCode(), and getImageFromHtmlContent().
| includeContainer | ( | $containerref, | |
| $once = 0, | |||
| $cachedelay = 0, | |||
| $cachekey = '' ) |
Execute content of a php page and report result to be included into another page.
It outputs content of file where the html and body part have been removed.
| string | $containerref | Path to file to include (must be a page from website root. Example: 'mypage.php' means 'mywebsite/mypage.php') |
| int | $once | If set to 1, we use include_once. |
| int | $cachedelay | A cache delay in seconds. |
| string | $cachekey | Add a key into the name of the cache so the includeContainer can use different cache content for the same page. |
Definition at line 608 of file website.lib.php.
References $conf, dolChmod(), and getDolGlobalString().
| redirectToContainer | ( | $containerref, | |
| $containeraliasalt = '', | |||
| $containerid = 0, | |||
| $permanent = 0, | |||
| $parameters = array(), | |||
| $parampropagation = 1 ) |
Format img tags to introduce viewimage on img src.
| string | $content | Content string |
| string | $containerref | Ref of container to redirect to (Example: 'mypage' or 'mypage.php'). |
| string | $containeraliasalt | Ref of alternative aliases to redirect to. |
| int | $containerid | Id of container. |
| int<0,1> | $permanent 0=Use temporary redirect 302 (default), 1=Use permanent redirect 301 | |
| array<string,mixed> | $parameters Array of parameters to append to the URL. | |
| int<0,1> | $parampropagation 0=Do not propagate query parameter in URL when doing the redirect, 1=Keep parameters (default) |
Definition at line 520 of file website.lib.php.
References setEventMessages().