Sprach Variablen Suche

Hello again,

Hier noch eine kleine Hilfestellung für Template Bastler, mit diesem Interface lassen sich die Sprachvariablen durchsuchen - die Suche geht auf Schlüssel und Werte los.

Folgendes als langsearch.php in das Shop Hauptverzeichnis einspielen - nach der Verwendung am besten wieder löschen, man weiß ja nie.

Das Script steht wie immer unter der WTFPL - “Do what the fuck you want to”

<?php
		
	// Setting error reporting mode
    error_reporting( E_ALL ^ E_NOTICE );

	//setting basic configuration parameters
	ini_set('session.name', 'sid' );
	ini_set('session.use_cookies', 0 );
	ini_set('session.use_trans_sid', 0);
	ini_set('url_rewriter.tags', '');
	ini_set('magic_quotes_runtime', 0);
	
	function getShopBasePath()
	{
		return dirname(__FILE__).'/';
	}
	

	function isAdmin()
	{
		return false;
	}
	
	// custom functions file
	require getShopBasePath() . 'modules/functions.php';
	
	// Generic utility method file
	require_once getShopBasePath() . 'core/oxfunctions.php';
	
	// initializes singleton config class
	$myConfig = oxConfig::getInstance();
	
	//strips magics quote if any
	oxUtils::getInstance()->stripGpcMagicQuotes();
	
	// reset it so it is done with oxnew
	$iDebug = $myConfig->getConfigParam('iDebug');
	set_exception_handler(array(oxNew('oxexceptionhandler', $iDebug), 'handleUncaughtException'));
	
	
	//Some class magic to open up oxLang for reading purpose
	class oxInternalLang extends oxLang{
		public function getLangTranslationArray(){
			return $this->_getLangTranslationArray();
		}
	}
	
	
	
	if($_REQUEST['fnc'] == 'search'){
		$sWord = $_REQUEST["search"];
		
		$aResults = array();
		$oLang = new oxInternalLang();
		$aTransArray = $oLang->getLangTranslationArray();
		
		foreach($aTransArray as $sKey => $sValue){
			if(stristr($sKey,$sWord) || stristr($sValue,$sWord)){
				$aResults[$sKey] = $sValue;
			}
		}
				
	}
	
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
 <head>
  <title>Sprachdateien durchsuchen</title>
  <link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap-1.1.1.min.css">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
 </head>
 
<body style="padding-top: 60px">

 <div class="topbar-wrapper noprint" style="z-index: 5">
  <div class="topbar">
 	<div class="fill">
 		<div class="container">
 			<h3><a href="#">Aggrosoft Sprachsuche</a></h3>
 		</div>
 	</div>
 </div>
 </div>

<div class="container">

  <form action="langsearch.php" method="post">
  	<input type="hidden" name="fnc" value="search">
	<fieldset>
	  <legend>Sprachkeys suchen</legend>
	  <div class="clearfix">
		<label for="key">Suchen nach:</label>
		<div class="input">
		  <input type="text" size="50" name="search" class="xlarge" value="<?php echo $sWord; ?>">
		</div>
	  </div><!-- /clearfix -->
	  <div class="actions">
		<button class="btn primary" type="submit">Start</button> <button class="btn" type="reset">Cancel</button>
	  </div>
	</fieldset>
  </form>
  <?php if($aResults): ?>
  <table class="zebra-striped">
  	<thead>
  		<tr>
  			<th class="header">Schlüssel</th>
			<th class="header">Wert</th>
		</tr>
  	</thead>
  	<tbody>
  		<?php foreach($aResults as $sKey => $sValue): ?>
  			<tr>
  				<td><?php echo $sKey; ?></td>
  				<td><?php echo $sValue; ?></td>
  			</tr>
  		<?php endforeach; ?>
  	</tbody>
  </table>
  <?php endif; ?>
</div>
  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
  <script type="text/javascript" src="http://autobahn.tablesorter.com/jquery.tablesorter.min.js"></script>
  <script type="text/javascript">
  	$(function(){
  		$("table").tablesorter({ sortList: [[1,1]] });
  	});
  </script>
 </body>
</html>