AdSense Plugin WP QUADS - Version 2.0.8

Version Description

(12th June 2020) = * New: MGID Integration #167 * New: Added new Position to display Ad After word count #23 * New: Added new Position to show Ad After 20,40,60,80 percent of content #175 * New: Made Ads.txt modifiable #162 * New: Ads not loading specific "page template" of Page attribute #53 * New: Ampforwp & advances amp ads importer #163 * Fix: Published going to auto Draft #169 * Fix: Settings are opened, but the page is not selected #157 * Fix: CSS shows in the head of the website in AMP after update #165 * Fix: Responsive option not working #114 * Fix: positioning bug Ad was displaying when two visibility options are selected #166 * Fix: LazyLoad does not work in custom code having an Adsense code #170 * Fix: Undefined variable Warning #177

Download this release

Release Info

Developer wpquads
Plugin Icon 128x128 AdSense Plugin WP QUADS
Version 2.0.8
Comparing to
See all releases

Code changes from version 2.0.7 to 2.0.8

admin/assets/js/dist/adminscript.js CHANGED
@@ -10224,10 +10224,17 @@ var QuadsAdCreateRouter = /*#__PURE__*/function (_Component) {
10224
  _defineProperty(_assertThisInitialized(_this), "publish", function (event) {
10225
  event.preventDefault();
10226
  var quads_post_meta = _this.state.quads_post_meta;
 
 
 
 
 
 
 
10227
 
10228
  switch (quads_post_meta.ad_type) {
10229
  case 'plain_text':
10230
- if (quads_post_meta.code && quads_post_meta.position && quads_post_meta.visibility_include.length > 0) {
10231
  _this.saveAdFormData('publish');
10232
  } else {
10233
  _this.setState({
@@ -10238,7 +10245,7 @@ var QuadsAdCreateRouter = /*#__PURE__*/function (_Component) {
10238
  break;
10239
 
10240
  case 'adsense':
10241
- if (quads_post_meta.g_data_ad_slot && quads_post_meta.g_data_ad_client && quads_post_meta.position && quads_post_meta.visibility_include.length > 0) {
10242
  _this.saveAdFormData('publish');
10243
  } else {
10244
  _this.setState({
@@ -10249,7 +10256,7 @@ var QuadsAdCreateRouter = /*#__PURE__*/function (_Component) {
10249
  break;
10250
 
10251
  case 'random_ads':
10252
- if (quads_post_meta.random_ads_list.length > 0 && quads_post_meta.position && quads_post_meta.visibility_include.length > 0) {
10253
  _this.saveAdFormData('publish');
10254
  } else {
10255
  _this.setState({
@@ -10260,7 +10267,7 @@ var QuadsAdCreateRouter = /*#__PURE__*/function (_Component) {
10260
  break;
10261
 
10262
  case 'double_click':
10263
- if (quads_post_meta.ad_unit_name && quads_post_meta.network_code && quads_post_meta.position && quads_post_meta.visibility_include.length > 0) {
10264
  _this.saveAdFormData('publish');
10265
  } else {
10266
  _this.setState({
@@ -10271,7 +10278,18 @@ var QuadsAdCreateRouter = /*#__PURE__*/function (_Component) {
10271
  break;
10272
 
10273
  case 'yandex':
10274
- if (quads_post_meta.block_id && quads_post_meta.position && quads_post_meta.visibility_include.length > 0) {
 
 
 
 
 
 
 
 
 
 
 
10275
  _this.saveAdFormData('publish');
10276
  } else {
10277
  _this.setState({
@@ -10307,11 +10325,9 @@ var QuadsAdCreateRouter = /*#__PURE__*/function (_Component) {
10307
  var new_url = _this.props.location.pathname + '?page=quads-settings';
10308
 
10309
  if (_this.state.quads_state_changed && !_this.state.quads_is_saved) {
10310
- var r = confirm("Do you want to save change?");
10311
 
10312
  if (r == true) {
10313
- _this.saveAdFormData(_this.state.quads_ad_status);
10314
-
10315
  _this.props.history.push(new_url);
10316
  } else {
10317
  return false;
@@ -10387,6 +10403,17 @@ var QuadsAdCreateRouter = /*#__PURE__*/function (_Component) {
10387
 
10388
  break;
10389
 
 
 
 
 
 
 
 
 
 
 
 
10390
  default:
10391
  break;
10392
  }
@@ -10472,9 +10499,11 @@ var QuadsAdCreateRouter = /*#__PURE__*/function (_Component) {
10472
  margin: 0,
10473
  position: 'beginning_of_post',
10474
  paragraph_number: 1,
 
10475
  image_number: 1,
10476
  enabled_on_amp: false,
10477
  enable_on_end_of_post: false,
 
10478
  image_caption: false,
10479
  include_dropdown: false,
10480
  exclude_dropdown: false,
@@ -55767,6 +55796,7 @@ var QuadsAdConfigFields = /*#__PURE__*/function (_Component) {
55767
  }, /*#__PURE__*/_react["default"].createElement("table", null, /*#__PURE__*/_react["default"].createElement("tbody", null, /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("label", null, __('Data Client ID', 'quick-adsense-reloaded'))), /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("input", {
55768
  className: show_form_error && post_meta.g_data_ad_client == '' ? 'quads_form_error' : '',
55769
  value: post_meta.g_data_ad_client,
 
55770
  onChange: this.props.adFormChangeHandler,
55771
  type: "text",
55772
  id: "g_data_ad_client",
@@ -55781,7 +55811,8 @@ var QuadsAdConfigFields = /*#__PURE__*/function (_Component) {
55781
  onChange: this.props.adFormChangeHandler,
55782
  type: "text",
55783
  id: "g_data_ad_slot",
55784
- name: "g_data_ad_slot"
 
55785
  }), show_form_error && post_meta.g_data_ad_slot == '' ? /*#__PURE__*/_react["default"].createElement("div", {
55786
  className: "quads_form_msg"
55787
  }, /*#__PURE__*/_react["default"].createElement("span", {
@@ -55954,6 +55985,88 @@ var QuadsAdConfigFields = /*#__PURE__*/function (_Component) {
55954
  }, "error_outline"), "Enter Block Id") : ''))))));
55955
  break;
55956
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55957
  default:
55958
  comp_html.push( /*#__PURE__*/_react["default"].createElement("div", {
55959
  key: "noads"
@@ -60986,7 +61099,14 @@ var QuadsLayout = /*#__PURE__*/function (_Component) {
60986
  name: "ad_label_check",
60987
  onChange: this.props.adFormChangeHandler,
60988
  type: "checkbox"
60989
- }))), post_meta.ad_label_check ? /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("label", null, __('Ad Label Position', 'quick-adsense-reloaded'))), /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("select", {
 
 
 
 
 
 
 
60990
  name: "adlabel",
60991
  value: post_meta.adlabel,
60992
  onChange: this.props.adFormChangeHandler
@@ -60994,14 +61114,7 @@ var QuadsLayout = /*#__PURE__*/function (_Component) {
60994
  value: "above"
60995
  }, __('Above Ad', 'quick-adsense-reloaded')), /*#__PURE__*/_react["default"].createElement("option", {
60996
  value: "below"
60997
- }, __('Below Ad', 'quick-adsense-reloaded'))))) : null, post_meta.ad_label_check ? /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("label", null, __('Ad Label Text', 'quick-adsense-reloaded'))), /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("input", {
60998
- onChange: this.props.adFormChangeHandler,
60999
- type: "text",
61000
- className: "small-text",
61001
- id: "ad_label_text",
61002
- name: "ad_label_text",
61003
- value: post_meta.ad_label_text
61004
- }))) : null)))));
61005
  }
61006
  }]);
61007
 
@@ -62975,6 +63088,9 @@ var QuadsVisibility = /*#__PURE__*/function (_Component) {
62975
  }, {
62976
  label: 'Tags',
62977
  value: 'tags'
 
 
 
62978
  }]
62979
  };
62980
  return _this;
@@ -63202,6 +63318,10 @@ var QuadsAdvancePosition = /*#__PURE__*/function (_Component) {
63202
  }, __('After Paragraph', 'quick-adsense-reloaded')), /*#__PURE__*/_react["default"].createElement("option", {
63203
  value: "after_image"
63204
  }, __('After Image', 'quick-adsense-reloaded')), /*#__PURE__*/_react["default"].createElement("option", {
 
 
 
 
63205
  value: "ad_shortcode"
63206
  }, __('Shortcode (Manual)', 'quick-adsense-reloaded'))), /*#__PURE__*/_react["default"].createElement("optgroup", {
63207
  label: "Partial Support ( AMP Only )"
@@ -63247,6 +63367,10 @@ var QuadsAdvancePosition = /*#__PURE__*/function (_Component) {
63247
  }, __('After Paragraph', 'quick-adsense-reloaded')), /*#__PURE__*/_react["default"].createElement("option", {
63248
  value: "after_image"
63249
  }, __('After Image', 'quick-adsense-reloaded')), /*#__PURE__*/_react["default"].createElement("option", {
 
 
 
 
63250
  value: "ad_shortcode"
63251
  }, __('Shortcode (Manual)', 'quick-adsense-reloaded'))), /*#__PURE__*/_react["default"].createElement("div", null, show_form_error && post_meta.position == '' ? /*#__PURE__*/_react["default"].createElement("span", {
63252
  className: "quads-error"
@@ -63291,7 +63415,23 @@ var QuadsAdvancePosition = /*#__PURE__*/function (_Component) {
63291
  type: "checkbox"
63292
  }), /*#__PURE__*/_react["default"].createElement("label", {
63293
  "for": "repeat_paragraph"
63294
- }, " ", __('Display After Every ', 'quick-adsense-reloaded'), post_meta.paragraph_number))) : '', post_meta.position == 'after_image' ? /*#__PURE__*/_react["default"].createElement("label", null, /*#__PURE__*/_react["default"].createElement("input", {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63295
  checked: post_meta.image_caption,
63296
  name: "image_caption",
63297
  onChange: this.props.adFormChangeHandler,
@@ -63729,6 +63869,35 @@ var QuadsAdListSettings = /*#__PURE__*/function (_Component) {
63729
  });
63730
  });
63731
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63732
  _defineProperty(_assertThisInitialized(_this), "open_global_excluder", function () {
63733
  _this.setState({
63734
  global_excluder_modal: true
@@ -63895,7 +64064,8 @@ var QuadsAdListSettings = /*#__PURE__*/function (_Component) {
63895
 
63896
  _defineProperty(_assertThisInitialized(_this), "closeQuerySuccess", function (e) {
63897
  _this.setState({
63898
- customer_querey_success: ''
 
63899
  });
63900
  });
63901
 
@@ -64355,7 +64525,9 @@ var QuadsAdListSettings = /*#__PURE__*/function (_Component) {
64355
  multiTagsValue: [],
64356
  multiPluginsValue: []
64357
  },
64358
- quads_wp_quads_pro_license_key: ''
 
 
64359
  };
64360
  return _this;
64361
  }
@@ -64525,7 +64697,10 @@ var QuadsAdListSettings = /*#__PURE__*/function (_Component) {
64525
  checked: settings.adsTxtEnabled
64526
  }), /*#__PURE__*/_react["default"].createElement("span", {
64527
  className: "quads-slider"
64528
- })))), quads_localize_data.is_pro ? /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("th", null, /*#__PURE__*/_react["default"].createElement("label", {
 
 
 
64529
  htmlFor: "global_excluder_enabled"
64530
  }, __('Global Excluder', 'quick-adsense-reloaded'))), /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("label", {
64531
  className: "quads-switch"
@@ -64619,11 +64794,26 @@ var QuadsAdListSettings = /*#__PURE__*/function (_Component) {
64619
  }, __('Copy System Info', 'quick-adsense-reloaded')), /*#__PURE__*/_react["default"].createElement("div", null, _this2.state.copied ? /*#__PURE__*/_react["default"].createElement("span", null, __('System info copied to clipboard', 'quick-adsense-reloaded')) : null))), /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("th", null, /*#__PURE__*/_react["default"].createElement("label", null, __('Export', 'quick-adsense-reloaded'))), /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("a", {
64620
  href: "".concat(quads_localize_data.rest_url, "quads-route/export-settings"),
64621
  className: "quads-btn quads-btn-primary"
64622
- }, "Export"), /*#__PURE__*/_react["default"].createElement("p", null, __('Export the Quick AdSense Reloaded settings for this site as a .json file. This allows you to easily import the configuration into another site.', 'quick-adsense-reloaded')))), /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("th", null, /*#__PURE__*/_react["default"].createElement("label", null, __('Import', 'quick-adsense-reloaded'))), /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("input", {
64623
- type: "file",
64624
- name: "import_file",
64625
- onChange: _this2.formChangeHandler
64626
- }), /*#__PURE__*/_react["default"].createElement("p", null, __('Import the Quick AdSense Reloaded settings from a .json file. This file can be obtained by exporting the settings on another site using the form above.', 'quick-adsense-reloaded')))))));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64627
 
