function pte_get_options() { global $pte_options, $current_user; if (isset($pte_options)) { return $pte_options; } $pte_options = array_merge(pte_get_user_options(), pte_get_site_options()); return $pte_options; }
function pte_imgedit_size_display() { $options = pte_get_user_options(); $option_label = pte_get_option_name(); ?> <span><input class="small-text" type="text" name="<?php print $option_label; ?> [pte_imgedit_max_size]" value="<?php if (isset($options['pte_imgedit_max_size'])) { print $options['pte_imgedit_max_size']; } ?> " id="pte_imgedit_max_size"> <?php _e("Set the max size for the crop image.", PTE_DOMAIN); ?> <br/><em><?php _e("No entry defaults to 600", PTE_DOMAIN); ?> </em> </span> <div class="sub-option"> <span><input type="checkbox" name="<?php print $option_label; ?> [pte_imgedit_disk]" <?php if ($options['pte_imgedit_disk']) { print "checked"; } ?> id="pte_imgedit_disk"> <label for="pte_imgedit_disk"> <?php _e("Check this to save the generated working image to disk instead of creating on the fly (experimental)", PTE_DOMAIN); ?> </label> </span> </div> <?php }
function pte_update_user_options() { require_once PTE_PLUGINPATH . 'php/options.php'; $options = pte_get_user_options(); // Check nonce if (!check_ajax_referer("pte-options", 'pte-nonce', false)) { return pte_json_error("CSRF Check failed"); } if (isset($_REQUEST['pte_crop_save'])) { if (strtolower($_REQUEST['pte_crop_save']) === "true") { $options['pte_crop_save'] = true; } else { $options['pte_crop_save'] = false; } } if (isset($_REQUEST['pte_thumbnail_bar'])) { if (strtolower($_REQUEST['pte_thumbnail_bar']) == 'vertical') { $options['pte_thumbnail_bar'] = 'vertical'; } else { $options['pte_thumbnail_bar'] = 'horizontal'; } } update_option(pte_get_option_name(), $options); }
function pte_update_user_options() { require_once PTE_PLUGINPATH . 'php/options.php'; $options = pte_get_user_options(); if (isset($_REQUEST['pte_crop_save'])) { if (strtolower($_REQUEST['pte_crop_save']) === "true") { $options['pte_crop_save'] = true; } else { $options['pte_crop_save'] = false; } } if (isset($_REQUEST['pte_thumbnail_bar'])) { if (strtolower($_REQUEST['pte_thumbnail_bar']) == 'vertical') { $options['pte_thumbnail_bar'] = 'vertical'; } else { $options['pte_thumbnail_bar'] = 'horizontal'; } } update_option(pte_get_option_name(), $options); }
function pte_imgedit_size_display() { $options = pte_get_user_options(); $option_label = pte_get_option_name(); ?> <span><input class="small-text" type="text" name="<?php print $option_label; ?> [pte_imgedit_max_size]" value="<?php if (isset($options['pte_imgedit_max_size'])) { print $options['pte_imgedit_max_size']; } ?> " id="pte_imgedit_max_size"> <?php _e("Set the max size for the crop image.", PTE_DOMAIN); ?> <br/><em><?php _e("No entry defaults to 600", PTE_DOMAIN); ?> </em> </span> <?php }
function pte_options_validate($input) { $options = pte_get_user_options(); if (isset($input['reset'])) { return array(); } $options['pte_debug'] = isset($input['pte_debug']); $options['pte_thickbox'] = isset($input['pte_thickbox']); $tmp_width = (int) preg_replace("/[\\D]/", "", $input['pte_tb_width']); if (!is_int($tmp_width) || $tmp_width < 750) { add_settings_error('pte_options', 'pte_options_error', __("Thickbox width must be at least 750 pixels.", PTE_DOMAIN)); } else { $options['pte_tb_width'] = $tmp_width; } $tmp_height = (int) preg_replace("/[\\D]/", "", $input['pte_tb_height']); if (!is_int($tmp_height) || $tmp_height < 550) { add_settings_error('pte_options', 'pte_options_error', __("Thickbox height must be greater than 550 pixels.", PTE_DOMAIN)); } else { $options['pte_tb_height'] = $tmp_height; } return $options; }