Changeset 4523
- Timestamp:
- Dec 19, 2009, 9:03:53 PM (14 years ago)
- Location:
- extensions/LLGBO2
- Files:
-
- 16 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/LLGBO2/main.inc.php
r4292 r4523 2 2 /* 3 3 Plugin Name: Look_like_gbo2 4 Version: 2.0. h4 Version: 2.0.I 5 5 Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=251 6 6 Author: Ex-Ftb … … 9 9 Add a border around picture ...... 10 10 */ 11 /* 2.0.c2 fix null value in js <> in IE,FF, chrome*/12 11 /* 2.0.d fix notice when HD picture is desactivate*/ 13 /* 2.0.e fix notice with redirect.tpl */ 14 /* 2.0.f always display metadata + maintain IPTC */ 15 /* 2.0.h new languages PL, ES, HU */ 12 /* 2.0.e fix notice with redirec.tpl */ 13 /* 2.0.f Tooltip and frame define by plugin vs Css*/ 14 /* 2.0.h new languages PL, ES, HU */ 15 /* 2.0.i Manage tab for tooltip and frame settings */ 16 16 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 17 17 /* création d'une instance de la classe */ 18 18 $obj = new look_like_gbo(); /* class loading */ 19 global $conf,$conf_LLGBO; 20 21 define ('LLGBO_INFO_VERSION','2.0.h'); 19 global $conf,$ttvalues,$plugvalues,$frvalues; 20 define ('LLGBO_INFO_VERSION','2.0.I'); 22 21 define('LLGBO_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/'); 23 $conf_LLGBO = explode("," , $conf['LLGBO']); 24 //print_r ($conf_LLGBO); 25 $conf_LLGBO['fsize'] = getimagesize(LLGBO_PATH.'pictures/chg_25.png');/* width of a cormer*/ 26 // 22 23 $conf['LLGBO_SETTINGS'] = explode("," , $conf['LLGBO']); 24 $conf['LLGBO_TOOLTIP'] = explode(",",$conf['LLGBOTOOLTIP']); 25 $conf['LLGBO_FRAME'] = explode (",",$conf['LLGBOFRAME']); 26 ///////////////////////////////////////////////////// 27 27 /* plugin Class */ 28 28 class look_like_gbo … … 32 32 array( 33 33 'NAME' => 'Look_like_GBo', 34 'URL' => get_admin_plugin_menu_link(dirname(__FILE__).'/admin/llgbo_admin.php') 35 ) 36 ); 34 'URL' => get_admin_plugin_menu_link(dirname(__FILE__).'/admin/llgbo_admin.php') )); 37 35 return $menu; } 38 36 39 37 /* always display metadata */ 40 38 function AutoDisplayMetadata() 41 {global $conf_LLGBO; 42 If ($conf_LLGBO[10] == 'true' ) //always display metadata 43 {if ( pwg_get_session_var('show_metadata') == null ) 44 { pwg_set_session_var('show_metadata', 1 ); } 45 } 39 {global $conf; 40 If ($conf['LLGBO_SETTINGS'] [2] == 'true' ) // exif under bt 41 {$_GET['metadata'] = 'O';} 46 42 } 47 43 48 44 // reset nofollow, noindex 49 45 function MyBeginheader() 50 { global $page,$conf_LLGBO; 51 If ($conf_LLGBO[10] == 'true' ) // reset nofollow, noindex 52 { unset ($page['meta_robots']);} 46 { global $page,$conf; 47 // echo '-10-'.$conf['LLGBO_SETTINGS',10]; 48 If ($conf['LLGBO_SETTINGS'][2] == 'true' ) // reset nofollow, noindex 49 { unset ($page['meta_robots']);} 53 50 } 54 51 // manage H E A D E R 55 52 function Myheader() 56 { global $template,$conf_LLGBO; 57 $Page_body = $template->get_template_vars('BODY_ID'); 58 $Categories = $template->get_template_vars('U_MODE_FLAT'); // Home page 59 60 61 If ($conf_LLGBO[6] == 'true' ) //display Header on home page 62 { if (strpos( $Categories ,'categories') === False ) 63 { $exclu = strtoupper($Page_body); /* maintain header on user define page */ 64 if ($exclu == '') {$exclu = '¤¤¤¤¤¤';} // Pb with redirect.tpl 65 if (strpos( strtoupper($conf_LLGBO[7]),$exclu) === False) 66 {$template->append('head_elements',"\n".' <STYLE type="text/css">#theHeader{display: none}</STYLE>'); 67 } 68 } 69 } 70 if ( $Page_body == 'thePicturePage') 71 { If (($conf_LLGBO[1] == 'true' )/* tooltip */ or ($conf_LLGBO[0] == 'true') /* frame */ ) 72 {$linkcss = '<link rel="stylesheet" type="text/css" href="'.LLGBO_PATH; 73 $template->append('head_elements',$linkcss.'css/gbolook.css">');} 74 } 75 76 //-------------------------------------- 77 // 78 If ($conf_LLGBO[9] == 'true' and $Page_body == 'thePicturePage') 79 {$template->append('head_elements',"\n".' <STYLE type="text/css">.navThumb{display: none} </STYLE>');} 53 {global $template,$conf; 54 $Page_body = $template->get_template_vars('BODY_ID'); 55 $Categories = $template->get_template_vars('U_MODE_FLAT'); // Home page 56 if ((isset ($Page_body)) )// pb with redirect.tpl 57 {If ($conf['LLGBO_SETTINGS'][6] == 'true' ) //display Header on home page 58 { if (strpos( $Categories ,'categories') === False ) 59 { $exclu = strtoupper($Page_body); /* maintain header on user define page */ 60 if (strpos( strtoupper($conf['LLGBO_SETTINGS'] [7]),$exclu) === False) 61 {$template->append('head_elements',"\n".' <STYLE type="text/css">#theHeader{display: none}</STYLE>');} 62 } 63 } 64 65 // 66 If ($conf['LLGBO_SETTINGS'] [9] == 'true' and $Page_body == 'thePicturePage') 67 {$template->append('head_elements',"\n".' <STYLE type="text/css">.navThumb{display: none} </STYLE>');} 68 } 80 69 } // end header 81 70 82 71 //* improve functionnalities --> picture.tpl 83 72 function DisplayGboLook() 84 { global $template,$conf_LLGBO; 85 $u_metadata = $template->get_template_vars('U_METADATA'); 86 $swt = ' swttips="'; 87 If ($conf_LLGBO[2] == 'true' ) // exif under bt 88 { $metadata = $template->get_template_vars('metadata'); 89 if(is_array($metadata)) 90 {foreach($metadata[0] as $cle =>$tableau) 91 { if(is_array($tableau)) 92 {foreach($tableau as $cle=>$valeur) 93 { $swt= $swt.$cle.' : '.$valeur.'<br>'; } 94 } } 95 /* IPTC 96 foreach($metadata[1] as $cle =>$tableau) 97 { if(is_array($tableau)) 98 {foreach($tableau as $cle=>$valeur) 99 { $swt= $swt.$cle.' : '.'<br>'.$valeur.'<br>'; } 100 } } */ 101 $template->assign( 'U_METADATA', $u_metadata.'"'.$swt); 102 unset ($metadata[0]); 103 $template-> assign('metadata', $metadata);} // keep iptc under picture 104 } 105 // compatibility with extended description 106 $ThePicture = $template->get_template_vars('current'); 107 $comment = $template->get_template_vars('COMMENT_IMG'); 108 if (!isset($comment) ) 109 {$template->assign( 'COMMENT_IMG' , $ThePicture['comment']);} 73 { global $template,$conf; 74 $u_metadata = $template->get_template_vars('U_METADATA'); 75 $swt = ' swttips="'; 76 If ($conf['LLGBO_SETTINGS'] [2] == 'true' ) // exif under bt 77 { $metadata = $template->get_template_vars('metadata'); 78 if(is_array($metadata)) 79 {foreach($metadata[0] as $cle =>$tableau) 80 { if(is_array($tableau)) 81 {foreach($tableau as $cle=>$valeur) 82 { $swt= $swt.$cle.' : '.$valeur.'<br>'; } 83 } } 84 $template->assign( 'U_METADATA', $u_metadata.'"'.$swt); 85 $template->clear_assign('metadata'); 86 } // hide original metadata 87 } 88 110 89 } 111 /* ------ Manage frame ---------------- */ 90 91 /* ------ Manage picture page---------------- */ 112 92 function MyPictureOptions($content ) 113 {global $template,$conf_LLGBO,$conf,$user; 93 {global $template,$conf,$user; 94 $sweetcss = ' <! --- LLGBO tooltip css--> 95 <style type="text/css"> 96 div#toolTip {position:absolute;z-index:1000;width:'.$conf['LLGBO_TOOLTIP'][0].'px;background:'.$conf['LLGBO_TOOLTIP'][3].';color:'.$conf['LLGBO_TOOLTIP'][5].';border:'.$conf['LLGBO_TOOLTIP'][1].'px solid '.$conf['LLGBO_TOOLTIP'][2].';padding:5px;min-height:1em;-moz-border-radius:5px} 97 div#toolTip p {margin:0;padding:0;color:'.$conf['LLGBO_TOOLTIP'][5].';font-size:0.8em;font-family:Verdana,Arial,Helvetica,sans-serif;text-align:left} 98 div#toolTip p em {display:block;margin-top:3px;font-style:normal;font-weight:bold;text-align:left} 99 div#toolTip p.title {color:'.$conf['LLGBO_TOOLTIP'][4].';text-align:center;padding:0 0 3px 0;} 100 </style>'; 114 101 // ----------- add JS tooltip in header ---------------------- 115 If (($conf _LLGBO[1] == 'true' ) /* tooltip */ or ($conf_LLGBO[2] == 'true' ) /* exif under bt */ )102 If (($conf['LLGBO'][1] == 'true' ) /* tooltip */ or ($conf['LLGBO_SETTINGS'] [2] == 'true' ) /* exif under bt */ ) 116 103 { $javacss = '<script type="text/javascript" charset="utf-8" src="'.LLGBO_PATH; 117 104 $linkcss = '<link rel="stylesheet" type="text/css" href="'.LLGBO_PATH; 118 $sweetcss = "\n".$linkcss.'css/sweettitles.css">'."\n".$javacss.'js/sweettitlesn.js"></script>'."\n";105 $sweetcss = $sweetcss."\n".$javacss.'js/sweettitlesn.js"></script>'."\n"; 119 106 $template->append('head_elements',$sweetcss); } 120 $template->assign('PLUG_REL_PATH', LLGBO_PATH); 107 121 108 // Navigation improvement are always available 122 109 $ThePicture = $template->get_template_vars('current'); … … 129 116 $prevthumb_title = $prev['TITLE']; 130 117 $usemap =''; 131 If ($conf_LLGBO[1] == 'true' )/* tooltip */ 132 { 118 If ($conf['LLGBO_SETTINGS'][1] == 'true' )/* tooltip */ 119 { $nextthumb_title = $next['TITLE']; 120 $prevthumb_title = $prev['TITLE']; 133 121 if (isset($first)){$template->assign('first', array('TITLE' => $first['TITLE'].'"'.$swtimg.$first['THUMB_SRC'].'>', 134 122 'U_IMG' => $first['U_IMG']));} … … 140 128 'U_IMG' => $last['U_IMG']));} 141 129 } 142 143 130 ///////////////////////////////////////////// 144 131 // an other plugin is working -> go back … … 148 135 ///////////////////////////////////////////////////////////////// 149 136 if ($ThePicture['is_picture'] <> 1 ) { return ; } 150 ///////////////////////////////////////////////////////////////// 151 If (($conf_LLGBO[0] == 'true') /* frame */ ) 152 { $template->assign('FRAME', 'ok'); 153 $template->assign(array( 154 'WIDTH_GBO' => $ThePicture['scaled_width'] + ( 2 * $conf_LLGBO['fsize'][0] /* frame width*/ ), 155 'WIDTH_FRAME' => $conf_LLGBO['fsize'][0], 156 'HEIGHT_FRAME' => $conf_LLGBO['fsize'][1]/* frame height*/ )); 157 If ($conf_LLGBO[5] == 'true' ) // title on frame 158 {$template->assign( array( 'TITLE_FRAME' => $ThePicture['name'] )); } 159 }// end frame 160 else // no frame 161 {$template->clear_assign('FRAME') ;} 162 If ($conf_LLGBO[3] == 'true' ) // usemap 137 ///////////////////////////////////////////////////////////////// 138 If (($conf['LLGBO_SETTINGS'] [1] == 'true' )/* tooltip display */ or ($conf['LLGBO_SETTINGS'] [0] == 'true') /* frame */ ) 139 {$linkcss = '<link rel="stylesheet" type="text/css" href="'.LLGBO_PATH; 140 $template->append('head_elements',$linkcss.'css/gbolook.css">');} 141 142 If ($conf['LLGBO_SETTINGS'] [3] == 'true' ) // usemap 163 143 { $usemap = '" usemap="#prevnext' ; 164 144 $imgw = $ThePicture['scaled_width']; 165 145 $imgh = $ThePicture['scaled_height']; 166 $dummy = round($imgw /15);167 146 $template->assign(array( 168 /* left --> Prev */ 169 'LEFT_X1' => 0, 'LEFT_Y1' => 0, 170 'LEFT_X2' => round($imgw * 0.22), 'LEFT_Y2' => $imgh , 171 /* up */ 172 'UP_X1' => round($imgw * 0.22) + $dummy, 'UP_Y1' => 0, 173 'UP_X2' => round($imgw * 0.78), 'UP_Y2' => round($imgh * 0.50), 174 /* high */ 175 'HIGH_X1' => round($imgw * 0.22) + $dummy, 'HIGH_Y1' => round($imgh * 0.50) + $dummy, 176 'HIGH_X2' => round($imgw * 0.78), 'HIGH_Y2' => $imgh, 177 /* right -> next */ 178 'RIGHT_X1' => round($imgw * 0.78) + $dummy, 'RIGHT_Y1' => 0, 179 'RIGHT_X2' => $imgw , 'RIGHT_Y2' => $imgh )); 180 $template->assign( 'USEMAP', 'ok' ); 147 /* left --> Prev */ 'LEFT_X1' => 0, 'LEFT_Y1' => 0, 148 'LEFT_X2' => round($imgw * 0.24), 'LEFT_Y2' => $imgh , 149 /* up */ 'UP_X1' => round($imgw * 0.24) , 'UP_Y1' => 0, 150 'UP_X2' => round($imgw * 0.76), 'UP_Y2' => round($imgh * 0.50), 151 /* high */ 'HIGH_X1' => round($imgw * 0.24) , 'HIGH_Y1' => round($imgh * 0.50) , 152 'HIGH_X2' => round($imgw * 0.76), 'HIGH_Y2' => $imgh, 153 /* right -> next */ 'RIGHT_X1' => round($imgw * 0.76) , 'RIGHT_Y1' => 0, 154 'RIGHT_X2' => $imgw , 'RIGHT_Y2' => $imgh )); 155 $template->assign( 'USEMAP', 'ok' ); 181 156 182 If ($conf _LLGBO[4] === 'true' ) // usemap and Display Thumb157 If ($conf['LLGBO_SETTINGS'] [4] === 'true' ) // usemap and Display Thumb 183 158 { $template->assign(array('NEXTTHUMB' => $swtimg.$next['THUMB_SRC'].'>"', 184 159 'NEXTTHUMBTITLE' => $nextthumb_title, 185 160 'PREVTHUMB' => $swtimg.$prev['THUMB_SRC'].'>"', 186 'PREVTHUMBTITLE' => $prevthumb_title));} 187 161 'PREVTHUMBTITLE' => $prevthumb_title));} 188 162 } // end usemap 189 163 $alt = $conf['allow_html_descriptions'] ? $ThePicture['name'] : strip_tags($ThePicture['name']); 190 164 $template->assign( array( 191 165 'SRC_IMG' => $ThePicture['image_url'], 192 166 'WIDTH_IMG' => $ThePicture['scaled_width'], 193 167 'HEIGHT_IMG' => $ThePicture['scaled_height'], 168 'COMMENT_IMG' => $conf['allow_html_descriptions'] ? $ThePicture['comment'] : strip_tags($ThePicture['comment']), 194 169 'ALT_IMG' => $alt.$usemap 195 170 )); … … 202 177 'UUID' => $uuid, ));} 203 178 204 205 If (($conf_LLGBO[5] == 'true' ) /* title on frame */ and ($conf_LLGBO[0] == 'true' )) // display frame 206 { $template->assign('SHOW_PICTURE_NAME_ON_TITLE', false);}179 If (($conf['LLGBO_SETTINGS'] [5] == 'true' ) /* title on frame */ and ($conf['LLGBO_SETTINGS'] [0] == 'true' )) // display frame 180 { $template->assign('SHOW_PICTURE_NAME_ON_TITLE', false); 181 $template->assign('TITLE_FRAME_COLOR', $conf['LLGBO_FRAME'][0]); } 207 182 208 If ($conf_LLGBO[8] == 'off' ) /* less infos*/ 209 { /* enregistrer le filtre de pr?-compilation */} 183 /* HTML frame */ 184 If (($conf['LLGBO_SETTINGS'] [0] == 'true') ) 185 { $bd = 0; 186 $frame_begin =''; 187 $frame_end=''; 188 for ($x = 1 ;$x < 32 ; $x =$x +2) 189 { if ((isset($conf['LLGBO_FRAME'][$x+1])) and ($conf['LLGBO_FRAME'][$x+1] > 0)) // boder value > 0 190 {$frame_begin = '<div style="border: '.$conf['LLGBO_FRAME'][$x+1].'px solid '.$conf['LLGBO_FRAME'][$x].'">'."\n".$frame_begin; 191 $bd = $bd + $conf['LLGBO_FRAME'][$x+1]; //define border sum 192 $frame_end = $frame_end .' </div>'; 193 } 194 } 195 $frame_width = $ThePicture["scaled_width"] + (2 * $bd); 196 $frame_height = $ThePicture["scaled_height"] + (2 * $bd); 197 $template->assign('FRAME_SIZE','style="width:'.$frame_width .'px; height:'.$frame_height.'px;"'); 198 $template->assign('FRAME_BEGIN', $frame_begin); 199 $template->assign('FRAME_END', $frame_end); 200 // title on frame 201 If ($conf['LLGBO_SETTINGS'] [5] == 'true' ) // title on frame 202 {$template->assign( array( 'TITLE_FRAME' => $ThePicture['name'] )); } 203 } // end frame 204 else // no frame 205 {$template->clear_assign('FRAME_BEGIN') ;} 210 206 211 207 $template->set_filenames( array('gbo_content'=> dirname(__FILE__).'/template/picture_content.tpl') ); 212 208 return $template->parse( 'gbo_content', true); 213 } 214 209 } //end --> MyPictureOptions 215 210 } // End class 216 211 … … 224 219 add_event_handler('get_admin_plugin_menu_links', array(&$obj, 'plugin_admin_menu') ); 225 220 set_plugin_data($plugin['id'], $obj); 226 function afficher_tableau($tableau)227 {228 // on fait une boucle qui lit les éléments du tableau229 foreach ($tableau as $cle=>$valeur)230 {231 // si l'un des éléments est lui même un tableau232 // alors on applique la fonction à ce tableau233 if(is_array($valeur))234 {235 // on affiche le nom de la clé et236 // le début d'une liste pour237 // décaler le contenu vers la droite238 print_r ($cle);239 echo ' : <ul>';240 241 // ici se réalise la récursivité242 // c'est à dire qu'on applique la fonction243 // à l'élément en cours car c'est lui aussi un tableau244 afficher_tableau($valeur);245 246 // on ferme la liste247 echo '</ul>';248 }249 }250 }251 252 221 ?> -
extensions/LLGBO2/maintain.inc.php
r4292 r4523 30 30 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 31 31 function plugin_install() 32 33 { global $prefixeTable; 34 plugin_uninstall(); // en cas de mauvaise deinstallation anterieure 32 { global $prefixeTable,$conf,$ttvalues,$plugvalues,$frvalues; 33 plugin_uninstall(); // en cas de mauvaise deinstallation anterieure 35 34 $q = ' 36 35 INSERT INTO '.CONFIG_TABLE.' (param,value,comment) 37 VALUES 38 ("LLGBO"," true,true,true,true,true,true,true,theAboutPage;theTagsPage;theCommentsPage;theIdentificationPage;theAdminPage,true,true,true","Look like gbosettings");';36 VALUES 37 ("LLGBO","'.$plugvalues.'","look like gbo global settings");'; 39 38 pwg_query($q); 39 $q = ' 40 INSERT INTO '.CONFIG_TABLE.' (param,value,comment) 41 VALUES 42 ("LLGBOTOOLTIP","'.$ttvalues.'","look like gbo tooltip settings");'; 43 pwg_query($q); 44 $q = ' 45 INSERT INTO '.CONFIG_TABLE.' (param,value,comment) 46 VALUES 47 ("LLGBOFRAME","'.$frvalues.'","look like gbo frame settings");'; 48 pwg_query($q); 49 50 $conf['LLGBO_SETTINGS'] = explode("," , $plugvalues); 51 $conf['LLGBO_TOOLTIP'] = explode(",",$ttvalues); 52 $conf['LLGBO_FRAME'] = explode (",", $frvalues); 53 40 54 } 41 55 function plugin_activate() 42 { global $conf; 43 // Vérification de la config, si pas bon -> reinstallation 44 if ((!isset($conf['LLGBO'])) or (substr_count($conf['LLGBO'] , ',') != 10)) { 45 $conf['LLGBO'] = "true,true,true,true,true,true,true,theAboutPage;theTagsPage;theCommentsPage;theIdentificationPage;theAdminPage,true,true,true"; 46 plugin_install();} 56 { global $prefixeTable,$conf,$ttvalues,$plugvalues,$frvalues; 57 /////////////////////////////////////////////////// 58 // Vérification de la config, si pas bon -> reinstallation 59 $plugvalues = "true,true,true,true,true,true,true,theAboutPage;theTagsPage;theCommentsPage;theIdentificationPage;theAdminPage,true,true"; 60 $ttvalues = "150,2,#fff,#000,#c92,#dadada"; 61 $frvalues = "#16195f,#ffffff,3,#040404,1,#ffffff,7,#ffffff,1,#fdfdfd,1,#fcfcfc,1,#fafafa,1,#eaeaea,1,#d3d3d3,1,#bababa,1,#9f9f9f,1,#858585,1,#777777,1,#646464,1,#575757,1,#474747,1"; 62 // 63 if ( (!isset($conf['LLGBO'])) or (substr_count($conf['LLGBO'], ',') != 9) 64 or (!isset($conf['LLGBOTOOLTIP'])) or (substr_count($conf['LLGBOTOOLTIP'], ',') != 5) 65 or (!isset($conf['LLGBOFRAME'])) or (substr_count($conf['LLGBOFRAME'], ',') != 32)) 66 { plugin_install(); } 47 67 } 48 68 49 function 69 function plugin_uninstall() 50 70 { global $prefixeTable; 51 71 $q = ' 52 DELETE FROM '.CONFIG_TABLE.' WHERE param ="LLGBO" LIMIT 1;';72 DELETE FROM '.CONFIG_TABLE.' WHERE param like "LLGBO%" LIMIT 4;'; 53 73 pwg_query( $q ); 54 74 }
Note: See TracChangeset
for help on using the changeset viewer.