Changeset 7624
- Timestamp:
- Nov 4, 2010, 8:56:36 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/meta/main.inc.php
r7518 r7624 29 29 30 30 //Gestion des meta dans le header 31 add_event_handler('loc_begin_page_header', 'add_meta',56 ); 31 add_event_handler('loc_begin_page_header', 'Change_Meta',20 ); 32 add_event_handler('loc_end_page_header', 'add_meta',56 ); 32 33 add_event_handler('loc_begin_page_header', 'add_metacat',61 ); 33 34 add_event_handler('loc_begin_page_header', 'add_metaimg',71 ); 34 35 add_event_handler('loc_after_page_header', 'set_meta_back',81); 36 37 function Change_Meta() 38 { 39 global $template; 40 $template->set_prefilter('header', 'upmata'); 41 } 42 43 function upmata ($content, &$smarty) 44 { 45 $search = '#<meta name="description" content=".*?">#'; 46 47 $replacement = '<meta name="description" content="{$PLUG_META}">'; 48 49 return preg_replace($search, $replacement, $content); 50 } 51 52 35 53 36 54 function add_meta() … … 41 59 $meta_infos['related_tags'] = $template->get_template_vars('related_tags'); 42 60 $meta_infos['info'] = $template->get_template_vars('INFO_FILE'); 43 $meta_infos[' comment'] = $template->get_template_vars('COMMENT_IMG');61 $meta_infos['title'] = $template->get_template_vars('PAGE_TITLE'); 44 62 45 63 $query = ' … … 72 90 73 91 // Description 74 if (!empty($meta_infos['info']) and !empty($meta['Description'])) 75 { 76 $template->assign('INFO_FILE', $meta_infos['info'] . ', ' . $meta['Description']); 92 if (!empty($meta_infos['title']) and !empty($meta_infos['info']) and !empty($meta['Description'])) 93 { 94 $template->assign('PLUG_META', $meta_infos['title']. ' - ' .$meta_infos['info'] . ', ' . $meta['Description']); 95 } 96 elseif (!empty($meta_infos['title']) and !empty($meta['Description'])) 97 { 98 $template->assign('PLUG_META', $meta_infos['title']. ' - ' .$meta['Description']); 77 99 } 78 100 elseif (!empty($meta['Description'])) 79 101 { 80 $template->assign(' INFO_FILE', $meta['Description']);81 } 82 102 $template->assign('PLUG_META', $meta['Description']); 103 } 104 83 105 // Robots 84 106 if (!empty($meta['robots'])) … … 95 117 $meta_infos['related_tags'] = $template->get_template_vars('related_tags'); 96 118 $meta_infos['info'] = $template->get_template_vars('INFO_FILE'); 97 $meta_infos['comment'] = $template->get_template_vars('COMMENT_IMG');98 99 119 100 120 //meta categories … … 122 142 if (!empty($row['metadescat'])) 123 143 { 124 $template->assign('COMMENT_IMG', $row['metadescat']); 125 $template->clear_assign('INFO_FILE'); 144 $template->assign('PLUG_META', $row['metadescat']); 126 145 } 127 146 } … … 135 154 $meta_infos['related_tags'] = $template->get_template_vars('related_tags'); 136 155 $meta_infos['info'] = $template->get_template_vars('INFO_FILE'); 137 $meta_infos['comment'] = $template->get_template_vars('COMMENT_IMG'); 156 138 157 //meta images 139 158 if ( !empty($page['image_id']) ) … … 160 179 if (!empty($row['metadesimg'])) 161 180 { 162 $template->assign('COMMENT_IMG', $row['metadesimg']); 163 $template->clear_assign('INFO_FILE'); 181 $template->assign('PLUG_META', $row['metadesimg']); 164 182 } 165 183 … … 178 196 'related_tags' => $meta_infos['related_tags'], 179 197 'INFO_FILE' => $meta_infos['info'], 180 'COMMENT_IMG' => $meta_infos['comment']181 198 ) 182 199 );
Note: See TracChangeset
for help on using the changeset viewer.