64628
  case "settings_google_autoads":
64629
  return /*#__PURE__*/_react["default"].createElement("div", {
@@ -103444,6 +103634,9 @@ var QuadsAdSettingsNavLink = /*#__PURE__*/function (_Component) {
103444
  to: 'admin.php?page=quads-settings&path=settings_tools',
103445
  className: current == 'settings_tools' ? 'quads-nav-link quads-nav-link-active' : 'quads-nav-link'
103446
  }, __('Tools', 'quick-adsense-reloaded')))), /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("h2", null, /*#__PURE__*/_react["default"].createElement(_reactRouterDom.Link, {
 
 
 
103447
  to: 'admin.php?page=quads-settings&path=settings_legacy',
103448
  className: current == 'settings_legacy' ? 'quads-nav-link quads-nav-link-active' : 'quads-nav-link'
103449
  }, __('Legacy', 'quick-adsense-reloaded')))), /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("h2", null, /*#__PURE__*/_react["default"].createElement(_reactRouterDom.Link, {
@@ -104149,6 +104342,11 @@ var QuadsAdList = /*#__PURE__*/function (_Component) {
104149
  type = "Yandex";
104150
  break;
104151
 
 
 
 
 
 
104152
  default:
104153
  break;
104154
  }
@@ -104493,7 +104691,14 @@ var QuadsAdListNavLink = /*#__PURE__*/function (_Component) {
104493
  var current = 'ads';
104494
 
104495
  if (typeof page.path != 'undefined') {
104496
- if (page.path == 'settings' || page.path == 'settings_tools' || page.path == 'settings_legacy' || page.path == 'settings_support' || page.path == 'settings_licenses' || page.path == 'settings_google_autoads') current = 'settings';
 
 
 
 
 
 
 
104497
  }
104498
 
104499
  return /*#__PURE__*/_react["default"].createElement("div", {
@@ -104619,6 +104824,10 @@ var AdTypeSelectorNavLink = /*#__PURE__*/function (_Component) {
104619
  img_url = quads_localize_data.quads_plugin_url + 'admin/assets/js/src/images/yandex.png';
104620
  break;
104621
 
 
 
 
 
104622
  default:
104623
  break;
104624
  }
@@ -104648,6 +104857,9 @@ var AdTypeSelectorNavLink = /*#__PURE__*/function (_Component) {
104648
  }, {
104649
  ad_type: 'yandex',
104650
  ad_type_name: 'Yandex'
 
 
 
104651
  }, {
104652
  ad_type: 'plain_text',
104653
  ad_type_name: 'Plain Text / HTML / JS'
10224
  _defineProperty(_assertThisInitialized(_this), "publish", function (event) {
10225
  event.preventDefault();
10226
  var quads_post_meta = _this.state.quads_post_meta;
10227
+ var validation_flag = true;
10228
+
10229
+ if (quads_post_meta.position == 'after_the_percentage') {
10230
+ if (quads_post_meta.after_the_percentage_value == '' || parseInt(quads_post_meta.after_the_percentage_value) < 10 || parseInt(quads_post_meta.after_the_percentage_value) > 101) {
10231
+ validation_flag = false;
10232
+ }
10233
+ }
10234
 
10235
  switch (quads_post_meta.ad_type) {
10236
  case 'plain_text':
10237
+ if (validation_flag && quads_post_meta.code && quads_post_meta.position && quads_post_meta.visibility_include.length > 0) {
10238
  _this.saveAdFormData('publish');
10239
  } else {
10240
  _this.setState({
10245
  break;
10246
 
10247
  case 'adsense':
10248
+ if (validation_flag && quads_post_meta.g_data_ad_slot && quads_post_meta.g_data_ad_client && quads_post_meta.position && quads_post_meta.visibility_include.length > 0) {
10249
  _this.saveAdFormData('publish');
10250
  } else {
10251
  _this.setState({
10256
  break;
10257
 
10258
  case 'random_ads':
10259
+ if (validation_flag && quads_post_meta.random_ads_list.length > 0 && quads_post_meta.position && quads_post_meta.visibility_include.length > 0) {
10260
  _this.saveAdFormData('publish');
10261
  } else {
10262
  _this.setState({
10267
  break;
10268
 
10269
  case 'double_click':
10270
+ if (validation_flag && quads_post_meta.ad_unit_name && quads_post_meta.network_code && quads_post_meta.position && quads_post_meta.visibility_include.length > 0) {
10271
  _this.saveAdFormData('publish');
10272
  } else {
10273
  _this.setState({
10278
  break;
10279
 
10280
  case 'yandex':
10281
+ if (validation_flag && quads_post_meta.block_id && quads_post_meta.position && quads_post_meta.visibility_include.length > 0) {
10282
+ _this.saveAdFormData('publish');
10283
+ } else {
10284
+ _this.setState({
10285
+ show_form_error: true
10286
+ });
10287
+ }
10288
+
10289
+ break;
10290
+
10291
+ case 'mgid':
10292
+ if (validation_flag && quads_post_meta.data_publisher && quads_post_meta.data_widget && quads_post_meta.data_container && quads_post_meta.position && quads_post_meta.visibility_include.length > 0) {
10293
  _this.saveAdFormData('publish');
10294
  } else {
10295
  _this.setState({
10325
  var new_url = _this.props.location.pathname + '?page=quads-settings';
10326
 
10327
  if (_this.state.quads_state_changed && !_this.state.quads_is_saved) {
10328
+ var r = confirm("Changes you made may not be saved.");
10329
 
10330
  if (r == true) {
 
 
10331
  _this.props.history.push(new_url);
10332
  } else {
10333
  return false;
10403
 
10404
  break;
10405
 
10406
+ case 'mgid':
10407
+ if (quads_post_meta.data_publisher && quads_post_meta.data_widget && quads_post_meta.data_container) {
10408
+ _this.props.history.push(new_url);
10409
+ } else {
10410
+ _this.setState({
10411
+ show_form_error: true
10412
+ });
10413
+ }
10414
+
10415
+ break;
10416
+
10417
  default:
10418
  break;
10419
  }
10499
  margin: 0,
10500
  position: 'beginning_of_post',
10501
  paragraph_number: 1,
10502
+ word_count_number: 100,
10503
  image_number: 1,
10504
  enabled_on_amp: false,
10505
  enable_on_end_of_post: false,
10506
+ after_the_percentage_value: 50,
10507
  image_caption: false,
10508
  include_dropdown: false,
10509
  exclude_dropdown: false,
55796
  }, /*#__PURE__*/_react["default"].createElement("table", null, /*#__PURE__*/_react["default"].createElement("tbody", null, /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("label", null, __('Data Client ID', 'quick-adsense-reloaded'))), /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("input", {
55797
  className: show_form_error && post_meta.g_data_ad_client == '' ? 'quads_form_error' : '',
55798
  value: post_meta.g_data_ad_client,
55799
+ placeholder: "ca-pub-2005XXXXXXXXX342",
55800
  onChange: this.props.adFormChangeHandler,
55801
  type: "text",
55802
  id: "g_data_ad_client",
55811
  onChange: this.props.adFormChangeHandler,
55812
  type: "text",
55813
  id: "g_data_ad_slot",
55814
+ name: "g_data_ad_slot",
55815
+ placeholder: "70XXXXXX12"
55816
  }), show_form_error && post_meta.g_data_ad_slot == '' ? /*#__PURE__*/_react["default"].createElement("div", {
55817
  className: "quads_form_msg"
55818
  }, /*#__PURE__*/_react["default"].createElement("span", {
55985
  }, "error_outline"), "Enter Block Id") : ''))))));
55986
  break;
55987
 
55988
+ case 'mgid':
55989
+ ad_type_name = 'MGID';
55990
+ comp_html.push( /*#__PURE__*/_react["default"].createElement("div", {
55991
+ key: "mgid"
55992
+ }, /*#__PURE__*/_react["default"].createElement("table", null, /*#__PURE__*/_react["default"].createElement("tbody", null, /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("label", null, __('Data Publisher', 'quick-adsense-reloaded'))), /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("input", {
55993
+ className: show_form_error && post_meta.data_publisher == '' ? 'quads_form_error' : '',
55994
+ value: post_meta.data_publisher,
55995
+ onChange: this.props.adFormChangeHandler,
55996
+ type: "text",
55997
+ id: "data_publisher",
55998
+ name: "data_publisher",
55999
+ placeholder: "site.com"
56000
+ }), show_form_error && post_meta.data_publisher == '' ? /*#__PURE__*/_react["default"].createElement("div", {
56001
+ className: "quads_form_msg"
56002
+ }, /*#__PURE__*/_react["default"].createElement("span", {
56003
+ className: "material-icons"
56004
+ }, "error_outline"), "Data Publisher") : '')), /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("label", null, __('Data Widget', 'quick-adsense-reloaded'))), /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("input", {
56005
+ className: show_form_error && post_meta.data_widget == '' ? 'quads_form_error' : '',
56006
+ value: post_meta.data_widget,
56007
+ onChange: this.props.adFormChangeHandler,
56008
+ type: "text",
56009
+ id: "data_widget",
56010
+ name: "data_widget",
56011
+ placeholder: "123456"
56012
+ }), show_form_error && post_meta.data_widget == '' ? /*#__PURE__*/_react["default"].createElement("div", {
56013
+ className: "quads_form_msg"
56014
+ }, /*#__PURE__*/_react["default"].createElement("span", {
56015
+ className: "material-icons"
56016
+ }, "error_outline"), "Enter Data Widget") : '')), /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("label", null, __('Data Container', 'quick-adsense-reloaded'))), /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("input", {
56017
+ className: show_form_error && post_meta.data_container == '' ? 'quads_form_error' : '',
56018
+ value: post_meta.data_container,
56019
+ onChange: this.props.adFormChangeHandler,
56020
+ type: "text",
56021
+ id: "data_container",
56022
+ name: "data_container",
56023
+ placeholder: "M87ScriptRootC123645"
56024
+ }), show_form_error && post_meta.data_container == '' ? /*#__PURE__*/_react["default"].createElement("div", {
56025
+ className: "quads_form_msg"
56026
+ }, /*#__PURE__*/_react["default"].createElement("span", {
56027
+ className: "material-icons"
56028
+ }, "error_outline"), "Enter Data Container") : '')), /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("label", null, __('Data Js Src', 'quick-adsense-reloaded'))), /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("input", {
56029
+ className: show_form_error && post_meta.data_js_src == '' ? 'quads_form_error' : '',
56030
+ value: post_meta.data_js_src,
56031
+ onChange: this.props.adFormChangeHandler,
56032
+ type: "text",
56033
+ id: "data_js_src",
56034
+ name: "data_js_src",
56035
+ placeholder: "//jsc.mgid.com/a/m/quads.com.123645.js"
56036
+ }), show_form_error && post_meta.data_js_src == '' ? /*#__PURE__*/_react["default"].createElement("div", {
56037
+ className: "quads_form_msg"
56038
+ }, /*#__PURE__*/_react["default"].createElement("span", {
56039
+ className: "material-icons"
56040
+ }, "error_outline"), "Enter Data Js Src") : '')), /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("label", null, __('Size', 'quick-adsense-reloaded'))), /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("select", {
56041
+ value: post_meta.adsense_type,
56042
+ onChange: this.props.adFormChangeHandler,
56043
+ name: "adsense_type",
56044
+ id: "adsense_type"
56045
+ }, /*#__PURE__*/_react["default"].createElement("option", {
56046
+ value: "normal"
56047
+ }, __('Fixed Size', 'quick-adsense-reloaded')), /*#__PURE__*/_react["default"].createElement("option", {
56048
+ value: "responsive"
56049
+ }, __('Responsive', 'quick-adsense-reloaded'))), post_meta.adsense_type !== 'responsive' ? /*#__PURE__*/_react["default"].createElement("div", {
56050
+ className: "quads-adsense-width-heigth"
56051
+ }, /*#__PURE__*/_react["default"].createElement("div", {
56052
+ className: "quads-adsense-width"
56053
+ }, /*#__PURE__*/_react["default"].createElement("label", null, __('Width', 'quick-adsense-reloaded'), /*#__PURE__*/_react["default"].createElement("input", {
56054
+ value: post_meta.g_data_ad_width ? post_meta.g_data_ad_width : '300',
56055
+ onChange: this.props.adFormChangeHandler,
56056
+ type: "number",
56057
+ id: "g_data_ad_width",
56058
+ name: "g_data_ad_width"
56059
+ }))), /*#__PURE__*/_react["default"].createElement("div", {
56060
+ className: "quads-adsense-height"
56061
+ }, /*#__PURE__*/_react["default"].createElement("label", null, __('Height', 'quick-adsense-reloaded'), /*#__PURE__*/_react["default"].createElement("input", {
56062
+ value: post_meta.g_data_ad_height ? post_meta.g_data_ad_height : '250',
56063
+ onChange: this.props.adFormChangeHandler,
56064
+ type: "number",
56065
+ id: "g_data_ad_height",
56066
+ name: "g_data_ad_height"
56067
+ })))) : '')))))));
56068
+ break;
56069
+
56070
  default:
56071
  comp_html.push( /*#__PURE__*/_react["default"].createElement("div", {
56072
  key: "noads"
61099
  name: "ad_label_check",
61100
  onChange: this.props.adFormChangeHandler,
61101
  type: "checkbox"
61102
+ }))), post_meta.ad_label_check ? /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("label", null, __('Ad Label Text', 'quick-adsense-reloaded'))), /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("input", {
61103
+ onChange: this.props.adFormChangeHandler,
61104
+ type: "text",
61105
+ className: "small-text",
61106
+ id: "ad_label_text",
61107
+ name: "ad_label_text",
61108
+ value: post_meta.ad_label_text
61109
+ }))) : null, post_meta.ad_label_check ? /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("label", null, __('Ad Label Position', 'quick-adsense-reloaded'))), /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("select", {
61110
  name: "adlabel",
61111
  value: post_meta.adlabel,
61112
  onChange: this.props.adFormChangeHandler
61114
  value: "above"
61115
  }, __('Above Ad', 'quick-adsense-reloaded')), /*#__PURE__*/_react["default"].createElement("option", {
61116
  value: "below"
61117
+ }, __('Below Ad', 'quick-adsense-reloaded'))))) : null)))));
 
 
 
 
 
 
 
