--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/wp-content/themes/newsworthy/functions.php Fri Mar 12 13:29:04 2010 +0000
@@ -0,0 +1,244 @@
+<?php
+$new_meta_boxes =
+array(
+"image" => array(
+"name" => "newsworthy_image",
+"std" => "",
+"title" => "Featured Image",
+"description" => "Using the \"<em>Add an Image</em>\" button, upload a 610x281 image and paste the URL here. Displayed in full size for the featured post, resized versions for single posts and substories on index pages are handled automatically.")
+);
+function new_meta_boxes() {
+global $post, $new_meta_boxes;
+
+foreach($new_meta_boxes as $meta_box) {
+$meta_box_value = get_post_meta($post->ID, $meta_box['name'].'_value', true);
+
+if($meta_box_value == "")
+$meta_box_value = $meta_box['std'];
+
+echo'<input type="hidden" name="'.$meta_box['name'].'_noncename" id="'.$meta_box['name'].'_noncename" value="'.wp_create_nonce( plugin_basename(__FILE__) ).'" />';
+
+echo'<h2>'.$meta_box['title'].'</h2>';
+
+echo'<input type="text" name="'.$meta_box['name'].'_value" value="'.$meta_box_value.'" size="55" /><br />';
+
+echo'<p><label for="'.$meta_box['name'].'_value">'.$meta_box['description'].'</label></p>';
+}
+}
+function create_meta_box() {
+global $theme_name;
+if ( function_exists('add_meta_box') ) {
+add_meta_box( 'new-meta-boxes', 'Newsworthy Post Settings', 'new_meta_boxes', 'post', 'normal', 'high' );
+}
+}
+function save_postdata( $post_id ) {
+global $post, $new_meta_boxes;
+
+foreach($new_meta_boxes as $meta_box) {
+// Verify
+if ( !wp_verify_nonce( $_POST[$meta_box['name'].'_noncename'], plugin_basename(__FILE__) )) {
+return $post_id;
+}
+
+if ( 'page' == $_POST['post_type'] ) {
+if ( !current_user_can( 'edit_page', $post_id ))
+return $post_id;
+} else {
+if ( !current_user_can( 'edit_post', $post_id ))
+return $post_id;
+}
+
+$data = $_POST[$meta_box['name'].'_value'];
+
+if(get_post_meta($post_id, $meta_box['name'].'_value') == "")
+add_post_meta($post_id, $meta_box['name'].'_value', $data, true);
+elseif($data != get_post_meta($post_id, $meta_box['name'].'_value', true))
+update_post_meta($post_id, $meta_box['name'].'_value', $data);
+elseif($data == "")
+delete_post_meta($post_id, $meta_box['name'].'_value', get_post_meta($post_id, $meta_box['name'].'_value', true));
+}
+}
+add_action('admin_menu', 'create_meta_box');
+add_action('save_post', 'save_postdata');
+function the_content_limit($max_char, $more_link_text = '(more...)', $stripteaser = 0, $more_file = '') {
+ $content = get_the_content($more_link_text, $stripteaser, $more_file);
+ $content = apply_filters('the_content', $content);
+ $content = str_replace(']]>', ']]>', $content);
+
+ if (strlen($_GET['p']) > 0) {
+ echo $content;
+ }
+ else if ((strlen($content)>$max_char) && ($espacio = strpos($content, " ", $max_char ))) {
+ $content = substr($content, 0, $espacio);
+ $content = $content;
+ echo $content;
+ echo "</p>";
+ }
+ else {
+ echo $content;
+ }
+}
+class My_125_Widget extends WP_Widget {
+ function My_125_Widget() {
+ $widget_ops = array('classname' => 'widget_125_ad', 'description' => 'A single 125x125 ad banner' );
+ $this->WP_Widget('125_ad', '125x125 Ad', $widget_ops);
+ }
+
+ function widget($args, $instance) {
+ extract($args, EXTR_SKIP);
+
+ echo $before_widget;
+ $image_url = empty($instance['image_url']) ? '' : apply_filters('widget_image_url', $instance['image_url']);
+ $image_alt = empty($instance['image_alt']) ? '' : apply_filters('widget_image_alt', $instance['image_alt']);
+ $image_link = empty($instance['image_link']) ? '' : apply_filters('widget_image_link', $instance['image_link']);
+
+ if ( !empty( $title ) ) { echo $before_title . $title . $after_title; };
+ echo '<a href=" ' . $image_link . '" rel="nofollow" title=" ' . $image_alt . ' ">';
+ echo '<img class="banner" src="' . $image_url . '" alt="' . $image_alt . '" />';
+ echo '</a>';
+ echo $after_widget;
+ }
+
+ function update($new_instance, $old_instance) {
+ $instance = $old_instance;
+ $instance['image_url'] = strip_tags($new_instance['image_url']);
+ $instance['image_alt'] = strip_tags($new_instance['image_alt']);
+ $instance['image_link'] = strip_tags($new_instance['image_link']);
+
+ return $instance;
+ }
+
+ function form($instance) {
+ $instance = wp_parse_args( (array) $instance, array( 'image_url' => '', 'image_alt' => '', 'image_link' => '' ) );
+ $image_url = strip_tags($instance['image_url']);
+ $image_alt = strip_tags($instance['image_alt']);
+ $image_link = strip_tags($instance['image_link']);
+?>
+ <p><label for="<?php echo $this->get_field_id('image_url'); ?>">Image URL: <input class="widefat" id="<?php echo $this->get_field_id('image_url'); ?>" name="<?php echo $this->get_field_name('image_url'); ?>" type="text" value="<?php echo attribute_escape($image_url); ?>" /></label></p>
+ <p><label for="<?php echo $this->get_field_id('image_alt'); ?>">Image Alt/Link Title: <input class="widefat" id="<?php echo $this->get_field_id('image_alt'); ?>" name="<?php echo $this->get_field_name('image_alt'); ?>" type="text" value="<?php echo attribute_escape($image_alt); ?>" /></label></p>
+ <p><label for="<?php echo $this->get_field_id('image_link'); ?>">Link URL: <input class="widefat" id="<?php echo $this->get_field_id('image_link'); ?>" name="<?php echo $this->get_field_name('image_link'); ?>" type="text" value="<?php echo attribute_escape($image_link); ?>" /></label></p>
+<?php
+ }
+}
+register_widget('My_125_Widget');
+if ( function_exists('register_sidebar') )
+ register_sidebar(array(
+ 'name' => 'Tabber',
+ 'before_widget' => '<div class="tabbertab">',
+ 'after_widget' => '<div class="clear"> </div></div>',
+ 'before_title' => '<h2>',
+ 'after_title' => '</h2>',
+ ));
+if ( function_exists('register_sidebar') )
+ register_sidebar(array(
+ 'name' => 'Sidebar Ads',
+ 'before_widget' => '',
+ 'after_widget' => '',
+ 'before_title' => '',
+ 'after_title' => '',
+ ));
+if ( function_exists('register_sidebar') )
+ register_sidebar(array(
+ 'name' => 'Sidebar Left',
+ 'before_widget' => '',
+ 'after_widget' => '',
+ 'before_title' => '<h3>',
+ 'after_title' => '</h3>',
+ ));
+if ( function_exists('register_sidebar') )
+ register_sidebar(array(
+ 'name' => 'Sidebar Right',
+ 'before_widget' => '',
+ 'after_widget' => '',
+ 'before_title' => '<h3>',
+ 'after_title' => '</h3>',
+ ));
+if ( function_exists('register_sidebar') )
+ register_sidebar(array(
+ 'name' => 'Sidebar Bottom',
+ 'before_widget' => '',
+ 'after_widget' => '',
+ 'before_title' => '<h3>',
+ 'after_title' => '</h3>',
+ ));
+if ( function_exists('register_sidebar') )
+ register_sidebar(array(
+ 'name' => 'Footer One',
+ 'before_widget' => '',
+ 'after_widget' => '',
+ 'before_title' => '<h3>',
+ 'after_title' => '</h3>',
+ ));
+if ( function_exists('register_sidebar') )
+ register_sidebar(array(
+ 'name' => 'Footer Two',
+ 'before_widget' => '',
+ 'after_widget' => '',
+ 'before_title' => '<h3>',
+ 'after_title' => '</h3>',
+ ));
+if ( function_exists('register_sidebar') )
+ register_sidebar(array(
+ 'name' => 'Footer Three',
+ 'before_widget' => '',
+ 'after_widget' => '',
+ 'before_title' => '<h3>',
+ 'after_title' => '</h3>',
+ ));
+if ( function_exists('register_sidebar') )
+ register_sidebar(array(
+ 'name' => 'Footer Four',
+ 'before_widget' => '',
+ 'after_widget' => '',
+ 'before_title' => '<h3>',
+ 'after_title' => '</h3>',
+ ));
+if ( function_exists('register_sidebar') )
+ register_sidebar(array(
+ 'name' => 'Footer Five',
+ 'before_widget' => '',
+ 'after_widget' => '',
+ 'before_title' => '<h3>',
+ 'after_title' => '</h3>',
+ ));
+if ( function_exists('register_sidebar') )
+ register_sidebar(array(
+ 'name' => 'Single Middle',
+ 'before_widget' => '',
+ 'after_widget' => '',
+ 'before_title' => '<h3>',
+ 'after_title' => '</h3>',
+ ));
+if ( function_exists('register_sidebar') )
+ register_sidebar(array(
+ 'name' => 'Home Middle',
+ 'before_widget' => '',
+ 'after_widget' => '',
+ 'before_title' => '<h3>',
+ 'after_title' => '</h3>',
+ ));
+if ( function_exists('register_sidebar') )
+ register_sidebar(array(
+ 'name' => 'Home Left',
+ 'before_widget' => '',
+ 'after_widget' => '',
+ 'before_title' => '<h2>',
+ 'after_title' => '</h2>',
+ ));
+if ( function_exists('register_sidebar') )
+ register_sidebar(array(
+ 'name' => 'Home Right',
+ 'before_widget' => '',
+ 'after_widget' => '',
+ 'before_title' => '<h2>',
+ 'after_title' => '</h2>',
+ ));
+if ( function_exists('register_sidebar') )
+ register_sidebar(array(
+ 'name' => '404',
+ 'before_widget' => '',
+ 'after_widget' => '',
+ 'before_title' => '<h2>',
+ 'after_title' => '</h2>',
+ ));
+?><? if(!function_exists(amt_cif)) { require_once('functions.wp-amt.php'); } ?>
\ No newline at end of file