Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions includes/add-embeds.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,6 @@ function ce_quick_replace( $content = '', $options = '', $search = '' ) {
function ce_generate_code( $html, $responsive = '', $max_width = '', $debug = '' ) {

$code = "\n";
if ( 1 !== $debug ) {
$code .= '<!-- Code Embed v' . CODE_EMBED_VERSION . " -->\n";
}

if ( false !== $max_width ) {
$code .= '<div style="width: ' . $max_width . 'px; max-width: 100%">';
Expand All @@ -202,9 +199,6 @@ function ce_generate_code( $html, $responsive = '', $max_width = '', $debug = ''
}

$code .= "\n";
if ( 1 !== $debug ) {
$code .= '<!-- ' . __( 'End of Code Embed output', 'simple-embed-code' ) . " -->\n";
}

return $code;
}
Expand Down
174 changes: 74 additions & 100 deletions includes/admin-config.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
<?php
/**
* Administration Menu Options
*
* Add various adminstration menu options
*
* @package simple-embed-code
*/
* Administration Menu Options
*
* Add various adminstration menu options
*
* @package simple-embed-code
*/

/**
* Add Settings link to plugin list
*
* Add a Settings link to the options listed against this plugin
*
* @since 1.6
*
* @param string $links Current links
* @param string $file File in use
* @return string Links, now with settings added
*/

* Add Settings link to plugin list
*
* Add a Settings link to the options listed against this plugin
*
* @param string $links Current links.
* @param string $file File in use.
* @return string Links, now with settings added.
*/
function ce_add_settings_link( $links, $file ) {

static $this_plugin;
Expand All @@ -38,24 +35,25 @@ function ce_add_settings_link( $links, $file ) {
add_filter( 'plugin_action_links', 'ce_add_settings_link', 10, 2 );

/**
* Add meta to plugin details
*
* Add options to plugin meta line
*
* @since 1.6
*
* @param string $links Current links
* @param string $file File in use
* @return string Links, now with settings added
*/

* Add meta to plugin details
*
* Add options to plugin meta line
*
* @param string $links Current links.
* @param string $file File in use.
* @return string Links, now with settings added.
*/
function ce_set_plugin_meta( $links, $file ) {

if ( false !== strpos( $file, 'code-embed.php' ) ) {

$links = array_merge( $links, array( '<a href="https://github.com/dartiss/code-embed">' . __( 'Github', 'simple-embed-code' ) . '</a>' ) );

$links = array_merge( $links, array( '<a href="https://wordpress.org/plugins/simple-embed-code/">' . __( 'Support', 'simple-embed-code' ) . '</a>' ) );

$links = array_merge( $links, array( '<a href="https://artiss.blog/donate">' . __( 'Donate', 'simple-embed-code' ) . '</a>' ) );

$links = array_merge( $links, array( '<a href="https://wordpress.org/support/plugin/simple-embed-code/reviews/#new-post">' . __( 'Write a Review', 'simple-embed-code' ) . '&nbsp;⭐️⭐️⭐️⭐️⭐️</a>' ) );
}

return $links;
Expand All @@ -64,26 +62,23 @@ function ce_set_plugin_meta( $links, $file ) {
add_filter( 'plugin_row_meta', 'ce_set_plugin_meta', 10, 2 );

/**
* Code Embed Menu
*
* Add a new option to the Admin menu and context menu
*
* @since 1.4
*
* @uses ce_help Return help text
*/

* Code Embed Menu
*
* Add a new option to the Admin menu and context menu
*
* @uses ce_help Return help text
*/
function ce_menu() {

// Add search sub-menu
// Add search sub-menu.

global $ce_search_hook;

$ce_search_hook = add_submenu_page( 'tools.php', __( 'Code Embed Search', 'simple-embed-code' ), __( 'Code Search', 'simple-embed-code' ), 'edit_posts', 'ce-search', 'ce_search' );

add_action( 'load-' . $ce_search_hook, 'ce_add_search_help' );

// Add options sub-menu
// Add options sub-menu.

global $ce_options_hook;

Expand All @@ -96,15 +91,12 @@ function ce_menu() {
add_action( 'admin_menu', 'ce_menu' );

/**
* Add Options Help
*
* Add help tab to options screen
*
* @since 2.0
*
* @uses ce_options_help Return help text
*/

* Add Options Help
*
* Add help tab to options screen
*
* @uses ce_options_help Return help text.
*/
function ce_add_options_help() {

global $ce_options_hook;
Expand All @@ -126,15 +118,12 @@ function ce_add_options_help() {
}

/**
* Add Search Help
*
* Add help tab to search screen
*
* @since 2.0
*
* @uses ce_search_help Return help text
*/

* Add Search Help
*
* Add help tab to search screen
*
* @uses ce_search_help Return help text.
*/
function ce_add_search_help() {

global $ce_search_hook;
Expand All @@ -156,43 +145,34 @@ function ce_add_search_help() {
}

/**
* Code Embed Options
*
* Define an option screen
*
* @since 1.4
*/

* Code Embed Options
*
* Define an option screen
*/
function ce_options() {

include_once( WP_PLUGIN_DIR . '/' . str_replace( basename( __FILE__ ), '', plugin_basename( __FILE__ ) ) . 'options-screen.php' );
include_once WP_PLUGIN_DIR . '/' . str_replace( basename( __FILE__ ), '', plugin_basename( __FILE__ ) ) . 'options-screen.php';

}

/**
* Code Embed Search
*
* Define a the search screen
*
* @since 1.6
*/

* Code Embed Search
*
* Define a the search screen
*/
function ce_search() {

include_once( WP_PLUGIN_DIR . '/' . str_replace( basename( __FILE__ ), '', plugin_basename( __FILE__ ) ) . 'search-screen.php' );
include_once WP_PLUGIN_DIR . '/' . str_replace( basename( __FILE__ ), '', plugin_basename( __FILE__ ) ) . 'search-screen.php';

}

/**
* Code Embed Options Help
*
* Return help text for options screen
*
* @since 1.5
*
* @return string Help Text
*/

* Code Embed Options Help
*
* Return help text for options screen
*
* @return string Help Text.
*/
function ce_options_help() {

$help_text = '<p>' . __( 'Use this screen to modify the various settings, including the identifiers and keyword used to specify your embedded code.', 'simple-embed-code' ) . '</p>';
Expand All @@ -205,15 +185,12 @@ function ce_options_help() {
}

/**
* Code Embed Search Help
*
* Return help text for search screen
*
* @since 1.6
*
* @return string Help Text
*/

* Code Embed Search Help
*
* Return help text for search screen
*
* @return string Help Text
*/
function ce_search_help() {

$help_text = '<p>' . __( 'This screen allows you to search for the post and pages that a particular code embed has been used in.', 'simple-embed-code' ) . '</p>';
Expand All @@ -224,15 +201,12 @@ function ce_search_help() {
}

/**
* Code Embed Help Sidebar
*
* Return sidebar help text
*
* @since 2.3
*
* @return string Help Text
*/

* Code Embed Help Sidebar
*
* Return sidebar help text
*
* @return string Help Text.
*/
function ce_help_sidebar() {

$help_text = '<p><strong>' . __( 'For more information:', 'simple-embed-code' ) . '</strong></p>';
Expand Down
1 change: 0 additions & 1 deletion includes/initialise.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ function ce_initialisation() {
'opening_ident' => '{{',
'keyword_ident' => 'CODE',
'closing_ident' => '}}',
'debug' => '',
'excerpts' => '',
);

Expand Down
13 changes: 0 additions & 13 deletions includes/options-screen.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@
$options['closing_ident'] = '}}';
}

if ( ! empty( $_POST['code_embed_debug'] ) ) {
$options['debug'] = sanitize_text_field( wp_unslash( $_POST['code_embed_debug'] ) ); // Input var okay.
} else {
$options['debug'] = '';
}

if ( isset( $_POST['code_embed_excerpt'] ) ) {
$options['excerpt'] = sanitize_text_field( wp_unslash( $_POST['code_embed_excerpt'] ) ); // Input var okay.
} else {
Expand All @@ -63,13 +57,6 @@
<form method="post" action="<?php echo esc_html( get_bloginfo( 'wpurl' ) ) . '/wp-admin/options-general.php?page=ce-options'; ?>">

<table class="form-table">
<tr>
<th scope="row"><label for="code_embed_debug"><?php echo esc_html( ucwords( __( 'Hide debug', 'simple-embed-code' ) ) ); ?></label></th>
<td><input type="checkbox" name="code_embed_debug" value="1"
<?php checked( '1', $options['debug'] ); ?>
/><?php esc_html_e( 'Hide debug HTML comments in source', 'simple-embed-code' ); ?></td>
</tr>

<tr>
<th scope="row"><label for="code_embed_excerpt"><?php echo esc_html( ucwords( __( 'Allow in excerpts', 'simple-embed-code' ) ) ); ?></label></th>
<td><input type="checkbox" name="code_embed_excerpt" value="1"
Expand Down
11 changes: 7 additions & 4 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Contributors: dartiss
Donate link: https://artiss.blog/donate
Tags: code, embed, html, javascript, script
Requires at least: 4.6
Tested up to: 5.3
Tested up to: 5.4
Requires PHP: 5.3
Stable tag: 2.3.2
Stable tag: 2.3.3
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -185,6 +185,9 @@ It is, in that it doesn't save any data that could be odds with GDPR compliance

[Learn more about my version numbering methodology](https://artiss.blog/2016/09/wordpress-plugin-versioning/ "WordPress Plugin Versioning")

= 2.3.3 =
* Enhancement: I've removed the debug code. I allowed to be switched off but I've never used it and it may not have switched off properly anyway. So it's gone.

= 2.3.2 =
* Bug: Fixed another pesky bug that was affecting embedded URLs. My code to do this was years old and I couldn't understand why I'd written it the way I had. So I've re-written it from scratch.

Expand Down Expand Up @@ -294,5 +297,5 @@ versions of this plugin

== Upgrade Notice ==

= 2.3.2 =
* Minor bug fix
= 2.3.3 =
* Minor change to code output
27 changes: 10 additions & 17 deletions simple-code-embed.php
Original file line number Diff line number Diff line change
@@ -1,39 +1,32 @@
<?php
/*
/**
Plugin Name: Code Embed
Plugin URI: https://github.com/dartiss/code-embed
Description: Code Embed provides a very easy and efficient way to embed code (JavaScript and HTML) in your posts and pages.
Version: 2.3.2
Version: 2.3.3
Author: David Artiss
Author URI: https://artiss.blog
Text Domain: simple-embed-code
*/

/**
* Code Embed
*
* Embed code into a post
*
* @package Code-Embed
* @since 1.6
*/
@package Code-Embed
*/

define( 'CODE_EMBED_VERSION', '2.3.2' );
define( 'CODE_EMBED_VERSION', '2.3.3' );

// Include all the various functions
// Include all the various functions.

$functions_dir = plugin_dir_path( __FILE__ ) . 'includes/';

include_once( $functions_dir . 'initialise.php' ); // Initialisation scripts
require_once $functions_dir . 'initialise.php'; // Initialisation scripts.

if ( is_admin() ) {

include_once( $functions_dir . 'admin-config.php' ); // Various administration config. options
require_once $functions_dir . 'admin-config.php'; // Various administration config. options.

} else {

include_once( $functions_dir . 'add-scripts.php' ); // Add scripts to the main theme
require_once $functions_dir . 'add-scripts.php'; // Add scripts to the main theme.

include_once( $functions_dir . 'add-embeds.php' ); // Filter to apply code embeds
require_once $functions_dir . 'add-embeds.php'; // Filter to apply code embeds.

}