Skip to content

Commit

Permalink
Merge pull request #67 from dartiss/develop
Browse files Browse the repository at this point in the history
Version 2.3.9
  • Loading branch information
dartiss authored Apr 19, 2024
2 parents 49e4a55 + 8572685 commit 53ffcb6
Show file tree
Hide file tree
Showing 10 changed files with 163 additions and 71 deletions.
30 changes: 30 additions & 0 deletions assets/blueprints/blueprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"landingPage": "\/wp-admin\/options-general.php?page=ce-options",
"preferredVersions": {
"php": "8.0",
"wp": "latest"
},
"phpExtensionBundles": [
"kitchen-sink"
],
"features": {
"networking": true
},
"steps": [
{
"step": "installPlugin",
"pluginZipFile": {
"resource": "url",
"url": "https:\/\/downloads.wordpress.org\/plugin\/simple-embed-code.zip"
},
"options": {
"activate": true
}
},
{
"step": "login",
"username": "admin",
"password": "password"
}
]
}
Binary file modified assets/icon-128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/icon-256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/screenshot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions includes/add-embeds.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ function ce_quick_replace( $content = '', $options = '', $search = '' ) {
*/
function ce_generate_code( $html, $responsive = '', $max_width = '' ) {

$code = "\n";
$code = '';

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

$code .= "\n";

return $code;
}

Expand Down
58 changes: 2 additions & 56 deletions includes/admin-config.php → includes/screens.php
Original file line number Diff line number Diff line change
@@ -1,66 +1,12 @@
<?php
/**
* Administration Menu Options
* Add screens
*
* Add various adminstration menu options
* Add settings and tools screens.
*
* @package simple-embed-code
*/

/**
* 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;

if ( ! $this_plugin ) {
$this_plugin = plugin_basename( __FILE__ );
}

if ( false !== strpos( $file, 'code-embed.php' ) ) {
$settings_link = '<a href="admin.php?page=ce-options">' . __( 'Settings', 'simple-embed-code' ) . '</a>';
array_unshift( $links, $settings_link );
}

return $links;
}

add_filter( 'plugin_action_links', 'ce_add_settings_link', 10, 2 );

/**
* 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;
}

add_filter( 'plugin_row_meta', 'ce_set_plugin_meta', 10, 2 );

/**
* Code Embed Menu
*
Expand Down
104 changes: 104 additions & 0 deletions includes/shared.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<?php
/**
* Shared Functions
*
* A group of functions shared across my plugins, for consistency.
*
* @package simple-embed-code
*/

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

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

$links = array_merge(
$links,
array( '<a href="https://github.com/dartiss/code-embed">' . __( 'Github', 'simple-embed-code' ) . '</a>' ),
array( '<a href="https://wordpress.org/support/plugin/simple-embed-code">' . __( 'Support', 'simple-embed-code' ) . '</a>' ),
array( '<a href="https://artiss.blog/donate">' . __( 'Donate', 'simple-embed-code' ) . '</a>' ),
array( '<a href="https://wordpress.org/support/plugin/simple-embed-code/reviews/?filter=5" title="' . __( 'Rate the plugin on WordPress.org', 'simple-embed-code' ) . '" style="color: #ffb900">' . str_repeat( '<span class="dashicons dashicons-star-filled" style="font-size: 16px; width:16px; height: 16px"></span>', 5 ) . '</a>' ),
);
}

return $links;
}

add_filter( 'plugin_row_meta', 'sec_plugin_meta', 10, 2 );

/**
* Modify actions links.
*
* Add or remove links for the actions listed against this plugin
*
* @version 1.1
* @param string $actions Current actions.
* @param string $plugin_file The plugin.
* @return string Actions, now with deactivation removed!
*/
function sec_action_links( $actions, $plugin_file ) {

// Make sure we only perform actions for this specific plugin!
if ( strpos( $plugin_file, 'simple-code-embed.php' ) !== false ) {

// Add link to the settings page.
if ( current_user_can( 'manage_options' ) ) {
array_unshift( $actions, '<a href="admin.php?page=ce-options">' . __( 'Settings', 'simple-embed-code' ) . '</a>' );
}
}

return $actions;
}

add_filter( 'plugin_action_links', 'sec_action_links', 10, 2 );

