> Read the accompanying readme.txt file for instructions and documentation. =>> Also, visit the plugin's homepage for additional information and updates. =>> Or visit: http://wordpress.org/extend/plugins/hide-broken-shortcodes/ */ /* Copyright (c) 2009-2011 by Scott Reilly (aka coffee2code) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ if ( is_admin() && !class_exists( 'c2c_ExpandableDashboardRecentComments' ) ) : class c2c_ExpandableDashboardRecentComments { // This just defines the default config. Values can be filtered via the filter 'c2c_expandable_dashboard_recent_comments_config' public static $config = array( 'remove-ellipsis' => false, 'more-text' => ' »', 'less-text' => ' «' ); /** * Class constructor: initializes class variables and adds actions and filters. */ public static function init() { global $pagenow; if ( 'index.php' == $pagenow ) add_action( 'admin_init', array( __CLASS__, 'do_init' ) ); } /** * Initialize the config and register actions/filters */ public static function do_init() { self::$config = apply_filters( 'c2c_expandable_dashboard_recent_comments_config', self::$config ); add_action( 'admin_head', array( __CLASS__, 'add_css' ) ); add_filter( 'comment_excerpt', array( __CLASS__, 'expandable_comment_excerpts' ) ); } /** * Echoes the CSS for this plugin within style tags * */ public static function add_css() { echo << #the-comment-list .comment-item blockquote .excerpt-full p { display:block; margin:1em 0; } CSS; } /** * Modifies a comment excerpt to add link to expand comments (using JavaScript). * * @param string $excerpt Excerpt * @return string The $excerpt modified to have show more/less links when applicable */ public static function expandable_comment_excerpts( $excerpt ) { global $comment; if ( preg_match( '/\.\.\.$/', $excerpt ) ) { $body = apply_filters( 'comment_text', apply_filters( 'get_comment_text', $comment->comment_content ), '40' ); $class = "excerpt-{$comment->comment_ID}"; $extended = "
" . ( self::$config['remove-ellipsis'] ? substr( $excerpt, 0, -3 ) : $excerpt ) . "" . self::$config['more-text'] . '
' . "'; $excerpt = preg_replace( '/\.\.\.$/', $excerpt, $extended ); } return $excerpt; } } // end c2c_ExpandableDashboardRecentComments c2c_ExpandableDashboardRecentComments::init(); endif; // end if !class_exists() ?>