1616 * @copyright 713uk13m <dev@nguyenanhung.com>
1717 *
1818 * $config['canonical_url'] = null;
19- $config['site_title'] = "Site Title";
20- $config['site_description'] = "Site Description";
21- $config['site_image'] = null;
22- $config['twitter_user'] = "@tw_username";
23- $config['fb_app_id'] = null;
24- $config['fb_page_id'] = null;
19+ * $config['site_title'] = "Site Title";
20+ * $config['site_description'] = "Site Description";
21+ * $config['site_image'] = null;
22+ * $config['twitter_user'] = "@tw_username";
23+ * $config['fb_app_id'] = null;
24+ * $config['fb_page_id'] = null;
2525 */
2626class CI_Seo_onpage
2727{
@@ -35,6 +35,11 @@ public function __construct()
3535 $ this ->CI ->load ->helper ('url ' );
3636 }
3737
38+ public function published ($ title = "" , $ description = "" , $ image = "" )
39+ {
40+ $ this ->set_tags ($ title , $ description , $ image );
41+ }
42+
3843 public function set_tags ($ title = "" , $ description = "" , $ image = "" )
3944 {
4045 $ current_url = current_url ();
@@ -48,7 +53,7 @@ public function set_tags($title = "", $description = "", $image = "")
4853 $ this ->set_canonical ();
4954 }
5055
51- private function set_title_tags ($ title )
56+ protected function set_title_tags ($ title )
5257 {
5358 if ($ title !== "" ) {
5459 echo "<title> $ title</title> \n" ;
@@ -63,7 +68,7 @@ private function set_title_tags($title)
6368
6469 }
6570
66- private function set_description_tags ($ description )
71+ protected function set_description_tags ($ description )
6772 {
6873 if ($ description !== "" ) {
6974 echo "<meta name='description' content=' $ description'/> \n" ;
@@ -76,7 +81,7 @@ private function set_description_tags($description)
7681 }
7782 }
7883
79- private function set_image_tags ($ image )
84+ protected function set_image_tags ($ image )
8085 {
8186 $ image_path = null ;
8287
@@ -96,14 +101,14 @@ private function set_image_tags($image)
96101 }
97102 }
98103
99- private function set_twitter_tags ()
104+ protected function set_twitter_tags ()
100105 {
101106 if ($ this ->CI ->config ->item ('twitter_user ' ) !== "" ) {
102107 echo "<meta name='twitter:site' content=' " . $ this ->CI ->config ->item ('twitter_user ' ) . "' /> \n" ;
103108 }
104109 }
105110
106- private function set_facebook_tags ()
111+ protected function set_facebook_tags ()
107112 {
108113 if ($ this ->CI ->config ->item ('fb_page_id ' ) !== "" ) {
109114 echo "<meta property='fb:pages' content=' " . $ this ->CI ->config ->item ('fb_page_id ' ) . "' /> \n" ;
@@ -114,14 +119,14 @@ private function set_facebook_tags()
114119 }
115120 }
116121
117- private function set_canonical ()
122+ protected function set_canonical ()
118123 {
119124 if ($ this ->CI ->config ->item ('canonical_url ' ) !== "" ) {
120125 echo "<link rel='canonical' href=' " . $ this ->CI ->config ->item ('canonical_url ' ) . "' /> \n" ;
121126 }
122127 }
123128
124- private function format_image_tags ($ image_path )
129+ protected function format_image_tags ($ image_path )
125130 {
126131 $ path = parse_url ($ image_path );
127132
0 commit comments