array(
'font-current-normal' => '#222222',
'font-current-hover' => '#000000',
'background-current-normal' => '#eeeeee',
'background-current-hover' => '#eeeeee',
'font-other-normal' => '#222222',
'font-other-hover' => '#000000',
'background-other-normal' => '#e5e5e5',
'background-other-hover' => '#eeeeee',
'border' => '#cdcdcd',
'background' => '#e5e5e5'
),
'White' => array(
'font-current-normal' => '#444444',
'font-current-hover' => '#000000',
'background-current-normal' => '#ffffff',
'background-current-hover' => '#eeeeee',
'font-other-normal' => '#444444',
'font-other-hover' => '#000000',
'background-other-normal' => '#ffffff',
'background-other-hover' => '#eeeeee',
'border' => '#cdcdcd',
'background' => '#ffffff'
),
'Blue' => array(
'font-current-normal' => '#ffffff',
'font-current-hover' => '#000000',
'background-current-normal' => '#95bedd',
'background-current-hover' => '#95bedd',
'font-other-normal' => '#000000',
'font-other-hover' => '#ffffff',
'background-other-normal' => '#cbddeb',
'background-other-hover' => '#95bedd',
'border' => '#0099cc',
'background' => '#cbddeb'
)
);
function __construct(){
$this->widget_css_defaults = $this->color_schemes['White'];
$this->footer_css_defaults = $this->color_schemes['White'];
add_action('plugins_loaded',array(&$this,'init'));
}
function init(){
global $sitepress_settings;
$this->settings = $sitepress_settings;
if (!empty($this->settings['icl_lang_sel_footer'])){
add_action('wp_head', array(&$this, 'language_selector_footer_style'),19);
add_action('wp_footer', array(&$this, 'language_selector_footer'),19);
}
if (is_admin()) {
add_action('icl_language_switcher_options',array(&$this,'admin'),1);
} else if (!empty($this->settings['icl_post_availability'])) {
if(function_exists('icl_register_string')){
icl_register_string('WPML', 'Text for alternative languages for posts', $this->settings['icl_post_availability_text']);
}
add_filter('the_content', array(&$this, 'post_availability'), 100);
}
// the language selector widget
$this->language_selector_widget_init();
if(is_admin() && isset($_GET['page']) && $_GET['page'] == ICL_PLUGIN_FOLDER . '/menu/languages.php'){
add_action('admin_head', 'icl_lang_sel_nav_css', 1, 1, true);
add_action('admin_head', array(&$this, 'custom_language_switcher_style'));
}
if(!is_admin()){
add_action('wp_head', array(&$this, 'custom_language_switcher_style'));
}
if(!empty($sitepress_settings['display_ls_in_menu'])){
add_filter('wp_nav_menu_items', array($this, 'wp_nav_menu_items_filter'), 10, 2);
}
}
function language_selector_widget_init(){
wp_register_sidebar_widget('icl_lang_sel_widget', __('Language Selector', 'sitepress'), 'language_selector_widget', array('classname'=>'icl_languages_selector'));
wp_register_widget_control('icl_lang_sel_widget_control', __('Language Selector', 'sitepress'), array(&$this, 'set_widget') );
add_action('template_redirect','icl_lang_sel_nav_ob_start', 0);
add_action('wp_head','icl_lang_sel_nav_ob_end');
}
function set_widget(){
global $sitepress, $sitepress_settings;
if (isset($_POST['icl_widget_update'])){
$sitepress_settings['icl_widget_title_show'] = (isset($_POST['icl_widget_title_show'])) ? 1 : 0;
$sitepress->save_settings($sitepress_settings);
}
echo '';
echo '
';
}
function post_availability($content){
$out = '';
if(is_singular()){
$languages = icl_get_languages('skip_missing=true');
if(1 < count($languages)){
//$out .= $this->settings['post_available_before'] ? $this->settings['post_available_before'] : '';
foreach($languages as $l){
if(!$l['active']) $langs[] = ''.$l['translated_name'].'';
}
$out .= join(', ', $langs);
//$out .= $this->settings['post_available_after'] ? $this->settings['post_available_after'] : '';
if(!function_exists('icl_t')){
function icl_t($c, $n, $str){return $str; }
}
$out = '
' . sprintf(icl_t('WPML', 'Text for alternative languages for posts', $this->settings['icl_post_availability_text']), $out) . '
'; } } $out = apply_filters('icl_post_alternative_languages', $out); if ($this->settings['icl_post_availability_position'] == 'above'){ $content = $out . $content; }else{ $content = $content . $out; } return $content; } function language_selector_footer_style(){ $add = false; foreach($this->footer_css_defaults as $key=>$d){ if (isset($this->settings['icl_lang_sel_footer_config'][$key]) && $this->settings['icl_lang_sel_footer_config'][$key] != $d){ $this->settings['icl_lang_sel_footer_config'][$key] . "\n"; $add = true; break; } } if($add){ echo "\n\n"; } } function language_selector_footer() { $languages = icl_get_languages('orderby=id&order=asc&skip_missing=0'); if(!empty($languages)){ echo ' '; } } function admin(){ foreach($this->color_schemes as $key=>$val): ?> widget_css_defaults as $k=>$v): ?>