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; }
<?php if (!defined('ABSPATH')) { die('No direct access allowed'); } ?> <div id="tmm_shortcode_template" class="tmm_shortcode_template clearfix"> <div class="one-half"> <?php TMM_Ext_Shortcodes::draw_shortcode_option(array('type' => 'select', 'title' => __('Choose Contact Form', 'tmm_shortcodes'), 'shortcode_field' => 'content', 'id' => '', 'options' => TMM_Contact_Form::get_forms_names(), 'default_value' => TMM_Ext_Shortcodes::set_default_value('content', ''), 'description' => '')); ?> </div><!--/ .one-half--> </div> <!-- -------------------------- PROCESSOR --------------------------- --> <script type="text/javascript"> var shortcode_name = "<?php echo basename(__FILE__, '.php'); ?> "; jQuery(function() { tmm_ext_shortcodes.changer(shortcode_name); jQuery("#tmm_shortcode_template .js_shortcode_template_changer").on('keyup change', function() { tmm_ext_shortcodes.changer(shortcode_name); });
<?php if (!defined('ABSPATH')) { die('No direct access allowed'); } //contact form on front by shortcode $form_name = $content; $contact_form = TMM_Contact_Form::get_form($form_name); wp_enqueue_script("tmm_shortcode_contact_form_js", TMM_Ext_Shortcodes::get_application_uri() . '/js/shortcodes/contact_form.js'); $unique_id = uniqid(); //output fields if (!empty($contact_form['inputs'])) { ?> <form method="post" class="contact-form"> <input type="hidden" name="contact_form_name" value="<?php echo $form_name; ?> " /> <?php foreach ($contact_form['inputs'] as $input) { ?> <?php $name = strtolower(trim(urlencode($input['label']))); $name = str_replace(" ", "_", $name); $pattern = "/[^a-zA-Z0-9_]+/i"; $name = preg_replace($pattern, "", $name); //***