61118
  }
61119
  }]);
61120
 
63088
  }, {
63089
  label: 'Tags',
63090
  value: 'tags'
63091
+ }, {
63092
+ label: 'Page Template',
63093
+ value: 'page_template'
63094
  }]
63095
  };
63096
  return _this;
63318
  }, __('After Paragraph', 'quick-adsense-reloaded')), /*#__PURE__*/_react["default"].createElement("option", {
63319
  value: "after_image"
63320
  }, __('After Image', 'quick-adsense-reloaded')), /*#__PURE__*/_react["default"].createElement("option", {
63321
+ value: "after_word_count"
63322
+ }, __('By Word Count', 'quick-adsense-reloaded')), /*#__PURE__*/_react["default"].createElement("option", {
63323
+ value: "after_the_percentage"
63324
+ }, __('After the Percentage', 'quick-adsense-reloaded')), /*#__PURE__*/_react["default"].createElement("option", {
63325
  value: "ad_shortcode"
63326
  }, __('Shortcode (Manual)', 'quick-adsense-reloaded'))), /*#__PURE__*/_react["default"].createElement("optgroup", {
63327
  label: "Partial Support ( AMP Only )"
63367
  }, __('After Paragraph', 'quick-adsense-reloaded')), /*#__PURE__*/_react["default"].createElement("option", {
63368
  value: "after_image"
63369
  }, __('After Image', 'quick-adsense-reloaded')), /*#__PURE__*/_react["default"].createElement("option", {
63370
+ value: "after_word_count"
63371
+ }, __('By Word Count', 'quick-adsense-reloaded')), /*#__PURE__*/_react["default"].createElement("option", {
63372
+ value: "after_the_percentage"
63373
+ }, __('After the Percentage', 'quick-adsense-reloaded')), /*#__PURE__*/_react["default"].createElement("option", {
63374
  value: "ad_shortcode"
63375
  }, __('Shortcode (Manual)', 'quick-adsense-reloaded'))), /*#__PURE__*/_react["default"].createElement("div", null, show_form_error && post_meta.position == '' ? /*#__PURE__*/_react["default"].createElement("span", {
63376
  className: "quads-error"
63415
  type: "checkbox"
63416
  }), /*#__PURE__*/_react["default"].createElement("label", {
63417
  "for": "repeat_paragraph"
63418
+ }, " ", __('Display After Every ', 'quick-adsense-reloaded'), post_meta.paragraph_number))) : '', post_meta.position == 'after_word_count' ? /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("label", null, /*#__PURE__*/_react["default"].createElement("input", {
63419
+ min: "1",
63420
+ onChange: this.props.adFormChangeHandler,
63421
+ name: "word_count_number",
63422
+ value: post_meta.word_count_number,
63423
+ type: "number"
63424
+ }))) : '', post_meta.position == 'after_the_percentage' ? /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("label", null, /*#__PURE__*/_react["default"].createElement("input", {
63425
+ min: "1",
63426
+ onChange: this.props.adFormChangeHandler,
63427
+ name: "after_the_percentage_value",
63428
+ value: post_meta.after_the_percentage_value,
63429
+ type: "number"
63430
+ }), " %")) : '', show_form_error && post_meta.position == 'after_the_percentage' && (post_meta.g_data_ad_client == '' || parseInt(quads_post_meta.after_the_percentage_value) < 10 || parseInt(quads_post_meta.after_the_percentage_value) > 101) ? /*#__PURE__*/_react["default"].createElement("div", {
63431
+ className: "quads_form_msg"
63432
+ }, /*#__PURE__*/_react["default"].createElement("span", {
63433
+ className: "material-icons"
63434
+ }, "error_outline"), "Percentage should be between 10 to 100") : '', post_meta.position == 'after_image' ? /*#__PURE__*/_react["default"].createElement("label", null, /*#__PURE__*/_react["default"].createElement("input", {
63435
  checked: post_meta.image_caption,
63436
  name: "image_caption",
63437
  onChange: this.props.adFormChangeHandler,
63869
  });
63870
  });
63871
 
63872
+ _defineProperty(_assertThisInitialized(_this), "importampforwpdata", function () {
63873
+ if (_this.state.importampforwpmsgprocessing != '') {
63874
+ return;
63875
+ }
63876
+
63877
+ _this.setState({
63878
+ importampforwpmsgprocessing: 'Importing Ads'
63879
+ });
63880
+
63881
+ var url = quads_localize_data.rest_url + 'quads-route/import-ampforwp-ads';
63882
+ fetch(url, {
63883
+ method: "post",
63884
+ headers: {
63885
+ 'Accept': 'application/json',
63886
+ 'Content-Type': 'application/json',
63887
+ 'X-WP-Nonce': quads_localize_data.nonce
63888
+ }
63889
+ }).then(function (res) {
63890
+ return res.json();
63891
+ }).then(function (result) {
63892
+ if (result.status === 't') {
63893
+ _this.setState({
63894
+ importampforwpmsg: result.data,
63895
+ importampforwpmsgprocessing: ''
63896
+ });
63897
+ }
63898
+ }, function (error) {});
63899
+ });
63900
+
63901
  _defineProperty(_assertThisInitialized(_this), "open_global_excluder", function () {
63902
  _this.setState({
63903
  global_excluder_modal: true
64064
 
64065
  _defineProperty(_assertThisInitialized(_this), "closeQuerySuccess", function (e) {
64066
  _this.setState({
64067
+ customer_querey_success: '',
64068
+ importampforwpmsg: ''
64069
  });
64070
  });
64071
 
64525
  multiTagsValue: [],
64526
  multiPluginsValue: []
64527
  },
64528
+ quads_wp_quads_pro_license_key: '',
64529
+ importampforwpmsg: "",
64530
+ importampforwpmsgprocessing: ""
64531
  };
64532
  return _this;
64533
  }
64697
  checked: settings.adsTxtEnabled
64698
  }), /*#__PURE__*/_react["default"].createElement("span", {
64699
  className: "quads-slider"
64700
+ })), _this2.state.adsTxtEnabled ? /*#__PURE__*/_react["default"].createElement("span", {
64701
+ onClick: _this2.open_ad_text_modal,
64702
+ className: "quads-generic-icon dashicons dashicons-admin-generic"
64703
+ }) : '')), quads_localize_data.is_pro ? /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("th", null, /*#__PURE__*/_react["default"].createElement("label", {
64704
  htmlFor: "global_excluder_enabled"
64705
  }, __('Global Excluder', 'quick-adsense-reloaded'))), /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("label", {
64706
  className: "quads-switch"
64794
  }, __('Copy System Info', 'quick-adsense-reloaded')), /*#__PURE__*/_react["default"].createElement("div", null, _this2.state.copied ? /*#__PURE__*/_react["default"].createElement("span", null, __('System info copied to clipboard', 'quick-adsense-reloaded')) : null))), /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("th", null, /*#__PURE__*/_react["default"].createElement("label", null, __('Export', 'quick-adsense-reloaded'))), /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("a", {
64795
  href: "".concat(quads_localize_data.rest_url, "quads-route/export-settings"),
64796
  className: "quads-btn quads-btn-primary"
64797
+ }, "Export"), /*#__PURE__*/_react["default"].createElement("p", null, __('Export the Quick AdSense Reloaded settings for this site as a .json file. This allows you to easily import the configuration into another site.', 'quick-adsense-reloaded')))))));
64798
+
64799
+ case "settings_importer":
64800
+ return /*#__PURE__*/_react["default"].createElement("div", {
64801
+ className: "quads-settings-tab-container"
64802
+ }, /*#__PURE__*/_react["default"].createElement("table", {
64803
+ className: "form-table",
64804
+ role: "presentation"
64805
+ }, /*#__PURE__*/_react["default"].createElement("tbody", null, /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("th", null, /*#__PURE__*/_react["default"].createElement("label", null, __('AMP for WP Ads', 'quick-adsense-reloaded'))), /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("a", {
64806
+ className: "quads-btn quads-btn-primary",
64807
+ id: "import_amp_for_wp",
64808
+ onClick: _this2.importampforwpdata
64809
+ }, __('Import', 'quick-adsense-reloaded')), _this2.state.importampforwpmsg ? /*#__PURE__*/_react["default"].createElement(_lab.Alert, {
64810
+ severity: "success",
64811
+ action: /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
64812
+ onClick: _this2.closeQuerySuccess
64813
+ }, "close")
64814
+ }, _this2.state.importampforwpmsg) : null, _this2.state.importampforwpmsgprocessing ? /*#__PURE__*/_react["default"].createElement("div", {
64815
+ className: "updating-message importampforwpmsgprocessing"
64816
+ }, /*#__PURE__*/_react["default"].createElement("p", null, "Importing Ads")) : '')))));
64817
 
