From 1cc59333fb4b1138fa9c96d9ee237edc4fd7de15 Mon Sep 17 00:00:00 2001 From: Brad Touesnard Date: Thu, 16 Aug 2012 16:45:04 -0300 Subject: [PATCH] Added author profile and PRO upgrade poll. --- .gitignore | 1 + asset/config.rb | 24 ++++++ asset/css/styles.css | 168 ++++++++++++++++++++++++++++++++++----- asset/js/script.js | 58 ++++++++++++++ asset/sass/styles.scss | 174 +++++++++++++++++++++++++++++++++++++++++ wp-migrate-db.php | 102 +++++++++++++++++++++++- 6 files changed, 506 insertions(+), 21 deletions(-) create mode 100644 .gitignore create mode 100644 asset/config.rb create mode 100644 asset/sass/styles.scss diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5df1b9b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.sass-cache diff --git a/asset/config.rb b/asset/config.rb new file mode 100644 index 0000000..f89f6ca --- /dev/null +++ b/asset/config.rb @@ -0,0 +1,24 @@ +# Require any additional compass plugins here. + +# Set this to the root of your project when deployed: +http_path = "/" +css_dir = "css" +sass_dir = "sass" +images_dir = "img" +javascripts_dir = "js" + +# You can select your preferred output style here (can be overridden via the command line): +# output_style = :expanded or :nested or :compact or :compressed + +# To enable relative paths to assets via compass helper functions. Uncomment: +# relative_assets = true + +# To disable debugging comments that display the original location of your selectors. Uncomment: +# line_comments = false + + +# If you prefer the indented syntax, you might want to regenerate this +# project again passing --syntax sass, or you can uncomment this: +# preferred_syntax = :sass +# and then run: +# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass diff --git a/asset/css/styles.css b/asset/css/styles.css index d9ff6e7..7daec72 100644 --- a/asset/css/styles.css +++ b/asset/css/styles.css @@ -1,38 +1,168 @@ +/* line 1, ../sass/styles.scss */ #migrate-form { - padding-top: 10px; + padding-top: 10px; } -.form-table .row-new-url th, -.form-table .row-new-url td, +/* line 9, ../sass/styles.scss */ +.form-table .row-new-url th, .form-table .row-new-url td, .form-table .row-new-path th, .form-table .row-new-path td, .form-table .row-revisions th, .form-table .row-revisions td { - padding-bottom: 20px; - border-bottom: 1px solid #ccc; + padding-bottom: 20px; + border-bottom: 1px solid #ccc; } - -.form-table .row-old-path th, -.form-table .row-old-path td, +/* line 18, ../sass/styles.scss */ +.form-table .row-old-path th, .form-table .row-old-path td, .form-table .row-save-file th, .form-table .row-save-file td, .form-table .row-guids th, .form-table .row-guids td { - padding-top: 20px; + padding-top: 20px; } +/* line 24, ../sass/styles.scss */ p.submit { - overflow: hidden; - padding-top: 20px; - border-top: 1px solid #ccc; - margin-top: 20px; + overflow: hidden; + padding-top: 20px; + border-top: 1px solid #ccc; + margin-top: 20px; } - +/* line 30, ../sass/styles.scss */ p.submit input { - float: left; + float: left; } - +/* line 34, ../sass/styles.scss */ p.submit img { - float: left; - margin: 3px 0 0 5px; -} \ No newline at end of file + float: left; + margin: 3px 0 0 5px; +} + +/* line 40, ../sass/styles.scss */ +#wpmdb-container { + position: relative; +} + +/* line 44, ../sass/styles.scss */ +#wpmdb-main { + margin-right: 320px; + min-height: 1000px; +} + +/* line 49, ../sass/styles.scss */ +#wpmdb-sidebar { + position: absolute; + top: 0; + right: 0; + width: 250px; + border: 1px solid #ccc; + padding: 20px; +} +/* line 57, ../sass/styles.scss */ +#wpmdb-sidebar .author { + padding-bottom: 20px; + margin-bottom: 20px; + border-bottom: 1px solid #ccc; + overflow: hidden; +} +/* line 63, ../sass/styles.scss */ +#wpmdb-sidebar .author img { + float: left; + margin-right: 20px; +} +/* line 68, ../sass/styles.scss */ +#wpmdb-sidebar .author .desc { + float: left; +} +/* line 72, ../sass/styles.scss */ +#wpmdb-sidebar .author h3 { + font-size: 12px; + margin: 0; +} +/* line 77, ../sass/styles.scss */ +#wpmdb-sidebar .author h2 { + font-size: 18px; + margin: 0; + padding: 0; +} +/* line 82, ../sass/styles.scss */ +#wpmdb-sidebar .author h2 a { + color: #464646; + text-decoration: none; +} +/* line 86, ../sass/styles.scss */ +#wpmdb-sidebar .author h2 a:hover { + color: #000; +} +/* line 92, ../sass/styles.scss */ +#wpmdb-sidebar .author p { + margin: 0; +} +/* line 98, ../sass/styles.scss */ +#wpmdb-sidebar .poll h2 { + padding: 0; + margin: 0; + margin-bottom: 0.5em; + color: #666; + font-size: 20px; +} +/* line 106, ../sass/styles.scss */ +#wpmdb-sidebar .poll ul { + list-style-type: disc; +} +/* line 110, ../sass/styles.scss */ +#wpmdb-sidebar .poll li { + margin-left: 1.5em; + color: #666; +} +/* line 115, ../sass/styles.scss */ +#wpmdb-sidebar .poll p { + margin: 0; +} +/* line 119, ../sass/styles.scss */ +#wpmdb-sidebar .poll .error { + color: red; + font-weight: bold; + margin-bottom: 1em; +} +/* line 125, ../sass/styles.scss */ +#wpmdb-sidebar .poll .thanks { + color: #333; +} +/* line 129, ../sass/styles.scss */ +#wpmdb-sidebar .poll .field { + margin-bottom: 1em; +} +/* line 132, ../sass/styles.scss */ +#wpmdb-sidebar .poll .field p { + margin-bottom: 0.3em; +} +/* line 136, ../sass/styles.scss */ +#wpmdb-sidebar .poll .field .willing-copy { + font-weight: bold; + font-size: 14px; + line-height: 1.4em; + margin-bottom: 1em; +} +/* line 144, ../sass/styles.scss */ +#wpmdb-sidebar .poll .field.how-much input { + width: 50px; +} +/* line 150, ../sass/styles.scss */ +#wpmdb-sidebar .poll .field.notify-me input { + position: absolute; +} +/* line 154, ../sass/styles.scss */ +#wpmdb-sidebar .poll .field.notify-me label { + display: block; + padding-left: 20px; +} +/* line 162, ../sass/styles.scss */ +#wpmdb-sidebar .poll .field.comments textarea { + width: 230px; + height: 3em; +} +/* line 167, ../sass/styles.scss */ +#wpmdb-sidebar .poll .field.comments textarea.has-content, #wpmdb-sidebar .poll .field.comments textarea:focus { + height: 5em; +} diff --git a/asset/js/script.js b/asset/js/script.js index ee2b5c6..6a4cde5 100644 --- a/asset/js/script.js +++ b/asset/js/script.js @@ -13,6 +13,64 @@ return false; } }); + + $('#wpmdb-sidebar').each(function() { + var $sidebar = $(this); + + $('form', $sidebar).submit(function() { + if (!$('input[name=notify-me]', $sidebar).attr('checked')) { + $('input[name=notify-email]', $sidebar).val(''); + } + + var $form = $(this), + data = $(this).serializeArray(); + + data.push({name: 'action', value: 'poll_submission'}); + + $.post( ajaxurl, data, function(result) { + if (result) { + $('.error', $sidebar).remove(); + $('.field.submit-button', $sidebar).before(''); + $('.error', $sidebar).fadeIn(); + } + else { + $form.html('

