-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from dartiss/develop
Version 2.3.9
- Loading branch information
Showing
10 changed files
with
163 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
] | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters