ThemeGrill Demo Importer - Version 1.4.0

Version Description

  • 20/07/2017 =
  • Feature - Plugin installer and activator mechinism.
  • Fix - Call to undefined function preg_filter().
  • Dev - Improved file structure.
  • Dev - Introduced tg_demo_installer_enabled().
  • Dev - Introduced tg_demo_installer_preview().
  • Dev - Introduced tg_demo_preview_screenshot_url().

See changelog for all versions.

=

Download this release

Release Info

Developer ThemeGrill
Plugin Icon 128x128 ThemeGrill Demo Importer
Version 1.4.0
Comparing to
See all releases

Code changes from version 1.3.4 to 1.4.0

Files changed (48) hide show
  1. .stylelintrc +0 -59
  2. .wordpress-org/banner-772x250.jpg +0 -0
  3. CHANGELOG.txt +0 -31
  4. CODE_OF_CONDUCT.md +0 -46
  5. assets/css/demo-importer-rtl.css +1 -1
  6. assets/css/demo-importer.css +1 -1
  7. assets/css/demo-importer.scss +63 -30
  8. assets/images/flash/flash-construction-v2.jpg +0 -0
  9. assets/images/flash/flash-construction.jpg +0 -0
  10. assets/images/flash/flash-default.jpg +0 -0
  11. assets/images/flash/flash-food-v2.jpg +0 -0
  12. assets/images/flash/flash-food.jpg +0 -0
  13. assets/images/flash/flash-onepage.jpg +0 -0
  14. assets/images/flash/flash-pro-agency.jpg +0 -0
  15. assets/images/flash/flash-pro-band.jpg +0 -0
  16. assets/images/flash/flash-pro-church.jpg +0 -0
  17. assets/images/flash/flash-pro-default.jpg +0 -0
  18. assets/images/flash/flash-pro-education.jpg +0 -0
  19. assets/images/flash/flash-pro-gym.jpg +0 -0
  20. assets/images/flash/flash-pro-health.jpg +0 -0
  21. assets/images/flash/flash-pro-store.jpg +0 -0
  22. assets/images/flash/flash-pro-wedding.jpg +0 -0
  23. assets/js/admin/demo-importer.js +162 -6
  24. assets/js/admin/demo-importer.min.js +1 -1
  25. assets/js/admin/demo-updates.js +100 -1
  26. assets/js/admin/demo-updates.min.js +1 -1
  27. composer.lock +0 -295
  28. includes/{includes/admin → admin}/class-demo-installer-skin.php +0 -0
  29. includes/{includes/admin → admin}/class-demo-upgrader.php +0 -0
  30. includes/{includes/admin → admin}/views/html-admin-page-importer.php +65 -39
  31. includes/{includes/admin → admin}/views/html-admin-page-installer-preview.php +5 -3
  32. includes/{includes/admin → admin}/views/html-admin-page-installer-uploads.php +0 -0
  33. includes/{includes/admin → admin}/views/html-admin-page-installer.php +70 -42
  34. includes/{includes/admin → admin}/views/html-notice-reset-wizard-success.php +0 -0
  35. includes/{includes/admin → admin}/views/html-notice-reset-wizard.php +0 -0
  36. includes/class-demo-importer.php +64 -103
  37. includes/{includes/functions-demo-importer.php → functions-demo-importer.php} +133 -25
  38. includes/functions-demo-template.php +67 -0
  39. includes/functions-demo-update.php +1 -1
  40. includes/{includes → importers}/class-customizer-importer.php +0 -0
  41. includes/{includes → importers}/class-widget-importer.php +0 -0
  42. includes/{includes → importers}/customize/class-oc-customize-demo-importer-setting.php +0 -0
  43. includes/{includes/importers → importers/wordpress-importer}/class-wxr-importer.php +0 -0
  44. includes/{includes/importers → importers/wordpress-importer}/class-wxr-parsers.php +0 -0
  45. languages/themegrill-demo-importer.pot +512 -448
  46. phpcs.ruleset.xml +0 -195
  47. readme.txt +13 -9
  48. themegrill-demo-importer.php +20 -12
