Skip to content

Commit

Permalink
Release 1.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
mihdan committed Nov 28, 2023
1 parent a1f146c commit fe5b5e1
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 6 deletions.
4 changes: 2 additions & 2 deletions mihdan-lite-youtube-embed.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Plugin Name: Lite Video Embed
* Description: A faster YouTube/RuTube embed. Renders faster than a sneeze.
* Version: 1.7.1
* Version: 1.7.2
* Author: Mikhail Kobzarev
* Author URI: https://www.kobzarev.com/
* Plugin URI: https://wordpress.org/plugins/mihdan-lite-youtube-embed/
Expand All @@ -18,7 +18,7 @@
exit;
}

define( 'MIHDAN_LITE_YOUTUBE_EMBED_VERSION', '1.7.1' );
define( 'MIHDAN_LITE_YOUTUBE_EMBED_VERSION', '1.7.2' );
define( 'MIHDAN_LITE_YOUTUBE_EMBED_SLUG', 'mihdan-lite-youtube-embed' );
define( 'MIHDAN_LITE_YOUTUBE_EMBED_NAME', 'Lite Video Embed' );
define( 'MIHDAN_LITE_YOUTUBE_EMBED_DIR', __DIR__ );
Expand Down
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://www.kobzarev.com/donate/
Tags: youtube, wordpress, seo-friendly, seo, cache, embed
Requires at least: 5.0
Tested up to: 6.4
Stable tag: 1.7.1
Stable tag: 1.7.2
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -54,6 +54,10 @@ e.g.

== Changelog ==

= 1.7.2 (28.11.2023) =
* Added setting to clean up the database when the plugin is uninstalled
* Fixed a fatal error occurring when deleting the cache

= 1.7.1 (17.11.2023) =
* Fixed the hook `mlye/youtube/render`

Expand Down
6 changes: 5 additions & 1 deletion src/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ function admin_init() {
foreach ( $this->sections_array as $section ) {
if ( false == get_option( $section['id'] ) ) {
// Add a new field as section ID.
add_option( $section['id'] );
add_option( $section['id'], [] );
}

// Deals with sections description.
Expand Down Expand Up @@ -950,6 +950,10 @@ function script() {
#mlye_plugins .form-table > tr > th,
#mlye_plugins .form-table > tbody > tr > th {
display: none;
}
#submit_mlye_contacts,
#submit_mlye_plugins {
display: none;
}
</style>
<?php
Expand Down
22 changes: 21 additions & 1 deletion src/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,16 @@ public function setup_fields() {
)
);

$this->wposa->add_field(
'mlye_tools',
[
'id' => 'delete_plugin_data',
'type' => 'checkbox',
'name' => __( 'Delete plugin data', 'mihdan-lite-youtube-embed' ),
'desc' => __( 'Delete plugin data upon uninstall.', 'mihdan-lite-youtube-embed' ),
]
);

$this->wposa->add_section(
array(
'id' => 'mlye_contacts',
Expand All @@ -256,7 +266,17 @@ public function setup_fields() {
'id' => 'description',
'type' => 'html',
'name' => __( 'Telegram', 'mihdan-lite-youtube-embed' ),
'desc' => __( 'Связаться со мной можно в телеграм <a href="https://t.me/+BMLrs_JudDg3Y2Zi" target="_blank">чате поддержки</a>', 'mihdan-lite-youtube-embed' ),
'desc' => __( '🆘 Связаться со мной можно в телеграм <a href="https://t.me/+BMLrs_JudDg3Y2Zi" target="_blank">чате поддержки</a>.', 'mihdan-lite-youtube-embed' ),
)
);

$this->wposa->add_field(
'mlye_contacts',
array(
'id' => 'donate',
'type' => 'html',
'name' => __( 'Donate', 'mihdan-lite-youtube-embed' ),
'desc' => __( '❤️ Помочь в развитии проекта можно на <a href="https://www.kobzarev.com/donate/" target="_blank">официальнос сайте</a>', 'mihdan-lite-youtube-embed' ),
)
);

Expand Down
21 changes: 20 additions & 1 deletion uninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,36 @@ class Uninstall {
*/
public function __construct() {
$this->clear_oembed_cache();

$tools = get_option( 'mlye_tools' );

// Delete plugin data upon uninstall.
if ( isset( $tools['delete_plugin_data'] ) && $tools['delete_plugin_data'] === 'on' ) {
$this->delete_plugin_data();
}
}

/**
* Clear oembed cache.
*/
public function clear_oembed_cache() {
public function clear_oembed_cache(): void {
global $wpdb;

$sql = "DELETE FROM {$wpdb->postmeta} WHERE LEFT(meta_key, 8) = '_oembed_'";
$wpdb->query( $sql );
}

/**
* Delete plugin data upon uninstall.
*
* @return void
*/
public function delete_plugin_data(): void {
global $wpdb;

$sql = "DELETE FROM {$wpdb->options} WHERE LEFT(option_name, 5) = 'mlye_'";
$wpdb->query( $sql );
}
}

new Uninstall();

0 comments on commit fe5b5e1

Please sign in to comment.