64818
  case "settings_google_autoads":
64819
  return /*#__PURE__*/_react["default"].createElement("div", {
103634
  to: 'admin.php?page=quads-settings&path=settings_tools',
103635
  className: current == 'settings_tools' ? 'quads-nav-link quads-nav-link-active' : 'quads-nav-link'
103636
  }, __('Tools', 'quick-adsense-reloaded')))), /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("h2", null, /*#__PURE__*/_react["default"].createElement(_reactRouterDom.Link, {
103637
+ to: 'admin.php?page=quads-settings&path=settings_importer',
103638
+ className: current == 'settings_importer' ? 'quads-nav-link quads-nav-link-active' : 'quads-nav-link'
103639
+ }, __('Importer', 'quick-adsense-reloaded')))), /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("h2", null, /*#__PURE__*/_react["default"].createElement(_reactRouterDom.Link, {
103640
  to: 'admin.php?page=quads-settings&path=settings_legacy',
103641
  className: current == 'settings_legacy' ? 'quads-nav-link quads-nav-link-active' : 'quads-nav-link'
103642
  }, __('Legacy', 'quick-adsense-reloaded')))), /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("h2", null, /*#__PURE__*/_react["default"].createElement(_reactRouterDom.Link, {
104342
  type = "Yandex";
104343
  break;
104344
 
104345
+ case 'mgid':
104346
+ img_url = quads_localize_data.quads_plugin_url + 'admin/assets/js/src/images/mgid_icon.png';
104347
+ type = "MGID";
104348
+ break;
104349
+
104350
  default:
104351
  break;
104352
  }
104691
  var current = 'ads';
104692
 
104693
  if (typeof page.path != 'undefined') {
104694
+ if (page.path == 'settings' || page.path == 'settings_tools' || page.path == 'settings_importer' || page.path == 'settings_legacy' || page.path == 'settings_support' || page.path == 'settings_licenses' || page.path == 'settings_google_autoads') {
104695
+ jQuery('.wp-submenu li').removeClass('current');
104696
+ jQuery('a[href$="quads-settings&path=settings"]').parent().addClass('current');
104697
+ current = 'settings';
104698
+ }
104699
+ } else if (page.page == 'quads-settings') {
104700
+ jQuery('.wp-submenu li').removeClass('current');
104701
+ jQuery('a[href$="quads-settings"]').parent().addClass('current');
104702
  }
104703
 
104704
  return /*#__PURE__*/_react["default"].createElement("div", {
104824
  img_url = quads_localize_data.quads_plugin_url + 'admin/assets/js/src/images/yandex.png';
104825
  break;
104826
 
104827
+ case 'mgid':
104828
+ img_url = quads_localize_data.quads_plugin_url + 'admin/assets/js/src/images/mgid.png';
104829
+ break;
104830
+
104831
  default:
104832
  break;
104833
  }
104857
  }, {
104858
  ad_type: 'yandex',
104859
  ad_type_name: 'Yandex'
104860
+ }, {
104861
+ ad_type: 'mgid',
104862
+ ad_type_name: 'MGID'
104863
  }, {
104864
  ad_type: 'plain_text',
104865
  ad_type_name: 'Plain Text / HTML / JS'
admin/assets/js/dist/style.css CHANGED
@@ -271,6 +271,9 @@ and open the template in the editor.
271
 
272
  #repeat_paragraph + label {
273
  text-transform: none; }
 
 
 
274
  /*
275
  To change this license header, choose License Headers in Project Properties.
276
  To change this template file, choose Tools | Templates
@@ -1178,6 +1181,11 @@ a.quads-nav-link-active {
1178
 
1179
  .quads-save-settings {
1180
  padding: 25px; }
 
 
 
 
 
1181
  /*
1182
  To change this license header, choose License Headers in Project Properties.
1183
  To change this template file, choose Tools | Templates
271
 
272
  #repeat_paragraph + label {
273
  text-transform: none; }
274
+
275
+ .quads-settings-group .quads-tr-position .quads-position-dropdown select {
276
+ width: 311px; }
277
  /*
278
  To change this license header, choose License Headers in Project Properties.
279
  To change this template file, choose Tools | Templates
1181
 
1182
  .quads-save-settings {
1183
  padding: 25px; }
1184
+
1185
+ .importampforwpmsgprocessing {
1186
+ background-color: #edf7ed;
1187
+ padding: 6px 16px;
1188
+ font-size: 0.875rem; }
1189
  /*
1190
  To change this license header, choose License Headers in Project Properties.
1191
  To change this template file, choose Tools | Templates
admin/assets/js/src/components/ads/ad-create-router/QuadsAdCreateRouter.jsx CHANGED
@@ -73,9 +73,11 @@ class QuadsAdCreateRouter extends Component {
73
  margin : 0,
74
  position : 'beginning_of_post',
75
  paragraph_number : 1,
 
76
  image_number : 1,
77
  enabled_on_amp : false,
78
  enable_on_end_of_post : false,
 
79
  image_caption : false,
80
  include_dropdown : false,
81
  exclude_dropdown : false,
@@ -375,12 +377,17 @@ class QuadsAdCreateRouter extends Component {
375
 
376
  event.preventDefault();
377
  const {quads_post_meta} = this.state;
378
-
 
 
 
 
 
379
  switch (quads_post_meta.ad_type) {
380
 
381
  case 'plain_text':
382
 
383
- if(quads_post_meta.code && quads_post_meta.position && quads_post_meta.visibility_include.length > 0){
384
  this.saveAdFormData('publish');
385
  }else{
386
  this.setState({show_form_error:true});
@@ -389,7 +396,7 @@ class QuadsAdCreateRouter extends Component {
389
  break;
390
 
391
  case 'adsense':
392
- if(quads_post_meta.g_data_ad_slot && quads_post_meta.g_data_ad_client && quads_post_meta.position && quads_post_meta.visibility_include.length > 0){
393
  this.saveAdFormData('publish');
394
  }else{
395
  this.setState({show_form_error:true});
@@ -397,21 +404,28 @@ class QuadsAdCreateRouter extends Component {
397
 
398
  break;
399
  case 'random_ads':
400
- if(quads_post_meta.random_ads_list.length > 0 && quads_post_meta.position && quads_post_meta.visibility_include.length > 0){
401
  this.saveAdFormData('publish');
402
  }else{
403
  this.setState({show_form_error:true});
404
  }
405
  break;
406
  case 'double_click':
407
- if(quads_post_meta.ad_unit_name && quads_post_meta.network_code && quads_post_meta.position && quads_post_meta.visibility_include.length > 0){
408
  this.saveAdFormData('publish');
409
  }else{
410
  this.setState({show_form_error:true});
411
  }
412
  break;
413
  case 'yandex':
414
- if(quads_post_meta.block_id && quads_post_meta.position && quads_post_meta.visibility_include.length > 0){
 
 
 
 
 
 
 
415
  this.saveAdFormData('publish');
416
  }else{
417
  this.setState({show_form_error:true});
@@ -469,13 +483,10 @@ class QuadsAdCreateRouter extends Component {
469
 
470
  if(this.state.quads_state_changed && !this.state.quads_is_saved){
471
 
472
- let r = confirm("Do you want to save change?");
473
 
474
  if (r == true) {
475
-
476
- this.saveAdFormData(this.state.quads_ad_status);
477
-
478
- this.props.history.push(new_url);
479
 
480
  } else {
481
  return false
@@ -537,6 +548,13 @@ class QuadsAdCreateRouter extends Component {
537
  this.setState({show_form_error:true});
538
  }
539
  break;
 
 
 
 
 
 
 
540
  default:
541
  break;
542
  }
73
  margin : 0,
74
  position : 'beginning_of_post',
75
  paragraph_number : 1,
76
+ word_count_number : 100,
77
  image_number : 1,
78
  enabled_on_amp : false,
79
  enable_on_end_of_post : false,
80
+ after_the_percentage_value: 50,
81
  image_caption : false,
82
  include_dropdown : false,
83
  exclude_dropdown : false,
377
 
378
  event.preventDefault();
379
  const {quads_post_meta} = this.state;
380
+ let validation_flag = true;
381
+ if(quads_post_meta.position == 'after_the_percentage'){
382
+ if(quads_post_meta.after_the_percentage_value == '' || parseInt(quads_post_meta.after_the_percentage_value) < 10 || parseInt(quads_post_meta.after_the_percentage_value) > 101){
383
+ validation_flag = false;
384
+ }
385
+ }
386
  switch (quads_post_meta.ad_type) {
387
 
388
  case 'plain_text':
389
 
390
+ if(validation_flag && quads_post_meta.code && quads_post_meta.position && quads_post_meta.visibility_include.length > 0){
391
  this.saveAdFormData('publish');
392
  }else{
393
  this.setState({show_form_error:true});
396
  break;
397
 
398
  case 'adsense':
399
+ if(validation_flag && quads_post_meta.g_data_ad_slot && quads_post_meta.g_data_ad_client && quads_post_meta.position && quads_post_meta.visibility_include.length > 0){
400
  this.saveAdFormData('publish');
401
  }else{
402
  this.setState({show_form_error:true});
404
 
405
  break;
406
  case 'random_ads':
407
+ if(validation_flag && quads_post_meta.random_ads_list.length > 0 && quads_post_meta.position && quads_post_meta.visibility_include.length > 0){
408
  this.saveAdFormData('publish');
409
  }else{
410
  this.setState({show_form_error:true});
411
  }
412
  break;
413
  case 'double_click':
414
+ if(validation_flag && quads_post_meta.ad_unit_name && quads_post_meta.network_code && quads_post_meta.position && quads_post_meta.visibility_include.length > 0){
415
  this.saveAdFormData('publish');
416
  }else{
417
  this.setState({show_form_error:true});
418
  }
419
  break;
420
  case 'yandex':
421
+ if(validation_flag && quads_post_meta.block_id && quads_post_meta.position && quads_post_meta.visibility_include.length > 0){
422
+ this.saveAdFormData('publish');
423
+ }else{
424
+ this.setState({show_form_error:true});
425
+ }
426
+ break;
427
+ case 'mgid':
428
+ if(validation_flag && quads_post_meta.data_publisher && quads_post_meta.data_widget && quads_post_meta.data_container && quads_post_meta.position && quads_post_meta.visibility_include.length > 0){
429
  this.saveAdFormData('publish');
430
  }else{
431
  this.setState({show_form_error:true});
483
 
484
  if(this.state.quads_state_changed && !this.state.quads_is_saved){
485
 
486
+ let r = confirm("Changes you made may not be saved.");
487
 
488
  if (r == true) {
489
+ this.props.history.push(new_url);
 
 
 
490
 
491
  } else {
492
  return false
548
  this.setState({show_form_error:true});
549
  }
550
  break;
551
+ case 'mgid':
552
+ if(quads_post_meta.data_publisher && quads_post_meta.data_widget && quads_post_meta.data_container){
553
+ this.props.history.push(new_url);
554
+ }else{
555
+ this.setState({show_form_error:true});
556
+ }
557
+ break;
558
  default:
559
  break;
560
  }
admin/assets/js/src/components/ads/ad-list/QuadsAdList.jsx CHANGED
@@ -57,7 +57,10 @@ class QuadsAdList extends Component {
57
  img_url = quads_localize_data.quads_plugin_url+'admin/assets/js/src/images/yandex_icon.png';
58
  type = "Yandex";
59
  break;
60
-
 
 
 
61
  default:
62
  break;
63
  }
57
  img_url = quads_localize_data.quads_plugin_url+'admin/assets/js/src/images/yandex_icon.png';
58
  type = "Yandex";
59
  break;
60
+ case 'mgid':
61
+ img_url = quads_localize_data.quads_plugin_url+'admin/assets/js/src/images/mgid_icon.png';
62
+ type = "MGID";
63
+ break;
64
  default:
65
  break;
66
  }
admin/assets/js/src/components/ads/ad-type-selector-nav/AdTypeSelectorNavLink.jsx CHANGED
@@ -16,7 +16,8 @@ class AdTypeSelectorNavLink extends Component {
16
  All_ad_network: [
17
  {ad_type:'adsense',ad_type_name:'AdSense'},
18
  {ad_type:'double_click',ad_type_name:'Google Ad Manager'},
19
- {ad_type:'yandex',ad_type_name:'Yandex'},
 
20
  {ad_type:'plain_text',ad_type_name:'Plain Text / HTML / JS'},
21
  {ad_type:'random_ads',ad_type_name:'Random Ads'},
22
 
@@ -44,6 +45,9 @@ class AdTypeSelectorNavLink extends Component {
44
  case 'yandex':
45
  img_url = quads_localize_data.quads_plugin_url+'admin/assets/js/src/images/yandex.png';
46
  break;
 
 
 
47
 
48
  default:
49
  break;
16
  All_ad_network: [
17
  {ad_type:'adsense',ad_type_name:'AdSense'},
18
  {ad_type:'double_click',ad_type_name:'Google Ad Manager'},
19
+ {ad_type:'yandex',ad_type_name:'Yandex'},
20
+ {ad_type:'mgid',ad_type_name:'MGID'},
21
  {ad_type:'plain_text',ad_type_name:'Plain Text / HTML / JS'},
22
  {ad_type:'random_ads',ad_type_name:'Random Ads'},
23
 
45
  case 'yandex':
46
  img_url = quads_localize_data.quads_plugin_url+'admin/assets/js/src/images/yandex.png';
47
  break;
48
+ case 'mgid':
49
+ img_url = quads_localize_data.quads_plugin_url+'admin/assets/js/src/images/mgid.png';
50
+ break;
51
 
52
  default:
53
  break;
admin/assets/js/src/components/ads/config-fields/QuadsAdConfigFields.jsx CHANGED
@@ -131,10 +131,10 @@ removeSeleted = (e) => {
131
  comp_html.push(<div key="adsense">
132
  <table>
133
  <tbody>
134
- <tr><td><label>{__('Data Client ID', 'quick-adsense-reloaded')}</label></td><td><input className={(show_form_error && post_meta.g_data_ad_client == '') ? 'quads_form_error' : ''} value={post_meta.g_data_ad_client} onChange={this.props.adFormChangeHandler} type="text" id="g_data_ad_client" name="g_data_ad_client" />
135
  {(show_form_error && post_meta.g_data_ad_client == '') ? <div className="quads_form_msg"><span className="material-icons">
136
  error_outline</span>Enter Data Client ID</div> :''} </td></tr>
137
- <tr><td><label>{__('Data Slot ID', 'quick-adsense-reloaded')}</label></td><td><input className={(show_form_error && post_meta.g_data_ad_slot == '') ? 'quads_form_error' : ''} value={post_meta.g_data_ad_slot} onChange={this.props.adFormChangeHandler} type="text" id="g_data_ad_slot" name="g_data_ad_slot" />
138
  {(show_form_error && post_meta.g_data_ad_slot == '') ? <div className="quads_form_msg"><span className="material-icons">
139
  error_outline
140
  </span>Enter Data Slot ID</div> :''}</td></tr>
@@ -282,6 +282,61 @@ error_outline
282
  </div>);
283
 
284
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
285
 
286
  default:
287
  comp_html.push(<div key="noads" >{__('Ad not found', 'quick-adsense-reloaded')}</div>);
131
  comp_html.push(<div key="adsense">
132
  <table>
133
  <tbody>
134
+ <tr><td><label>{__('Data Client ID', 'quick-adsense-reloaded')}</label></td><td><input className={(show_form_error && post_meta.g_data_ad_client == '') ? 'quads_form_error' : ''} value={post_meta.g_data_ad_client} placeholder="ca-pub-2005XXXXXXXXX342" onChange={this.props.adFormChangeHandler} type="text" id="g_data_ad_client" name="g_data_ad_client" />
135
  {(show_form_error && post_meta.g_data_ad_client == '') ? <div className="quads_form_msg"><span className="material-icons">
136
  error_outline</span>Enter Data Client ID</div> :''} </td></tr>
137
+ <tr><td><label>{__('Data Slot ID', 'quick-adsense-reloaded')}</label></td><td><input className={(show_form_error && post_meta.g_data_ad_slot == '') ? 'quads_form_error' : ''} value={post_meta.g_data_ad_slot} onChange={this.props.adFormChangeHandler} type="text" id="g_data_ad_slot" name="g_data_ad_slot" placeholder="70XXXXXX12" />
138
  {(show_form_error && post_meta.g_data_ad_slot == '') ? <div className="quads_form_msg"><span className="material-icons">
139
  error_outline
140
  </span>Enter Data Slot ID</div> :''}</td></tr>
282
  </div>);
283
 
284
  break;
285
+ case 'mgid':
286
+ ad_type_name = 'MGID';
287
+ comp_html.push(<div key="mgid">
288
+ <table>
289
+ <tbody>
290
+ <tr><td>
291
+ <label>{__('Data Publisher', 'quick-adsense-reloaded')}</label></td><td><input className={(show_form_error && post_meta.data_publisher == '') ? 'quads_form_error' : ''} value={post_meta.data_publisher} onChange={this.props.adFormChangeHandler} type="text" id="data_publisher" name="data_publisher" placeholder="site.com" />
292
+ {(show_form_error && post_meta.data_publisher == '') ? <div className="quads_form_msg"><span className="material-icons">
293
+ error_outline</span>Data Publisher</div> :''}
294
+ </td></tr>
295
+ <tr><td>
296
+ <label>{__('Data Widget', 'quick-adsense-reloaded')}</label></td><td><input className={(show_form_error && post_meta.data_widget == '') ? 'quads_form_error' : ''} value={post_meta.data_widget} onChange={this.props.adFormChangeHandler} type="text" id="data_widget" name="data_widget" placeholder="123456" />
297
+ {(show_form_error && post_meta.data_widget == '') ? <div className="quads_form_msg"><span className="material-icons">
298
+ error_outline</span>Enter Data Widget</div> :''}
299
+ </td></tr>
300
+ <tr><td>
301
+ <label>{__('Data Container', 'quick-adsense-reloaded')}</label></td><td><input className={(show_form_error && post_meta.data_container == '') ? 'quads_form_error' : ''} value={post_meta.data_container} onChange={this.props.adFormChangeHandler} type="text" id="data_container" name="data_container" placeholder="M87ScriptRootC123645" />
302
+ {(show_form_error && post_meta.data_container == '') ? <div className="quads_form_msg"><span className="material-icons">
303
+ error_outline</span>Enter Data Container</div> :''}
304
+ </td></tr>
305
+ <tr><td>
306
+ <label>{__('Data Js Src', 'quick-adsense-reloaded')}</label></td><td><input className={(show_form_error && post_meta.data_js_src == '') ? 'quads_form_error' : ''} value={post_meta.data_js_src} onChange={this.props.adFormChangeHandler} type="text" id="data_js_src" name="data_js_src" placeholder="//jsc.mgid.com/a/m/quads.com.123645.js" />
307
+ {(show_form_error && post_meta.data_js_src == '') ? <div className="quads_form_msg"><span className="material-icons">
308
+ error_outline</span>Enter Data Js Src</div> :''}
309
+ </td></tr>
310
+ <tr><td><label>{__('Size', 'quick-adsense-reloaded')}</label></td><td>
311
+ <div>
312
+ <select value={post_meta.adsense_type} onChange={this.props.adFormChangeHandler} name="adsense_type" id="adsense_type">
313
+ <option value="normal">{__('Fixed Size', 'quick-adsense-reloaded')}</option>
314
+ <option value="responsive">{__('Responsive', 'quick-adsense-reloaded')}</option>
315
+ </select>
316
+ {
317
+ post_meta.adsense_type !== 'responsive' ?
318
+ <div className="quads-adsense-width-heigth">
319
+
320
+ <div className="quads-adsense-width">
321
+ <label>{__('Width', 'quick-adsense-reloaded')}
322
+ <input value={post_meta.g_data_ad_width ? post_meta.g_data_ad_width:'300'} onChange={this.props.adFormChangeHandler} type="number" id="g_data_ad_width" name="g_data_ad_width" />
323
+ </label>
324
+ </div>
325
+ <div className="quads-adsense-height">
326
+ <label>{__('Height', 'quick-adsense-reloaded')}
327
+ <input value={post_meta.g_data_ad_height ? post_meta.g_data_ad_height:'250'} onChange={this.props.adFormChangeHandler} type="number" id="g_data_ad_height" name="g_data_ad_height" />
328
+ </label>
329
+ </div>
330
+ </div>
331
+ : ''
332
+ }
333
+ </div>
334
+ </td></tr>
335
+ </tbody>
336
+ </table>
337
+ </div>);
338
+
339
+ break;
340
 
341
  default:
342
  comp_html.push(<div key="noads" >{__('Ad not found', 'quick-adsense-reloaded')}</div>);
admin/assets/js/src/components/ads/nav/QuadsAdListNavLink.jsx CHANGED
@@ -29,9 +29,15 @@ class QuadsAdListNavLink extends Component {
29
 
30
  if(typeof(page.path) != 'undefined' ) {
31
 
32
- if( page.path == 'settings' || page.path == 'settings_tools' || page.path == 'settings_legacy' || page.path == 'settings_support' || page.path == 'settings_licenses' || page.path == 'settings_google_autoads')
 
 
33
  current = 'settings';
34
- }
 
 
 
 
35
  return(
36
  <div className="quads-ad-tab-wrapper">
37
  <div className="quads-hidden-element">
29
 
30
  if(typeof(page.path) != 'undefined' ) {
31
 
32
+ if( page.path == 'settings' || page.path == 'settings_tools' || page.path == 'settings_importer' || page.path == 'settings_legacy' || page.path == 'settings_support' || page.path == 'settings_licenses' || page.path == 'settings_google_autoads') {
33
+ jQuery('.wp-submenu li').removeClass('current');
34
+ jQuery('a[href$="quads-settings&path=settings"]').parent().addClass('current');
35
  current = 'settings';
36
+ }
37
+ }else if(page.page == 'quads-settings'){
38
+ jQuery('.wp-submenu li').removeClass('current');
39
+ jQuery('a[href$="quads-settings"]').parent().addClass('current');
40
+ }
41
  return(
42
  <div className="quads-ad-tab-wrapper">
43
  <div className="quads-hidden-element">
admin/assets/js/src/components/common/advance-position/QuadsAdvancePosition.jsx CHANGED
@@ -31,7 +31,9 @@ class QuadsAdvancePosition extends Component {
31
  <option value="before_last_paragraph">{__('Right before the last Paragraph', 'quick-adsense-reloaded')}</option>
32
  <option value="after_paragraph">{__('After Paragraph', 'quick-adsense-reloaded')}</option>
33
  <option value="after_image">{__('After Image', 'quick-adsense-reloaded')}</option>
34
- <option value="ad_shortcode">{__('Shortcode (Manual)', 'quick-adsense-reloaded')}</option>
 
 
35
  </optgroup>
36
 
37
  <optgroup label="Partial Support ( AMP Only )">
@@ -57,6 +59,9 @@ class QuadsAdvancePosition extends Component {
57
  <option value="before_last_paragraph">{__('Right before the last Paragraph', 'quick-adsense-reloaded')}</option>
58
  <option value="after_paragraph">{__('After Paragraph', 'quick-adsense-reloaded')}</option>
59
  <option value="after_image">{__('After Image', 'quick-adsense-reloaded')}</option>
 
 
 
60
  <option value="ad_shortcode">{__('Shortcode (Manual)', 'quick-adsense-reloaded')}</option>
61
  </select> }
62
  <div>{ (show_form_error && post_meta.position == '') ? <span className="quads-error"><div className="quads_form_msg"><span className="material-icons">error_outline</span>Select Where Will The AD Appear</div></span> : ''}</div>
@@ -84,6 +89,22 @@ class QuadsAdvancePosition extends Component {
84
 
85
  </div></div> : ''}
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  {post_meta.position == 'after_image' ?
88
  <label>
89
  <input checked={post_meta.image_caption} name="image_caption" onChange={this.props.adFormChangeHandler} type="checkbox"/>
31
  <option value="before_last_paragraph">{__('Right before the last Paragraph', 'quick-adsense-reloaded')}</option>
32
  <option value="after_paragraph">{__('After Paragraph', 'quick-adsense-reloaded')}</option>
33
  <option value="after_image">{__('After Image', 'quick-adsense-reloaded')}</option>
34
+ <option value="after_word_count">{__('By Word Count', 'quick-adsense-reloaded')}</option>
35
+ <option value="after_the_percentage">{__('After the Percentage', 'quick-adsense-reloaded')}</option>
36
+ <option value="ad_shortcode">{__('Shortcode (Manual)', 'quick-adsense-reloaded')}</option>
37
  </optgroup>
38
 
39
  <optgroup label="Partial Support ( AMP Only )">
59
  <option value="before_last_paragraph">{__('Right before the last Paragraph', 'quick-adsense-reloaded')}</option>
60
  <option value="after_paragraph">{__('After Paragraph', 'quick-adsense-reloaded')}</option>
61
  <option value="after_image">{__('After Image', 'quick-adsense-reloaded')}</option>
62
+ <option value="after_word_count">{__('By Word Count', 'quick-adsense-reloaded')}</option>
63
+ <option value="after_the_percentage">{__('After the Percentage', 'quick-adsense-reloaded')}</option>
64
+
65
  <option value="ad_shortcode">{__('Shortcode (Manual)', 'quick-adsense-reloaded')}</option>
66
  </select> }
67
  <div>{ (show_form_error && post_meta.position == '') ? <span className="quads-error"><div className="quads_form_msg"><span className="material-icons">error_outline</span>Select Where Will The AD Appear</div></span> : ''}</div>
89
 
90
  </div></div> : ''}
91
 
92
+ {post_meta.position == 'after_word_count' ?
93
+ <div>
94
+ <label>
95
+ <input min="1" onChange={this.props.adFormChangeHandler} name="word_count_number" value={post_meta.word_count_number} type="number" />
96
+ </label>
97
+ </div> : ''}
98
+ {post_meta.position == 'after_the_percentage' ?
99
+ <div>
100
+ <label>
101
+ <input min="1" onChange={this.props.adFormChangeHandler} name="after_the_percentage_value" value={post_meta.after_the_percentage_value} type="number" /> %
102
+ </label>
103
+ </div> : ''}
104
+ {(show_form_error && post_meta.position == 'after_the_percentage' && (post_meta.g_data_ad_client == '' || parseInt(quads_post_meta.after_the_percentage_value) < 10 || parseInt(quads_post_meta.after_the_percentage_value) > 101)) ? <div className="quads_form_msg"><span className="material-icons">
105
+ error_outline</span>Percentage should be
106
+ between 10 to 100</div> :''}
107
+
108
  {post_meta.position == 'after_image' ?
109
  <label>
110
  <input checked={post_meta.image_caption} name="image_caption" onChange={this.props.adFormChangeHandler} type="checkbox"/>
admin/assets/js/src/components/common/advance-position/QuadsAdvancePosition.scss CHANGED
@@ -27,4 +27,7 @@ and open the template in the editor.
27
  }
28
  #repeat_paragraph+label {
29
  text-transform: none;
 
 
 
30
  }
27
  }
28
  #repeat_paragraph+label {
29
  text-transform: none;
30
+ }
31
+ .quads-settings-group .quads-tr-position .quads-position-dropdown select{
32
+ width: 311px
33
  }
admin/assets/js/src/components/common/layout/QuadsLayout.jsx CHANGED
@@ -41,6 +41,14 @@ class QuadsLayout extends Component {
41
  </td>
42
  </tr>
43
  {post_meta.ad_label_check ?
 
 
 
 
 
 
 
 
44
  <tr>
45
  <td><label>{__('Ad Label Position', 'quick-adsense-reloaded')}</label></td>
46
  <td>
@@ -51,14 +59,7 @@ class QuadsLayout extends Component {
51
  </td>
52
  </tr>
53
  : null }
54
- {post_meta.ad_label_check ?
55
- <tr>
56
- <td><label>{__('Ad Label Text', 'quick-adsense-reloaded')}</label></td>
57
- <td>
58
- <input onChange={this.props.adFormChangeHandler} type="text" className="small-text" id="ad_label_text" name="ad_label_text" value={post_meta.ad_label_text}/>
59
- </td>
60
- </tr>
61
- : null }
62
  </tbody>
63
  </table>
64
  </div>
41
  </td>
42
  </tr>
43
  {post_meta.ad_label_check ?
44
+ <tr>
45
+ <td><label>{__('Ad Label Text', 'quick-adsense-reloaded')}</label></td>
46
+ <td>
47
+ <input onChange={this.props.adFormChangeHandler} type="text" className="small-text" id="ad_label_text" name="ad_label_text" value={post_meta.ad_label_text}/>
48
+ </td>
49
+ </tr>
50
+ : null }
51
+ {post_meta.ad_label_check ?
52
  <tr>
53
  <td><label>{__('Ad Label Position', 'quick-adsense-reloaded')}</label></td>
54
  <td>
59
  </td>
60
  </tr>
61
  : null }
62
+
 
 
 
 
 
 
 
63
  </tbody>
64
  </table>
65
  </div>
admin/assets/js/src/components/common/visibility/QuadsVisibility.jsx CHANGED
@@ -32,7 +32,8 @@ class QuadsVisibility extends Component {
32
  {label:'Post Format', value:'post_format'},
33
  {label:'Page', value:'page'},
34
  {label:'Taxonomy Terms', value:'taxonomy'},
35
- {label:'Tags', value:'tags'}
 
36
  ]
37
  };
38
  }
32
  {label:'Post Format', value:'post_format'},
33
  {label:'Page', value:'page'},
34
  {label:'Taxonomy Terms', value:'taxonomy'},
35
+ {label:'Tags', value:'tags'},
36
+ {label:'Page Template', value:'page_template'}
37
  ]
38
  };
39
  }
admin/assets/js/src/components/settings/QuadsAdListSettings.jsx CHANGED
@@ -51,14 +51,42 @@ class QuadsAdListSettings extends Component {
51
  multiTagsValue : [],
52
  multiPluginsValue : []
53
  },
54
- quads_wp_quads_pro_license_key : '',
 
 
55
  };
56
  }
57
  handleCopy = () => {
58
  copy(this.state.textToCopy);
59
  this.setState({ copied: true });
60
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
 
 
62
  open_global_excluder = () => {
63
  this.setState({global_excluder_modal:true});
64
  }
@@ -244,7 +272,7 @@ handleMultiPluginsChange = (option) => {
244
 
245
  }
246
  closeQuerySuccess = (e) => {
247
- this.setState({customer_querey_success: ''});
248
  }
249
  closeQueryError = (e) => {
250
  this.setState({customer_querey_error: ''});
@@ -738,7 +766,7 @@ handleMultiPluginsChange = (option) => {
738
  <span className="quads-slider"></span>
739
  </label>
740
 
741
- {/* {this.state.adsTxtEnabled ? <span onClick={this.open_ad_text_modal} className="quads-generic-icon dashicons dashicons-admin-generic"></span> : ''} */}
742
  </td>
743
  </tr>
744
  {
@@ -811,19 +839,30 @@ handleMultiPluginsChange = (option) => {
811
  <a href={`${quads_localize_data.rest_url}quads-route/export-settings`} className="quads-btn quads-btn-primary">Export</a>
812
  <p>{__('Export the Quick AdSense Reloaded settings for this site as a .json file. This allows you to easily import the configuration into another site.', 'quick-adsense-reloaded')}</p>
813
  </td>
814
- </tr>
815
- <tr>
816
- <th><label>{__('Import', 'quick-adsense-reloaded')}</label></th>
 
 
 
 
 
 
 
 
 
817
  <td>
818
- <input type="file" name="import_file" onChange={this.formChangeHandler}/>
819
- <p>{__('Import the Quick AdSense Reloaded settings from a .json file. This file can be obtained by exporting the settings on another site using the form above.', 'quick-adsense-reloaded')}</p>
 
820
  </td>
821
- </tr>
822
  </tbody>
823
  </table>
824
 
825
  </div>
826
- );
 
827
  case "settings_google_autoads": return(
828
  <div className="quads-settings-tab-container">
829
  <div className="quads-help-support">
51
  multiTagsValue : [],
52
  multiPluginsValue : []
53
  },
54
+ quads_wp_quads_pro_license_key : '',
55
+ importampforwpmsg : "",
56
+ importampforwpmsgprocessing : "",
57
  };
58
  }
