Skip to content

Commit

Permalink
Merge pull request #45 from nguyenanhung/develop
Browse files Browse the repository at this point in the history
Add Helper Function: bear_framework_show_jsonld_script
  • Loading branch information
nguyenanhung authored Sep 24, 2023
2 parents 8c7923d + 0bb7e77 commit 7e7dd64
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 12 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ Các hàm này dùng debug
- [x] Helper Function: `strip_only_tags`
- [x] Helper Function: `tracking_google_analytics`
- [x] Helper Function: `tracking_google_gtag_analytics_default`
- [x] Helper Function: `bear_framework_show_jsonld_script`

### Image Helper

Expand Down
33 changes: 23 additions & 10 deletions helpers/html_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ function meta_dns_prefetch()
* Function meta_property
*
* @param string|array $property
* @param string $content
* @param string $type
* @param string $newline
* @param string $content
* @param string $type
* @param string $newline
*
* @return string
* @author : 713uk13m <dev@nguyenanhung.com>
Expand All @@ -43,9 +43,9 @@ function meta_property($property = '', $content = '', $type = 'property', $newli
$property = array(
array(
'property' => $property,
'content' => $content,
'type' => $type,
'newline' => $newline
'content' => $content,
'type' => $type,
'newline' => $newline
)
);
} elseif (isset($property['property'])) {
Expand Down Expand Up @@ -118,7 +118,7 @@ function stripHtmlTag($str)
*
* @param $str
* @param $tags
* @param bool $stripContent
* @param bool $stripContent
*
* @return string|string[]|null
* @author : 713uk13m <dev@nguyenanhung.com>
Expand Down Expand Up @@ -216,9 +216,9 @@ function gtag() {
/**
* Create a XHTML tag
*
* @param string $tag The tag name
* @param array|string $attr The tag attributes
* @param string|bool $content The content to place in the tag, or false for no closing tag
* @param string $tag The tag name
* @param array|string $attr The tag attributes
* @param string|bool $content The content to place in the tag, or false for no closing tag
*
* @return string
*/
Expand Down Expand Up @@ -250,3 +250,16 @@ function html_tag($tag, $attr = array(), $content = false)
return $html;
}
}
if (!function_exists('bear_framework_show_jsonld_script')) {
function bear_framework_show_jsonld_script($content)
{
$content = trim($content);
if (empty($content)) {
return $content;
}
$start = '<script type="application/ld+json">';
$end = '</script>';
return $start . PHP_EOL . $content . PHP_EOL . $end;
}
}

4 changes: 2 additions & 2 deletions src/BaseHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
*/
class BaseHelper
{
const VERSION = '1.5.9';
const LAST_MODIFIED = '2023-09-20';
const VERSION = '1.5.9.1';
const LAST_MODIFIED = '2023-09-24';
const PROJECT_NAME = 'CodeIgniter - Basic Helper';
const AUTHOR_NAME = 'Hung Nguyen';
const AUTHOR_FULL_NAME = 'Hung Nguyen';
Expand Down

0 comments on commit 7e7dd64

Please sign in to comment.