Skip to content

Commit

Permalink
New manifest icon and gdpr consent (#51)
Browse files Browse the repository at this point in the history
* Add 512x512 icon, closes #50

* Update plugin version and change log

* Add GDPR consent

* Minify admin js files, clean up gulp script
  • Loading branch information
anghelalexandra authored Aug 27, 2018
1 parent 59edc28 commit 7eafb4a
Show file tree
Hide file tree
Showing 10 changed files with 463 additions and 391 deletions.
642 changes: 336 additions & 306 deletions admin/js/UI.Modules/Feedback/WMP_SEND_FEEDBACK.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion admin/js/UI.Modules/Feedback/WMP_SEND_FEEDBACK.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion admin/pages/theme-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@
<div class="notice notice-left right" style="width: 265px;">
<span>
Add your logo in a .png format with a transparent background. This will be displayed on the cover of your app.<br /><br />
Your icon should be square with a recommended size of 256 x 256 px. This will be displayed when the app will be added to the homescreen.<br /><br />
Your icon should be square with a recommended size of 512 x 512 px. This will be displayed when the app will be added to the homescreen.<br /><br />
The file size for uploaded images should not exceed 1MB.
</span>
</div>
Expand Down
106 changes: 57 additions & 49 deletions admin/sections/feedback.php
Original file line number Diff line number Diff line change
@@ -1,49 +1,57 @@
<?php
// get current screen
$screen = get_current_screen();

// set current page
if ($screen->id !== '')
if ($screen->id == 'toplevel_page_wmp-options')
$current_page = "What's new";
else
$current_page = str_replace('wp-mobile-pack_page_wmp-options-','',$screen->id);
else
$current_page = '';
?>

<div class="form-box feedback">
<h2>Give Us Your Feedback</h2>
<div class="spacer-10"></div>
<p>Help us improve WP Mobile Pack. We're eager to hear your feedback and be sure that we ALWAYS answer it.</p>
<div class="spacer-10"></div>
<form id="wmp_feedback_form" name="wmp_feedback_form" action="<?php echo admin_url('admin-ajax.php'); ?>?action=wmp_send_feedback" method="post">
<input type="hidden" name="wmp_feedback_page" id="wmp_feedback_page" value="<?php echo ucfirst($current_page);?>" />

<input type="text" name="wmp_feedback_email" id="wmp_feedback_email" placeholder="Your e-mail address" class="small" />
<div id="error_email_container" class="field-message error"></div>
<div class="spacer-10"></div>

<input type="text" name="wmp_feedback_name" id="wmp_feedback_name" placeholder="Your name" class="small" />
<div id="error_name_container" class="field-message error"></div>
<div class="spacer-10"></div>

<textarea name="wmp_feedback_message" id="wmp_feedback_message" placeholder="You're awesome, did you know that?" class="small"></textarea>
<div id="error_message_container" class="field-message error"></div>
<div class="spacer-10"></div>
<a class="btn green smaller" href="javascript:void(0)" id="wmp_feedback_send_btn">Send</a>
</form>
</div>

<div class="ask-review">
<div class="spacer-10"></div>
<p>If you like Wordpress Mobile Pack, <a href="https://wordpress.org/support/view/plugin-reviews/wordpress-mobile-pack?filter=5#postform" target="_blank">please leave us a &#9733;&#9733;&#9733;&#9733;&#9733; rating</a>. A huge thank you in advance!</p>
</div>

<script type="text/javascript">
if (window.WMPJSInterface && window.WMPJSInterface != null){
jQuery(document).ready(function(){
window.WMPJSInterface.add("UI_feedback","WMP_SEND_FEEDBACK",{'DOMDoc':window.document, 'feedbackEmail': '<?php echo WMP_FEEDBACK_EMAIL;?>'}, window);
});
}
</script>
<?php
// get current screen
$screen = get_current_screen();

// set current page
if ($screen->id !== '')
if ($screen->id == 'toplevel_page_wmp-options')
$current_page = "What's new";
else
$current_page = str_replace('wp-mobile-pack_page_wmp-options-','',$screen->id);
else
$current_page = '';
?>

<div class="form-box feedback">
<h2>Give Us Your Feedback</h2>
<div class="spacer-10"></div>
<p>Help us improve WP Mobile Pack. We're eager to hear your feedback and be sure that we ALWAYS answer it.</p>
<div class="spacer-10"></div>
<form id="wmp_feedback_form" name="wmp_feedback_form" action="<?php echo admin_url('admin-ajax.php'); ?>?action=wmp_send_feedback" method="post">
<input type="hidden" name="wmp_feedback_page" id="wmp_feedback_page" value="<?php echo ucfirst($current_page);?>" />

<input type="text" name="wmp_feedback_email" id="wmp_feedback_email" placeholder="Your e-mail address" class="small" />
<div id="error_email_container" class="field-message error"></div>
<div class="spacer-10"></div>

<input type="text" name="wmp_feedback_name" id="wmp_feedback_name" placeholder="Your name" class="small" />
<div id="error_name_container" class="field-message error"></div>
<div class="spacer-10"></div>

<textarea name="wmp_feedback_message" id="wmp_feedback_message" placeholder="You're awesome, did you know that?" class="small"></textarea>
<div id="error_message_container" class="field-message error"></div>
<div class="spacer-10"></div>

<p>Webcrumbz will use the information you provide on this form to be in touch with you and to provide updates and marketing. Please let us know all the ways you would like to hear from us:</p>
<div class="spacer-10"></div>
<input type="checkbox" name="wmp_feedback_permissions_email" id="wmp_feedback_permissions_email" value="1" /> Email
<div class="spacer-10"></div>
<input type="checkbox" name="wmp_feedback_permissions_directemail" id="wmp_feedback_permissions_directemail" value="1" /> Direct Email
<div class="spacer-10"></div>

<a class="btn green smaller" href="javascript:void(0)" id="wmp_feedback_send_btn">Send</a>
</form>
</div>

<div class="ask-review">
<div class="spacer-10"></div>
<p>If you like Wordpress Mobile Pack, <a href="https://wordpress.org/support/view/plugin-reviews/wordpress-mobile-pack?filter=5#postform" target="_blank">please leave us a &#9733;&#9733;&#9733;&#9733;&#9733; rating</a>. A huge thank you in advance!</p>
</div>

<script type="text/javascript">
if (window.WMPJSInterface && window.WMPJSInterface != null){
jQuery(document).ready(function(){
window.WMPJSInterface.add("UI_feedback","WMP_SEND_FEEDBACK",{'DOMDoc':window.document, 'feedbackEmail': '<?php echo WMP_FEEDBACK_EMAIL;?>'}, window);
});
}
</script>
2 changes: 1 addition & 1 deletion core/config.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

define("WMP_VERSION", '3.3');
define("WMP_VERSION", '3.4');
define('WMP_PLUGIN_NAME', 'WP Mobile Pack');
define('WMP_DOMAIN', 'wordpress-mobile-pack');

Expand Down
79 changes: 56 additions & 23 deletions gulptools/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,19 @@
*/
var gulp = require('gulp'),
sass = require('gulp-sass'),
replace = require('gulp-batch-replace'),
stripCssComments = require('gulp-strip-css-comments'),
hex2rgb = require('hex2rgb'),
concat = require('gulp-concat'),
minify = require('gulp-minify'),
fs = require('fs'),
argv = require('yargs').argv,
insert = require('gulp-insert');


/**
* Read JSON config file from the specified path
* @param path
*/
function readConfigFile(path) {

if (fs.existsSync(path))
return JSON.parse(fs.readFileSync(path));
if (fs.existsSync(path)) return JSON.parse(fs.readFileSync(path));
}


/**
*
* Create a variables file from the two config arrays
Expand All @@ -36,18 +29,35 @@ function readConfigFile(path) {
* @returns {string}
*/
function createVariablesFile(colorVariables, fontsVariables) {

var contents = '';

for (var color in colorVariables) {
contents = contents + '$' + String(color) + ':' + String(colorVariables[color]) + ';\n';
contents =
contents +
'$' +
String(color) +
':' +
String(colorVariables[color]) +
';\n';
}

for (var font in fontsVariables) {
if (fontsVariables[font].indexOf('rem') >= 0)
contents = contents + '$' + String(font) + ':' + String(fontsVariables[font]) + ';\n';
contents =
contents +
'$' +
String(font) +
':' +
String(fontsVariables[font]) +
';\n';
else
contents = contents + '$' + String(font) + ':"' + String(fontsVariables[font]) + '";\n';
contents =
contents +
'$' +
String(font) +
':"' +
String(fontsVariables[font]) +
'";\n';
}

return contents;
Expand All @@ -58,34 +68,57 @@ function createVariablesFile(colorVariables, fontsVariables) {
* Compile CSS file for a single theme
*
*/
gulp.task('compile-default-theme', function () {

gulp.task('compile-default-theme', function() {
if (argv.theme != null) {

var theme = argv.theme;
var json = readConfigFile('../frontend/themes/app' + String(theme) + '/presets.json');

if (json == null || json['vars'] == null || json['presets'] == null || json['fonts'] == null) {
var json = readConfigFile(
'../frontend/themes/app' + String(theme) + '/presets.json'
);

if (
json == null ||
json['vars'] == null ||
json['presets'] == null ||
json['fonts'] == null
) {
console.log('Missing colors or fonts from the SCSS config file');
} else {

// Merge variable names and color settings into a single object
var colorVariables = {};
for (var i = 0; i < json['vars'].length; i++) {
colorVariables[ json['vars'][i] ] = json['presets']['1'][i];
colorVariables[json['vars'][i]] = json['presets']['1'][i];
}

// Create a string with all the variables settings
var contents = createVariablesFile(colorVariables, json['fonts']);

// Compile SCSS file and write it in the resources folder
return gulp.src('../frontend/themes/app' + String(theme) + '/scss/phone.scss')
return gulp
.src('../frontend/themes/app' + String(theme) + '/scss/phone.scss')
.pipe(insert.prepend(contents))
.pipe(sass({ outputStyle: 'compressed' }).on('error', sass.logError))
.pipe(gulp.dest('../frontend/themes/app' + String(theme) + '/css/'));
}

} else {
console.log('Missing theme argument');
}
});

/**
*
* Minify admin JS files
*
*/
gulp.task('admin:processjs', function() {
gulp
.src(['./../admin/js/**/*.js', '!./../admin/js/**/*.min.js'])
.pipe(
minify({
ext: {
min: '.min.js'
},
noSource: true
})
)
.pipe(gulp.dest('./../admin/js/'));
});
5 changes: 1 addition & 4 deletions gulptools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@
"hex2rgb": "^2.2.0"
},
"devDependencies": {
"gulp-batch-replace": "0.0.0",
"gulp-concat": "^2.6.0",
"gulp-insert": "^0.5.0",
"gulp-minify": "^3.1.0",
"gulp-sass": "^3.0.0",
"gulp-strip-css-comments": "^1.2.0",
"hex-rgb": "^1.0.0",
"yargs": "^4.8.1"
},
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions inc/class-wmp-uploads.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class WMobilePack_Uploads
'extensions' => array('png')
),
'icon' => array(
'max_width' => 256,
'max_height' => 256,
'max_width' => 512,
'max_height' => 512,
'extensions' => array('jpg', 'jpeg', 'png','gif')
),
'cover' => array(
Expand All @@ -40,7 +40,7 @@ class WMobilePack_Uploads
),
);

public static $manifest_sizes = array(48, 96, 144, 196);
public static $manifest_sizes = array(48, 96, 144, 196, 512);

protected static $htaccess_template = 'frontend/sections/htaccess-template.txt';

Expand Down
Loading

0 comments on commit 7eafb4a

Please sign in to comment.