diff --git a/functions.php b/functions.php index d27cbbb..caa0885 100644 --- a/functions.php +++ b/functions.php @@ -294,6 +294,10 @@ function flash_scripts() { require get_template_directory() . '/inc/admin/class-flash-theme-review-notice.php'; require get_template_directory() . '/inc/admin/class-flash-tdi-notice.php'; require get_template_directory() . '/inc/admin/class-flash-dashboard.php'; + require get_template_directory() . '/inc/admin/class-flash-notice.php'; + require get_template_directory() . '/inc/admin/class-flash-welcome-notice.php'; + require get_template_directory() . '/inc/admin/class-flash-upgrade.php'; + } /** diff --git a/gulpfile.js b/gulpfile.js index 2689c74..3c5548d 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -10,121 +10,128 @@ * * Load gulp and it's plugin. */ -var gulp = require( 'gulp' ); +var gulp = require('gulp'); // CSS Plugins -var autoprefixer = require( 'gulp-autoprefixer' ); // Prefixes CSS. -var uglifycss = require( 'gulp-uglifycss' ); // Minifies CSS. -var rtlcss = require( 'gulp-rtlcss' ); // Generates RTL CSS. -var sass = require( 'gulp-sass' ); // Compiles sass into CSS. +var autoprefixer = require('gulp-autoprefixer'); // Prefixes CSS. +var uglifycss = require('gulp-uglifycss'); // Minifies CSS. +var rtlcss = require('gulp-rtlcss'); // Generates RTL CSS. +var sass = require('gulp-sass'); // Compiles sass into CSS. // JS Plugins -var uglify = require( 'gulp-uglify' ); // Minify JS. +var uglify = require('gulp-uglify'); // Minify JS. // Utility Plugins -var browserSync = require( 'browser-sync' ).create(); // Reloads browser. -var imagemin = require( 'gulp-imagemin' ); // Minifies Images. -var rename = require( 'gulp-rename' ); // Renames files. -var wpPot = require( 'gulp-wp-pot' ); // Generates translation file. -var zip = require( 'gulp-zip' ); // Compresses into zip file. -var notify = require( 'gulp-notify' ); // Sends notification. +var browserSync = require('browser-sync').create(); // Reloads browser. +var imagemin = require('gulp-imagemin'); // Minifies Images. +var rename = require('gulp-rename'); // Renames files. +var wpPot = require('gulp-wp-pot'); // Generates translation file. +var zip = require('gulp-zip'); // Compresses into zip file. +var notify = require('gulp-notify'); // Sends notification. // Linter Plugins -var stylelint = require( 'gulp-stylelint' ); // Checks for the CSS errors. -var eslint = require( 'gulp-eslint' ); // Checks for the JS errors. -var phpcs = require( 'gulp-phpcs' ); //Checks for the php errors and WordPress standards. +var stylelint = require('gulp-stylelint'); // Checks for the CSS errors. +var eslint = require('gulp-eslint'); // Checks for the JS errors. +var phpcs = require('gulp-phpcs'); //Checks for the php errors and WordPress standards. /** * Project information. */ var info = { - name: 'Flash', - slug: 'flash', - url: 'https://themegrill.com/themes/flash/', - author: 'ThemeGrill', - authorUrl: 'https://themegrill.com/', - authorEmail: 'themegrill@gmail.com', - teamEmail: '', - localUrl: 'flash.local' + name: 'Flash', + slug: 'flash', + url: 'https://themegrill.com/themes/flash/', + author: 'ThemeGrill', + authorUrl: 'https://themegrill.com/', + authorEmail: 'themegrill@gmail.com', + teamEmail: '', + localUrl: 'flash.local' }; /** * Defines paths */ var paths = { - scss: { - src: './assets/sass/**/*.scss', - dest: './' - }, - - css: { - src: [ './assets/css/*.css', '!./assets/css/*.min.css' ], - dest: './assets/css' - }, - - rtlcss: { - src: [ './style.css' ], - dest: './' - }, - - prefixStyles: { - src: './*.css', - dest: './' - }, - - lintFiles: { - php: [ - './*.php', - './inc/**/*.php', - '!./inc/kirki/**', - '!./inc/tgm-plugin-activation/**', - './inc/widgets/*.php', - './template-parts/**/*.php' - ], - styles: [ './assets/sass/**/*.scss' ], - js: [ './assets/js/*-custom.js', '!./assets/js/*.min.js' ] - }, - - js: { - src: [ './assets/js/*.js', '!./assets/js/*.min.js' ], - dest: './assets/js/' - }, - - php: { - src: [ - './*.php', - './inc/*.php', - './inc/customizer/**/*.php', - './template-parts/**/*.php' - ] - }, - - img: { - src: [ './assets/img/**' ], - dest: './assets/img' - }, - - zip: { - src: [ - '**', - '!vendor', - '!vendor/**', - '!node_modules', - '!node_modules/**', - '!assets/sass', - '!assets/sass/**', - '!dest.xml', - '!dist', - '!dist/**', - '!*.json', - '!*.md', - '!gulpfile.js', - '!composer.lock', - '!phpcs.xml' - ], - dest: './dist' - } + scss: { + src: './assets/sass/**/*.scss', + dest: './' + }, + + css: { + src: ['./assets/css/*.css', '!./assets/css/*.min.css'], + dest: './assets/css' + }, + + adminscss: { + src: './inc/admin/sass/admin.scss', + dest: './inc/admin/css/' + }, + + + rtlcss: { + src: ['./style.css'], + dest: './' + }, + + prefixStyles: { + src: './*.css', + dest: './' + }, + + + lintFiles: { + php: [ + './*.php', + './inc/**/*.php', + '!./inc/kirki/**', + '!./inc/tgm-plugin-activation/**', + './inc/widgets/*.php', + './template-parts/**/*.php' + ], + styles: ['./assets/sass/**/*.scss'], + js: ['./assets/js/*-custom.js', '!./assets/js/*.min.js'] + }, + + js: { + src: ['./assets/js/*.js', '!./assets/js/*.min.js'], + dest: './assets/js/' + }, + + php: { + src: [ + './*.php', + './inc/*.php', + './inc/customizer/**/*.php', + './template-parts/**/*.php' + ] + }, + + img: { + src: ['./assets/img/**'], + dest: './assets/img' + }, + + zip: { + src: [ + '**', + '!vendor', + '!vendor/**', + '!node_modules', + '!node_modules/**', + '!assets/sass', + '!assets/sass/**', + '!dest.xml', + '!dist', + '!dist/**', + '!*.json', + '!*.md', + '!gulpfile.js', + '!composer.lock', + '!phpcs.xml' + ], + dest: './dist' + } }; /** @@ -134,203 +141,218 @@ var paths = { */ // Style tasks -var styles = gulp.series( compileSass, prefixStyles, generateRTLCSS, browserSyncStream ); +var styles = gulp.series(compileSass, prefixStyles, generateRTLCSS, browserSyncStream); // Start a front-end development server. -var server = gulp.series( browserSyncStart, watch ); +var server = gulp.series(browserSyncStart, watch); // Test code -var test = gulp.series( lintPHP, lintJS, lintStyle ); +var test = gulp.series(lintPHP, lintJS, lintStyle); // Build -var build = gulp.series( test, minifyCSS, minifyJs, minifyImg, generatePotFile, compressZip ); +var build = gulp.series(test, minifyCSS, minifyJs, minifyImg, generatePotFile, compressZip); // Start browserSync -function browserSyncStart( cb ) { - browserSync.init( - { - proxy: info.localUrl - }, - cb - ); +function browserSyncStart(cb) { + browserSync.init({ + proxy: info.localUrl + }, + cb + ); } // Reloads the browser -function browserSyncReload( cb ) { - browserSync.reload(); - cb(); +function browserSyncReload(cb) { + browserSync.reload(); + cb(); } // Streams the browser. -function browserSyncStream( cb ) { - browserSync.stream(); - cb(); +function browserSyncStream(cb) { + browserSync.stream(); + cb(); } // Compiles SCSS into CSS. function compileSass() { - return gulp - .src( paths.scss.src ) - .pipe( - sass( { - indentType: 'tab', - indentWidth: 1, - outputStyle: 'expanded', - linefeed: 'crlf' - } ) - ) - .pipe( gulp.dest( paths.scss.dest ) ) - .on( 'error', notify.onError() ); + return gulp + .src(paths.scss.src) + .pipe( + sass({ + indentType: 'tab', + indentWidth: 1, + outputStyle: 'expanded', + linefeed: 'crlf' + }) + ) + .pipe(gulp.dest(paths.scss.dest)) + .on('error', notify.onError()); } // Prefixes CSS. function prefixStyles() { - return gulp - .src( paths.prefixStyles.src ) - .pipe( - autoprefixer( { - browsers: [ 'last 2 versions' ], - cascade: false - } ) - ) - .pipe( gulp.dest( paths.prefixStyles.dest ) ) - .pipe( browserSync.stream() ) - .on( 'error', notify.onError() ); + return gulp + .src(paths.prefixStyles.src) + .pipe( + autoprefixer({ + browsers: ['last 2 versions'], + cascade: false + }) + ) + .pipe(gulp.dest(paths.prefixStyles.dest)) + .pipe(browserSync.stream()) + .on('error', notify.onError()); } // Generates RTL CSS file. function generateRTLCSS() { - return gulp - .src( paths.rtlcss.src ) - .pipe( rtlcss() ) - .pipe( rename( { suffix: '-rtl' } ) ) - .pipe( gulp.dest( paths.rtlcss.dest ) ) - .on( 'error', notify.onError() ); + return gulp + .src(paths.rtlcss.src) + .pipe(rtlcss()) + .pipe(rename({ suffix: '-rtl' })) + .pipe(gulp.dest(paths.rtlcss.dest)) + .on('error', notify.onError()); } // Minify css file function minifyCSS() { - return gulp - .src( paths.css.src ) - .pipe( uglifycss() ) - .pipe( rename( { suffix: '.min' } ) ) - .pipe( gulp.dest( paths.css.dest ) ); + return gulp + .src(paths.css.src) + .pipe(uglifycss()) + .pipe(rename({ suffix: '.min' })) + .pipe(gulp.dest(paths.css.dest)); } // Runs all the task of style. function styles() { - return gulp.series( compileSass, prefixStyles, generateRTLCSS ); + return gulp.series(compileSass, prefixStyles, generateRTLCSS); } +// Compiles AdminSass into AdminCSS +function compileAdminSass() { + return gulp.src(paths.adminscss.src) + .pipe(sass({ + indentType: 'tab', + indentWidth: 1, + outputStyle: 'expanded', + linefeed: 'crlf' + }).on('error', sass.logError)) + .pipe(gulp.dest(paths.adminscss.dest)) + .pipe(browserSync.stream()); +} // Lint php through phpcs and PHPCompatibility function lintPHP() { - return gulp - .src( paths.lintFiles.php ) - .pipe( - phpcs( { - bin: 'vendor/bin/phpcs', - standard: 'phpcs.xml', - warningSeverity: 0 - } ) - ) - .pipe( phpcs.reporter( 'log' ) ) - .pipe( phpcs.reporter( 'fail', { failOnFirst: false } ) ) - .on( 'error', notify.onError() ); + return gulp + .src(paths.lintFiles.php) + .pipe( + phpcs({ + bin: 'vendor/bin/phpcs', + standard: 'phpcs.xml', + warningSeverity: 0 + }) + ) + .pipe(phpcs.reporter('log')) + .pipe(phpcs.reporter('fail', { failOnFirst: false })) + .on('error', notify.onError()); } // Lint scss,css file through stylelint function lintStyle() { - return gulp - .src( paths.lintFiles.styles ) - .pipe( - stylelint( { - failAfterError: true, - reporters: [ { formatter: 'string', console: true } ] - } ) - ) - .on( 'error', notify.onError() ); + return gulp + .src(paths.lintFiles.styles) + .pipe( + stylelint({ + failAfterError: true, + reporters: [{ formatter: 'string', console: true }] + }) + ) + .on('error', notify.onError()); } + // Lint js files through eslint function lintJS() { - return gulp - .src( paths.lintFiles.js ) - .pipe( eslint() ) - .pipe( eslint.format() ) - .on( 'error', notify.onError() ); + return gulp + .src(paths.lintFiles.js) + .pipe(eslint()) + .pipe(eslint.format()) + .on('error', notify.onError()); } // Minfies image files. function minifyImg() { - return gulp - .src( paths.img.src ) - .pipe( imagemin() ) - .pipe( gulp.dest( paths.img.dest ) ) - .on( 'error', notify.onError() ); + return gulp + .src(paths.img.src) + .pipe(imagemin()) + .pipe(gulp.dest(paths.img.dest)) + .on('error', notify.onError()); } // Minifies the js files. function minifyJs() { - return gulp - .src( paths.js.src ) - .pipe( uglify() ) - .pipe( rename( { suffix: '.min' } ) ) - .pipe( gulp.dest( paths.js.dest ) ) - .on( 'error', notify.onError() ); + return gulp + .src(paths.js.src) + .pipe(uglify()) + .pipe(rename({ suffix: '.min' })) + .pipe(gulp.dest(paths.js.dest)) + .on('error', notify.onError()); } // Generates translation file. function generatePotFile() { - return gulp - .src( paths.php.src ) - .pipe( - wpPot( { - domain: info.slug, - package: info.name, - bugReport: info.authorEmail, - team: info.teamEmail - } ) - ) - .pipe( gulp.dest( 'languages/' + info.slug + '.pot' ) ) - .on( 'error', notify.onError() ); + return gulp + .src(paths.php.src) + .pipe( + wpPot({ + domain: info.slug, + package: info.name, + bugReport: info.authorEmail, + team: info.teamEmail + }) + ) + .pipe(gulp.dest('languages/' + info.slug + '.pot')) + .on('error', notify.onError()); } // Compress theme into a zip file. function compressZip() { - return gulp - .src( paths.zip.src ) - .pipe( zip( info.slug + '.zip' ) ) - .pipe( gulp.dest( paths.zip.dest ) ) - .on( 'error', notify.onError() ) - .pipe( notify( { - message: 'Great! Package is ready', - title: 'Build successful' - } - ) ); + return gulp + .src(paths.zip.src) + .pipe(zip(info.slug + '.zip')) + .pipe(gulp.dest(paths.zip.dest)) + .on('error', notify.onError()) + .pipe(notify({ + message: 'Great! Package is ready', + title: 'Build successful' + })); } // Watch for file changes function watch() { - gulp.watch( paths.scss.src, styles ); - gulp.watch( [ paths.js.src, paths.php.src ], browserSyncReload ); + gulp.watch(paths.scss.src, styles); + gulp.watch(paths.adminscss.src, compileAdminSass); + gulp.watch(paths.js.src, browserSyncReload); + gulp.watch(paths.php.src, browserSyncReload); + + } // Builds the package. function build() { - return gulp.series( - lintPHP, - lintJS, - lintStyle, - compileSass, - prefixStyles, - generateRTLCSS, - minifyCSS, - minifyImg, - minifyJs, - generatePotFile, - compressZip - ); + return gulp.series( + lintPHP, + lintJS, + lintStyle, + compileSass, + prefixStyles, + generateRTLCSS, + minifyCSS, + minifyImg, + minifyJs, + generatePotFile, + compressZip + ); } // define tasks @@ -338,6 +360,7 @@ exports.browserSyncStart = browserSyncStart; exports.browserSyncReload = browserSyncReload; exports.browserSyncStream = browserSyncStream; exports.compileSass = compileSass; +exports.compileAdminSass = compileAdminSass; exports.prefixStyles = prefixStyles; exports.generateRTLCSS = generateRTLCSS; exports.minifyCSS = minifyCSS; @@ -353,4 +376,4 @@ exports.styles = styles; exports.test = test; exports.server = server; exports.test = test; -exports.build = build; +exports.build = build; \ No newline at end of file diff --git a/inc/admin/class-flash-notice.php b/inc/admin/class-flash-notice.php new file mode 100644 index 0000000..dc94dfc --- /dev/null +++ b/inc/admin/class-flash-notice.php @@ -0,0 +1,93 @@ +name = $name; + $this->type = $type; + $this->dismiss_url = $dismiss_url; + $this->temporary_dismiss_url = $temporary_dismiss_url; + $this->pricing_url = 'https://themegrill.com/pricing/?utm_source=flash-dashboard-message&utm_medium=view-pricing-link&utm_campaign=upgrade'; + $this->current_user_id = get_current_user_id(); + + // Notice markup. + add_action( 'admin_notices', array( $this, 'notice' ) ); + + $this->dismiss_notice(); + $this->dismiss_notice_temporary(); + } + + public function notice() { + if ( ! $this->is_dismiss_notice() ) { + $this->notice_markup(); + } + } + + private function is_dismiss_notice() { + return apply_filters( 'flash_' . $this->name . '_notice_dismiss', true ); + } + + public function notice_markup() { + echo ''; + } + + /** + * Hide a notice if the GET variable is set. + */ + public function dismiss_notice() { + if ( isset( $_GET['flash_notice_dismiss'] ) && isset( $_GET['_flash_upgrade_notice_dismiss_nonce'] ) ) { // WPCS: input var ok. + if ( ! wp_verify_nonce( wp_unslash( $_GET['_flash_upgrade_notice_dismiss_nonce'] ), 'flash_upgrade_notice_dismiss_nonce' ) ) { // phpcs:ignore WordPress.VIP.ValidatedSanitizedInput.InputNotSanitized + wp_die( __( 'Action failed. Please refresh the page and retry.', 'flash' ) ); // WPCS: xss ok. + } + + if ( ! current_user_can( 'publish_posts' ) ) { + wp_die( __( 'Cheatin’ huh?', 'flash' ) ); // WPCS: xss ok. + } + + $dismiss_notice = sanitize_text_field( wp_unslash( $_GET['flash_notice_dismiss'] ) ); + + // Hide. + if ( $dismiss_notice === $_GET['flash_notice_dismiss'] ) { + add_user_meta( get_current_user_id(), 'flash_' . $dismiss_notice . '_notice_dismiss', 'yes', true ); + } + } + } + + public function dismiss_notice_temporary() { + if ( isset( $_GET['flash_notice_dismiss_temporary'] ) && isset( $_GET['_flash_upgrade_notice_dismiss_temporary_nonce'] ) ) { // WPCS: input var ok. + if ( ! wp_verify_nonce( wp_unslash( $_GET['_flash_upgrade_notice_dismiss_temporary_nonce'] ), 'flash_upgrade_notice_dismiss_temporary_nonce' ) ) { // phpcs:ignore WordPress.VIP.ValidatedSanitizedInput.InputNotSanitized + wp_die( __( 'Action failed. Please refresh the page and retry.', 'flash' ) ); // WPCS: xss ok. + } + + if ( ! current_user_can( 'publish_posts' ) ) { + wp_die( __( 'Cheatin’ huh?', 'flash' ) ); // WPCS: xss ok. + } + + $dismiss_notice = sanitize_text_field( wp_unslash( $_GET['flash_notice_dismiss_temporary'] ) ); + + // Hide. + if ( $dismiss_notice === $_GET['flash_notice_dismiss_temporary'] ) { + add_user_meta( get_current_user_id(), 'flash_' . $dismiss_notice . '_notice_dismiss_temporary', 'yes', true ); + } + } + } +} diff --git a/inc/admin/class-flash-theme-review-notice.php b/inc/admin/class-flash-theme-review-notice.php index d5c8cba..7781d0f 100644 --- a/inc/admin/class-flash-theme-review-notice.php +++ b/inc/admin/class-flash-theme-review-notice.php @@ -66,7 +66,7 @@ public function flash_theme_review_notice() { * 2. If the user has ignored the message partially for 15 days. * 3. Dismiss always if clicked on 'I Already Did' button. */ - if ( ( get_option( 'flash_theme_installed_time' ) > strtotime( '-15 day' ) ) || ( $ignored_notice_partially > strtotime( '-15 day' ) ) || ( $ignored_notice ) ) { + if ( ( get_option( 'flash_theme_installed_time' ) > strtotime( '0 day' ) ) || ( $ignored_notice_partially > strtotime( '0 day' ) ) || ( $ignored_notice ) ) { return; } ?> diff --git a/inc/admin/class-flash-upgrade.php b/inc/admin/class-flash-upgrade.php new file mode 100644 index 0000000..aea43a7 --- /dev/null +++ b/inc/admin/class-flash-upgrade.php @@ -0,0 +1,108 @@ +set_notice_time(); + + $this->set_temporary_dismiss_notice_time(); + + $this->set_dismiss_notice(); + } + + private function set_notice_time() { + if (!get_option('flash_upgrade_notice_start_time')) { + update_option('flash_upgrade_notice_start_time', time()); + } + } + + private function set_temporary_dismiss_notice_time() { + if (isset($_GET['flash_notice_dismiss_temporary']) && 'upgrade' === $_GET['flash_notice_dismiss_temporary']) { + update_user_meta($this->current_user_id, 'flash_upgrade_notice_dismiss_temporary_start_time', time()); + } + } + + public function set_dismiss_notice() { + + /** + * Do not show notice if: + * + * 1. It has not been 5 days since the theme is activated. + * 2. If the user has ignored the message partially for 2 days. + * 3. Dismiss always if clicked on 'Dismiss' button. + */ + if ( get_option('flash_upgrade_notice_start_time') > strtotime('0 day') + || get_user_meta(get_current_user_id(), 'flash_upgrade_notice_dismiss', true) + || get_user_meta(get_current_user_id(), 'flash_upgrade_notice_dismiss_temporary_start_time', true) > strtotime('0 day') + ) { + add_filter('flash_upgrade_notice_dismiss', '__return_true'); + } else { + add_filter('flash_upgrade_notice_dismiss', '__return_false'); + } + } + + public function notice_markup() { +?> +
+ + +

