diff --git a/optimwp.php b/optimwp.php index 1f808cd..41f5ae8 100644 --- a/optimwp.php +++ b/optimwp.php @@ -1,9 +1,9 @@ 1, 'optimwp_disable_file_editor'=> 1, 'optimwp_change_login_error'=> 1, + 'optimwp_remove_powered_by'=> 1, + 'optimwp_disable_auto_linking'=> 1, + 'optimwp_remove_capital'=> 1, 'optimwp_disable_post_revisions'=>[ '0'=> 'post', '1'=> 'page', @@ -79,6 +82,20 @@ function optimwp_plugin_action_links($links, $file) { return $links; } + function optimwp_plugin_row_meta( $links, $file ): array { + if ( plugin_basename( __FILE__ ) == $file ) { + $row_meta = [ + 'sponsor' => ' ' . esc_html__( 'Sponsor', 'optimwp' ) . '' + ]; + + return array_merge( $links, $row_meta ); + } + + return (array) $links; + } + + add_filter( 'plugin_row_meta', 'optimwp_plugin_row_meta', 10, 2 ); + // Add Menu To WordPress function optimwp_menu(): void { add_options_page('OptimWP Settings', 'OptimWP', 'manage_options', 'optimwp', 'optimwp_manage' ); @@ -87,7 +104,7 @@ function optimwp_menu(): void { // Plugin Management Page function optimwp_manage(): void{ - if( isset( $_POST["action"] ) && ( $_POST["action"] == "update" ) ){ + if( isset( $_POST['action'] ) && ( $_POST['action'] == 'update' ) ){ // Wp_nonce check if (!isset( $_POST['optimwp_update'] ) || ! wp_verify_nonce( $_POST['optimwp_update'], 'optimwp_update' ) ) { echo __('Sorry, you do not have access to this page!', 'optimwp'); @@ -117,7 +134,10 @@ function optimwp_manage(): void{ $optimwp_remove_shortlink = sanitize_text_field($_POST['optimwp_remove_shortlink']); $optimwp_disable_file_editor = sanitize_text_field($_POST['optimwp_disable_file_editor']); $optimwp_change_login_error = sanitize_text_field($_POST['optimwp_change_login_error']); + $optimwp_remove_powered_by = sanitize_text_field($_POST['optimwp_remove_powered_by']); $optimwp_remove_wlwmanifest_link = sanitize_text_field($_POST['optimwp_remove_wlwmanifest_link']); + $optimwp_disable_auto_linking = sanitize_text_field($_POST['optimwp_disable_auto_linking']); + $optimwp_remove_capital = sanitize_text_field($_POST['optimwp_remove_capital']); if(!isset($_POST['optimwp_disable_post_revisions'])){ $optimwp_disable_post_revisions =[]; }else{ @@ -149,6 +169,9 @@ function optimwp_manage(): void{ 'optimwp_remove_wlwmanifest_link'=> $optimwp_remove_wlwmanifest_link, 'optimwp_disable_file_editor'=> $optimwp_disable_file_editor, 'optimwp_change_login_error'=> $optimwp_change_login_error, + 'optimwp_remove_powered_by'=> $optimwp_remove_powered_by, + 'optimwp_disable_auto_linking'=> $optimwp_disable_auto_linking, + 'optimwp_remove_capital'=> $optimwp_remove_capital, 'optimwp_disable_post_revisions'=> $optimwp_disable_post_revisions ]; update_option('optimwp_options', $optimwp_options); @@ -158,8 +181,8 @@ function optimwp_manage(): void{ $my_options = get_option('optimwp_options'); ?>