Source Code For morediv.php
Turn Line Numbers Off
<?php
- /*
- Plugin Name: More Div
- Version: 0.1
- Plugin URI: http://jfoucher.info
- Description: Puts a div with class morediv around the teaser of a post, allowing to style the teaser differently.
- Author: Jonathan Foucher
- Author URI: http://jfoucher.info/2004/10/04/teaser-style-wordpress-plugin/
- This plugin supports Automatic Update : http://wiki.wordpress.org/AutomaticUpdate
- Update: http://jfoucher.info/plugin-update.php?p=32
- Copyright (c) 2004
- Released under the GPL license
- http://www.gnu.org/licenses/gpl.txt
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
- /************************************
- ** TO TAKE ADVANTAGE OF UPDATE **
- ** DETECTION, PLEASE CONSIDER **
- ** MAKING THE FOLLOWING ADDITION **
- ** TO YOUR WORDPRESS INSTALL **
- ** **
- *************************************
- OPEN FOR EDITING : wp-admin/plugins.php
- FIND
- if ( preg_match("|Version:(.*)|i", $plugin_data, $version) )
- $version = $version1?;
- else
- $version ='';
- ADD THE FOLLOWING CODE AFTERWARDS
- // BEGIN PLUGIN UPDATE ADD-ON
- if ( preg_match("|Update:(.*)|i", $plugin_data, $update) )
- {
- $update = $update[1];
- $update = trim($update);
- if ($u = @file("$update")) {
- $u = implode('',$u);
- $u = trim($u);
- $v = trim($version);
- if($u != $v){
- $updatelink = '<a href="';
- $updatelink .= $plugin_uri[1];
- $updatelink .= '">';
- $updatelink .= '<em><strong>Update Available:</strong> (';
- $updatelink .= $u;
- $updatelink .= ')</em></a>';
- $description[1] .= '<br />';
- $description[1] .= $updatelink;
- }
- else
- {
- $updatelink = '';
- }
-
- }
- else{
- $updatelink = '';
- }
- }
- else
- { $update ='';}
- //END PLUGIN UPDATE ADD-ON
- */
- function morediv($text) {
- if (eregi("<a id=\"more-([0-9]+)\"></a>",$text)) {
- $text='<div class="morediv">'.$text;
- $text=eregi_replace("(<a id=\"more-[0-9]+\"></a>[^\n]*)","\\1</div>",$text);
- }
- return $text;
-
- }
- add_filter('the_content', 'morediv');
- ?>