59
  handleCopy = () => {
60
  copy(this.state.textToCopy);
61
  this.setState({ copied: true });
62
  }
63
+ importampforwpdata = () => {
64
+ if(this.state.importampforwpmsgprocessing !=''){
65
+ return;
66
+ }
67
+ this.setState({importampforwpmsgprocessing: 'Importing Ads'});
68
+ const url = quads_localize_data.rest_url + 'quads-route/import-ampforwp-ads';
69
+ fetch(url,{
70
+ method: "post",
71
+ headers: {
72
+ 'Accept': 'application/json',
73
+ 'Content-Type': 'application/json',
74
+ 'X-WP-Nonce': quads_localize_data.nonce,
75
+ }
76
+ })
77
+ .then(res => res.json())
78
+ .then(
79
+ (result) => {
80
+ if(result.status === 't'){
81
+ this.setState({importampforwpmsg: result.data,importampforwpmsgprocessing:''});
82
+ }
83
+ },
84
+ (error) => {
85
+
86
+ }
87
+ );
88
 
89
+ }
90
  open_global_excluder = () => {
91
  this.setState({global_excluder_modal:true});
92
  }
272
 
273
  }
274
  closeQuerySuccess = (e) => {
275
+ this.setState({customer_querey_success: '',importampforwpmsg: ''});
276
  }
