| @@ -1,59 +1,22 @@ | ||
| 1 | 1 | <?php |
| 2 | -/** | |
| 3 | - * Code Embed | |
| 4 | - * | |
| 5 | - * @package simple-embed-code | |
| 6 | - * @author David Artiss | |
| 7 | - * @license GPL-2.0-or-later | |
| 8 | - * @since 1.0 | |
| 9 | - * @version 2.6.4 | |
| 10 | - * | |
| 11 | - * Plugin Name: Code Embed | |
| 12 | - * Plugin URI: https://wordpress.org/plugins/simple-embed-code/ | |
| 13 | - * Description: Code Embed provides a very easy and efficient way to embed code (JavaScript, CSS and HTML) in your posts and pages. | |
| 14 | - * Version: 2.6.4 | |
| 15 | - * Requires at least: 4.9 | |
| 16 | - * Requires PHP: 7.4 | |
| 17 | - * Author: David Artiss | |
| 18 | - * Author URI: https://artiss.blog | |
| 19 | - * Text Domain: simple-embed-code | |
| 20 | - * License: GPL v2 or later | |
| 21 | - * License URI: https://www.gnu.org/licenses/gpl-2.0.html | |
| 22 | - * | |
| 23 | - * This program is free software; you can redistribute it and/or modify it under the terms of the GNU | |
| 24 | - * General Public License version 2, as published by the Free Software Foundation. You may NOT assume | |
| 25 | - * that you can use any other version of the GPL. | |
| 26 | - * | |
| 27 | - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without | |
| 28 | - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
| 29 | - */ | |
| 30 | - | |
| 31 | -// Exit if accessed directly. | |
| 32 | - | |
| 33 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 34 | - exit; | |
| 2 | +/* | |
| 3 | +Plugin Name: Simple Code Embed | |
| 4 | +Plugin URI: http://www.artiss.co.uk/simple-code-embed | |
| 5 | +Description: Allows you to embed code into your posts & pages | |
| 6 | +Version: 1.2 | |
| 7 | +Author: David Artiss | |
| 8 | +Author URI: http://www.artiss.co.uk | |
| 9 | +*/ | |
| 10 | +add_filter('the_content', 'simple_code_embed'); | |
| 11 | +function simple_code_embed($content) { | |
| 12 | + global $post; | |
| 13 | + $loop=1; | |
| 14 | + while ($loop<6) { | |
| 15 | + $code="CODE".$loop; | |
| 16 | + $html=get_post_meta($post->ID,$code,false); | |
| 17 | + $content=str_replace("%".$code."%",$html[0],$content); | |
| 18 | + $loop++; | |
| 19 | + } | |
| 20 | + return $content; | |
| 35 | 21 | } |
| 36 | - | |
| 37 | -// Define globals. | |
| 38 | - | |
| 39 | -if ( ! defined( 'CODE_EMBED_VERSION' ) ) { | |
| 40 | - define( 'CODE_EMBED_VERSION', '2.6.4' ); | |
| 41 | -} | |
| 42 | - | |
| 43 | -if ( ! defined( 'CODE_EMBED_PLUGIN_BASE' ) ) { | |
| 44 | - define( 'CODE_EMBED_PLUGIN_BASE', plugin_basename( __FILE__ ) ); | |
| 45 | -} | |
| 46 | - | |
| 47 | -// Include all the various functions. | |
| 48 | - | |
| 49 | -require_once plugin_dir_path( __FILE__ ) . 'includes/initialise.php'; // Initialization scripts. | |
| 50 | - | |
| 51 | -require_once plugin_dir_path( __FILE__ ) . 'includes/add-css-scripts.php'; // Add scripts to the main theme. | |
| 52 | - | |
| 53 | -require_once plugin_dir_path( __FILE__ ) . 'includes/add-embeds.php'; // Filter to apply code embeds. | |
| 54 | - | |
| 55 | -require_once plugin_dir_path( __FILE__ ) . 'includes/shared.php'; // Functions shared across all my plugins. | |
| 56 | - | |
| 57 | -require_once plugin_dir_path( __FILE__ ) . 'includes/screens.php'; // Add settings and tools screens. | |
| 58 | - | |
| 59 | -require_once plugin_dir_path( __FILE__ ) . 'includes/secure.php'; // Security functionality. | |
| 22 | +?> | |