+ ' . esc_html($current_user->display_name) . '', + 'flash', + 'upgrade15', + '15%' + ); + ?> +

+ + +
+' . esc_html__( 'Get started with flash', 'flash' ) . ''; + + return $html; + } + + /** + * Show welcome notice. + */ + public function welcome_notice_markup() { + $dismiss_url = wp_nonce_url( + remove_query_arg( array( 'activated' ), add_query_arg( 'flash-hide-notice', 'welcome' ) ), + 'flash_hide_notices_nonce', + '_flash_notice_nonce' + ); + ?> +
+ + +
+
+ <?php esc_html_e( 'flash', 'flash' ); ?> +
+ +
+

+ ', + '' + ); + ?> +

+ +
+ import_button_html(); ?> + +
+
+
+
+ get_error_code(); + $response['errorMessage'] = $result->get_error_message(); + } + } + } else { + wp_enqueue_style( 'plugin-install' ); + wp_enqueue_script( 'plugin-install' ); + + $response['redirect'] = admin_url( '/themes.php?page=demo-importer&browse=all&flash-hide-notice=welcome' ); + + /** + * Install Plugin. + */ + include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; + include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; + + $api = plugins_api( + 'plugin_information', + array( + 'slug' => sanitize_key( wp_unslash( 'themegrill-demo-importer' ) ), + 'fields' => array( + 'sections' => false, + ), + ) + ); + + $skin = new WP_Ajax_Upgrader_Skin(); + $upgrader = new Plugin_Upgrader( $skin ); + $result = $upgrader->install( $api->download_link ); + + if ( $result ) { + $response['installed'] = 'succeed'; + } else { + $response['installed'] = 'failed'; + } + + // Activate plugin. + if ( current_user_can( 'activate_plugin' ) ) { + $result = activate_plugin( 'themegrill-demo-importer/themegrill-demo-importer.php' ); + + if ( is_wp_error( $result ) ) { + $response['errorCode'] = $result->get_error_code(); + $response['errorMessage'] = $result->get_error_message(); + } + } + } + + wp_send_json( $response ); + + exit(); + } +} + +new flash_Welcome_Notice(); \ No newline at end of file diff --git a/inc/admin/css/admin.css b/inc/admin/css/admin.css new file mode 100644 index 0000000..191e29d --- /dev/null +++ b/inc/admin/css/admin.css @@ -0,0 +1,185 @@ +/** + CSS rule of welcome admin before 2.2.0 update + */ + +pre.changelog { + font-size: 12px; + background-color: #f5f5f5; + background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(50%, #f5f5f5), color-stop(50%, #e6e6e6)); + background-image: -webkit-linear-gradient(#f5f5f5 50%, #e6e6e6 50%); + background-image: linear-gradient(#f5f5f5 50%, #e6e6e6 50%); + background-size: 38px 38px; + border: 1px solid #d4d4d4; + display: block; + line-height: 19px; + margin-bottom: 10px; + overflow: visible; + overflow-y: hidden; + padding: 0 0 0 4px; +} + +pre.changelog span { + font-weight: 700; +} + +.return-to-dashboard.suffice { + clear: both; +} + +p.suffice-actions a.skip { + opacity: .5; +} + +p.suffice-actions a.docs:focus, +p.suffice-actions a.docs:hover, +p.suffice-actions a.skip:focus, +p.suffice-actions a.skip:hover { + opacity: 1; +} + +p.suffice-actions a.button-primary, +p.suffice-actions a.button-secondary { + text-decoration: none !important; +} + +table { + width: 100%; + border-collapse: collapse; +} + +td { + text-align: center; +} + +.about-wrap { + max-width: 100%; +} + +.about-wrap h1 { + display: block; + text-align: center; + width: 100%; + font-size: 38px; + font-weight: 600; +} + +.welcome-description-wrap { + display: inline-block; + width: 100%; + margin: 20px 0; +} + +.about-wrap .about-text, +.suffice-screenshot { + margin: 20px 10px; + width: 47%; + float: left; +} + +.about-wrap table td h3 { + margin: 20px; + padding-left: 20px; + text-align: left; +} + +.wrap table { + border: 1px solid #e1e1e1; + border-collapse: collapse; +} + +.wrap table th { + width: 33%; +} + +.wrap table th:first-child { + background-color: rgba(0, 0, 0, 0.03); +} + +.about-wrap table td .table-desc { + font-size: 15px; + margin: 20px; + padding-left: 20px; + display: block; + text-align: left; +} + +.about-wrap table .table-feature-title>h3 { + color: #404040; +} + +.wrap table th { + background-color: #24B37E; +} + +.wrap table th:last-child { + background-color: #228B9B; +} + +.wrap table th h3 { + color: #fff; + margin: 15px; +} + +tr:nth-child(2n) { + background-color: #e7e7e7; +} + +.wrap table td span { + font-size: 25px; +} + +.wrap table td .dashicons.dashicons-no { + color: #CE2D2D; +} + +.wrap table td .dashicons.dashicons-yes { + color: #24B37E; +} + +table tr .btn-wrapper { + padding: 10px 0; +} + +table tr .btn-wrapper .button { + background-color: #228b9b; + color: #fff; + font-size: 14px; + line-height: 0; + padding: 27px 0; + width: 59%; +} + +table tr .btn-wrapper .button:hover { + background: #097282 none repeat scroll 0 0; + color: #fff; +} + +@media (max-width: 1400px) { + .about-wrap h1 { + font-size: 30px; + } + .about-wrap .about-text { + font-size: 16px; + } +} + +@media (max-width: 1200px) { + .about-wrap .about-text { + font-size: 14px; + } + .about-wrap table td h3, + .about-wrap table td { + font-size: 14px; + } +} + +@media (max-width: 980px) { + .about-wrap h1 { + font-size: 25px; + } + .about-wrap .about-text, + .suffice-screenshot { + float: none; + width: 100%; + } +} \ No newline at end of file diff --git a/inc/admin/saas/admin.scss b/inc/admin/saas/admin.scss new file mode 100644 index 0000000..191e29d --- /dev/null +++ b/inc/admin/saas/admin.scss @@ -0,0 +1,185 @@ +/** + CSS rule of welcome admin before 2.2.0 update + */ + +pre.changelog { + font-size: 12px; + background-color: #f5f5f5; + background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(50%, #f5f5f5), color-stop(50%, #e6e6e6)); + background-image: -webkit-linear-gradient(#f5f5f5 50%, #e6e6e6 50%); + background-image: linear-gradient(#f5f5f5 50%, #e6e6e6 50%); + background-size: 38px 38px; + border: 1px solid #d4d4d4; + display: block; + line-height: 19px; + margin-bottom: 10px; + overflow: visible; + overflow-y: hidden; + padding: 0 0 0 4px; +} + +pre.changelog span { + font-weight: 700; +} + +.return-to-dashboard.suffice { + clear: both; +} + +p.suffice-actions a.skip { + opacity: .5; +} + +p.suffice-actions a.docs:focus, +p.suffice-actions a.docs:hover, +p.suffice-actions a.skip:focus, +p.suffice-actions a.skip:hover { + opacity: 1; +} + +p.suffice-actions a.button-primary, +p.suffice-actions a.button-secondary { + text-decoration: none !important; +} + +table { + width: 100%; + border-collapse: collapse; +} + +td { + text-align: center; +} + +.about-wrap { + max-width: 100%; +} + +.about-wrap h1 { + display: block; + text-align: center; + width: 100%; + font-size: 38px; + font-weight: 600; +} + +.welcome-description-wrap { + display: inline-block; + width: 100%; + margin: 20px 0; +} + +.about-wrap .about-text, +.suffice-screenshot { + margin: 20px 10px; + width: 47%; + float: left; +} + +.about-wrap table td h3 { + margin: 20px; + padding-left: 20px; + text-align: left; +} + +.wrap table { + border: 1px solid #e1e1e1; + border-collapse: collapse; +} + +.wrap table th { + width: 33%; +} + +.wrap table th:first-child { + background-color: rgba(0, 0, 0, 0.03); +} + +.about-wrap table td .table-desc { + font-size: 15px; + margin: 20px; + padding-left: 20px; + display: block; + text-align: left; +} + +.about-wrap table .table-feature-title>h3 { + color: #404040; +} + +.wrap table th { + background-color: #24B37E; +} + +.wrap table th:last-child { + background-color: #228B9B; +} + +.wrap table th h3 { + color: #fff; + margin: 15px; +} + +tr:nth-child(2n) { + background-color: #e7e7e7; +} + +.wrap table td span { + font-size: 25px; +} + +.wrap table td .dashicons.dashicons-no { + color: #CE2D2D; +} + +.wrap table td .dashicons.dashicons-yes { + color: #24B37E; +} + +table tr .btn-wrapper { + padding: 10px 0; +} + +table tr .btn-wrapper .button { + background-color: #228b9b; + color: #fff; + font-size: 14px; + line-height: 0; + padding: 27px 0; + width: 59%; +} + +table tr .btn-wrapper .button:hover { + background: #097282 none repeat scroll 0 0; + color: #fff; +} + +@media (max-width: 1400px) { + .about-wrap h1 { + font-size: 30px; + } + .about-wrap .about-text { + font-size: 16px; + } +} + +@media (max-width: 1200px) { + .about-wrap .about-text { + font-size: 14px; + } + .about-wrap table td h3, + .about-wrap table td { + font-size: 14px; + } +} + +@media (max-width: 980px) { + .about-wrap h1 { + font-size: 25px; + } + .about-wrap .about-text, + .suffice-screenshot { + float: none; + width: 100%; + } +} \ No newline at end of file diff --git a/inc/class-flash-admin.php b/inc/class-flash-admin.php index d5c6ca0..f61b9f8 100644 --- a/inc/class-flash-admin.php +++ b/inc/class-flash-admin.php @@ -22,8 +22,6 @@ class Flash_Admin { * Constructor. */ public function __construct() { - add_action( 'wp_loaded', array( __CLASS__, 'hide_notices' ) ); - add_action( 'wp_loaded', array( $this, 'admin_notice' ) ); add_action( 'wp_ajax_import_button', array( $this, 'flash_ajax_import_button_handler' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'flash_ajax_enqueue_scripts' ) ); } @@ -104,76 +102,6 @@ public function flash_ajax_import_button_handler() { wp_send_json( $response ); exit(); } - - /** - /** - * Add admin notice. - */ - public function admin_notice() { - global $pagenow; - - wp_enqueue_style( 'flash-message', get_template_directory_uri() . '/css/message.css', array(), FLASH_THEME_VERSION ); - - // Let's bail on theme activation. - $notice_nag = get_option( 'flash_admin_notice_welcome' ); - if ( ! $notice_nag ) { - add_action( 'admin_notices', array( $this, 'welcome_notice' ) ); - } - } - - /** - * Hide a notice if the GET variable is set. - */ - public static function hide_notices() { - if ( isset( $_GET['flash-hide-notice'] ) && isset( $_GET['_flash_notice_nonce'] ) ) { - if ( ! wp_verify_nonce( $_GET['_flash_notice_nonce'], 'flash_hide_notices_nonce' ) ) { - wp_die( __( 'Action failed. Please refresh the page and retry.', 'flash' ) ); - } - - if ( ! current_user_can( 'manage_options' ) ) { - wp_die( __( 'Cheatin’ huh?', 'flash' ) ); - } - - $hide_notice = sanitize_text_field( $_GET['flash-hide-notice'] ); - update_option( 'flash_admin_notice_' . $hide_notice, 1 ); - - // Hide. - if ( 'welcome' === $_GET['flash-hide-notice'] ) { - update_option( 'flash_admin_notice_' . $hide_notice, 1 ); - } else { // Show. - delete_option( 'flash_admin_notice_' . $hide_notice ); - } - } - } - - /** - * Show welcome notice. - */ - public function welcome_notice() { - ?> -
- - - - -
- - -

- ', '' ); ?> - - -

- -
- -
-
-
-