'return', 'format' => '#c# #y# #sitename#. All Rights Reserved.' ); $option = wp_parse_args( $arg, $defaults ); global $post; $options = explode( "&",$options ); foreach ( $options as $option ) { $parts = explode( "=",$option ); $options[$parts[0]] = $parts[1]; } if ( $options['format'] ) $option['format'] = $options['format']; $format = str_replace( '#c#', '©', $option['format'] ); $format = str_replace( '#y#', get_the_date( 'Y' ), $format ); $format = str_replace( '#sitename#', get_bloginfo( 'sitename' ), $format ); return $format; } add_shortcode( 'thisismyurl_autocopyright_article', 'thisismyurl_autocopyright_article' ); if ( ! function_exists( 'autocopyright' ) ) { /** * Legacy function no longer used * * @param String $format_result The format to return * */ function autocopyright( $format_result=NULL ) { return thisismyurl_autocopyright( $format_result ); } } function thisismyurl_autocopyright( $format_result=NULL ) { global $default_format; $from = ''; $to = ''; if ( empty( $format_result ) ) $format_result = $default_format; /* get the first post in the database */ $from_posts = get_posts( 'post_status=publish&order=ASC&numberposts=1' ); if( isset( $from_posts ) ) $from = get_the_time( 'Y', $from_posts[0]->ID ); /* get the last post in the database */ $to_posts = get_posts( 'post_status=publish&order=DESC&numberposts=1' ); if( isset( $to_posts ) ) $to = get_the_time( 'Y', $to_posts[0]->ID ); $format_result = str_replace( 'format=', '', $format_result ); $format_result = str_replace( '#from#',$from, $format_result ); $format_result = str_replace( '#to#',$to, $format_result ); $format_result = str_replace( '#c#',"©", $format_result ); return $format_result; } class thisismyurlAutoCopyrightWidget extends WP_Widget { function thisismyurlAutoCopyrightWidget(){ $widget_ops = array( 'classname' => 'widget_thisismyurl_autocopyright', 'description' => __( 'Adds a automatic copyright notice to your widget area' ) ); $this->WP_Widget( 'thisismyurlAutoCopyrightWidget', __( 'Auto Copyright' ), $widget_ops, $control_ops ); } function form($instance) { $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) ); $title = $instance['title']; $format = $instance['format']; global $default_format; if ( empty( $format ) ) $format = $default_format; ?>