/**
* WordPress Fork Check
*
* Deactivate the plugin if an unsupported fork of WordPress is detected.
*
* @version 1.0
*/
function sec_fork_check() {

// Check for a fork.

if ( function_exists( 'calmpress_version' ) || function_exists( 'classicpress_version' ) ) {

// Grab the plugin details.

$plugins = get_plugins();
$name = $plugins[ CODE_EMBED_PLUGIN_BASE ]['Name'];

// Deactivate this plugin.

deactivate_plugins( CODE_EMBED_PLUGIN_BASE );

// Set up a message and output it via wp_die.

/* translators: 1: The plugin name. */
$message = '<p><b>' . sprintf( __( '%1$s has been deactivated', 'simple-embed-code' ), $name ) . '</b></p><p>' . __( 'Reason:', 'simple-embed-code' ) . '</p>';
/* translators: 1: The plugin name. */
$message .= '<ul><li>' . __( 'A fork of WordPress was detected.', 'simple-embed-code' ) . '</li></ul><p>' . sprintf( __( 'The author of %1$s will not provide any support until the above are resolved.', 'simple-embed-code' ), $name ) . '</p>';

$allowed = array(
'p' => array(),
'b' => array(),
'ul' => array(),
'li' => array(),
);

wp_die( wp_kses( $message, $allowed ), '', array( 'back_link' => true ) );
}
}

add_action( 'admin_init', 'sec_fork_check' );
21 changes: 13 additions & 8 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
=== Code Embed ===
Contributors: dartiss
Donate link: https://artiss.blog/donate
Tags: code, embed, html, css, javascript, script
Tags: code, embed, html, css, javascript
Requires at least: 4.6
Tested up to: 6.4
Tested up to: 6.5
Requires PHP: 7.4
Stable tag: 2.3.8
Stable tag: 2.3.9
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

🧩 Code Embed provides a very easy and efficient way to embed code (JavaScript, CSS and HTML) in your posts and pages.
Code Embed provides a very easy and efficient way to embed code (JavaScript, CSS and HTML) in your posts and pages.

== Description ==

Expand All @@ -26,9 +26,9 @@ Key features include...
* Embed an external script directly using just the URL
* And much, much more!

Iconography is courtesy of the very talented [Janki Rathod](https://www.fiverr.com/jankirathore) ♥️
Iconography is courtesy of the very talented [Janki Rathod](https://www.fiverr.com/jankirathore).

👉 Please visit the [Github page](https://github.com/dartiss/code-embed "Github") for the latest code development, planned enhancements and known issues 👈
**Please visit the [Github page](https://github.com/dartiss/code-embed "Github") for the latest code development, planned enhancements and known issues**

== Getting Started ==

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

I use semantic versioning, with the first release being 1.0.

= 2.3.9 =
* Enhancement: So, let me tell you a story. To make the output look neat, I was adding carriage returns to the embeds. Except, if you want to embed something part way through a line it can look... well... wrong. And all for it looking clean. Remember kids, cleanlyness isn't always next to Godlyness. Needless to say, those rogue carriage returns are gone
* Enhancement: Whilst I was at it, I updated some of the settings code to a brand-spanking new version, which I'm sharing across all my plugins
* Enhancement: Tidied up some of the assets, including adding a blueprint for WordPress Playground

= 2.3.8 =
* Bug: You know that vulnerability I fixed in 2.3.7? It fixed that but broke something else. That should now resolved. Apologies for that.

Expand Down Expand Up @@ -327,5 +332,5 @@ versions of this plugin

== Upgrade Notice ==

= 2.3.8 =
* Critical bug fix
= 2.3.9 =
* Minor improvement to output to elliminate unwanted carriage returns
16 changes: 12 additions & 4 deletions simple-code-embed.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
*
* Plugin Name: Code Embed
* Plugin URI: https://wordpress.org/plugins/simple-embed-code/
* Description: 🧩 Code Embed provides a very easy and efficient way to embed code (JavaScript and HTML) in your posts and pages.
* Version: 2.3.8
* Description: Code Embed provides a very easy and efficient way to embed code (JavaScript and HTML) in your posts and pages.
* Version: 2.3.9
* Requires at least: 4.6
* Requires PHP: 7.4
* Author: David Artiss
Expand All @@ -26,7 +26,13 @@
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/

define( 'CODE_EMBED_VERSION', '2.3.8' );
define( 'CODE_EMBED_VERSION', '2.3.9' );

// Define global to hold the plugin base file name.

if ( ! defined( 'CODE_EMBED_PLUGIN_BASE' ) ) {
define( 'CODE_EMBED_PLUGIN_BASE', plugin_basename( __FILE__ ) );
}

// Include all the various functions.

Expand All @@ -36,7 +42,9 @@

if ( is_admin() ) {

require_once $functions_dir . 'admin-config.php'; // Various administration config. options.
require_once $functions_dir . 'shared.php'; // Functions shared across all my plugins.

require_once $functions_dir . 'screens.php'; // Add settings and tools screens.

} else {

Expand Down

0 comments on commit 53ffcb6

Please sign in to comment.