diff --git a/README.md b/README.md index 7966754..61cd518 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -WP SVG Icons v3.1 +WP SVG Icons v3.1.1 ============= - **Contributors** : eherman24 @@ -118,6 +118,13 @@ If you buy the pro version you will also receive support and updates for one yea #### Changelog += 3.1.1 - March 5th, 2015 = +* Fixed bug where clicking custom icon didn't load it into the preview container +* Added new setting to delete custom icon pack on plugin uninstall +* Re-wrote uninstall function to remove all plugin created options +* Added 2 week upgrade/review notification +* Minor style enhancements and bug fixes + = 3.1 - March 3rd, 2015 = * Fix link styles overriding WordPress defaults * Minified default icon styles, added appropriate element classes and enqueued across dashboard diff --git a/admin/class-wp-svg-icons-admin.php b/admin/class-wp-svg-icons-admin.php index b0f89e1..710e483 100644 --- a/admin/class-wp-svg-icons-admin.php +++ b/admin/class-wp-svg-icons-admin.php @@ -53,7 +53,19 @@ public function __construct( $plugin_name, $version ) { add_action( 'wp_update_nav_menu_item', array( $this, 'wp_svg_icons_update_custom_nav_fields'), 10, 3 ); // action hook which handles the ajax request of deleting files - add_action('wp_ajax_svg_delete_custom_pack', array( &$this , 'svg_delete_custom_pack_ajax' ) ); + add_action('wp_ajax_svg_delete_custom_pack', array( &$this , 'svg_delete_custom_pack_ajax' ) ); + + // custom font pack found error + add_action('admin_notices', array( &$this , 'wp_svg_customPack_installed_error' ) ); + + // set the custom upload directory + add_action( 'admin_head', array( &$this , 'wp_svg_change_downloads_upload_dir' ) , 999 ); + + // check the users plugin installation date + add_action( 'admin_init', array( &$this , 'wp_svg_icons_check_installation_date' ) ); + + // dismissable notice admin side + add_action( 'admin_init', array( &$this , 'wp_svg_icons_stop_bugging_me' ), 5 ); } /** @@ -116,13 +128,7 @@ public function enqueue_scripts() { // enqueue our nav scripts/styles $this->enqueue_custom_nav_scripts_on_nav_menu_page(); - - // custom font pack found error - add_action('admin_notices', array( &$this , 'wp_svg_customPack_installed_error' ) ); - - // set the custom upload directory - add_action( 'admin_head', array( &$this , 'wp_svg_change_downloads_upload_dir' ) , 999 ); - + } // ajax delete our .zip and entire directory for the custom pack! @@ -338,6 +344,78 @@ public function recursive_delete_directory( $dir ) { } } + /* + wp_svg_icons_stop_bugging_me() + Remove the Review us notification when user clicks 'Dismiss' + @since v3.1.1 + */ + public function wp_svg_icons_stop_bugging_me() { + $nobug = ""; + if ( isset( $_GET['wp_svg_icons_nobug'] ) ) { + $nobug = esc_attr( $_GET['wp_svg_icons_nobug'] ); + } + if ( 1 == $nobug ) { + add_option( 'wp_svg_icons_review_stop_bugging_me', TRUE ); + } + } + + /* + wp_svg_icons_check_installation_date() + checks the user installation date, and adds our action + - if it's past 2 weeks we ask the user for a review :) + @since v3.1.1 + */ + public function wp_svg_icons_check_installation_date() { + + // add a new option to store the plugin activation date/time + // @since v3.1.1 + // this is used to notify the user that they should review after 2 weeks + if ( !get_option( 'wp_svg_icons_activation_date' ) ) { + add_option( 'wp_svg_icons_activation_date', strtotime( "now" ) ); + } + + $stop_bugging_me = get_option( 'wp_svg_icons_review_stop_bugging_me' ); + + if( !$stop_bugging_me ) { + $install_date = get_option( 'wp_svg_icons_activation_date' ); + $past_date = strtotime( '-0 days' ); + if ( $past_date >= $install_date && current_user_can( 'install_plugins' ) ) { + add_action( 'admin_notices', array( &$this , 'wp_svg_icons_display_review_us_notice' ) ); + } + } + + } + + /* + Display our admin notification + asking for a review, and for user feedback + @since v3.1.1 + */ + public function wp_svg_icons_display_review_us_notice() { + /* Lets only display our admin notice on YT4WP pages to not annoy the hell out of people :) */ + if ( in_array( get_current_screen()->base , array( 'dashboard' , 'toplevel_page_wp-svg-icons' , 'wp-svg-icons_page_wp-svg-icons-custom-set' , 'wp-svg-icons_page_wp_svg_icons' , 'wp-svg-icons_page_wp-svg-icons-upgrade' , 'post' ) ) ) { + // Review URL - Change to the URL of your plugin on WordPress.org + $reviewurl = 'https://wordpress.org/support/view/plugin-reviews/svg-vector-icon-plugin'; + $go_pro_url = 'http://www.evan-herman.com/wordpress-plugin/wp-svg-icons/'; + $http_https = isset($_SERVER['HTTPS']) ? 'https://' : 'http://'; + $current_url = "$http_https$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; + $nobugurl = add_query_arg( 'wp_svg_icons_nobug', '1', $current_url ); + global $current_user; + get_currentuserinfo(); + if ( '' != $current_user->user_firstname ) { + $review_message = '