Thanks for your input.

').fadeIn(); + } + }); + return false; + }); + + $('input[name=willing-pay]', $sidebar).change(function() { + var $yes_questions = $('.yes-questions', $sidebar); + if ('Yes' == $(this).val()) { + $yes_questions.show(); + } + else { + $yes_questions.hide(); + } + + $('.field.comments', $sidebar).show(); + }); + + $('input[name=notify-me]', $sidebar).click(function() { + var $notify_email = $('.notify-email', $sidebar); + if ($(this).attr('checked')) { + $notify_email.show(); + } + else { + $notify_email.hide(); + } + }); + + $('.field.comments textarea', $sidebar).blur(function() { + if ($(this).val()) { + $(this).addClass('has-content'); + } + else { + $(this).removeClass('has-content'); + } + }) + }); }); var admin_url = ajaxurl.replace( '/admin-ajax.php', '' ), diff --git a/asset/sass/styles.scss b/asset/sass/styles.scss new file mode 100644 index 0000000..35e0e1d --- /dev/null +++ b/asset/sass/styles.scss @@ -0,0 +1,174 @@ +#migrate-form { + padding-top: 10px; +} + +.form-table { + .row-new-url, + .row-new-path, + .row-revisions { + th, td { + padding-bottom: 20px; + border-bottom: 1px solid #ccc; + } + } + + .row-old-path, + .row-save-file, + .row-guids { + th, td { + padding-top: 20px; + } + } +} + +p.submit { + overflow: hidden; + padding-top: 20px; + border-top: 1px solid #ccc; + margin-top: 20px; + + input { + float: left; + } + + img { + float: left; + margin: 3px 0 0 5px; + } +} + +#wpmdb-container { + position: relative; +} + +#wpmdb-main { + margin-right: 320px; + min-height: 1000px; +} + +#wpmdb-sidebar { + position: absolute; + top: 0; + right: 0; + width: 250px; + border: 1px solid #ccc; + padding: 20px; + + .author { + padding-bottom: 20px; + margin-bottom: 20px; + border-bottom: 1px solid #ccc; + overflow: hidden; + + img { + float: left; + margin-right: 20px; + } + + .desc { + float: left; + } + + h3 { + font-size: 12px; + margin: 0; + } + + h2 { + font-size: 18px; + margin: 0; + padding: 0; + + a { + color: #464646; + text-decoration: none; + + &:hover { + color: #000; + } + } + } + + p { + margin: 0; + } + } + + .poll { + h2 { + padding: 0; + margin: 0; + margin-bottom: 0.5em; + color: #666; + font-size: 20px; + } + + ul { + list-style-type: disc; + } + + li { + margin-left: 1.5em; + color: #666; + } + + p { + margin: 0; + } + + .error { + color: red; + font-weight: bold; + margin-bottom: 1em; + } + + .thanks { + color: #333; + } + + .field { + margin-bottom: 1em; + + p { + margin-bottom: 0.3em; + } + + .willing-copy { + font-weight: bold; + font-size: 14px; + line-height: 1.4em; + margin-bottom: 1em; + } + + &.how-much { + input { + width: 50px; + } + } + + &.notify-me { + input { + position: absolute; + } + + label { + display: block; + padding-left: 20px; + } + + } + + &.comments { + textarea { + width: 230px; + height: 3em; + + &.has-content, + &:focus { + height: 5em; + } + } + } + } + } +} \ No newline at end of file diff --git a/wp-migrate-db.php b/wp-migrate-db.php index 1396015..85902c4 100644 --- a/wp-migrate-db.php +++ b/wp-migrate-db.php @@ -58,10 +58,27 @@ function __construct() { $this->replaced['nonserialized']['count'] = 0; add_action( 'admin_menu', array( $this, 'admin_menu' ) ); + add_action( 'wp_ajax_poll_submission', array( $this, 'poll_submission' ) ); $this->handle_request(); } + function poll_submission() { + $response = wp_remote_post( 'http://bradt.ca/wpmdb-poll.php', array( + 'timeout' => 60, + 'body' => $_POST + )); + + if ( is_wp_error( $response ) ) { + echo "Error attempting to save your submission."; + } + else { + echo $response['body']; + } + + die(); // this is required to return a proper result + } + function handle_request() { if ( !isset( $_GET['page'] ) || 'wp-migrate-db' != $_GET['page'] ) return; @@ -122,6 +139,10 @@ function options_page() {

WP Migrate DB

+
+ +
+ errors)) { @@ -328,9 +349,86 @@ function options_page() {

+ +
+ +
+ +
+ +
+

Created & maintained by

+

Brad Touesnard

+

+ Profile +    + Donate +

+
+
+ +
+

PRO Version?

+

+ What if there was a PRO version of this plugin that included the following? +

+ +
    +
  • Ability to transmit the data to the migrated site and + import it in one click. No downloading, + no uploading, no command line, no phpMyAdmin. +
  • +
  • + Priority email support to troubleshoot migration issues. + Very quick response times during business hours. +
  • +
+ +
+

Is that something you'd be willing to pay for?

+ +      + +
+ + + + + +
+ +
+
+ +
+ +