$value) { $options[$option] = $value; } add_option($settings,$options); } unset($service_config); } } if (function_exists($service_name.'_extras')) { $extras = call_user_func($service_name.'_extras'); if ( get_option($service_name.'_extras') ) { update_option('webtv_'.$service_name.'_extras', $extras); } else { add_option('webtv_'.$service_name.'_extras', $extras); } } } } //Activate_me function add_config_page() { if ( function_exists('add_submenu_page') ) { add_options_page('WebTV for WordPress Configuration', 'WebTV', 8, basename(__FILE__), array(&$this,'config_page')); add_filter( 'plugin_action_links', array( &$this, 'filter_plugin_actions'), 10, 2 ); } } function filter_plugin_actions( $links, $file ){ //Static so we don't call plugin_basename on every plugin row. static $this_plugin; if ( ! $this_plugin ) $this_plugin = plugin_basename(__FILE__); if ( dirname($file) == dirname($this_plugin) ){ $settings_link = '' . __('Settings') . ''; array_unshift( $links, $settings_link ); // before other links } return $links; } function config_page() { if (!current_user_can('manage_options')) die(__('You cannot edit the WebTV options.')); $options = get_option("webtv"); //print_r($options); if (!is_array($options)) { $options = array(); $options['attemps'] = 3; add_option("webtv",$options); } if (!is_array($options['order'])) { foreach ($options['services'] as $service) { $options['order'][] = $service; } update_option("webtv",$options); } if ( isset($_POST['submit']) ) { check_admin_referer('webtv-config'); //print_r($_POST); if (isset($_POST['attemps']) && is_numeric($_POST['attemps'])) { $options['attemps'] = $_POST['attemps']; if ($options['attemps'] < 1) { $options['attemps'] = 3; } if ($options['attemps'] > 6) { $options['attemps'] = 6; } } if (isset($_POST['attemps']) && $_POST['attemps'] == "") { $options['attemps'] = 3; } if (isset($_POST['orderedlist'])) { $service_order = split("\|", $_POST['orderedlist']); $options['order'] = $service_order; } update_option("webtv",$options); $services = $_POST['service']; foreach ($services as $service_name => $service) { $service_settings = get_option("webtv_".$service_name); $enabled = false; if ($service['enabled'] == 'true') { $enabled = true; } unset($service['enabled']); foreach ($service as $option => $value) { if ($value == "") $enabled = false; $service_settings[$option] = $value; } $service_settings['enabled'] = $enabled; update_option("webtv_".$service_name,$service_settings); } } if ( isset($_POST['cleanupsubmit']) ) { check_admin_referer('webtv-cleanup'); global $wpdb, $table_prefix; $query = 'DELETE FROM '.$table_prefix.'options WHERE option_name like "webtv%"'; $wpdb->query($query); if (isset($_POST['cleanup'])) { $query = 'DELETE FROM '.$table_prefix.'postmeta WHERE meta_key like "webtv%"'; $wpdb->query($query); echo "

WebTV ha eliminado toda la información.

\n"; } echo "

WebTV ha sido desinstalado.

\n"; } ?>

WebTV Configuration




$extraoptions) { ?> '; unset($settings[$type]); } } foreach ($settings as $option => $value) { $type = "text"; if ($option == "password") { $type = "password"; } ?>





" onClick="submitForm()" />


" />

webtv_is_admin_page(array('post.php', 'post-new.php', 'page.php', 'page-new.php')) ) { $url = get_option('siteurl'); $url .= '/wp-content/plugins/'. dirname(plugin_basename(__FILE__)).'/includes/'; wp_enqueue_script('webtv-insert',$url. 'webtvhandlers.js',array('swfupload') ); global $post_ID, $temp_ID; $post_id = (int) (0 == $post_ID ? $temp_ID : $post_ID); $maxsize = $this->return_formatbytes(ini_get('post_max_size')); ?>