' . sprintf( __( "Hey" , "wp-svg-icons" ) . " " . $current_user->user_firstname . __( ", You've been using" , "wp-svg-icons" ) . " WP SVG Icons " . __( "for 2 weeks now. We certainly hope you're enjoying the power and all the features packed into the free version. If so, leave us a review, we'd love to hear what you have to say. If you're really enjoying the plugin, consider upgrading to the pro version for some added features and premium support." , "wp-svg-icons" ) . "

" . __( "Leave A Review" , "wp-svg-icons" ) . " " . __( "Upgrade to Pro" , "wp-svg-icons" ) . " " . __( "Dismiss" , "wp-svg-icons" ) . " ", $reviewurl, $go_pro_url, $nobugurl ) . '

'; + } else { + $review_message = '

' . sprintf( __( "Hey there, it looks like you've been using" , "wp-svg-icons" ) . " WP SVG Icons " . __( "for 2 weeks now. We certainly hope you're enjoying the power and all the features packed into the free version. If so, leave us a review, we'd love to hear what you have to say. If you're really enjoying the plugin, consider upgrading to the pro version for some added features and premium support." , "wp-svg-icons" ) . "

" . __( "Leave A Review" , "wp-svg-icons" ) . " " . __( "Upgrade to Pro" , "wp-svg-icons" ) . " " . __( "Dismiss" , "wp-svg-icons" ) . " ", $reviewurl, $go_pro_url, $nobugurl ) . '

