public function check_update() { if( ! current_user_can( 'manage_options' ) || ! current_user_can( 'install_plugins' ) ) return; // gets current database version $current_db_version = get_option( 'image_watermark_version', '1.0.0' ); // new version? if ( version_compare( $current_db_version, Image_Watermark()->defaults['version'], '<' ) ) { // update plugin version update_option( 'image_watermark_version', Image_Watermark()->defaults['version'] ); } }
static $plugin; $plugin = plugin_basename( __FILE__ ); if ( $file == $plugin ) { $settings_link = sprintf( '<a href="%s">%s</a>', admin_url( 'options-general.php' ) . '?page=watermark-options', __( 'Settings', 'image-watermark' ) ); array_unshift( $links, $settings_link ); } return $links; } } /** * Get instance of main class. * * @return object Instance */ function Image_Watermark() { static $instance; // first call to instance() initializes the plugin if ( $instance === null || ! ( $instance instanceof Image_Watermark ) ) $instance = Image_Watermark::instance(); return $instance; } Image_Watermark();
/** * Logged-in users image protection option. */ public function iw_protection_logged() { ?> <label for="iw_protection_logged"> <input id="iw_protection_logged" type="checkbox" <?php checked( ( ! empty( Image_Watermark()->options['image_protection']['forlogged'] ) ? 1 : 0 ), 1, true ); ?> value="1" name="iw_options[image_protection][forlogged]"> <?php _e( 'Enable image protection for logged-in users also', 'image-watermark' ); ?> </label> <?php }