| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | // JoomlaWorks "Tabs & Slides" Plugin for Joomla! 1.0.x - Version 2.3 |
|---|
| 4 | // License: http://www.gnu.org/copyleft/gpl.html |
|---|
| 5 | // Authors: Fotis Evangelou - George Chouliaras |
|---|
| 6 | // Copyright (c) 2006 - 2007 JoomlaWorks.gr - http://www.joomlaworks.gr |
|---|
| 7 | // Project page at http://www.joomlaworks.gr - Demos at http://demo.joomlaworks.gr |
|---|
| 8 | // Support forum at http://forum.joomlaworks.gr |
|---|
| 9 | // ***Last update: August 30th, 2007*** |
|---|
| 10 | */ |
|---|
| 11 | |
|---|
| 12 | function jwHeader(){ |
|---|
| 13 | $header = " |
|---|
| 14 | <style type=\"text/css\" media=\"screen\"> |
|---|
| 15 | @import \"/includes/jwtabs/tabs_slides.css\"; |
|---|
| 16 | </style> |
|---|
| 17 | <style type=\"text/css\" media=\"print\">.jwts_tabbernav{display:none;}</style> |
|---|
| 18 | <script type=\"text/javascript\">var jwts_slideSpeed=30; var jwts_timer=10;</script> |
|---|
| 19 | <script type=\"text/javascript\" src=\"/includes/jwtabs/tabs_slides_comp.js\"></script> |
|---|
| 20 | "; |
|---|
| 21 | $header .= "<script type=\"text/javascript\" src=\"/includes/jwtabs/tabs_slides_def_loader.js\"></script>"; |
|---|
| 22 | return $header; |
|---|
| 23 | } |
|---|
| 24 | |
|---|
| 25 | function jwTabs( $text, $published = true ) { |
|---|
| 26 | //$text = 'test'.$text; |
|---|
| 27 | $enable_tabs = 1; |
|---|
| 28 | $enable_slides = 1; |
|---|
| 29 | // JS loader selection |
|---|
| 30 | $use_optimized_loader = 0; // Use optimized JS code loader? 0=no and 1=yes. Default is 0. |
|---|
| 31 | |
|---|
| 32 | if (!$published) { |
|---|
| 33 | if (preg_match_all("/{tab=.+?}/", $text, $matches, PREG_PATTERN_ORDER) > 0) { |
|---|
| 34 | foreach ($matches[0] as $match) { |
|---|
| 35 | $match = str_replace("{tab=", "", $match); |
|---|
| 36 | $match = str_replace("}", "", $match); |
|---|
| 37 | $text = str_replace( "{tab=".$match."}", "", $text ); |
|---|
| 38 | $text = str_replace( "{/tabs}", "", $text ); |
|---|
| 39 | } |
|---|
| 40 | } |
|---|
| 41 | if (preg_match_all("/{slide=.+?}/", $text, $matches, PREG_PATTERN_ORDER) > 0) { |
|---|
| 42 | foreach ($matches[0] as $match) { |
|---|
| 43 | $match = str_replace("{slide=", "", $match); |
|---|
| 44 | $match = str_replace("}", "", $match); |
|---|
| 45 | $text = str_replace( "{slide=".$match."}", "", $text ); |
|---|
| 46 | $text = str_replace( "{/slide}", "", $text ); |
|---|
| 47 | } |
|---|
| 48 | } |
|---|
| 49 | return; |
|---|
| 50 | } |
|---|
| 51 | |
|---|
| 52 | $path = $_SERVER['DOCUMENT_ROOT']; |
|---|
| 53 | $live_site = 'http://'.$_SERVER['HTTP_HOST']; |
|---|
| 54 | static $tabid; |
|---|
| 55 | |
|---|
| 56 | // Start Tabs Replacement |
|---|
| 57 | // index.php |
|---|
| 58 | if($enable_tabs) { |
|---|
| 59 | $b=1; |
|---|
| 60 | if (preg_match_all("/{tab=.+?}{tab=.+?}|{tab=.+?}|{\/tabs}/", $text, $matches, PREG_PATTERN_ORDER) > 0) { |
|---|
| 61 | foreach ($matches[0] as $match) { |
|---|
| 62 | if($b==1 && $match!="{/tabs}") { |
|---|
| 63 | $tabs[] = 1; |
|---|
| 64 | $b=2; |
|---|
| 65 | } |
|---|
| 66 | elseif($match=="{/tabs}"){ |
|---|
| 67 | $tabs[]=3; |
|---|
| 68 | $b=1; |
|---|
| 69 | } |
|---|
| 70 | elseif(preg_match("/{tab=.+?}{tab=.+?}/", $match)){ |
|---|
| 71 | $tabs[]=2; |
|---|
| 72 | $tabs[]=1; |
|---|
| 73 | $b=2; |
|---|
| 74 | } |
|---|
| 75 | else { |
|---|
| 76 | $tabs[]=2; |
|---|
| 77 | } |
|---|
| 78 | } |
|---|
| 79 | } |
|---|
| 80 | @reset($tabs); |
|---|
| 81 | $tabscount = 0; |
|---|
| 82 | if (preg_match_all("/{tab=.+?}|{\/tabs}/", $text, $matches, PREG_PATTERN_ORDER) > 0) { |
|---|
| 83 | foreach ($matches[0] as $match) { |
|---|
| 84 | if($tabs[$tabscount]==1) { |
|---|
| 85 | $match = str_replace("{tab=", "", $match); |
|---|
| 86 | $match = str_replace("}", "", $match); |
|---|
| 87 | $text = str_replace( "{tab=".$match."}", " |
|---|
| 88 | <div class=\"jwts_tabber\" id=\"jwts_tab".$tabid."\"><div class=\"jwts_tabbertab\" title=\"".$match."\"><h2><a href=\"javascript:void(null);\" name=\"advtab\">".$match."</a></h2>", $text ); |
|---|
| 89 | $tabid++; |
|---|
| 90 | } elseif($tabs[$tabscount]==2) { |
|---|
| 91 | $match = str_replace("{tab=", "", $match); |
|---|
| 92 | $match = str_replace("}", "", $match); |
|---|
| 93 | $text = str_replace( "{tab=".$match."}", "</div><div class=\"jwts_tabbertab\" title=\"".$match."\"><h2><a href=\"javascript:void(null);\" name=\"advtab\">".$match."</a></h2>", $text ); |
|---|
| 94 | } elseif($tabs[$tabscount]==3) { |
|---|
| 95 | $text = str_replace( "{/tabs}", "</div></div><div class=\"jwts_clr\"></div>", $text ); |
|---|
| 96 | } |
|---|
| 97 | $tabscount++; |
|---|
| 98 | } |
|---|
| 99 | } |
|---|
| 100 | } |
|---|
| 101 | // End Tabs Replacement |
|---|
| 102 | |
|---|
| 103 | // Start Slides Replacement |
|---|
| 104 | // index.php |
|---|
| 105 | if($enable_slides) { |
|---|
| 106 | if (preg_match_all("/{slide=.+?}/", $text, $matches, PREG_PATTERN_ORDER) > 0) { |
|---|
| 107 | foreach ($matches[0] as $match) { |
|---|
| 108 | $match = str_replace("{slide=", "", $match); |
|---|
| 109 | $match = str_replace("}", "", $match); |
|---|
| 110 | $text = str_replace( "{slide=".$match."}", "<div class=\"jwts_title\"><div class=\"jwts_title_left\"><a href=\"javascript:void(null);\" title=\"Íàæìèòå ÷òîáû îòêðûòü\" class=\"jwts_title_text\">".$match."</a></div></div><div class=\"jwts_slidewrapper\"><div>", $text ); |
|---|
| 111 | $text = str_replace( "{/slide}", "</div></div>", $text ); |
|---|
| 112 | } |
|---|
| 113 | } |
|---|
| 114 | } |
|---|
| 115 | // End Slides Replacement |
|---|
| 116 | return $text; |
|---|
| 117 | } |
|---|
| 118 | |
|---|
| 119 | ?> |
|---|