colorcontrol = "Color Control";
$this->shortcolorcontrol = $special_id_for_db."cc";
//echo $this->shortcolorcontrol;
$value_of_std[0]=get_theme_mod($this->shortcolorcontrol."_menu_elem_back_color",'#022433');
$value_of_std[1]=get_theme_mod($this->shortcolorcontrol."_content_back_color",'#FFFFFF');
$value_of_std[2]=get_theme_mod($this->shortcolorcontrol."_sideb_background_color",'#ECECEC');
$value_of_std[3]=get_theme_mod($this->shortcolorcontrol."_footer_back_color",'#ECECEC');
$value_of_std[4]=get_theme_mod($this->shortcolorcontrol."_home_top_posts_color",'#ECECEC');
$value_of_std[5]=get_theme_mod($this->shortcolorcontrol."_top_posts_color",'#012331');
$value_of_std[6]=get_theme_mod($this->shortcolorcontrol."_text_headers_color",'#012331');
$value_of_std[7]=get_theme_mod($this->shortcolorcontrol."_primary_text_color",'#1f1f1f');
$value_of_std[8]=get_theme_mod($this->shortcolorcontrol."_footer_text_color",'#1f1f1f');
$value_of_std[9]=get_theme_mod($this->shortcolorcontrol."_primary_links_color",'#000000');
$value_of_std[10]=get_theme_mod($this->shortcolorcontrol."_primary_links_hover_color",'#000000');
$value_of_std[11]=get_theme_mod($this->shortcolorcontrol."_menu_links_color",'#FFFFFF');
$value_of_std[12]=get_theme_mod($this->shortcolorcontrol."_menu_links_hover_color",'#FFFFFF');
$value_of_std[13]=get_theme_mod($this->shortcolorcontrol."_menu_color",'#044967');
$value_of_std[14]=get_theme_mod($this->shortcolorcontrol."_selected_menu_color",'#044967');
$value_of_std[15]=get_theme_mod($this->shortcolorcontrol."_color_scheme",'#E0E0E0');
$value_of_std[16]=get_theme_mod($this->shortcolorcontrol."_logo_text_color",'#ffffff');
$value_of_std[17]=get_theme_mod($this->shortcolorcontrol."_logo_text_color_for_phone",'#000000');
$this->options_colorcontrol = array(
"menu_elem_back_color" => array(
"name" => "Menu Element Backround Color",
"desc" => "",
"var_name" =>'menu_elem_back_color',
"id" => $this->shortcolorcontrol . "_menu_elem_back_color",
"type" => "picker",
"std" => $value_of_std[0]
),
/* "content_back_color" => array(
"name" => "Body Background Color",
"desc" => "",
"var_name" =>'content_back_color',
"id" => $this->shortcolorcontrol . "_content_back_color",
"type" => "picker",
"std" => $value_of_std[1]
), */
"sideb_background_color" => array(
"name" => "Sidebar Background Color",
"desc" => "",
"var_name" =>'sideb_background_color',
"id" => $this->shortcolorcontrol . "_sideb_background_color",
"type" => "picker",
"std" => $value_of_std[2]
),
"footer_back_color" => array(
"name" => "Footer Background Color",
"desc" => "",
"var_name" =>'footer_back_color',
"id" => $this->shortcolorcontrol . "_footer_back_color",
"type" => "picker",
"std" => $value_of_std[3]
),
"home_top_posts_color" => array(
"name" => "Featured Post Background Color",
"desc" => "",
"var_name" =>'home_top_posts_color',
"id" => $this->shortcolorcontrol . "_home_top_posts_color",
"type" => "picker",
"std" => $value_of_std[4]
),
"top_posts_color" => array(
"name" => "Top Posts Background Color",
"desc" => "",
"var_name" =>'top_posts_color',
"id" => $this->shortcolorcontrol . "_top_posts_color",
"type" => "picker",
"std" => $value_of_std[5]
),
"text_headers_color" => array(
"name" => "Header Text(<h1> etc) Color",
"desc" => "",
"var_name" =>'text_headers_color',
"id" => $this->shortcolorcontrol . "_text_headers_color",
"type" => "picker",
"std" => $value_of_std[6]
),
"primary_text_color" => array(
"name" => "Primary Text Corlor",
"desc" => "",
"var_name" =>'primary_text_color',
"id" => $this->shortcolorcontrol . "_primary_text_color",
"type" => "picker",
"std" => $value_of_std[7]
),
"footer_text_color" => array(
"name" => "Footer Text Color",
"desc" => "",
"var_name" =>'footer_text_color',
"id" => $this->shortcolorcontrol . "_footer_text_color",
"type" => "picker",
"std" => $value_of_std[8]
),
"primary_links_color" => array(
"name" => "Primary Links",
"desc" => "",
"var_name" =>'primary_links_color',
"id" => $this->shortcolorcontrol . "_primary_links_color",
"type" => "picker",
"std" => $value_of_std[9]
),
"primary_links_hover_color" => array(
"name" => "Primary Links Hover",
"desc" => "",
"var_name" =>'primary_links_hover_color',
"id" => $this->shortcolorcontrol . "_primary_links_hover_color",
"type" => "picker",
"std" => $value_of_std[10]
),
"menu_links_color" => array(
"name" => "Menu Links",
"desc" => "",
"var_name" =>'menu_links_color',
"id" => $this->shortcolorcontrol . "_menu_links_color",
"type" => "picker",
"std" => $value_of_std[11]
),
"menu_links_hover_color" => array(
"name" => "Menu Links Hover",
"desc" => "",
"var_name" =>'menu_links_hover_color',
"id" => $this->shortcolorcontrol . "_menu_links_hover_color",
"type" => "picker",
"std" => $value_of_std[12]
),
"menu_color" => array(
"name" => "Hover Menu Item",
"desc" => "",
"var_name" =>'menu_color',
"id" => $this->shortcolorcontrol . "_menu_color",
"type" => "picker",
"std" => $value_of_std[13]
),
"selected_menu_color" => array(
"name" => "Selected Menu Item",
"desc" => "",
"var_name" =>'selected_menu_color',
"id" => $this->shortcolorcontrol . "_selected_menu_color",
"type" => "picker",
"std" => $value_of_std[14]
),
"color_scheme" => array(
"name" => " ",
"var_name" =>'color_scheme',
"id" => $this->shortcolorcontrol . "_color_scheme",
"type" => "",
"std" => $value_of_std[15]
),
"logo_text_color" => array(
"name" => "Logo Text Color ",
"desc" => "",
"var_name" =>'logo_text_color',
"id" => $this->shortcolorcontrol . "_logo_text_color",
"type" => "picker",
"std" => $value_of_std[16]
),
"logo_text_color_for_phone" => array(
"name" => "Logo Text Color For Phone",
"desc" => "",
"var_name" =>'logo_text_color_for_phone',
"id" => $this->shortcolorcontrol . "_logo_text_color_for_phone",
"type" => "picker",
"std" => $value_of_std[17]
)
);
}
public function web_bussines_customize_preview_js() {
wp_enqueue_script( 'web_bussines-customizer', get_template_directory_uri() . '/scripts/theme-customizer.js', array( 'customize-preview' ) );
}
/* public function web_bussines_customize_register( $wp_customize ) {
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
global $dor_color_control_page;
$wp_customize->add_section( 'aaa' , array(
'title' => __( 'Schemes', 'web_bussines' ),
'priority' => 49,
) );
foreach($this->options_colorcontrol as $key=>$spec_color)
{
if($spec_color['type']=='picker'){
$wp_customize->add_setting( 'theme_mods_exclusive['.$spec_color['id'].']', array(
'default' => $spec_color['std'],
'type' => 'option',
'sanitize_callback' => 'sanitize_hex_color',
'capability' => 'edit_theme_options',
'transport' => 'postMessage'
) );
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'theme_mods_exclusive['.$spec_color['id'].']', array(
'label' => $spec_color['name'],
'section' => 'colors',
'settings' => 'theme_mods_exclusive['.$spec_color['id'].']'
) ) );
}
}
} */
/// save changes or reset options
public function web_dorado_theme_update_and_get_options_color_control(){
if ( isset($_GET['page']) && $_GET['page'] == "web_dorado_theme" && isset($_GET['controller']) && $_GET['controller'] == "color_control_page") {
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'save' ) {
foreach ($this->options_colorcontrol as $value) {
set_theme_mod($value['id'], $_REQUEST[$value['var_name']]);
}
foreach ($this->options_colorcontrol as $value) {
if (isset($_REQUEST[$value['var_name']])) {
set_theme_mod($value['id'], $_REQUEST[$value['var_name']]);
} else {
remove_theme_mod($value['id']);
}
}
header("Location: themes.php?page=web_dorado_theme&controller=color_control_page&saved=true");
die;
} else if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'reset' ) {
foreach ($this->options_colorcontrol as $value) {
remove_theme_mod($value['id']);
}
header("Location: themes.php?page=web_dorado_theme&controller=color_control_page&reset=true");
die;
}
}
}
public function web_dorado_color_control_page_admin_scripts(){
wp_enqueue_style('color_control_page_main_style',get_template_directory_uri('template_directory').'/admin/css/color_control.css');
wp_enqueue_script('wp-color-picker');
wp_enqueue_style( 'wp-color-picker' );
}
public function update_color_control(){
//for update global options
global $dor_color_control_page;
foreach ($dor_color_control_page->options_colorcontrol as $value) {
$$value['var_name'] = $value['std'];
}
$background_color = get_background_color();
$background_image=get_background_image();
?>
' . $this->colorcontrol . ' settings saved.
';
if (isset($_REQUEST['reset']) && $_REQUEST['reset'] )
echo '' . $this->colorcontrol . ' settings reset.
';
}
global $dor_admin_helepr_functions;
$pickers=$this->get_option_type('picker');
$count_picker=count( $pickers );
$array_of_colors=array(
array(
"menu_elem_back_color" => "#022433",
"sideb_background_color" => "#ECECEC",
"footer_back_color" => "#ECECEC",
"home_top_posts_color" => "#ECECEC",
"top_posts_color" => "#012331",
"text_headers_color" => "#012331",
"primary_text_color" => "#1f1f1f",
"footer_text_color" => "#1f1f1f",
"primary_links_color" => "#000000",
"primary_links_hover_color" => "#000000",
"menu_links_color" => "#ffffff",
"menu_links_hover_color" => "#ffffff",
"menu_color" => "#044967",
"selected_menu_color" => "#044967",
"logo_text_color" => "#ffffff",
"logo_text_color_for_phone" => "#000000",
),
array(
"menu_elem_back_color" => "#D4D2D2",
"sideb_background_color" => "#ECECEC",
"footer_back_color" => "#ECECEC",
"home_top_posts_color" => "#ECECEC",
"top_posts_color" => "#086200",
"text_headers_color" => "#086200",
"primary_text_color" => "#1f1f1f",
"footer_text_color" => "#1f1f1f",
"primary_links_color" => "#000000",
"primary_links_hover_color" => "#000000",
"menu_links_color" => "#3E3E3E",
"menu_links_hover_color" => "#3E3E3E",
"menu_color" => "#EDEDED",
"selected_menu_color" => "#EDEDED",
"logo_text_color" => "#086200",
"logo_text_color_for_phone" => "#086200",
),
array(
"menu_elem_back_color" => "#091F3C",
"sideb_background_color" => "#ECECEC",
"footer_back_color" => "#ECECEC",
"home_top_posts_color" => "#ECECEC",
"top_posts_color" => "#0D2C53",
"text_headers_color" => "#0B2749",
"primary_text_color" => "#000000",
"footer_text_color" => "#000000",
"primary_links_color" => "#000000",
"primary_links_hover_color" => "#000000",
"menu_links_color" => "#ffffff",
"menu_links_hover_color" => "#ffffff",
"menu_color" => "#044A9F",
"selected_menu_color" => "#044A9F",
"logo_text_color" => "#ffffff",
"logo_text_color_for_phone" => "#000000",
),
array(
"menu_elem_back_color" => "#C1C2C2",
"sideb_background_color" => "#ECECEC",
"footer_back_color" => "#ECECEC",
"home_top_posts_color" => "#ECECEC",
"top_posts_color" => "#BE4415",
"text_headers_color" => "#BE4415",
"primary_text_color" => "#1f1f1f",
"footer_text_color" => "#1f1f1f",
"primary_links_color" => "#000000",
"primary_links_hover_color" => "#000000",
"menu_links_color" => "#383838",
"menu_links_hover_color" => "#383838",
"menu_color" => "#EDEDED",
"selected_menu_color" => "#EDEDED",
"logo_text_color" => "#BE4415",
"logo_text_color_for_phone" => "#BE4415",
)
);
?>default_themes_jquery($array_of_colors) ?>
The color customization parameters are disabled in free version. Please buy the commercial version in order to enable this functionality.
options_colorcontrol as $option ){
if(isset($type) && isset($option['type']) && $option['type'] == $type ){
$cur_type_elements[$k]=$option;
$k++;
}
}
return $cur_type_elements;
}
private function default_themes_jquery($array_of_colors=NULL){
// print array if it not set
if($array_of_colors===NULL){
echo "\$array_of_colors=array(
array(
";
foreach($this->options_colorcontrol as $key=>$special_color){
if($special_color['type']=='picker'){
echo " \"".$special_color['var_name']."\" => \"".$special_color['std']."\",
";
}
}
echo "),
array(
";
foreach($this->options_colorcontrol as $key=>$special_color){
if($special_color['type']=='picker'){
echo " \"".$special_color['var_name']."\" => \"".$special_color['std']."\",
";
}
}
echo ")); esi copy past ara array_of_colors tex@ kashxati";
die();
}
// print qjeru and initial colors standart themes
else
{
echo '";
}
}
private function default_theme_select($array_of_colors=NULL){
$count_of_selects=count($array_of_colors);
echo '';
}
private function hex_to_rgba($color, $opacity = false) {
$default = 'rgb(0,0,0)';
//Return default if no color provided
if(empty($color))
return $default;
//Sanitize $color if "#" is provided
if ($color[0] == '#' ) {
$color = substr( $color, 1 );
}
//Check if color has 6 or 3 characters and get values
if (strlen($color) == 6) {
$hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] );
} elseif ( strlen( $color ) == 3 ) {
$hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] );
} else {
return $default;
}
//Convert hexadec to rgb
$rgb = array_map('hexdec', $hex);
//Check if opacity is set(rgba or rgb)
if($opacity){
if(abs($opacity) > 1)
$opacity = 1.0;
$output = 'rgba('.implode(",",$rgb).','.$opacity.')';
} else {
$output = 'rgb('.implode(",",$rgb).')';
}
//Return rgb(a) color string
return $output;
}
}