. */ /* Stop direct call */ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die("Sorry, you don't have direct access to this page."); } /* attach JavaScript file for textarea reszing */ $ae_path = WP_CONTENT_URL.'/plugins/'.plugin_basename(dirname(__FILE__)).'/'; function ae_js_sheet() { global $ae_path; wp_enqueue_script('ta-resize-script', $ae_path.'ta-expander.js', false, false, true); } add_action('admin_print_scripts-widgets.php', 'ae_js_sheet'); add_action('admin_footer-widgets.php', 'ae_write_script'); //Additional links on the plugin page add_filter('plugin_row_meta', 'ae_register_links',10,2); function ae_register_links($links, $file) { $base = plugin_basename(__FILE__); if ($file == $base) { $links[] = ''.__('FAQ', 'adseasy').''; $links[] = ''.__('Donate', 'adseasy').''; } return $links; } // extending the widget class class Ads_Easy_Widget extends WP_Widget { function Ads_Easy_Widget() { $widget_opts = array( 'description' => __('You can show ads in your sidebars and other widgetareas with this widget. Define, on what kind of pages they will show up.', 'adseasy') ); $control_opts = array( 'width' => 400 ); parent::WP_Widget(false, $name = 'Ads Easy', $widget_opts, $control_opts); } function form($instance) { $defaults = array( 'homepage' => true, 'category' => true ); $instance = wp_parse_args( (array) $instance, $defaults ); $title = esc_attr($instance['title']); $name = esc_attr($instance['name']); $adblock = $instance['adblock']; $style=esc_attr($instance['style']); $homepage=esc_attr($instance['homepage']); $frontpage=esc_attr($instance['frontpage']); $page=esc_attr($instance['page']); $category=esc_attr($instance['category']); $single=esc_attr($instance['single']); $date=esc_attr($instance['date']); $tag=esc_attr($instance['tag']); $attachment=esc_attr($instance['attachment']); $taxonomy=esc_attr($instance['taxonomy']); $author=esc_attr($instance['author']); $search=esc_attr($instance['search']); $not_found=esc_attr($instance['not_found']); $logged_in=esc_attr($instance['logged_in']); if (empty($style)) { $style_height=25; } else { $ae_elements=str_replace(array("\r\n", "\n", "\r"), '|', $style); $style_height=count(explode('|', $ae_elements))*21; } if (empty($adblock)) { $adblock_height=25; } else { $ae_elements=str_replace(array("\r\n", "\n", "\r"), '|', $adblock); $adblock_height=count(explode('|', $ae_elements))*21; } ?>













"; $ae_after_widget=""; } echo $ae_before_widget; if ( $title ) { echo $before_title . $title . $after_title; } /* This is the actual function of the plugin, it fills the sidebar with the customized excerpts */ echo $instance['adblock']; echo $ae_after_widget; }}} } add_action('widgets_init', create_function('', 'return register_widget("Ads_Easy_Widget");')); // import laguage files load_plugin_textdomain('adseasy', false , basename(dirname(__FILE__)).'/languages'); ?>