public static function save_google_fonts()
 {
     $data = array();
     parse_str($_REQUEST['values'], $data);
     TMM::update_option('saved_google_fonts', $data);
     exit;
 }
 public static function change_options()
 {
     $action_type = $_REQUEST['type'];
     $data = array();
     parse_str($_REQUEST['values'], $data);
     $data = TMM_Helper::db_quotes_shield($data);
     switch ($action_type) {
         case 'save':
             if (!empty($data)) {
                 foreach ($data as $option => $newvalue) {
                     if ($option == "sidebars") {
                         unset($newvalue[0]);
                         TMM::update_option('sidebars', $newvalue);
                         continue;
                     }
                     if ($option == "seo_group") {
                         unset($newvalue[0]);
                         TMM::update_option('seo_groups', $newvalue);
                         continue;
                     }
                     if ($option == "contact_form") {
                         if (!empty($newvalue)) {
                             foreach ($newvalue as $key => $form) {
                                 if (!isset($newvalue[$key]['title'])) {
                                     unset($newvalue[$key]);
                                 }
                                 if (empty($newvalue[$key]['title'])) {
                                     unset($newvalue[$key]);
                                 }
                             }
                         }
                         TMM_Contact_Form::save($newvalue);
                         continue;
                     }
                     if (is_array($newvalue)) {
                         self::update_option($option, $newvalue);
                     } else {
                         $newvalue = stripcslashes($newvalue);
                         $newvalue = str_replace('\\"', '"', $newvalue);
                         $newvalue = str_replace("\\'", "'", $newvalue);
                         self::update_option($option, $newvalue);
                     }
                 }
             }
             _e('Options have been updated.', 'almera');
             break;
         case 'reset':
             if (!empty($data)) {
                 foreach ($data as $option => $newvalue) {
                     if ($option == "sidebars") {
                         continue;
                     }
                     if ($option == "contact_form") {
                         continue;
                     }
                     self::update_option($option, $newvalue);
                 }
             }
             _e('Options have been reset.', 'almera');
             break;
         default:
             break;
     }
     //**** CSS REGENERATION
     $custom_css1 = self::draw_free_page(TMM_THEME_PATH . '/admin/theme_options/custom_css1.php');
     $custom_css2 = self::draw_free_page(TMM_THEME_PATH . '/admin/theme_options/custom_css2.php');
     $handle = fopen(TMM_THEME_PATH . '/css/custom1.css', 'w');
     fwrite($handle, $custom_css1);
     fclose($handle);
     $handle = fopen(TMM_THEME_PATH . '/css/custom2.css', 'w');
     fwrite($handle, $custom_css2);
     fclose($handle);
     exit;
 }
 public static function save($data)
 {
     TMM::update_option('contact_form', $data);
 }
Example #4
0
        $theme_mods = get_option('theme_mods_' . 'almera');
        $theme_mods['nav_menu_locations']['primary'] = $menu_id;
        update_option('theme_mods_' . 'almera', $theme_mods);
        if (class_exists('TMM_Ext_Shortcodes')) {
            $shortcodes = TMM_Ext_Shortcodes::get_shortcodes_array();
            if (!empty($shortcodes)) {
                foreach ($shortcodes as $shortcode) {
                    TMM::update_option('show_shortcode_' . $shortcode, 1);
                }
            }
        }
        TMM::update_option('theme_was_activated', 1);
        //*****
        TMM::update_option('saved_google_fonts', 'a:1:{i:0;s:83:"Open Sans:300,300italic,400regular,italic,600,600italic,700,700italic,800,800italic";}');
        TMM::update_option('sidebar_position', 'sbr');
        TMM::update_option('copyright_text', 'Copyright &copy; 2013. <a target="_blank" href="http://webtemplatemasters.com">ThemeMakers</a>. All rights reserved');
    }
}
//********************
add_action('admin_notices', 'tmm_print_admin_notice');
function tmm_print_admin_notice()
{
    $notices = "";
    if (!is_writable(TMM_THEME_PATH . "/css/custom1.css")) {
        $notices .= __('<div class="error"><p>To make your theme work correctly you need to set the permissions 777 for <b>' . TMM_THEME_PATH . '/css/custom1.css</b> folder. Follow <a href="http://webtemplatemasters.com/tutorials/permissions/" target="_blank">the link</a> to read the instructions how to do it properly.</p></div>', 'almera');
    }
    if (!is_writable(TMM_THEME_PATH . "/css/custom2.css")) {
        $notices .= __('<div class="error"><p>To make your theme work correctly you need to set the permissions 777 for <b>' . TMM_THEME_PATH . '/css/custom2.css</b> folder. Follow <a href="http://webtemplatemasters.com/tutorials/permissions/" target="_blank">the link</a> to read the instructions how to do it properly.</p></div>', 'almera');
    }
    echo $notices;
}