277
  closeQueryError = (e) => {
278
  this.setState({customer_querey_error: ''});
766
  <span className="quads-slider"></span>
767
  </label>
768
 
769
+ {this.state.adsTxtEnabled ? <span onClick={this.open_ad_text_modal} className="quads-generic-icon dashicons dashicons-admin-generic"></span> : ''}
770
  </td>
771
  </tr>
772
  {
839
  <a href={`${quads_localize_data.rest_url}quads-route/export-settings`} className="quads-btn quads-btn-primary">Export</a>
840
  <p>{__('Export the Quick AdSense Reloaded settings for this site as a .json file. This allows you to easily import the configuration into another site.', 'quick-adsense-reloaded')}</p>
841
  </td>
842
+ </tr>
843
+ </tbody>
844
+ </table>
845
+
846
+ </div>
847
+ );
848
+ case "settings_importer": return(
849
+ <div className="quads-settings-tab-container">
850
+ <table className="form-table" role="presentation">
851
+ <tbody>
852
+ <tr>
853
+ <th><label>{__('AMP for WP Ads', 'quick-adsense-reloaded')}</label></th>
854
  <td>
855
+ <a className="quads-btn quads-btn-primary" id="import_amp_for_wp" onClick={this.importampforwpdata}>{__('Import', 'quick-adsense-reloaded')}</a>
856
+ {this.state.importampforwpmsg ? <Alert severity="success" action={<Icon onClick={this.closeQuerySuccess}>close</Icon>}>{this.state.importampforwpmsg}</Alert> : null}
857
+ {this.state.importampforwpmsgprocessing ? <div className='updating-message importampforwpmsgprocessing'><p>Importing Ads</p></div>: ''}
858
  </td>
859
+ </tr>
860
  </tbody>
861
  </table>
862
 
863
  </div>
864
+
865
+ );
866
  case "settings_google_autoads": return(
867
  <div className="quads-settings-tab-container">
868
  <div className="quads-help-support">
admin/assets/js/src/components/settings/QuadsAdListSettings.scss CHANGED
@@ -108,4 +108,9 @@ a.quads-nav-link-active {
108
  }
109
  .quads-save-settings{
110
  padding: 25px;
 
 
 
 
 
111
  }
108
  }
109
  .quads-save-settings{
110
  padding: 25px;
111
+ }
112
+ .importampforwpmsgprocessing{
113
+ background-color: rgb(237, 247, 237);
114
+ padding: 6px 16px;
115
+ font-size: 0.875rem;
116
  }
admin/assets/js/src/components/settings/QuadsAdSettingsNavLink.jsx CHANGED
@@ -28,6 +28,7 @@ class QuadsAdSettingsNavLink extends Component {
28
  <li><h2><Link to={'admin.php?page=quads-settings&path=settings'} className={current == 'settings' ? 'quads-nav-link quads-nav-link-active' : 'quads-nav-link'}>{__('Features', 'quick-adsense-reloaded')}</Link></h2></li>
29
  {/* <li><h2><Link to={'admin.php?page=quads-settings&path=main_settings_importer'} className="quads-nav-link">{__('Migrator', 'quick-adsense-reloaded')}</Link></h2></li> */}
30
  <li><h2><Link to={'admin.php?page=quads-settings&path=settings_tools'} className={current == 'settings_tools' ? 'quads-nav-link quads-nav-link-active' : 'quads-nav-link'}>{__('Tools', 'quick-adsense-reloaded')}</Link></h2></li>
 
31
  <li><h2><Link to={'admin.php?page=quads-settings&path=settings_legacy'} className={current == 'settings_legacy' ? 'quads-nav-link quads-nav-link-active' : 'quads-nav-link'}>{__('Legacy', 'quick-adsense-reloaded')}</Link></h2></li>
32
  <li><h2><Link to={'admin.php?page=quads-settings&path=settings_support'} className={current == 'settings_support' ? 'quads-nav-link quads-nav-link-active' : 'quads-nav-link'}>{__('Help & Support', 'quick-adsense-reloaded')}</Link></h2></li>
33
  {quads_localize_data.is_pro ?
28
  <li><h2><Link to={'admin.php?page=quads-settings&path=settings'} className={current == 'settings' ? 'quads-nav-link quads-nav-link-active' : 'quads-nav-link'}>{__('Features', 'quick-adsense-reloaded')}</Link></h2></li>
29
  {/* <li><h2><Link to={'admin.php?page=quads-settings&path=main_settings_importer'} className="quads-nav-link">{__('Migrator', 'quick-adsense-reloaded')}</Link></h2></li> */}
30
  <li><h2><Link to={'admin.php?page=quads-settings&path=settings_tools'} className={current == 'settings_tools' ? 'quads-nav-link quads-nav-link-active' : 'quads-nav-link'}>{__('Tools', 'quick-adsense-reloaded')}</Link></h2></li>
31
+ <li><h2><Link to={'admin.php?page=quads-settings&path=settings_importer'} className={current == 'settings_importer' ? 'quads-nav-link quads-nav-link-active' : 'quads-nav-link'}>{__('Importer', 'quick-adsense-reloaded')}</Link></h2></li>
32
  <li><h2><Link to={'admin.php?page=quads-settings&path=settings_legacy'} className={current == 'settings_legacy' ? 'quads-nav-link quads-nav-link-active' : 'quads-nav-link'}>{__('Legacy', 'quick-adsense-reloaded')}</Link></h2></li>
33
  <li><h2><Link to={'admin.php?page=quads-settings&path=settings_support'} className={current == 'settings_support' ? 'quads-nav-link quads-nav-link-active' : 'quads-nav-link'}>{__('Help & Support', 'quick-adsense-reloaded')}</Link></h2></li>
34
  {quads_localize_data.is_pro ?
admin/assets/js/src/images/mgid.png ADDED
Binary file
admin/assets/js/src/images/mgid_icon.png ADDED
Binary file
admin/includes/rest-api-service.php CHANGED
@@ -47,13 +47,13 @@ class QUADS_Ad_Setup_Api_Service {
47
 
48
  $choices[] = array('label' => 'Default Template', 'value' => 'default');
49
 
50
- $templates = get_page_templates();
51
 
52
  if($templates){
53
 
54
  foreach($templates as $k => $v){
55
 
56
- $choices[] = array('label' => $k, 'value' => $v);
57
 
58
  }
59
 
@@ -344,7 +344,8 @@ class QUADS_Ad_Setup_Api_Service {
344
  $response = array();
345
  if(count($this->amp_front_loop)==0){
346
  $query_data = get_posts($arg);
347
- $post_meta = array();
 
348
  foreach ($query_data as $key => $value) {
349
  $data = array();
350
  $data['post_id'] = $value->ID;
@@ -384,7 +385,16 @@ class QUADS_Ad_Setup_Api_Service {
384
 
385
  if($key == 'QckTags'){
386
  $quads_options['quicktags'] = array($key => $val);
387
- } else{
 
 
 
 
 
 
 
 
 
388
  $quads_options[$key] = $val;
389
  }
390
 
47
 
48
  $choices[] = array('label' => 'Default Template', 'value' => 'default');
49
 
50
+ $templates = wp_get_theme()->get_page_templates();
51
 
52
  if($templates){
53
 
54
  foreach($templates as $k => $v){
55
 
56
+ $choices[] = array('label' => $v, 'value' => $k);
57
 
58
  }
59
 
344
  $response = array();
345
  if(count($this->amp_front_loop)==0){
346
  $query_data = get_posts($arg);
347
+ $post_meta = array();
348
+ $posts_data = array();
349
  foreach ($query_data as $key => $value) {
350
  $data = array();
351
  $data['post_id'] = $value->ID;
385
 
386
  if($key == 'QckTags'){
387
  $quads_options['quicktags'] = array($key => $val);
388
+ }else if($key == 'adsTxtText' ){
389
+ if($parameters['adsTxtEnabled']){
390
+ if (false !== file_put_contents(ABSPATH . 'ads.txt', $val)) {
391
+ // show notice that ads.txt has been created
392
+ set_transient('quads_vi_ads_txt_notice', true, 300);
393
+ }else{
394
+ set_transient('quads_vi_ads_txt_error', true, 300);
395
+ }
396
+ }
397
+ } else{
398
  $quads_options[$key] = $val;
399
  }
400
 
admin/includes/rest-api.php CHANGED
@@ -144,8 +144,567 @@ class QUADS_Ad_Setup_Api {
144
  return current_user_can( 'manage_options' );
145
  }
146
  ));
 
 
 
 
 
 
 
147
 
148
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  public function quadsSubscribeNewsletter($request){
150
  $parameters = $request->get_params();
151
  $api_url = 'http://magazine3.company/wp-json/api/central/email/subscribe';
@@ -371,6 +930,7 @@ class QUADS_Ad_Setup_Api {
371
  $add = array('none' => 'Exclude nothing');
372
  $quads_settings['auto_ads_get_post_types'] = $add + $post_types;
373
  $quads_settings['autoads_excl_user_roles'] = array_merge(array('none' => 'Exclude nothing'), $this->quads_get_user_roles_api());
 
374
  return $quads_settings;
375
  }
376
  public function getConditionList($request_data){
144
  return current_user_can( 'manage_options' );
145
  }
146
  ));
147
+ register_rest_route( 'quads-route', 'import-ampforwp-ads', array(
148
+ 'methods' => 'POST',
149
+ 'callback' => array($this, 'importampforwp_ads'),
150
+ 'permission_callback' => function(){
151
+ return current_user_can( 'manage_options' );
152
+ }
153
+ ));
154
 
155
  }
156
+ /** Here we are importing AMP for WP and advance Amp ads to Quads**/
157
+ public function importampforwp_ads(){
158
+ global $redux_builder_amp;
159
+ $args = array(
160
+ 'post_type' => 'quads-ads'
161
+ );
162
+ $the_query = new WP_Query( $args );
163
+ $ad_count = $the_query->found_posts;
164
+ $post_status = 'publish';
165
+ $amp_options = get_option('redux_builder_amp');
166
+ $user_id = get_current_user_id();
167
+ $after_the_percentage_value = '';
168
+
169
+ for($i=1; $i<=6; $i++){
170
+ if($amp_options['enable-amp-ads-'.$i] != 1){
171
+ continue;
172
+ }
173
+ $ad_type = $amp_options['enable-amp-ads-type-'.$i];
174
+ if(($ad_type== 'adsense' && (empty($amp_options['enable-amp-ads-text-feild-client-'.$i]) || empty($amp_options['enable-amp-ads-text-feild-slot-'.$i]))) || ($ad_type== 'mgid' && (empty($amp_options['enable-amp-ads-mgid-field-data-pub-'.$i]) || empty($amp_options['enable-amp-ads-mgid-field-data-widget-'.$i])))){
175
+ continue;
176
+ }
177
+ $ad_count++;
178
+ switch ($i) {
179
+ case 1:
180
+ $position = 'amp_below_the_header';
181
+ break;
182
+ case 2:
183
+ $position = 'amp_below_the_footer';
184
+ break;
185
+ case 3:
186
+ $position = 'amp_above_the_post_content';
187
+ break;
188
+ case 4:
189
+ $position = 'amp_below_the_post_content';
190
+ break;
191
+ case 5:
192
+ $position = 'amp_below_the_title';
193
+ break;
194
+ case 6:
195
+ $position = 'amp_above_related_post';
196
+ break;
197
+ }
198
+ switch ($amp_options['enable-amp-ads-select-'.$i]) {
199
+ case '1':
200
+ $g_data_ad_width = '300';
201
+ $g_data_ad_height = '250';
202
+ break;
203
+ case '2':
204
+ $g_data_ad_width = '336';
205
+ $g_data_ad_height = '280';
206
+ break;
207
+ case '3':
208
+ $g_data_ad_width = '728';
209
+ $g_data_ad_height = '90';
210
+ break;
211
+ case '4':
212
+ $g_data_ad_width = '300';
213
+ $g_data_ad_height = '600';
214
+ break;
215
+ case '5':
216
+ $g_data_ad_width = '320';
217
+ $g_data_ad_height = '100';
218
+ break;
219
+ case '6':
220
+ $g_data_ad_width = '200';
221
+ $g_data_ad_height = '50';
222
+ break;
223
+ case '7':
224
+ $g_data_ad_width = '320';
225
+ $g_data_ad_height = '50';
226
+ break;
227
+ default:
228
+ $g_data_ad_width = '300';
229
+ $g_data_ad_height= '250';
230
+ break;
231
+ }
232
+ if($ad_type== 'mgid'){
233
+ if($i == 2){
234
+ $position = 'ad_shortcode';
235
+ }
236
+ $post_title ='MGID Ad '.$i.' (Migrated from AMP)';
237
+ $g_data_ad_width = $amp_options['enable-amp-ads-mgid-width-'.$i];
238
+ $g_data_ad_height= $amp_options['enable-amp-ads-mgid-height-'.$i];
239
+ }else{
240
+ $post_title ='Adsense Ad '.$i.' (Migrated from AMP)';
241
+ }
242
+ $ads_post = array(
243
+ 'post_author' => $user_id,
244
+ 'post_title' => $post_title,
245
+ 'post_status' => $post_status,
246
+ 'post_name' => $post_title,
247
+ 'post_type' => 'quads-ads',
248
+
249
+ );
250
+ if($amp_options['enable-amp-ads-resp-'.$i]){
251
+ $adsense_type = 'responsive';
252
+ }else{
253
+ $adsense_type = 'normal';
254
+ }
255
+ $post_id = wp_insert_post($ads_post);
256
+ $visibility_include =array();
257
+ if($i == 3){
258
+ $display_on = $amp_options['made-amp-ad-3-global'];
259
+ $j =0;
260
+ foreach ($display_on as $display_on_data) {
261
+ switch ($display_on_data) {
262
+ case '1':
263
+ $visibility_include[$j]['type']['label'] = 'Post Type';
264
+ $visibility_include[$j]['type']['value'] = 'post_type';
265
+ $visibility_include[$j]['value']['label'] = "post";
266
+ $visibility_include[$j]['value']['value'] = "post";
267
+ $j++;
268
+ break;
269
+ case '2':
270
+ $visibility_include[$j]['type']['label'] = 'Post Type';
271
+ $visibility_include[$j]['type']['value'] = 'post_type';
272
+ $visibility_include[$j]['value']['label'] = "page";
273
+ $visibility_include[$j]['value']['value'] = "page";
274
+ $j++;
275
+ break;
276
+ case '4':
277
+ $visibility_include[$j]['type']['label'] = 'General';
278
+ $visibility_include[$j]['type']['value'] = 'general';
279
+ $visibility_include[$j]['value']['label'] = "Show Globally";
280
+ $visibility_include[$j]['value']['value'] = "show_globally";
281
+ $j++;
282
+ break;
283
+ }
284
+ }
285
+ }else{
286
+ $visibility_include[0]['type']['label'] = 'General';
287
+ $visibility_include[0]['type']['value'] = 'general';
288
+ $visibility_include[0]['value']['label'] = "Show Globally";
289
+ $visibility_include[0]['value']['value'] = "show_globally";
290
+ }
291
+
292
+ $adforwp_meta_key = array(
293
+ 'ad_type' => $ad_type ,
294
+ 'g_data_ad_client' => $amp_options['enable-amp-ads-text-feild-client-'.$i],
295
+ 'g_data_ad_slot' => $amp_options['enable-amp-ads-text-feild-slot-'.$i],
296
+ 'data_publisher' => $amp_options['enable-amp-ads-mgid-field-data-pub-'.$i],
297
+ 'data_widget' => $amp_options['enable-amp-ads-mgid-field-data-widget-'.$i],
298
+ 'data_container' => $amp_options['enable-amp-ads-mgid-field-data-con-'.$i],
299
+ 'g_data_ad_width' => $g_data_ad_width,
300
+ 'g_data_ad_height' => $g_data_ad_height,
301
+ 'adsense_type' => $adsense_type,
302
+ 'enabled_on_amp' => 1,
303
+ 'visibility_include' => $visibility_include,
304
+ 'position' => $position,
305
+ 'imported_from' => 'ampforwp_ads',
306
+ 'label' => $post_title,
307
+ 'ad_id' => $post_id,
308
+ 'code' => '',
309
+ 'enable_one_end_of_post' =>'',
310
+ 'quads_ad_old_id' => 'ad'.$ad_count,
311
+ 'ad_label_check' => $amp_options['ampforwp-ads-sponsorship'],
312
+ 'ad_label_text' => $amp_options['ampforwp-ads-sponsorship-label'],
313
+ );
314
+
315
+ foreach ($adforwp_meta_key as $key => $val){
316
+ update_post_meta($post_id, $key, $val);
317
+ }
318
+ }
319
+ if ( defined( 'ADVANCED_AMP_ADS_VERSION' ) ) {
320
+ // Incontent Ads
321
+ for($i=1; $i<=6; $i++){
322
+ if($redux_builder_amp['ampforwp-incontent-ad-'.$i] != 1){
323
+ continue;
324
+ }
325
+ $ad_type = $redux_builder_amp['ampforwp-advertisement-type-incontent-ad-'.$i];
326
+ $ad_type_label = '';
327
+ if($ad_type== '4'){
328
+ continue;
329
+ }
330
+ if(($ad_type== '1' && (empty($redux_builder_amp['ampforwp-adsense-ad-data-ad-client-incontent-ad-'.$i]) || empty($redux_builder_amp['ampforwp-adsense-ad-data-ad-slot-incontent-ad-'.$i]))) || ($ad_type== '5' && (empty($redux_builder_amp['ampforwp-mgid-ad-Data-Publisher-incontent-ad-'.$i]) || empty($redux_builder_amp['ampforwp-mgid-ad-Data-Widget-incontent-ad-'.$i])))){
331
+ continue;
332
+ }
333
+ $ad_count++;
334
+ $g_data_ad_width = '';
335
+ $g_data_ad_height= '';
336
+ if($ad_type == '1'){
337
+ $ad_type_label = 'adsense';
338
+ $post_title = 'Adsense Ad '.$i.' Incontent Ad (Migrated from AMP)';
339
+ $g_data_ad_width = $redux_builder_amp['ampforwp-adsense-ad-width-incontent-ad-'.$i];
340
+ $g_data_ad_height = $redux_builder_amp['ampforwp-adsense-ad-height-incontent-ad-'.$i];
341
+ $position = $redux_builder_amp['ampforwp-adsense-ad-position-incontent-ad-'.$i];
342
+ }else if($ad_type == '2'){
343
+ $ad_type_label = 'double_click';
344
+ $post_title = 'DoubleClick Ad '.$i.' Incontent Ad (Migrated from AMP)';
345
+ $g_data_ad_width = $redux_builder_amp['ampforwp-doubleclick-ad-width-incontent-ad-'.$i];
346
+ $g_data_ad_height = $redux_builder_amp['ampforwp-doubleclick-ad-height-incontent-ad-'.$i];
347
+ $position = $redux_builder_amp['ampforwp-doubleclick-ad-position-incontent-ad-'.$i];
348
+ }else if($ad_type == '3'){
349
+ $ad_type_label = 'plain_text';
350
+ $post_title = 'Plain Text Ad '.$i.' Incontent Ad (Migrated from AMP)';
351
+ $position = $redux_builder_amp['ampforwp-custom-ads-ad-position-incontent-ad-'.$i];
352
+ }else if($ad_type == '5'){
353
+ $ad_type_label = 'mgid';
354
+ $post_title ='MGID Ad '.$i.' Incontent Ad (Migrated from AMP)';
355
+ $g_data_ad_width = $redux_builder_amp['ampforwp-mgid-ad-width-incontent-ad-'.$i];
356
+ $g_data_ad_height = $redux_builder_amp['ampforwp-mgid-ad-height-incontent-ad-'.$i];
357
+ $position = $redux_builder_amp['ampforwp-mgid-ad-position-incontent-ad-'.$i];
358
+ }
359
+ if($redux_builder_amp['adsense-rspv-ad-incontent-'.$i]){
360
+ $adsense_type = 'responsive';
361
+ }else{
362
+ $adsense_type = 'normal';
363
+ }
364
+ $ads_post = array(
365
+ 'post_author' => $user_id,
366
+ 'post_title' => $post_title,
367
+ 'post_status' => $post_status,
368
+ 'post_name' => $post_title,
369
+ 'post_type' => 'quads-ads',
370
+ );
371
+ $post_id = wp_insert_post($ads_post);
372
+ $visibility_include =array();
373
+
374
+ $visibility_include[0]['type']['label'] = 'Post Type';
375
+ $visibility_include[0]['type']['value'] = 'post_type';
376
+ $visibility_include[0]['value']['label'] = "post";
377
+ $visibility_include[0]['value']['value'] = "post";
378
+ $doubleclick_ad_data_slot = explode('/', $redux_builder_amp['ampforwp-doubleclick-ad-data-slot-incontent-ad-'.$i]);
379
+ $adlabel = 'above';
380
+ if($redux_builder_amp['ampforwp-ad-sponsorship-location'] == '2'){
381
+