.stylelintrc DELETED
@@ -1,59 +0,0 @@
1
- {
2
- "rules": {
3
- "indentation": "tab",
4
- "color-hex-case": "lower",
5
- "color-no-invalid-hex": true,
6
-
7
- "function-calc-no-unspaced-operator": true,
8
- "function-comma-space-after": "always-single-line",
9
- "function-comma-space-before": "never",
10
- "function-name-case": "lower",
11
- "function-url-quotes": "always",
12
- "function-whitespace-after": "always",
13
-
14
- "number-leading-zero": "always",
15
- "number-no-trailing-zeros": true,
16
- "length-zero-no-unit": true,
17
-
18
- "string-no-newline": true,
19
- "string-quotes": "single",
20
-
21
- "unit-case": "lower",
22
- "unit-no-unknown": true,
23
- "unit-whitelist": ["px", "%", "deg", "ms", "em", "vh", "vw", "rem", "s", "ex", "pt", "cm"],
24
-
25
- "value-list-comma-space-after": "always-single-line",
26
- "value-list-comma-space-before": "never",
27
-
28
- "shorthand-property-no-redundant-values": true,
29
-
30
- "property-case": "lower",
31
-
32
- "declaration-block-no-duplicate-properties": [true, { "severity": "warning" } ],
33
- "declaration-block-no-ignored-properties": [true, { "severity": "warning" } ],
34
- "declaration-block-trailing-semicolon": "always",
35
- "declaration-block-single-line-max-declarations": 0,
36
- "declaration-block-semicolon-space-before": "never",
37
- "declaration-block-semicolon-space-after": "always-single-line",
38
- "declaration-block-semicolon-newline-before": "never-multi-line",
39
- "declaration-block-semicolon-newline-after": "always-multi-line",
40
-
41
- "block-closing-brace-newline-after": "always",
42
- "block-closing-brace-newline-before": "always-multi-line",
43
- "block-no-empty": true,
44
- "block-opening-brace-newline-after": "always-multi-line",
45
- "block-opening-brace-space-before": "always",
46
-
47
- "selector-attribute-brackets-space-inside": "never",
48
- "selector-attribute-operator-space-after": "never",
49
- "selector-attribute-operator-space-before": "never",
50
- "selector-combinator-space-after": "always",
51
- "selector-combinator-space-before": "always",
52
- "selector-pseudo-class-case": "lower",
53
- "selector-pseudo-class-parentheses-space-inside": "always",
54
- "selector-pseudo-element-case": "lower",
55
- "selector-pseudo-element-colon-notation": "double",
56
- "selector-pseudo-element-no-unknown": true,
57
- "selector-type-case": "lower",
58
- }
59
- }
.wordpress-org/banner-772x250.jpg DELETED
Binary file
CHANGELOG.txt DELETED
@@ -1,31 +0,0 @@
1
- == Changelog ==
2
-
3
- = 1.3.3 =
4
- * Tweak - Support demo import for suffice theme.
5
-
6
- = 1.3.2 =
7
- * Tweak - Load screenshots for pro theme demos.
8
-
9
- = 1.3.1 =
10
- * Tweak - Load screenshot from theme instead of plugin for themes with single demo.
11
-
12
- = 1.3.0 =
13
- * Tweak - Support data update for nested siteorigin layoutbuilder.
14
- * Fix - Import button not working on firefox.
15
-
16
- = 1.2.0 =
17
- * Tweak - Load scripts perfecly on demo importer appearance page.
18
- * Tweak - Set transient for redirecting to demo importer page after install or update.
19
- * Tweak - Introduced filter hook `themegrill_demo_importer_installer` to control demo view.
20
-
21
- = 1.1.0 =
22
- * Feature - Backbone views interface for demos and previews
23
- * Feature - Added download button for the preview not installed
24
- * Feature - Robust quick search view to change in demo interface
25
- * Feature - Detailed information in popup to showcase plugins, events, etc
26
- * Refactor - Replace old way to import demo with new `wp.updates` methods
27
- * Fix - Menu classes to hide admin menu if no JS using css class `hide-if-no-js`
28
- * Fix - Remove the old demo pack if found and to update the new demo packs
29
-
30
- = 1.0.0 =
31
- * Initial Public Release
CODE_OF_CONDUCT.md DELETED
@@ -1,46 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
-
7
- ## Our Standards
8
-
9
- Examples of behavior that contributes to creating a positive environment include:
10
-
11
- * Using welcoming and inclusive language
12
- * Being respectful of differing viewpoints and experiences
13
- * Gracefully accepting constructive criticism
14
- * Focusing on what is best for the community
15
- * Showing empathy towards other community members
16
-
17
- Examples of unacceptable behavior by participants include:
18
-
19
- * The use of sexualized language or imagery and unwelcome sexual attention or advances
20
- * Trolling, insulting/derogatory comments, and personal or political attacks
21
- * Public or private harassment
22
- * Publishing others' private information, such as a physical or electronic address, without explicit permission
23
- * Other conduct which could reasonably be considered inappropriate in a professional setting
24
-
25
- ## Our Responsibilities
26
-
27
- Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28
-
29
- Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30
-
31
- ## Scope
32
-
33
- This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34
-
35
- ## Enforcement
36
-
37
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at support@themegrill.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38
-
39
- Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40
-
41
- ## Attribution
42
-
43
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44
-
45
- [homepage]: http://contributor-covenant.org
46
- [version]: http://contributor-covenant.org/version/1/4/
assets/css/demo-importer-rtl.css CHANGED
@@ -1 +1 @@
1
- .appearance_page_demo-importer .demo-importer h1{margin-bottom:15px}.appearance_page_demo-importer .demo-importer .search-form{display:inline}.appearance_page_demo-importer .demo-importer .wp-filter-search{position:relative;top:-2px;right:20px;margin:0;width:280px;font-size:16px;font-weight:300;line-height:1.5}.appearance_page_demo-importer .demo-installer .wp-filter{padding:0 20px}.appearance_page_demo-importer .demo-installer .wp-filter .filter-links li>a:focus{box-shadow:none}.appearance_page_demo-importer .demo-installer .welcome-panel{margin:0;background:#e9eff3;border:10px solid #fff;box-shadow:none}.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-content{width:45%;float:right}.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-content .welcome-panel-column{width:100%}.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-content .welcome-panel-column ul{padding-right:10px}.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-iframe-video{float:left;width:50%}.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-iframe-video .welcome-panel-iframe-video-inner{position:relative;height:0;margin:0 10px 23px;padding-bottom:56.25%;border:5px solid #dadada}.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-iframe-video .welcome-panel-iframe-video-inner iframe{position:absolute;top:0;right:0;width:100%;height:100%}.appearance_page_demo-importer .demo-installer .premium-ribbon{overflow:hidden}.appearance_page_demo-importer .demo-installer .premium-ribbon::after{background-color:#24b37e;border:1px solid #069c64;box-shadow:0 0 4px rgba(255,255,255,.5) inset,0 1px 3px rgba(0,0,0,.3);color:#fff;content:'PRO';font-size:16px;font-weight:700;padding:5px 30px;position:absolute;left:-30px;top:6px;-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg)}table.plugins-list-table{margin-bottom:1em}table.plugins-list-table tr:nth-child(2n) td{background:#fcfcfc}table.plugins-list-table th{padding:9px;font-weight:600}table.plugins-list-table td{padding:9px;font-size:1.1em}table.plugins-list-table td mark{background:transparent none}table.plugins-list-table td mark.yes{color:#7ad03a}table.plugins-list-table td mark.no{color:#999}table.plugins-list-table td mark.error{color:#a00}table.plugins-list-table .plugin-status{text-align:center}.tips{cursor:help;text-decoration:none}img.tips{padding:5px 0 0}#tiptip_holder{display:none;z-index:8675309;position:absolute;top:0;left:0}#tiptip_holder.tip_top{padding-bottom:5px}#tiptip_holder.tip_top #tiptip_arrow_inner{margin-top:-7px;margin-right:-6px;border-top-color:#333}#tiptip_holder.tip_bottom{padding-top:5px}#tiptip_holder.tip_bottom #tiptip_arrow_inner{margin-top:-5px;margin-right:-6px;border-bottom-color:#333}#tiptip_holder.tip_right{padding-right:5px}#tiptip_holder.tip_right #tiptip_arrow_inner{margin-top:-6px;margin-right:-5px;border-left-color:#333}#tiptip_holder.tip_left{padding-left:5px}#tiptip_holder.tip_left #tiptip_arrow_inner{margin-top:-6px;margin-right:-7px;border-right-color:#333}#tiptip_content{color:#fff;font-size:.8em;max-width:150px;background:#333;text-align:center;border-radius:3px;padding:.618em 1em;box-shadow:0 1px 3px rgba(0,0,0,.2)}#tiptip_content code{padding:1px;background:#888}#tiptip_arrow,#tiptip_arrow_inner{position:absolute;border-color:transparent;border-style:solid;border-width:6px;height:0;width:0}#tiptip_arrow{right:50%;margin-right:-6px}@media screen and (max-width:500px){.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-content,.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-iframe-video{float:none;width:100%}}
1
+ .appearance_page_demo-importer .demo-importer h1{margin-bottom:15px}.appearance_page_demo-importer .demo-importer .search-form{display:inline}.appearance_page_demo-importer .demo-importer .wp-filter-search{position:relative;top:-2px;right:20px;margin:0;width:280px;font-size:16px;font-weight:300;line-height:1.5}.appearance_page_demo-importer .demo-installer .wp-filter{padding:0 20px}.appearance_page_demo-importer .demo-installer .wp-filter .filter-links li>a:focus{box-shadow:none}.appearance_page_demo-importer .demo-installer .welcome-panel{margin:0;background:#e9eff3;border:10px solid #fff;box-shadow:none}.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-content{width:45%;float:right}.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-content .welcome-panel-column{width:100%}.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-content .welcome-panel-column ul{padding-right:10px}.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-iframe-video{float:left;width:50%}.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-iframe-video .welcome-panel-iframe-video-inner{position:relative;height:0;margin:0 10px 23px;padding-bottom:56.25%;border:5px solid #dadada}.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-iframe-video .welcome-panel-iframe-video-inner iframe{position:absolute;top:0;right:0;width:100%;height:100%}.appearance_page_demo-importer .demo-installer .premium-ribbon{position:absolute;left:0;top:0;width:100%;height:100%;overflow:hidden}.appearance_page_demo-importer .demo-installer .premium-ribbon span{color:#fff;display:block;text-transform:uppercase;border:1px solid #069c64;background-color:#24b37e;box-shadow:0 0 4px rgba(255,255,255,.5) inset,0 1px 3px rgba(0,0,0,.3);font-size:15px;font-weight:700;text-align:center;padding:5px 30px;-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg);position:absolute;top:6px;left:-30px}table.plugins-list-table{margin-bottom:1em}table.plugins-list-table .plugin-status{text-align:center}table.plugins-list-table .plugin-status span{width:20px;height:20px;visibility:hidden;vertical-align:top;display:inline-block}table.plugins-list-table .plugin-status span::before{visibility:visible;display:inline-block;font:normal 20px/1 dashicons;-webkit-transition:color .1s ease-in 0;transition:color .1s ease-in 0;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}table.plugins-list-table .plugin-status .active::before{color:#7ad03a;content:'\f147'}table.plugins-list-table .plugin-status .activate-now::before,table.plugins-list-table .plugin-status .install-now::before{color:#a00;content:'\f153'}table.plugins-list-table .plugin-status .activate-now::before{content:'\f534'}table.plugins-list-table .plugin-status .updating-message::before{color:#f56e28;content:'\f463';-webkit-animation:rotation 2s infinite linear;animation:rotation 2s infinite linear}table.plugins-list-table .plugin-actions .plugins-activate,table.plugins-list-table .plugin-actions .plugins-install{float:left;-webkit-transform:none;-ms-transform:none;transform:none}table.plugins-list-table .plugin-actions .plugins-install{margin-right:8px}.tips{cursor:help;text-decoration:none}img.tips{padding:5px 0 0}#tiptip_holder{display:none;z-index:8675309;position:absolute;top:0;left:0}#tiptip_holder.tip_top{padding-bottom:5px}#tiptip_holder.tip_top #tiptip_arrow_inner{margin-top:-7px;margin-right:-6px;border-top-color:#333}#tiptip_holder.tip_bottom{padding-top:5px}#tiptip_holder.tip_bottom #tiptip_arrow_inner{margin-top:-5px;margin-right:-6px;border-bottom-color:#333}#tiptip_holder.tip_right{padding-right:5px}#tiptip_holder.tip_right #tiptip_arrow_inner{margin-top:-6px;margin-right:-5px;border-left-color:#333}#tiptip_holder.tip_left{padding-left:5px}#tiptip_holder.tip_left #tiptip_arrow_inner{margin-top:-6px;margin-right:-7px;border-right-color:#333}#tiptip_content{color:#fff;font-size:.8em;max-width:150px;background:#333;text-align:center;border-radius:3px;padding:.618em 1em;box-shadow:0 1px 3px rgba(0,0,0,.2)}#tiptip_content code{padding:1px;background:#888}#tiptip_arrow,#tiptip_arrow_inner{position:absolute;border-color:transparent;border-style:solid;border-width:6px;height:0;width:0}#tiptip_arrow{right:50%;margin-right:-6px}@media screen and (max-width:500px){.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-content,.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-iframe-video{float:none;width:100%}}
assets/css/demo-importer.css CHANGED
@@ -1 +1 @@
1
- .appearance_page_demo-importer .demo-importer h1{margin-bottom:15px}.appearance_page_demo-importer .demo-importer .search-form{display:inline}.appearance_page_demo-importer .demo-importer .wp-filter-search{position:relative;top:-2px;left:20px;margin:0;width:280px;font-size:16px;font-weight:300;line-height:1.5}.appearance_page_demo-importer .demo-installer .wp-filter{padding:0 20px}.appearance_page_demo-importer .demo-installer .wp-filter .filter-links li>a:focus{box-shadow:none}.appearance_page_demo-importer .demo-installer .welcome-panel{margin:0;background:#e9eff3;border:10px solid #fff;box-shadow:none}.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-content{width:45%;float:left}.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-content .welcome-panel-column{width:100%}.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-content .welcome-panel-column ul{padding-left:10px}.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-iframe-video{float:right;width:50%}.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-iframe-video .welcome-panel-iframe-video-inner{position:relative;height:0;margin:0 10px 23px;padding-bottom:56.25%;border:5px solid #dadada}.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-iframe-video .welcome-panel-iframe-video-inner iframe{position:absolute;top:0;left:0;width:100%;height:100%}.appearance_page_demo-importer .demo-installer .premium-ribbon{overflow:hidden}.appearance_page_demo-importer .demo-installer .premium-ribbon::after{background-color:#24b37e;border:1px solid #069c64;box-shadow:0 0 4px rgba(255,255,255,.5) inset,0 1px 3px rgba(0,0,0,.3);color:#fff;content:'PRO';font-size:16px;font-weight:700;padding:5px 30px;position:absolute;right:-30px;top:6px;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}table.plugins-list-table{margin-bottom:1em}table.plugins-list-table tr:nth-child(2n) td{background:#fcfcfc}table.plugins-list-table th{padding:9px;font-weight:600}table.plugins-list-table td{padding:9px;font-size:1.1em}table.plugins-list-table td mark{background:transparent none}table.plugins-list-table td mark.yes{color:#7ad03a}table.plugins-list-table td mark.no{color:#999}table.plugins-list-table td mark.error{color:#a00}table.plugins-list-table .plugin-status{text-align:center}.tips{cursor:help;text-decoration:none}img.tips{padding:5px 0 0}#tiptip_holder{display:none;z-index:8675309;position:absolute;top:0;left:0}#tiptip_holder.tip_top{padding-bottom:5px}#tiptip_holder.tip_top #tiptip_arrow_inner{margin-top:-7px;margin-left:-6px;border-top-color:#333}#tiptip_holder.tip_bottom{padding-top:5px}#tiptip_holder.tip_bottom #tiptip_arrow_inner{margin-top:-5px;margin-left:-6px;border-bottom-color:#333}#tiptip_holder.tip_right{padding-left:5px}#tiptip_holder.tip_right #tiptip_arrow_inner{margin-top:-6px;margin-left:-5px;border-right-color:#333}#tiptip_holder.tip_left{padding-right:5px}#tiptip_holder.tip_left #tiptip_arrow_inner{margin-top:-6px;margin-left:-7px;border-left-color:#333}#tiptip_content{color:#fff;font-size:.8em;max-width:150px;background:#333;text-align:center;border-radius:3px;padding:.618em 1em;box-shadow:0 1px 3px rgba(0,0,0,.2)}#tiptip_content code{padding:1px;background:#888}#tiptip_arrow,#tiptip_arrow_inner{position:absolute;border-color:transparent;border-style:solid;border-width:6px;height:0;width:0}@media screen and (max-width:500px){.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-content,.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-iframe-video{float:none;width:100%}}
1
+ .appearance_page_demo-importer .demo-importer h1{margin-bottom:15px}.appearance_page_demo-importer .demo-importer .search-form{display:inline}.appearance_page_demo-importer .demo-importer .wp-filter-search{position:relative;top:-2px;left:20px;margin:0;width:280px;font-size:16px;font-weight:300;line-height:1.5}.appearance_page_demo-importer .demo-installer .wp-filter{padding:0 20px}.appearance_page_demo-importer .demo-installer .wp-filter .filter-links li>a:focus{box-shadow:none}.appearance_page_demo-importer .demo-installer .welcome-panel{margin:0;background:#e9eff3;border:10px solid #fff;box-shadow:none}.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-content{width:45%;float:left}.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-content .welcome-panel-column{width:100%}.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-content .welcome-panel-column ul{padding-left:10px}.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-iframe-video{float:right;width:50%}.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-iframe-video .welcome-panel-iframe-video-inner{position:relative;height:0;margin:0 10px 23px;padding-bottom:56.25%;border:5px solid #dadada}.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-iframe-video .welcome-panel-iframe-video-inner iframe{position:absolute;top:0;left:0;width:100%;height:100%}.appearance_page_demo-importer .demo-installer .premium-ribbon{position:absolute;right:0;top:0;width:100%;height:100%;overflow:hidden}.appearance_page_demo-importer .demo-installer .premium-ribbon span{color:#fff;display:block;text-transform:uppercase;border:1px solid #069c64;background-color:#24b37e;box-shadow:0 0 4px rgba(255,255,255,.5) inset,0 1px 3px rgba(0,0,0,.3);font-size:15px;font-weight:700;text-align:center;padding:5px 30px;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg);position:absolute;top:6px;right:-30px}table.plugins-list-table{margin-bottom:1em}table.plugins-list-table .plugin-status{text-align:center}table.plugins-list-table .plugin-status span{width:20px;height:20px;visibility:hidden;vertical-align:top;display:inline-block}table.plugins-list-table .plugin-status span::before{visibility:visible;display:inline-block;font:normal 20px/1 dashicons;-webkit-transition:color .1s ease-in 0;transition:color .1s ease-in 0;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}table.plugins-list-table .plugin-status .active::before{color:#7ad03a;content:'\f147'}table.plugins-list-table .plugin-status .activate-now::before,table.plugins-list-table .plugin-status .install-now::before{color:#a00;content:'\f153'}table.plugins-list-table .plugin-status .activate-now::before{content:'\f534'}table.plugins-list-table .plugin-status .updating-message::before{color:#f56e28;content:'\f463';-webkit-animation:rotation 2s infinite linear;animation:rotation 2s infinite linear}table.plugins-list-table .plugin-actions .plugins-activate,table.plugins-list-table .plugin-actions .plugins-install{float:right;-webkit-transform:none;-ms-transform:none;transform:none}table.plugins-list-table .plugin-actions .plugins-install{margin-left:8px}.tips{cursor:help;text-decoration:none}img.tips{padding:5px 0 0}#tiptip_holder{display:none;z-index:8675309;position:absolute;top:0;left:0}#tiptip_holder.tip_top{padding-bottom:5px}#tiptip_holder.tip_top #tiptip_arrow_inner{margin-top:-7px;margin-left:-6px;border-top-color:#333}#tiptip_holder.tip_bottom{padding-top:5px}#tiptip_holder.tip_bottom #tiptip_arrow_inner{margin-top:-5px;margin-left:-6px;border-bottom-color:#333}#tiptip_holder.tip_right{padding-left:5px}#tiptip_holder.tip_right #tiptip_arrow_inner{margin-top:-6px;margin-left:-5px;border-right-color:#333}#tiptip_holder.tip_left{padding-right:5px}#tiptip_holder.tip_left #tiptip_arrow_inner{margin-top:-6px;margin-left:-7px;border-left-color:#333}#tiptip_content{color:#fff;font-size:.8em;max-width:150px;background:#333;text-align:center;border-radius:3px;padding:.618em 1em;box-shadow:0 1px 3px rgba(0,0,0,.2)}#tiptip_content code{padding:1px;background:#888}#tiptip_arrow,#tiptip_arrow_inner{position:absolute;border-color:transparent;border-style:solid;border-width:6px;height:0;width:0}@media screen and (max-width:500px){.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-content,.appearance_page_demo-importer .demo-installer .welcome-panel .welcome-panel-iframe-video{float:none;width:100%}}
assets/css/demo-importer.scss CHANGED
@@ -79,21 +79,28 @@
79
}
80
81
.premium-ribbon {
82
overflow: hidden;
83
84
- &::after {
85
- background-color: #24b37e;
86
border: 1px solid #069c64;
87
box-shadow: 0 0 4px rgba( 255, 255, 255, 0.5 ) inset, 0 1px 3px rgba( 0, 0, 0, 0.3 );
88
- color: #fff;
89
- content: 'PRO';
90
- font-size: 16px;
91
font-weight: 700;
92
padding: 5px 30px;
93
position: absolute;
94
- right: -30px;
95
top: 6px;
96
- transform: rotate( 45deg );
97
}
98
}
99
}
@@ -102,40 +109,66 @@
102
table.plugins-list-table {
103
margin-bottom: 1em;
104
105
- tr:nth-child( 2n ) {
106
- td {
107
- background: #fcfcfc;
108
- }
109
- }
110
-
111
- th {
112
- padding: 9px;
113
- font-weight: 600;
114
- }
115
116
- td {
117
- padding: 9px;
118
- font-size: 1.1em;
119
120
- mark {
121
- background: transparent none;
122
}
123
124
- mark.yes {
125
- color: #7ad03a;
126
}
127
128
- mark.no {
129
- color: #999;
130
}
131
132
- mark.error {
133
- color: #a00;
134
}
135
}
136
137
- .plugin-status {
138
- text-align: center;
139
}
140
}
141
79
}
80
81
.premium-ribbon {
82
+ position: absolute;
83
+ right: 0;
84
+ top: 0;
85
+ width: 100%;
86
+ height: 100%;
87
overflow: hidden;
88
89
+ span {
90
+ color: #fff;
91
+ display: block;
92
+ text-transform: uppercase;
93
border: 1px solid #069c64;
94
+ background-color: #24b37e;
95
box-shadow: 0 0 4px rgba( 255, 255, 255, 0.5 ) inset, 0 1px 3px rgba( 0, 0, 0, 0.3 );
96
+ font-size: 15px;
97
font-weight: 700;
98
+ text-align: center;
99
padding: 5px 30px;
100
+ transform: rotate(45deg);
101
position: absolute;
102
top: 6px;
103
+ right: -30px;
104
}
105
}
106
}
109
table.plugins-list-table {
110
margin-bottom: 1em;
111
112
+ .plugin-status {
113
+ text-align: center;
114
115
+ span {
116
+ width: 20px;
117
+ height: 20px;
118
+ visibility: hidden;
119
+ vertical-align: top;
120
+ display: inline-block;
121
+
122
+ &::before {
123
+ visibility: visible;
124
+ display: inline-block;
125
+ font: normal 20px/1 'dashicons';
126
+ transition: color 0.1s ease-in 0;
127
+ -webkit-font-smoothing: antialiased;
128
+ -moz-osx-font-smoothing: grayscale;
129
+ }
130
+ }
131
132
+ .active {
133
+ &::before {
134
+ color: #7ad03a;
135
+ content: '\f147';
136
+ }
137
}
138
139
+ .install-now,
140
+ .activate-now {
141
+ &::before {
142
+ color: #a00;
143
+ content: '\f153';
144
+ }
145
}
146
147
+ .activate-now {
148
+ &::before {
149
+ content: '\f534';
150
+ }
151
}
152
153
+ .updating-message {
154
+ &::before {
155
+ color: #f56e28;
156
+ content: '\f463';
157
+ animation: rotation 2s infinite linear;
158
+ }
159
}
160
}
161
162
+ .plugin-actions {
163
+ .plugins-install,
164
+ .plugins-activate {
165
+ float: right;
166
+ transform: none;
167
+ }
168
+
169
+ .plugins-install {
170
+ margin-left: 8px;
171
+ }
172
}
173
}
174
assets/images/flash/flash-construction-v2.jpg DELETED
Binary file
assets/images/flash/flash-construction.jpg DELETED
Binary file
assets/images/flash/flash-default.jpg DELETED
Binary file
assets/images/flash/flash-food-v2.jpg DELETED
Binary file
assets/images/flash/flash-food.jpg DELETED
Binary file
assets/images/flash/flash-onepage.jpg DELETED
Binary file
assets/images/flash/flash-pro-agency.jpg DELETED
Binary file
assets/images/flash/flash-pro-band.jpg DELETED
Binary file
assets/images/flash/flash-pro-church.jpg DELETED
Binary file
assets/images/flash/flash-pro-default.jpg DELETED
Binary file
assets/images/flash/flash-pro-education.jpg DELETED
Binary file
assets/images/flash/flash-pro-gym.jpg DELETED
Binary file
assets/images/flash/flash-pro-health.jpg DELETED
Binary file
assets/images/flash/flash-pro-store.jpg DELETED
Binary file
assets/images/flash/flash-pro-wedding.jpg DELETED
Binary file
assets/js/admin/demo-importer.js CHANGED
@@ -272,11 +272,6 @@ demos.view.Demo = wp.Backbone.View.extend({
272
if ( this.model.get( 'displayAuthor' ) ) {
273
this.$el.addClass( 'display-author' );
274
}
275
-
276
- // Append ribbon class
277
- if ( this.model.get( 'actions' ).pro_link ) {
278
- this.$el.html( this.html( data ) ).addClass( 'premium-ribbon' );
279
- }
280
},
281
282
// Adds a class to the currently active demo
@@ -376,7 +371,8 @@ demos.view.Details = wp.Backbone.View.extend({
376
'click .delete-demo': 'deleteDemo',
377
'click .left': 'previousDemo',
378
'click .right': 'nextDemo',
379
- 'click .demo-import': 'importDemo'
380
},
381
382
// The HTML template for the theme overlay
@@ -530,6 +526,142 @@ demos.view.Details = wp.Backbone.View.extend({
530
} );
531
},
532
533
deleteDemo: function( event ) {
534
var _this = this,
535
_collection = this.model.collection,
@@ -1225,6 +1357,30 @@ $( document ).ready( function() {
1225
1226
frame.attr( 'src', frame.data( 'src' ) );
1227
});
1228
});
1229
1230
})( jQuery );
272
if ( this.model.get( 'displayAuthor' ) ) {
273
this.$el.addClass( 'display-author' );
274
}
275
},
276
277
// Adds a class to the currently active demo
371
'click .delete-demo': 'deleteDemo',
372
'click .left': 'previousDemo',
373
'click .right': 'nextDemo',
374
+ 'click .demo-import': 'importDemo',
375
+ 'click .plugins-install': 'installPlugin'
376
},
377
378
// The HTML template for the theme overlay
526
} );
527
},
528
529
+ installPlugin: function( event ) {
530
+ var itemsSelected = $( document ).find( 'input[name="required[]"], input[name="checked[]"]:checked' ),
531
+ $target = $( event.target ),
532
+ success = 0,
533
+ error = 0,
534
+ errorMessages = [];
535
+
536
+ event.preventDefault();
537
+
538
+ if ( $target.hasClass( 'disabled' ) || $target.hasClass( 'updating-message' ) ) {
539
+ return;
540
+ }
541
+
542
+ // Remove previous error messages, if any.
543
+ $( '.theme-info .update-message' ).remove();
544
+
545
+ // Bail if there were no items selected.
546
+ if ( ! itemsSelected.length ) {
547
+ event.preventDefault();
548
+ $( '.theme-about' ).animate( { scrollTop: 0 } );
549
+ $( '.theme-info .plugins-info' ).after( wp.updates.adminNotice( {
550
+ id: 'no-items-selected',
551
+ className: 'update-message notice-error notice-alt',
552
+ message: wp.updates.l10n.noItemsSelected
553
+ } ) );
554
+ }
555
+
556
+ wp.updates.maybeRequestFilesystemCredentials( event );
557
+
558
+ // Confirmation dialog for installing bulk plugins.
559
+ if ( ! window.confirm( wp.demos.data.settings.confirmInstall ) ) {
560
+ return;
561
+ }
562
+
563
+ // Un-check the bulk checkboxes.
564
+ $( document ).find( '.manage-column [type="checkbox"]' ).prop( 'checked', false );
565
+
566
+ $( document ).trigger( 'wp-plugin-bulk-install', itemsSelected );
567
+
568
+ // Find all the checkboxes which have been checked.
569
+ itemsSelected.each( function( index, element ) {
570
+ var $checkbox = $( element ),
571
+ $itemRow = $checkbox.parents( 'tr' );
572
+
573
+ // Only add install-able items to the update queue.
574
+ if ( ! $itemRow.hasClass( 'install' ) || $itemRow.find( 'notice-error' ).length ) {
575
+
576
+ // Un-check the box.
577
+ $checkbox.filter( ':not(:disabled)' ).prop( 'checked', false );
578
+ return;
579
+ } else {
580
+ $target
581
+ .addClass( 'updating-message' )
582
+ .text( wp.updates.l10n.installing );
583
+
584
+ wp.a11y.speak( wp.updates.l10n.installingMsg, 'polite' );
585
+ }
586
+
587
+ // Add it to the queue.
588
+ wp.updates.queue.push( {
589
+ action: 'install-plugin',
590
+ data: {
591
+ slug: $itemRow.data( 'slug' )
592
+ }
593
+ } );
594
+ } );
595
+
596
+ // Display bulk notification for install of plugin.
597
+ $( document ).on( 'wp-plugin-bulk-install-success wp-plugin-bulk-install-error', function( event, response ) {
598
+ var $itemRow = $( '[data-slug="' + response.slug + '"]' ),
599
+ $bulkActionNotice, itemName;
600
+
601
+ if ( 'wp-' + response.install + '-bulk-install-success' === event.type ) {
602
+ success++;
603
+ } else {
604
+ itemName = response.pluginName ? response.pluginName : $itemRow.find( '.plugin-name' ).text();
605
+
606
+ error++;
607
+ errorMessages.push( itemName + ': ' + response.errorMessage );
608
+ }
609
+
610
+ $itemRow.find( 'input[name="checked[]"]:checked' ).filter( ':not(:disabled)' ).prop( 'checked', false );
611
+
612
+ wp.updates.adminNotice = wp.template( 'wp-bulk-installs-admin-notice' );
613
+
614
+ // Remove previous error messages, if any.
615
+ $( '.theme-info .bulk-action-notice' ).remove();
616
+
617
+ $( '.theme-info .plugins-info' ).after( wp.updates.adminNotice( {
618
+ id: 'bulk-action-notice',
619
+ className: 'bulk-action-notice notice-alt',
620
+ successes: success,
621
+ errors: error,
622
+ errorMessages: errorMessages,
623
+ type: response.install
624
+ } ) );
625
+
626
+ $bulkActionNotice = $( '#bulk-action-notice' ).on( 'click', 'button', function() {
627
+ // $( this ) is the clicked button, no need to get it again.
628
+ $( this )
629
+ .toggleClass( 'bulk-action-errors-collapsed' )
630
+ .attr( 'aria-expanded', ! $( this ).hasClass( 'bulk-action-errors-collapsed' ) );
631
+ // Show the errors list.
632
+ $bulkActionNotice.find( '.bulk-action-errors' ).toggleClass( 'hidden' );
633
+ } );
634
+
635
+ if ( ! wp.updates.queue.length ) {
636
+ if ( error > 0 ) {
637
+ $target
638
+ .removeClass( 'updating-message' ).addClass( 'disabled' )
639
+ .text( wp.updates.l10n.installFailedShort );
640
+
641
+ wp.a11y.speak( wp.updates.l10n.installedMsg, 'polite' );
642
+
643
+ $( '.theme-about' ).animate( { scrollTop: 0 } );
644
+ } else {
645
+ $target
646
+ .removeClass( 'updating-message' ).addClass( 'disabled' )
647
+ .text( wp.updates.l10n.pluginInstalled );
648
+
649
+ wp.a11y.speak( wp.updates.l10n.installedMsg, 'polite' );
650
+
651
+ $( '.plugins-activate' ).removeAttr( 'disabled' );
652
+ }
653
+ }
654
+ } );
655
+
656
+ // Reset admin notice template after #bulk-action-notice was added.
657
+ $( document ).on( 'wp-updates-notice-added', function() {
658
+ wp.updates.adminNotice = wp.template( 'wp-updates-admin-notice' );
659
+ } );
660
+
661
+ // Check the queue, now that the event handlers have been added.
662
+ wp.updates.queueChecker();
663
+ },
664
+
665
deleteDemo: function( event ) {
666
var _this = this,
667
_collection = this.model.collection,
1357
1358
frame.attr( 'src', frame.data( 'src' ) );
1359
});
1360
+
1361
+ // Make disabled checkbox always checked through data-checked.
1362
+ $( document.body ).on( 'click', 'thead .check-column :checkbox', function( event ) {
1363
+ var $this = $( this ),
1364
+ $table = $this.closest( 'table' ),
1365
+ controlChecked = $this.prop( 'checked' ),
1366
+ toggle = event.shiftKey || $this.data( 'wp-toggle' );
1367
+
1368
+ $table.children( 'tbody' ).filter( ':visible' )
1369
+ .children().children( '.check-column' ).find( ':checkbox' )
1370
+ .prop( 'checked', function() {
1371
+ if ( $( this ).is( ':hidden,:disabled' ) ) {
1372
+ return $( this ).data( 'checked' ) ? true : false;
1373
+ }
1374
+
1375
+ if ( toggle ) {
1376
+ return ! $( this ).prop( 'checked' );
1377
+ } else if ( controlChecked ) {
1378
+ return true;
1379
+ }
1380
+
1381
+ return false;
1382
+ });
1383
+ });
1384
});
1385
1386
})( jQuery );
assets/js/admin/demo-importer.min.js CHANGED
@@ -1 +1 @@
1
- window.wp=window.wp||{},function(e){var t,i;(t=wp.demos=wp.demos||{}).data=demoImporterLocalizeScript,i=t.data.l10n,t.isPreview=!!t.data.settings.isPreview,t.isInstall=!!t.data.settings.isInstall,_.extend(t,{model:{},view:{},routes:{},router:{},template:wp.template}),t.Model=Backbone.Model.extend({initialize:function(){var e;-1!==_.indexOf(t.data.installedDemos,this.get("slug"))&&this.set({installed:!0}),this.set({id:this.get("slug")||this.get("id")}),this.has("sections")&&(e=this.get("sections").description,this.set({description:e}))}}),t.view.Appearance=wp.Backbone.View.extend({el:"#wpbody-content .wrap .theme-browser",window:e(window),page:0,initialize:function(e){_.bindAll(this,"scroller"),this.SearchView=e.SearchView?e.SearchView:t.view.Search,this.window.bind("scroll",_.throttle(this.scroller,300))},render:function(){this.view=new t.view.Demos({collection:this.collection,parent:this}),this.search(),this.view.render(),this.$el.empty().append(this.view.el).addClass("rendered")},searchContainer:e(".search-form"),search:function(){var o,s=this;1!==t.data.demos.length&&((o=new this.SearchView({collection:s.collection,parent:this})).render(),this.searchContainer.append(e.parseHTML('<label class="screen-reader-text" for="wp-filter-search-input">'+i.search+"</label>")).append(o.el))},scroller:function(){var e,t,i=this;e=this.window.scrollTop()+i.window.height(),t=i.$el.offset().top+i.$el.outerHeight(!1)-i.window.height(),e>(t=Math.round(.9*t))&&this.trigger("demo:scroll")},initTipTip:function(){e("#tiptip_holder").removeAttr("style"),e("#tiptip_arrow").removeAttr("style"),e(".tips").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:50})}}),t.Collection=Backbone.Collection.extend({model:t.Model,terms:"",doSearch:function(i){this.terms!==i&&(this.terms=i,this.terms.length>0&&this.search(this.terms),""===this.terms&&(this.reset(t.data.demos),e("body").removeClass("no-results")),this.trigger("demos:update"))},search:function(i){var o,s,n,r,a,l;this.reset(t.data.demos,{silent:!0}),i=i.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\amp;"),i=i.replace(/ /g,")(?=.*"),o=new RegExp("^(?=.*"+i+").+","i"),0===(s=this.filter(function(e){return r=e.get("name").replace(/(<([^>]+)>)/gi,""),a=e.get("description").replace(/(<([^>]+)>)/gi,""),l=e.get("author").replace(/(<([^>]+)>)/gi,""),n=_.union([r,e.get("id"),a,l,e.get("tags")]),o.test(e.get("author"))&&i.length>2&&e.set("displayAuthor",!0),o.test(n)})).length?this.trigger("query:empty"):e("body").removeClass("no-results"),this.reset(s)},paginate:function(e){var t=this;return e=e||0,t=_(t.rest(20*e)),t=_(t.first(20))}}),t.view.Demo=wp.Backbone.View.extend({className:"theme",state:"grid",html:t.template(t.isPreview?"demo-preview":"demo"),events:{click:"expand",keydown:"expand",touchend:"expand",keyup:"addFocus",touchmove:"preventExpand","click .demo-import":"importDemo"},touchDrag:!1,initialize:function(){this.model.on("change",this.render,this)},render:function(){var e=this.model.toJSON();this.$el.html(this.html(e)).attr({tabindex:0,"aria-describedby":e.id+"-action "+e.id+"-name","data-slug":e.id}),this.activeDemo(),this.model.get("displayAuthor")&&this.$el.addClass("display-author"),this.model.get("actions").pro_link&&this.$el.html(this.html(e)).addClass("premium-ribbon")},activeDemo:function(){this.model.get("active")&&this.$el.addClass("active")},addFocus:function(){var t=e(":focus").hasClass("theme")?e(":focus"):e(":focus").parents(".theme");e(".theme.focus").removeClass("focus"),t.addClass("focus")},expand:function(i){var o=this;if(!t.isPreview&&("keydown"!==(i=i||window.event).type||13===i.which||32===i.which))return!0===this.touchDrag?this.touchDrag=!1:void(e(i.target).is(".theme-actions a")||e(i.target).is(".theme-actions a, .update-message, .button-link, .notice-dismiss")||(t.focusedDemo=this.$el,this.trigger("demo:expand",o.model.cid)))},preventExpand:function(){this.touchDrag=!0},importDemo:function(t){var i=this,o=e(t.target);t.preventDefault(),o.hasClass("disabled")||window.confirm(wp.demos.data.settings.confirmImport)&&(e(document).on("wp-demo-import-success",function(e,t){i.model.get("id")===t.slug&&i.model.set({imported:!0})}),wp.updates.importDemo({slug:o.data("slug")}))}}),t.view.Details=wp.Backbone.View.extend({className:"theme-overlay",events:{click:"collapse","click .delete-demo":"deleteDemo","click .left":"previousDemo","click .right":"nextDemo","click .demo-import":"importDemo"},html:t.template("demo-single"),render:function(){var e=this.model.toJSON();this.$el.html(this.html(e)),this.activeDemo(),this.navigation(),this.screenshotCheck(this.$el),this.containFocus(this.$el)},activeDemo:function(){this.$el.toggleClass("active",this.model.get("active"))},containFocus:function(t){_.delay(function(){e(".theme-wrap a.button-primary:visible").focus()},100),t.on("keydown.wp-themes",function(e){var i=t.find(".theme-header button:not(.disabled)").first(),o=t.find(".theme-actions a:visible").last();9===e.which&&(i[0]===e.target&&e.shiftKey?(o.focus(),e.preventDefault()):o[0]!==e.target||e.shiftKey||(i.focus(),e.preventDefault()))})},collapse:function(i){var o,s=this;i=i||window.event,1!==t.data.demos.length&&(e(i.target).is(".theme-backdrop")||e(i.target).is(".close")||27===i.keyCode)&&(e("body").addClass("closing-overlay"),this.$el.fadeOut(130,function(){e("body").removeClass("closing-overlay"),s.closeOverlay(),o=document.body.scrollTop,t.router.navigate(t.router.baseUrl("")),document.body.scrollTop=o,t.focusedDemo&&t.focusedDemo.focus()}))},navigation:function(){this.model.cid===this.model.collection.at(0).cid&&this.$el.find(".left").addClass("disabled").prop("disabled",!0),this.model.cid===this.model.collection.at(this.model.collection.length-1).cid&&this.$el.find(".right").addClass("disabled").prop("disabled",!0)},closeOverlay:function(){e("body").removeClass("modal-open"),this.remove(),this.unbind(),this.trigger("demo:collapse")},importDemo:function(t){var i=this,o=e(t.target);t.preventDefault(),o.hasClass("disabled")||window.confirm(wp.demos.data.settings.confirmImport)&&(e(document).on("wp-demo-import-success",function(e,t){i.model.get("id")===t.slug&&i.model.set({imported:!0})}),e(document).on("wp-updates-queue-job",function(e,t){"import-demo"===t.action&&wp.updates.importDemo(t.data)}),wp.updates.importDemo({slug:o.data("slug")}))},deleteDemo:function(i){var o=this,s=this.model.collection,n=t;i.preventDefault(),window.confirm(wp.demos.data.settings.confirmDelete)&&(wp.updates.maybeRequestFilesystemCredentials(i),e(document).one("wp-demo-delete-success",function(t,i){o.$el.find(".close").trigger("click"),e('[data-slug="'+i.slug+'"').css({backgroundColor:"#faafaa"}).fadeOut(350,function(){e(this).remove(),n.data.demos=_.without(n.data.demos,_.findWhere(n.data.demos,{id:i.slug})),e(".wp-filter-search").val(""),s.doSearch(""),s.remove(o.model),s.trigger("demos:update")})}),wp.updates.deleteDemo({slug:this.model.get("id")}))},nextDemo:function(){var e=this;return e.trigger("demo:next",e.model.cid),!1},previousDemo:function(){var e=this;return e.trigger("demo:previous",e.model.cid),!1},screenshotCheck:function(e){var t,i;t=e.find(".screenshot img"),(i=new Image).src=t.attr("src"),i.width&&i.width<=300&&e.addClass("small-screenshot")}}),t.view.Demos=wp.Backbone.View.extend({className:"themes wp-clearfix",$overlay:e("div.theme-overlay"),index:0,count:e(".wrap .demo-count"),liveDemoCount:0,initialize:function(t){var i=this;this.parent=t.parent,i.importedDemo(),this.setView("grid"),this.listenTo(i.collection,"demos:update",function(){i.parent.page=0,i.importedDemo(),i.render(this),i.parent.initTipTip()}),this.listenTo(i.collection,"query:success",function(e){_.isNumber(e)?(i.count.text(e),i.announceSearchResults(e)):(i.count.text(i.collection.length),i.announceSearchResults(i.collection.length))}),this.listenTo(i.collection,"query:empty",function(){e("body").addClass("no-results")}),this.listenTo(this.parent,"demo:scroll",function(){i.renderDemos(i.parent.page)}),this.listenTo(this.parent,"demo:close",function(){i.overlay&&i.overlay.closeOverlay()}),e("body").on("keyup",function(t){i.overlay&&(e("#request-filesystem-credentials-dialog").is(":visible")||(39===t.keyCode&&i.overlay.nextDemo(),37===t.keyCode&&i.overlay.previousDemo(),27===t.keyCode&&i.overlay.collapse(t)))})},render:function(){this.$el.empty(),t.isPreview||1!==t.data.demos.length||(this.singleDemo=new t.view.Details({model:this.collection.models[0]}),this.singleDemo.render(),this.$el.addClass("single-theme"),this.$el.append(this.singleDemo.el)),this.options.collection.size()>0&&this.renderDemos(this.parent.page),this.liveDemoCount=this.collection.count?this.collection.count:this.collection.length,this.count.text(this.liveDemoCount)},renderDemos:function(e){var o=this;o.instance=o.collection.paginate(e),0!==o.instance.size()?(o.instance.each(function(e){o.demo=new t.view.Demo({model:e,parent:o}),o.demo.render(),o.$el.append(o.demo.el),o.listenTo(o.demo,"demo:expand",o.expand,o)}),!t.isPreview&&t.isInstall&&t.data.settings.canInstall&&this.$el.append('<div class="theme add-new-theme"><a href="'+t.data.settings.installURI+'"><div class="theme-screenshot"><span></span></div><h2 class="theme-name">'+i.addNew+"</h2></a></div>"),this.parent.page++):this.parent.trigger("demo:end")},importedDemo:function(){var e,t=this;(e=t.collection.findWhere({active:!0}))&&(t.collection.remove(e),t.collection.add(e,{at:0}))},setView:function(e){return e},expand:function(i){var o,s,n=this;this.model=n.collection.get(i),t.router.navigate(t.router.baseUrl(t.router.demoPath+this.model.id)),this.setView("detail"),e("body").addClass("modal-open"),this.overlay=new t.view.Details({model:n.model}),this.overlay.render(),this.model.get("hasUpdate")&&(o=e('[data-slug="'+this.model.id+'"]'),s=e(this.overlay.el),o.find(".updating-message").length?(s.find(".notice-warning h3").remove(),s.find(".notice-warning").removeClass("notice-large").addClass("updating-message").find("p").text(wp.updates.l10n.updating)):o.find(".notice-error").length&&s.find(".notice-warning").remove()),this.$overlay.html(this.overlay.el),this.listenTo(this.overlay,"demo:next",function(){n.next([n.model.cid])}).listenTo(this.overlay,"demo:previous",function(){n.previous([n.model.cid])})},next:function(e){var t,i,o=this;t=o.collection.get(e[0]),(i=o.collection.at(o.collection.indexOf(t)+1))!==undefined&&(this.overlay.closeOverlay(),o.demo.trigger("demo:expand",i.cid))},previous:function(e){var t,i,o=this;t=o.collection.get(e[0]),(i=o.collection.at(o.collection.indexOf(t)-1))!==undefined&&(this.overlay.closeOverlay(),o.demo.trigger("demo:expand",i.cid))},announceSearchResults:function(e){0===e?wp.a11y.speak(i.noDemosFound):wp.a11y.speak(i.demosFound.replace("%d",e))}}),t.view.Search=wp.Backbone.View.extend({tagName:"input",className:"wp-filter-search",id:"wp-filter-search-input",searching:!1,attributes:{placeholder:i.searchPlaceholder,type:"search","aria-describedby":"live-search-desc"},events:{input:"search",keyup:"search",blur:"pushState"},initialize:function(e){this.parent=e.parent,this.listenTo(this.parent,"demo:close",function(){this.searching=!1})},search:function(e){"keyup"===e.type&&27===e.which&&(e.target.value=""),this.doSearch(e)},doSearch:_.debounce(function(e){var i={};this.collection.doSearch(e.target.value),this.searching&&13!==e.which?i.replace=!0:this.searching=!0,e.target.value?t.router.navigate(t.router.baseUrl(t.router.searchPath+e.target.value),i):t.router.navigate(t.router.baseUrl(""))},500),pushState:function(e){var i=t.router.baseUrl("");e.target.value&&(i=t.router.baseUrl(t.router.searchPath+e.target.value)),this.searching=!1,t.router.navigate(i)}}),t.Router=Backbone.Router.extend({routes:{"themes.php?page=demo-importer&demo=:slug":"demo","themes.php?page=demo-importer&search=:query":"search","themes.php?page=demo-importer&s=:query":"search","themes.php?page=demo-importer":"demos","":"demos"},baseUrl:function(e){return"themes.php?page=demo-importer"+e},demoPath:"&demo=",searchPath:"&search=",search:function(t){e(".wp-filter-search").val(t)},demos:function(){e(".wp-filter-search").val("")},navigate:function(){Backbone.history._hasPushState&&Backbone.Router.prototype.navigate.apply(this,arguments)}}),t.Run={init:function(){this.demos=new t.Collection(t.data.demos),this.view=new t.view.Appearance({collection:this.demos}),this.render()},render:function(){this.view.render(),this.view.initTipTip(),this.routes(),Backbone.history.start({root:t.data.settings.adminUrl,pushState:!0,hashChange:!1})},routes:function(){var i=this;t.router=new t.Router,t.router.on("route:demo",function(e){i.view.view.expand(e)}),t.router.on("route:demos",function(){i.demos.doSearch(""),i.view.trigger("demo:close")}),t.router.on("route:search",function(){e(".wp-filter-search").trigger("keyup")}),this.extraRoutes()},extraRoutes:function(){return!1}},t.view.Installer=t.view.Appearance.extend({el:"#wpbody-content .wrap",render:function(){this.search(),this.uploader(),this.view=new t.view.Demos({collection:this.collection,parent:this}),this.$el.find(".themes").remove(),this.view.render(),this.$el.find(".theme-browser").append(this.view.el).addClass("rendered")},uploader:function(){var t=e(".upload-view-toggle"),i=e(document.body);t.on("click",function(){i.toggleClass("show-upload-view"),t.attr("aria-expanded",i.hasClass("show-upload-view"))})},clearSearch:function(){e("#wp-filter-search-input").val("")}}),t.InstallerRouter=Backbone.Router.extend({routes:{"themes.php?page=demo-importer&browse=uploads&demo=:slug":"demo","themes.php?page=demo-importer&browse=:sort&search=:query":"search","themes.php?page=demo-importer&browse=:sort&s=:query":"search","themes.php?page=demo-importer&browse=welcome":"sort","themes.php?page=demo-importer&browse=:sort":"demos","themes.php?page=demo-importer":"sort"},browse:function(){return t.isPreview?"preview":"uploads"},baseUrl:function(e){return"themes.php?page=demo-importer&browse="+this.browse()+e},demoPath:"&demo=",searchPath:"&search=",search:function(t,i){e(".wp-filter-search").val(i)},demos:function(){e(".wp-filter-search").val("")},navigate:function(){Backbone.history._hasPushState&&Backbone.Router.prototype.navigate.apply(this,arguments)}}),t.RunInstaller={init:function(){this.demos=new t.Collection(t.data.demos),this.view=new t.view.Installer({collection:this.demos}),this.render()},render:function(){this.view.render(),this.view.initTipTip(),this.routes(),Backbone.history.start({root:t.data.settings.adminUrl,pushState:!0,hashChange:!1})},routes:function(){var i=this;t.router=new t.InstallerRouter,t.router.on("route:demo",function(e){i.view.view.expand(e)}),t.router.on("route:demos",function(){i.demos.doSearch(""),i.view.trigger("demo:close")}),t.router.on("route:sort",function(t){t&&"welcome"!==t||e(".wp-filter-search").hide()}),t.router.on("route:search",function(){e(".wp-filter-search").focus().trigger("keyup")}),this.extraRoutes()},extraRoutes:function(){return!1}},e(document).ready(function(){t.isInstall?t.RunInstaller.init():t.Run.init(),e(".themegrill-demo-importer-rating-link").on("click",function(){var i=e(this);e.post(t.data.settings.ajaxUrl,{action:"footer-text-rated"}),i.parent().text(i.data("rated"))}),e(".themegrill-reset-wordpress").on("click",function(){return window.confirm(t.data.settings.confirmReset)}),e("#contextual-help-link").on("click",function(){var t=e("#tab-panel-themegrill_demo_importer_guided_tour_tab iframe");t.attr("src",t.data("src"))})})}(jQuery);
1
+ window.wp=window.wp||{},function(e){var t,i;(t=wp.demos=wp.demos||{}).data=demoImporterLocalizeScript,i=t.data.l10n,t.isPreview=!!t.data.settings.isPreview,t.isInstall=!!t.data.settings.isInstall,_.extend(t,{model:{},view:{},routes:{},router:{},template:wp.template}),t.Model=Backbone.Model.extend({initialize:function(){var e;-1!==_.indexOf(t.data.installedDemos,this.get("slug"))&&this.set({installed:!0}),this.set({id:this.get("slug")||this.get("id")}),this.has("sections")&&(e=this.get("sections").description,this.set({description:e}))}}),t.view.Appearance=wp.Backbone.View.extend({el:"#wpbody-content .wrap .theme-browser",window:e(window),page:0,initialize:function(e){_.bindAll(this,"scroller"),this.SearchView=e.SearchView?e.SearchView:t.view.Search,this.window.bind("scroll",_.throttle(this.scroller,300))},render:function(){this.view=new t.view.Demos({collection:this.collection,parent:this}),this.search(),this.view.render(),this.$el.empty().append(this.view.el).addClass("rendered")},searchContainer:e(".search-form"),search:function(){var o,s=this;1!==t.data.demos.length&&((o=new this.SearchView({collection:s.collection,parent:this})).render(),this.searchContainer.append(e.parseHTML('<label class="screen-reader-text" for="wp-filter-search-input">'+i.search+"</label>")).append(o.el))},scroller:function(){var e,t,i=this;e=this.window.scrollTop()+i.window.height(),t=i.$el.offset().top+i.$el.outerHeight(!1)-i.window.height(),e>(t=Math.round(.9*t))&&this.trigger("demo:scroll")},initTipTip:function(){e("#tiptip_holder").removeAttr("style"),e("#tiptip_arrow").removeAttr("style"),e(".tips").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:50})}}),t.Collection=Backbone.Collection.extend({model:t.Model,terms:"",doSearch:function(i){this.terms!==i&&(this.terms=i,this.terms.length>0&&this.search(this.terms),""===this.terms&&(this.reset(t.data.demos),e("body").removeClass("no-results")),this.trigger("demos:update"))},search:function(i){var o,s,n,a,r,l;this.reset(t.data.demos,{silent:!0}),i=i.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\amp;"),i=i.replace(/ /g,")(?=.*"),o=new RegExp("^(?=.*"+i+").+","i"),0===(s=this.filter(function(e){return a=e.get("name").replace(/(<([^>]+)>)/gi,""),r=e.get("description").replace(/(<([^>]+)>)/gi,""),l=e.get("author").replace(/(<([^>]+)>)/gi,""),n=_.union([a,e.get("id"),r,l,e.get("tags")]),o.test(e.get("author"))&&i.length>2&&e.set("displayAuthor",!0),o.test(n)})).length?this.trigger("query:empty"):e("body").removeClass("no-results"),this.reset(s)},paginate:function(e){var t=this;return e=e||0,t=_(t.rest(20*e)),t=_(t.first(20))}}),t.view.Demo=wp.Backbone.View.extend({className:"theme",state:"grid",html:t.template(t.isPreview?"demo-preview":"demo"),events:{click:"expand",keydown:"expand",touchend:"expand",keyup:"addFocus",touchmove:"preventExpand","click .demo-import":"importDemo"},touchDrag:!1,initialize:function(){this.model.on("change",this.render,this)},render:function(){var e=this.model.toJSON();this.$el.html(this.html(e)).attr({tabindex:0,"aria-describedby":e.id+"-action "+e.id+"-name","data-slug":e.id}),this.activeDemo(),this.model.get("displayAuthor")&&this.$el.addClass("display-author")},activeDemo:function(){this.model.get("active")&&this.$el.addClass("active")},addFocus:function(){var t=e(":focus").hasClass("theme")?e(":focus"):e(":focus").parents(".theme");e(".theme.focus").removeClass("focus"),t.addClass("focus")},expand:function(i){var o=this;if(!t.isPreview&&("keydown"!==(i=i||window.event).type||13===i.which||32===i.which))return!0===this.touchDrag?this.touchDrag=!1:void(e(i.target).is(".theme-actions a")||e(i.target).is(".theme-actions a, .update-message, .button-link, .notice-dismiss")||(t.focusedDemo=this.$el,this.trigger("demo:expand",o.model.cid)))},preventExpand:function(){this.touchDrag=!0},importDemo:function(t){var i=this,o=e(t.target);t.preventDefault(),o.hasClass("disabled")||window.confirm(wp.demos.data.settings.confirmImport)&&(e(document).on("wp-demo-import-success",function(e,t){i.model.get("id")===t.slug&&i.model.set({imported:!0})}),wp.updates.importDemo({slug:o.data("slug")}))}}),t.view.Details=wp.Backbone.View.extend({className:"theme-overlay",events:{click:"collapse","click .delete-demo":"deleteDemo","click .left":"previousDemo","click .right":"nextDemo","click .demo-import":"importDemo","click .plugins-install":"installPlugin"},html:t.template("demo-single"),render:function(){var e=this.model.toJSON();this.$el.html(this.html(e)),this.activeDemo(),this.navigation(),this.screenshotCheck(this.$el),this.containFocus(this.$el)},activeDemo:function(){this.$el.toggleClass("active",this.model.get("active"))},containFocus:function(t){_.delay(function(){e(".theme-wrap a.button-primary:visible").focus()},100),t.on("keydown.wp-themes",function(e){var i=t.find(".theme-header button:not(.disabled)").first(),o=t.find(".theme-actions a:visible").last();9===e.which&&(i[0]===e.target&&e.shiftKey?(o.focus(),e.preventDefault()):o[0]!==e.target||e.shiftKey||(i.focus(),e.preventDefault()))})},collapse:function(i){var o,s=this;i=i||window.event,1!==t.data.demos.length&&(e(i.target).is(".theme-backdrop")||e(i.target).is(".close")||27===i.keyCode)&&(e("body").addClass("closing-overlay"),this.$el.fadeOut(130,function(){e("body").removeClass("closing-overlay"),s.closeOverlay(),o=document.body.scrollTop,t.router.navigate(t.router.baseUrl("")),document.body.scrollTop=o,t.focusedDemo&&t.focusedDemo.focus()}))},navigation:function(){this.model.cid===this.model.collection.at(0).cid&&this.$el.find(".left").addClass("disabled").prop("disabled",!0),this.model.cid===this.model.collection.at(this.model.collection.length-1).cid&&this.$el.find(".right").addClass("disabled").prop("disabled",!0)},closeOverlay:function(){e("body").removeClass("modal-open"),this.remove(),this.unbind(),this.trigger("demo:collapse")},importDemo:function(t){var i=this,o=e(t.target);t.preventDefault(),o.hasClass("disabled")||window.confirm(wp.demos.data.settings.confirmImport)&&(e(document).on("wp-demo-import-success",function(e,t){i.model.get("id")===t.slug&&i.model.set({imported:!0})}),e(document).on("wp-updates-queue-job",function(e,t){"import-demo"===t.action&&wp.updates.importDemo(t.data)}),wp.updates.importDemo({slug:o.data("slug")}))},installPlugin:function(t){var i=e(document).find('input[name="required[]"], input[name="checked[]"]:checked'),o=e(t.target),s=0,n=0,a=[];t.preventDefault(),o.hasClass("disabled")||o.hasClass("updating-message")||(e(".theme-info .update-message").remove(),i.length||(t.preventDefault(),e(".theme-about").animate({scrollTop:0}),e(".theme-info .plugins-info").after(wp.updates.adminNotice({id:"no-items-selected",className:"update-message notice-error notice-alt",message:wp.updates.l10n.noItemsSelected}))),wp.updates.maybeRequestFilesystemCredentials(t),window.confirm(wp.demos.data.settings.confirmInstall)&&(e(document).find('.manage-column [type="checkbox"]').prop("checked",!1),e(document).trigger("wp-plugin-bulk-install",i),i.each(function(t,i){var s=e(i),n=s.parents("tr");n.hasClass("install")&&!n.find("notice-error").length?(o.addClass("updating-message").text(wp.updates.l10n.installing),wp.a11y.speak(wp.updates.l10n.installingMsg,"polite"),wp.updates.queue.push({action:"install-plugin",data:{slug:n.data("slug")}})):s.filter(":not(:disabled)").prop("checked",!1)}),e(document).on("wp-plugin-bulk-install-success wp-plugin-bulk-install-error",function(t,i){var r,l,d=e('[data-slug="'+i.slug+'"]');"wp-"+i.install+"-bulk-install-success"===t.type?s++:(l=i.pluginName?i.pluginName:d.find(".plugin-name").text(),n++,a.push(l+": "+i.errorMessage)),d.find('input[name="checked[]"]:checked').filter(":not(:disabled)").prop("checked",!1),wp.updates.adminNotice=wp.template("wp-bulk-installs-admin-notice"),e(".theme-info .bulk-action-notice").remove(),e(".theme-info .plugins-info").after(wp.updates.adminNotice({id:"bulk-action-notice",className:"bulk-action-notice notice-alt",successes:s,errors:n,errorMessages:a,type:i.install})),r=e("#bulk-action-notice").on("click","button",function(){e(this).toggleClass("bulk-action-errors-collapsed").attr("aria-expanded",!e(this).hasClass("bulk-action-errors-collapsed")),r.find(".bulk-action-errors").toggleClass("hidden")}),wp.updates.queue.length||(n>0?(o.removeClass("updating-message").addClass("disabled").text(wp.updates.l10n.installFailedShort),wp.a11y.speak(wp.updates.l10n.installedMsg,"polite"),e(".theme-about").animate({scrollTop:0})):(o.removeClass("updating-message").addClass("disabled").text(wp.updates.l10n.pluginInstalled),wp.a11y.speak(wp.updates.l10n.installedMsg,"polite"),e(".plugins-activate").removeAttr("disabled")))}),e(document).on("wp-updates-notice-added",function(){wp.updates.adminNotice=wp.template("wp-updates-admin-notice")}),wp.updates.queueChecker()))},deleteDemo:function(i){var o=this,s=this.model.collection,n=t;i.preventDefault(),window.confirm(wp.demos.data.settings.confirmDelete)&&(wp.updates.maybeRequestFilesystemCredentials(i),e(document).one("wp-demo-delete-success",function(t,i){o.$el.find(".close").trigger("click"),e('[data-slug="'+i.slug+'"').css({backgroundColor:"#faafaa"}).fadeOut(350,function(){e(this).remove(),n.data.demos=_.without(n.data.demos,_.findWhere(n.data.demos,{id:i.slug})),e(".wp-filter-search").val(""),s.doSearch(""),s.remove(o.model),s.trigger("demos:update")})}),wp.updates.deleteDemo({slug:this.model.get("id")}))},nextDemo:function(){var e=this;return e.trigger("demo:next",e.model.cid),!1},previousDemo:function(){var e=this;return e.trigger("demo:previous",e.model.cid),!1},screenshotCheck:function(e){var t,i;t=e.find(".screenshot img"),(i=new Image).src=t.attr("src"),i.width&&i.width<=300&&e.addClass("small-screenshot")}}),t.view.Demos=wp.Backbone.View.extend({className:"themes wp-clearfix",$overlay:e("div.theme-overlay"),index:0,count:e(".wrap .demo-count"),liveDemoCount:0,initialize:function(t){var i=this;this.parent=t.parent,i.importedDemo(),this.setView("grid"),this.listenTo(i.collection,"demos:update",function(){i.parent.page=0,i.importedDemo(),i.render(this),i.parent.initTipTip()}),this.listenTo(i.collection,"query:success",function(e){_.isNumber(e)?(i.count.text(e),i.announceSearchResults(e)):(i.count.text(i.collection.length),i.announceSearchResults(i.collection.length))}),this.listenTo(i.collection,"query:empty",function(){e("body").addClass("no-results")}),this.listenTo(this.parent,"demo:scroll",function(){i.renderDemos(i.parent.page)}),this.listenTo(this.parent,"demo:close",function(){i.overlay&&i.overlay.closeOverlay()}),e("body").on("keyup",function(t){i.overlay&&(e("#request-filesystem-credentials-dialog").is(":visible")||(39===t.keyCode&&i.overlay.nextDemo(),37===t.keyCode&&i.overlay.previousDemo(),27===t.keyCode&&i.overlay.collapse(t)))})},render:function(){this.$el.empty(),t.isPreview||1!==t.data.demos.length||(this.singleDemo=new t.view.Details({model:this.collection.models[0]}),this.singleDemo.render(),this.$el.addClass("single-theme"),this.$el.append(this.singleDemo.el)),this.options.collection.size()>0&&this.renderDemos(this.parent.page),this.liveDemoCount=this.collection.count?this.collection.count:this.collection.length,this.count.text(this.liveDemoCount)},renderDemos:function(e){var o=this;o.instance=o.collection.paginate(e),0!==o.instance.size()?(o.instance.each(function(e){o.demo=new t.view.Demo({model:e,parent:o}),o.demo.render(),o.$el.append(o.demo.el),o.listenTo(o.demo,"demo:expand",o.expand,o)}),!t.isPreview&&t.isInstall&&t.data.settings.canInstall&&this.$el.append('<div class="theme add-new-theme"><a href="'+t.data.settings.installURI+'"><div class="theme-screenshot"><span></span></div><h2 class="theme-name">'+i.addNew+"</h2></a></div>"),this.parent.page++):this.parent.trigger("demo:end")},importedDemo:function(){var e,t=this;(e=t.collection.findWhere({active:!0}))&&(t.collection.remove(e),t.collection.add(e,{at:0}))},setView:function(e){return e},expand:function(i){var o,s,n=this;this.model=n.collection.get(i),t.router.navigate(t.router.baseUrl(t.router.demoPath+this.model.id)),this.setView("detail"),e("body").addClass("modal-open"),this.overlay=new t.view.Details({model:n.model}),this.overlay.render(),this.model.get("hasUpdate")&&(o=e('[data-slug="'+this.model.id+'"]'),s=e(this.overlay.el),o.find(".updating-message").length?(s.find(".notice-warning h3").remove(),s.find(".notice-warning").removeClass("notice-large").addClass("updating-message").find("p").text(wp.updates.l10n.updating)):o.find(".notice-error").length&&s.find(".notice-warning").remove()),this.$overlay.html(this.overlay.el),this.listenTo(this.overlay,"demo:next",function(){n.next([n.model.cid])}).listenTo(this.overlay,"demo:previous",function(){n.previous([n.model.cid])})},next:function(e){var t,i,o=this;t=o.collection.get(e[0]),(i=o.collection.at(o.collection.indexOf(t)+1))!==undefined&&(this.overlay.closeOverlay(),o.demo.trigger("demo:expand",i.cid))},previous:function(e){var t,i,o=this;t=o.collection.get(e[0]),(i=o.collection.at(o.collection.indexOf(t)-1))!==undefined&&(this.overlay.closeOverlay(),o.demo.trigger("demo:expand",i.cid))},announceSearchResults:function(e){0===e?wp.a11y.speak(i.noDemosFound):wp.a11y.speak(i.demosFound.replace("%d",e))}}),t.view.Search=wp.Backbone.View.extend({tagName:"input",className:"wp-filter-search",id:"wp-filter-search-input",searching:!1,attributes:{placeholder:i.searchPlaceholder,type:"search","aria-describedby":"live-search-desc"},events:{input:"search",keyup:"search",blur:"pushState"},initialize:function(e){this.parent=e.parent,this.listenTo(this.parent,"demo:close",function(){this.searching=!1})},search:function(e){"keyup"===e.type&&27===e.which&&(e.target.value=""),this.doSearch(e)},doSearch:_.debounce(function(e){var i={};this.collection.doSearch(e.target.value),this.searching&&13!==e.which?i.replace=!0:this.searching=!0,e.target.value?t.router.navigate(t.router.baseUrl(t.router.searchPath+e.target.value),i):t.router.navigate(t.router.baseUrl(""))},500),pushState:function(e){var i=t.router.baseUrl("");e.target.value&&(i=t.router.baseUrl(t.router.searchPath+e.target.value)),this.searching=!1,t.router.navigate(i)}}),t.Router=Backbone.Router.extend({routes:{"themes.php?page=demo-importer&demo=:slug":"demo","themes.php?page=demo-importer&search=:query":"search","themes.php?page=demo-importer&s=:query":"search","themes.php?page=demo-importer":"demos","":"demos"},baseUrl:function(e){return"themes.php?page=demo-importer"+e},demoPath:"&demo=",searchPath:"&search=",search:function(t){e(".wp-filter-search").val(t)},demos:function(){e(".wp-filter-search").val("")},navigate:function(){Backbone.history._hasPushState&&Backbone.Router.prototype.navigate.apply(this,arguments)}}),t.Run={init:function(){this.demos=new t.Collection(t.data.demos),this.view=new t.view.Appearance({collection:this.demos}),this.render()},render:function(){this.view.render(),this.view.initTipTip(),this.routes(),Backbone.history.start({root:t.data.settings.adminUrl,pushState:!0,hashChange:!1})},routes:function(){var i=this;t.router=new t.Router,t.router.on("route:demo",function(e){i.view.view.expand(e)}),t.router.on("route:demos",function(){i.demos.doSearch(""),i.view.trigger("demo:close")}),t.router.on("route:search",function(){e(".wp-filter-search").trigger("keyup")}),this.extraRoutes()},extraRoutes:function(){return!1}},t.view.Installer=t.view.Appearance.extend({el:"#wpbody-content .wrap",render:function(){this.search(),this.uploader(),this.view=new t.view.Demos({collection:this.collection,parent:this}),this.$el.find(".themes").remove(),this.view.render(),this.$el.find(".theme-browser").append(this.view.el).addClass("rendered")},uploader:function(){var t=e(".upload-view-toggle"),i=e(document.body);t.on("click",function(){i.toggleClass("show-upload-view"),t.attr("aria-expanded",i.hasClass("show-upload-view"))})},clearSearch:function(){e("#wp-filter-search-input").val("")}}),t.InstallerRouter=Backbone.Router.extend({routes:{"themes.php?page=demo-importer&browse=uploads&demo=:slug":"demo","themes.php?page=demo-importer&browse=:sort&search=:query":"search","themes.php?page=demo-importer&browse=:sort&s=:query":"search","themes.php?page=demo-importer&browse=welcome":"sort","themes.php?page=demo-importer&browse=:sort":"demos","themes.php?page=demo-importer":"sort"},browse:function(){return t.isPreview?"preview":"uploads"},baseUrl:function(e){return"themes.php?page=demo-importer&browse="+this.browse()+e},demoPath:"&demo=",searchPath:"&search=",search:function(t,i){e(".wp-filter-search").val(i)},demos:function(){e(".wp-filter-search").val("")},navigate:function(){Backbone.history._hasPushState&&Backbone.Router.prototype.navigate.apply(this,arguments)}}),t.RunInstaller={init:function(){this.demos=new t.Collection(t.data.demos),this.view=new t.view.Installer({collection:this.demos}),this.render()},render:function(){this.view.render(),this.view.initTipTip(),this.routes(),Backbone.history.start({root:t.data.settings.adminUrl,pushState:!0,hashChange:!1})},routes:function(){var i=this;t.router=new t.InstallerRouter,t.router.on("route:demo",function(e){i.view.view.expand(e)}),t.router.on("route:demos",function(){i.demos.doSearch(""),i.view.trigger("demo:close")}),t.router.on("route:sort",function(t){t&&"welcome"!==t||e(".wp-filter-search").hide()}),t.router.on("route:search",function(){e(".wp-filter-search").focus().trigger("keyup")}),this.extraRoutes()},extraRoutes:function(){return!1}},e(document).ready(function(){t.isInstall?t.RunInstaller.init():t.Run.init(),e(".themegrill-demo-importer-rating-link").on("click",function(){var i=e(this);e.post(t.data.settings.ajaxUrl,{action:"footer-text-rated"}),i.parent().text(i.data("rated"))}),e(".themegrill-reset-wordpress").on("click",function(){return window.confirm(t.data.settings.confirmReset)}),e("#contextual-help-link").on("click",function(){var t=e("#tab-panel-themegrill_demo_importer_guided_tour_tab iframe");t.attr("src",t.data("src"))}),e(document.body).on("click","thead .check-column :checkbox",function(t){var i=e(this),o=i.closest("table"),s=i.prop("checked"),n=t.shiftKey||i.data("wp-toggle");o.children("tbody").filter(":visible").children().children(".check-column").find(":checkbox").prop("checked",function(){return e(this).is(":hidden,:disabled")?!!e(this).data("checked"):n?!e(this).prop("checked"):!!s})})})}(jQuery);
assets/js/admin/demo-updates.js CHANGED
@@ -108,7 +108,7 @@
108
109
$document.trigger( 'wp-demo-import-success', response );
110
111
- $message = $card.find( '.button-primary' )
112
.removeClass( 'updating-message' )
113
.addClass( 'updated-message disabled' )
114
.attr( 'aria-label', wp.updates.l10n.demoImportedLabel.replace( '%s', response.demoName ) )
@@ -251,6 +251,101 @@
251
$document.trigger( 'wp-demo-delete-error', response );
252
};
253
254
/**
255
* Validates an AJAX response to ensure it's a proper object.
256
*
@@ -331,6 +426,10 @@
331
wp.updates.deleteDemo( job.data );
332
break;
333
334
default:
335
break;
336
}
108
109
$document.trigger( 'wp-demo-import-success', response );
110
111
+ $message = $card.find( '.button-primary:not(.plugins-install)' )
112
.removeClass( 'updating-message' )
113
.addClass( 'updated-message disabled' )
114
.attr( 'aria-label', wp.updates.l10n.demoImportedLabel.replace( '%s', response.demoName ) )
251
$document.trigger( 'wp-demo-delete-error', response );
252
};
253
254
+ /**
255
+ * Sends an Ajax request to the server to install a plugin.
256
+ *
257
+ * @param {object} args Arguments.
258
+ * @param {string} args.slug Plugin identifier in the WordPress.org Plugin repository.
259
+ * @param {bulkInstallPluginSuccess=} args.success Optional. Success callback. Default: wp.updates.bulkInstallPluginSuccess
260
+ * @param {bulkInstallPluginError=} args.error Optional. Error callback. Default: wp.updates.bulkInstallPluginError
261
+ * @return {$.promise} A jQuery promise that represents the request,
262
+ * decorated with an abort() method.
263
+ */
264
+ wp.updates.bulkInstallPlugin = function( args ) {
265
+ var $pluginRow = $( 'tr[data-slug="' + args.slug + '"]' ),
266
+ $message = $pluginRow.find( '.plugin-status span' );
267
+
268
+ args = _.extend( {
269
+ success: wp.updates.bulkInstallPluginSuccess,
270
+ error: wp.updates.bulkInstallPluginError
271
+ }, args );
272
+
273
+ if ( $message.html() !== wp.updates.l10n.installing ) {
274
+ $message.data( 'originaltext', $message.html() );
275
+ }
276
+
277
+ $message
278
+ .addClass( 'updating-message' )
279
+ .attr( 'aria-label', wp.updates.l10n.pluginInstallingLabel.replace( '%s', $pluginRow.data( 'name' ) ) )
280
+ .text( wp.updates.l10n.installing );
281
+
282
+ wp.a11y.speak( wp.updates.l10n.installingMsg, 'polite' );
283
+
284
+ $document.trigger( 'wp-plugin-bulk-installing', args );
285
+
286
+ return wp.updates.ajax( 'install-plugin', args );
287
+ };
288
+
289
+ /**
290
+ * Updates the UI appropriately after a successful plugin install.
291
+ *
292
+ * @typedef {object} installPluginSuccess
293
+ * @param {object} response Response from the server.
294
+ * @param {string} response.slug Slug of the installed plugin.
295
+ * @param {string} response.pluginName Name of the installed plugin.
296
+ * @param {string} response.activateUrl URL to activate the just installed plugin.
297
+ */
298
+ wp.updates.bulkInstallPluginSuccess = function( response ) {
299
+ var $pluginRow = $( 'tr[data-slug="' + response.slug + '"]' ).removeClass( 'install' ).addClass( 'installed' ),
300
+ $updateMessage = $pluginRow.find( '.plugin-status span' );
301
+
302
+ $updateMessage
303
+ .removeClass( 'updating-message install-now' )
304
+ .addClass( 'updated-message activate-now' )
305
+ .attr( 'aria-label', wp.updates.l10n.pluginInstalledLabel.replace( '%s', response.pluginName ) )
306
+ .text( wp.updates.l10n.pluginInstalled );
307
+
308
+ wp.a11y.speak( wp.updates.l10n.installedMsg, 'polite' );
309
+
310
+ $document.trigger( 'wp-plugin-bulk-install-success', response );
311
+ };
312
+
313
+ /**
314
+ * Updates the UI appropriately after a failed plugin install.
315
+ *
316
+ * @typedef {object} installPluginError
317
+ * @param {object} response Response from the server.
318
+ * @param {string} response.slug Slug of the plugin to be installed.
319
+ * @param {string=} response.pluginName Optional. Name of the plugin to be installed.
320
+ * @param {string} response.errorCode Error code for the error that occurred.
321
+ * @param {string} response.errorMessage The error that occurred.
322
+ */
323
+ wp.updates.bulkInstallPluginError = function( response ) {
324
+ var $pluginRow = $( 'tr[data-slug="' + response.slug + '"]' ),
325
+ $updateMessage = $pluginRow.find( '.plugin-status span' ),
326
+ errorMessage;
327
+
328
+ if ( ! wp.updates.isValidResponse( response, 'install' ) ) {
329
+ return;
330
+ }
331
+
332
+ if ( wp.updates.maybeHandleCredentialError( response, 'install-plugin' ) ) {
333
+ return;
334
+ }
335
+
336
+ errorMessage = wp.updates.l10n.installFailed.replace( '%s', response.errorMessage );
337
+
338
+ $updateMessage
339
+ .removeClass( 'updating-message' )
340
+ .addClass( 'updated-message' )
341
+ .attr( 'aria-label', wp.updates.l10n.pluginInstallFailedLabel.replace( '%s', $pluginRow.data( 'name' ) ) )
342
+ .text( wp.updates.l10n.installFailedShort );
343
+
344
+ wp.a11y.speak( errorMessage, 'assertive' );
345
+
346
+ $document.trigger( 'wp-plugin-bulk-install-error', response );
347
+ };
348
+
349
/**
350
* Validates an AJAX response to ensure it's a proper object.
351
*
426
wp.updates.deleteDemo( job.data );
427
break;
428
429
+ case 'install-plugin':
430
+ wp.updates.bulkInstallPlugin( job.data );
431
+ break;
432
+
433
default:
434
break;
435
}
assets/js/admin/demo-updates.min.js CHANGED
@@ -1 +1 @@
1
- !function(e,t,a){var s=e(document);(t=t||{}).updates=t.updates||{},t.updates.l10n=_.extend(t.updates.l10n,a.l10n||{}),t.updates.addAdminNotice=function(a){var d,r=e(a.selector),i=e(".wp-header-end");delete a.selector,d=t.updates.adminNotice(a),r.length||(r=e("#"+a.id)),r.length?r.replaceWith(d):i.length?e(".wp-header-end").after(d):e(".wrap").find("> h1").after(d),s.trigger("wp-updates-notice-added")},t.updates.importDemo=function(a){var d=e('.demo-import[data-slug="'+a.slug+'"]');return a=_.extend({success:t.updates.importDemoSuccess,error:t.updates.importDemoError},a),d.addClass("updating-message"),d.parents(".theme").addClass("focus"),d.html()!==t.updates.l10n.importing&&d.data("originaltext",d.html()),d.text(t.updates.l10n.importing).attr("aria-label",t.updates.l10n.demoImportingLabel.replace("%s",d.data("name"))),t.a11y.speak(t.updates.l10n.importingMsg,"polite"),e('.theme-info .theme-description, [data-slug="'+a.slug+'"]').removeClass("demo-import-failed").find(".notice.notice-error").remove(),s.trigger("wp-demo-importing",a),t.updates.ajax("import-demo",a)},t.updates.importDemoSuccess=function(a){var d,r=e(".theme-overlay, [data-slug="+a.slug+"]");s.trigger("wp-demo-import-success",a),d=r.find(".button-primary").removeClass("updating-message").addClass("updated-message disabled").attr("aria-label",t.updates.l10n.demoImportedLabel.replace("%s",a.demoName)).text(t.updates.l10n.imported),t.a11y.speak(t.updates.l10n.importedMsg,"polite"),setTimeout(function(){a.previewUrl&&(d.siblings(".demo-preview").remove(),d.attr("target","_blank").attr("href",a.previewUrl).removeClass("demo-import updated-message disabled").addClass("live-preview").attr("aria-label",t.updates.l10n.livePreviewLabel.replace("%s",a.demoName)).text(t.updates.l10n.livePreview))},1e3)},t.updates.importDemoError=function(a){var d,r=t.updates.l10n.importFailed.replace("%s",a.errorMessage),i=t.updates.adminNotice({className:"update-message notice-error notice-alt",message:r});t.updates.isValidResponse(a,"import")&&(s.find("body").hasClass("modal-open")||s.find(".themes").hasClass("single-theme")?(d=e('.demo-import[data-slug="'+a.slug+'"]'),e(".theme-info .theme-description").prepend(i)):d=e('[data-slug="'+a.slug+'"]').removeClass("focus").addClass("demo-import-failed").append(i).find(".demo-import"),d.removeClass("updating-message").attr("aria-label",t.updates.l10n.demoImportFailedLabel.replace("%s",d.data("name"))).text(t.updates.l10n.importFailedShort),t.a11y.speak(r,"assertive"),s.trigger("wp-demo-import-error",a))},t.updates.deleteDemo=function(a){var d=e(".theme-actions .delete-demo");return a=_.extend({success:t.updates.deleteDemoSuccess,error:t.updates.deleteDemoError},a),d&&d.html()!==t.updates.l10n.deleting&&d.data("originaltext",d.html()).text(t.updates.l10n.deleting),t.a11y.speak(t.updates.l10n.deleting,"polite"),e(".theme-info .update-message").remove(),s.trigger("wp-demo-deleting",a),t.updates.ajax("delete-demo",a)},t.updates.deleteDemoSuccess=function(e){t.a11y.speak(t.updates.l10n.deleted,"polite"),s.trigger("wp-demo-delete-success",e)},t.updates.deleteDemoError=function(a){var d=e(".theme-actions .delete-demo"),r=t.updates.l10n.deleteFailed.replace("%s",a.errorMessage),i=t.updates.adminNotice({className:"update-message notice-error notice-alt",message:r});t.updates.maybeHandleCredentialError(a,"delete-demo")||(e(".theme-info .theme-description").before(i),d.html(d.data("originaltext")),t.a11y.speak(r,"assertive"),s.trigger("wp-demo-delete-error",a))},t.updates.isValidResponse=function(a,s){var d,r=t.updates.l10n.unknownError;if(_.isObject(a)&&!_.isFunction(a.always))return!0;switch(_.isString(a)&&"-1"===a?r=t.updates.l10n.nonceError:_.isString(a)?r=a:"undefined"!=typeof a.readyState&&0===a.readyState?r=t.updates.l10n.connectionError:_.isString(a.statusText)&&(r=a.statusText+" "+t.updates.l10n.statusTextLink),s){case"import":d=t.updates.l10n.importFailed}return d=d.replace("%s",r),t.updates.addAdminNotice({id:"unknown_error",className:"notice-error is-dismissible",message:_.unescape(d)}),e(".button.updating-message").removeClass("updating-message").removeAttr("aria-label").text(t.updates.l10n.updateFailedShort),t.a11y.speak(d,"assertive"),!1},t.updates.queueChecker=function(){var e;if(!t.updates.ajaxLocked&&t.updates.queue.length){switch((e=t.updates.queue.shift()).action){case"import-demo":t.updates.importDemo(e.data);break;case"delete-demo":t.updates.deleteDemo(e.data)}s.trigger("wp-updates-queue-job",e)}}}(jQuery,window.wp,window._demoUpdatesSettings);
1
+ !function(e,a,t){var s=e(document);(a=a||{}).updates=a.updates||{},a.updates.l10n=_.extend(a.updates.l10n,t.l10n||{}),a.updates.addAdminNotice=function(t){var l,d=e(t.selector),r=e(".wp-header-end");delete t.selector,l=a.updates.adminNotice(t),d.length||(d=e("#"+t.id)),d.length?d.replaceWith(l):r.length?e(".wp-header-end").after(l):e(".wrap").find("> h1").after(l),s.trigger("wp-updates-notice-added")},a.updates.importDemo=function(t){var l=e('.demo-import[data-slug="'+t.slug+'"]');return t=_.extend({success:a.updates.importDemoSuccess,error:a.updates.importDemoError},t),l.addClass("updating-message"),l.parents(".theme").addClass("focus"),l.html()!==a.updates.l10n.importing&&l.data("originaltext",l.html()),l.text(a.updates.l10n.importing).attr("aria-label",a.updates.l10n.demoImportingLabel.replace("%s",l.data("name"))),a.a11y.speak(a.updates.l10n.importingMsg,"polite"),e('.theme-info .theme-description, [data-slug="'+t.slug+'"]').removeClass("demo-import-failed").find(".notice.notice-error").remove(),s.trigger("wp-demo-importing",t),a.updates.ajax("import-demo",t)},a.updates.importDemoSuccess=function(t){var l,d=e(".theme-overlay, [data-slug="+t.slug+"]");s.trigger("wp-demo-import-success",t),l=d.find(".button-primary:not(.plugins-install)").removeClass("updating-message").addClass("updated-message disabled").attr("aria-label",a.updates.l10n.demoImportedLabel.replace("%s",t.demoName)).text(a.updates.l10n.imported),a.a11y.speak(a.updates.l10n.importedMsg,"polite"),setTimeout(function(){t.previewUrl&&(l.siblings(".demo-preview").remove(),l.attr("target","_blank").attr("href",t.previewUrl).removeClass("demo-import updated-message disabled").addClass("live-preview").attr("aria-label",a.updates.l10n.livePreviewLabel.replace("%s",t.demoName)).text(a.updates.l10n.livePreview))},1e3)},a.updates.importDemoError=function(t){var l,d=a.updates.l10n.importFailed.replace("%s",t.errorMessage),r=a.updates.adminNotice({className:"update-message notice-error notice-alt",message:d});a.updates.isValidResponse(t,"import")&&(s.find("body").hasClass("modal-open")||s.find(".themes").hasClass("single-theme")?(l=e('.demo-import[data-slug="'+t.slug+'"]'),e(".theme-info .theme-description").prepend(r)):l=e('[data-slug="'+t.slug+'"]').removeClass("focus").addClass("demo-import-failed").append(r).find(".demo-import"),l.removeClass("updating-message").attr("aria-label",a.updates.l10n.demoImportFailedLabel.replace("%s",l.data("name"))).text(a.updates.l10n.importFailedShort),a.a11y.speak(d,"assertive"),s.trigger("wp-demo-import-error",t))},a.updates.deleteDemo=function(t){var l=e(".theme-actions .delete-demo");return t=_.extend({success:a.updates.deleteDemoSuccess,error:a.updates.deleteDemoError},t),l&&l.html()!==a.updates.l10n.deleting&&l.data("originaltext",l.html()).text(a.updates.l10n.deleting),a.a11y.speak(a.updates.l10n.deleting,"polite"),e(".theme-info .update-message").remove(),s.trigger("wp-demo-deleting",t),a.updates.ajax("delete-demo",t)},a.updates.deleteDemoSuccess=function(e){a.a11y.speak(a.updates.l10n.deleted,"polite"),s.trigger("wp-demo-delete-success",e)},a.updates.deleteDemoError=function(t){var l=e(".theme-actions .delete-demo"),d=a.updates.l10n.deleteFailed.replace("%s",t.errorMessage),r=a.updates.adminNotice({className:"update-message notice-error notice-alt",message:d});a.updates.maybeHandleCredentialError(t,"delete-demo")||(e(".theme-info .theme-description").before(r),l.html(l.data("originaltext")),a.a11y.speak(d,"assertive"),s.trigger("wp-demo-delete-error",t))},a.updates.bulkInstallPlugin=function(t){var l=e('tr[data-slug="'+t.slug+'"]'),d=l.find(".plugin-status span");return t=_.extend({success:a.updates.bulkInstallPluginSuccess,error:a.updates.bulkInstallPluginError},t),d.html()!==a.updates.l10n.installing&&d.data("originaltext",d.html()),d.addClass("updating-message").attr("aria-label",a.updates.l10n.pluginInstallingLabel.replace("%s",l.data("name"))).text(a.updates.l10n.installing),a.a11y.speak(a.updates.l10n.installingMsg,"polite"),s.trigger("wp-plugin-bulk-installing",t),a.updates.ajax("install-plugin",t)},a.updates.bulkInstallPluginSuccess=function(t){e('tr[data-slug="'+t.slug+'"]').removeClass("install").addClass("installed").find(".plugin-status span").removeClass("updating-message install-now").addClass("updated-message activate-now").attr("aria-label",a.updates.l10n.pluginInstalledLabel.replace("%s",t.pluginName)).text(a.updates.l10n.pluginInstalled),a.a11y.speak(a.updates.l10n.installedMsg,"polite"),s.trigger("wp-plugin-bulk-install-success",t)},a.updates.bulkInstallPluginError=function(t){var l,d=e('tr[data-slug="'+t.slug+'"]'),r=d.find(".plugin-status span");a.updates.isValidResponse(t,"install")&&(a.updates.maybeHandleCredentialError(t,"install-plugin")||(l=a.updates.l10n.installFailed.replace("%s",t.errorMessage),r.removeClass("updating-message").addClass("updated-message").attr("aria-label",a.updates.l10n.pluginInstallFailedLabel.replace("%s",d.data("name"))).text(a.updates.l10n.installFailedShort),a.a11y.speak(l,"assertive"),s.trigger("wp-plugin-bulk-install-error",t)))},a.updates.isValidResponse=function(t,s){var l,d=a.updates.l10n.unknownError;if(_.isObject(t)&&!_.isFunction(t.always))return!0;switch(_.isString(t)&&"-1"===t?d=a.updates.l10n.nonceError:_.isString(t)?d=t:"undefined"!=typeof t.readyState&&0===t.readyState?d=a.updates.l10n.connectionError:_.isString(t.statusText)&&(d=t.statusText+" "+a.updates.l10n.statusTextLink),s){case"import":l=a.updates.l10n.importFailed}return l=l.replace("%s",d),a.updates.addAdminNotice({id:"unknown_error",className:"notice-error is-dismissible",message:_.unescape(l)}),e(".button.updating-message").removeClass("updating-message").removeAttr("aria-label").text(a.updates.l10n.updateFailedShort),a.a11y.speak(l,"assertive"),!1},a.updates.queueChecker=function(){var e;if(!a.updates.ajaxLocked&&a.updates.queue.length){switch((e=a.updates.queue.shift()).action){case"import-demo":a.updates.importDemo(e.data);break;case"delete-demo":a.updates.deleteDemo(e.data);break;case"install-plugin":a.updates.bulkInstallPlugin(e.data)}s.trigger("wp-updates-queue-job",e)}}}(jQuery,window.wp,window._demoUpdatesSettings);
composer.lock DELETED
@@ -1,295 +0,0 @@
1
- {
2
- "_readme": [
3
- "This file locks the dependencies of your project to a known state",
4
- "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5
- "This file is @generated automatically"
6
- ],
7
- "hash": "dc8868b0f068d03c4a1ea5221933732b",
8
- "content-hash": "e902d62f93fd8f9f14910ae4a1e8a26f",
9
- "packages": [
10
- {
11
- "name": "composer/installers",
12
- "version": "v1.2.0",
13
- "source": {
14
- "type": "git",
15
- "url": "https://github.com/composer/installers.git",
16
- "reference": "d78064c68299743e0161004f2de3a0204e33b804"
17
- },
18
- "dist": {
19
- "type": "zip",
20
- "url": "https://api.github.com/repos/composer/installers/zipball/d78064c68299743e0161004f2de3a0204e33b804",
21
- "reference": "d78064c68299743e0161004f2de3a0204e33b804",
22
- "shasum": ""
23
- },
24
- "require": {
25
- "composer-plugin-api": "^1.0"
26
- },
27
- "replace": {
28
- "roundcube/plugin-installer": "*",
29
- "shama/baton": "*"
30
- },
31
- "require-dev": {
32
- "composer/composer": "1.0.*@dev",
33
- "phpunit/phpunit": "4.1.*"
34
- },
35
- "type": "composer-plugin",
36
- "extra": {
37
- "class": "Composer\\Installers\\Plugin",
38
- "branch-alias": {
39
- "dev-master": "1.0-dev"
40
- }
41
- },
42
- "autoload": {
43
- "psr-4": {
44
- "Composer\\Installers\\": "src/Composer/Installers"
45
- }
46
- },
47
- "notification-url": "https://packagist.org/downloads/",
48
- "license": [
49
- "MIT"
50
- ],
51
- "authors": [
52
- {
53
- "name": "Kyle Robinson Young",
54
- "email": "kyle@dontkry.com",
55
- "homepage": "https://github.com/shama"
56
- }
57
- ],
58
- "description": "A multi-framework Composer library installer",
59
- "homepage": "https://composer.github.io/installers/",
60
- "keywords": [
61
- "Craft",
62
- "Dolibarr",
63
- "Hurad",
64
- "ImageCMS",
65
- "MODX Evo",
66
- "Mautic",
67
- "OXID",
68
- "Plentymarkets",
69
- "RadPHP",
70
- "SMF",
71
- "Thelia",
72
- "WolfCMS",
73
- "agl",
74
- "aimeos",
75
- "annotatecms",
76
- "attogram",
77
- "bitrix",
78
- "cakephp",
79
- "chef",
80
- "cockpit",
81
- "codeigniter",
82
- "concrete5",
83
- "croogo",
84
- "dokuwiki",
85
- "drupal",
86
- "elgg",
87
- "expressionengine",
88
- "fuelphp",
89
- "grav",
90
- "installer",
91
- "joomla",
92
- "kohana",
93
- "laravel",
94
- "lithium",
95
- "magento",
96
- "mako",
97
- "mediawiki",
98
- "modulework",
99
- "moodle",
100
- "phpbb",
101
- "piwik",
102
- "ppi",
103
- "puppet",
104
- "reindex",
105
- "roundcube",
106
- "shopware",
107
- "silverstripe",
108
- "symfony",
109
- "typo3",
110
- "wordpress",
111
- "yawik",
112
- "zend",
113
- "zikula"
114
- ],
115
- "time": "2016-08-13 20:53:52"
116
- }
117
- ],
118
- "packages-dev": [
119
- {
120
- "name": "simplyadmire/composer-plugins",
121
- "version": "dev-master",
122
- "source": {
123
- "type": "git",
124
- "url": "https://github.com/SimplyAdmire/ComposerPlugins.git",
125
- "reference": "d8380f670694c1c2330b22591ca74adc82cffe19"
126
- },
127
- "dist": {
128
- "type": "zip",
129
- "url": "https://api.github.com/repos/SimplyAdmire/ComposerPlugins/zipball/d8380f670694c1c2330b22591ca74adc82cffe19",
130
- "reference": "d8380f670694c1c2330b22591ca74adc82cffe19",
131
- "shasum": ""
132
- },
133
- "require": {
134
- "composer-plugin-api": "^1.0",
135
- "squizlabs/php_codesniffer": "*"
136
- },
137
- "type": "composer-plugin",
138
- "extra": {
139
- "class": [
140
- "SimplyAdmire\\ComposerPlugins\\PhpCodesnifferStandardInstallerPlugin"
141
- ]
142
- },
143
- "autoload": {
144
- "psr-0": {
145
- "SimplyAdmire\\ComposerPlugins": ""
146
- }
147
- },
148
- "notification-url": "https://packagist.org/downloads/",
149
- "license": [
150
- "LGPL-3.0+"
151
- ],
152
- "authors": [
153
- {
154
- "name": "Rens Admiraal",
155
- "email": "rens@simplyadmire.com",
156
- "role": "lead"
157
- }
158
- ],
159
- "description": "Composer plugin for installing PHP_CodeSniffer standards",
160
- "keywords": [
161
- "PHP_CodeSniffer",
162
- "TYPO3 CMS",
163
- "TYPO3 Flow",
164
- "TYPO3 Neos",
165
- "phpcs",
166
- "standards",
167
- "typo3"
168
- ],
169
- "time": "2016-05-12 11:58:38"
170
- },
171
- {
172
- "name": "squizlabs/php_codesniffer",
173
- "version": "2.7.0",
174
- "source": {
175
- "type": "git",
176
- "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
177
- "reference": "571e27b6348e5b3a637b2abc82ac0d01e6d7bbed"
178
- },
179
- "dist": {
180
- "type": "zip",
181
- "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/571e27b6348e5b3a637b2abc82ac0d01e6d7bbed",
182
- "reference": "571e27b6348e5b3a637b2abc82ac0d01e6d7bbed",
183
- "shasum": ""
184
- },
185
- "require": {
186
- "ext-simplexml": "*",
187
- "ext-tokenizer": "*",
188
- "ext-xmlwriter": "*",
189
- "php": ">=5.1.2"
190
- },
191
- "require-dev": {
192
- "phpunit/phpunit": "~4.0"
193
- },
194
- "bin": [
195
- "scripts/phpcs",
196
- "scripts/phpcbf"
197
- ],
198
- "type": "library",
199
- "extra": {
200
- "branch-alias": {
201
- "dev-master": "2.x-dev"
202
- }
203
- },
204
- "autoload": {
205
- "classmap": [
206
- "CodeSniffer.php",
207
- "CodeSniffer/CLI.php",
208
- "CodeSniffer/Exception.php",
209
- "CodeSniffer/File.php",
210
- "CodeSniffer/Fixer.php",
211
- "CodeSniffer/Report.php",
212
- "CodeSniffer/Reporting.php",
213
- "CodeSniffer/Sniff.php",
214
- "CodeSniffer/Tokens.php",
215
- "CodeSniffer/Reports/",
216
- "CodeSniffer/Tokenizers/",
217
- "CodeSniffer/DocGenerators/",
218
- "CodeSniffer/Standards/AbstractPatternSniff.php",
219
- "CodeSniffer/Standards/AbstractScopeSniff.php",
220
- "CodeSniffer/Standards/AbstractVariableSniff.php",
221
- "CodeSniffer/Standards/IncorrectPatternException.php",
222
- "CodeSniffer/Standards/Generic/Sniffs/",
223
- "CodeSniffer/Standards/MySource/Sniffs/",
224
- "CodeSniffer/Standards/PEAR/Sniffs/",
225
- "CodeSniffer/Standards/PSR1/Sniffs/",
226
- "CodeSniffer/Standards/PSR2/Sniffs/",
227
- "CodeSniffer/Standards/Squiz/Sniffs/",
228
- "CodeSniffer/Standards/Zend/Sniffs/"
229
- ]
230
- },
231
- "notification-url": "https://packagist.org/downloads/",
232
- "license": [
233
- "BSD-3-Clause"
234
- ],
235
- "authors": [
236
- {
237
- "name": "Greg Sherwood",
238
- "role": "lead"
239
- }
240
- ],
241
- "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
242
- "homepage": "http://www.squizlabs.com/php-codesniffer",
243
- "keywords": [
244
- "phpcs",
245
- "standards"
246
- ],
247
- "time": "2016-09-01 23:53:02"
248
- },
249
- {
250
- "name": "wp-coding-standards/wpcs",
251
- "version": "0.10.0",
252
- "source": {
253
- "type": "git",
254
- "url": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git",
255
- "reference": "b39490465f6fd7375743a395019cd597e12119c9"
256
- },
257
- "dist": {
258
- "type": "zip",
259
- "url": "https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/zipball/b39490465f6fd7375743a395019cd597e12119c9",
260
- "reference": "b39490465f6fd7375743a395019cd597e12119c9",
261
- "shasum": ""
262
- },
263
- "require": {
264
- "squizlabs/php_codesniffer": "^2.6"
265
- },
266
- "type": "library",
267
- "notification-url": "https://packagist.org/downloads/",
268
- "license": [
269
- "MIT"
270
- ],
271
- "authors": [
272
- {
273
- "name": "Contributors",
274
- "homepage": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/graphs/contributors"
275
- }
276
- ],
277
- "description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions",
278
- "keywords": [
279
- "phpcs",
280
- "standards",
281
- "wordpress"
282
- ],
283
- "time": "2016-08-29 20:04:47"
284
- }
285
- ],
286
- "aliases": [],
287
- "minimum-stability": "stable",
288
- "stability-flags": {
289
- "simplyadmire/composer-plugins": 20
290
- },
291
- "prefer-stable": false,
292
- "prefer-lowest": false,
293
- "platform": [],
294
- "platform-dev": []
295
- }
includes/{includes/admin → admin}/class-demo-installer-skin.php RENAMED
File without changes
includes/{includes/admin → admin}/class-demo-upgrader.php RENAMED
File without changes
includes/{includes/admin → admin}/views/html-admin-page-importer.php RENAMED
@@ -167,48 +167,73 @@ if ( ! defined( 'ABSPATH' ) ) {
167
168
<h3 class="plugins-info"><?php _e( 'Plugins Information', 'themegrill-demo-importer' ); ?></h3>
169
170
- <table class="plugins-list-table widefat">
171
- <thead>
172
- <tr>
173
- <th class="plugin-name"><?php esc_html_e( 'Plugin Name', 'themegrill-demo-importer' ); ?></th>
174
- <th class="plugin-type"><?php esc_html_e( 'Type', 'themegrill-demo-importer' ); ?></th>
175
- <th class="plugin-status"><?php esc_html_e( 'Status', 'themegrill-demo-importer' ); ?></th>
176
- </tr>
177
- </thead>
178
- <tbody>
179
- <# if ( ! _.isEmpty( data.plugins ) ) { #>
180
- <# _.each( data.plugins, function( plugin, slug ) { #>
181
- <tr>
182
- <td class="plugin-name">
183
- <# if ( plugin.link ) { #>
184
- <a href="{{{ plugin.link }}}" target="_blank">{{{ plugin.name }}}</a>
185
- <# } else { #>
186
- <a href="<?php echo esc_url( admin_url( 'plugin-install.php?tab=search&type=term&s=' ) ); ?>{{ slug }}" target="_blank">{{ plugin.name }}</a>
187
- <# } #>
188
- </td>
189
- <td class="plugin-type">
190
- <# if ( plugin.required ) { #>
191
- <span class="required"><?php esc_html_e( 'Required', 'themegrill-demo-importer' ); ?></span>
192
- <# } else { #>
193
- <span class="recommended"><?php esc_html_e( 'Recommended', 'themegrill-demo-importer' ); ?></span>
194
- <# } #>
195
- </td>
196
- <td class="plugin-status">
197
- <# if ( plugin.is_active ) { #>
198
- <mark class="yes"><span class="dashicons dashicons-yes"></span></mark>
199
- <# } else { #>
200
- <mark class="error"><span class="dashicons dashicons-no-alt"></span></mark>
201
- <# } #>
202
- </td>
203
</tr>
204
- <# }); #>
205
- <# } else { #>
206
<tr>
207
- <td class="plugins-list-table-blank-state" colspan="3"><p><?php _e( 'No plugins are needed to import this demo.', 'themegrill-demo-importer' ); ?></p></td>
208
</tr>
209
- <# } #>
210
- </tbody>
211
- </table>
212
213
<# if ( data.tags ) { #>
214
<p class="theme-tags"><span><?php _e( 'Tags:', 'themegrill-demo-importer' ); ?></span> {{{ data.tags }}}</p>
@@ -245,3 +270,4 @@ if ( ! defined( 'ABSPATH' ) ) {
245
<?php
246
wp_print_request_filesystem_credentials_modal();
247
wp_print_admin_notice_templates();
167
168
<h3 class="plugins-info"><?php _e( 'Plugins Information', 'themegrill-demo-importer' ); ?></h3>
169
170
+ <form method="post" id="bulk-action-form">
171
+ <?php wp_nonce_field( 'bulk-plugins-activate' ); ?>
172
+ <table class="plugins-list-table widefat striped">
173
+ <thead>
174
+ <tr>
175
+ <td id="cb" class="manage-column check-column">
176
+ <label class="screen-reader-text" for="cb-select-all-1"><?php esc_html_e( 'Select All', 'themegrill-demo-importer' ); ?></label>
177
+ <input id="cb-select-all-1" type="checkbox">
178
+ </td>
179
+ <th scope="col" class="manage-column plugin-name"><?php esc_html_e( 'Plugin Name', 'themegrill-demo-importer' ); ?></th>
180
+ <th scope="col" class="manage-column plugin-type"><?php esc_html_e( 'Type', 'themegrill-demo-importer' ); ?></th>
181
+ <th scope="col" class="manage-column plugin-status"><?php esc_html_e( 'Status', 'themegrill-demo-importer' ); ?></th>
182
+ </tr>
183
+ </thead>
184
+ <tbody id="the-list">
185
+ <# if ( ! _.isEmpty( data.plugins ) ) { #>
186
+ <# _.each( data.plugins, function( plugin, slug ) { #>
187
+ <# var checkboxIdPrefix = _.uniqueId( 'checkbox_' ) #>
188
+ <tr class="plugin<# if ( ! plugin.is_install ) { #> install<# } #>" data-slug="{{ slug }}" data-plugin="{{ plugin.slug }}" data-name="{{ plugin.name }}">
189
+ <th scope="row" class="check-column">
190
+ <label class="screen-reader-text" for="{{ checkboxIdPrefix }}"><?php printf( __( 'Select %s', 'themegrill-demo-importer' ), '{{ plugin.name }}' ); ?></label>
191
+ <input type="checkbox" name="checked[]" value="{{ plugin.slug }}" id="{{ checkboxIdPrefix }}"<# if ( plugin.required ) { #> data-checked="1" checked="checked" disabled="disabled"<# } #>>
192
+ <# if ( plugin.required ) { #>
193
+ <input type="hidden" name="checked[]" value="{{ plugin.slug }}">
194
+ <# } #>
195
+ </th>
196
+ <td class="plugin-name">
197
+ <# if ( plugin.link ) { #>
198
+ <a href="{{{ plugin.link }}}" target="_blank">{{{ plugin.name }}}</a>
199
+ <# } else { #>
200
+ <a href="<?php printf( esc_url( 'https://wordpress.org/plugins/%s' ), '{{ slug }}' ); ?>" target="_blank">{{ plugin.name }}</a>
201
+ <# } #>
202
+ </td>
203
+ <td class="plugin-type">
204
+ <# if ( plugin.required ) { #>
205
+ <abbr class="required"><?php esc_html_e( 'Required', 'themegrill-demo-importer' ); ?></abbr>
206
+ <# } else { #>
207
+ <abbr class="recommended"><?php esc_html_e( 'Recommended', 'themegrill-demo-importer' ); ?></abbr>
208
+ <# } #>
209
+ </td>
210
+ <td class="plugin-status">
211
+ <# if ( plugin.is_active && plugin.is_install ) { #>
212
+ <span class="active"><?php esc_html_e( 'Active', 'themegrill-demo-importer' ); ?></span>
213
+ <# } else if ( plugin.is_install ) { #>
214
+ <span class="activate-now"><?php esc_html_e( 'Activate', 'themegrill-demo-importer' ); ?></span>
215
+ <# } else { #>
216
+ <span class="install-now"><?php esc_html_e( 'Install Now', 'themegrill-demo-importer' ); ?></span>
217
+ <# } #>
218
+ </td>
219
+ </tr>
220
+ <# }); #>
221
+ <# } else { #>
222
+ <tr class="no-items">
223
+ <td class="colspanchange" colspan="4"><?php _e( 'No plugins are needed to import this demo.', 'themegrill-demo-importer' ); ?></td>
224
</tr>
225
+ <# } #>
226
+ </tbody>
227
+ <tfoot>
228
<tr>
229
+ <th scope="col" class="manage-column plugin-actions<# if ( ! data.pluginActions['install'] ) { #> installed<# } #>" colspan="4">
230
+ <a href="#" class="button button-primary plugins-install<# if ( ! data.pluginActions['install'] ) { #> disabled<# } #>"><?php _e( 'Install Plugins', 'themegrill-demo-importer' ); ?></a>
231
+ <input type="submit" name="bulk_action" id="bulk_action" class="button button-secondary plugins-activate" value="<?php esc_attr_e( __( 'Activate Plugins', 'themegrill-demo-importer' ) ); ?>"<# if ( ! data.pluginActions['activate'] ) { #> disabled<# } #>>
232
+ </th>
233
</tr>
234
+ </tfoot>
235
+ </table>
236
+ </form>
237
238
<# if ( data.tags ) { #>
239
<p class="theme-tags"><span><?php _e( 'Tags:', 'themegrill-demo-importer' ); ?></span> {{{ data.tags }}}</p>
270
<?php
271
wp_print_request_filesystem_credentials_modal();
272
wp_print_admin_notice_templates();
273
+ tg_print_admin_notice_templates();
includes/{includes/admin → admin}/views/html-admin-page-installer-preview.php RENAMED
@@ -11,7 +11,7 @@ if ( ! defined( 'ABSPATH' ) ) {
11
<div class="theme-browser rendered">
12
<div class="themes wp-clearfix">
13
<?php foreach ( $demos as $demo ) : ?>
14
- <div class="theme<?php echo ( $demo['actions']['pro_link'] ) ? " premium-ribbon": ''; ?>" tabindex="0">
15
<a target="_blank" href="<?php echo esc_url( $demo['actions']['preview_url'] ); ?>">
16
<?php if ( $demo['screenshot'] ) : ?>
17
<div class="theme-screenshot">
@@ -21,6 +21,9 @@ if ( ! defined( 'ABSPATH' ) ) {
21
<div class="theme-screenshot blank"></div>
22
<?php endif; ?>
23
<span class="more-details"><?php _e( 'Demo Preview', 'themegrill-demo-importer' ); ?></span>
24
</a>
25
<div class="theme-author"><?php
26
/* translators: %s: Demo author name */
@@ -35,8 +38,7 @@ if ( ! defined( 'ABSPATH' ) ) {
35
$aria_label = sprintf( _x( 'Download %s', 'demo', 'themegrill-demo-importer' ), esc_attr( $demo['name'] ) );
36
?>
37
<a class="button button-primary demo-download" data-name="<?php echo esc_attr( $demo['name'] ); ?>" href="<?php echo esc_url( $demo['actions']['download_url'] ); ?>" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Download', 'themegrill-demo-importer' ); ?></a>
38
- <?php endif; ?>
39
- <?php if ( $demo['actions']['pro_link'] ) : ?>
40
<?php
41
/* translators: %s: Demo name */
42
$aria_label = sprintf( _x( 'View %s Pro', 'demo', 'themegrill-demo-importer' ), esc_attr( $demo['name'] ) );
11
<div class="theme-browser rendered">
12
<div class="themes wp-clearfix">
13
<?php foreach ( $demos as $demo ) : ?>
14
+ <div class="theme" tabindex="0">
15
<a target="_blank" href="<?php echo esc_url( $demo['actions']['preview_url'] ); ?>">
16
<?php if ( $demo['screenshot'] ) : ?>
17
<div class="theme-screenshot">
21
<div class="theme-screenshot blank"></div>
22
<?php endif; ?>
23
<span class="more-details"><?php _e( 'Demo Preview', 'themegrill-demo-importer' ); ?></span>
24
+ <?php if ( $demo['actions']['pro_link'] ) : ?>
25
+ <span class="premium-ribbon"><span><?php _e( 'Pro', 'themegrill-demo-importer' ); ?></span></span>
26
+ <?php endif; ?>
27
</a>
28
<div class="theme-author"><?php
29
/* translators: %s: Demo author name */
38
$aria_label = sprintf( _x( 'Download %s', 'demo', 'themegrill-demo-importer' ), esc_attr( $demo['name'] ) );
39
?>
40
<a class="button button-primary demo-download" data-name="<?php echo esc_attr( $demo['name'] ); ?>" href="<?php echo esc_url( $demo['actions']['download_url'] ); ?>" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Download', 'themegrill-demo-importer' ); ?></a>
41
+ <?php elseif ( $demo['actions']['pro_link'] ) : ?>
42
<?php
43
/* translators: %s: Demo name */
44
$aria_label = sprintf( _x( 'View %s Pro', 'demo', 'themegrill-demo-importer' ), esc_attr( $demo['name'] ) );
includes/{includes/admin → admin}/views/html-admin-page-installer-uploads.php RENAMED
File without changes
includes/{includes/admin → admin}/views/html-admin-page-installer.php RENAMED
@@ -21,7 +21,7 @@ $demo_filter_links = apply_filters( 'themegrill_demo_importer_filter_links_array
21
<h1 class="wp-heading-inline"><?php esc_html_e( 'Demo Importer', 'themegrill-demo-importer' ); ?></h1>
22
23
<?php if ( current_user_can( 'upload_files' ) ) : ?>
24
- <button type="button" class="upload-view-toggle page-title-action hide-if-no-js tg-demo-upload" aria-expanded="false"><?php _e( 'Upload Demo', 'themegrill-demo-importer' ); ?></button>
25
<?php endif; ?>
26
27
<hr class="wp-header-end">
@@ -183,48 +183,73 @@ $demo_filter_links = apply_filters( 'themegrill_demo_importer_filter_links_array
183
184
<h3 class="plugins-info"><?php _e( 'Plugins Information', 'themegrill-demo-importer' ); ?></h3>
185
186
- <table class="plugins-list-table widefat">
187
- <thead>
188
- <tr>
189
- <th class="plugin-name"><?php esc_html_e( 'Plugin Name', 'themegrill-demo-importer' ); ?></th>
190
- <th class="plugin-type"><?php esc_html_e( 'Type', 'themegrill-demo-importer' ); ?></th>
191
- <th class="plugin-status"><?php esc_html_e( 'Status', 'themegrill-demo-importer' ); ?></th>
192
- </tr>
193
- </thead>
194
- <tbody>
195
- <# if ( ! _.isEmpty( data.plugins ) ) { #>
196
- <# _.each( data.plugins, function( plugin, slug ) { #>
197
- <tr>
198
- <td class="plugin-name">
199
- <# if ( plugin.link ) { #>
200
- <a href="{{{ plugin.link }}}" target="_blank">{{{ plugin.name }}}</a>
201
- <# } else { #>
202
- <a href="<?php echo esc_url( admin_url( 'plugin-install.php?tab=search&type=term&s=' ) ); ?>{{ slug }}" target="_blank">{{ plugin.name }}</a>
203
- <# } #>
204
- </td>
205
- <td class="plugin-type">
206
- <# if ( plugin.required ) { #>
207
- <span class="required"><?php esc_html_e( 'Required', 'themegrill-demo-importer' ); ?></span>
208
- <# } else { #>
209
- <span class="recommended"><?php esc_html_e( 'Recommended', 'themegrill-demo-importer' ); ?></span>
210
- <# } #>
211
- </td>
212
- <td class="plugin-status">
213
- <# if ( plugin.is_active ) { #>
214
- <mark class="yes"><span class="dashicons dashicons-yes"></span></mark>
215
- <# } else { #>
216
- <mark class="error"><span class="dashicons dashicons-no-alt"></span></mark>
217
- <# } #>
218
- </td>
219
</tr>
220
- <# }); #>
221
- <# } else { #>
222
<tr>
223
- <td class="plugins-list-table-blank-state" colspan="3"><p><?php _e( 'No plugins are needed to import this demo.', 'themegrill-demo-importer' ); ?></p></td>
224
</tr>
225
- <# } #>
226
- </tbody>
227
- </table>
228
229
<# if ( data.tags ) { #>
230
<p class="theme-tags"><span><?php _e( 'Tags:', 'themegrill-demo-importer' ); ?></span> {{{ data.tags }}}</p>
@@ -268,6 +293,9 @@ $demo_filter_links = apply_filters( 'themegrill_demo_importer_filter_links_array
268
<div class="theme-screenshot blank"></div>
269
<# } #>
270
<span class="more-details"><?php _e( 'Demo Preview', 'themegrill-demo-importer' ); ?></span>
271
</a>
272
<div class="theme-author"><?php
273
/* translators: %s: Demo author name */
@@ -282,8 +310,7 @@ $demo_filter_links = apply_filters( 'themegrill_demo_importer_filter_links_array
282
$aria_label = sprintf( _x( 'Download %s', 'demo', 'themegrill-demo-importer' ), '{{ data.name }}' );
283
?>
284
<a class="button button-primary demo-download" data-name="{{ data.name }}" href="{{ data.actions.download_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Download', 'themegrill-demo-importer' ); ?></a>
285
- <# } #>
286
- <# if ( data.actions.pro_link ) { #>
287
<?php
288
/* translators: %s: Demo name */
289
$aria_label = sprintf( _x( 'View %s Pro', 'demo', 'themegrill-demo-importer' ), '{{ data.name }}' );
@@ -301,3 +328,4 @@ $demo_filter_links = apply_filters( 'themegrill_demo_importer_filter_links_array
301
<?php
302
wp_print_request_filesystem_credentials_modal();
303
wp_print_admin_notice_templates();
21
<h1 class="wp-heading-inline"><?php esc_html_e( 'Demo Importer', 'themegrill-demo-importer' ); ?></h1>
22
23
<?php if ( current_user_can( 'upload_files' ) ) : ?>
24
+ <button type="button" class="upload-view-toggle page-title-action hide-if-no-js" aria-expanded="false"><?php _e( 'Upload Demo', 'themegrill-demo-importer' ); ?></button>
25
<?php endif; ?>
26
27
<hr class="wp-header-end">
183
184
<h3 class="plugins-info"><?php _e( 'Plugins Information', 'themegrill-demo-importer' ); ?></h3>
185
186
+ <form method="post" id="bulk-action-form">
187
+ <?php wp_nonce_field( 'bulk-plugins-activate' ); ?>
188
+ <table class="plugins-list-table widefat striped">
189
+ <thead>
190
+ <tr>
191
+ <td id="cb" class="manage-column check-column">
192
+ <label class="screen-reader-text" for="cb-select-all-1"><?php esc_html_e( 'Select All', 'themegrill-demo-importer' ); ?></label>
193
+ <input id="cb-select-all-1" type="checkbox">
194
+ </td>
195
+ <th scope="col" class="manage-column plugin-name"><?php esc_html_e( 'Plugin Name', 'themegrill-demo-importer' ); ?></th>
196
+ <th scope="col" class="manage-column plugin-type"><?php esc_html_e( 'Type', 'themegrill-demo-importer' ); ?></th>
197
+ <th scope="col" class="manage-column plugin-status"><?php esc_html_e( 'Status', 'themegrill-demo-importer' ); ?></th>
198
+ </tr>
199
+ </thead>
200
+ <tbody id="the-list">
201
+ <# if ( ! _.isEmpty( data.plugins ) ) { #>
202
+ <# _.each( data.plugins, function( plugin, slug ) { #>
203
+ <# var checkboxIdPrefix = _.uniqueId( 'checkbox_' ) #>
204
+ <tr class="plugin<# if ( ! plugin.is_install ) { #> install<# } #>" data-slug="{{ slug }}" data-plugin="{{ plugin.slug }}" data-name="{{ plugin.name }}">
205
+ <th scope="row" class="check-column">
206
+ <label class="screen-reader-text" for="{{ checkboxIdPrefix }}"><?php printf( __( 'Select %s', 'themegrill-demo-importer' ), '{{ plugin.name }}' ); ?></label>
207
+ <input type="checkbox" name="checked[]" value="{{ plugin.slug }}" id="{{ checkboxIdPrefix }}"<# if ( plugin.required ) { #> data-checked="1" checked="checked" disabled="disabled"<# } #>>
208
+ <# if ( plugin.required ) { #>
209
+ <input type="hidden" name="checked[]" value="{{ plugin.slug }}">
210
+ <# } #>
211
+ </th>
212
+ <td class="plugin-name">
213
+ <# if ( plugin.link ) { #>
214
+ <a href="{{{ plugin.link }}}" target="_blank">{{{ plugin.name }}}</a>
215
+ <# } else { #>
216
+ <a href="<?php printf( esc_url( 'https://wordpress.org/plugins/%s' ), '{{ slug }}' ); ?>" target="_blank">{{ plugin.name }}</a>
217
+ <# } #>
218
+ </td>
219
+ <td class="plugin-type">
220
+ <# if ( plugin.required ) { #>
221
+ <abbr class="required"><?php esc_html_e( 'Required', 'themegrill-demo-importer' ); ?></abbr>
222
+ <# } else { #>
223
+ <abbr class="recommended"><?php esc_html_e( 'Recommended', 'themegrill-demo-importer' ); ?></abbr>
224
+ <# } #>
225
+ </td>
226
+ <td class="plugin-status">
227
+ <# if ( plugin.is_active && plugin.is_install ) { #>
228
+ <span class="active"><?php esc_html_e( 'Active', 'themegrill-demo-importer' ); ?></span>
229
+ <# } else if ( plugin.is_install ) { #>
230
+ <span class="activate-now"><?php esc_html_e( 'Activate', 'themegrill-demo-importer' ); ?></span>
231
+ <# } else { #>
232
+ <span class="install-now"><?php esc_html_e( 'Install Now', 'themegrill-demo-importer' ); ?></span>
233
+ <# } #>
234
+ </td>
235
+ </tr>
236
+ <# }); #>
237
+ <# } else { #>
238
+ <tr class="no-items">
239
+ <td class="colspanchange" colspan="4"><?php _e( 'No plugins are needed to import this demo.', 'themegrill-demo-importer' ); ?></td>
240
</tr>
241
+ <# } #>
242
+ </tbody>
243
+ <tfoot>
244
<tr>
245
+ <th scope="col" class="manage-column plugin-actions<# if ( ! data.pluginActions['install'] ) { #> installed<# } #>" colspan="4">
246
+ <a href="#" class="button button-primary plugins-install<# if ( ! data.pluginActions['install'] ) { #> disabled<# } #>"><?php _e( 'Install Plugins', 'themegrill-demo-importer' ); ?></a>
247
+ <input type="submit" name="bulk_action" id="bulk_action" class="button button-secondary plugins-activate" value="<?php esc_attr_e( __( 'Activate Plugins', 'themegrill-demo-importer' ) ); ?>"<# if ( ! data.pluginActions['activate'] ) { #> disabled<# } #>>
248
+ </th>
249
</tr>
250
+ </tfoot>
251
+ </table>
252
+ </form>
253
254
<# if ( data.tags ) { #>
255
<p class="theme-tags"><span><?php _e( 'Tags:', 'themegrill-demo-importer' ); ?></span> {{{ data.tags }}}</p>
293
<div class="theme-screenshot blank"></div>
294
<# } #>
295
<span class="more-details"><?php _e( 'Demo Preview', 'themegrill-demo-importer' ); ?></span>
296
+ <# if ( data.actions.pro_link ) { #>
297
+ <span class="premium-ribbon"><span><?php _e( 'Pro', 'themegrill-demo-importer' ); ?></span></span>
298
+ <# } #>
299
</a>
300
<div class="theme-author"><?php
301
/* translators: %s: Demo author name */
310
$aria_label = sprintf( _x( 'Download %s', 'demo', 'themegrill-demo-importer' ), '{{ data.name }}' );
311
?>
312
<a class="button button-primary demo-download" data-name="{{ data.name }}" href="{{ data.actions.download_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Download', 'themegrill-demo-importer' ); ?></a>
313
+ <# } else if ( data.actions.pro_link ) { #>
314
<?php
315
/* translators: %s: Demo name */
316
$aria_label = sprintf( _x( 'View %s Pro', 'demo', 'themegrill-demo-importer' ), '{{ data.name }}' );
328
<?php
329
wp_print_request_filesystem_credentials_modal();
330
wp_print_admin_notice_templates();
331
+ tg_print_admin_notice_templates();
includes/{includes/admin → admin}/views/html-notice-reset-wizard-success.php RENAMED
File without changes
includes/{includes/admin → admin}/views/html-notice-reset-wizard.php RENAMED
File without changes
includes/class-demo-importer.php CHANGED
@@ -30,12 +30,6 @@ class TG_Demo_Importer {
30
*/
31
public $demo_packages;
32
33
- /**
34
- * Demo installer.
35
- * @var bool
36
- */
37
- public $demo_installer = true;
38
-
39
/**
40
* Constructor.
41
*/
@@ -80,18 +74,16 @@ class TG_Demo_Importer {
80
* Demo importer setup.
81
*/
82
public function setup() {
83
- $this->demo_config = apply_filters( 'themegrill_demo_importer_config', array() );
84
- $this->demo_packages = apply_filters( 'themegrill_demo_importer_packages', array() );
85
- $this->demo_installer = apply_filters( 'themegrill_demo_importer_installer', true );
86
}
87
88
/**
89
* Include required core files.
90
*/
91
public function includes() {
92
- include_once( dirname( __FILE__ ) . '/includes/functions-demo-importer.php' );
93
- include_once( dirname( __FILE__ ) . '/includes/class-customizer-importer.php' );
94
- include_once( dirname( __FILE__ ) . '/includes/class-widget-importer.php' );
95
}
96
97
/**
@@ -130,29 +122,6 @@ class TG_Demo_Importer {
130
return trailingslashit( $working_dir ) . sanitize_file_name( $filename );
131
}
132
133
- /**
134
- * Get the demo preview screenshot URL.
135
- *
136
- * @param string $demo_dir
137
- * @param string $current_template
138
- * @return string the demo preview screenshot URL.
139
- */
140
- public function get_screenshot_url( $demo_dir, $current_template ) {
141
- $screenshot_theme_path = get_template_directory() . "/images/demo/{$demo_dir}.jpg";
142
- $screenshot_plugin_path = TGDM()->plugin_path() . "/assets/images/{$current_template}/{$demo_dir}.jpg";
143
-
144
- if ( file_exists( $screenshot_theme_path ) ) {
145
- $screenshot_url = get_template_directory_uri() . "/images/demo/{$demo_dir}.jpg";
146
- } elseif ( file_exists( $screenshot_plugin_path ) ) {
147
- $screenshot_url = TGDM()->plugin_url() . "/assets/images/{$current_template}/{$demo_dir}.jpg";
148
- } else {
149
- $theme_data = wp_get_theme();
150
- $screenshot_url = $theme_data->get_screenshot();
151
- }
152
-
153
- return $screenshot_url;
154
- }
155
-
156
/**
157
* Check if demo pack is enabled.
158
* @param array $demo_id
@@ -180,7 +149,7 @@ class TG_Demo_Importer {
180
global $submenu;
181
182
if ( isset( $submenu['themes.php'] ) ) {
183
- $submenu_class = $this->demo_installer ? 'demo-installer hide-if-no-js' : 'demo-importer';
184
185
// Add menu classes if user has access.
186
if ( apply_filters( 'themegrill_demo_importer_include_class_in_menu', true ) ) {
@@ -235,17 +204,18 @@ class TG_Demo_Importer {
235
),
236
) );
237
wp_localize_script( 'tg-demo-importer', 'demoImporterLocalizeScript', array(
238
- 'demos' => $this->prepare_demos_for_js( $this->is_preview() ? $this->demo_packages : $this->demo_config ),
239
'settings' => array(
240
- 'isPreview' => $this->is_preview(),
241
- 'isInstall' => $this->demo_installer,
242
- 'canInstall' => current_user_can( 'upload_files' ),
243
- 'installURI' => current_user_can( 'upload_files' ) ? self_admin_url( 'themes.php?page=demo-importer&browse=preview' ) : null,
244
- 'confirmReset' => __( 'It is strongly recommended that you backup your database before proceeding. Are you sure you wish to run the reset wizard now?', 'themegrill-demo-importer' ),
245
- 'confirmDelete' => __( "Are you sure you want to delete this demo?\n\nClick 'Cancel' to go back, 'OK' to confirm the delete.", 'themegrill-demo-importer' ),
246
- 'confirmImport' => __( 'Importing demo content will replicate the live demo and overwrites your current customizer, widgets and other settings. It might take few minutes to complete the demo import. Are you sure you want to import this demo?', 'themegrill-demo-importer' ),
247
- 'ajaxUrl' => admin_url( 'admin-ajax.php' ),
248
- 'adminUrl' => parse_url( self_admin_url(), PHP_URL_PATH ),
249
),
250
'l10n' => array(
251
'addNew' => __( 'Add New Demo', 'themegrill-demo-importer' ),
@@ -275,7 +245,7 @@ class TG_Demo_Importer {
275
if ( isset( $current_screen->id ) && apply_filters( 'themegrill_demo_importer_display_admin_footer_text', in_array( $current_screen->id, array( 'appearance_page_demo-importer' ) ) ) ) {
276
// Change the footer text.
277
if ( ! get_option( 'themegrill_demo_importer_admin_footer_text_rated' ) ) {
278
- $footer_text = sprintf( __( 'If you like <strong>ThemeGrill Demo Importer</strong> please leave us a %s&#9733;&#9733;&#9733;&#9733;&#9733;%s rating. A huge thanks in advance!', 'themegrill-demo-importer' ), '<a href="https://wordpress.org/support/plugin/themegrill-demo-importer/reviews?rate=5#new-post" target="_blank" class="themegrill-demo-importer-rating-link" data-rated="' . esc_attr__( 'Thanks :)', 'themegrill-demo-importer' ) . '">', '</a>' );
279
} else {
280
$footer_text = __( 'Thank you for importing with ThemeGrill Demo Importer.', 'themegrill-demo-importer' );
281
}
@@ -297,24 +267,21 @@ class TG_Demo_Importer {
297
$video_map = array(
298
'demo-importer' => array(
299
'title' => __( 'Importing Demo', 'themegrill-demo-importer' ),
300
- 'url' => '//fast.wistia.net/embed/iframe/ctdquor9uh.jsonp?',
301
),
302
);
303
304
- $page = empty( $_GET['page'] ) ? '' : sanitize_title( $_GET['page'] );
305
- $video_key = $page ? $page : $screen->id;
306
307
- if ( ! $this->demo_installer && isset( $video_map[ $video_key ] ) ) {
308
$screen->add_help_tab( array(
309
'id' => 'themegrill_demo_importer_guided_tour_tab',
310
'title' => __( 'Guided Tour', 'themegrill-demo-importer' ),
311
'content' =>
312
'<h2>' . __( 'Guided Tour', 'themegrill-demo-importer' ) . ' &ndash; ' . esc_html( $video_map[ $video_key ]['title'] ) . '</h2>' .
313
- '<div class="wistia_responsive_padding" style="padding:56.25% 0 0 0;position:relative;">
314
- <div class="wistia_responsive_wrapper" style="height:100%;left:0;position:absolute;top:0;width:100%;">
315
- <iframe src="' . esc_url( $video_map[ $video_key ]['url'] ) . 'seo=false&videoFoam=true" title="Wistia video player" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_embed" name="wistia_embed" allowfullscreen mozallowfullscreen webkitallowfullscreen oallowfullscreen msallowfullscreen width="100%" height="100%"></iframe>
316
- </div></div>
317
- <script src="//fast.wistia.net/assets/external/E-v1.js" async></script>',
318
) );
319
}
320
@@ -378,9 +345,9 @@ class TG_Demo_Importer {
378
379
// Output reset wizard notice.
380
if ( ! $demo_notice_dismiss && in_array( $demo_activated_id, array_keys( $this->demo_config ) ) ) {
381
- include_once( dirname( __FILE__ ) . '/includes/admin/views/html-notice-reset-wizard.php' );
382
} elseif ( isset( $_GET['reset'] ) && 'true' === $_GET['reset'] ) {
383
- include_once( dirname( __FILE__ ) . '/includes/admin/views/html-notice-reset-wizard-success.php' );
384
}
385
}
386
@@ -420,7 +387,7 @@ class TG_Demo_Importer {
420
$blog_public = get_option( 'blog_public' );
421
$footer_rated = get_option( 'themegrill_demo_importer_admin_footer_text_rated' );
422
423
- if ( $current_user->user_login != 'admin' ) {
424
$user = get_user_by( 'login', 'admin' );
425
}
426
@@ -458,16 +425,12 @@ class TG_Demo_Importer {
458
}
459
460
// Activate required plugins.
461
- $activate_required_plugins = (array) apply_filters( 'themegrill_demo_importer_' . $template . '_required_plugins', array( TGDM_PLUGIN_BASENAME ) );
462
- if ( ! empty( $activate_required_plugins ) ) {
463
- foreach ( $activate_required_plugins as $plugin ) {
464
- $plugin = plugin_basename( $plugin );
465
- if ( ! is_wp_error( validate_plugin( $plugin ) ) ) {
466
- activate_plugin( $plugin );
467
- }
468
}
469
- } else {
470
- activate_plugin( TGDM_PLUGIN_BASENAME );
471
}
472
473
// Update the cookies.
@@ -480,18 +443,6 @@ class TG_Demo_Importer {
480
}
481
}
482
483
- /**
484
- * Check for preview filter.
485
- * @return bool
486
- */
487
- public function is_preview() {
488
- if ( $this->demo_installer && isset( $_GET['browse'] ) ) {
489
- return 'preview' === $_GET['browse'] ? true : false;
490
- }
491
-
492
- return false;
493
- }
494
-
495
/**
496
* Prepare demos for JavaScript.
497
*
@@ -517,14 +468,15 @@ class TG_Demo_Importer {
517
}
518
519
// Make sure the imported demo is listed first.
520
- if ( ! $this->is_preview() && isset( $demos[ $demo_activated_id ] ) ) {
521
$prepared_demos[ $demo_activated_id ] = array();
522
}
523
524
if ( ! empty( $demos ) ) {
525
foreach ( $demos as $demo_id => $demo_data ) {
526
- $demo_notices = array();
527
- $encoded_slug = urlencode( $demo_id );
528
$premium_link = isset( $demo_data['pro_link'] ) ? $demo_data['pro_link'] : '';
529
$download_url = isset( $demo_data['download'] ) ? $demo_data['download'] : "https://github.com/themegrill/themegrill-demo-pack/raw/master/packages/{$current_template}/{$demo_id}.zip";
530
$demo_package = isset( $demo_data['demo_pack'] ) ? $demo_data['demo_pack'] : false;
@@ -533,30 +485,35 @@ class TG_Demo_Importer {
533
// Plugins status.
534
foreach ( $plugins_list as $plugin => $plugin_data ) {
535
$plugins_list[ $plugin ]['is_active'] = is_plugin_active( $plugin_data['slug'] );
536
}
537
538
// Add demo notices.
539
if ( isset( $demo_data['template'] ) && $current_template !== $demo_data['template'] ) {
540
$demo_notices['required_theme'] = true;
541
} elseif ( wp_list_filter( $plugins_list, array( 'required' => true, 'is_active' => false ) ) ) {
542
$demo_notices['required_plugins'] = true;
543
}
544
545
- // Check if demo is installed.
546
- $installed = false;
547
- if ( in_array( $demo_id, array_keys( $this->demo_config ) ) ) {
548
- $installed = true;
549
- }
550
-
551
// Prepare all demos.
552
- if ( $this->is_preview() ) {
553
$prepared_demos[ $demo_id ] = array(
554
'id' => $demo_id,
555
'name' => $demo_data['name'],
556
- 'installed' => $installed,
557
- 'screenshot' => $this->get_screenshot_url( $demo_id, $current_template ),
558
- 'description' => isset( $demo_data['description'] ) ? $demo_data['description'] : '',
559
- 'author' => isset( $demo_data['author'] ) ? $demo_data['author'] : __( 'ThemeGrill', 'themegrill-demo-importer' ),
560
'actions' => array(
561
'pro_link' => $premium_link,
562
'preview_url' => $demo_data['preview'],
@@ -570,13 +527,17 @@ class TG_Demo_Importer {
570
'theme' => $demo_data['theme'],
571
'package' => $demo_package,
572
'screenshot' => $this->import_file_url( $demo_id, 'screenshot.jpg' ),
573
- 'description' => isset( $demo_data['description'] ) ? $demo_data['description'] : '',
574
- 'author' => isset( $demo_data['author'] ) ? $demo_data['author'] : __( 'ThemeGrill', 'themegrill-demo-importer' ),
575
'authorAndUri' => '<a href="https://themegrill.com" target="_blank">ThemeGrill</a>',
576
- 'version' => isset( $demo_data['version'] ) ? $demo_data['version'] : '1.1.0',
577
'active' => $demo_id === $demo_activated_id,
578
'hasNotice' => $demo_notices,
579
'plugins' => $plugins_list,
580
'actions' => array(
581
'preview' => home_url( '/' ),
582
'demo_url' => $demo_data['demo_url'],
@@ -603,13 +564,13 @@ class TG_Demo_Importer {
603
* Demo Importer page output.
604
*/
605
public function demo_importer() {
606
- $demos = $this->prepare_demos_for_js( $this->is_preview() ? $this->demo_packages : $this->demo_config );
607
608
if ( isset( $_GET['action'] ) && 'upload-demo' === $_GET['action'] ) {
609
$this->upload_demo_pack();
610
} else {
611
- $suffix = $this->demo_installer ? 'installer' : 'importer';
612
- include_once( dirname( __FILE__ ) . "/includes/admin/views/html-admin-page-{$suffix}.php" );
613
}
614
}
615
@@ -633,8 +594,8 @@ class TG_Demo_Importer {
633
$type = 'upload'; // Install demo type, From Web or an Upload.
634
635
// Demo Upgrader Class.
636
- include_once( dirname( __FILE__ ) . '/includes/admin/class-demo-upgrader.php' );
637
- include_once( dirname( __FILE__ ) . '/includes/admin/class-demo-installer-skin.php' );
638
639
$upgrader = new TG_Demo_Upgrader( new TG_Demo_Installer_Skin( compact( 'type', 'title', 'nonce', 'url' ) ) );
640
$result = $upgrader->install( $file_upload->package );
@@ -730,7 +691,7 @@ class TG_Demo_Importer {
730
}
731
732
// Include WXR Importer.
733
- require dirname( __FILE__ ) . '/includes/importers/class-wxr-importer.php';
734
735
do_action( 'themegrill_ajax_before_dummy_xml_import', $demo_data, $demo_id );
736
30
*/
31
public $demo_packages;
32
33
/**
34
* Constructor.
35
*/
74
* Demo importer setup.
75
*/
76
public function setup() {
77
+ $this->demo_config = apply_filters( 'themegrill_demo_importer_config', array() );
78
+ $this->demo_packages = apply_filters( 'themegrill_demo_importer_packages', array() );
79
}
80
81
/**
82
* Include required core files.
83
*/
84
public function includes() {
85
+ include_once( dirname( __FILE__ ) . '/importers/class-widget-importer.php' );
86
+ include_once( dirname( __FILE__ ) . '/importers/class-customizer-importer.php' );
87
}
88
89
/**
122
return trailingslashit( $working_dir ) . sanitize_file_name( $filename );
123
}
124
125
/**
126
* Check if demo pack is enabled.
127
* @param array $demo_id
149
global $submenu;
150
151
if ( isset( $submenu['themes.php'] ) ) {
152
+ $submenu_class = tg_demo_installer_enabled() ? 'demo-installer hide-if-no-js' : 'demo-importer';
153
154
// Add menu classes if user has access.
155
if ( apply_filters( 'themegrill_demo_importer_include_class_in_menu', true ) ) {
204
),
205
) );
206
wp_localize_script( 'tg-demo-importer', 'demoImporterLocalizeScript', array(
207
+ 'demos' => $this->prepare_demos_for_js( tg_demo_installer_preview() ? $this->demo_packages : $this->demo_config ),
208
'settings' => array(
209
+ 'isPreview' => tg_demo_installer_preview(),
210
+ 'isInstall' => tg_demo_installer_enabled(),
211
+ 'canInstall' => current_user_can( 'upload_files' ),
212
+ 'installURI' => current_user_can( 'upload_files' ) ? self_admin_url( 'themes.php?page=demo-importer&browse=preview' ) : null,
213
+ 'confirmReset' => __( 'It is strongly recommended that you backup your database before proceeding. Are you sure you wish to run the reset wizard now?', 'themegrill-demo-importer' ),
214
+ 'confirmDelete' => __( "Are you sure you want to delete this demo?\n\nClick 'Cancel' to go back, 'OK' to confirm the delete.", 'themegrill-demo-importer' ),
215
+ 'confirmImport' => __( 'Importing demo content will replicate the live demo and overwrites your current customizer, widgets and other settings. It might take few minutes to complete the demo import. Are you sure you want to import this demo?', 'themegrill-demo-importer' ),
216
+ 'confirmInstall' => __( 'Are you sure you want to install the selected plugins and their data?', 'themegrill-demo-importer' ),
217
+ 'ajaxUrl' => admin_url( 'admin-ajax.php' ),
218
+ 'adminUrl' => parse_url( self_admin_url(), PHP_URL_PATH ),
219
),
220
'l10n' => array(
221
'addNew' => __( 'Add New Demo', 'themegrill-demo-importer' ),
245
if ( isset( $current_screen->id ) && apply_filters( 'themegrill_demo_importer_display_admin_footer_text', in_array( $current_screen->id, array( 'appearance_page_demo-importer' ) ) ) ) {
246
// Change the footer text.
247
if ( ! get_option( 'themegrill_demo_importer_admin_footer_text_rated' ) ) {
248
+ $footer_text = sprintf( __( 'If you like <strong>ThemeGrill Demo Importer</strong> please leave us a %1$s&#9733;&#9733;&#9733;&#9733;&#9733;%2$s rating. A huge thanks in advance!', 'themegrill-demo-importer' ), '<a href="https://wordpress.org/support/plugin/themegrill-demo-importer/reviews?rate=5#new-post" target="_blank" class="themegrill-demo-importer-rating-link" data-rated="' . esc_attr__( 'Thanks :)', 'themegrill-demo-importer' ) . '">', '</a>' );
249
} else {
250
$footer_text = __( 'Thank you for importing with ThemeGrill Demo Importer.', 'themegrill-demo-importer' );
251
}
267
$video_map = array(
268
'demo-importer' => array(
269
'title' => __( 'Importing Demo', 'themegrill-demo-importer' ),
270
+ 'id' => 'ctdquor9uh',
271
),
272
);
273
274
+ $video_key = empty( $_GET['page'] ) ? $screen->id : sanitize_title( $_GET['page'] );
275
276
+ if ( ! tg_demo_installer_enabled() && isset( $video_map[ $video_key ] ) ) {
277
$screen->add_help_tab( array(
278
'id' => 'themegrill_demo_importer_guided_tour_tab',
279
'title' => __( 'Guided Tour', 'themegrill-demo-importer' ),
280
'content' =>
281
'<h2>' . __( 'Guided Tour', 'themegrill-demo-importer' ) . ' &ndash; ' . esc_html( $video_map[ $video_key ]['title'] ) . '</h2>' .
282
+ '<script src="//fast.wistia.net/assets/external/E-v1.js" aync></script>
283
+ <div class="wistia_embed wistia_async_' . esc_attr( $video_map[ $video_key ]['id'] ) . ' videoFoam=true seo=false" style="width:640px;height:360px;">&nbsp;</div>
284
+ ',
285
) );
286
}
287
345
346
// Output reset wizard notice.
347
if ( ! $demo_notice_dismiss && in_array( $demo_activated_id, array_keys( $this->demo_config ) ) ) {
348
+ include_once( dirname( __FILE__ ) . '/admin/views/html-notice-reset-wizard.php' );
349
} elseif ( isset( $_GET['reset'] ) && 'true' === $_GET['reset'] ) {
350
+ include_once( dirname( __FILE__ ) . '/admin/views/html-notice-reset-wizard-success.php' );
351
}
352
}
353
387
$blog_public = get_option( 'blog_public' );
388
$footer_rated = get_option( 'themegrill_demo_importer_admin_footer_text_rated' );
389
390
+ if ( 'admin' != $current_user->user_login ) {
391
$user = get_user_by( 'login', 'admin' );
392
}
393
425
}
426
427
// Activate required plugins.
428
+ $required_plugins = (array) apply_filters( 'themegrill_demo_importer_' . $template . '_required_plugins', array() );
429
+ if ( is_array( $required_plugins ) ) {
430
+ if ( ! in_array( TGDM_PLUGIN_BASENAME, $required_plugins ) ) {
431
+ $required_plugins = array_merge( $required_plugins, array( TGDM_PLUGIN_BASENAME ) );
432
}
433
+ activate_plugins( $required_plugins, '', is_network_admin(), true );
434
}
435
436
// Update the cookies.
443
}
444
}
445
446
/**
447
* Prepare demos for JavaScript.
448
*
468
}
469
470
// Make sure the imported demo is listed first.
471
+ if ( ! tg_demo_installer_preview() && isset( $demos[ $demo_activated_id ] ) ) {
472
$prepared_demos[ $demo_activated_id ] = array();
473
}
474
475
if ( ! empty( $demos ) ) {
476
foreach ( $demos as $demo_id => $demo_data ) {
477
+ $author = isset( $demo_data['author'] ) ? $demo_data['author'] : __( 'ThemeGrill', 'themegrill-demo-importer' );
478
+ $version = isset( $demo_data['version'] ) ? $demo_data['version'] : TGDM_VERSION;
479
+ $description = isset( $demo_data['description'] ) ? $demo_data['description'] : '';
480
$premium_link = isset( $demo_data['pro_link'] ) ? $demo_data['pro_link'] : '';
481
$download_url = isset( $demo_data['download'] ) ? $demo_data['download'] : "https://github.com/themegrill/themegrill-demo-pack/raw/master/packages/{$current_template}/{$demo_id}.zip";
482
$demo_package = isset( $demo_data['demo_pack'] ) ? $demo_data['demo_pack'] : false;
485
// Plugins status.
486
foreach ( $plugins_list as $plugin => $plugin_data ) {
487
$plugins_list[ $plugin ]['is_active'] = is_plugin_active( $plugin_data['slug'] );
488
+
489
+ // Looks like a plugin is installed, but not active.
490
+ if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin ) ) {
491
+ $plugins = get_plugins( '/' . $plugin );
492
+ if ( ! empty( $plugins ) ) {
493
+ $plugins_list[ $plugin ]['is_install'] = true;
494
+ }
495
+ } else {
496
+ $plugins_list[ $plugin ]['is_install'] = false;
497
+ }
498
}
499
500
// Add demo notices.
501
+ $demo_notices = array();
502
if ( isset( $demo_data['template'] ) && $current_template !== $demo_data['template'] ) {
503
$demo_notices['required_theme'] = true;
504
} elseif ( wp_list_filter( $plugins_list, array( 'required' => true, 'is_active' => false ) ) ) {
505
$demo_notices['required_plugins'] = true;
506
}
507
508
// Prepare all demos.
509
+ if ( tg_demo_installer_preview() ) {
510
$prepared_demos[ $demo_id ] = array(
511
'id' => $demo_id,
512
'name' => $demo_data['name'],
513
+ 'installed' => in_array( $demo_id, array_keys( $this->demo_config ) ),
514
+ 'screenshot' => tg_get_demo_preview_screenshot_url( $demo_id, $current_template ),
515
+ 'description' => $description,
516
+ 'author' => $author,
517
'actions' => array(
518
'pro_link' => $premium_link,
519
'preview_url' => $demo_data['preview'],
527
'theme' => $demo_data['theme'],
528
'package' => $demo_package,
529
'screenshot' => $this->import_file_url( $demo_id, 'screenshot.jpg' ),
530
+ 'description' => $description,
531
+ 'author' => $author,
532
'authorAndUri' => '<a href="https://themegrill.com" target="_blank">ThemeGrill</a>',
533
+ 'version' => $version,
534
'active' => $demo_id === $demo_activated_id,
535
'hasNotice' => $demo_notices,
536
'plugins' => $plugins_list,
537
+ 'pluginActions' => array(
538
+ 'install' => wp_list_filter( $plugins_list, array( 'is_install' => false ) ) ? true : false,
539
+ 'activate' => wp_list_filter( $plugins_list, array( 'is_active' => false ) ) ? true : false,
540
+ ),
541
'actions' => array(
542
'preview' => home_url( '/' ),
543
'demo_url' => $demo_data['demo_url'],
564
* Demo Importer page output.
565
*/
566
public function demo_importer() {
567
+ $demos = $this->prepare_demos_for_js( tg_demo_installer_preview() ? $this->demo_packages : $this->demo_config );
568
569
if ( isset( $_GET['action'] ) && 'upload-demo' === $_GET['action'] ) {
570
$this->upload_demo_pack();
571
} else {
572
+ $suffix = tg_demo_installer_enabled() ? 'installer' : 'importer';
573
+ include_once( dirname( __FILE__ ) . "/admin/views/html-admin-page-{$suffix}.php" );
574
}
575
}
576
594
$type = 'upload'; // Install demo type, From Web or an Upload.
595
596
// Demo Upgrader Class.
597
+ include_once( dirname( __FILE__ ) . '/admin/class-demo-upgrader.php' );
598
+ include_once( dirname( __FILE__ ) . '/admin/class-demo-installer-skin.php' );
599
600
$upgrader = new TG_Demo_Upgrader( new TG_Demo_Installer_Skin( compact( 'type', 'title', 'nonce', 'url' ) ) );
601
$result = $upgrader->install( $file_upload->package );
691
}
692
693
// Include WXR Importer.
694
+ require( dirname( __FILE__ ) . '/importers/wordpress-importer/class-wxr-importer.php' );
695
696
do_action( 'themegrill_ajax_before_dummy_xml_import', $demo_data, $demo_id );
697
includes/{includes/functions-demo-importer.php → functions-demo-importer.php} RENAMED
@@ -12,31 +12,8 @@ if ( ! defined( 'ABSPATH' ) ) {
12
exit;
13
}
14
15
- if ( ! function_exists( 'tg_get_demo_file_url' ) ) {
16
-
17
- /**
18
- * Get a demo file URL.
19
- *
20
- * @param string $demo_dir demo dir.
21
- * @return string the demo data file URL.
22
- */
23
- function tg_get_demo_file_url( $demo_dir ) {
24
- return apply_filters( 'themegrill_demo_file_url', get_template_directory_uri() . '/inc/demo-data/' . $demo_dir, $demo_dir );
25
- }
26
- }
27
-
28
- if ( ! function_exists( 'tg_get_demo_file_path' ) ) {
29
-
30
- /**
31
- * Get a demo file path.
32
- *
33
- * @param string $demo_dir demo dir.
34
- * @return string the demo data file path.
35
- */
36
- function tg_get_demo_file_path( $demo_dir ) {
37
- return apply_filters( 'themegrill_demo_file_path', get_template_directory() . '/inc/demo-data/' . $demo_dir . '/dummy-data', $demo_dir );
38
- }
39
- }
40
41
/**
42
* Get an attachment ID from the filename.
@@ -83,6 +60,40 @@ function tg_get_attachment_id( $filename ) {
83
return $attachment_id;
84
}
85
86
/**
87
* Ajax handler for deleting a demo pack.
88
* @see tg_delete_demo_pack()
@@ -215,6 +226,32 @@ function tg_delete_demo_pack( $demo_pack, $redirect = '' ) {
215
return true;
216
}
217
218
/**
219
* Clear data before demo import AJAX action.
220
*
@@ -347,3 +384,74 @@ function tg_set_wc_pages( $demo_id ) {
347
// We no longer need WC setup wizard redirect.
348
delete_transient( '_wc_activation_redirect' );
349
}
12
exit;
13
}
14
15
+ // Include core functions (available in both admin and frontend).
16
+ include_once( TGDM_ABSPATH . 'includes/functions-demo-update.php' );
17
18
/**
19
* Get an attachment ID from the filename.
60
return $attachment_id;
61
}
62
63
+ /**
64
+ * Bulk plugin activation action.
65
+ */
66
+ function tg_activate_bulk_plugin() {
67
+ if ( ! empty( $_REQUEST['bulk_action'] ) ) {
68
+ if ( ! current_user_can( 'activate_plugins' ) ) {
69
+ wp_die( __( 'Sorry, you are not allowed to activate plugins for this site.', 'themegrill-demo-importer' ) );
70
+ }
71
+
72
+ check_admin_referer( 'bulk-plugins-activate' );
73
+
74
+ $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
75
+
76
+ if ( is_network_admin() ) {
77
+ foreach ( $plugins as $i => $plugin ) {
78
+ // Only activate plugins which are not already network activated.
79
+ if ( is_plugin_active_for_network( $plugin ) ) {
80
+ unset( $plugins[ $i ] );
81
+ }
82
+ }
83
+ } else {
84
+ foreach ( $plugins as $i => $plugin ) {
85
+ // Only activate plugins which are not already active and are not network-only when on Multisite.
86
+ if ( is_plugin_active( $plugin ) || ( is_multisite() && is_network_only_plugin( $plugin ) ) ) {
87
+ unset( $plugins[ $i ] );
88
+ }
89
+ }
90
+ }
91
+
92
+ activate_plugins( $plugins, '', is_network_admin() );
93
+ }
94
+ }
95
+ add_action( 'admin_init', 'tg_activate_bulk_plugin' );
96
+
97
/**
98
* Ajax handler for deleting a demo pack.
99
* @see tg_delete_demo_pack()
226
return true;
227
}
228
229
+ if ( ! function_exists( 'tg_demo_installer_enabled' ) ) {
230
+
231
+ /**
232
+ * Is demo installer enabled?
233
+ * @return bool
234
+ */
235
+ function tg_demo_installer_enabled() {
236
+ return apply_filters( 'themegrill_demo_importer_installer', true );
237
+ }
238
+ }
239
+
240
+ if ( ! function_exists( 'tg_demo_installer_preview' ) ) {
241
+
242
+ /**
243
+ * Is demo installer preview filter?
244
+ * @return bool
245
+ */
246
+ function tg_demo_installer_preview() {
247
+ if ( tg_demo_installer_enabled() && isset( $_GET['browse'] ) ) {
248
+ return 'preview' === $_GET['browse'] ? true : false;
249
+ }
250
+
251
+ return false;
252
+ }
253
+ }
254
+
255
/**
256
* Clear data before demo import AJAX action.
257
*
384
// We no longer need WC setup wizard redirect.
385
delete_transient( '_wc_activation_redirect' );
386
}
387
+
388
+ /**
389
+ * Prints the JavaScript templates for install admin notices.
390
+ *
391
+ * Template takes one argument with four values:
392
+ *
393
+ * param {object} data {
394
+ * Arguments for admin notice.
395
+ *
396
+ * @type string id ID of the notice.
397
+ * @type string className Class names for the notice.
398
+ * @type string message The notice's message.
399
+ * @type string type The type of update the notice is for. Either 'plugin' or 'theme'.
400
+ * }
401
+ *
402
+ * @since 1.4.0
403
+ */
404
+ function tg_print_admin_notice_templates() {
405
+ ?>
406
+ <script id="tmpl-wp-installs-admin-notice" type="text/html">
407
+ <div <# if ( data.id ) { #>id="{{ data.id }}"<# } #> class="notice {{ data.className }}"><p>{{{ data.message }}}</p></div>
408
+ </script>
409
+ <script id="tmpl-wp-bulk-installs-admin-notice" type="text/html">
410
+ <div id="{{ data.id }}" class="{{ data.className }} notice <# if ( data.errors ) { #>notice-error<# } else { #>notice-success<# } #>">
411
+ <p>
412
+ <# if ( data.successes ) { #>
413
+ <# if ( 1 === data.successes ) { #>
414
+ <# if ( 'plugin' === data.type ) { #>
415
+ <?php
416
+ /* translators: %s: Number of plugins */
417
+ printf( __( '%s plugin successfully installed.' ), '{{ data.successes }}' );
418
+ ?>
419
+ <# } #>
420
+ <# } else { #>
421
+ <# if ( 'plugin' === data.type ) { #>
422
+ <?php
423
+ /* translators: %s: Number of plugins */
424
+ printf( __( '%s plugins successfully installed.' ), '{{ data.successes }}' );
425
+ ?>
426
+ <# } #>
427
+ <# } #>
428
+ <# } #>
429
+ <# if ( data.errors ) { #>
430
+ <button class="button-link bulk-action-errors-collapsed" aria-expanded="false">
431
+ <# if ( 1 === data.errors ) { #>
432
+ <?php
433
+ /* translators: %s: Number of failed installs */
434
+ printf( __( '%s install failed.' ), '{{ data.errors }}' );
435
+ ?>
436
+ <# } else { #>
437
+ <?php
438
+ /* translators: %s: Number of failed installs */
439
+ printf( __( '%s installs failed.' ), '{{ data.errors }}' );
440
+ ?>
441
+ <# } #>
442
+ <span class="screen-reader-text"><?php _e( 'Show more details' ); ?></span>
443
+ <span class="toggle-indicator" aria-hidden="true"></span>
444
+ </button>
445
+ <# } #>
446
+ </p>
447
+ <# if ( data.errors ) { #>
448
+ <ul class="bulk-action-errors hidden">
449
+ <# _.each( data.errorMessages, function( errorMessage ) { #>
450
+ <li>{{ errorMessage }}</li>
451
+ <# } ); #>
452