<?php

class Thememakers_Entity_Page {

    public function register() {

    }

    public static function save($post_id) {
        update_post_meta($post_id, "page_top", @$_POST["page_top"]);
        update_post_meta($post_id, "page_bottom", @$_POST["page_bottom"]);
        //*****
        update_post_meta($post_id, "meta_title", @$_POST["meta_title"]);
        update_post_meta($post_id, "meta_keywords", @$_POST["meta_keywords"]);
        update_post_meta($post_id, "meta_description", @$_POST["meta_description"]);
    }

    public static function init_meta_boxes() {

        add_meta_box("seo_options", __("Seo options", THEMEMAKERS_THEME_FOLDER_NAME), array('Thememakers_Entity_Page', 'page_seo_options'), "page", "normal", "low");
        add_meta_box("seo_options", __("Seo options", THEMEMAKERS_THEME_FOLDER_NAME), array('Thememakers_Entity_Page', 'page_seo_options'), "post", "normal", "low");
        add_meta_box("seo_options", __("Seo options", THEMEMAKERS_THEME_FOLDER_NAME), array('Thememakers_Entity_Page', 'page_seo_options'), "folio", "normal", "low");
        add_meta_box("seo_options", __("Seo options", THEMEMAKERS_THEME_FOLDER_NAME), array('Thememakers_Entity_Page', 'page_seo_options'), "gall", "normal", "low");
        //*****
        add_meta_box("content_areas", __("Content areas", THEMEMAKERS_THEME_FOLDER_NAME), array('Thememakers_Entity_Page', 'content_areas_meta'), "page", "normal", "low");
        add_meta_box("content_areas", __("Content areas", THEMEMAKERS_THEME_FOLDER_NAME), array('Thememakers_Entity_Page', 'content_areas_meta'), "post", "normal", "low");
		
    }

    public function content_areas_meta() {
        global $post;
        $data = array();
        $custom = get_post_custom($post->ID);
        $data['page_top'] = @$custom["page_top"][0];
        $data['page_bottom'] = @$custom["page_bottom"][0];
        echo ThemeMakersThemeView::draw_html('page/before_after', $data);
    }

    public function page_seo_options() {
        global $post;
        $data = array();
        $custom = get_post_custom($post->ID);
        $data['meta_title'] = @$custom["meta_title"][0];
        $data['meta_keywords'] = @$custom["meta_keywords"][0];
        $data['meta_description'] = @$custom["meta_description"][0];
        echo ThemeMakersThemeView::draw_html('page/seo_options', $data);
    }

}

