<commit_before><?php
if (!defined('KAIZEKU')) { die(42); }

class wpiAdmin
{
	const REQUEST_PREFIX = '/^wpi_/';
	
	const OPTIONS_PREFIX = 'wpi_';
	
	public $request;
	
	public $lang = array();
	
	
	public function __construct()
	{
		$this->registerDefaultScript();
		
		$options = array('optionPagesMenu',	'optionAdvance','optionPostLayout',
		'optionWidgets','optionPlugins','optionMisc','optionCache');
		
		foreach($options as $method){
			add_action(wpiFilter::ACTION_THEME_OPTIONS,array($this,$method));
		}
		
		unset($options,$method);
		
		$this->_lang();
			
	}
	
	
	private function _lang()
	{
		$this->lang['enabled'] = __('Enabled',WPI_META);
		$this->lang['disabled'] = __('Disabled',WPI_META);
	}
	
	
	public function registerDefaultScript()
	{
		wp_register_script(WPI_META.'_admin', WPI_THEME_URL.'admin.js',false, '0.1');	
	}
	
	
	public function __destruct()
	{		
		unset($this);
	}
	
	
    public function filterRequest($request)
    {    			
		
		if (!is_array($request)) return false;
		
		
        foreach ($request as $key => $val) {
        	
            if (preg_match(self::REQUEST_PREFIX, $key) ) {				                
				$key = str_rem(self::OPTIONS_PREFIX,$key);
				if ($key == 'flush_css'){
					$this->_flushCSS();
				} else {
					self::save($key,$val);
				}     
            }            
        }
        
        unset($request,$key,$val);	
  
    }
    
    private function _flushCSS(){
    	if ( ($css = wpi_get_dir(WPI_CACHE_CSS_DIR)) != false ){
	    	foreach($css as $filename){
	    		$file = WPI_CACHE_CSS_DIR.$filename;
	    		
	    		if (file_exists($file)){
	    			unlink($file);
	    		}
	    	}
    	}
    }
    
	public function printCSS()
	{		
		t('link','',array('rel'=>'stylesheet','href'=>WPI_THEME_URL.'admin.css','type'=>'text/css'));
	}
	
	
	public function script()
	{
		wp_register_script(WPI_META.'_admin', WPI_THEME_URL.'admin.js',false, '0.1');
	}
	
	    
    public function themeOptions()
    {
    	if (is_req('saved')){<commit_msg>fixes menu glitch in theme options for WordPress 2.7 update archives<commit_after><?php
if (!defined('KAIZEKU')) { die(42); }

class wpiAdmin
{
	const REQUEST_PREFIX = '/^wpi_/';
	
	const OPTIONS_PREFIX = 'wpi_';
	
	public $request;
	
	public $lang = array();
	
	
	public function __construct()
	{
		$this->registerDefaultScript();
		
		$options = array('optionPagesMenu',	'optionAdvance','optionPostLayout',
		'optionWidgets','optionPlugins','optionMisc','optionCache');
		
		foreach($options as $method){
			add_action(wpiFilter::ACTION_THEME_OPTIONS,array($this,$method));
		}
		
		unset($options,$method);
		
		$this->_lang();
			
	}
	
	
	private function _lang()
	{
		$this->lang['enabled'] = __('Enabled',WPI_META);
		$this->lang['disabled'] = __('Disabled',WPI_META);
	}
	
	
	public function registerDefaultScript()
	{
		wp_register_script(WPI_META.'_admin', WPI_THEME_URL.'admin.js',false, '0.1');	
	}
	
	
	public function __destruct()
	{		
		unset($this);
	}
	
	
    public function filterRequest($request)
    {    			
		
		if (!is_array($request)) return false;
		
		
        foreach ($request as $key => $val) {
        	
            if (preg_match(self::REQUEST_PREFIX, $key) ) {				                
				$key = str_rem(self::OPTIONS_PREFIX,$key);
				if ($key == 'flush_css'){
					$this->_flushCSS();
				} else {
					self::save($key,$val);
				}     
            }            
        }
        
        unset($request,$key,$val);	
  
    }
    
    private function _flushCSS(){
    	if ( ($css = wpi_get_dir(WPI_CACHE_CSS_DIR)) != false ){
	    	foreach($css as $filename){
	    		$file = WPI_CACHE_CSS_DIR.$filename;
	    		
	    		if (file_exists($file)){
	    			unlink($file);
	    		}
	    	}
    	}
    }
    
	public function printCSS()
	{		
		t('link','',array('rel'=>'stylesheet','href'=>WPI_THEME_URL.'admin.css','type'=>'text/css'));
		if (is_wp_version('2.7') || is_wp_version('2.7-beta1')){
?>
		<style type="text/css">
		    #wpi-theme-options{background-position:253% 0%;margin:0pt !important}
			#wpi-theme-options .main{width:600px}
			#wpi-theme-options .options-item{width:98%}
			#wpi-theme-options .side-panel h2{margin-top:8px}
		</style>
<?php			
		}
	}
	
	
	public function script()
	{
		wp_register_script(WPI_META.'_admin', WPI_THEME_URL.'admin.js',false, '0.1');
	}
	
	    
    public function themeOptions()
    {
    	if (is_req('saved')){
{'fraction_non_alphanumeric': 0.17000911577028258, 'fraction_numerical': 0.007064721969006381, 'mean_word_length': 2.8567662565905096, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6468728', 'n_tokens_mistral': 1776, 'n_tokens_neox': 1553, 'n_words': 230}