'; + } + ?> + +
+ +
+ .mhl,.glyph .fs0,.glyph fieldset,.mbl,.mhl>h1:first-child{display:none}.glyph span:first-child{display:block;width:100%;font-size:1.5em}.glyph span:last-child{line-height:.9;font-size:15px;display:none}.glyph{color:#333}.selected{color:#F80;background:#d8d8d8}.selected span:last-child{color:#666}.custom-pack-container-ajax .glyph{width:29px}.wp-svg-icon-preview .previewIcon{font-size:90px;display:block;margin:10px auto 0}.wp-svg-icons-wrap .custom-pack-container-ajax .glyph{padding:10px 7px 0!important}.bgc1>.mhl,.mbl,.wrap .current-font-pack .mhl>h1:first-child{display:none}.wrap .current-font-pack .glyph{background:0 0;margin:.25em .35em .25em 0;width:1.5em;padding:.35em;box-shadow:none;-o-transition:.15s;-ms-transition:.15s;-moz-transition:.15s;-webkit-transition:.15s;transition:.15s;font-size:1.75em}.wrap .current-font-pack .glyph:hover{cursor:pointer;color:#ff8000}.glyph .fs0,.wrap .current-font-pack .glyph fieldset{display:none}.wrap .current-font-pack .glyph span:first-child{display:block;width:100%;font-size:1.5em}.wrap .current-font-pack .glyph span:last-child{line-height:.9;font-size:15px;display:none}.wrap .current-font-pack .glyph{color:#333}.wrap .current-font-pack .selected{color:#F80;background:#d8d8d8}.wrap .current-font-pack .selected span:last-child{color:#666}.wrap .current-font-pack .wp-svg-icon-preview-box{margin-top:-6em}.wrap .current-font-pack .wp-svg-icon-preview{font-size:8em}.wrap .current-font-pack .wp-svg-icon-preview-box i{display:block;margin-top:-.5em;padding-top:5px}.wrap .current-font-pack .wp-svg-icon-preview div{margin-top:10px}.wp-svg-icons_page_wp-svg-icons-custom-set ::selection{background:#FF8000}.toplevel_page_wp-svg-icons .wp-menu-image img{margin-top:-3px}.dashicons-wp-svg-gift:before{content:"\e099"!important;font-size:18px}#advanced-shortcode-attr-list{display:none;margin:0 35px}#advanced-shortcode-attr-list li{width:46.5%;float:left}.shortcode-attr-right-column{float:right!important}.wp-svg-advanced-shortcode-attr-row strong{display:block;margin-bottom:.25em}.wp-svg-advanced-shortcode-attr-row .shortcode-attr-right-column .wp-picker-container{width:100%}.wp-svg-advanced-shortcode-attr-row{display:block;width:100%;float:left}.wp-svg-advanced-shortcode-attr-row:nth-child(2){margin-top:1em}#advanced-shortcode-attr-toggle{font-size:11px}#icon-size-input{max-width:75px;margin-top:1em;text-align:center}.wp-svg-happy{-o-transition:.15s;-ms-transition:.15s;-moz-transition:.15s;-webkit-transition:.15s;transition:.15s}.wp-svg-happy:hover{color:#FF8000} \ No newline at end of file +.custom-pack-container-ajax{width:100%}.custom-pack-container-ajax [class*=" wp-svg-custom-"],.custom-pack-container-ajax [class^=wp-svg-custom-]{font-size:2.75em!important}.bgc1>.mhl,.glyph .fs0,.glyph fieldset,.mbl,.mhl>h1:first-child{display:none}.glyph span:first-child{display:block;width:100%;font-size:1.5em}.glyph span:last-child{line-height:.9;font-size:15px;display:none}.glyph{color:#333}.selected{color:#F80;background:#d8d8d8}.selected span:last-child{color:#666}.custom-pack-container-ajax .glyph{width:29px}.wp-svg-icon-preview .previewIcon{font-size:90px;display:block;margin:10px auto 0}.wp-svg-icons-wrap .custom-pack-container-ajax .glyph{padding:10px 7px 0!important}.bgc1>.mhl,.mbl,.wrap .current-font-pack .mhl>h1:first-child{display:none}.wrap .current-font-pack .glyph{background:0 0;margin:.25em .35em .25em 0;width:1.5em;padding:.35em;box-shadow:none;-o-transition:.15s;-ms-transition:.15s;-moz-transition:.15s;-webkit-transition:.15s;transition:.15s;font-size:1.75em}.wrap .current-font-pack .glyph:hover{cursor:pointer;color:#ff8000}.glyph .fs0,.wrap .current-font-pack .glyph fieldset{display:none}.wrap .current-font-pack .glyph span:first-child{display:block;width:100%;font-size:1.5em}.wrap .current-font-pack .glyph span:last-child{line-height:.9;font-size:15px;display:none}.wrap .current-font-pack .glyph{color:#333}.wrap .current-font-pack .selected{color:#F80;background:#d8d8d8}.wrap .current-font-pack .selected span:last-child{color:#666}.wrap .current-font-pack .wp-svg-icon-preview-box{margin-top:-6em}.wrap .current-font-pack .wp-svg-icon-preview{font-size:8em}.wrap .current-font-pack .wp-svg-icon-preview-box i{display:block;margin-top:-.5em;padding-top:5px}.wrap .current-font-pack .wp-svg-icon-preview div{margin-top:10px}.wp-svg-icons_page_wp-svg-icons-custom-set ::selection{background:#FF8000}.toplevel_page_wp-svg-icons .wp-menu-image img{margin-top:-3px}.dashicons-wp-svg-gift:before{content:"\e099"!important;font-size:18px}#advanced-shortcode-attr-list{display:none;margin:0 35px}#advanced-shortcode-attr-list li{width:46.5%;float:left}.shortcode-attr-right-column{float:right!important}.wp-svg-advanced-shortcode-attr-row strong{display:block;margin-bottom:.25em}.wp-svg-advanced-shortcode-attr-row .shortcode-attr-right-column .wp-picker-container{width:100%}.wp-svg-advanced-shortcode-attr-row{display:block;width:100%;float:left}.wp-svg-advanced-shortcode-attr-row:nth-child(2){margin-top:1em}#advanced-shortcode-attr-toggle{font-size:11px}#icon-size-input{max-width:75px;margin-top:1em;text-align:center}.wp-svg-happy{-o-transition:.15s;-ms-transition:.15s;-moz-transition:.15s;-webkit-transition:.15s;transition:.15s}.wp-svg-happy:hover{color:#FF8000}#review-wp-svg-icons-notice{display:block;margin:5px 20px 2px 0px;border-left:4px solid #7ad03a;margin-top:1.5em;padding:2px 10px;background:url(../images/evan-herman-mascot.png) right bottom no-repeat #fff;background-size:120px;background-position-y:29px}#review-wp-svg-icons-notice .button-container{display:block;text-align:center} \ No newline at end of file diff --git a/admin/js/wordpress-svg-icon-plugin-scripts.js b/admin/js/wordpress-svg-icon-plugin-scripts.js index c052cc1..7a51905 100644 --- a/admin/js/wordpress-svg-icon-plugin-scripts.js +++ b/admin/js/wordpress-svg-icon-plugin-scripts.js @@ -1 +1 @@ -/* WP SVG ICON PLUGIN SCRIPTS Compiled by Evan Herman - www.Evan-Herman.com */ jQuery(document).ready( function() { // select default icon element wrapper on initial page load iconWrapperClick( jQuery( this ) , localized_data.default_icon_element ); var interval = null; var x = 0; function check_thick() { interval = setInterval(function() { if( jQuery( '#TB_ajaxContent' ).is( ':visible' ) ) { x = 0; if( jQuery( '.icon-wrapper' ).hasClass( 'selected-element-wrap' ) ) { return; } jQuery( '.custom-pack-tab' ).removeAttr( 'style' ); iconWrapperClick( jQuery( this ) , localized_data.default_icon_element ); jQuery( '.element_selection_container' ).find( jQuery( '.icon-wrapper[alt="' + localized_data.default_icon_element + '"]' ) ).addClass( 'selected-element-wrap' ); } else { x = 1; } }, 50); }; // run our check thickbox function // on initial page load check_thick(); // if a custom icon pack is not installed, // lets make sure that the custom tab remains hidden if( localized_data.custom_pack_active != 'true' ) { setInterval(function() { if( jQuery( '#TB_ajaxContent' ).is( ':visible' ) ) { jQuery( '.custom-pack-tab' ).hide(); } }, 50); } // when a user clicks on an icon, // load'er up to the preview box function buttonClick() { var glyphUnicode = jQuery( 'input[type=text].glyph_unicode', this ).val(); var iconClass = jQuery( this ).find( 'div' ).attr( 'class' ).replace( 'fs1' , '' ); var selectedIconWrapper = jQuery( '.selected-element-wrap' ).attr( 'alt' ); jQuery('.glyph').removeClass('selected'); jQuery(this).addClass('selected'); jQuery('.copy_paste_input').text('[wp-svg-icons icon="'+iconClass.trim()+'" wrap="'+selectedIconWrapper+'"]'); jQuery('input[type=text].expansion_glyph_unicode').css('background-color','#eee'); jQuery('input[type=text].glyph_unicode').css('background-color','#eee'); jQuery('input[type=text].glyph_unicode', this).css('background-color','#FF8000', 'font-color', '#000'); jQuery('.wp-svg-icon-preview').html('