Version Description
- Feature: Add native support for Gravity Forms Chained Select
- Feature: Include Gravity Forms add-on conditional logic in PDF Conditional Logic selector
- Feature: When the "Show Page Names" PDF setting is enabled, the
pagebreak
CSS class can now be used on Named Pagebreak fields (except the very first one) - Feature: PDF Rich Text fields now utilise the full width of the editor
- Dev Feature: Add $form_data API endpoint
- Dev Feature: Add the $form and $this variables to the
gfpdf_field_value
filter - Dev Feature: Add
gfpdf_form_data_key_order
filter to allow the re-ordering of the $form_data array - Dev Feature: Add filter
gfpdf_container_disable_faux_columns
to allow faux columns to be toggled off (useful when using a lot of conditional logic with CSS Ready Classes) - Housekeeping: Update Monolog to latest version
- Housekeeping: Instead of generic error, display
You do not have permission to view this PDF
when user failed PDF security checks - Housekeeping: Tweak the Help page to provide more relevant information.
- Housekeeping: Reduce the Gravity PDF log file bloat, and add more specific log messages.
- Housekeeping: Recursively clean-up the PDF temporary directory
- Housekeeping: Limit the registration of PDF settings on Gravity PDF pages, and the admin options.php page
- Bug: Prevent multiple calls running when a new template is installed/deleted and then selected
- Bug: Pre-process any mergetags for the Checkbox, HTML, Post Content, Radio, Section, Textarea and Terms of Service Gravity Form fields
- Bug: Fix individual quantity field $form_data
- Bug: Ensure individual product fields (Product, Discount, Shipping, Subtotal, Tax and Total) display an empty value in the $form_data array, when necissary
- Bug: Fix PDF Template Manager display issues for WordPress 4.8+
- Bug: Adjust Logged out timeout default to 20 minutes to match documentation
- Bug: Fix PHP notice when pre-procesing the template settings
- Bug: Fix Survey $form_data['survey']['score'] key
- Bug: Fix the Gravity Perks E-Commerce Subtotal value in the $form_data array
- Bug: Prevent TinyMCE error when selecting a new template and other plugins define a custom TinyMCE plugin
- Bug: Adjust PDF Template Upload limit from 5MB to 10MB
- Bug: Fix Product field background color issue
- Bug: Right-align prices in the product table
- Bug: Fix PHP fatal error when PDF cannot be correctly saved to disk
Download this release
Release Info
Developer | Blue Liquid Designs |
Plugin | Gravity PDF |
Version | 4.4.0 |
Comparing to | |
See all releases |
Code changes from version 4.3.2 to 4.4.0
- README.txt +36 -1
- api.php +23 -2
- dist/assets/css/gfpdf-styles.min.css +1 -1
- dist/assets/js/app.bundle.min.js +1 -1
- dist/assets/js/gfpdf-settings.min.js +1 -1
- pdf.php +4 -4
- src/assets/css/gfpdf-admin-styles.css +0 -17
- src/assets/css/gfpdf-styles.css +0 -983
- src/assets/images/gravitypdf-globe-white.png +0 -0
- src/assets/images/updating-advanced-template-selector.png +0 -0
- src/assets/images/updating-four-columns.png +0 -0
- src/assets/images/updating-merge-tags.png +0 -0
- src/assets/js/gfpdf-backbone.js +0 -1113
- src/assets/js/gfpdf-entries.js +0 -41
- src/assets/js/gfpdf-migration.js +0 -74
- src/assets/js/gfpdf-settings.js +0 -1462
- src/assets/js/react/actionTypes/templates.js +0 -35
- src/assets/js/react/actions/templates.js +0 -137
- src/assets/js/react/bootstrap/templateBootstrap.js +0 -179
- src/assets/js/react/components/Dropzone.js +0 -79
- src/assets/js/react/components/Empty.js +0 -37
- src/assets/js/react/components/ShowMessage.js +0 -167
- src/assets/js/react/components/TemplateActivateButton.js +0 -106
- src/assets/js/react/components/TemplateButton.js +0 -78
- src/assets/js/react/components/TemplateCloseDialog.js +0 -105
- src/assets/js/react/components/TemplateContainer.js +0 -122
- src/assets/js/react/components/TemplateDeleteButton.js +0 -153
- src/assets/js/react/components/TemplateFooterActions.js +0 -106
- src/assets/js/react/components/TemplateHeaderNavigation.js +0 -210
- src/assets/js/react/components/TemplateHeaderTitle.js +0 -49
- src/assets/js/react/components/TemplateList.js +0 -115
- src/assets/js/react/components/TemplateListItem.js +0 -170
- src/assets/js/react/components/TemplateListItemComponents.js +0 -61
- src/assets/js/react/components/TemplateScreenshot.js +0 -52
- src/assets/js/react/components/TemplateScreenshots.js +0 -54
- src/assets/js/react/components/TemplateSearch.js +0 -155
- src/assets/js/react/components/TemplateSingle.js +0 -174
- src/assets/js/react/components/TemplateSingleComponents.js +0 -180
- src/assets/js/react/components/TemplateUploader.js +0 -301
- src/assets/js/react/gfpdf-main.js +0 -63
- src/assets/js/react/reducers/templateReducer.js +0 -155
- src/assets/js/react/router/templateRouter.js +0 -122
- src/assets/js/react/selectors/getTemplates.js +0 -186
- src/assets/js/react/utilities/versionCompare.js +0 -153
- src/assets/languages/gravity-forms-pdf-extended.pot +153 -145
- src/autoload.php +2 -2
- src/bootstrap.php +30 -7
- src/controller/Controller_Actions.php +2 -2
- src/controller/Controller_Activation.php +2 -2
- src/controller/Controller_Form_Settings.php +2 -2
- src/controller/Controller_Install.php +2 -2
- src/controller/Controller_Mergetags.php +2 -2
- src/controller/Controller_PDF.php +3 -2
- src/controller/Controller_Settings.php +2 -2
- src/controller/Controller_Shortcodes.php +2 -4
- src/controller/Controller_Templates.php +2 -2
- src/controller/Controller_Welcome_Screen.php +2 -2
- src/deprecated.php +9 -2
- src/helper/Helper_Data.php +2 -2
- src/helper/Helper_Field_Container.php +13 -3
- src/helper/Helper_Field_Container_Void.php +2 -2
- src/helper/Helper_Form.php +2 -2
- src/helper/Helper_Logger.php +12 -8
- src/helper/Helper_Migration.php +4 -4
- src/helper/Helper_Misc.php +2 -2
- src/helper/Helper_Notices.php +2 -2
- src/helper/Helper_Options_Fields.php +8 -8
- src/helper/Helper_PDF.php +17 -3
- src/helper/Helper_PDF_List_Table.php +2 -2
- src/helper/Helper_QueryPath.php +2 -2
- src/helper/Helper_Singleton.php +2 -2
- src/helper/Helper_Templates.php +2 -2
- src/helper/abstract/Helper_Abstract_Addon.php +2 -2
- src/helper/abstract/Helper_Abstract_Controller.php +2 -2
- src/helper/abstract/Helper_Abstract_Field_Products.php +2 -2
- src/helper/abstract/Helper_Abstract_Fields.php +3 -3
- src/helper/abstract/Helper_Abstract_Form.php +2 -2
- src/helper/abstract/Helper_Abstract_Model.php +2 -2
- src/helper/abstract/Helper_Abstract_Options.php +13 -36
- src/helper/abstract/Helper_Abstract_View.php +2 -2
- src/helper/fields/Field_Address.php +2 -2
- src/helper/fields/Field_Chainedselect.php +136 -0
- src/helper/fields/Field_Checkbox.php +4 -4
- src/helper/fields/Field_Coupon.php +2 -2
- src/helper/fields/Field_Creditcard.php +2 -2
- src/helper/fields/Field_Date.php +2 -2
- src/helper/fields/Field_Default.php +2 -2
- src/helper/fields/Field_Discount.php +3 -3
- src/helper/fields/Field_Email.php +2 -2
- src/helper/fields/Field_Fileupload.php +2 -2
- src/helper/fields/Field_Hidden.php +2 -2
- src/helper/fields/Field_Html.php +7 -3
- src/helper/fields/Field_Likert.php +2 -2
- src/helper/fields/Field_List.php +2 -2
- src/helper/fields/Field_Multiselect.php +2 -2
- src/helper/fields/Field_Name.php +2 -2
- src/helper/fields/Field_Number.php +2 -2
- src/helper/fields/Field_Option.php +2 -2
- src/helper/fields/Field_Phone.php +2 -2
- src/helper/fields/Field_Poll.php +2 -2
- src/helper/fields/Field_Post_Category.php +2 -2
- src/helper/fields/Field_Post_Content.php +5 -3
- src/helper/fields/Field_Post_Custom_Field.php +2 -2
- src/helper/fields/Field_Post_Excerpt.php +2 -2
- src/helper/fields/Field_Post_Image.php +2 -2
- src/helper/fields/Field_Post_Tags.php +2 -2
- src/helper/fields/Field_Post_Title.php +2 -2
- src/helper/fields/Field_Product.php +3 -3
- src/helper/fields/Field_Products.php +8 -8
- src/helper/fields/Field_Quantity.php +4 -11
- src/helper/fields/Field_Quiz.php +2 -2
- src/helper/fields/Field_Radio.php +4 -5
- src/helper/fields/Field_Rank.php +2 -2
- src/helper/fields/Field_Rating.php +2 -2
- src/helper/fields/Field_Section.php +5 -3
- src/helper/fields/Field_Select.php +2 -2
- src/helper/fields/Field_Shipping.php +3 -3
- src/helper/fields/Field_Signature.php +2 -2
- src/helper/fields/Field_Subtotal.php +8 -13
- src/helper/fields/Field_Survey.php +2 -2
- src/helper/fields/Field_Tax.php +3 -3
- src/helper/fields/Field_Text.php +2 -2
- src/helper/fields/Field_Textarea.php +7 -3
- src/helper/fields/Field_Time.php +2 -2
- src/helper/fields/Field_Tos.php +7 -3
- src/helper/fields/Field_Total.php +3 -3
- src/helper/fields/Field_Website.php +2 -2
- src/helper/fields/Field_v3_List.php +2 -2
- src/helper/fields/Field_v3_Products.php +2 -2
- src/helper/fields/Field_v3_Section.php +2 -2
- src/helper/interface/Helper_Interface_Actions.php +2 -2
- src/helper/interface/Helper_Interface_Config.php +2 -2
- src/helper/interface/Helper_Interface_Extension_Settings.php +2 -2
- src/helper/interface/Helper_Interface_Filters.php +2 -2
- src/helper/interface/Helper_Interface_Setup_TearDown.php +2 -2
- src/helper/licensing/EDD_SL_Plugin_Updater.php +1 -1
- src/helper/trait/Helper_Trait_Logger.php +2 -2
- src/model/Model_Actions.php +2 -2
- src/model/Model_Form_Settings.php +17 -17
- src/model/Model_Install.php +11 -26
- src/model/Model_Mergetags.php +3 -3
- src/model/Model_PDF.php +55 -52
- src/model/Model_Settings.php +9 -10
- src/model/Model_Shortcodes.php +4 -7
- src/model/Model_Templates.php +2 -2
- src/model/Model_Welcome_Screen.php +2 -4
- src/templates/config/blank-slate.php +2 -2
- src/templates/config/focus-gravity.php +2 -2
- src/templates/config/legacy.php +2 -2
- src/templates/config/rubix.php +2 -2
- src/templates/config/zadani.php +2 -2
- src/view/View_Actions.php +2 -2
- src/view/View_Form_Settings.php +2 -2
- src/view/View_PDF.php +21 -6
- src/view/View_Settings.php +2 -6
- src/view/View_Shortcodes.php +2 -2
- src/view/View_Welcome_Screen.php +2 -2
- src/view/html/Actions/action_buttons.php +2 -2
- src/view/html/Actions/begin_multisite_migration.php +2 -2
- src/view/html/Actions/end_multisite_migration.php +2 -2
- src/view/html/Actions/migration.php +2 -2
- src/view/html/Actions/review_plugin.php +2 -2
- src/view/html/FormSettings/add_edit.php +8 -3
- src/view/html/FormSettings/list.php +2 -2
- src/view/html/PDF/core_template_styles.php +5 -4
- src/view/html/PDF/entry_detailed_pdf.php +2 -2
- src/view/html/PDF/entry_list_pdf_multiple.php +2 -2
- src/view/html/PDF/entry_list_pdf_single.php +2 -2
- src/view/html/PDF/form_title.php +2 -2
- src/view/html/PDF/page_title.php +3 -3
- src/view/html/Settings/extensions.php +2 -2
- src/view/html/Settings/general.php +8 -2
- src/view/html/Settings/help.php +17 -13
- src/view/html/Settings/license.php +3 -3
- src/view/html/Settings/system_status.php +2 -2
- src/view/html/Settings/tabs.php +2 -2
- src/view/html/Settings/tools.php +2 -2
- src/view/html/Settings/uninstaller.php +2 -2
- src/view/html/Shortcodes/conditional_logic_not_met.php +2 -2
- src/view/html/Shortcodes/gravitypdf.php +2 -2
- src/view/html/Shortcodes/invalid_pdf_config.php +2 -2
- src/view/html/Shortcodes/no_entry_id.php +2 -2
- src/view/html/Shortcodes/pdf_not_active.php +2 -2
- src/view/html/Welcome/more.php +15 -11
- src/view/html/Welcome/welcome.php +2 -2
- vendor/composer/autoload_classmap.php +8 -0
- vendor/composer/autoload_static.php +8 -0
- vendor/composer/installed.json +15 -13
- vendor/monolog/monolog/.php_cs +59 -15
- vendor/monolog/monolog/{CHANGELOG.mdown → CHANGELOG.md} +96 -0
- vendor/monolog/monolog/LICENSE +1 -1
- vendor/monolog/monolog/{README.mdown → README.md} +0 -0
- vendor/monolog/monolog/composer.json +14 -9
- vendor/monolog/monolog/doc/01-usage.md +3 -0
- vendor/monolog/monolog/doc/02-handlers-formatters-processors.md +16 -1
- vendor/monolog/monolog/src/Monolog/ErrorHandler.php +13 -5
- vendor/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php +2 -3
- vendor/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php +3 -1
- vendor/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php +85 -0
- vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php +30 -3
- vendor/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php +6 -5
- vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php +95 -3
- vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php +24 -4
- vendor/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php +1 -1
- vendor/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php +3 -2
- vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php +118 -14
- vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php +5 -3
- vendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php +10 -1
- vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php +67 -17
- vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php +58 -20
- vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php +2 -2
- vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php +9 -2
- vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php +1 -1
- vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php +21 -19
- vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php +3 -5
- vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php +169 -0
- vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php +25 -7
- vendor/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php +1 -1
- vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php +2 -2
- vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php +3 -3
- vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php +6 -6
- vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php +21 -11
- vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php +1 -1
- vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php +3 -3
- vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php +24 -0
- vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php +108 -0
- vendor/monolog/monolog/src/Monolog/Handler/HipChatHandler.php +26 -13
- vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php +6 -6
- vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php +4 -4
- vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php +12 -0
- vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php +2 -2
- vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php +7 -3
- vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php +14 -5
- vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php +20 -16
- vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php +1 -1
- vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php +4 -4
- vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php +7 -7
- vendor/monolog/monolog/src/Monolog/Handler/RavenHandler.php +46 -3
- vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php +5 -5
- vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php +63 -16
- vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php +25 -2
- vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php +294 -0
- vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php +81 -159
- vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php +115 -0
- vendor/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php +80 -0
- vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php +66 -4
- vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php +34 -4
- vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php +16 -4
- vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php +1 -1
- vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php +4 -0
- vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php +27 -4
- vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php +49 -43
- vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php +4 -0
- vendor/monolog/monolog/src/Monolog/Logger.php +71 -20
- vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php +22 -3
- vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php +4 -4
- vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php +63 -0
- vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php +8 -0
- vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php +12 -4
- vendor/monolog/monolog/src/Monolog/Registry.php +3 -3
- vendor/monolog/monolog/tests/Monolog/Formatter/ChromePHPFormatterTest.php +5 -5
- vendor/monolog/monolog/tests/Monolog/Formatter/ElasticaFormatterTest.php +1 -1
- vendor/monolog/monolog/tests/Monolog/Formatter/FluentdFormatterTest.php +62 -0
- vendor/monolog/monolog/tests/Monolog/Formatter/GelfMessageFormatterTest.php +58 -4
- vendor/monolog/monolog/tests/Monolog/Formatter/JsonFormatterTest.php +105 -0
- vendor/monolog/monolog/tests/Monolog/Formatter/LineFormatterTest.php +16 -2
- vendor/monolog/monolog/tests/Monolog/Formatter/LogstashFormatterTest.php +50 -6
- vendor/monolog/monolog/tests/Monolog/Formatter/MongoDBFormatterTest.php +18 -9
- vendor/monolog/monolog/tests/Monolog/Formatter/NormalizerFormatterTest.php +159 -6
- vendor/monolog/monolog/tests/Monolog/Formatter/ScalarFormatterTest.php +22 -10
- vendor/monolog/monolog/tests/Monolog/Handler/AmqpHandlerTest.php +4 -4
- vendor/monolog/monolog/tests/Monolog/Handler/ChromePHPHandlerTest.php +19 -4
- vendor/monolog/monolog/tests/Monolog/Handler/DeduplicationHandlerTest.php +165 -0
- vendor/monolog/monolog/tests/Monolog/Handler/DynamoDbHandlerTest.php +11 -2
- vendor/monolog/monolog/tests/Monolog/Handler/FingersCrossedHandlerTest.php +24 -0
- vendor/monolog/monolog/tests/Monolog/Handler/GroupHandlerTest.php +23 -0
- vendor/monolog/monolog/tests/Monolog/Handler/HandlerWrapperTest.php +130 -0
- vendor/monolog/monolog/tests/Monolog/Handler/HipChatHandlerTest.php +40 -5
- vendor/monolog/monolog/tests/Monolog/Handler/LogEntriesHandlerTest.php +1 -1
- vendor/monolog/monolog/tests/Monolog/Handler/NativeMailerHandlerTest.php +50 -0
- vendor/monolog/monolog/tests/Monolog/Handler/NewRelicHandlerTest.php +8 -0
- vendor/monolog/monolog/tests/Monolog/Handler/PHPConsoleHandlerTest.php +1 -2
- vendor/monolog/monolog/tests/Monolog/Handler/PushoverHandlerTest.php +1 -1
- vendor/monolog/monolog/tests/Monolog/Handler/RavenHandlerTest.php +73 -3
- vendor/monolog/monolog/tests/Monolog/Handler/RedisHandlerTest.php +2 -2
- vendor/monolog/monolog/tests/Monolog/Handler/RollbarHandlerTest.php +84 -0
- vendor/monolog/monolog/tests/Monolog/Handler/RotatingFileHandlerTest.php +122 -10
- vendor/monolog/monolog/tests/Monolog/Handler/Slack/SlackRecordTest.php +387 -0
- vendor/monolog/monolog/tests/Monolog/Handler/SlackHandlerTest.php +33 -11
- vendor/monolog/monolog/tests/Monolog/Handler/SlackWebhookHandlerTest.php +107 -0
- vendor/monolog/monolog/tests/Monolog/Handler/SlackbotHandlerTest.php +47 -0
- vendor/monolog/monolog/tests/Monolog/Handler/SocketHandlerTest.php +27 -0
- vendor/monolog/monolog/tests/Monolog/Handler/StreamHandlerTest.php +17 -1
- vendor/monolog/monolog/tests/Monolog/Handler/SwiftMailerHandlerTest.php +48 -0
- vendor/monolog/monolog/tests/Monolog/Handler/SyslogUdpHandlerTest.php +31 -4
- vendor/monolog/monolog/tests/Monolog/Handler/TestHandlerTest.php +4 -0
- vendor/monolog/monolog/tests/Monolog/Handler/ZendMonitorHandlerTest.php +1 -1
- vendor/monolog/monolog/tests/Monolog/LoggerTest.php +77 -0
- vendor/monolog/monolog/tests/Monolog/Processor/MercurialProcessorTest.php +41 -0
- vendor/monolog/monolog/tests/Monolog/Processor/PsrLogMessageProcessorTest.php +1 -1
- vendor/monolog/monolog/tests/Monolog/Processor/UidProcessorTest.php +6 -0
- vendor/monolog/monolog/tests/Monolog/Processor/WebProcessorTest.php +15 -0
- vendor/monolog/monolog/tests/Monolog/RegistryTest.php +0 -1
- vendor/monolog/monolog/tests/Monolog/TestCase.php +1 -1
README.txt
CHANGED
@@ -5,7 +5,8 @@ Donate link: https://gravitypdf.com/donate-to-plugin/
|
|
5 |
Tags: gravity, forms, pdf, automation, attachment, email
|
6 |
Requires at least: 4.4
|
7 |
Tested up to: 4.9
|
8 |
-
Stable tag: 4.
|
|
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl.txt
|
11 |
|
@@ -32,6 +33,10 @@ The plugin ships with four highly-customisable PDF templates perfectly suited fo
|
|
32 |
* [The documentation](https://gravitypdf.com/documentation/v4/user-installation/) has everything from basic install instructions to advanced developer how-to guides. Our friendly team is also on hand to [provide FREE general support](https://gravitypdf.com/support/).
|
33 |
* PHP, HTML and CSS come easy? [You’ll find creating your own PDF templates a breeze](https://gravitypdf.com/documentation/v4/developer-start-customising/). If not, [we offer PDF design services](https://gravitypdf.com/integration-services/) tailored just for you. We can even auto-fill existing PDFs!
|
34 |
|
|
|
|
|
|
|
|
|
35 |
= Requirements =
|
36 |
|
37 |
Gravity PDF can be run on most shared web hosting without any issues. It requires **PHP 5.4+** (PHP 7.0+ recommended) and at least 64MB of WP Memory (128MB+ recommended). You'll also need to be running WordPress 4.2+ and have [Gravity Forms 1.9+](https://rocketgenius.pxf.io/c/1211356/445235/7938) (affiliate link).
|
@@ -85,6 +90,36 @@ Also, if you enjoy using the software [we'd love it if you could give us a revie
|
|
85 |
|
86 |
== Changelog ==
|
87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
= 4.3.2 =
|
89 |
* Bug: Reverse pricing issue bug fix in 4.3.1 (under some circumstances it cause the incorrect Unit Price to be displayed in product table)
|
90 |
* Bug: Fix Unit Price currency issue in the product table when using the Gravity Forms Multi Currency plugin
|
5 |
Tags: gravity, forms, pdf, automation, attachment, email
|
6 |
Requires at least: 4.4
|
7 |
Tested up to: 4.9
|
8 |
+
Stable tag: 4.4.0
|
9 |
+
Requires PHP: 5.4
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl.txt
|
12 |
|
33 |
* [The documentation](https://gravitypdf.com/documentation/v4/user-installation/) has everything from basic install instructions to advanced developer how-to guides. Our friendly team is also on hand to [provide FREE general support](https://gravitypdf.com/support/).
|
34 |
* PHP, HTML and CSS come easy? [You’ll find creating your own PDF templates a breeze](https://gravitypdf.com/documentation/v4/developer-start-customising/). If not, [we offer PDF design services](https://gravitypdf.com/integration-services/) tailored just for you. We can even auto-fill existing PDFs!
|
35 |
|
36 |
+
= Premium Extensions and Templates =
|
37 |
+
|
38 |
+
[Unlock more features for Gravity PDF with one of our premium extensions](https://gravitypdf.com/extension-shop/). If one of the free PDF templates aren't working for you, [try a premium template instead](https://gravitypdf.com/template-shop/).
|
39 |
+
|
40 |
= Requirements =
|
41 |
|
42 |
Gravity PDF can be run on most shared web hosting without any issues. It requires **PHP 5.4+** (PHP 7.0+ recommended) and at least 64MB of WP Memory (128MB+ recommended). You'll also need to be running WordPress 4.2+ and have [Gravity Forms 1.9+](https://rocketgenius.pxf.io/c/1211356/445235/7938) (affiliate link).
|
90 |
|
91 |
== Changelog ==
|
92 |
|
93 |
+
= 4.4.0 =
|
94 |
+
* Feature: Add native support for Gravity Forms Chained Select
|
95 |
+
* Feature: Include Gravity Forms add-on conditional logic in PDF Conditional Logic selector
|
96 |
+
* Feature: When the "Show Page Names" PDF setting is enabled, the `pagebreak` CSS class can now be used on Named Pagebreak fields (except the very first one)
|
97 |
+
* Feature: PDF Rich Text fields now utilise the full width of the editor
|
98 |
+
* Dev Feature: Add $form_data API endpoint
|
99 |
+
* Dev Feature: Add the $form and $this variables to the `gfpdf_field_value` filter
|
100 |
+
* Dev Feature: Add `gfpdf_form_data_key_order` filter to allow the re-ordering of the $form_data array
|
101 |
+
* Dev Feature: Add filter `gfpdf_container_disable_faux_columns` to allow faux columns to be toggled off (useful when using a lot of conditional logic with CSS Ready Classes)
|
102 |
+
* Housekeeping: Update Monolog to latest version
|
103 |
+
* Housekeeping: Instead of generic error, display `You do not have permission to view this PDF` when user failed PDF security checks
|
104 |
+
* Housekeeping: Tweak the Help page to provide more relevant information.
|
105 |
+
* Housekeeping: Reduce the Gravity PDF log file bloat, and add more specific log messages.
|
106 |
+
* Housekeeping: Recursively clean-up the PDF temporary directory
|
107 |
+
* Housekeeping: Limit the registration of PDF settings on Gravity PDF pages, and the admin options.php page
|
108 |
+
* Bug: Prevent multiple calls running when a new template is installed/deleted and then selected
|
109 |
+
* Bug: Pre-process any mergetags for the Checkbox, HTML, Post Content, Radio, Section, Textarea and Terms of Service Gravity Form fields
|
110 |
+
* Bug: Fix individual quantity field $form_data
|
111 |
+
* Bug: Ensure individual product fields (Product, Discount, Shipping, Subtotal, Tax and Total) display an empty value in the $form_data array, when necissary
|
112 |
+
* Bug: Fix PDF Template Manager display issues for WordPress 4.8+
|
113 |
+
* Bug: Adjust Logged out timeout default to 20 minutes to match documentation
|
114 |
+
* Bug: Fix PHP notice when pre-procesing the template settings
|
115 |
+
* Bug: Fix Survey $form_data['survey']['score'] key
|
116 |
+
* Bug: Fix the Gravity Perks E-Commerce Subtotal value in the $form_data array
|
117 |
+
* Bug: Prevent TinyMCE error when selecting a new template and other plugins define a custom TinyMCE plugin
|
118 |
+
* Bug: Adjust PDF Template Upload limit from 5MB to 10MB
|
119 |
+
* Bug: Fix Product field background color issue
|
120 |
+
* Bug: Right-align prices in the product table
|
121 |
+
* Bug: Fix PHP fatal error when PDF cannot be correctly saved to disk
|
122 |
+
|
123 |
= 4.3.2 =
|
124 |
* Bug: Reverse pricing issue bug fix in 4.3.1 (under some circumstances it cause the incorrect Unit Price to be displayed in product table)
|
125 |
* Bug: Fix Unit Price currency issue in the product table when using the Gravity Forms Multi Currency plugin
|
api.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
*
|
8 |
*
|
9 |
* @package Gravity PDF
|
10 |
-
* @copyright Copyright (c)
|
11 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
12 |
* @since 4.0
|
13 |
*/
|
@@ -20,7 +20,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
20 |
/*
|
21 |
This file is part of Gravity PDF.
|
22 |
|
23 |
-
Gravity PDF – Copyright (C)
|
24 |
|
25 |
This program is free software; you can redistribute it and/or modify
|
26 |
it under the terms of the GNU General Public License as published by
|
@@ -645,4 +645,25 @@ final class GPDFAPI {
|
|
645 |
|
646 |
return true;
|
647 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
648 |
}
|
7 |
*
|
8 |
*
|
9 |
* @package Gravity PDF
|
10 |
+
* @copyright Copyright (c) 2018 Blue Liquid Designs
|
11 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
12 |
* @since 4.0
|
13 |
*/
|
20 |
/*
|
21 |
This file is part of Gravity PDF.
|
22 |
|
23 |
+
Gravity PDF – Copyright (C) 2018 Blue Liquid Designs
|
24 |
|
25 |
This program is free software; you can redistribute it and/or modify
|
26 |
it under the terms of the GNU General Public License as published by
|
645 |
|
646 |
return true;
|
647 |
}
|
648 |
+
|
649 |
+
/**
|
650 |
+
* Return the $form_data array used in custom PDF templates
|
651 |
+
*
|
652 |
+
* @param int $entry_id
|
653 |
+
*
|
654 |
+
* @return array|WP_Error
|
655 |
+
*
|
656 |
+
* @since 4.4
|
657 |
+
*/
|
658 |
+
public static function get_form_data( $entry_id ) {
|
659 |
+
$gform = self::get_form_class();
|
660 |
+
$pdf_model = self::get_mvc_class( 'Model_PDF' );
|
661 |
+
$entry = $gform->get_entry( $entry_id );
|
662 |
+
|
663 |
+
if ( is_wp_error( $entry ) ) {
|
664 |
+
return $entry;
|
665 |
+
}
|
666 |
+
|
667 |
+
return $pdf_model->get_form_data( $entry );
|
668 |
+
}
|
669 |
}
|
dist/assets/css/gfpdf-styles.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.about-wrap .gfpdf-badge{margin-bottom:1.5em;position:relative;width:100%}.about-wrap .feature-section:not(.under-the-hood) .col.gfpdf-breakdown{margin-top:0}.gfpdf-badge{background:url(../../../src/assets/images/gravitypdf-globe-black.png) no-repeat 50% 5px;color:#333;display:inline-block;font-size:14px;font-weight:600;height:40px;margin:5px 0 0;padding-top:120px;text-align:center;text-rendering:optimizelegibility}.gfpdf-page .about-wrap [class$=col] .col{border-bottom:none}.gfpdf-page .about-wrap .feature-section{border-bottom:1px solid rgba(0,0,0,.1)}.gfpdf-page .about-wrap .feature-section.two-col .col{vertical-align:middle}div img.gfpdf-image{border:1px solid #ccc;max-width:98%;-webkit-box-shadow:1px 1px 5px 1px rgba(0,0,0,.15);-moz-box-shadow:1px 1px 5px 1px rgba(0,0,0,.15);box-shadow:1px 1px 5px 1px rgba(0,0,0,.15)}#pdfextended-settings{margin-top:20px}#pdfextended-settings h3,#tab_pdf h3{margin-top:5px;line-height:1.3em}#pdfextended-settings h3 i,#tab_pdf h3 i{padding-right:2px}#pdfextended-settings #add-new-pdf{padding:4px 8px}#pdfextended-settings div.notice,div.pdf-notice{margin:5px 15px 2px;padding:0 .6em}.gfpdf-page #pdfextended-settings .theme div.notice,.gfpdf-page #pdfextended-settings .theme-info div.notice,.gfpdf-page .theme div.notice,.gfpdf-page .theme-info div.notice{margin:0;z-index:500;color:#444;padding:1px 12px}.gfpdf-page div.error,.gfpdf-page div.notice,div.pdf-error,div.pdf-notice{background-color:#fff;border-left:4px solid #7ad03a;box-shadow:0 1px 1px 0 rgba(0,0,0,.1)}.gfpdf-page div.error,div.pdf-error{border-left-color:#dc3232}.gfpdf-page div.notice,div.pdf-notice{margin:5px 0 15px;padding:1px 12px}#pdfextended-settings #gfpdf-advanced-options,#tab_pdf #gfpdf-advanced-options{display:none;margin-bottom:20px}.no-js #pdfextended-settings #gfpdf-advanced-options,.no-js #tab_pdf #gfpdf-advanced-options{display:block}#pdfextended-settings .gfpdf-advanced-options,#tab_pdf .gfpdf-advanced-options{margin-top:-5px}.no-js #pdfextended-settings .gfpdf-advanced-options,.no-js #tab_pdf .gfpdf-advanced-options{display:none}#pdfextended-settings select.large,#tab_pdf select.large{width:100%;max-width:350px}#tab_pdf .formSubmitted input:invalid{border:1px solid red}#tab_pdf .wp-editor-wrap{margin:0 12px 0 0}.rtl #pdfextended-settings label,.rtl #tab_pdf label{float:right;margin-left:5px}#pdf-license .fa-exclamation-circle{color:red}#pdf-license .fa-check{color:green}#pdfextended-settings table.gfpdf_table thead th{font-weight:700}#pdfextended-settings table.gfpdf_table tr:nth-child(2n) td,#pdfextended-settings table.gfpdf_table tr:nth-child(2n) th{background:none repeat scroll 0 0 #fcfcfc}#pdfextended-settings p.submit{padding-bottom:0;margin-bottom:0}#pdfextended-settings span.details.path,#pdfextended-settings span.path{padding:2px;background:#f2f2f2}#setup-templates-confirm ul{margin-top:5px}#setup-templates-confirm li{list-style-type:disc;margin-left:20px}#manage-font-files div{margin:10px 0}#manage-font-files div.updated{margin-top:0}#manage-font-files li{border:1px solid #ccc;position:relative}#manage-font-files li .delete-font{position:absolute;top:0;right:0;padding:5px 10px}#manage-font-files li .delete-font:hover{background:#dc0606;color:#fff}#manage-font-files input.invalid{border:1px solid red}#manage-font-files .font-submit{text-align:center}#manage-font-files #font-add-list{border:none;text-align:center;color:#ccc;cursor:pointer}#manage-font-files #font-empty{font-size:14px;font-style:italic;line-height:21px;padding:60px 0 15px;text-align:center}#manage-font-files #font-add-list:hover{color:#555}#manage-font-files #font-add-list span{display:block;text-transform:uppercase;margin-top:-5px}#manage-font-files li a{display:block;background:#eee;padding:5px 7px;text-decoration:none}#manage-font-files li a.font-name .fa{margin-right:5px}#manage-font-files li a:hover{background:#e9e9e9}#manage-font-files .font-settings{padding:5px 7px}#manage-font-files .gf_settings_description{font-size:95%}#manage-font-files .font-selector>label,#manage-font-files .font-settings>label{float:left;width:9em}#manage-font-files .regular-text{width:16em}#manage-font-files .css-usage{text-align:center}#manage-font-files .css-usage input{width:100%;text-align:center}#manage-font-files .css-usage pre{margin:5px 0;background:#eee;padding:7.5px}.rtl #font-list .css-usage input{direction:ltr!important}#pdfextended-settings .metabox-holder h3{font-size:14px}#pdfextended-settings .postbox-container .postbox{margin:0 8px 20px 0}#pdfextended-settings .postbox h3.hndle{padding-bottom:12px}#pdfextended-settings .postbox .hndle,#pdfextended-settings .widget .widget-top{cursor:default}#pdfextended-settings #pdf_support_hours h3,#pdfextended-settings .postbox .handlediv{display:none}#pdfextended-settings .about-wrap,#pdfextended-settings .about-wrap .about-text{max-width:none;min-height:0;line-height:1.8em}#pdfextended-settings .about-wrap #search-knowledgebase,#pdfextended-settings .about-wrap .about-text,#pdfextended-settings .about-wrap h1{text-align:center;margin-right:0}#pdfextended-settings .postbox .inside{margin-bottom:0}#pdfextended-settings .about-wrap h1{margin-top:40px}#pdfextended-settings .about-wrap #search-knowledgebase input{font-family:FontAwesome,'Open Sans',sans-serif;font-size:22px;margin:10px 0 0;padding:16px 20px;line-height:25px;width:100%}#pdfextended-settings #search-results{text-align:left;margin:0 auto;width:100%}#pdfextended-settings #search-results .postbox,#search-results .postbox .inside{display:none}#pdfextended-settings #search-results .postbox h3{margin-bottom:0}#pdfextended-settings #search-results .postbox.is-active h3{margin-bottom:8px}#pdfextended-settings #dashboard_primary .rss-widget .rssSummary .continue-reading{display:none}#pdfextended-settings .spinner.is-active{visibility:visible;margin:0}#pdfextended-settings .rss-widget ul li{padding:6px 0;margin:0;border-bottom:1px dotted #ccc}#pdfextended-settings .rss-widget ul li a{font-size:16px}#pdfextended-settings .rss-widget ul li:first-child,#pdfextended-settings .rss-widget ul li:last-child{border-bottom:none}#pdfextended-settings .about-wrap .about-text-disclaimer{font-size:13px}#pdfextended-settings .about-wrap #dashboard-widgets.columns-2 .postbox-container{width:100%}#pdfextended-settings .about-wrap #dashboard-widgets .postbox-container a{background:#f6f6f6 none repeat scroll 0 0;border:3px solid #eee;border-radius:10px;color:inherit;display:block;padding:15px;font-size:16px;text-decoration:none;margin-bottom:30px;transition:all .5s ease 0s}#pdfextended-settings .about-wrap #dashboard-widgets .postbox-container a:hover{border:3px solid #076aa4}#pdfextended-settings .about-wrap #dashboard-widgets .postbox-container a span{font-weight:700}#pdfextended-settings .about-wrap .center{text-align:center}#pdfextended-settings .about-wrap .button.button-large{height:35px;line-height:33px;padding:0 17px 9px}#pdf-system-status .fa-check-circle,#pdf-system-status .fa-exclamation-triangle,#pdf-system-status .fa-times-circle{font-size:17px;margin-left:5px;vertical-align:bottom;margin-top:-2px}#pdf-system-status .fa-check-circle{color:green}#pdf-system-status .fa-exclamation-triangle{color:#ff8a00}#pdf-system-status .fa-times-circle{color:#d10b0b}#pdf-system-status #license input[type=email],#pdf-system-status #license input[type=number],#pdf-system-status #license input[type=password],#pdf-system-status #license input[type=search],#pdf-system-status #license input[type=tel],#pdf-system-status #license input[type=text],#pdf-system-status #license input[type=url],#pdf-system-status #license select,#pdf-system-status #license textarea{background-color:#fff;border:1px solid #ddd;box-shadow:0 1px 2px rgba(0,0,0,.07) inset;color:#333;width:100%}#pdf-system-status #license input[type=text][readonly=readonly]{background:#eee;cursor:not-allowed}#pdf-system-status #license label{font-weight:700;line-height:30px;color:#222;font-size:14px;float:left;width:20em}#pdf-system-status #license .deactivate,#pdf-system-status #license .expired,#pdf-system-status #license .expires,#pdf-system-status #license .inactive,#pdf-system-status #license .limit{font-style:italic}#pdf-system-status #license .expired{display:block;color:#9e0b0f}#pdf-system-status #license .gf_keystatus_invalid,#pdf-system-status #license .gf_keystatus_valid{font-size:120%}#pdf-system-status #license p{clear:left;float:left;width:100%}#pdf-system-status #license span.container{display:block}#gfpdf_list_form .check-column{width:50px}#gfpdf_list_form .delete a:hover,#gfpdf_list_form .duplicate a:hover{cursor:pointer}#gfpdf_list_form .gravitypdf_shortcode{background:#eee;width:100%;padding:5px;outline:0}.gfpdf-hidden{display:none}.gfpdf_conditional_logic{margin-top:10px}#pdf-form-settings .conditional_logic th{padding-top:15px}#pdf-form-settings .conditional_logic td{vertical-align:top}#gfpdf_list_form .gfpdf-spinner,#pdf-form-settings .gfpdf-spinner,#pdfextended-settings .gfpdf-spinner,.wp-dialog .gfpdf-spinner{padding-left:5px;vertical-align:middle;width:20px}#gfpdf_list_form .gfpdf-spinner-small{width:15px}#gfpdf-template-example img{width:100%;max-width:300px;border:1px solid #ccc;display:block;margin-top:5px}#gfpdf-template-example p{border:1px solid #ccc;display:inline-block;max-width:300px;padding:0 5px;text-align:center;width:100%}#gfpdf_pdf_form .gfpdf-toggle-wrapper{padding-top:25px}#gfpdf_pdf_form .gfpdf-tab-container{border-bottom:1px solid #e6e6e6;clear:both;padding:0 0 24px 0;margin:0 0 24px 0}#gfpdf_pdf_form .nav-tab-wrapper{margin-bottom:20px}.gfpdf-tab-wrapper.wp-filter{margin:0 0 15px}.gfpdf-page .merge-tag-support{max-width:none}.gfpdf-page h4.section-title{font-weight:700;margin-bottom:0}.gfpdf-page .form-table li{list-style:inherit}.gfpdf_form_action_has_submenu{position:relative}.gfpdf_submenu{width:200px}.gfpdf_submenu li{border-bottom:1px solid #eee}.gfpdf_detailed_pdf_container_pdf{clear:left;margin-bottom:3px}.gfpdf_detailed_pdf_container span{display:block;word-wrap:break-word;padding:2px 0 2px 2px}#gfpdf-template-container .theme .theme-actions{opacity:1;left:inherit;border-top:none;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}#gfpdf-template-container .wp-filter-search{margin:0 0 5px;font-size:16px;font-weight:300;line-height:1.5;width:100%}#gfpdf-template-container .theme .theme-author{display:block}#gfpdf-overlay h1{float:left;padding-left:2%}#gfpdf-overlay p.no-themes{display:block;font-size:18px}#fancy-template-selector{margin-left:5px;vertical-align:middle}#gpdf-advance-template-selector button{vertical-align:middle;margin-left:5px}#gfpdf-template-container .theme.add-new-theme a.doing-ajax span:after,#gfpdf-template-container .theme.add-new-theme a.doing-ajax:hover span:after{font-family:FontAwesome,'Open Sans',sans-serif;content:'\f1ce';font-size:79px;background:0 0;width:auto;height:auto;left:51.5%;text-indent:0;-webkit-animation:fa-spin 1.5s infinite linear;animation:fa-spin 1.5s infinite linear}.theme-browser .theme.add-new-theme.gfpdf-dropzone-active a{background:#0073aa}.theme-browser .theme.add-new-theme.gfpdf-dropzone-active a:after{border-color:transparent}.theme-browser .theme.add-new-theme.gfpdf-dropzone-active a span:after{background:#fff;color:#0073aa}#gfpdf-template-container .theme.add-new-theme a.doing-ajax:focus span:after,#gfpdf-template-container .theme.add-new-theme a.doing-ajax:hover span:after,#gfpdf-template-container .theme.add-new-theme.gfpdf-dropzone-active a.doing-ajax span:after{color:#fff;background:0 0}.theme-browser .theme.add-new-theme.gfpdf-dropzone-active .theme-name{color:#fff}.gfpdf-dropzone-reject{background:red}.gfpdf-template-install-instructions{font-size:85%;text-align:center;margin-top:5px}.image-radio-buttons input{display:none}.image-radio-buttons img{padding:6px}.image-radio-buttons input:checked+img{background:#2abbff}@media only screen and (min-width:500px){.about-wrap .gfpdf-badge{position:absolute;right:0;top:0;margin:0;width:130px}.rtl .about-wrap .gfpdf-badge{left:0;right:auto}}@media only screen and (max-width:780px){#pdfextended-settings table.gfpdf_table td,#pdfextended-settings table.gfpdf_table th{display:block;vertical-align:middle;width:auto}.gfpdf-page .chosen-container{font-size:17px}.gfpdf-page .chosen-container-single .chosen-single{height:38px;line-height:34px}.gfpdf-page .chosen-container-single .chosen-single div{top:7px}.gfpdf-page .chosen-container .chosen-results li{line-height:24px}.gfpdf-page .chosen-container-multi .chosen-choices li.search-choice{line-height:24px}.gfpdf-page .chosen-container-multi .chosen-choices li.search-choice .search-choice-close{top:10px}.gfpdf-page .chosen-container-multi .chosen-choices li.search-field input[type=text]{height:38px}.gfpdf-page .form-table tbody td input[type=number]{font-size:16px;line-height:1.5;padding:7px 10px}.gfpdf-page .form-table tbody td label{display:block;font-size:16px}.gfpdf-page .form-table tbody td label:first-of-type{margin-top:10px}#manage-font-files,.gf_delete_notice,.gfpdf-page .form-table td,.gfpdf-page .form-table th,.gfpdf-page .gfpdf_table td,.gfpdf-page .gfpdf_table th{font-size:16px}#manage-font-files,.gf_delete_notice{line-height:21px}.gfpdf-page .form-table tbody .conditional_logic td label{display:inline}.gfpdf-page .form-table tbody td input[type=number]{padding-right:3px}}@media only screen and (min-width:782px){.gfpdf-mascot-sitting{background:url(../../../src/assets/images/cap-paws-sitting.png) no-repeat 0 0;width:181px;height:193px;display:inline-block;float:right;margin-top:-149px;position:relative;z-index:100}.rtl .gfpdf-mascot-sitting{float:left}#gfpdf-mascot-container{padding-bottom:120px!important}#pdfextended-settings table.gfpdf_table tbody th{width:200px}#manage-font-files .gf_settings_description{margin:0 0 6px 9.5em}#pdfextended-settings .about-wrap #dashboard-widgets.columns-2 .postbox-container{width:49.5%}#pdfextended-settings .about-wrap #dashboard-widgets .postbox-container a{margin-right:30px;min-height:245px}#pdfextended-settings #pdf-system-status th{padding-top:12px;padding-bottom:12px}#pdfextended-settings #pdf-system-status td{padding-top:10px;padding-bottom:10px}.gfpdf-page .chosen-container{max-width:300px}#gfpdf_conditional_logic_container .gf_conditional_logic_rules_container :first-child{max-width:250px;width:100%}}@media only screen and (min-width:900px){#pdfextended-settings .help-container .postbox{width:32.66%;float:left;margin-left:.5%;margin-right:.5%;min-width:0}#pdfextended-settings .help-container .postbox:first-child{margin-left:0}#pdfextended-settings .help-container .postbox:last-child{margin-right:0}}@media only screen and (min-width:1000px){#pdf-system-status #license label{float:left;width:20%}#pdf-system-status #license span.container{float:left;width:80%}#pdfextended-settings .about-wrap #dashboard-widgets .postbox-container a{min-height:180px}}@media only screen and (max-width:1120px){#gfpdf-template-container .theme:nth-child(odd){margin-right:2%}}@media only screen and (min-width:1400px){#pdfextended-settings #search-results,#pdfextended-settings .about-wrap #search-knowledgebase input,#pdfextended-settings .help-container{width:75%}#pdfextended-settings .about-wrap #dashboard-widgets .postbox-container a{min-height:90px}}@media only screen and (min-width:1640px){#gfpdf-template-container .theme{margin:0 2% 2% 0}#gfpdf-template-container .wp-filter-search{width:22.7%}}
|
1 |
+
.about-wrap .gfpdf-badge{margin-bottom:1.5em;position:relative;width:100%}.about-wrap .feature-section:not(.under-the-hood) .col.gfpdf-breakdown{margin-top:0}.gfpdf-badge{background:url(../../../src/assets/images/gravitypdf-globe-black.png) no-repeat 50% 5px;color:#333;display:inline-block;font-size:14px;font-weight:600;height:40px;margin:5px 0 0;padding-top:120px;text-align:center;text-rendering:optimizelegibility}.gfpdf-page .about-wrap [class$=col] .col{border-bottom:none}.gfpdf-page .about-wrap .feature-section{border-bottom:1px solid rgba(0,0,0,.1)}.gfpdf-page .about-wrap .feature-section.two-col .col{vertical-align:middle}div img.gfpdf-image{border:1px solid #ccc;max-width:98%;-webkit-box-shadow:1px 1px 5px 1px rgba(0,0,0,.15);-moz-box-shadow:1px 1px 5px 1px rgba(0,0,0,.15);box-shadow:1px 1px 5px 1px rgba(0,0,0,.15)}#pdfextended-settings{margin-top:20px}#pdfextended-settings h3,#tab_pdf h3{margin-top:5px;line-height:1.3em}#pdfextended-settings h3 i,#tab_pdf h3 i{padding-right:2px}#pdfextended-settings #add-new-pdf{padding:4px 8px}#pdfextended-settings div.notice,div.pdf-notice{margin:5px 15px 2px;padding:0 .6em}.gfpdf-page #pdfextended-settings .theme div.notice,.gfpdf-page #pdfextended-settings .theme-info div.notice,.gfpdf-page .theme div.notice,.gfpdf-page .theme-info div.notice{margin:0;z-index:500;color:#444;padding:1px 12px}.gfpdf-page div.error,.gfpdf-page div.notice,div.pdf-error,div.pdf-notice{background-color:#fff;border-left:4px solid #7ad03a;box-shadow:0 1px 1px 0 rgba(0,0,0,.1)}.gfpdf-page div.error,div.pdf-error{border-left-color:#dc3232}.gfpdf-page div.notice,div.pdf-notice{margin:5px 0 15px;padding:1px 12px}#pdfextended-settings #gfpdf-advanced-options,#tab_pdf #gfpdf-advanced-options{display:none;margin-bottom:20px}.no-js #pdfextended-settings #gfpdf-advanced-options,.no-js #tab_pdf #gfpdf-advanced-options{display:block}#pdfextended-settings .gfpdf-advanced-options,#tab_pdf .gfpdf-advanced-options{margin-top:-5px}.no-js #pdfextended-settings .gfpdf-advanced-options,.no-js #tab_pdf .gfpdf-advanced-options{display:none}#pdfextended-settings select.large,#tab_pdf select.large{width:100%;max-width:350px}#tab_pdf .formSubmitted input:invalid{border:1px solid red}#tab_pdf .wp-editor-wrap{margin:0 12px 0 0}.rtl #pdfextended-settings label,.rtl #tab_pdf label{float:right;margin-left:5px}#pdf-license .fa-exclamation-circle{color:red}#pdf-license .fa-check{color:green}#pdfextended-settings table.gfpdf_table thead th{font-weight:700}#pdfextended-settings table.gfpdf_table tr:nth-child(2n) td,#pdfextended-settings table.gfpdf_table tr:nth-child(2n) th{background:none repeat scroll 0 0 #fcfcfc}#pdfextended-settings p.submit{padding-bottom:0;margin-bottom:0}#pdfextended-settings span.details.path,#pdfextended-settings span.path{padding:2px;background:#f2f2f2}#setup-templates-confirm ul{margin-top:5px}#setup-templates-confirm li{list-style-type:disc;margin-left:20px}#manage-font-files div{margin:10px 0}#manage-font-files div.updated{margin-top:0}#manage-font-files li{border:1px solid #ccc;position:relative}#manage-font-files li .delete-font{position:absolute;top:0;right:0;padding:5px 10px}#manage-font-files li .delete-font:hover{background:#dc0606;color:#fff}#manage-font-files input.invalid{border:1px solid red}#manage-font-files .font-submit{text-align:center}#manage-font-files #font-add-list{border:none;text-align:center;color:#ccc;cursor:pointer}#manage-font-files #font-empty{font-size:14px;font-style:italic;line-height:21px;padding:60px 0 15px;text-align:center}#manage-font-files #font-add-list:hover{color:#555}#manage-font-files #font-add-list span{display:block;text-transform:uppercase;margin-top:-5px}#manage-font-files li a{display:block;background:#eee;padding:5px 7px;text-decoration:none}#manage-font-files li a.font-name .fa{margin-right:5px}#manage-font-files li a:hover{background:#e9e9e9}#manage-font-files .font-settings{padding:5px 7px}#manage-font-files .gf_settings_description{font-size:95%}#manage-font-files .font-selector>label,#manage-font-files .font-settings>label{float:left;width:9em}#manage-font-files .regular-text{width:16em}#manage-font-files .css-usage{text-align:center}#manage-font-files .css-usage input{width:100%;text-align:center}#manage-font-files .css-usage pre{margin:5px 0;background:#eee;padding:7.5px}.rtl #font-list .css-usage input{direction:ltr!important}#pdfextended-settings .metabox-holder h3{font-size:14px}#pdfextended-settings .postbox-container .postbox{margin:0 8px 20px 0}#pdfextended-settings .postbox h3.hndle{padding-bottom:12px}#pdfextended-settings .postbox .hndle,#pdfextended-settings .widget .widget-top{cursor:default}#pdfextended-settings #pdf_support_hours h3,#pdfextended-settings .postbox .handlediv{display:none}#pdfextended-settings .about-wrap,#pdfextended-settings .about-wrap .about-text{max-width:none;min-height:0;line-height:1.8em}#pdfextended-settings .about-wrap #search-knowledgebase,#pdfextended-settings .about-wrap .about-text,#pdfextended-settings .about-wrap h1{text-align:center;margin-right:0}#pdfextended-settings .postbox .inside{margin-bottom:0}#pdfextended-settings .about-wrap h1{margin-top:40px}#pdfextended-settings .about-wrap #search-knowledgebase input{font-family:FontAwesome,'Open Sans',sans-serif;font-size:22px;margin:10px 0 0;padding:16px 20px;line-height:25px;width:100%}#pdfextended-settings #search-results{text-align:left;margin:0 auto;width:100%}#pdfextended-settings #search-results .postbox,#search-results .postbox .inside{display:none}#pdfextended-settings #search-results .postbox h3{margin-bottom:0}#pdfextended-settings #search-results .postbox.is-active h3{margin-bottom:8px}#pdfextended-settings #dashboard_primary .rss-widget .rssSummary .continue-reading{display:none}#pdfextended-settings .spinner.is-active{visibility:visible;margin:0}#pdfextended-settings .rss-widget ul li{padding:6px 0;margin:0;border-bottom:1px dotted #ccc}#pdfextended-settings .rss-widget ul li a{font-size:16px}#pdfextended-settings .rss-widget ul li:first-child,#pdfextended-settings .rss-widget ul li:last-child{border-bottom:none}#pdfextended-settings .about-wrap .about-text-disclaimer{font-size:13px}#pdfextended-settings .about-wrap #dashboard-widgets:after{content:"";display:block;clear:both}#pdfextended-settings .about-wrap #dashboard-widgets{margin-bottom:30px}#pdfextended-settings .about-wrap #dashboard-widgets.columns-2 .postbox-container{width:100%}#pdfextended-settings .about-wrap #dashboard-widgets .postbox-container>a{background:#f6f6f6 none repeat scroll 0 0;border:3px solid #eee;border-radius:10px;color:inherit;display:block;padding:15px;font-size:16px;text-decoration:none;margin-bottom:30px;transition:all .5s ease 0s}#pdfextended-settings .about-wrap #dashboard-widgets .postbox-container>a:hover{border:3px solid #076aa4}#pdfextended-settings .about-wrap #dashboard-widgets .postbox-container>a span{font-weight:700}#pdfextended-settings .about-wrap #dashboard-widgets .postbox-container li{margin:0;padding:0;list-style-type:disc;list-style-position:inside}#pdfextended-settings .about-wrap .center{text-align:center}#pdfextended-settings .about-wrap .button.button-large{height:35px;line-height:33px;padding:0 17px 9px}#pdf-system-status .fa-check-circle,#pdf-system-status .fa-exclamation-triangle,#pdf-system-status .fa-times-circle{font-size:17px;margin-left:5px;vertical-align:bottom;margin-top:-2px}#pdf-system-status .fa-check-circle{color:green}#pdf-system-status .fa-exclamation-triangle{color:#ff8a00}#pdf-system-status .fa-times-circle{color:#d10b0b}#pdf-system-status #license input[type=email],#pdf-system-status #license input[type=number],#pdf-system-status #license input[type=password],#pdf-system-status #license input[type=search],#pdf-system-status #license input[type=tel],#pdf-system-status #license input[type=text],#pdf-system-status #license input[type=url],#pdf-system-status #license select,#pdf-system-status #license textarea{background-color:#fff;border:1px solid #ddd;box-shadow:0 1px 2px rgba(0,0,0,.07) inset;color:#333;width:100%}#pdf-system-status #license input[type=text][readonly=readonly]{background:#eee;cursor:not-allowed}#pdf-system-status #license label{font-weight:700;line-height:30px;color:#222;font-size:14px;float:left;width:20em}#pdf-system-status #license .deactivate,#pdf-system-status #license .expired,#pdf-system-status #license .expires,#pdf-system-status #license .inactive,#pdf-system-status #license .limit{font-style:italic}#pdf-system-status #license .expired{display:block;color:#9e0b0f}#pdf-system-status #license .gf_keystatus_invalid,#pdf-system-status #license .gf_keystatus_valid{font-size:120%}#pdf-system-status #license p{clear:left;float:left;width:100%}#pdf-system-status #license span.container{display:block}#gfpdf_list_form .check-column{width:50px}#gfpdf_list_form .delete a:hover,#gfpdf_list_form .duplicate a:hover{cursor:pointer}#gfpdf_list_form .gravitypdf_shortcode{background:#eee;width:100%;padding:5px;outline:0}.gfpdf-hidden{display:none}.gfpdf_conditional_logic{margin-top:10px}#pdf-form-settings .conditional_logic th{padding-top:15px}#pdf-form-settings .conditional_logic td{vertical-align:top}#gfpdf_list_form .gfpdf-spinner,#pdf-form-settings .gfpdf-spinner,#pdfextended-settings .gfpdf-spinner,.wp-dialog .gfpdf-spinner{padding-left:5px;vertical-align:middle;width:20px}#gfpdf_list_form .gfpdf-spinner-small{width:15px}#gfpdf-template-example img{width:100%;max-width:300px;border:1px solid #ccc;display:block;margin-top:5px}#gfpdf-template-example p{border:1px solid #ccc;display:inline-block;max-width:300px;padding:0 5px;text-align:center;width:100%}#gfpdf_pdf_form .gfpdf-toggle-wrapper{padding-top:25px}#gfpdf_pdf_form .gfpdf-tab-container{border-bottom:1px solid #e6e6e6;clear:both;padding:0 0 24px 0;margin:0 0 8px 0}#gfpdf_pdf_form .extensions-upsell{float:right;font-style:italic}#pdfextended-settings .extensions-upsell{font-style:italic}#gfpdf_pdf_form .nav-tab-wrapper{margin-bottom:20px}.gfpdf-tab-wrapper.wp-filter{margin:0 0 15px}.gfpdf-page .merge-tag-support{max-width:none}.gfpdf-page h4.section-title{font-weight:700;margin-bottom:0}.gfpdf-page .form-table li{list-style:inherit}.gfpdf_form_action_has_submenu{position:relative}.gfpdf_submenu{width:200px}.gfpdf_submenu li{border-bottom:1px solid #eee}.gfpdf_detailed_pdf_container_pdf{clear:left;margin-bottom:3px}.gfpdf_detailed_pdf_container span{display:block;word-wrap:break-word;padding:2px 0 2px 2px}#gfpdf-template-container .theme .theme-actions{opacity:1;left:inherit;border-top:none;height:38px;padding:9px 10px 0;top:auto;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;-webkit-transform:none;transform:none;box-shadow:none}#gfpdf-template-container .wp-filter-search{margin:0 0 5px;font-size:16px;font-weight:300;line-height:1.5;width:100%}#gfpdf-template-container .theme .theme-author{display:block}#gfpdf-overlay h1{float:left;padding-left:2%}#gfpdf-overlay p.no-themes{display:block;font-size:18px}#fancy-template-selector{margin-left:5px;vertical-align:middle}#gpdf-advance-template-selector button{vertical-align:middle;margin-left:5px}#gfpdf-template-container .theme.add-new-theme a.doing-ajax span:after,#gfpdf-template-container .theme.add-new-theme a.doing-ajax:hover span:after{font-family:FontAwesome,'Open Sans',sans-serif;content:'\f1ce';font-size:79px;background:0 0;width:auto;height:auto;left:51.5%;text-indent:0;-webkit-animation:fa-spin 1.5s infinite linear;animation:fa-spin 1.5s infinite linear}.theme-browser .theme.add-new-theme.gfpdf-dropzone-active a{background:#0073aa}.theme-browser .theme.add-new-theme.gfpdf-dropzone-active a:after{border-color:transparent}.theme-browser .theme.add-new-theme.gfpdf-dropzone-active a span:after{background:#fff;color:#0073aa}#gfpdf-template-container .theme.add-new-theme a.doing-ajax:focus span:after,#gfpdf-template-container .theme.add-new-theme a.doing-ajax:hover span:after,#gfpdf-template-container .theme.add-new-theme.gfpdf-dropzone-active a.doing-ajax span:after{color:#fff;background:0 0}.theme-browser .theme.add-new-theme.gfpdf-dropzone-active .theme-name{color:#fff}.gfpdf-dropzone-reject{background:red}.gfpdf-template-install-instructions{font-size:85%;text-align:center;margin-top:5px}.image-radio-buttons input{display:none}.image-radio-buttons img{padding:6px}.image-radio-buttons input:checked+img{background:#2abbff}@media only screen and (min-width:500px){.about-wrap .gfpdf-badge{position:absolute;right:0;top:0;margin:0;width:130px}.rtl .about-wrap .gfpdf-badge{left:0;right:auto}}@media only screen and (max-width:780px){#pdfextended-settings table.gfpdf_table td,#pdfextended-settings table.gfpdf_table th{display:block;vertical-align:middle;width:auto}.gfpdf-page .chosen-container{font-size:17px}.gfpdf-page .chosen-container-single .chosen-single{height:38px;line-height:34px}.gfpdf-page .chosen-container-single .chosen-single div{top:7px}.gfpdf-page .chosen-container .chosen-results li{line-height:24px}.gfpdf-page .chosen-container-multi .chosen-choices li.search-choice{line-height:24px}.gfpdf-page .chosen-container-multi .chosen-choices li.search-choice .search-choice-close{top:10px}.gfpdf-page .chosen-container-multi .chosen-choices li.search-field input[type=text]{height:38px}.gfpdf-page .form-table tbody td input[type=number]{font-size:16px;line-height:1.5;padding:7px 10px}.gfpdf-page .form-table tbody td label{display:block;font-size:16px}.gfpdf-page .form-table tbody td label:first-of-type{margin-top:10px}#manage-font-files,.gf_delete_notice,.gfpdf-page .form-table td,.gfpdf-page .form-table th,.gfpdf-page .gfpdf_table td,.gfpdf-page .gfpdf_table th{font-size:16px}#manage-font-files,.gf_delete_notice{line-height:21px}.gfpdf-page .form-table tbody .conditional_logic td label{display:inline}.gfpdf-page .form-table tbody td input[type=number]{padding-right:3px}}@media only screen and (min-width:782px){.gfpdf-mascot-sitting{background:url(../../../src/assets/images/cap-paws-sitting.png) no-repeat 0 0;width:181px;height:193px;display:inline-block;float:right;margin-top:-189px;position:relative;z-index:100}.rtl .gfpdf-mascot-sitting{float:left}#gfpdf-mascot-container{padding-bottom:120px!important}#pdfextended-settings table.gfpdf_table tbody th{width:200px}#manage-font-files .gf_settings_description{margin:0 0 6px 9.5em}#pdfextended-settings .about-wrap #dashboard-widgets.columns-2 .postbox-container{width:49.5%}#pdfextended-settings .about-wrap #dashboard-widgets .postbox-container>a{margin-right:30px;min-height:245px}#pdfextended-settings #pdf-system-status th{padding-top:12px;padding-bottom:12px}#pdfextended-settings #pdf-system-status td{padding-top:10px;padding-bottom:10px}.gfpdf-page .chosen-container{max-width:300px}#gfpdf_conditional_logic_container .gf_conditional_logic_rules_container :first-child{max-width:250px;width:100%}}@media only screen and (min-width:900px){#pdfextended-settings .help-container .postbox{width:32.66%;float:left;margin-left:.5%;margin-right:.5%;min-width:0}#pdfextended-settings .help-container .postbox:first-child{margin-left:0}#pdfextended-settings .help-container .postbox:last-child{margin-right:0}}@media only screen and (min-width:1000px){#pdf-system-status #license label{float:left;width:20%}#pdf-system-status #license span.container{float:left;width:80%}#pdfextended-settings .about-wrap #dashboard-widgets .postbox-container>a{min-height:180px}}@media only screen and (max-width:1120px){#gfpdf-template-container .theme:nth-child(odd){margin-right:2%}}@media only screen and (min-width:1400px){#pdfextended-settings #search-results,#pdfextended-settings .about-wrap #search-knowledgebase input,#pdfextended-settings .help-container{width:75%}#pdfextended-settings .about-wrap #dashboard-widgets .postbox-container>a{min-height:90px}}@media only screen and (min-width:1640px){#gfpdf-template-container .theme{margin:0 2% 2% 0}#gfpdf-template-container .wp-filter-search{width:22.7%}}
|
dist/assets/js/app.bundle.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
webpackJsonp([0],{120:function(e,t,n){"use strict";function r(e){var t=a(),r=n.i(h.createStore)(t,window.devToolsExtension&&window.devToolsExtension());o(e),n.i(p.render)(c.a.createElement(u.HashRouter,null,c.a.createElement(u.Route,{render:function(e){return c.a.createElement(T.a,x({},e,{store:r,buttonText:GFPDF.advanced}))}})),document.getElementById("gpdf-advance-template-selector")),n.i(g.a)(r),i(r,e),s(r,e)}function a(){return n.i(h.combineReducers)({template:v.a})}function o(e){e.next().after('<span id="gpdf-advance-template-selector">').next().after('<div id="gfpdf-overlay" class="theme-overlay">')}function i(e,t){var r=b()(e.getState,"template.activeTemplate");e.subscribe(r(function(e){t.val()!==e&&t.val(e).trigger("chosen:updated").trigger("change")})),t.change(function(){this.value!==e.getState().template.activeTemplate&&e.dispatch(n.i(y.a)(this.value))})}function s(e,t){var n=e.getState().template.list.size,r=b()(e.getState,"template.list");e.subscribe(r(function(e){n!==e.size&&(n=e.size,m.a.post(GFPDF.ajaxUrl).field("action","gfpdf_get_template_options").field("nonce",GFPDF.ajaxNonce).then(function(e){t.html(e.text).trigger("chosen:updated").trigger("change")}))}))}t.a=r;var l=n(1),c=n.n(l),p=n(40),u=(n.n(p),n(15)),f=n(33),m=n.n(f),h=n(41),d=n(73),b=n.n(d),y=n(18),g=n(139),v=n(138),T=n(123),x=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}},121:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(2),s=n.n(i),l=n(1),c=n.n(l),p=n(72),u=n.n(p),f=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),m=function(e){function t(){return r(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),f(t,[{key:"render",value:function(){return c.a.createElement(u.a,{onDrop:this.props.onDrop,multiple:this.props.multiple,disablePreview:!0,className:this.props.className,activeClassName:this.props.activeClassName},this.props.children)}}]),t}(c.a.Component);m.propTypes={children:s.a.node.isRequired,onDrop:s.a.func.isRequired,multiple:s.a.bool,className:s.a.string,activeClassName:s.a.string},m.defaultProps={multiple:!1,maxSize:1/0,className:"gfpdf-dropzone",activeClassName:"gfpdf-dropzone-active"},t.a=m},122:function(e,t,n){"use strict";t.a=function(){return!1}},123:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(2),s=n.n(i),l=n(1),c=n.n(l),p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(e){function t(){var e,n,o,i;r(this,t);for(var s=arguments.length,l=Array(s),c=0;c<s;c++)l[c]=arguments[c];return n=o=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),o.handleClick=function(e){e.preventDefault(),e.stopPropagation(),o.props.history.push("/template")},i=n,a(o,i)}return o(t,e),p(t,[{key:"render",value:function(){var e=this;return c.a.createElement("button",{type:"button",id:"fancy-template-selector",className:"button gfpdf-button",onClick:this.handleClick,ref:function(t){return e.button=t}},this.props.buttonText)}}]),t}(c.a.Component);u.propTypes={buttonText:s.a.string},t.a=u},124:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(2),s=n.n(i),l=n(1),c=n.n(l),p=n(15),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),f=function(e){function t(){var e,n,o,i;r(this,t);for(var s=arguments.length,l=Array(s),c=0;c<s;c++)l[c]=arguments[c];return n=o=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),o.handleKeyPress=function(e){27!==e.keyCode||"wp-filter-search"===e.target.className&&""!==e.target.value||o.closeDialog()},o.closeDialog=function(){o.props.history.push(o.props.closeRoute||"/")},i=n,a(o,i)}return o(t,e),u(t,[{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyPress,!1)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyPress,!1)}},{key:"render",value:function(){return c.a.createElement("button",{className:"close dashicons dashicons-no",tabIndex:"142",onClick:this.closeDialog,onKeyDown:this.handleKeyPress,"aria-label":"close"},c.a.createElement("span",{className:"screen-reader-text"},"Close dialog"))}}]),t}(c.a.Component);f.propTypes={closeRoute:s.a.string},t.a=n.i(p.withRouter)(f)},125:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(2),s=n.n(i),l=n(1),c=n.n(l),p=n(11),u=n(18),f=n(15),m=n(33),h=n.n(m),d=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),b=function(e){function t(){var e,n,o,i;r(this,t);for(var s=arguments.length,l=Array(s),c=0;c<s;c++)l[c]=arguments[c];return n=o=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),o.deleteTemplate=function(e){if(e.preventDefault(),e.stopPropagation(),window.confirm(o.props.templateConfirmDeleteText)){var t=o.props.template.get("id");h.a.post(o.props.ajaxUrl).field("action","gfpdf_delete_template").field("nonce",o.props.ajaxNonce).field("id",t).then(function(){},o.ajaxFailed),o.props.history.push("/template"),o.props.onTemplateDelete(t)}},o.ajaxFailed=function(){var e=o.props.template.set("error",o.props.templateDeleteErrorText);o.props.addTemplate(e)},i=n,a(o,i)}return o(t,e),d(t,[{key:"render",value:function(){var e=this.props.callbackFunction?this.props.callbackFunction:this.deleteTemplate;return c.a.createElement("a",{onClick:e,href:"#",tabIndex:"150",className:"button button-secondary delete-theme"},this.props.buttonText)}}]),t}(c.a.Component);b.propTypes={ajaxUrl:s.a.string,ajaxNonce:s.a.string,template:s.a.object,addTemplate:s.a.func,onTemplateDelete:s.a.func,callbackFunction:s.a.func,buttonText:s.a.string,templateConfirmDeleteText:s.a.string,templateDeleteErrorText:s.a.string};var y=function(e){return{addTemplate:function(t){e(n.i(u.b)(t))},onTemplateDelete:function(t){e(n.i(u.c)(t))}}};t.a=n.i(f.withRouter)(n.i(p.connect)(null,y)(b))},126:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(2),s=n.n(i),l=n(1),c=n.n(l),p=n(77),u=n(125),f=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),m=function(e){function t(){var e,n,o,i;r(this,t);for(var s=arguments.length,l=Array(s),c=0;c<s;c++)l[c]=arguments[c];return n=o=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),o.notCoreTemplate=function(e){return-1!==e.get("path").indexOf(o.props.pdfWorkingDirPath)},i=n,a(o,i)}return o(t,e),f(t,[{key:"render",value:function(){var e=this.props.template,t=e.get("compatible");return c.a.createElement("div",{className:"theme-actions"},!this.props.isActiveTemplate&&t?c.a.createElement(p.a,{template:e,buttonText:this.props.activateText}):null,!this.props.isActiveTemplate&&this.notCoreTemplate(e)?c.a.createElement(u.a,{template:e,ajaxUrl:this.props.ajaxUrl,ajaxNonce:this.props.ajaxNonce,buttonText:this.props.templateDeleteText,templateConfirmDeleteText:this.props.templateConfirmDeleteText,templateDeleteErrorText:this.props.templateDeleteErrorText}):null)}}]),t}(c.a.Component);m.propTypes={template:s.a.object.isRequired,isActiveTemplate:s.a.bool,ajaxUrl:s.a.string,ajaxNonce:s.a.string,activateText:s.a.string,pdfWorkingDirPath:s.a.string,templateDeleteText:s.a.string,templateConfirmDeleteText:s.a.string,templateDeleteErrorText:s.a.string},t.a=m},127:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(2),s=n.n(i),l=n(1),c=n.n(l),p=n(11),u=n(15),f=n(32),m=(n.n(f),function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}()),h=function(e){function t(){var e,n,o,i;r(this,t);for(var s=arguments.length,l=Array(s),c=0;c<s;c++)l[c]=arguments[c];return n=o=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),o.previousTemplate=function(e){e.preventDefault(),e.stopPropagation();var t=o.props.templates.get(o.props.templateIndex-1).get("id");t&&o.props.history.push("/template/"+t)},o.nextTemplate=function(e){e.preventDefault(),e.stopPropagation();var t=o.props.templates.get(o.props.templateIndex+1).get("id");t&&o.props.history.push("/template/"+t)},o.handleKeyPress=function(e){o.props.isFirst||37!==e.keyCode||o.previousTemplate(e),o.props.isLast||39!==e.keyCode||o.nextTemplate(e)},i=n,a(o,i)}return o(t,e),m(t,[{key:"componentDidMount",value:function(){window.addEventListener("keydown",this.handleKeyPress,!1)}},{key:"componentWillUnmount",value:function(){window.removeEventListener("keydown",this.handleKeyPress,!1)}},{key:"render",value:function(){var e=this.props.isFirst,t=this.props.isLast,r=n.i(f.List)(["dashicons","dashicons-no"]),a=r.push("left"),o=r.push("right");a=e?a.push("disabled"):a,o=t?o.push("disabled"):o;var i=e?"disabled":"",s=t?"disabled":"";return c.a.createElement("span",null,c.a.createElement("button",{onClick:this.previousTemplate,onKeyDown:this.handleKeyPress,className:a.join(" "),tabIndex:"141",disabled:i},c.a.createElement("span",{className:"screen-reader-text"},this.props.showPreviousTemplateText)),c.a.createElement("button",{onClick:this.nextTemplate,onKeyDown:this.handleKeyPress,className:o.join(" "),tabIndex:"141",disabled:s},c.a.createElement("span",{className:"screen-reader-text"},this.props.showNextTemplateText)))}}]),t}(c.a.Component);h.propTypes={templates:s.a.object.isRequired,templateIndex:s.a.number.isRequired,isFirst:s.a.bool,isLast:s.a.bool,showPreviousTemplateText:s.a.string,showNextTemplateText:s.a.string};var d=function(e,t){var n=t.templates,r=t.template.get("id");return{isFirst:n.first().get("id")===r,isLast:n.last().get("id")===r}};t.a=n.i(u.withRouter)(n.i(p.connect)(d)(h))},128:function(e,t,n){"use strict";var r=n(2),a=n.n(r),o=n(1),i=n.n(o),s=function(e){var t=e.header;return i.a.createElement("h1",null,t)};s.propTypes={header:a.a.string},t.a=s},129:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(2),s=n.n(i),l=n(1),c=n.n(l),p=n(11),u=n(80),f=n(78),m=n(130),h=n(134),d=n(128),b=n(136),y=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),g=function(e){function t(){return r(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),y(t,[{key:"render",value:function(){var e=this,t=c.a.createElement(d.a,{header:this.props.templateHeaderText});return c.a.createElement(f.a,{header:t,closeRoute:"/"},c.a.createElement(h.a,null),c.a.createElement("div",null,this.props.templates.map(function(t,n){return c.a.createElement(m.a,{key:n,template:t,templateDetailsText:e.props.templateDetailsText,activateText:e.props.activateText})}),c.a.createElement(b.a,{ajaxUrl:this.props.ajaxUrl,ajaxNonce:this.props.ajaxNonce,addTemplateText:this.props.addTemplateText,genericUploadErrorText:this.props.genericUploadErrorText,filenameErrorText:this.props.filenameErrorText,filesizeErrorText:this.props.filesizeErrorText,installSuccessText:this.props.installSuccessText,installUpdatedText:this.props.installUpdatedText,templateSuccessfullyInstalledUpdated:this.props.templateSuccessfullyInstalledUpdated,templateInstallInstructions:this.props.templateInstallInstructions})))}}]),t}(c.a.Component);g.propTypes={templates:s.a.object,route:s.a.object};var v=function(e){return{templates:n.i(u.a)(e)}};t.a=n.i(p.connect)(v)(g)},130:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(2),s=n.n(i),l=n(1),c=n.n(l),p=n(11),u=n(15),f=n(18),m=n(132),h=n(43),d=n(131),b=n(79),y=n(77),g=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),v=function(e){function t(){var e,n,o,i;r(this,t);for(var s=arguments.length,l=Array(s),c=0;c<s;c++)l[c]=arguments[c];return n=o=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),o.maybeShowDetailedTemplate=function(e){13===e.keyCode&&-1===e.target.className.indexOf("button")&&o.showDetailedTemplate()},o.showDetailedTemplate=function(){o.props.history.push("/template/"+o.props.template.get("id"))},o.removeMessage=function(){o.props.updateTemplateParam(o.props.template.get("id"),"message",null)},i=n,a(o,i)}return o(t,e),g(t,[{key:"render",value:function(){var e=this.props.template,t=this.props.activeTemplate===e.get("id"),n=e.get("compatible"),r=t?"active theme":"theme";return c.a.createElement("div",{onClick:this.showDetailedTemplate,onKeyDown:this.maybeShowDetailedTemplate,className:r,"data-slug":e.get("id"),tabIndex:"150"},c.a.createElement(m.a,{image:e.get("screenshot")}),e.get("error")?c.a.createElement(h.a,{text:e.get("error"),error:!0}):null,e.get("message")?c.a.createElement(h.a,{text:e.get("message"),dismissableCallback:this.removeMessage,dismissable:!0,delay:12e3}):null,c.a.createElement(d.a,{label:this.props.templateDetailsText}),c.a.createElement(d.b,{group:e.get("group")}),c.a.createElement(b.b,{name:e.get("template")}),c.a.createElement("div",{className:"theme-actions"},!t&&n?c.a.createElement(y.a,{template:this.props.template,buttonText:this.props.activateText}):null))}}]),t}(c.a.Component);v.propTypes={template:s.a.object,activeTemplate:s.a.string,updateTemplateParam:s.a.func,activateText:s.a.string,templateDetailsText:s.a.string};var T=function(e){return{activeTemplate:e.template.activeTemplate}},x=function(e){return{updateTemplateParam:function(t,r,a){e(n.i(f.d)(t,r,a))}}};t.a=n.i(u.withRouter)(n.i(p.connect)(T,x)(v))},131:function(e,t,n){"use strict";n.d(t,"a",function(){return s}),n.d(t,"b",function(){return l});var r=n(2),a=n.n(r),o=n(1),i=n.n(o),s=function(e){var t=e.label;return i.a.createElement("span",{className:"more-details"},t)};s.propTypes={name:a.a.string};var l=function(e){var t=e.group;return i.a.createElement("p",{className:"theme-author"},t)};l.propTypes={group:a.a.string}},132:function(e,t,n){"use strict";var r=n(2),a=n.n(r),o=n(1),i=n.n(o),s=function(e){var t=e.image,n=t?"theme-screenshot":"theme-screenshot blank";return i.a.createElement("div",{className:n},t?i.a.createElement("img",{src:t,alt:""}):null)};s.propTypes={image:a.a.string},t.a=s},133:function(e,t,n){"use strict";var r=n(2),a=n.n(r),o=n(1),i=n.n(o),s=function(e){var t=e.image,n=t?"screenshot":"screenshot blank";return i.a.createElement("div",{className:"theme-screenshots"},i.a.createElement("div",{className:n},t?i.a.createElement("img",{src:t,alt:""}):null))};s.propTypes={image:a.a.string},t.a=s},134:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(2),s=n.n(i),l=n(1),c=n.n(l),p=n(11),u=n(71),f=n.n(u),m=n(18),h=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),d=function(e){function t(){var e,n,o,i;r(this,t);for(var s=arguments.length,l=Array(s),c=0;c<s;c++)l[c]=arguments[c];return n=o=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),o.handleSearch=function(e){e.persist(),o.runSearch(e)},o.runSearch=function(e){o.props.onSearch(e.target.value||"")},i=n,a(o,i)}return o(t,e),h(t,[{key:"componentWillMount",value:function(){this.runSearch=f()(this.runSearch,200)}},{key:"componentDidMount",value:function(){this.input.focus()}},{key:"render",value:function(){var e=this;return c.a.createElement("div",null,c.a.createElement("input",{className:"wp-filter-search",id:"wp-filter-search-input",ref:function(t){return e.input=t},placeholder:"Search Installed Templates",type:"search","aria-describedby":"live-search-desc",tabIndex:"145",onChange:this.handleSearch,defaultValue:this.props.search}))}}]),t}(c.a.Component);d.propTypes={onSearch:s.a.func,search:s.a.string};var b=function(e){return{search:e.template.search}},y=function(e){return{onSearch:function(t){e(n.i(m.e)(t))}}};t.a=n.i(p.connect)(b,y)(d)},135:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(2),s=n.n(i),l=n(1),c=n.n(l),p=n(11),u=n(80),f=n(78),m=n(127),h=n(126),d=n(133),b=n(43),y=n(79),g=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),v=function(e){function t(){return r(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),g(t,[{key:"shouldComponentUpdate",value:function(e,t){return null!=e.template}},{key:"render",value:function(){var e=this.props.template,t=this.props.activeTemplate===e.get("id"),n=c.a.createElement(m.a,{template:e,templateIndex:this.props.templateIndex,templates:this.props.templates,showPreviousTemplateText:this.props.showPreviousTemplateText,showNextTemplateText:this.props.showNextTemplateText}),r=c.a.createElement(h.a,{template:e,isActiveTemplate:t,ajaxUrl:this.props.ajaxUrl,ajaxNonce:this.props.ajaxNonce,activateText:this.props.activateText,pdfWorkingDirPath:this.props.pdfWorkingDirPath,templateDeleteText:this.props.templateDeleteText,templateConfirmDeleteText:this.props.templateConfirmDeleteText,templateDeleteErrorText:this.props.templateDeleteErrorText});return c.a.createElement(f.a,{header:n,footer:r,closeRoute:"/template"},c.a.createElement("div",{id:"gfpdf-template-detail-view",className:"gfpdf-template-detail"},c.a.createElement(d.a,{image:e.get("screenshot")}),c.a.createElement("div",{className:"theme-info"},c.a.createElement(y.a,{isCurrentTemplate:t,label:this.props.currentTemplateText}),c.a.createElement(y.b,{name:e.get("template"),version:e.get("version"),versionLabel:this.props.versionText}),c.a.createElement(y.c,{author:e.get("author"),uri:e.get("author uri")}),c.a.createElement(y.d,{group:e.get("group"),label:this.props.groupText}),e.get("long_message")?c.a.createElement(b.a,{text:e.get("long_message")}):null,e.get("long_error")?c.a.createElement(b.a,{text:e.get("long_error"),error:!0}):null,c.a.createElement(y.e,{desc:e.get("description")}),c.a.createElement(y.f,{tags:e.get("tags"),label:this.props.tagsText}))))}}]),t}(c.a.Component);v.propTypes={route:s.a.object,template:s.a.object,activeTemplate:s.a.string,templateIndex:s.a.number,templates:s.a.object};var T=function(e,t){var r=n.i(u.a)(e),a=t.match.params.id,o=function(e){return e.get("id")===a};return{template:r.find(o),templateIndex:r.findIndex(o),templates:r,activeTemplate:e.template.activeTemplate}};t.a=n.i(p.connect)(T)(v)},136:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(2),s=n.n(i),l=n(1),c=n.n(l),p=n(11),u=n(33),f=n.n(u),m=n(32),h=(n.n(m),n(18)),d=n(121),b=n(43),y=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),g=function(e){function t(){var e,o,i,s;r(this,t);for(var l=arguments.length,c=Array(l),p=0;p<l;p++)c[p]=arguments[p];return o=i=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(c))),i.state={ajax:!1,error:"",message:""},i.onDrop=function(e){e instanceof Array&&e.length>0&&e.forEach(function(e){var t=e.name;i.checkFilename(t)&&i.checkFilesize(e.size)&&(i.setState({ajax:!0,error:"",message:""}),f.a.post(i.props.ajaxUrl).field("action","gfpdf_upload_template").field("nonce",i.props.ajaxNonce).attach("template",e,t).then(i.ajaxSuccess,i.ajaxFailed))})},i.checkFilename=function(e){return".zip"===e.substr(e.length-4)||(i.setState({error:i.props.filenameErrorText}),!1)},i.checkFilesize=function(e){return!(e/1024>5120)||(i.setState({error:i.props.filesizeErrorText}),!1)},i.ajaxSuccess=function(e){e.body.templates.forEach(function(e){void 0===i.props.templates.find(function(t){return t.get("id")===e.id})?(e.new=!0,e.message=i.props.installSuccessText,i.props.addNewTemplate(n.i(m.fromJS)(e))):i.props.updateTemplateParam(e.id,"message",i.props.installUpdatedText)}),i.setState({ajax:!1,message:i.props.templateSuccessfullyInstalledUpdated})},i.ajaxFailed=function(e){i.setState({error:e.response.body&&void 0!==e.response.body.error?e.response.body.error:i.props.genericUploadErrorText,ajax:!1})},i.removeMessage=function(){i.setState({message:""})},i.openDropzone=function(e){e.preventDefault()},s=o,a(i,s)}return o(t,e),y(t,[{key:"render",value:function(){return c.a.createElement(d.a,{onDrop:this.onDrop,maxSize:1024e4,multiple:!0,className:"theme add-new-theme gfpdf-dropzone"},c.a.createElement("a",{href:"#",onClick:this.openDropzone,className:this.state.ajax?"doing-ajax":""},c.a.createElement("div",{className:"theme-screenshot"},c.a.createElement("span",null)),""!==this.state.error?c.a.createElement(b.a,{text:this.state.error,error:!0}):null,""!==this.state.message?c.a.createElement(b.a,{text:this.state.message,dismissable:!0,dismissableCallback:this.removeMessage}):null,c.a.createElement("h2",{className:"theme-name"},this.props.addTemplateText)),c.a.createElement("div",{className:"gfpdf-template-install-instructions"},this.props.templateInstallInstructions))}}]),t}(c.a.Component);g.propTypes={ajaxUrl:s.a.string,ajaxNonce:s.a.string,genericUploadErrorText:s.a.string,addTemplateText:s.a.string,filenameErrorText:s.a.string,filesizeErrorText:s.a.string,installSuccessText:s.a.string,installUpdatedText:s.a.string,templateSuccessfullyInstalledUpdated:s.a.string,templateInstallInstructions:s.a.string,addNewTemplate:s.a.func,updateTemplateParam:s.a.func,templates:s.a.object};var v=function(e){return{templates:e.template.list}},T=function(e){return{addNewTemplate:function(t){e(n.i(h.b)(t))},updateTemplateParam:function(t,r,a){e(n.i(h.d)(t,r,a))}}};t.a=n.i(p.connect)(v,T)(g)},137:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(75),a=n.n(r),o=n(42),i=n.n(o),s=n(120);a()(function(){if(void 0!==GFPDF.templateList){window.Promise||(window.Promise=i.a);var e=a()("#gfpdf_settings\\[template\\], #gfpdf_settings\\[default_template\\]");e.length>0&&n.i(s.a)(e)}})},138:function(e,t,n){"use strict";var r=n(32),a=(n.n(r),n(76)),o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i={list:n.i(r.fromJS)(GFPDF.templateList),activeTemplate:GFPDF.activeTemplate||GFPDF.activeDefaultTemplate,search:""},s=function(e,t){return e.findKey(function(e){if(e.get("id")===t)return!0})};t.a=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i,t=arguments[1];switch(t.type){case a.a:return o({},e,{search:t.text});case a.b:return o({},e,{activeTemplate:t.id});case a.c:return o({},e,{list:e.list.push(t.template)});case a.d:return o({},e,{list:e.list.set(s(e.list,t.template.get("id")),t.template)});case a.e:return o({},e,{list:e.list.setIn([s(e.list,t.id),t.name],t.value)});case a.f:return o({},e,{list:e.list.delete(s(e.list,t.id))})}return e}},139:function(e,t,n){"use strict";function r(e){n.i(i.render)(o.a.createElement(s.Provider,{store:e},o.a.createElement(m,null)),document.getElementById("gfpdf-overlay"))}t.a=r;var a=n(1),o=n.n(a),i=n(40),s=(n.n(i),n(11)),l=n(15),c=n(129),p=n(135),u=n(122),f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},m=function(){return o.a.createElement(l.HashRouter,null,o.a.createElement(l.Switch,null,o.a.createElement(l.Route,{path:"/template",exact:!0,render:function(e){return o.a.createElement(c.a,f({},e,{ajaxUrl:GFPDF.ajaxUrl,ajaxNonce:GFPDF.ajaxNonce,templateDetailsText:GFPDF.templateDetails,templateHeaderText:GFPDF.installedPdfs,genericUploadErrorText:GFPDF.problemWithTheUpload,activateText:GFPDF.select,addTemplateText:GFPDF.addNewTemplate,filenameErrorText:GFPDF.uploadInvalidNotZipFile,filesizeErrorText:GFPDF.uploadInvalidExceedsFileSizeLimit,installSuccessText:GFPDF.templateSuccessfullyInstalled,installUpdatedText:GFPDF.templateSuccessfullyUpdated,templateSuccessfullyInstalledUpdated:GFPDF.templateSuccessfullyInstalledUpdated,templateInstallInstructions:GFPDF.templateInstallInstructions}))}}),o.a.createElement(l.Route,{path:"/template/:id",render:function(e){return o.a.createElement(p.a,f({},e,{ajaxUrl:GFPDF.ajaxUrl,ajaxNonce:GFPDF.ajaxNonce,pdfWorkingDirPath:GFPDF.pdfWorkingDir,activateText:GFPDF.select,templateDeleteText:GFPDF.delete,templateConfirmDeleteText:GFPDF.doYouWantToDeleteTemplate,templateDeleteErrorText:GFPDF.couldNotDeleteTemplate,currentTemplateText:GFPDF.currentTemplate,versionText:GFPDF.version,groupText:GFPDF.group,tagsText:GFPDF.tags,showPreviousTemplateText:GFPDF.showPreviousTemplate,showNextTemplateText:GFPDF.showNextTemplate}))}}),o.a.createElement(l.Route,{component:u.a})))}},140:function(e,t,n){"use strict";t.a=function(e,t,n){var r,a,o=0,i={dev:-6,alpha:-5,a:-5,beta:-4,b:-4,RC:-3,rc:-3,"#":-2,p:1,pl:1},s=function(e){return e=(""+e).replace(/[_\-+]/g,"."),e=e.replace(/([^.\d]+)/g,".$1.").replace(/\.{2,}/g,"."),e.length?e.split("."):[-8]},l=function(e){return e?isNaN(e)?i[e]||-7:parseInt(e,10):0};for(e=s(e),t=s(t),a=Math.max(e.length,t.length),r=0;r<a;r++)if(e[r]!==t[r]){if(e[r]=l(e[r]),t[r]=l(t[r]),e[r]<t[r]){o=-1;break}if(e[r]>t[r]){o=1;break}}if(!n)return o;switch(n){case">":case"gt":return o>0;case">=":case"ge":return o>=0;case"<=":case"le":return o<=0;case"===":case"=":case"eq":return 0===o;case"<>":case"!==":case"ne":return 0!==o;case"":case"<":case"lt":return o<0;default:return null}}},18:function(e,t,n){"use strict";n.d(t,"e",function(){return a}),n.d(t,"a",function(){return o}),n.d(t,"b",function(){return i}),n.d(t,"d",function(){return s}),n.d(t,"c",function(){return l});var r=n(76),a=function(e){return{type:r.a,text:e}},o=function(e){return{type:r.b,id:e}},i=function(e){return{type:r.c,template:e}},s=function(e,t,n){return{type:r.e,id:e,name:t,value:n}},l=function(e){return{type:r.f,id:e}}},43:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(2),s=n.n(i),l=n(1),c=n.n(l),p=n(75),u=n.n(p),f=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),m=function(e){function t(){var e,n,o,i;r(this,t);for(var s=arguments.length,l=Array(s),c=0;c<s;c++)l[c]=arguments[c];return n=o=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),o.state={visible:!0},o.shouldSetTimer=function(){o.props.dismissable&&o.setTimer()},o.setTimer=function(){null!=o._timer&&clearTimeout(o._timer),o._timer=setTimeout(function(){u()(o._message).removeClass("inline").slideUp(400,function(){u()(o._message).removeAttr("style"),o.setState({visible:!1}),o._timer=null,o.props.dismissableCallback&&o.props.dismissableCallback()})},o.props.delay)},i=n,a(o,i)}return o(t,e),f(t,[{key:"componentWillReceiveProps",value:function(){this.setState({visible:!0}),this.shouldSetTimer()}},{key:"componentDidMount",value:function(){this.shouldSetTimer()}},{key:"componentWillUnmount",value:function(){this.props.dismissable&&clearTimeout(this._timer)}},{key:"render",value:function(){var e=this,t=this.props,n=t.text,r=t.error,a="notice inline";return r&&(a+=" error"),this.state.visible?c.a.createElement("div",{ref:function(t){return e._message=t},className:a},c.a.createElement("p",null,n)):c.a.createElement("div",null)}}]),t}(c.a.Component);m.defaultProps={delay:4e3,dismissable:!1},m.propTypes={text:s.a.string.isRequired,error:s.a.bool,delay:s.a.number,dismissable:s.a.bool,dismissableCallback:s.a.func},t.a=m},75:function(e,t){e.exports=jQuery},76:function(e,t,n){"use strict";n.d(t,"a",function(){return r}),n.d(t,"b",function(){return a}),n.d(t,"c",function(){return o}),n.d(t,"d",function(){return i}),n.d(t,"e",function(){return s}),n.d(t,"f",function(){return l});var r="SEARCH_TEMPLATES",a="SELECT_TEMPLATE",o="ADD_TEMPLATE",i="UPDATE_TEMPLATE",s="UPDATE_TEMPLATE_PARAM",l="DELETE_TEMPLATE"},77:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(2),s=n.n(i),l=n(1),c=n.n(l),p=n(11),u=n(18),f=n(15),m=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),h=function(e){function t(){var e,n,o,i;r(this,t);for(var s=arguments.length,l=Array(s),c=0;c<s;c++)l[c]=arguments[c];return n=o=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),o.selectTemplate=function(e){e.preventDefault(),e.stopPropagation(),o.props.history.push(""),o.props.onTemplateSelect(o.props.template.get("id"))},i=n,a(o,i)}return o(t,e),m(t,[{key:"render",value:function(){return c.a.createElement("a",{onClick:this.selectTemplate,href:"#",tabIndex:"150",className:"button button-primary activate"},this.props.buttonText)}}]),t}(c.a.Component);h.propTypes={template:s.a.object,onTemplateSelect:s.a.func,buttonText:s.a.string};var d=function(e){return{onTemplateSelect:function(t){e(n.i(u.a)(t))}}};t.a=n.i(f.withRouter)(n.i(p.connect)(null,d)(h))},78:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(2),s=n.n(i),l=n(1),c=n.n(l),p=n(124),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),f=function(e){function t(){var e,n,o,i;r(this,t);for(var s=arguments.length,l=Array(s),c=0;c<s;c++)l[c]=arguments[c];return n=o=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),o.handleFocus=function(e){o.container.contains(e.target)||(e.stopPropagation(),o.container.focus())},i=n,a(o,i)}return o(t,e),u(t,[{key:"componentDidMount",value:function(){document.addEventListener("focus",this.handleFocus,!0),document.activeElement&&"wp-filter-search"!==document.activeElement.className&&this.container.focus()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("focus",this.handleFocus,!0)}},{key:"render",value:function(){var e=this,t=this.props.header,n=this.props.footer,r=this.props.children,a=this.props.closeRoute;return c.a.createElement("div",{ref:function(t){return e.container=t},tabIndex:"140"},c.a.createElement("div",{className:"backdrop theme-backdrop"}),c.a.createElement("div",{className:"container theme-wrap"},c.a.createElement("div",{className:"theme-header"},t,c.a.createElement(p.a,{closeRoute:a})),c.a.createElement("div",{id:"gfpdf-template-container",className:"theme-about wp-clearfix theme-browser rendered"},r),n))}}]),t}(c.a.Component);f.propTypes={header:s.a.oneOfType([s.a.string,s.a.element]),footer:s.a.oneOfType([s.a.string,s.a.element]),children:s.a.node.isRequired,closeRoute:s.a.string},t.a=f},79:function(e,t,n){"use strict";n.d(t,"a",function(){return s}),n.d(t,"b",function(){return l}),n.d(t,"c",function(){return p}),n.d(t,"d",function(){return u}),n.d(t,"e",function(){return f}),n.d(t,"f",function(){return m});var r=n(2),a=n.n(r),o=n(1),i=n.n(o),s=function(e){var t=e.isCurrentTemplate,n=e.label;return t?i.a.createElement("span",{className:"current-label"},n):i.a.createElement("span",null)};s.propTypes={isCurrentTemplate:a.a.bool,label:a.a.string};var l=function(e){var t=e.name,n=e.version,r=e.versionLabel;return i.a.createElement("h2",{className:"theme-name"},t,i.a.createElement(c,{version:n,label:r}))};l.propTypes={name:a.a.string,version:a.a.string,versionLabel:a.a.string};var c=function(e){var t=e.label,n=e.version;return n?i.a.createElement("span",{className:"theme-version"},t,": ",n):i.a.createElement("span",null)};c.propTypes={label:a.a.string,version:a.a.string};var p=function(e){var t=e.author,n=e.uri;return n?i.a.createElement("p",{className:"theme-author"},i.a.createElement("a",{href:n},t)):i.a.createElement("p",{className:"theme-author"},t)};p.propTypes={author:a.a.string,uri:a.a.string};var u=function(e){var t=e.label,n=e.group;return i.a.createElement("p",{className:"theme-author"},i.a.createElement("strong",null,t,": ",n))};u.propTypes={label:a.a.string,group:a.a.string};var f=function(e){var t=e.desc;return i.a.createElement("p",{className:"theme-description"},t)};f.propTypes={desc:a.a.string};var m=function(e){var t=e.label,n=e.tags;return n?i.a.createElement("p",{className:"theme-tags"},i.a.createElement("span",null,t,":")," ",n):i.a.createElement("span",null)};m.propTypes={label:a.a.string,tags:a.a.string}},80:function(e,t,n){"use strict";var r=n(74),a=(n.n(r),n(140)),o=function(e){return e.template.list},i=function(e){return e.template.search},s=function(e){return e.template.activeTemplate},l=function(e,t){e=e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),e=e.replace(/ /g,")(?=.*");var n=new RegExp("^(?=.*"+e+").+","i");return t.filter(function(e){var t=e.get("template").replace(/(<([^>]+)>)/gi,""),r=e.get("description").replace(/(<([^>]+)>)/gi,""),a=e.get("author").replace(/(<([^>]+)>)/gi,""),o=e.get("group").replace(/(<([^>]+)>)/gi,"");return n.test([t,e.get("id"),o,r,a].toString())})},c=function(e,t){return e.sort(function(e,n){return!0===e.get("new",!1)&&!0===e.get("new",!1)?0:!0===e.get("new",!1)?1:!0===n.get("new",!1)?-1:t===e.get("id")?-1:t===n.get("id")?1:e.get("group")<n.get("group")?-1:e.get("group")>n.get("group")?1:e.get("template")<n.get("template")?-1:e.get("template")>n.get("template")?1:0})},p=function(e){return e.map(function(e){var t=e.get("required_pdf_version");return n.i(a.a)(t,GFPDF.currentVersion,">")?e.merge({compatible:!1,error:GFPDF.requiresGravityPdfVersion.replace(/%s/g,t),long_error:GFPDF.templateNotCompatibleWithGravityPdfVersion.replace(/%s/g,t)}):e.set("compatible",!0)})};t.a=n.i(r.createSelector)([o,i,s],function(e,t,n){return e=p(e),t&&(e=l(t,e)),c(e,n)})}},[137]);
|
1 |
+
webpackJsonp([0],{120:function(e,t,n){"use strict";function r(e){var t=a(),r=n.i(h.createStore)(t,window.devToolsExtension&&window.devToolsExtension());o(e),n.i(p.render)(c.a.createElement(u.HashRouter,null,c.a.createElement(u.Route,{render:function(e){return c.a.createElement(T.a,x({},e,{store:r,buttonText:GFPDF.advanced}))}})),document.getElementById("gpdf-advance-template-selector")),n.i(g.a)(r),i(r,e),s(r,e)}function a(){return n.i(h.combineReducers)({template:v.a})}function o(e){e.next().after('<span id="gpdf-advance-template-selector">').next().after('<div id="gfpdf-overlay" class="theme-overlay">')}function i(e,t){var r=b()(e.getState,"template.activeTemplate");e.subscribe(r(function(e){t.val()!==e&&t.val(e).trigger("chosen:updated").trigger("change")})),t.change(function(){this.value!==e.getState().template.activeTemplate&&e.dispatch(n.i(y.a)(this.value))})}function s(e,t){var n=e.getState().template.list.size,r=b()(e.getState,"template.list");e.subscribe(r(function(e){if(n!==e.size){n=e.size;var r=t.val();m.a.post(GFPDF.ajaxUrl).field("action","gfpdf_get_template_options").field("nonce",GFPDF.ajaxNonce).then(function(e){t.html(e.text).val(r).trigger("chosen:updated")})}}))}t.a=r;var l=n(1),c=n.n(l),p=n(40),u=(n.n(p),n(15)),f=n(33),m=n.n(f),h=n(41),d=n(73),b=n.n(d),y=n(18),g=n(139),v=n(138),T=n(123),x=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}},121:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(2),s=n.n(i),l=n(1),c=n.n(l),p=n(72),u=n.n(p),f=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),m=function(e){function t(){return r(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),f(t,[{key:"render",value:function(){return c.a.createElement(u.a,{onDrop:this.props.onDrop,multiple:this.props.multiple,disablePreview:!0,className:this.props.className,activeClassName:this.props.activeClassName},this.props.children)}}]),t}(c.a.Component);m.propTypes={children:s.a.node.isRequired,onDrop:s.a.func.isRequired,multiple:s.a.bool,className:s.a.string,activeClassName:s.a.string},m.defaultProps={multiple:!1,maxSize:1/0,className:"gfpdf-dropzone",activeClassName:"gfpdf-dropzone-active"},t.a=m},122:function(e,t,n){"use strict";t.a=function(){return!1}},123:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(2),s=n.n(i),l=n(1),c=n.n(l),p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(e){function t(){var e,n,o,i;r(this,t);for(var s=arguments.length,l=Array(s),c=0;c<s;c++)l[c]=arguments[c];return n=o=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),o.handleClick=function(e){e.preventDefault(),e.stopPropagation(),o.props.history.push("/template")},i=n,a(o,i)}return o(t,e),p(t,[{key:"render",value:function(){var e=this;return c.a.createElement("button",{type:"button",id:"fancy-template-selector",className:"button gfpdf-button",onClick:this.handleClick,ref:function(t){return e.button=t}},this.props.buttonText)}}]),t}(c.a.Component);u.propTypes={buttonText:s.a.string},t.a=u},124:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(2),s=n.n(i),l=n(1),c=n.n(l),p=n(15),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),f=function(e){function t(){var e,n,o,i;r(this,t);for(var s=arguments.length,l=Array(s),c=0;c<s;c++)l[c]=arguments[c];return n=o=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),o.handleKeyPress=function(e){27!==e.keyCode||"wp-filter-search"===e.target.className&&""!==e.target.value||o.closeDialog()},o.closeDialog=function(){o.props.history.push(o.props.closeRoute||"/")},i=n,a(o,i)}return o(t,e),u(t,[{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyPress,!1)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyPress,!1)}},{key:"render",value:function(){return c.a.createElement("button",{className:"close dashicons dashicons-no",tabIndex:"142",onClick:this.closeDialog,onKeyDown:this.handleKeyPress,"aria-label":"close"},c.a.createElement("span",{className:"screen-reader-text"},"Close dialog"))}}]),t}(c.a.Component);f.propTypes={closeRoute:s.a.string},t.a=n.i(p.withRouter)(f)},125:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(2),s=n.n(i),l=n(1),c=n.n(l),p=n(11),u=n(18),f=n(15),m=n(33),h=n.n(m),d=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),b=function(e){function t(){var e,n,o,i;r(this,t);for(var s=arguments.length,l=Array(s),c=0;c<s;c++)l[c]=arguments[c];return n=o=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),o.deleteTemplate=function(e){if(e.preventDefault(),e.stopPropagation(),window.confirm(o.props.templateConfirmDeleteText)){var t=o.props.template.get("id");h.a.post(o.props.ajaxUrl).field("action","gfpdf_delete_template").field("nonce",o.props.ajaxNonce).field("id",t).then(function(){},o.ajaxFailed),o.props.history.push("/template"),o.props.onTemplateDelete(t)}},o.ajaxFailed=function(){var e=o.props.template.set("error",o.props.templateDeleteErrorText);o.props.addTemplate(e)},i=n,a(o,i)}return o(t,e),d(t,[{key:"render",value:function(){var e=this.props.callbackFunction?this.props.callbackFunction:this.deleteTemplate;return c.a.createElement("a",{onClick:e,href:"#",tabIndex:"150",className:"button button-secondary delete-theme"},this.props.buttonText)}}]),t}(c.a.Component);b.propTypes={ajaxUrl:s.a.string,ajaxNonce:s.a.string,template:s.a.object,addTemplate:s.a.func,onTemplateDelete:s.a.func,callbackFunction:s.a.func,buttonText:s.a.string,templateConfirmDeleteText:s.a.string,templateDeleteErrorText:s.a.string};var y=function(e){return{addTemplate:function(t){e(n.i(u.b)(t))},onTemplateDelete:function(t){e(n.i(u.c)(t))}}};t.a=n.i(f.withRouter)(n.i(p.connect)(null,y)(b))},126:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(2),s=n.n(i),l=n(1),c=n.n(l),p=n(77),u=n(125),f=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),m=function(e){function t(){var e,n,o,i;r(this,t);for(var s=arguments.length,l=Array(s),c=0;c<s;c++)l[c]=arguments[c];return n=o=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),o.notCoreTemplate=function(e){return-1!==e.get("path").indexOf(o.props.pdfWorkingDirPath)},i=n,a(o,i)}return o(t,e),f(t,[{key:"render",value:function(){var e=this.props.template,t=e.get("compatible");return c.a.createElement("div",{className:"theme-actions"},!this.props.isActiveTemplate&&t?c.a.createElement(p.a,{template:e,buttonText:this.props.activateText}):null,!this.props.isActiveTemplate&&this.notCoreTemplate(e)?c.a.createElement(u.a,{template:e,ajaxUrl:this.props.ajaxUrl,ajaxNonce:this.props.ajaxNonce,buttonText:this.props.templateDeleteText,templateConfirmDeleteText:this.props.templateConfirmDeleteText,templateDeleteErrorText:this.props.templateDeleteErrorText}):null)}}]),t}(c.a.Component);m.propTypes={template:s.a.object.isRequired,isActiveTemplate:s.a.bool,ajaxUrl:s.a.string,ajaxNonce:s.a.string,activateText:s.a.string,pdfWorkingDirPath:s.a.string,templateDeleteText:s.a.string,templateConfirmDeleteText:s.a.string,templateDeleteErrorText:s.a.string},t.a=m},127:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(2),s=n.n(i),l=n(1),c=n.n(l),p=n(11),u=n(15),f=n(32),m=(n.n(f),function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}()),h=function(e){function t(){var e,n,o,i;r(this,t);for(var s=arguments.length,l=Array(s),c=0;c<s;c++)l[c]=arguments[c];return n=o=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),o.previousTemplate=function(e){e.preventDefault(),e.stopPropagation();var t=o.props.templates.get(o.props.templateIndex-1).get("id");t&&o.props.history.push("/template/"+t)},o.nextTemplate=function(e){e.preventDefault(),e.stopPropagation();var t=o.props.templates.get(o.props.templateIndex+1).get("id");t&&o.props.history.push("/template/"+t)},o.handleKeyPress=function(e){o.props.isFirst||37!==e.keyCode||o.previousTemplate(e),o.props.isLast||39!==e.keyCode||o.nextTemplate(e)},i=n,a(o,i)}return o(t,e),m(t,[{key:"componentDidMount",value:function(){window.addEventListener("keydown",this.handleKeyPress,!1)}},{key:"componentWillUnmount",value:function(){window.removeEventListener("keydown",this.handleKeyPress,!1)}},{key:"render",value:function(){var e=this.props.isFirst,t=this.props.isLast,r=n.i(f.List)(["dashicons","dashicons-no"]),a=r.push("left"),o=r.push("right");a=e?a.push("disabled"):a,o=t?o.push("disabled"):o;var i=e?"disabled":"",s=t?"disabled":"";return c.a.createElement("span",null,c.a.createElement("button",{onClick:this.previousTemplate,onKeyDown:this.handleKeyPress,className:a.join(" "),tabIndex:"141",disabled:i},c.a.createElement("span",{className:"screen-reader-text"},this.props.showPreviousTemplateText)),c.a.createElement("button",{onClick:this.nextTemplate,onKeyDown:this.handleKeyPress,className:o.join(" "),tabIndex:"141",disabled:s},c.a.createElement("span",{className:"screen-reader-text"},this.props.showNextTemplateText)))}}]),t}(c.a.Component);h.propTypes={templates:s.a.object.isRequired,templateIndex:s.a.number.isRequired,isFirst:s.a.bool,isLast:s.a.bool,showPreviousTemplateText:s.a.string,showNextTemplateText:s.a.string};var d=function(e,t){var n=t.templates,r=t.template.get("id");return{isFirst:n.first().get("id")===r,isLast:n.last().get("id")===r}};t.a=n.i(u.withRouter)(n.i(p.connect)(d)(h))},128:function(e,t,n){"use strict";var r=n(2),a=n.n(r),o=n(1),i=n.n(o),s=function(e){var t=e.header;return i.a.createElement("h1",null,t)};s.propTypes={header:a.a.string},t.a=s},129:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(2),s=n.n(i),l=n(1),c=n.n(l),p=n(11),u=n(80),f=n(78),m=n(130),h=n(134),d=n(128),b=n(136),y=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),g=function(e){function t(){return r(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),y(t,[{key:"render",value:function(){var e=this,t=c.a.createElement(d.a,{header:this.props.templateHeaderText});return c.a.createElement(f.a,{header:t,closeRoute:"/"},c.a.createElement(h.a,null),c.a.createElement("div",null,this.props.templates.map(function(t,n){return c.a.createElement(m.a,{key:n,template:t,templateDetailsText:e.props.templateDetailsText,activateText:e.props.activateText})}),c.a.createElement(b.a,{ajaxUrl:this.props.ajaxUrl,ajaxNonce:this.props.ajaxNonce,addTemplateText:this.props.addTemplateText,genericUploadErrorText:this.props.genericUploadErrorText,filenameErrorText:this.props.filenameErrorText,filesizeErrorText:this.props.filesizeErrorText,installSuccessText:this.props.installSuccessText,installUpdatedText:this.props.installUpdatedText,templateSuccessfullyInstalledUpdated:this.props.templateSuccessfullyInstalledUpdated,templateInstallInstructions:this.props.templateInstallInstructions})))}}]),t}(c.a.Component);g.propTypes={templates:s.a.object,route:s.a.object};var v=function(e){return{templates:n.i(u.a)(e)}};t.a=n.i(p.connect)(v)(g)},130:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(2),s=n.n(i),l=n(1),c=n.n(l),p=n(11),u=n(15),f=n(18),m=n(132),h=n(43),d=n(131),b=n(79),y=n(77),g=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),v=function(e){function t(){var e,n,o,i;r(this,t);for(var s=arguments.length,l=Array(s),c=0;c<s;c++)l[c]=arguments[c];return n=o=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),o.maybeShowDetailedTemplate=function(e){13===e.keyCode&&-1===e.target.className.indexOf("button")&&o.showDetailedTemplate()},o.showDetailedTemplate=function(){o.props.history.push("/template/"+o.props.template.get("id"))},o.removeMessage=function(){o.props.updateTemplateParam(o.props.template.get("id"),"message",null)},i=n,a(o,i)}return o(t,e),g(t,[{key:"render",value:function(){var e=this.props.template,t=this.props.activeTemplate===e.get("id"),n=e.get("compatible"),r=t?"active theme":"theme";return c.a.createElement("div",{onClick:this.showDetailedTemplate,onKeyDown:this.maybeShowDetailedTemplate,className:r,"data-slug":e.get("id"),tabIndex:"150"},c.a.createElement(m.a,{image:e.get("screenshot")}),e.get("error")?c.a.createElement(h.a,{text:e.get("error"),error:!0}):null,e.get("message")?c.a.createElement(h.a,{text:e.get("message"),dismissableCallback:this.removeMessage,dismissable:!0,delay:12e3}):null,c.a.createElement(d.a,{label:this.props.templateDetailsText}),c.a.createElement(d.b,{group:e.get("group")}),c.a.createElement(b.b,{name:e.get("template")}),c.a.createElement("div",{className:"theme-actions"},!t&&n?c.a.createElement(y.a,{template:this.props.template,buttonText:this.props.activateText}):null))}}]),t}(c.a.Component);v.propTypes={template:s.a.object,activeTemplate:s.a.string,updateTemplateParam:s.a.func,activateText:s.a.string,templateDetailsText:s.a.string};var T=function(e){return{activeTemplate:e.template.activeTemplate}},x=function(e){return{updateTemplateParam:function(t,r,a){e(n.i(f.d)(t,r,a))}}};t.a=n.i(u.withRouter)(n.i(p.connect)(T,x)(v))},131:function(e,t,n){"use strict";n.d(t,"a",function(){return s}),n.d(t,"b",function(){return l});var r=n(2),a=n.n(r),o=n(1),i=n.n(o),s=function(e){var t=e.label;return i.a.createElement("span",{className:"more-details"},t)};s.propTypes={name:a.a.string};var l=function(e){var t=e.group;return i.a.createElement("p",{className:"theme-author"},t)};l.propTypes={group:a.a.string}},132:function(e,t,n){"use strict";var r=n(2),a=n.n(r),o=n(1),i=n.n(o),s=function(e){var t=e.image,n=t?"theme-screenshot":"theme-screenshot blank";return i.a.createElement("div",{className:n},t?i.a.createElement("img",{src:t,alt:""}):null)};s.propTypes={image:a.a.string},t.a=s},133:function(e,t,n){"use strict";var r=n(2),a=n.n(r),o=n(1),i=n.n(o),s=function(e){var t=e.image,n=t?"screenshot":"screenshot blank";return i.a.createElement("div",{className:"theme-screenshots"},i.a.createElement("div",{className:n},t?i.a.createElement("img",{src:t,alt:""}):null))};s.propTypes={image:a.a.string},t.a=s},134:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(2),s=n.n(i),l=n(1),c=n.n(l),p=n(11),u=n(71),f=n.n(u),m=n(18),h=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),d=function(e){function t(){var e,n,o,i;r(this,t);for(var s=arguments.length,l=Array(s),c=0;c<s;c++)l[c]=arguments[c];return n=o=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),o.handleSearch=function(e){e.persist(),o.runSearch(e)},o.runSearch=function(e){o.props.onSearch(e.target.value||"")},i=n,a(o,i)}return o(t,e),h(t,[{key:"componentWillMount",value:function(){this.runSearch=f()(this.runSearch,200)}},{key:"componentDidMount",value:function(){this.input.focus()}},{key:"render",value:function(){var e=this;return c.a.createElement("div",null,c.a.createElement("input",{className:"wp-filter-search",id:"wp-filter-search-input",ref:function(t){return e.input=t},placeholder:"Search Installed Templates",type:"search","aria-describedby":"live-search-desc",tabIndex:"145",onChange:this.handleSearch,defaultValue:this.props.search}))}}]),t}(c.a.Component);d.propTypes={onSearch:s.a.func,search:s.a.string};var b=function(e){return{search:e.template.search}},y=function(e){return{onSearch:function(t){e(n.i(m.e)(t))}}};t.a=n.i(p.connect)(b,y)(d)},135:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(2),s=n.n(i),l=n(1),c=n.n(l),p=n(11),u=n(80),f=n(78),m=n(127),h=n(126),d=n(133),b=n(43),y=n(79),g=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),v=function(e){function t(){return r(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),g(t,[{key:"shouldComponentUpdate",value:function(e,t){return null!=e.template}},{key:"render",value:function(){var e=this.props.template,t=this.props.activeTemplate===e.get("id"),n=c.a.createElement(m.a,{template:e,templateIndex:this.props.templateIndex,templates:this.props.templates,showPreviousTemplateText:this.props.showPreviousTemplateText,showNextTemplateText:this.props.showNextTemplateText}),r=c.a.createElement(h.a,{template:e,isActiveTemplate:t,ajaxUrl:this.props.ajaxUrl,ajaxNonce:this.props.ajaxNonce,activateText:this.props.activateText,pdfWorkingDirPath:this.props.pdfWorkingDirPath,templateDeleteText:this.props.templateDeleteText,templateConfirmDeleteText:this.props.templateConfirmDeleteText,templateDeleteErrorText:this.props.templateDeleteErrorText});return c.a.createElement(f.a,{header:n,footer:r,closeRoute:"/template"},c.a.createElement("div",{id:"gfpdf-template-detail-view",className:"gfpdf-template-detail"},c.a.createElement(d.a,{image:e.get("screenshot")}),c.a.createElement("div",{className:"theme-info"},c.a.createElement(y.a,{isCurrentTemplate:t,label:this.props.currentTemplateText}),c.a.createElement(y.b,{name:e.get("template"),version:e.get("version"),versionLabel:this.props.versionText}),c.a.createElement(y.c,{author:e.get("author"),uri:e.get("author uri")}),c.a.createElement(y.d,{group:e.get("group"),label:this.props.groupText}),e.get("long_message")?c.a.createElement(b.a,{text:e.get("long_message")}):null,e.get("long_error")?c.a.createElement(b.a,{text:e.get("long_error"),error:!0}):null,c.a.createElement(y.e,{desc:e.get("description")}),c.a.createElement(y.f,{tags:e.get("tags"),label:this.props.tagsText}))))}}]),t}(c.a.Component);v.propTypes={route:s.a.object,template:s.a.object,activeTemplate:s.a.string,templateIndex:s.a.number,templates:s.a.object};var T=function(e,t){var r=n.i(u.a)(e),a=t.match.params.id,o=function(e){return e.get("id")===a};return{template:r.find(o),templateIndex:r.findIndex(o),templates:r,activeTemplate:e.template.activeTemplate}};t.a=n.i(p.connect)(T)(v)},136:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(2),s=n.n(i),l=n(1),c=n.n(l),p=n(11),u=n(33),f=n.n(u),m=n(32),h=(n.n(m),n(18)),d=n(121),b=n(43),y=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),g=function(e){function t(){var e,o,i,s;r(this,t);for(var l=arguments.length,c=Array(l),p=0;p<l;p++)c[p]=arguments[p];return o=i=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(c))),i.state={ajax:!1,error:"",message:""},i.onDrop=function(e){e instanceof Array&&e.length>0&&e.forEach(function(e){var t=e.name;i.checkFilename(t)&&i.checkFilesize(e.size)&&(i.setState({ajax:!0,error:"",message:""}),f.a.post(i.props.ajaxUrl).field("action","gfpdf_upload_template").field("nonce",i.props.ajaxNonce).attach("template",e,t).then(i.ajaxSuccess,i.ajaxFailed))})},i.checkFilename=function(e){return".zip"===e.substr(e.length-4)||(i.setState({error:i.props.filenameErrorText}),!1)},i.checkFilesize=function(e){return!(e/1024>10240)||(i.setState({error:i.props.filesizeErrorText}),!1)},i.ajaxSuccess=function(e){e.body.templates.forEach(function(e){void 0===i.props.templates.find(function(t){return t.get("id")===e.id})?(e.new=!0,e.message=i.props.installSuccessText,i.props.addNewTemplate(n.i(m.fromJS)(e))):i.props.updateTemplateParam(e.id,"message",i.props.installUpdatedText)}),i.setState({ajax:!1,message:i.props.templateSuccessfullyInstalledUpdated})},i.ajaxFailed=function(e){i.setState({error:e.response.body&&void 0!==e.response.body.error?e.response.body.error:i.props.genericUploadErrorText,ajax:!1})},i.removeMessage=function(){i.setState({message:""})},i.openDropzone=function(e){e.preventDefault()},s=o,a(i,s)}return o(t,e),y(t,[{key:"render",value:function(){return c.a.createElement(d.a,{onDrop:this.onDrop,maxSize:1024e4,multiple:!0,className:"theme add-new-theme gfpdf-dropzone"},c.a.createElement("a",{href:"#",onClick:this.openDropzone,className:this.state.ajax?"doing-ajax":""},c.a.createElement("div",{className:"theme-screenshot"},c.a.createElement("span",null)),""!==this.state.error?c.a.createElement(b.a,{text:this.state.error,error:!0}):null,""!==this.state.message?c.a.createElement(b.a,{text:this.state.message,dismissable:!0,dismissableCallback:this.removeMessage}):null,c.a.createElement("h2",{className:"theme-name"},this.props.addTemplateText)),c.a.createElement("div",{className:"gfpdf-template-install-instructions"},this.props.templateInstallInstructions))}}]),t}(c.a.Component);g.propTypes={ajaxUrl:s.a.string,ajaxNonce:s.a.string,genericUploadErrorText:s.a.string,addTemplateText:s.a.string,filenameErrorText:s.a.string,filesizeErrorText:s.a.string,installSuccessText:s.a.string,installUpdatedText:s.a.string,templateSuccessfullyInstalledUpdated:s.a.string,templateInstallInstructions:s.a.string,addNewTemplate:s.a.func,updateTemplateParam:s.a.func,templates:s.a.object};var v=function(e){return{templates:e.template.list}},T=function(e){return{addNewTemplate:function(t){e(n.i(h.b)(t))},updateTemplateParam:function(t,r,a){e(n.i(h.d)(t,r,a))}}};t.a=n.i(p.connect)(v,T)(g)},137:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(75),a=n.n(r),o=n(42),i=n.n(o),s=n(120);a()(function(){if(void 0!==GFPDF.templateList){window.Promise||(window.Promise=i.a);var e=a()("#gfpdf_settings\\[template\\], #gfpdf_settings\\[default_template\\]");e.length>0&&n.i(s.a)(e)}})},138:function(e,t,n){"use strict";var r=n(32),a=(n.n(r),n(76)),o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i={list:n.i(r.fromJS)(GFPDF.templateList),activeTemplate:GFPDF.activeTemplate||GFPDF.activeDefaultTemplate,search:""},s=function(e,t){return e.findKey(function(e){if(e.get("id")===t)return!0})};t.a=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i,t=arguments[1];switch(t.type){case a.a:return o({},e,{search:t.text});case a.b:return o({},e,{activeTemplate:t.id});case a.c:return o({},e,{list:e.list.push(t.template)});case a.d:return o({},e,{list:e.list.set(s(e.list,t.template.get("id")),t.template)});case a.e:return o({},e,{list:e.list.setIn([s(e.list,t.id),t.name],t.value)});case a.f:return o({},e,{list:e.list.delete(s(e.list,t.id))})}return e}},139:function(e,t,n){"use strict";function r(e){n.i(i.render)(o.a.createElement(s.Provider,{store:e},o.a.createElement(m,null)),document.getElementById("gfpdf-overlay"))}t.a=r;var a=n(1),o=n.n(a),i=n(40),s=(n.n(i),n(11)),l=n(15),c=n(129),p=n(135),u=n(122),f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},m=function(){return o.a.createElement(l.HashRouter,null,o.a.createElement(l.Switch,null,o.a.createElement(l.Route,{path:"/template",exact:!0,render:function(e){return o.a.createElement(c.a,f({},e,{ajaxUrl:GFPDF.ajaxUrl,ajaxNonce:GFPDF.ajaxNonce,templateDetailsText:GFPDF.templateDetails,templateHeaderText:GFPDF.installedPdfs,genericUploadErrorText:GFPDF.problemWithTheUpload,activateText:GFPDF.select,addTemplateText:GFPDF.addNewTemplate,filenameErrorText:GFPDF.uploadInvalidNotZipFile,filesizeErrorText:GFPDF.uploadInvalidExceedsFileSizeLimit,installSuccessText:GFPDF.templateSuccessfullyInstalled,installUpdatedText:GFPDF.templateSuccessfullyUpdated,templateSuccessfullyInstalledUpdated:GFPDF.templateSuccessfullyInstalledUpdated,templateInstallInstructions:GFPDF.templateInstallInstructions}))}}),o.a.createElement(l.Route,{path:"/template/:id",render:function(e){return o.a.createElement(p.a,f({},e,{ajaxUrl:GFPDF.ajaxUrl,ajaxNonce:GFPDF.ajaxNonce,pdfWorkingDirPath:GFPDF.pdfWorkingDir,activateText:GFPDF.select,templateDeleteText:GFPDF.delete,templateConfirmDeleteText:GFPDF.doYouWantToDeleteTemplate,templateDeleteErrorText:GFPDF.couldNotDeleteTemplate,currentTemplateText:GFPDF.currentTemplate,versionText:GFPDF.version,groupText:GFPDF.group,tagsText:GFPDF.tags,showPreviousTemplateText:GFPDF.showPreviousTemplate,showNextTemplateText:GFPDF.showNextTemplate}))}}),o.a.createElement(l.Route,{component:u.a})))}},140:function(e,t,n){"use strict";t.a=function(e,t,n){var r,a,o=0,i={dev:-6,alpha:-5,a:-5,beta:-4,b:-4,RC:-3,rc:-3,"#":-2,p:1,pl:1},s=function(e){return e=(""+e).replace(/[_\-+]/g,"."),e=e.replace(/([^.\d]+)/g,".$1.").replace(/\.{2,}/g,"."),e.length?e.split("."):[-8]},l=function(e){return e?isNaN(e)?i[e]||-7:parseInt(e,10):0};for(e=s(e),t=s(t),a=Math.max(e.length,t.length),r=0;r<a;r++)if(e[r]!==t[r]){if(e[r]=l(e[r]),t[r]=l(t[r]),e[r]<t[r]){o=-1;break}if(e[r]>t[r]){o=1;break}}if(!n)return o;switch(n){case">":case"gt":return o>0;case">=":case"ge":return o>=0;case"<=":case"le":return o<=0;case"===":case"=":case"eq":return 0===o;case"<>":case"!==":case"ne":return 0!==o;case"":case"<":case"lt":return o<0;default:return null}}},18:function(e,t,n){"use strict";n.d(t,"e",function(){return a}),n.d(t,"a",function(){return o}),n.d(t,"b",function(){return i}),n.d(t,"d",function(){return s}),n.d(t,"c",function(){return l});var r=n(76),a=function(e){return{type:r.a,text:e}},o=function(e){return{type:r.b,id:e}},i=function(e){return{type:r.c,template:e}},s=function(e,t,n){return{type:r.e,id:e,name:t,value:n}},l=function(e){return{type:r.f,id:e}}},43:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(2),s=n.n(i),l=n(1),c=n.n(l),p=n(75),u=n.n(p),f=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),m=function(e){function t(){var e,n,o,i;r(this,t);for(var s=arguments.length,l=Array(s),c=0;c<s;c++)l[c]=arguments[c];return n=o=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),o.state={visible:!0},o.shouldSetTimer=function(){o.props.dismissable&&o.setTimer()},o.setTimer=function(){null!=o._timer&&clearTimeout(o._timer),o._timer=setTimeout(function(){u()(o._message).removeClass("inline").slideUp(400,function(){u()(o._message).removeAttr("style"),o.setState({visible:!1}),o._timer=null,o.props.dismissableCallback&&o.props.dismissableCallback()})},o.props.delay)},i=n,a(o,i)}return o(t,e),f(t,[{key:"componentWillReceiveProps",value:function(){this.setState({visible:!0}),this.shouldSetTimer()}},{key:"componentDidMount",value:function(){this.shouldSetTimer()}},{key:"componentWillUnmount",value:function(){this.props.dismissable&&clearTimeout(this._timer)}},{key:"render",value:function(){var e=this,t=this.props,n=t.text,r=t.error,a="notice inline";return r&&(a+=" error"),this.state.visible?c.a.createElement("div",{ref:function(t){return e._message=t},className:a},c.a.createElement("p",null,n)):c.a.createElement("div",null)}}]),t}(c.a.Component);m.defaultProps={delay:4e3,dismissable:!1},m.propTypes={text:s.a.string.isRequired,error:s.a.bool,delay:s.a.number,dismissable:s.a.bool,dismissableCallback:s.a.func},t.a=m},75:function(e,t){e.exports=jQuery},76:function(e,t,n){"use strict";n.d(t,"a",function(){return r}),n.d(t,"b",function(){return a}),n.d(t,"c",function(){return o}),n.d(t,"d",function(){return i}),n.d(t,"e",function(){return s}),n.d(t,"f",function(){return l});var r="SEARCH_TEMPLATES",a="SELECT_TEMPLATE",o="ADD_TEMPLATE",i="UPDATE_TEMPLATE",s="UPDATE_TEMPLATE_PARAM",l="DELETE_TEMPLATE"},77:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(2),s=n.n(i),l=n(1),c=n.n(l),p=n(11),u=n(18),f=n(15),m=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),h=function(e){function t(){var e,n,o,i;r(this,t);for(var s=arguments.length,l=Array(s),c=0;c<s;c++)l[c]=arguments[c];return n=o=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),o.selectTemplate=function(e){e.preventDefault(),e.stopPropagation(),o.props.history.push(""),o.props.onTemplateSelect(o.props.template.get("id"))},i=n,a(o,i)}return o(t,e),m(t,[{key:"render",value:function(){return c.a.createElement("a",{onClick:this.selectTemplate,href:"#",tabIndex:"150",className:"button button-primary activate"},this.props.buttonText)}}]),t}(c.a.Component);h.propTypes={template:s.a.object,onTemplateSelect:s.a.func,buttonText:s.a.string};var d=function(e){return{onTemplateSelect:function(t){e(n.i(u.a)(t))}}};t.a=n.i(f.withRouter)(n.i(p.connect)(null,d)(h))},78:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=n(2),s=n.n(i),l=n(1),c=n.n(l),p=n(124),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),f=function(e){function t(){var e,n,o,i;r(this,t);for(var s=arguments.length,l=Array(s),c=0;c<s;c++)l[c]=arguments[c];return n=o=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),o.handleFocus=function(e){o.container.contains(e.target)||(e.stopPropagation(),o.container.focus())},i=n,a(o,i)}return o(t,e),u(t,[{key:"componentDidMount",value:function(){document.addEventListener("focus",this.handleFocus,!0),document.activeElement&&"wp-filter-search"!==document.activeElement.className&&this.container.focus()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("focus",this.handleFocus,!0)}},{key:"render",value:function(){var e=this,t=this.props.header,n=this.props.footer,r=this.props.children,a=this.props.closeRoute;return c.a.createElement("div",{ref:function(t){return e.container=t},tabIndex:"140"},c.a.createElement("div",{className:"backdrop theme-backdrop"}),c.a.createElement("div",{className:"container theme-wrap"},c.a.createElement("div",{className:"theme-header"},t,c.a.createElement(p.a,{closeRoute:a})),c.a.createElement("div",{id:"gfpdf-template-container",className:"theme-about wp-clearfix theme-browser rendered"},r),n))}}]),t}(c.a.Component);f.propTypes={header:s.a.oneOfType([s.a.string,s.a.element]),footer:s.a.oneOfType([s.a.string,s.a.element]),children:s.a.node.isRequired,closeRoute:s.a.string},t.a=f},79:function(e,t,n){"use strict";n.d(t,"a",function(){return s}),n.d(t,"b",function(){return l}),n.d(t,"c",function(){return p}),n.d(t,"d",function(){return u}),n.d(t,"e",function(){return f}),n.d(t,"f",function(){return m});var r=n(2),a=n.n(r),o=n(1),i=n.n(o),s=function(e){var t=e.isCurrentTemplate,n=e.label;return t?i.a.createElement("span",{className:"current-label"},n):i.a.createElement("span",null)};s.propTypes={isCurrentTemplate:a.a.bool,label:a.a.string};var l=function(e){var t=e.name,n=e.version,r=e.versionLabel;return i.a.createElement("h2",{className:"theme-name"},t,i.a.createElement(c,{version:n,label:r}))};l.propTypes={name:a.a.string,version:a.a.string,versionLabel:a.a.string};var c=function(e){var t=e.label,n=e.version;return n?i.a.createElement("span",{className:"theme-version"},t,": ",n):i.a.createElement("span",null)};c.propTypes={label:a.a.string,version:a.a.string};var p=function(e){var t=e.author,n=e.uri;return n?i.a.createElement("p",{className:"theme-author"},i.a.createElement("a",{href:n},t)):i.a.createElement("p",{className:"theme-author"},t)};p.propTypes={author:a.a.string,uri:a.a.string};var u=function(e){var t=e.label,n=e.group;return i.a.createElement("p",{className:"theme-author"},i.a.createElement("strong",null,t,": ",n))};u.propTypes={label:a.a.string,group:a.a.string};var f=function(e){var t=e.desc;return i.a.createElement("p",{className:"theme-description"},t)};f.propTypes={desc:a.a.string};var m=function(e){var t=e.label,n=e.tags;return n?i.a.createElement("p",{className:"theme-tags"},i.a.createElement("span",null,t,":")," ",n):i.a.createElement("span",null)};m.propTypes={label:a.a.string,tags:a.a.string}},80:function(e,t,n){"use strict";var r=n(74),a=(n.n(r),n(140)),o=function(e){return e.template.list},i=function(e){return e.template.search},s=function(e){return e.template.activeTemplate},l=function(e,t){e=e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),e=e.replace(/ /g,")(?=.*");var n=new RegExp("^(?=.*"+e+").+","i");return t.filter(function(e){var t=e.get("template").replace(/(<([^>]+)>)/gi,""),r=e.get("description").replace(/(<([^>]+)>)/gi,""),a=e.get("author").replace(/(<([^>]+)>)/gi,""),o=e.get("group").replace(/(<([^>]+)>)/gi,"");return n.test([t,e.get("id"),o,r,a].toString())})},c=function(e,t){return e.sort(function(e,n){return!0===e.get("new",!1)&&!0===e.get("new",!1)?0:!0===e.get("new",!1)?1:!0===n.get("new",!1)?-1:t===e.get("id")?-1:t===n.get("id")?1:e.get("group")<n.get("group")?-1:e.get("group")>n.get("group")?1:e.get("template")<n.get("template")?-1:e.get("template")>n.get("template")?1:0})},p=function(e){return e.map(function(e){var t=e.get("required_pdf_version");return n.i(a.a)(t,GFPDF.currentVersion,">")?e.merge({compatible:!1,error:GFPDF.requiresGravityPdfVersion.replace(/%s/g,t),long_error:GFPDF.templateNotCompatibleWithGravityPdfVersion.replace(/%s/g,t)}):e.set("compatible",!0)})};t.a=n.i(r.createSelector)([o,i,s],function(e,t,n){return e=p(e),t&&(e=l(t,e)),c(e,n)})}},[137]);
|
dist/assets/js/gfpdf-settings.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(t){t(function(){function e(){var e=this;this.init=function(){this.initCommon(),this.isSettings()&&this.processSettings(),this.isFormSettings()&&this.processFormSettings()},this.initCommon=function(){this.setupGravityForms(),this.doUploadListener(),this.doColorPicker(),this.setupSelectBoxes(),this.showTooltips(),this.setupCustomPaperSize(),this.setupToggledFields(),this.setupDynamicTemplateFields(),this.setupLicenseDeactivation()},this.setupGravityForms=function(){"undefined"!=typeof gf_vars&&(gf_vars.thisFormButton=GFPDF.conditionalText,gf_vars.show=GFPDF.enable,gf_vars.hide=GFPDF.disable),window.gfMergeTags&&"undefined"!=typeof form&&(window.gfMergeTags.getTargetElement=this.resetGfMergeTags)},this.isSettings=function(){return t("#tab_PDF").length},this.isFormSettings=function(){return t("#tab_pdf").length},this.isFormSettingsList=function(){return t("#gfpdf_list_form").length},this.isFormSettingsEdit=function(){return t("#gfpdf_pdf_form").length},this.getCurrentSettingsPage=function(){return this.isSettings()?t(".nav-tab-wrapper a.nav-tab-active:first").data("id"):""},this.processSettings=function(){switch(this.cleanupGFNavigation(),this.runPDFAccessCheck(),this.getCurrentSettingsPage()){case"general":this.generalSettings();break;case"tools":this.toolsSettings()}},this.processFormSettings=function(){this.isFormSettingsList()&&this.doFormSettingsListPage(),this.isFormSettingsEdit()&&this.doFormSettingsEditPage()},this.doFormSettingsEditPage=function(){this.setupRequiredFields(t("#gfpdf_pdf_form")),this.setupPdfTabs(),this.handleSecurityConditionals(),this.handlePDFConditionalLogic(),this.handleOwnerRestriction(),this.toggleFontAppearance(t("#gfpdf_settings\\[template\\]").data("template_group")),this.toggleAppearanceTab(),t("#gfpdf_pdf_form").submit(function(){try{tinyMCE.triggerSave()}catch(t){}}),t("#gfpdf_pdf_form").submit(function(){t("#gfpdf_settings\\[conditionalLogic\\]").val(jQuery.toJSON(window.gfpdf_current_pdf.conditionalLogic))})},this.handleSecurityConditionals=function(){var e=t("#pdf-general-advanced"),i=e.find('input[name="gfpdf_settings[security]"]'),n=e.find('input[name="gfpdf_settings[format]"]');i.change(function(){if(t(this).is(":checked")){var i=n.filter(":checked").val();t(this).val()===GFPDF.no||i!==GFPDF.standard?e.find("tr:nth-child(3),tr:nth-child(4),tr:nth-child(5):not(.gfpdf-hidden)").hide():e.find("tr:nth-child(3),tr:nth-child(4),tr:nth-child(5):not(.gfpdf-hidden)").show(),i!==GFPDF.standard?e.find("tr:nth-child(2)").hide():e.find("tr:nth-child(2)").show()}}).trigger("change"),n.change(function(){t(this).is(":checked")&&i.trigger("change")}).trigger("change")},this.handlePDFConditionalLogic=function(){gform.addFilter("gform_conditional_object",function(t,e){return"gfpdf"===e?window.gfpdf_current_pdf:t}),t("#gfpdf_conditional_logic").change(function(){void 0===window.gfpdf_current_pdf.conditionalLogic&&t(this).prop("checked")?window.gfpdf_current_pdf.conditionalLogic=new ConditionalLogic:t(this).prop("checked")||(window.gfpdf_current_pdf.conditionalLogic=null),ToggleConditionalLogic(!1,"gfpdf")}).trigger("change")},this.handleOwnerRestriction=function(){var e=t("#gfpdf-advanced-pdf-options");e.find('input[name="gfpdf_settings[public_access]"]').change(function(){t(this).is(":checked")&&("Yes"===t(this).val()?e.find("tr:nth-child(8)").hide():e.find("tr:nth-child(8)").show())}).trigger("change")},this.doFormSettingsListPage=function(){this.setupAJAXListDeleteListener(),this.setupAJAXListDuplicateListener(),this.setupAJAXListStateListener()},this.setupAJAXListStateListener=function(){t("#gfpdf_list_form").on("click",".check-column img",function(){var i=String(t(this).data("id")),n=this;if(i.length>0){n.src.indexOf("active1.png")>=0?(n.src=n.src.replace("active1.png","active0.png"),t(n).attr("title",GFPDF.inactive).attr("alt",GFPDF.inactive)):(n.src=n.src.replace("active0.png","active1.png"),t(n).attr("title",GFPDF.active).attr("alt",GFPDF.active));var a={action:"gfpdf_change_state",nonce:t(this).data("nonce"),fid:t(this).data("fid"),pid:t(this).data("id")};e.ajax(a,function(t){})}})},this.setupAJAXListDuplicateListener=function(){t("#gfpdf_list_form").on("click","a.submitduplicate",function(){var i=String(t(this).data("id")),n=this,a=t('<img alt="'+GFPDF.spinnerAlt+'" src="'+GFPDF.spinnerUrl+'" class="gfpdf-spinner gfpdf-spinner-small" />');if(t(this).after(a).parent().parent().attr("style","position:static; visibility: visible;"),i.length>0){var s={action:"gfpdf_list_duplicate",nonce:t(this).data("nonce"),fid:t(this).data("fid"),pid:t(this).data("id")};e.ajax(s,function(a){if(a.msg){t(n).parent().parent().attr("style","").find(".gfpdf-spinner").remove(),e.show_message(a.msg);var s=t(n).parents("tr"),o=s.clone().css("background","#baffb8");o.find(".column-name > a, .edit a").each(function(){var i=t(this).attr("href");i=e.updateURLParameter(i,"pid",a.pid),t(this).attr("href",i)}),o.find(".column-name > a").html(a.name);var d=o.find(".duplicate a"),r=o.find(".delete a"),c=o.find(".check-column img"),f=o.find(".column-shortcode input");d.data("id",a.pid),d.data("nonce",a.dup_nonce),r.data("id",a.pid),r.data("nonce",a.del_nonce),c.data("id",a.pid),c.data("nonce",a.state_nonce);var l=f.val();l=l.replace(i,a.pid),f.val(l);var p="";s.hasClass("alternate")?(o.removeClass("alternate"),p="#FFF"):(o.addClass("alternate"),p="#f9f9f9");var g=c.attr("src");c.attr("title",GFPDF.inactive).attr("alt",GFPDF.inactive).attr("src",g.replace("active1.png","active0.png")),o.hide().insertAfter(s).fadeIn().animate({backgroundColor:p})}})}})},this.maybeShowEmptyRow=function(){var e=t("#gfpdf_list_form tbody");if(0===e.find("tr").length){var i=t("<tr>").addClass("no-items"),n=t("<td>").attr("colspan","5").addClass("colspanchange"),a=t("<a>").attr("href",t("#add-new-pdf").attr("href")).append(GFPDF.letsGoCreateOne+".");n.append(GFPDF.thisFormHasNoPdfs).append(" ").append(a),i.append(n),e.append(i)}},this.setupAJAXListDeleteListener=function(){var i=t("#delete-confirm"),n=[{text:GFPDF.delete,click:function(){i.wpdialog("close"),$elm=t(i.data("elm"));var n=t('<img alt="'+GFPDF.spinnerAlt+'" src="'+GFPDF.spinnerUrl+'" class="gfpdf-spinner gfpdf-spinner-small" />');$elm.append(n).parent().parent().attr("style","position:static; visibility: visible;");var a={action:"gfpdf_list_delete",nonce:$elm.data("nonce"),fid:$elm.data("fid"),pid:$elm.data("id")};e.ajax(a,function(t){if(t.msg){$elm.parent().parent().attr("style","").find(".gfpdf-spinner").remove(),e.show_message(t.msg);$elm.parents("tr").css("background","#ffb8b8").fadeOut(400,function(){this.remove(),e.maybeShowEmptyRow()})}i.data("elm",null)})}},{text:GFPDF.cancel,click:function(){i.wpdialog("close").data("elm",null)}}];this.wp_dialog(i,n,300,175),t("#gfpdf_list_form").on("click","a.submitdelete",function(){String(t(this).data("id")).length>0&&!i.data("elm")&&(e.resizeDialogIfNeeded(i,300,175),i.wpdialog("open").data("elm",this))})},this.setupPdfTabs=function(){t(".gfpdf-tab-container").not(":eq(0)").hide(),t(".gfpdf-tab-wrapper a").click(function(){return t(this).parents("ul").find("a").removeClass("current"),t(this).addClass("current").blur(),t(".gfpdf-tab-container").hide(),t(t(this).attr("href")).show(),!1})},this.setupToggledFields=function(){t("form").off("change",".gfpdf-input-toggle").on("change",".gfpdf-input-toggle",function(){var e=t(this).parent().next();t(this).prop("checked")?e.slideDown("slow"):(e.slideUp("slow"),e.find(".wp-editor-area").each(function(){var e=tinyMCE.get(t(this).attr("id"));null!==e&&e.setContent("")}),e.find("textarea").each(function(){t(this).val("")}))})},this.setupDynamicTemplateFields=function(){t("#gfpdf_settings\\[template\\]").off("change").change(function(){var i=t('<img alt="'+GFPDF.spinnerAlt+'" src="'+GFPDF.spinnerUrl+'" class="gfpdf-spinner" />');t(this).next().after(i);var n={action:"gfpdf_get_template_fields",nonce:GFPDF.ajaxNonce,template:t(this).val(),type:t(this).attr("id"),id:t("#gform_id").val(),gform_pdf_id:t("#gform_pdf_id").val()};e.ajax(n,function(n){i.remove(),t('input[name="gfpdf_settings[advanced_template]"][value="No"]').prop("checked",!0).trigger("change"),n.fields?(window.gfMergeTags&&(t(".merge-tag-support").removeClass("merge-tag-support"),t(".all-merge-tags a.open-list").off("click")),t.each(n.editors,function(t,e){var i=tinyMCE.get(e);if(null!==i)try{tinyMCE.remove(i)}catch(t){}}),t("#pdf-custom-appearance").hide().html(n.fields).fadeIn(),t("#gfpdf-custom-appearance-nav").show(),e.loadTinyMCEEditor(n.editors,n.editor_init),e.initCommon(),e.doMergetags()):(t("#gfpdf-custom-appearance-nav").hide(),t("#pdf-custom-appearance").html("")),n.template_type&&e.toggleFontAppearance(n.template_type)})})},this.setupLicenseDeactivation=function(){t(".gfpdf-deactivate-license").click(function(){var i=t(this).parent();i.find(".gf_settings_description label").html("");var n=t('<img alt="'+GFPDF.spinnerAlt+'" src="'+GFPDF.spinnerUrl+'" class="gfpdf-spinner" />');t(this).append(n);var a=t(this).data("addon-name"),s={action:"gfpdf_deactivate_license",addon_name:a,license:t(this).data("license"),nonce:t(this).data("nonce")};return e.ajax(s,function(e){n.remove(),e.success?(t("#gfpdf_settings\\[license_"+a+"\\]").val(""),t("#gfpdf_settings\\[license_"+a+"_message\\]").val(""),t("#gfpdf_settings\\[license_"+a+"_status\\]").val(""),i.find("i").remove(),i.find("a").remove(),i.find(".gf_settings_description label").html(e.success)):i.find(".gf_settings_description label").html(e.error)}),!1})},this.toggleFontAppearance=function(e){var i=t("#pdf-general-appearance").find("tr.gfpdf_font_type, tr.gfpdf_font_size, tr.gfpdf_font_colour");"legacy"==e?i.hide():i.show()},this.toggleAppearanceTab=function(){t('input[name="gfpdf_settings[advanced_template]"]').change(function(){"Yes"==t(this).val()?t("#gfpdf-appearance-nav").hide():t("#gfpdf-appearance-nav").show()}),t('input[name="gfpdf_settings[advanced_template]"]:checked').trigger("change")},this.loadTinyMCEEditor=function(e,i){null!=i&&(i.body_class="id post-type-post post-status-publish post-format-standard",i.formats={alignleft:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"left"}},{selector:"img,table,dl.wp-caption",classes:"alignleft"}],aligncenter:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"center"}},{selector:"img,table,dl.wp-caption",classes:"aligncenter"}],alignright:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"right"}},{selector:"img,table,dl.wp-caption",classes:"alignright"}],strikethrough:{inline:"del"}}),t.each(e,function(t,e){i.selector="#"+e,tinyMCE.init(i),tinyMCE.execCommand("mceAddEditor",!1,e),"function"==typeof QTags&&(QTags({id:e}),QTags._buttonsInit(),"function"==typeof switchEditors.switchto&&switchEditors.switchto(jQuery("#wp-"+e+"-wrap").find(".wp-switch-editor.switch-"+("html"==getUserSetting("editor")?"html":"tmce"))[0]))})},this.doUploadListener=function(){var e;window.formfield="",t("body").off("click",".gfpdf_settings_upload_button").on("click",".gfpdf_settings_upload_button",function(i){i.preventDefault();var n=t(this);if(window.formfield=t(this).parent().prev(),e)return void e.open();e=wp.media.frames.file_frame=wp.media({title:n.data("uploader-title"),button:{text:n.data("uploader-button-text")},multiple:!1}),e.on("select",function(){e.state().get("selection").each(function(t,e){t=t.toJSON(),window.formfield.val(t.url).change()})}),e.open()})},this.doColorPicker=function(){t(".gfpdf-color-picker").each(function(){t(this).wpColorPicker()})},this.doMergetags=function(){window.gfMergeTags&&"undefined"!=typeof form&&(window.gfMergeTags=new gfMergeTagsObj(form),window.gfMergeTags.getTargetElement=this.resetGfMergeTags),!window.gfMergeTags&&"undefined"!=typeof form&&t(".merge-tag-support").length>=0&&t(".merge-tag-support").each(function(){new gfMergeTagsObj(form,t(this))})},this.resetGfMergeTags=function(e){var i=t(e),n=i.parents("span.all-merge-tags").data("targetElement");return n=n.replace(/[!"#$%&'()*+,.\/:;<=>?@[\\\]^`{|}~]/g,"\\$&"),t("#"+n)},this.setupCustomPaperSize=function(){t(".gfpdf_paper_size").each(function(){var e=t(this).nextAll(".gfpdf_paper_size_other").first();t(this).find("select").off("change").change(function(){"CUSTOM"===t(this).val()?e.fadeIn():e.fadeOut()}).trigger("change")})},this.cleanupGFNavigation=function(){t("#gform_tabs a").each(function(){var e=t(this).attr("href"),i=new RegExp("&tab=[^&;]*","g");t(this).attr("href",e.replace(i,""))})},this.runPDFAccessCheck=function(){var e=t("#gfpdf-direct-pdf-protection-check");if(e.length>0){var i=t('<img alt="'+GFPDF.spinnerAlt+'" src="'+GFPDF.spinnerUrl+'" class="gfpdf-spinner" />');e.append(i);var n={action:"gfpdf_has_pdf_protection",nonce:e.data("nonce")};this.ajax(n,function(t){i.remove(),!0===t?e.find("#gfpdf-direct-pdf-check-protected").show():e.find("#gfpdf-direct-pdf-check-unprotected").show()})}},this.setupRequiredFields=function(e){e.attr("novalidate","novalidate"),e.find('tr input[type="submit"]').click(function(){e.addClass("formSubmitted")}),e.find("tr").each(function(){t(this).find(':input[required=""]:first, :input[required]:first').parents("tr").find("th").append('<span class="gfield_required">*</span>')})},this.showTooltips=function(){"function"==typeof gform_initialize_tooltips&&(t(".gf_hidden_tooltip").each(function(){t(this).parent().siblings("th:first").append(" ").append(e.get_tooltip(t(this).html())),t(this).remove()}),gform_initialize_tooltips())},this.setupSelectBoxes=function(){var e=t(".gfpdf-chosen"),i={disable_search_threshold:5,width:"100%"};t("body").hasClass("rtl")&&(e.addClass("chosen-rtl"),i.rtl=!0),console.log(i),e.each(function(){t(this).chosen(i)})},this.setup_advanced_options=function(){var e=t(".gfpdf-advanced-options"),i=e.prev();e.find("a").click(function(){var e=this;return i.slideToggle(600,function(){var i=t(e).text();t(e).text(i==GFPDF.showAdvancedOptions?GFPDF.hideAdvancedOptions:GFPDF.showAdvancedOptions)}),!1}),t(".gfpdf-advanced-options").prev().find(".gfield_error").length&&i.show()},this.generalSettings=function(){this.setupRequiredFields(t("#pdfextended-settings > form"));var e=t("#pdf-general-security");e.find('input[name="gfpdf_settings[default_restrict_owner]"]').change(function(){t(this).is(":checked")&&("Yes"===t(this).val()?e.find("tr:nth-child(3)").hide():e.find("tr:nth-child(3)").show())}).trigger("change"),this.setup_advanced_options()},this.toolsSettings=function(){this.setupToolsTemplateInstallerDialog(),this.setupToolsFontsDialog(),this.setupToolsUninstallDialog()},this.setupToolsTemplateInstallerDialog=function(){var i=t("#gfpdf_settings\\[setup_templates\\]"),n=t("#setup-templates-confirm"),a=[{text:GFPDF.continue,click:function(){i.unbind().click()}},{text:GFPDF.cancel,click:function(){n.wpdialog("close")}}];n.length&&(this.wp_dialog(n,a,500,350),i.click(function(){return e.resizeDialogIfNeeded(n,500,350),n.wpdialog("open"),!1}))},this.setupToolsFontsDialog=function(){var i=t("#gfpdf_settings\\[manage_fonts\\]"),n=t("#manage-font-files");this.wp_dialog(n,[],500,500),i.click(function(){return e.resizeDialogIfNeeded(n,500,500),n.wpdialog("open"),!1}),window.location.hash&&"#manage_fonts"==window.location.hash&&i.click()},this.setupToolsUninstallDialog=function(){var i=t("#gfpdf-uninstall"),n=t("#uninstall-confirm"),a=[{text:GFPDF.uninstall,click:function(){i.parents("form").submit()}},{text:GFPDF.cancel,click:function(){n.wpdialog("close")}}];this.wp_dialog(n,a,500,175),i.click(function(){return e.resizeDialogIfNeeded(n,500,175),n.wpdialog("open"),!1})},this.resizeDialogIfNeeded=function(e,i,n){var a=t(window).width(),s=t(window).height(),o=a<500?a-20:i,d=s<500?s-50:n;e.wpdialog("option","width",o),e.wpdialog("option","height",d)},this.wp_dialog=function(e,i,n,a){e.wpdialog({autoOpen:!1,resizable:!1,draggable:!1,width:n,height:a,modal:!0,dialogClass:"wp-dialog",zIndex:3e5,buttons:i,open:function(){t(this).siblings(".ui-dialog-buttonpane").find("button:eq(1)").focus(),t(".ui-widget-overlay").bind("click",function(){e.wpdialog("close")})}})},this.get_tooltip=function(e){var i=t("<a>"),n=t('<i class="fa fa-question-circle">');return i.append(n),i.addClass("gf_tooltip tooltip"),i.click(function(){return!1}),i.attr("title",e),i},this.ajax=function(e,i){t.ajax({type:"post",dataType:"json",url:GFPDF.ajaxUrl,data:e,success:i,error:this.ajax_error})},this.ajax_error=function(t,e,i){console.log(e),console.log(i)},this.show_message=function(e,i,n){i=void 0!==i?i:4500,n=void 0!==n&&n;var a=t('<div id="message">').html("<p>"+e+"</p>");!0===n?a.addClass("error"):a.addClass("updated"),t(".wrap > h2").after(a),setTimeout(function(){a.slideUp()},i)},this.updateURLParameter=function(t,e,n){var a="",s=t.split("?"),o=s[0],d=s[1],r="";if(d)for(s=d.split("&"),i=0;i<s.length;i++)s[i].split("=")[0]!=e&&(a+=r+s[i],r="&");return o+"?"+a+r+e+"="+n}}(new e).init()})}(jQuery);
|
1 |
+
!function(t){t(function(){function e(){var e=this;this.init=function(){this.initCommon(),this.isSettings()&&this.processSettings(),this.isFormSettings()&&this.processFormSettings()},this.initCommon=function(){this.setupGravityForms(),this.doUploadListener(),this.doColorPicker(),this.setupSelectBoxes(),this.showTooltips(),this.setupCustomPaperSize(),this.setupToggledFields(),this.setupDynamicTemplateFields(),this.setupLicenseDeactivation()},this.setupGravityForms=function(){"undefined"!=typeof gf_vars&&(gf_vars.thisFormButton=GFPDF.conditionalText,gf_vars.show=GFPDF.enable,gf_vars.hide=GFPDF.disable),window.gfMergeTags&&"undefined"!=typeof form&&(window.gfMergeTags.getTargetElement=this.resetGfMergeTags)},this.isSettings=function(){return t("#tab_PDF").length},this.isFormSettings=function(){return t("#tab_pdf").length},this.isFormSettingsList=function(){return t("#gfpdf_list_form").length},this.isFormSettingsEdit=function(){return t("#gfpdf_pdf_form").length},this.getCurrentSettingsPage=function(){return this.isSettings()?t(".nav-tab-wrapper a.nav-tab-active:first").data("id"):""},this.processSettings=function(){switch(this.cleanupGFNavigation(),this.runPDFAccessCheck(),this.getCurrentSettingsPage()){case"general":this.generalSettings();break;case"tools":this.toolsSettings()}},this.processFormSettings=function(){this.isFormSettingsList()&&this.doFormSettingsListPage(),this.isFormSettingsEdit()&&this.doFormSettingsEditPage()},this.doFormSettingsEditPage=function(){this.setupRequiredFields(t("#gfpdf_pdf_form")),this.setupPdfTabs(),this.handleSecurityConditionals(),this.handlePDFConditionalLogic(),this.handleOwnerRestriction(),this.toggleFontAppearance(t("#gfpdf_settings\\[template\\]").data("template_group")),this.toggleAppearanceTab(),t("#gfpdf_pdf_form").submit(function(){try{tinyMCE.triggerSave()}catch(t){}}),t("#gfpdf_pdf_form").submit(function(){t("#gfpdf_settings\\[conditionalLogic\\]").val(jQuery.toJSON(window.gfpdf_current_pdf.conditionalLogic))})},this.handleSecurityConditionals=function(){var e=t("#pdf-general-advanced"),i=e.find('input[name="gfpdf_settings[security]"]'),n=e.find('input[name="gfpdf_settings[format]"]');i.change(function(){if(t(this).is(":checked")){var i=n.filter(":checked").val();t(this).val()===GFPDF.no||i!==GFPDF.standard?e.find("tr:nth-child(3),tr:nth-child(4),tr:nth-child(5):not(.gfpdf-hidden)").hide():e.find("tr:nth-child(3),tr:nth-child(4),tr:nth-child(5):not(.gfpdf-hidden)").show(),i!==GFPDF.standard?e.find("tr:nth-child(2)").hide():e.find("tr:nth-child(2)").show()}}).trigger("change"),n.change(function(){t(this).is(":checked")&&i.trigger("change")}).trigger("change")},this.handlePDFConditionalLogic=function(){gform.addFilter("gform_conditional_object",function(t,e){return"gfpdf"===e?window.gfpdf_current_pdf:t}),t("#gfpdf_conditional_logic").change(function(){void 0===window.gfpdf_current_pdf.conditionalLogic&&t(this).prop("checked")?window.gfpdf_current_pdf.conditionalLogic=new ConditionalLogic:t(this).prop("checked")||(window.gfpdf_current_pdf.conditionalLogic=null),ToggleConditionalLogic(!1,"gfpdf")}).trigger("change")},this.handleOwnerRestriction=function(){var e=t("#gfpdf-advanced-pdf-options");e.find('input[name="gfpdf_settings[public_access]"]').change(function(){t(this).is(":checked")&&("Yes"===t(this).val()?e.find("tr:nth-child(8)").hide():e.find("tr:nth-child(8)").show())}).trigger("change")},this.doFormSettingsListPage=function(){this.setupAJAXListDeleteListener(),this.setupAJAXListDuplicateListener(),this.setupAJAXListStateListener()},this.setupAJAXListStateListener=function(){t("#gfpdf_list_form").on("click",".check-column img",function(){var i=String(t(this).data("id")),n=this;if(i.length>0){n.src.indexOf("active1.png")>=0?(n.src=n.src.replace("active1.png","active0.png"),t(n).attr("title",GFPDF.inactive).attr("alt",GFPDF.inactive)):(n.src=n.src.replace("active0.png","active1.png"),t(n).attr("title",GFPDF.active).attr("alt",GFPDF.active));var a={action:"gfpdf_change_state",nonce:t(this).data("nonce"),fid:t(this).data("fid"),pid:t(this).data("id")};e.ajax(a,function(t){})}})},this.setupAJAXListDuplicateListener=function(){t("#gfpdf_list_form").on("click","a.submitduplicate",function(){var i=String(t(this).data("id")),n=this,a=t('<img alt="'+GFPDF.spinnerAlt+'" src="'+GFPDF.spinnerUrl+'" class="gfpdf-spinner gfpdf-spinner-small" />');if(t(this).after(a).parent().parent().attr("style","position:static; visibility: visible;"),i.length>0){var s={action:"gfpdf_list_duplicate",nonce:t(this).data("nonce"),fid:t(this).data("fid"),pid:t(this).data("id")};e.ajax(s,function(a){if(a.msg){t(n).parent().parent().attr("style","").find(".gfpdf-spinner").remove(),e.show_message(a.msg);var s=t(n).parents("tr"),o=s.clone().css("background","#baffb8");o.find(".column-name > a, .edit a").each(function(){var i=t(this).attr("href");i=e.updateURLParameter(i,"pid",a.pid),t(this).attr("href",i)}),o.find(".column-name > a").html(a.name);var d=o.find(".duplicate a"),r=o.find(".delete a"),c=o.find(".check-column img"),f=o.find(".column-shortcode input");d.data("id",a.pid),d.data("nonce",a.dup_nonce),r.data("id",a.pid),r.data("nonce",a.del_nonce),c.data("id",a.pid),c.data("nonce",a.state_nonce);var l=f.val();l=l.replace(i,a.pid),f.val(l);var p="";s.hasClass("alternate")?(o.removeClass("alternate"),p="#FFF"):(o.addClass("alternate"),p="#f9f9f9");var g=c.attr("src");c.attr("title",GFPDF.inactive).attr("alt",GFPDF.inactive).attr("src",g.replace("active1.png","active0.png")),o.hide().insertAfter(s).fadeIn().animate({backgroundColor:p})}})}})},this.maybeShowEmptyRow=function(){var e=t("#gfpdf_list_form tbody");if(0===e.find("tr").length){var i=t("<tr>").addClass("no-items"),n=t("<td>").attr("colspan","5").addClass("colspanchange"),a=t("<a>").attr("href",t("#add-new-pdf").attr("href")).append(GFPDF.letsGoCreateOne+".");n.append(GFPDF.thisFormHasNoPdfs).append(" ").append(a),i.append(n),e.append(i)}},this.setupAJAXListDeleteListener=function(){var i=t("#delete-confirm"),n=[{text:GFPDF.delete,click:function(){i.wpdialog("close"),$elm=t(i.data("elm"));var n=t('<img alt="'+GFPDF.spinnerAlt+'" src="'+GFPDF.spinnerUrl+'" class="gfpdf-spinner gfpdf-spinner-small" />');$elm.append(n).parent().parent().attr("style","position:static; visibility: visible;");var a={action:"gfpdf_list_delete",nonce:$elm.data("nonce"),fid:$elm.data("fid"),pid:$elm.data("id")};e.ajax(a,function(t){if(t.msg){$elm.parent().parent().attr("style","").find(".gfpdf-spinner").remove(),e.show_message(t.msg);$elm.parents("tr").css("background","#ffb8b8").fadeOut(400,function(){this.remove(),e.maybeShowEmptyRow()})}i.data("elm",null)})}},{text:GFPDF.cancel,click:function(){i.wpdialog("close").data("elm",null)}}];this.wp_dialog(i,n,300,175),t("#gfpdf_list_form").on("click","a.submitdelete",function(){String(t(this).data("id")).length>0&&!i.data("elm")&&(e.resizeDialogIfNeeded(i,300,175),i.wpdialog("open").data("elm",this))})},this.setupPdfTabs=function(){t(".gfpdf-tab-container").not(":eq(0)").hide(),t(".gfpdf-tab-wrapper a").click(function(){return t(this).parents("ul").find("a").removeClass("current"),t(this).addClass("current").blur(),t(".gfpdf-tab-container").hide(),t(t(this).attr("href")).show(),!1})},this.setupToggledFields=function(){t("form").off("change",".gfpdf-input-toggle").on("change",".gfpdf-input-toggle",function(){var e=t(this).parent().next();t(this).prop("checked")?e.slideDown("slow"):(e.slideUp("slow"),e.find(".wp-editor-area").each(function(){var e=tinyMCE.get(t(this).attr("id"));null!==e&&e.setContent("")}),e.find("textarea").each(function(){t(this).val("")}))})},this.setupDynamicTemplateFields=function(){t("#gfpdf_settings\\[template\\]").off("change").change(function(){var i=t('<img alt="'+GFPDF.spinnerAlt+'" src="'+GFPDF.spinnerUrl+'" class="gfpdf-spinner" />');t(this).next().after(i);var n={action:"gfpdf_get_template_fields",nonce:GFPDF.ajaxNonce,template:t(this).val(),type:t(this).attr("id"),id:t("#gform_id").val(),gform_pdf_id:t("#gform_pdf_id").val()};e.ajax(n,function(n){i.remove(),t('input[name="gfpdf_settings[advanced_template]"][value="No"]').prop("checked",!0).trigger("change"),n.fields?(window.gfMergeTags&&(t(".merge-tag-support").removeClass("merge-tag-support"),t(".all-merge-tags a.open-list").off("click")),t.each(n.editors,function(t,e){var i=tinyMCE.get(e);if(null!==i)try{tinyMCE.remove(i)}catch(t){}}),t("#pdf-custom-appearance").hide().html(n.fields).fadeIn(),t("#gfpdf-custom-appearance-nav").show(),e.loadTinyMCEEditor(n.editors,n.editor_init),e.initCommon(),e.doMergetags()):(t("#gfpdf-custom-appearance-nav").hide(),t("#pdf-custom-appearance").html("")),n.template_type&&e.toggleFontAppearance(n.template_type)})})},this.setupLicenseDeactivation=function(){t(".gfpdf-deactivate-license").click(function(){var i=t(this).parent();i.find(".gf_settings_description label").html("");var n=t('<img alt="'+GFPDF.spinnerAlt+'" src="'+GFPDF.spinnerUrl+'" class="gfpdf-spinner" />');t(this).append(n);var a=t(this).data("addon-name"),s={action:"gfpdf_deactivate_license",addon_name:a,license:t(this).data("license"),nonce:t(this).data("nonce")};return e.ajax(s,function(e){n.remove(),e.success?(t("#gfpdf_settings\\[license_"+a+"\\]").val(""),t("#gfpdf_settings\\[license_"+a+"_message\\]").val(""),t("#gfpdf_settings\\[license_"+a+"_status\\]").val(""),i.find("i").remove(),i.find("a").remove(),i.find(".gf_settings_description label").html(e.success)):i.find(".gf_settings_description label").html(e.error)}),!1})},this.toggleFontAppearance=function(e){var i=t("#pdf-general-appearance").find("tr.gfpdf_font_type, tr.gfpdf_font_size, tr.gfpdf_font_colour");"legacy"==e?i.hide():i.show()},this.toggleAppearanceTab=function(){t('input[name="gfpdf_settings[advanced_template]"]').change(function(){"Yes"==t(this).val()?t("#gfpdf-appearance-nav").hide():t("#gfpdf-appearance-nav").show()}),t('input[name="gfpdf_settings[advanced_template]"]:checked').trigger("change")},this.loadTinyMCEEditor=function(e,i){null!=i&&(i.body_class="id post-type-post post-status-publish post-format-standard",i.formats={alignleft:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"left"}},{selector:"img,table,dl.wp-caption",classes:"alignleft"}],aligncenter:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"center"}},{selector:"img,table,dl.wp-caption",classes:"aligncenter"}],alignright:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"right"}},{selector:"img,table,dl.wp-caption",classes:"alignright"}],strikethrough:{inline:"del"}},i.content_style='body#tinymce { max-width: 100%; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;}'),t.each(e,function(t,e){i.selector="#"+e,tinyMCE.init(i),tinyMCE.execCommand("mceAddEditor",!1,e),"function"==typeof QTags&&(QTags({id:e}),QTags._buttonsInit(),"function"==typeof switchEditors.switchto&&switchEditors.switchto(jQuery("#wp-"+e+"-wrap").find(".wp-switch-editor.switch-"+("html"==getUserSetting("editor")?"html":"tmce"))[0]))})},this.doUploadListener=function(){var e;window.formfield="",t("body").off("click",".gfpdf_settings_upload_button").on("click",".gfpdf_settings_upload_button",function(i){i.preventDefault();var n=t(this);if(window.formfield=t(this).parent().prev(),e)return void e.open();e=wp.media.frames.file_frame=wp.media({title:n.data("uploader-title"),button:{text:n.data("uploader-button-text")},multiple:!1}),e.on("select",function(){e.state().get("selection").each(function(t,e){t=t.toJSON(),window.formfield.val(t.url).change()})}),e.open()})},this.doColorPicker=function(){t(".gfpdf-color-picker").each(function(){t(this).wpColorPicker()})},this.doMergetags=function(){window.gfMergeTags&&"undefined"!=typeof form&&(window.gfMergeTags=new gfMergeTagsObj(form),window.gfMergeTags.getTargetElement=this.resetGfMergeTags),!window.gfMergeTags&&"undefined"!=typeof form&&t(".merge-tag-support").length>=0&&t(".merge-tag-support").each(function(){new gfMergeTagsObj(form,t(this))})},this.resetGfMergeTags=function(e){var i=t(e),n=i.parents("span.all-merge-tags").data("targetElement");return n=n.replace(/[!"#$%&'()*+,.\/:;<=>?@[\\\]^`{|}~]/g,"\\$&"),t("#"+n)},this.setupCustomPaperSize=function(){t(".gfpdf_paper_size").each(function(){var e=t(this).nextAll(".gfpdf_paper_size_other").first();t(this).find("select").off("change").change(function(){"CUSTOM"===t(this).val()?e.fadeIn():e.fadeOut()}).trigger("change")})},this.cleanupGFNavigation=function(){t("#gform_tabs a").each(function(){var e=t(this).attr("href"),i=new RegExp("&tab=[^&;]*","g");t(this).attr("href",e.replace(i,""))})},this.runPDFAccessCheck=function(){var e=t("#gfpdf-direct-pdf-protection-check");if(e.length>0){var i=t('<img alt="'+GFPDF.spinnerAlt+'" src="'+GFPDF.spinnerUrl+'" class="gfpdf-spinner" />');e.append(i);var n={action:"gfpdf_has_pdf_protection",nonce:e.data("nonce")};this.ajax(n,function(t){i.remove(),!0===t?e.find("#gfpdf-direct-pdf-check-protected").show():e.find("#gfpdf-direct-pdf-check-unprotected").show()})}},this.setupRequiredFields=function(e){e.attr("novalidate","novalidate"),e.find('tr input[type="submit"]').click(function(){e.addClass("formSubmitted")}),e.find("tr").each(function(){t(this).find(':input[required=""]:first, :input[required]:first').parents("tr").find("th").append('<span class="gfield_required">*</span>')})},this.showTooltips=function(){"function"==typeof gform_initialize_tooltips&&(t(".gf_hidden_tooltip").each(function(){t(this).parent().siblings("th:first").append(" ").append(e.get_tooltip(t(this).html())),t(this).remove()}),gform_initialize_tooltips())},this.setupSelectBoxes=function(){var e=t(".gfpdf-chosen"),i={disable_search_threshold:5,width:"100%"};t("body").hasClass("rtl")&&(e.addClass("chosen-rtl"),i.rtl=!0),console.log(i),e.each(function(){t(this).chosen(i)})},this.setup_advanced_options=function(){var e=t(".gfpdf-advanced-options"),i=e.prev();e.find("a").click(function(){var e=this;return i.slideToggle(600,function(){var i=t(e).text();t(e).text(i==GFPDF.showAdvancedOptions?GFPDF.hideAdvancedOptions:GFPDF.showAdvancedOptions)}),!1}),t(".gfpdf-advanced-options").prev().find(".gfield_error").length&&i.show()},this.generalSettings=function(){this.setupRequiredFields(t("#pdfextended-settings > form"));var e=t("#pdf-general-security");e.find('input[name="gfpdf_settings[default_restrict_owner]"]').change(function(){t(this).is(":checked")&&("Yes"===t(this).val()?e.find("tr:nth-child(3)").hide():e.find("tr:nth-child(3)").show())}).trigger("change"),this.setup_advanced_options()},this.toolsSettings=function(){this.setupToolsTemplateInstallerDialog(),this.setupToolsFontsDialog(),this.setupToolsUninstallDialog()},this.setupToolsTemplateInstallerDialog=function(){var i=t("#gfpdf_settings\\[setup_templates\\]"),n=t("#setup-templates-confirm"),a=[{text:GFPDF.continue,click:function(){i.unbind().click()}},{text:GFPDF.cancel,click:function(){n.wpdialog("close")}}];n.length&&(this.wp_dialog(n,a,500,350),i.click(function(){return e.resizeDialogIfNeeded(n,500,350),n.wpdialog("open"),!1}))},this.setupToolsFontsDialog=function(){var i=t("#gfpdf_settings\\[manage_fonts\\]"),n=t("#manage-font-files");this.wp_dialog(n,[],500,500),i.click(function(){return e.resizeDialogIfNeeded(n,500,500),n.wpdialog("open"),!1}),window.location.hash&&"#manage_fonts"==window.location.hash&&i.click()},this.setupToolsUninstallDialog=function(){var i=t("#gfpdf-uninstall"),n=t("#uninstall-confirm"),a=[{text:GFPDF.uninstall,click:function(){i.parents("form").submit()}},{text:GFPDF.cancel,click:function(){n.wpdialog("close")}}];this.wp_dialog(n,a,500,175),i.click(function(){return e.resizeDialogIfNeeded(n,500,175),n.wpdialog("open"),!1})},this.resizeDialogIfNeeded=function(e,i,n){var a=t(window).width(),s=t(window).height(),o=a<500?a-20:i,d=s<500?s-50:n;e.wpdialog("option","width",o),e.wpdialog("option","height",d)},this.wp_dialog=function(e,i,n,a){e.wpdialog({autoOpen:!1,resizable:!1,draggable:!1,width:n,height:a,modal:!0,dialogClass:"wp-dialog",zIndex:3e5,buttons:i,open:function(){t(this).siblings(".ui-dialog-buttonpane").find("button:eq(1)").focus(),t(".ui-widget-overlay").bind("click",function(){e.wpdialog("close")})}})},this.get_tooltip=function(e){var i=t("<a>"),n=t('<i class="fa fa-question-circle">');return i.append(n),i.addClass("gf_tooltip tooltip"),i.click(function(){return!1}),i.attr("title",e),i},this.ajax=function(e,i){t.ajax({type:"post",dataType:"json",url:GFPDF.ajaxUrl,data:e,success:i,error:this.ajax_error})},this.ajax_error=function(t,e,i){console.log(e),console.log(i)},this.show_message=function(e,i,n){i=void 0!==i?i:4500,n=void 0!==n&&n;var a=t('<div id="message">').html("<p>"+e+"</p>");!0===n?a.addClass("error"):a.addClass("updated"),t(".wrap > h2").after(a),setTimeout(function(){a.slideUp()},i)},this.updateURLParameter=function(t,e,n){var a="",s=t.split("?"),o=s[0],d=s[1],r="";if(d)for(s=d.split("&"),i=0;i<s.length;i++)s[i].split("=")[0]!=e&&(a+=r+s[i],r="&");return o+"?"+a+r+e+"="+n}}(new e).init()})}(jQuery);
|
pdf.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Gravity PDF
|
4 |
-
Version: 4.
|
5 |
Description: Automatically generate highly-customisable PDF documents using Gravity Forms.
|
6 |
Author: Gravity PDF
|
7 |
Author URI: https://gravitypdf.com
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
/*
|
18 |
This file is part of Gravity PDF
|
19 |
|
20 |
-
Gravity PDF – Copyright (C)
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
@@ -37,7 +37,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
37 |
/*
|
38 |
* Set base constants we'll use throughout the plugin
|
39 |
*/
|
40 |
-
define( 'PDF_EXTENDED_VERSION', '4.
|
41 |
define( 'PDF_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); /* plugin directory path */
|
42 |
define( 'PDF_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); /* plugin directory url */
|
43 |
define( 'PDF_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); /* the plugin basename */
|
@@ -203,7 +203,7 @@ class GFPDF_Major_Compatibility_Checks {
|
|
203 |
|
204 |
/* Gravity Forms version not compatible */
|
205 |
if ( ! class_exists( 'GFCommon' ) || ! version_compare( GFCommon::$version, $this->required_gf_version, '>=' ) ) {
|
206 |
-
$this->notices[] = sprintf( esc_html__( '%sGravity Forms%s Version %s is required. %sGet more info%s.', 'gravity-forms-pdf-extended' ), '<a href="https://
|
207 |
|
208 |
return false;
|
209 |
}
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Gravity PDF
|
4 |
+
Version: 4.4.0
|
5 |
Description: Automatically generate highly-customisable PDF documents using Gravity Forms.
|
6 |
Author: Gravity PDF
|
7 |
Author URI: https://gravitypdf.com
|
17 |
/*
|
18 |
This file is part of Gravity PDF
|
19 |
|
20 |
+
Gravity PDF – Copyright (C) 2018 Blue Liquid Designs
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
37 |
/*
|
38 |
* Set base constants we'll use throughout the plugin
|
39 |
*/
|
40 |
+
define( 'PDF_EXTENDED_VERSION', '4.4.0' ); /* the current plugin version */
|
41 |
define( 'PDF_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); /* plugin directory path */
|
42 |
define( 'PDF_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); /* plugin directory url */
|
43 |
define( 'PDF_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); /* the plugin basename */
|
203 |
|
204 |
/* Gravity Forms version not compatible */
|
205 |
if ( ! class_exists( 'GFCommon' ) || ! version_compare( GFCommon::$version, $this->required_gf_version, '>=' ) ) {
|
206 |
+
$this->notices[] = sprintf( esc_html__( '%sGravity Forms%s Version %s is required. %sGet more info%s.', 'gravity-forms-pdf-extended' ), '<a href="https://rocketgenius.pxf.io/c/1211356/445235/7938">', '</a>', $this->required_gf_version, '<a href="https://gravitypdf.com/documentation/v4/user-activation-errors/#gravityforms-version">', '</a>' );
|
207 |
|
208 |
return false;
|
209 |
}
|
src/assets/css/gfpdf-admin-styles.css
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
|
2 |
-
/**
|
3 |
-
* CSS file included on all WordPress Admin Pages
|
4 |
-
* If style is targetted directly at Gravity PDF admin pages include in gfpdf-styles.css instead
|
5 |
-
*/
|
6 |
-
|
7 |
-
|
8 |
-
@media only screen and (min-width: 600px) {
|
9 |
-
.notice.gfpdf-alert-mascot {
|
10 |
-
padding-left: 145px !important;
|
11 |
-
|
12 |
-
background-image: url(../../../src/assets/images/paws-with-logo-small.png);
|
13 |
-
background-position: 10px 50%;
|
14 |
-
background-repeat: no-repeat;
|
15 |
-
background-size: 125px;
|
16 |
-
}
|
17 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/css/gfpdf-styles.css
DELETED
@@ -1,983 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Welcome Page
|
3 |
-
*/
|
4 |
-
|
5 |
-
.about-wrap .gfpdf-badge {
|
6 |
-
margin-bottom: 1.5em;
|
7 |
-
position: relative;
|
8 |
-
width: 100%;
|
9 |
-
}
|
10 |
-
|
11 |
-
.about-wrap .feature-section:not(.under-the-hood) .col.gfpdf-breakdown {
|
12 |
-
margin-top: 0;
|
13 |
-
}
|
14 |
-
|
15 |
-
.gfpdf-badge {
|
16 |
-
background: url("../../../src/assets/images/gravitypdf-globe-black.png") no-repeat 50% 5px;
|
17 |
-
color: #333;
|
18 |
-
display: inline-block;
|
19 |
-
font-size: 14px;
|
20 |
-
font-weight: 600;
|
21 |
-
height: 40px;
|
22 |
-
margin: 5px 0 0;
|
23 |
-
padding-top: 120px;
|
24 |
-
text-align: center;
|
25 |
-
text-rendering: optimizelegibility;
|
26 |
-
}
|
27 |
-
|
28 |
-
.gfpdf-page .about-wrap [class$="col"] .col {
|
29 |
-
border-bottom: none;
|
30 |
-
}
|
31 |
-
|
32 |
-
.gfpdf-page .about-wrap .feature-section {
|
33 |
-
border-bottom: 1px solid rgba(0, 0, 0, 0.1 );
|
34 |
-
}
|
35 |
-
|
36 |
-
.gfpdf-page .about-wrap .feature-section.two-col .col {
|
37 |
-
vertical-align: middle;
|
38 |
-
}
|
39 |
-
|
40 |
-
div img.gfpdf-image {
|
41 |
-
border: 1px solid #CCC;
|
42 |
-
max-width: 98%;
|
43 |
-
|
44 |
-
-webkit-box-shadow: 1px 1px 5px 1px rgba(0,0,0,0.15);
|
45 |
-
-moz-box-shadow: 1px 1px 5px 1px rgba(0,0,0,0.15);
|
46 |
-
box-shadow: 1px 1px 5px 1px rgba(0,0,0,0.15);
|
47 |
-
|
48 |
-
}
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
/**
|
53 |
-
* General Settings Page
|
54 |
-
*/
|
55 |
-
#pdfextended-settings {
|
56 |
-
margin-top: 20px;
|
57 |
-
}
|
58 |
-
|
59 |
-
#pdfextended-settings h3,
|
60 |
-
#tab_pdf h3 {
|
61 |
-
margin-top: 5px;
|
62 |
-
line-height: 1.3em;
|
63 |
-
}
|
64 |
-
|
65 |
-
#pdfextended-settings h3 i,
|
66 |
-
#tab_pdf h3 i {
|
67 |
-
padding-right: 2px;
|
68 |
-
}
|
69 |
-
|
70 |
-
#pdfextended-settings #add-new-pdf {
|
71 |
-
padding: 4px 8px;
|
72 |
-
}
|
73 |
-
|
74 |
-
#pdfextended-settings div.notice, div.pdf-notice {
|
75 |
-
margin: 5px 15px 2px;
|
76 |
-
padding: 0 0.6em;
|
77 |
-
}
|
78 |
-
|
79 |
-
.gfpdf-page #pdfextended-settings .theme div.notice,
|
80 |
-
.gfpdf-page .theme div.notice,
|
81 |
-
.gfpdf-page #pdfextended-settings .theme-info div.notice,
|
82 |
-
.gfpdf-page .theme-info div.notice{
|
83 |
-
margin: 0;
|
84 |
-
z-index: 500;
|
85 |
-
color: #444;
|
86 |
-
padding: 1px 12px;
|
87 |
-
}
|
88 |
-
|
89 |
-
.gfpdf-page div.notice, div.pdf-notice,
|
90 |
-
.gfpdf-page div.error, div.pdf-error {
|
91 |
-
background-color: #FFFFFF;
|
92 |
-
border-left: 4px solid #7AD03A;
|
93 |
-
box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
|
94 |
-
}
|
95 |
-
|
96 |
-
.gfpdf-page div.error, div.pdf-error {
|
97 |
-
border-left-color: #dc3232;
|
98 |
-
}
|
99 |
-
|
100 |
-
.gfpdf-page div.notice, div.pdf-notice {
|
101 |
-
margin: 5px 0 15px;
|
102 |
-
padding: 1px 12px;
|
103 |
-
}
|
104 |
-
|
105 |
-
#pdfextended-settings #gfpdf-advanced-options,
|
106 |
-
#tab_pdf #gfpdf-advanced-options {
|
107 |
-
display: none;
|
108 |
-
margin-bottom: 20px;
|
109 |
-
}
|
110 |
-
|
111 |
-
.no-js #pdfextended-settings #gfpdf-advanced-options,
|
112 |
-
.no-js #tab_pdf #gfpdf-advanced-options {
|
113 |
-
display: block;
|
114 |
-
}
|
115 |
-
|
116 |
-
#pdfextended-settings .gfpdf-advanced-options,
|
117 |
-
#tab_pdf .gfpdf-advanced-options {
|
118 |
-
margin-top: -5px;
|
119 |
-
}
|
120 |
-
|
121 |
-
.no-js #pdfextended-settings .gfpdf-advanced-options,
|
122 |
-
.no-js #tab_pdf .gfpdf-advanced-options {
|
123 |
-
display: none;
|
124 |
-
}
|
125 |
-
|
126 |
-
#pdfextended-settings select.large,
|
127 |
-
#tab_pdf select.large {
|
128 |
-
width: 100%;
|
129 |
-
max-width: 350px;
|
130 |
-
}
|
131 |
-
|
132 |
-
#tab_pdf .formSubmitted input:invalid {
|
133 |
-
border: 1px solid red;
|
134 |
-
}
|
135 |
-
|
136 |
-
#tab_pdf .wp-editor-wrap {
|
137 |
-
margin: 0 12px 0 0;
|
138 |
-
}
|
139 |
-
|
140 |
-
.rtl #pdfextended-settings label, .rtl #tab_pdf label {
|
141 |
-
float: right;
|
142 |
-
margin-left: 5px;
|
143 |
-
}
|
144 |
-
|
145 |
-
/*
|
146 |
-
* License page
|
147 |
-
*/
|
148 |
-
#pdf-license .fa-exclamation-circle {
|
149 |
-
color: red;
|
150 |
-
}
|
151 |
-
|
152 |
-
#pdf-license .fa-check {
|
153 |
-
color: green;
|
154 |
-
}
|
155 |
-
|
156 |
-
/**
|
157 |
-
* Tools Settings Page
|
158 |
-
*/
|
159 |
-
|
160 |
-
#pdfextended-settings table.gfpdf_table thead th {
|
161 |
-
font-weight: bold;
|
162 |
-
}
|
163 |
-
|
164 |
-
#pdfextended-settings table.gfpdf_table tr:nth-child(2n) td,
|
165 |
-
#pdfextended-settings table.gfpdf_table tr:nth-child(2n) th {
|
166 |
-
background: none repeat scroll 0 0 #fcfcfc;
|
167 |
-
}
|
168 |
-
|
169 |
-
#pdfextended-settings p.submit {
|
170 |
-
padding-bottom: 0;
|
171 |
-
margin-bottom: 0;
|
172 |
-
}
|
173 |
-
|
174 |
-
#pdfextended-settings span.path,
|
175 |
-
#pdfextended-settings span.details.path {
|
176 |
-
padding: 2px;
|
177 |
-
background: #f2f2f2;
|
178 |
-
}
|
179 |
-
|
180 |
-
#setup-templates-confirm ul {
|
181 |
-
margin-top: 5px;
|
182 |
-
}
|
183 |
-
#setup-templates-confirm li {
|
184 |
-
list-style-type: disc;
|
185 |
-
margin-left: 20px;
|
186 |
-
}
|
187 |
-
|
188 |
-
#manage-font-files div {
|
189 |
-
margin: 10px 0;
|
190 |
-
}
|
191 |
-
|
192 |
-
#manage-font-files div.updated {
|
193 |
-
margin-top: 0;
|
194 |
-
}
|
195 |
-
|
196 |
-
#manage-font-files li {
|
197 |
-
border: 1px solid #CCC;
|
198 |
-
position: relative;
|
199 |
-
}
|
200 |
-
|
201 |
-
#manage-font-files li .delete-font {
|
202 |
-
position: absolute;
|
203 |
-
top: 0;
|
204 |
-
right: 0;
|
205 |
-
padding: 5px 10px;
|
206 |
-
}
|
207 |
-
|
208 |
-
#manage-font-files li .delete-font:hover {
|
209 |
-
background: #dc0606;
|
210 |
-
color: #FFF;
|
211 |
-
}
|
212 |
-
|
213 |
-
#manage-font-files input.invalid {
|
214 |
-
border: 1px solid red;
|
215 |
-
}
|
216 |
-
|
217 |
-
#manage-font-files .font-submit {
|
218 |
-
text-align: center;
|
219 |
-
}
|
220 |
-
|
221 |
-
#manage-font-files #font-add-list {
|
222 |
-
border: none;
|
223 |
-
text-align: center;
|
224 |
-
color: #ccc;
|
225 |
-
cursor: pointer;
|
226 |
-
}
|
227 |
-
|
228 |
-
#manage-font-files #font-empty {
|
229 |
-
font-size: 14px;
|
230 |
-
font-style: italic;
|
231 |
-
line-height: 21px;
|
232 |
-
padding: 60px 0 15px;
|
233 |
-
text-align: center;
|
234 |
-
}
|
235 |
-
|
236 |
-
#manage-font-files #font-add-list:hover {
|
237 |
-
color: #555;
|
238 |
-
}
|
239 |
-
|
240 |
-
#manage-font-files #font-add-list span {
|
241 |
-
display: block;
|
242 |
-
text-transform: uppercase;
|
243 |
-
margin-top: -5px;
|
244 |
-
}
|
245 |
-
|
246 |
-
#manage-font-files li a {
|
247 |
-
display: block;
|
248 |
-
background: #EEE;
|
249 |
-
padding: 5px 7px;
|
250 |
-
text-decoration: none;
|
251 |
-
}
|
252 |
-
|
253 |
-
#manage-font-files li a.font-name .fa {
|
254 |
-
margin-right: 5px;
|
255 |
-
}
|
256 |
-
|
257 |
-
#manage-font-files li a:hover {
|
258 |
-
background: #e9e9e9;
|
259 |
-
}
|
260 |
-
|
261 |
-
#manage-font-files .font-settings {
|
262 |
-
padding: 5px 7px;
|
263 |
-
}
|
264 |
-
|
265 |
-
#manage-font-files .gf_settings_description {
|
266 |
-
font-size: 95%;
|
267 |
-
}
|
268 |
-
|
269 |
-
#manage-font-files .font-settings > label, #manage-font-files .font-selector > label {
|
270 |
-
float: left;
|
271 |
-
width: 9em;
|
272 |
-
}
|
273 |
-
|
274 |
-
#manage-font-files .regular-text {
|
275 |
-
width: 16em;
|
276 |
-
}
|
277 |
-
|
278 |
-
#manage-font-files .css-usage {
|
279 |
-
text-align: center;
|
280 |
-
}
|
281 |
-
|
282 |
-
#manage-font-files .css-usage input {
|
283 |
-
width: 100%;
|
284 |
-
text-align: center;
|
285 |
-
}
|
286 |
-
|
287 |
-
#manage-font-files .css-usage pre {
|
288 |
-
margin: 5px 0;
|
289 |
-
background: #EEE;
|
290 |
-
padding: 7.5px;
|
291 |
-
}
|
292 |
-
|
293 |
-
.rtl #font-list .css-usage input {
|
294 |
-
direction: ltr !important;
|
295 |
-
}
|
296 |
-
|
297 |
-
/**
|
298 |
-
* Help Settings Page
|
299 |
-
*/
|
300 |
-
#pdfextended-settings .metabox-holder h3 {
|
301 |
-
font-size: 14px;
|
302 |
-
}
|
303 |
-
|
304 |
-
#pdfextended-settings .postbox-container .postbox {
|
305 |
-
margin: 0 8px 20px 0;
|
306 |
-
}
|
307 |
-
|
308 |
-
#pdfextended-settings .postbox h3.hndle {
|
309 |
-
padding-bottom: 12px;
|
310 |
-
}
|
311 |
-
|
312 |
-
#pdfextended-settings .postbox .hndle, #pdfextended-settings .widget .widget-top {
|
313 |
-
cursor: default;
|
314 |
-
}
|
315 |
-
|
316 |
-
#pdfextended-settings .postbox .handlediv,
|
317 |
-
#pdfextended-settings #pdf_support_hours h3 {
|
318 |
-
display: none;
|
319 |
-
}
|
320 |
-
|
321 |
-
#pdfextended-settings .about-wrap, #pdfextended-settings .about-wrap .about-text {
|
322 |
-
max-width: none;
|
323 |
-
min-height: 0;
|
324 |
-
line-height: 1.8em;
|
325 |
-
}
|
326 |
-
|
327 |
-
#pdfextended-settings .about-wrap h1, #pdfextended-settings .about-wrap .about-text, #pdfextended-settings .about-wrap #search-knowledgebase {
|
328 |
-
text-align: center;
|
329 |
-
margin-right: 0;
|
330 |
-
}
|
331 |
-
|
332 |
-
#pdfextended-settings .postbox .inside {
|
333 |
-
margin-bottom: 0;
|
334 |
-
}
|
335 |
-
|
336 |
-
#pdfextended-settings .about-wrap h1 {
|
337 |
-
margin-top: 40px;
|
338 |
-
}
|
339 |
-
|
340 |
-
#pdfextended-settings .about-wrap #search-knowledgebase input {
|
341 |
-
font-family: 'FontAwesome', 'Open Sans', sans-serif;
|
342 |
-
font-size: 22px;
|
343 |
-
margin: 10px 0 0;
|
344 |
-
padding: 16px 20px;
|
345 |
-
line-height: 25px;
|
346 |
-
width: 100%;
|
347 |
-
}
|
348 |
-
|
349 |
-
#pdfextended-settings #search-results {
|
350 |
-
text-align: left;
|
351 |
-
margin: 0 auto;
|
352 |
-
width: 100%;
|
353 |
-
}
|
354 |
-
|
355 |
-
#pdfextended-settings #search-results .postbox, #search-results .postbox .inside {
|
356 |
-
display: none;
|
357 |
-
}
|
358 |
-
|
359 |
-
#pdfextended-settings #search-results .postbox h3 {
|
360 |
-
margin-bottom: 0;
|
361 |
-
}
|
362 |
-
|
363 |
-
#pdfextended-settings #search-results .postbox.is-active h3 {
|
364 |
-
margin-bottom: 8px;
|
365 |
-
}
|
366 |
-
|
367 |
-
#pdfextended-settings #dashboard_primary .rss-widget .rssSummary .continue-reading {
|
368 |
-
display: none;
|
369 |
-
}
|
370 |
-
|
371 |
-
#pdfextended-settings .spinner.is-active {
|
372 |
-
visibility: visible;
|
373 |
-
margin: 0;
|
374 |
-
}
|
375 |
-
|
376 |
-
#pdfextended-settings .rss-widget ul li {
|
377 |
-
padding: 6px 0;
|
378 |
-
margin: 0;
|
379 |
-
border-bottom: 1px dotted #CCC;
|
380 |
-
}
|
381 |
-
|
382 |
-
#pdfextended-settings .rss-widget ul li a {
|
383 |
-
font-size: 16px;
|
384 |
-
}
|
385 |
-
|
386 |
-
#pdfextended-settings .rss-widget ul li:first-child,
|
387 |
-
#pdfextended-settings .rss-widget ul li:last-child {
|
388 |
-
border-bottom: none;
|
389 |
-
}
|
390 |
-
|
391 |
-
#pdfextended-settings .about-wrap .about-text-disclaimer {
|
392 |
-
font-size: 13px;
|
393 |
-
}
|
394 |
-
|
395 |
-
#pdfextended-settings .about-wrap #dashboard-widgets.columns-2 .postbox-container {
|
396 |
-
width: 100%
|
397 |
-
}
|
398 |
-
|
399 |
-
#pdfextended-settings .about-wrap #dashboard-widgets .postbox-container a {
|
400 |
-
background: #f6f6f6 none repeat scroll 0 0;
|
401 |
-
border: 3px solid #eee;
|
402 |
-
border-radius: 10px;
|
403 |
-
color: inherit;
|
404 |
-
display: block;
|
405 |
-
padding: 15px;
|
406 |
-
font-size: 16px;
|
407 |
-
text-decoration: none;
|
408 |
-
margin-bottom: 30px;
|
409 |
-
transition: all 0.5s ease 0s;
|
410 |
-
}
|
411 |
-
|
412 |
-
#pdfextended-settings .about-wrap #dashboard-widgets .postbox-container a:hover {
|
413 |
-
border: 3px solid #076aa4;
|
414 |
-
}
|
415 |
-
|
416 |
-
#pdfextended-settings .about-wrap #dashboard-widgets .postbox-container a span {
|
417 |
-
font-weight: bold;
|
418 |
-
}
|
419 |
-
|
420 |
-
#pdfextended-settings .about-wrap .center {
|
421 |
-
text-align: center;
|
422 |
-
}
|
423 |
-
|
424 |
-
#pdfextended-settings .about-wrap .button.button-large {
|
425 |
-
height: 35px;
|
426 |
-
line-height: 33px;
|
427 |
-
padding: 0 17px 9px;
|
428 |
-
}
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
/**
|
433 |
-
* System status icons
|
434 |
-
*/
|
435 |
-
#pdf-system-status .fa-check-circle, #pdf-system-status .fa-exclamation-triangle, #pdf-system-status .fa-times-circle {
|
436 |
-
font-size: 17px;
|
437 |
-
margin-left: 5px;
|
438 |
-
vertical-align: bottom;
|
439 |
-
margin-top: -2px;
|
440 |
-
}
|
441 |
-
|
442 |
-
#pdf-system-status .fa-check-circle {
|
443 |
-
color: #008000;
|
444 |
-
}
|
445 |
-
|
446 |
-
#pdf-system-status .fa-exclamation-triangle {
|
447 |
-
color: #ff8a00;
|
448 |
-
}
|
449 |
-
|
450 |
-
#pdf-system-status .fa-times-circle {
|
451 |
-
color: #d10b0b;
|
452 |
-
}
|
453 |
-
|
454 |
-
|
455 |
-
/**
|
456 |
-
* License page
|
457 |
-
*/
|
458 |
-
|
459 |
-
#pdf-system-status #license input[type="email"], #pdf-system-status #license input[type="number"], #pdf-system-status #license input[type="password"], #pdf-system-status #license input[type="search"], #pdf-system-status #license input[type="tel"], #pdf-system-status #license input[type="text"], #pdf-system-status #license input[type="url"], #pdf-system-status #license select, #pdf-system-status #license textarea {
|
460 |
-
background-color: #FFFFFF;
|
461 |
-
border: 1px solid #DDDDDD;
|
462 |
-
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.07) inset;
|
463 |
-
color: #333333;
|
464 |
-
width: 100%;
|
465 |
-
}
|
466 |
-
|
467 |
-
#pdf-system-status #license input[type="text"][readonly="readonly"] {
|
468 |
-
background: #EEE;
|
469 |
-
cursor: not-allowed;
|
470 |
-
}
|
471 |
-
|
472 |
-
#pdf-system-status #license label {
|
473 |
-
font-weight: bold;
|
474 |
-
line-height: 30px;
|
475 |
-
color: #222;
|
476 |
-
font-size: 14px;
|
477 |
-
float: left;
|
478 |
-
width: 20em;
|
479 |
-
}
|
480 |
-
|
481 |
-
#pdf-system-status #license .expires, #pdf-system-status #license .inactive, #pdf-system-status #license .limit, #pdf-system-status #license .expired, #pdf-system-status #license .deactivate {
|
482 |
-
font-style: italic;
|
483 |
-
}
|
484 |
-
|
485 |
-
#pdf-system-status #license .expired {
|
486 |
-
display: block;
|
487 |
-
color: #9e0b0f;
|
488 |
-
}
|
489 |
-
|
490 |
-
#pdf-system-status #license .gf_keystatus_invalid,
|
491 |
-
#pdf-system-status #license .gf_keystatus_valid {
|
492 |
-
font-size: 120%;
|
493 |
-
}
|
494 |
-
|
495 |
-
#pdf-system-status #license p {
|
496 |
-
clear: left;
|
497 |
-
float: left;
|
498 |
-
width: 100%;
|
499 |
-
}
|
500 |
-
|
501 |
-
#pdf-system-status #license span.container {
|
502 |
-
display: block;
|
503 |
-
}
|
504 |
-
|
505 |
-
|
506 |
-
/**
|
507 |
-
* PDF Form Settings List
|
508 |
-
*/
|
509 |
-
#gfpdf_list_form .check-column {
|
510 |
-
width: 50px;
|
511 |
-
}
|
512 |
-
|
513 |
-
#gfpdf_list_form .duplicate a:hover,
|
514 |
-
#gfpdf_list_form .delete a:hover {
|
515 |
-
cursor: pointer;
|
516 |
-
}
|
517 |
-
|
518 |
-
#gfpdf_list_form .gravitypdf_shortcode {
|
519 |
-
background: #EEE;
|
520 |
-
width: 100%;
|
521 |
-
padding: 5px;
|
522 |
-
outline: none;
|
523 |
-
}
|
524 |
-
|
525 |
-
#gfpdf_list_form .gravitypdf_shortcode:focus {
|
526 |
-
|
527 |
-
}
|
528 |
-
|
529 |
-
/**
|
530 |
-
* PDF Form Settings (individual)
|
531 |
-
*/
|
532 |
-
.gfpdf-hidden {
|
533 |
-
display: none;
|
534 |
-
}
|
535 |
-
|
536 |
-
.gfpdf_conditional_logic {
|
537 |
-
margin-top: 10px;
|
538 |
-
}
|
539 |
-
|
540 |
-
#pdf-form-settings .conditional_logic th {
|
541 |
-
padding-top: 15px;
|
542 |
-
}
|
543 |
-
|
544 |
-
#pdf-form-settings .conditional_logic td {
|
545 |
-
vertical-align: top;
|
546 |
-
}
|
547 |
-
|
548 |
-
#pdf-form-settings .gfpdf-spinner,
|
549 |
-
#pdfextended-settings .gfpdf-spinner,
|
550 |
-
.wp-dialog .gfpdf-spinner,
|
551 |
-
#gfpdf_list_form .gfpdf-spinner {
|
552 |
-
padding-left: 5px;
|
553 |
-
vertical-align: middle;
|
554 |
-
width: 20px;
|
555 |
-
}
|
556 |
-
|
557 |
-
#gfpdf_list_form .gfpdf-spinner-small {
|
558 |
-
width: 15px;
|
559 |
-
}
|
560 |
-
|
561 |
-
#gfpdf-template-example img {
|
562 |
-
width: 100%;
|
563 |
-
max-width: 300px;
|
564 |
-
border: 1px solid #CCC;
|
565 |
-
display: block;
|
566 |
-
margin-top: 5px;
|
567 |
-
}
|
568 |
-
|
569 |
-
#gfpdf-template-example p {
|
570 |
-
border: 1px solid #ccc;
|
571 |
-
display: inline-block;
|
572 |
-
max-width: 300px;
|
573 |
-
padding: 0 5px;
|
574 |
-
text-align: center;
|
575 |
-
width: 100%;
|
576 |
-
}
|
577 |
-
|
578 |
-
#gfpdf_pdf_form .gfpdf-toggle-wrapper {
|
579 |
-
padding-top: 25px;
|
580 |
-
}
|
581 |
-
|
582 |
-
#gfpdf_pdf_form .gfpdf-tab-container {
|
583 |
-
border-bottom: 1px solid #e6e6e6;
|
584 |
-
clear: both;
|
585 |
-
padding: 0 0 24px 0;
|
586 |
-
margin: 0 0 24px 0;
|
587 |
-
}
|
588 |
-
|
589 |
-
#gfpdf_pdf_form .nav-tab-wrapper {
|
590 |
-
margin-bottom: 20px;
|
591 |
-
}
|
592 |
-
|
593 |
-
.gfpdf-tab-wrapper.wp-filter {
|
594 |
-
margin: 0 0 15px;
|
595 |
-
}
|
596 |
-
|
597 |
-
.gfpdf-page .merge-tag-support {
|
598 |
-
max-width: none;
|
599 |
-
}
|
600 |
-
|
601 |
-
.gfpdf-page h4.section-title {
|
602 |
-
font-weight: bold;
|
603 |
-
margin-bottom: 0;
|
604 |
-
}
|
605 |
-
|
606 |
-
.gfpdf-page .form-table li {
|
607 |
-
list-style: inherit;
|
608 |
-
}
|
609 |
-
|
610 |
-
/**
|
611 |
-
* Entry List Page
|
612 |
-
*/
|
613 |
-
.gfpdf_form_action_has_submenu {
|
614 |
-
position: relative;
|
615 |
-
}
|
616 |
-
|
617 |
-
.gfpdf_submenu {
|
618 |
-
width: 200px;
|
619 |
-
}
|
620 |
-
|
621 |
-
.gfpdf_submenu li {
|
622 |
-
border-bottom: 1px solid #eee;
|
623 |
-
}
|
624 |
-
|
625 |
-
/**
|
626 |
-
* Gravity Forms Entry Details Page
|
627 |
-
*/
|
628 |
-
.gfpdf_detailed_pdf_container_pdf {
|
629 |
-
clear: left;
|
630 |
-
margin-bottom: 3px;
|
631 |
-
}
|
632 |
-
|
633 |
-
.gfpdf_detailed_pdf_container span {
|
634 |
-
display: block;
|
635 |
-
word-wrap: break-word;
|
636 |
-
padding: 2px 0 2px 2px;
|
637 |
-
}
|
638 |
-
|
639 |
-
/*
|
640 |
-
* Fancy Template Selector
|
641 |
-
*/
|
642 |
-
#gfpdf-template-container .theme .theme-actions {
|
643 |
-
opacity: 1;
|
644 |
-
left: inherit;
|
645 |
-
border-top: none;
|
646 |
-
-moz-box-sizing: content-box;
|
647 |
-
-webkit-box-sizing: content-box;
|
648 |
-
box-sizing: content-box;
|
649 |
-
}
|
650 |
-
|
651 |
-
#gfpdf-template-container .wp-filter-search {
|
652 |
-
margin: 0 0 5px;
|
653 |
-
font-size: 16px;
|
654 |
-
font-weight: 300;
|
655 |
-
line-height: 1.5;
|
656 |
-
|
657 |
-
width: 100%;
|
658 |
-
}
|
659 |
-
|
660 |
-
#gfpdf-template-container .theme .theme-author {
|
661 |
-
display: block;
|
662 |
-
}
|
663 |
-
|
664 |
-
#gfpdf-overlay h1 {
|
665 |
-
float: left;
|
666 |
-
padding-left: 2%;
|
667 |
-
}
|
668 |
-
|
669 |
-
#gfpdf-overlay p.no-themes {
|
670 |
-
display: block;
|
671 |
-
font-size: 18px;
|
672 |
-
}
|
673 |
-
|
674 |
-
#fancy-template-selector {
|
675 |
-
margin-left: 5px;
|
676 |
-
vertical-align: middle;
|
677 |
-
}
|
678 |
-
|
679 |
-
#gpdf-advance-template-selector button {
|
680 |
-
vertical-align: middle;
|
681 |
-
margin-left: 5px;
|
682 |
-
}
|
683 |
-
|
684 |
-
#gfpdf-template-container .theme.add-new-theme a.doing-ajax span:after,
|
685 |
-
#gfpdf-template-container .theme.add-new-theme a.doing-ajax:hover span:after{
|
686 |
-
font-family: 'FontAwesome', 'Open Sans', sans-serif;
|
687 |
-
content: '\f1ce';
|
688 |
-
font-size: 79px;
|
689 |
-
background: none;
|
690 |
-
width: auto;
|
691 |
-
height: auto;
|
692 |
-
left: 51.5%;
|
693 |
-
text-indent: 0;
|
694 |
-
-webkit-animation: fa-spin 1.5s infinite linear;
|
695 |
-
animation: fa-spin 1.5s infinite linear;
|
696 |
-
}
|
697 |
-
|
698 |
-
/*
|
699 |
-
* Dropzone
|
700 |
-
*/
|
701 |
-
.theme-browser .theme.add-new-theme.gfpdf-dropzone-active a {
|
702 |
-
background: rgb(0, 115, 170);
|
703 |
-
}
|
704 |
-
.theme-browser .theme.add-new-theme.gfpdf-dropzone-active a:after {
|
705 |
-
border-color: transparent;
|
706 |
-
}
|
707 |
-
|
708 |
-
.theme-browser .theme.add-new-theme.gfpdf-dropzone-active a span:after {
|
709 |
-
background: #FFF;
|
710 |
-
color: rgb(0, 115, 170);
|
711 |
-
}
|
712 |
-
|
713 |
-
#gfpdf-template-container .theme.add-new-theme a.doing-ajax:hover span:after,
|
714 |
-
#gfpdf-template-container .theme.add-new-theme a.doing-ajax:focus span:after,
|
715 |
-
#gfpdf-template-container .theme.add-new-theme.gfpdf-dropzone-active a.doing-ajax span:after {
|
716 |
-
color: #FFF;
|
717 |
-
background: none;
|
718 |
-
}
|
719 |
-
|
720 |
-
.theme-browser .theme.add-new-theme.gfpdf-dropzone-active .theme-name {
|
721 |
-
color: #FFF;
|
722 |
-
}
|
723 |
-
|
724 |
-
.gfpdf-dropzone-reject {
|
725 |
-
background: red;
|
726 |
-
}
|
727 |
-
|
728 |
-
.gfpdf-template-install-instructions {
|
729 |
-
font-size: 85%;
|
730 |
-
text-align: center;
|
731 |
-
margin-top: 5px;
|
732 |
-
}
|
733 |
-
|
734 |
-
/*
|
735 |
-
* Custom Template Field Style
|
736 |
-
*/
|
737 |
-
.image-radio-buttons input {
|
738 |
-
display: none;
|
739 |
-
}
|
740 |
-
|
741 |
-
.image-radio-buttons img {
|
742 |
-
padding: 6px;
|
743 |
-
}
|
744 |
-
|
745 |
-
.image-radio-buttons input:checked + img {
|
746 |
-
background: #2abbff;
|
747 |
-
}
|
748 |
-
|
749 |
-
|
750 |
-
@media only screen and (min-width: 500px) {
|
751 |
-
|
752 |
-
/**
|
753 |
-
* Responsive Welcome Page
|
754 |
-
*/
|
755 |
-
.about-wrap .gfpdf-badge {
|
756 |
-
position: absolute;
|
757 |
-
right: 0;
|
758 |
-
top: 0;
|
759 |
-
margin: 0;
|
760 |
-
width: 130px;
|
761 |
-
}
|
762 |
-
|
763 |
-
.rtl .about-wrap .gfpdf-badge {
|
764 |
-
left: 0;
|
765 |
-
right: auto;
|
766 |
-
}
|
767 |
-
}
|
768 |
-
|
769 |
-
@media only screen and (max-width: 780px) {
|
770 |
-
#pdfextended-settings table.gfpdf_table th, #pdfextended-settings table.gfpdf_table td {
|
771 |
-
display: block;
|
772 |
-
vertical-align: middle;
|
773 |
-
width: auto;
|
774 |
-
}
|
775 |
-
|
776 |
-
/* Chosen Styles */
|
777 |
-
.gfpdf-page .chosen-container {
|
778 |
-
font-size: 17px;
|
779 |
-
}
|
780 |
-
|
781 |
-
.gfpdf-page .chosen-container-single .chosen-single {
|
782 |
-
height: 38px;
|
783 |
-
line-height: 34px;
|
784 |
-
}
|
785 |
-
|
786 |
-
.gfpdf-page .chosen-container-single .chosen-single div {
|
787 |
-
top: 7px;
|
788 |
-
}
|
789 |
-
|
790 |
-
.gfpdf-page .chosen-container .chosen-results li {
|
791 |
-
line-height: 24px;
|
792 |
-
}
|
793 |
-
|
794 |
-
.gfpdf-page .chosen-container-multi .chosen-choices li.search-choice {
|
795 |
-
line-height: 24px;
|
796 |
-
}
|
797 |
-
|
798 |
-
.gfpdf-page .chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
|
799 |
-
top: 10px;
|
800 |
-
}
|
801 |
-
|
802 |
-
.gfpdf-page .chosen-container-multi .chosen-choices li.search-field input[type="text"] {
|
803 |
-
height: 38px;
|
804 |
-
}
|
805 |
-
|
806 |
-
/* Input Styles */
|
807 |
-
.gfpdf-page .form-table tbody td input[type="number"] {
|
808 |
-
font-size: 16px;
|
809 |
-
line-height: 1.5;
|
810 |
-
padding: 7px 10px;
|
811 |
-
}
|
812 |
-
|
813 |
-
.gfpdf-page .form-table tbody td label {
|
814 |
-
display: block;
|
815 |
-
font-size: 16px;
|
816 |
-
}
|
817 |
-
|
818 |
-
.gfpdf-page .form-table tbody td label:first-of-type {
|
819 |
-
margin-top: 10px;
|
820 |
-
}
|
821 |
-
|
822 |
-
.gfpdf-page .form-table th,
|
823 |
-
.gfpdf-page .form-table td,
|
824 |
-
.gfpdf-page .gfpdf_table th,
|
825 |
-
.gfpdf-page .gfpdf_table td,
|
826 |
-
.gf_delete_notice,
|
827 |
-
#manage-font-files {
|
828 |
-
font-size: 16px;
|
829 |
-
}
|
830 |
-
|
831 |
-
.gf_delete_notice,
|
832 |
-
#manage-font-files {
|
833 |
-
line-height: 21px;
|
834 |
-
}
|
835 |
-
|
836 |
-
.gfpdf-page .form-table tbody .conditional_logic td label {
|
837 |
-
display: inline;
|
838 |
-
}
|
839 |
-
|
840 |
-
.gfpdf-page .form-table tbody td input[type="number"] {
|
841 |
-
padding-right: 3px;
|
842 |
-
}
|
843 |
-
}
|
844 |
-
|
845 |
-
@media only screen and (min-width: 782px) {
|
846 |
-
|
847 |
-
/**
|
848 |
-
* Add out mascot on larger displays only
|
849 |
-
*/
|
850 |
-
.gfpdf-mascot-sitting {
|
851 |
-
background: url("../../../src/assets/images/cap-paws-sitting.png") no-repeat 0 0;
|
852 |
-
width: 181px;
|
853 |
-
height: 193px;
|
854 |
-
display: inline-block;
|
855 |
-
float: right;
|
856 |
-
margin-top: -149px;
|
857 |
-
position: relative;
|
858 |
-
z-index: 100;
|
859 |
-
}
|
860 |
-
|
861 |
-
.rtl .gfpdf-mascot-sitting {
|
862 |
-
float: left;
|
863 |
-
}
|
864 |
-
|
865 |
-
#gfpdf-mascot-container {
|
866 |
-
padding-bottom: 120px !important;
|
867 |
-
}
|
868 |
-
|
869 |
-
#pdfextended-settings table.gfpdf_table tbody th {
|
870 |
-
width: 200px;
|
871 |
-
}
|
872 |
-
|
873 |
-
#manage-font-files .gf_settings_description {
|
874 |
-
margin: 0 0 6px 9.5em;
|
875 |
-
}
|
876 |
-
|
877 |
-
#pdfextended-settings .about-wrap #dashboard-widgets.columns-2 .postbox-container {
|
878 |
-
width: 49.5%;
|
879 |
-
}
|
880 |
-
|
881 |
-
#pdfextended-settings .about-wrap #dashboard-widgets .postbox-container a {
|
882 |
-
margin-right: 30px;
|
883 |
-
min-height: 245px;
|
884 |
-
}
|
885 |
-
|
886 |
-
#pdfextended-settings #pdf-system-status th {
|
887 |
-
padding-top: 12px;
|
888 |
-
padding-bottom: 12px;
|
889 |
-
}
|
890 |
-
|
891 |
-
#pdfextended-settings #pdf-system-status td {
|
892 |
-
padding-top: 10px;
|
893 |
-
padding-bottom: 10px;
|
894 |
-
}
|
895 |
-
|
896 |
-
/* Chosen Styles */
|
897 |
-
.gfpdf-page .chosen-container {
|
898 |
-
max-width: 300px;
|
899 |
-
}
|
900 |
-
|
901 |
-
/* Conditional Logic */
|
902 |
-
#gfpdf_conditional_logic_container .gf_conditional_logic_rules_container :first-child {
|
903 |
-
max-width: 250px;
|
904 |
-
width: 100%;
|
905 |
-
}
|
906 |
-
}
|
907 |
-
|
908 |
-
@media only screen and (min-width: 900px) {
|
909 |
-
|
910 |
-
/**
|
911 |
-
* Help and Support
|
912 |
-
*/
|
913 |
-
#pdfextended-settings .help-container .postbox {
|
914 |
-
width: 32.66%;
|
915 |
-
float: left;
|
916 |
-
margin-left: 0.5%;
|
917 |
-
margin-right: 0.5%;
|
918 |
-
min-width: 0;
|
919 |
-
}
|
920 |
-
|
921 |
-
#pdfextended-settings .help-container .postbox:first-child {
|
922 |
-
margin-left: 0;
|
923 |
-
}
|
924 |
-
|
925 |
-
#pdfextended-settings .help-container .postbox:last-child {
|
926 |
-
margin-right: 0;
|
927 |
-
}
|
928 |
-
}
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
/* Add media queries */
|
933 |
-
@media only screen and (min-width: 1000px) {
|
934 |
-
|
935 |
-
/**
|
936 |
-
* License page
|
937 |
-
*/
|
938 |
-
#pdf-system-status #license label {
|
939 |
-
float: left;
|
940 |
-
width: 20%;
|
941 |
-
}
|
942 |
-
|
943 |
-
#pdf-system-status #license span.container {
|
944 |
-
float: left;
|
945 |
-
width: 80%;
|
946 |
-
}
|
947 |
-
|
948 |
-
#pdfextended-settings .about-wrap #dashboard-widgets .postbox-container a {
|
949 |
-
min-height: 180px;
|
950 |
-
}
|
951 |
-
}
|
952 |
-
|
953 |
-
@media only screen and (max-width: 1120px) {
|
954 |
-
#gfpdf-template-container .theme:nth-child(odd) {
|
955 |
-
margin-right: 2%;
|
956 |
-
}
|
957 |
-
}
|
958 |
-
|
959 |
-
|
960 |
-
@media only screen and (min-width: 1400px) {
|
961 |
-
/**
|
962 |
-
* Help and Support
|
963 |
-
*/
|
964 |
-
|
965 |
-
#pdfextended-settings .about-wrap #search-knowledgebase input,
|
966 |
-
#pdfextended-settings #search-results, #pdfextended-settings .help-container{
|
967 |
-
width: 75%;
|
968 |
-
}
|
969 |
-
|
970 |
-
#pdfextended-settings .about-wrap #dashboard-widgets .postbox-container a {
|
971 |
-
min-height: 90px;
|
972 |
-
}
|
973 |
-
}
|
974 |
-
|
975 |
-
@media only screen and (min-width: 1640px) {
|
976 |
-
#gfpdf-template-container .theme {
|
977 |
-
margin: 0 2% 2% 0;
|
978 |
-
}
|
979 |
-
|
980 |
-
#gfpdf-template-container .wp-filter-search {
|
981 |
-
width: 22.7%;
|
982 |
-
}
|
983 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/images/gravitypdf-globe-white.png
DELETED
Binary file
|
src/assets/images/updating-advanced-template-selector.png
DELETED
Binary file
|
src/assets/images/updating-four-columns.png
DELETED
Binary file
|
src/assets/images/updating-merge-tags.png
DELETED
Binary file
|
src/assets/js/gfpdf-backbone.js
DELETED
@@ -1,1113 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Gravity PDF Settings JS Logic
|
3 |
-
* Dependancies: backbone, underscore, jquery
|
4 |
-
* @since 4.0
|
5 |
-
*/
|
6 |
-
|
7 |
-
(function($) {
|
8 |
-
|
9 |
-
$(function() {
|
10 |
-
|
11 |
-
/**
|
12 |
-
* To prevent problems with PHP's ASP Short tags (removed in PHP 7) we'll change Underscore's delimiters to be Handlebars-ish:
|
13 |
-
* {{= }}, {{- }} or {{ }}
|
14 |
-
*
|
15 |
-
* @see https://github.com/GravityPDF/gravity-pdf/issues/417
|
16 |
-
* @type {{interpolate: RegExp, evaluate: RegExp, escape: RegExp}}
|
17 |
-
* @since 4.0.1
|
18 |
-
*/
|
19 |
-
var UnderscoreSettingsOverride = {
|
20 |
-
evaluate: /\{\{(.+?)\}\}/gim,
|
21 |
-
interpolate: /\{\{=(.+?)\}\}/gim,
|
22 |
-
escape: /\{\{-(.+?)\}\}/gim
|
23 |
-
};
|
24 |
-
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Handles our Font CRUD Feature
|
28 |
-
* Allows URLs to TTF font files to be passed
|
29 |
-
* to a specific custom font 'group' defined by the user.
|
30 |
-
*
|
31 |
-
* Backbone model's save and destroy methods have been overridden
|
32 |
-
* to work with WordPress' ajax-admin.php file endpoint.
|
33 |
-
*
|
34 |
-
* @since 4.0
|
35 |
-
*/
|
36 |
-
var Fonts = {
|
37 |
-
Model: {},
|
38 |
-
Collection: {},
|
39 |
-
View: {},
|
40 |
-
Misc: {},
|
41 |
-
};
|
42 |
-
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Our Font Backbone Model which handles validation, saving and deleting
|
46 |
-
* @since 4.0
|
47 |
-
*/
|
48 |
-
Fonts.Model.Core = Backbone.Model.extend({
|
49 |
-
/**
|
50 |
-
* Set our default model parameters
|
51 |
-
* Existing models pulled from the database also have an ID parameter
|
52 |
-
* @type {Object}
|
53 |
-
* @since 4.0
|
54 |
-
*/
|
55 |
-
defaults: {
|
56 |
-
font_name: '',
|
57 |
-
regular: '',
|
58 |
-
bold: '',
|
59 |
-
italics: '',
|
60 |
-
bolditalics: '',
|
61 |
-
disabled: false,
|
62 |
-
},
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Set our custom endpoint to be used to sync the model
|
66 |
-
* @type String
|
67 |
-
* @since 4.0
|
68 |
-
*/
|
69 |
-
url: GFPDF.ajaxUrl,
|
70 |
-
|
71 |
-
/**
|
72 |
-
* Route save through ajax-admin.php which doesn't support standard
|
73 |
-
* REST API features. Emulate POST and JSON data structures.
|
74 |
-
* @param Object options
|
75 |
-
* @param Object additional configuration options
|
76 |
-
* @return Object
|
77 |
-
* @since 4.0
|
78 |
-
*/
|
79 |
-
save: function(options, config) {
|
80 |
-
|
81 |
-
var params = {
|
82 |
-
emulateHTTP: true,
|
83 |
-
emulateJSON: true,
|
84 |
-
data: {
|
85 |
-
action: 'gfpdf_font_save',
|
86 |
-
nonce: options.nonce,
|
87 |
-
payload : this.toJSON()
|
88 |
-
}
|
89 |
-
};
|
90 |
-
|
91 |
-
/* Merge out two objects together */
|
92 |
-
$.extend(params, config);
|
93 |
-
|
94 |
-
return Backbone.sync( 'update', this, params );
|
95 |
-
},
|
96 |
-
|
97 |
-
/**
|
98 |
-
* Route delete through ajax-admin.php which doesn't support standard
|
99 |
-
* REST API features. Emulate POST and JSON data structures.
|
100 |
-
* @param Object options
|
101 |
-
* @param Object additional configuration options
|
102 |
-
* @return Object
|
103 |
-
* @since 4.0
|
104 |
-
*/
|
105 |
-
destroy: function(options, config) {
|
106 |
-
|
107 |
-
var params = {
|
108 |
-
emulateHTTP: true,
|
109 |
-
emulateJSON: true,
|
110 |
-
data: {
|
111 |
-
action: 'gfpdf_font_delete',
|
112 |
-
nonce: options.nonce,
|
113 |
-
id : this.get('id'),
|
114 |
-
}
|
115 |
-
};
|
116 |
-
|
117 |
-
/* Merge out two objects together */
|
118 |
-
$.extend(params, config);
|
119 |
-
|
120 |
-
return Backbone.sync( 'update', this, params );
|
121 |
-
},
|
122 |
-
|
123 |
-
/**
|
124 |
-
* Create custom validation method which will prevent a model being updated
|
125 |
-
* when using .save() or .set() if the validation fails.
|
126 |
-
*
|
127 |
-
* Multiple custom events are also triggered to allow our view to update the DOM as needed
|
128 |
-
* @param Object attrs The new model data
|
129 |
-
* @param Object options
|
130 |
-
* @return String On error, a string is returned
|
131 |
-
* @since 4.0
|
132 |
-
*/
|
133 |
-
validate: function(attrs, options) {
|
134 |
-
|
135 |
-
/* Do name validation */
|
136 |
-
var regex = new RegExp('^[A-Za-z0-9 ]+$');
|
137 |
-
|
138 |
-
if( attrs.font_name.length > 0) {
|
139 |
-
if(! regex.test(attrs.font_name) ) {
|
140 |
-
|
141 |
-
/* If not successful trigger error */
|
142 |
-
return 'invalid_characters';
|
143 |
-
} else {
|
144 |
-
|
145 |
-
/* trigger successful event to disable the view error */
|
146 |
-
this.trigger('valid_name');
|
147 |
-
}
|
148 |
-
}
|
149 |
-
|
150 |
-
/**
|
151 |
-
* Validate the selected fonts
|
152 |
-
*/
|
153 |
-
if(this.validateFonts(attrs) === false) {
|
154 |
-
return 'invalid_font';
|
155 |
-
}
|
156 |
-
|
157 |
-
this.trigger('validation_passed', this);
|
158 |
-
},
|
159 |
-
|
160 |
-
/**
|
161 |
-
* Check if font value (regular, bold, italics, bolditalics)
|
162 |
-
* has a value at all, and if so whether it has a .ttf extension.
|
163 |
-
*
|
164 |
-
* Multiple custom events are also triggered to allow our view to update a particular
|
165 |
-
* DOM element based on the validation success or failure.
|
166 |
-
*
|
167 |
-
* @param Object attrs The new model data
|
168 |
-
* @return Boolean Whether the group validation passed or failed
|
169 |
-
* @since 4.0
|
170 |
-
*/
|
171 |
-
validateFonts: function(attrs) {
|
172 |
-
|
173 |
-
/* set validation to true and any that fail will mark as false */
|
174 |
-
var validation = true;
|
175 |
-
|
176 |
-
/* set up an object with our key-value pairs refering to the input data */
|
177 |
-
var fonts = {
|
178 |
-
regular: attrs.regular,
|
179 |
-
bold: attrs.bold,
|
180 |
-
italics: attrs.italics,
|
181 |
-
bolditalics: attrs.bolditalics,
|
182 |
-
};
|
183 |
-
|
184 |
-
/* Loop through the object and use jQuery's proxy to correct the 'this' scope */
|
185 |
-
$.each( fonts, $.proxy(function( index, font ) {
|
186 |
-
|
187 |
-
/* if there is value for the font we'll validate it */
|
188 |
-
if(font.length > 0 && this.isValidFile(font) === false) {
|
189 |
-
|
190 |
-
/* mark our global validation as false */
|
191 |
-
validation = false;
|
192 |
-
this.trigger('invalid_font', this, true, index); /* tell our view the font is invalid */
|
193 |
-
} else {
|
194 |
-
this.trigger('valid_font', this, false, index); /* tell our view the font is valid */
|
195 |
-
}
|
196 |
-
|
197 |
-
}, this));
|
198 |
-
|
199 |
-
return validation;
|
200 |
-
},
|
201 |
-
|
202 |
-
/**
|
203 |
-
* Does our actual font validation
|
204 |
-
* Checks if the string length is large enough to be considered valid,
|
205 |
-
* and then checks if it has a file extension of .ttf
|
206 |
-
* @param String font The font string to check
|
207 |
-
* @return Boolean True on success, false on failure
|
208 |
-
* @since 4.0
|
209 |
-
*/
|
210 |
-
isValidFile: function(font) {
|
211 |
-
|
212 |
-
/* Check if the value could contain enough characters to be valid */
|
213 |
-
if(font.length < 5) {
|
214 |
-
return false;
|
215 |
-
}
|
216 |
-
|
217 |
-
/* Get the last 4 characters and convert to lower case */
|
218 |
-
var extension = font.substr(font.length - 4).toLowerCase();
|
219 |
-
|
220 |
-
/* Check if they match a TTF font file */
|
221 |
-
if(extension === '.ttf') {
|
222 |
-
|
223 |
-
/* Check if we have a valid URL */
|
224 |
-
var regex = new RegExp(/^[a-z](?:[-a-z0-9\+\.])*:(?:\/\/(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\._~!\$&'\(\)\*\+,;=:\xA0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[\uD800-\uD83E\uD840-\uD87E\uD880-\uD8BE\uD8C0-\uD8FE\uD900-\uD93E\uD940-\uD97E\uD980-\uD9BE\uD9C0-\uD9FE\uDA00-\uDA3E\uDA40-\uDA7E\uDA80-\uDABE\uDAC0-\uDAFE\uDB00-\uDB3E\uDB44-\uDB7E][\uDC00-\uDFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F][\uDC00-\uDFFD])*@)?(?:\[(?:(?:(?:[0-9a-f]{1,4}:){6}(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3})|::(?:[0-9a-f]{1,4}:){5}(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3})|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3})|(?:[0-9a-f]{1,4}:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3})|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3})|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3})|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3})|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|v[0-9a-f]+[-a-z0-9\._~!\$&'\(\)\*\+,;=:]+)\]|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}|(?:%[0-9a-f][0-9a-f]|[-a-z0-9\._~!\$&'\(\)\*\+,;=@\xA0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[\uD800-\uD83E\uD840-\uD87E\uD880-\uD8BE\uD8C0-\uD8FE\uD900-\uD93E\uD940-\uD97E\uD980-\uD9BE\uD9C0-\uD9FE\uDA00-\uDA3E\uDA40-\uDA7E\uDA80-\uDABE\uDAC0-\uDAFE\uDB00-\uDB3E\uDB44-\uDB7E][\uDC00-\uDFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F][\uDC00-\uDFFD])*)(?::[0-9]*)?(?:\/(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\._~!\$&'\(\)\*\+,;=:@\xA0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[\uD800-\uD83E\uD840-\uD87E\uD880-\uD8BE\uD8C0-\uD8FE\uD900-\uD93E\uD940-\uD97E\uD980-\uD9BE\uD9C0-\uD9FE\uDA00-\uDA3E\uDA40-\uDA7E\uDA80-\uDABE\uDAC0-\uDAFE\uDB00-\uDB3E\uDB44-\uDB7E][\uDC00-\uDFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F][\uDC00-\uDFFD]))*)*|\/(?:(?:(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\._~!\$&'\(\)\*\+,;=:@\xA0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[\uD800-\uD83E\uD840-\uD87E\uD880-\uD8BE\uD8C0-\uD8FE\uD900-\uD93E\uD940-\uD97E\uD980-\uD9BE\uD9C0-\uD9FE\uDA00-\uDA3E\uDA40-\uDA7E\uDA80-\uDABE\uDAC0-\uDAFE\uDB00-\uDB3E\uDB44-\uDB7E][\uDC00-\uDFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F][\uDC00-\uDFFD]))+)(?:\/(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\._~!\$&'\(\)\*\+,;=:@\xA0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[\uD800-\uD83E\uD840-\uD87E\uD880-\uD8BE\uD8C0-\uD8FE\uD900-\uD93E\uD940-\uD97E\uD980-\uD9BE\uD9C0-\uD9FE\uDA00-\uDA3E\uDA40-\uDA7E\uDA80-\uDABE\uDAC0-\uDAFE\uDB00-\uDB3E\uDB44-\uDB7E][\uDC00-\uDFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F][\uDC00-\uDFFD]))*)*)?|(?:(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\._~!\$&'\(\)\*\+,;=:@\xA0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[\uD800-\uD83E\uD840-\uD87E\uD880-\uD8BE\uD8C0-\uD8FE\uD900-\uD93E\uD940-\uD97E\uD980-\uD9BE\uD9C0-\uD9FE\uDA00-\uDA3E\uDA40-\uDA7E\uDA80-\uDABE\uDAC0-\uDAFE\uDB00-\uDB3E\uDB44-\uDB7E][\uDC00-\uDFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F][\uDC00-\uDFFD]))+)(?:\/(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\._~!\$&'\(\)\*\+,;=:@\xA0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[\uD800-\uD83E\uD840-\uD87E\uD880-\uD8BE\uD8C0-\uD8FE\uD900-\uD93E\uD940-\uD97E\uD980-\uD9BE\uD9C0-\uD9FE\uDA00-\uDA3E\uDA40-\uDA7E\uDA80-\uDABE\uDAC0-\uDAFE\uDB00-\uDB3E\uDB44-\uDB7E][\uDC00-\uDFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F][\uDC00-\uDFFD]))*)*|(?!(?:%[0-9a-f][0-9a-f]|[-a-z0-9\._~!\$&'\(\)\*\+,;=:@\xA0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[\uD800-\uD83E\uD840-\uD87E\uD880-\uD8BE\uD8C0-\uD8FE\uD900-\uD93E\uD940-\uD97E\uD980-\uD9BE\uD9C0-\uD9FE\uDA00-\uDA3E\uDA40-\uDA7E\uDA80-\uDABE\uDAC0-\uDAFE\uDB00-\uDB3E\uDB44-\uDB7E][\uDC00-\uDFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F][\uDC00-\uDFFD])))(?:\?(?:%[0-9a-f][0-9a-f]|[-a-z0-9\._~!\$&'\(\)\*\+,;=:@\/\?\xA0-\uD7FF\uE000-\uFDCF\uFDF0-\uFFEF]|[\uD800-\uD83E\uD840-\uD87E\uD880-\uD8BE\uD8C0-\uD8FE\uD900-\uD93E\uD940-\uD97E\uD980-\uD9BE\uD9C0-\uD9FE\uDA00-\uDA3E\uDA40-\uDA7E\uDA80-\uDABE\uDAC0-\uDAFE\uDB00-\uDB3E\uDB44-\uDB7E\uDB80-\uDBBE\uDBC0-\uDBFE][\uDC00-\uDFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDC00-\uDFFD])*)?(?:\#(?:%[0-9a-f][0-9a-f]|[-a-z0-9\._~!\$&'\(\)\*\+,;=:@\/\?\xA0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[\uD800-\uD83E\uD840-\uD87E\uD880-\uD8BE\uD8C0-\uD8FE\uD900-\uD93E\uD940-\uD97E\uD980-\uD9BE\uD9C0-\uD9FE\uDA00-\uDA3E\uDA40-\uDA7E\uDA80-\uDABE\uDAC0-\uDAFE\uDB00-\uDB3E\uDB44-\uDB7E][\uDC00-\uDFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F][\uDC00-\uDFFD])*)?$/igm);
|
225 |
-
|
226 |
-
if(regex.test(font) ) {
|
227 |
-
return true;
|
228 |
-
}
|
229 |
-
}
|
230 |
-
|
231 |
-
return false;
|
232 |
-
},
|
233 |
-
|
234 |
-
/**
|
235 |
-
* Our ModelBinder CSS Declaration Converter
|
236 |
-
* @param String direction Either ModelToView or ViewToModel
|
237 |
-
* @param String value The value to convert
|
238 |
-
* @param String target The DOM target name
|
239 |
-
* @param Object model The Model
|
240 |
-
* @return String
|
241 |
-
* @since 4.0
|
242 |
-
*/
|
243 |
-
cssDeclaration: function(direction, value, target, model) {
|
244 |
-
var shortname = model.getShortname(value);
|
245 |
-
return 'font-family: "' + value + '", ' + shortname + ', sans-serif;';
|
246 |
-
},
|
247 |
-
|
248 |
-
/**
|
249 |
-
* Converts a standard name to the format used in mPDF
|
250 |
-
* @param String name The name to convert
|
251 |
-
* @return String
|
252 |
-
* @since 4.0
|
253 |
-
*/
|
254 |
-
getShortname: function(name) {
|
255 |
-
name = name.toLowerCase();
|
256 |
-
name = name.replace(' ', '');
|
257 |
-
|
258 |
-
return name;
|
259 |
-
}
|
260 |
-
});
|
261 |
-
|
262 |
-
|
263 |
-
/**
|
264 |
-
* Creates a Backbone collection with our model attached
|
265 |
-
* @type Object
|
266 |
-
* @since 4.0
|
267 |
-
*/
|
268 |
-
Fonts.Collection.Core = Backbone.Collection.extend({
|
269 |
-
model: Fonts.Model.Core
|
270 |
-
});
|
271 |
-
|
272 |
-
|
273 |
-
/**
|
274 |
-
* Our top-level view for rendering our font list.
|
275 |
-
* This view is responsible for looping through the Backbone collection,
|
276 |
-
* creating a new Fonts.View.Item object and appending it to our container
|
277 |
-
*
|
278 |
-
* We also have a listenTo() event which triggers the rendering process when a new
|
279 |
-
* model is added to our collection.
|
280 |
-
*
|
281 |
-
* @since 4.0
|
282 |
-
*/
|
283 |
-
Fonts.View.Container = Backbone.View.extend({
|
284 |
-
|
285 |
-
/**
|
286 |
-
* Our View Target Element
|
287 |
-
* @type String
|
288 |
-
* @since 4.0
|
289 |
-
*/
|
290 |
-
el: '#font-list',
|
291 |
-
|
292 |
-
/**
|
293 |
-
* Our View wrapper tag
|
294 |
-
* @type String
|
295 |
-
* @since 4.0
|
296 |
-
*/
|
297 |
-
tagName: 'ul',
|
298 |
-
|
299 |
-
/**
|
300 |
-
* Automatically render our view upon initialization and add
|
301 |
-
* an event listener so new Font.View.Item objects can be automatically
|
302 |
-
* appended to our container (without re-rendering all the objects)
|
303 |
-
*
|
304 |
-
* @param Object options Any passed in parameters when the object is created
|
305 |
-
* @since 4.0
|
306 |
-
*/
|
307 |
-
initialize: function(options) {
|
308 |
-
|
309 |
-
this.listenTo(this.collection, 'add', this.addRender);
|
310 |
-
this.listenTo(this.collection, 'remove', this.render);
|
311 |
-
this.render();
|
312 |
-
},
|
313 |
-
|
314 |
-
/**
|
315 |
-
* Handles the DOM display process
|
316 |
-
* @return Object Returns reference to itself (for chaining purposes)
|
317 |
-
* @since 4.0
|
318 |
-
*/
|
319 |
-
render: function() {
|
320 |
-
|
321 |
-
/* Check if our collection has any models */
|
322 |
-
if(this.collection.length > 0) {
|
323 |
-
|
324 |
-
/* Empty our element */
|
325 |
-
this.$el.empty();
|
326 |
-
|
327 |
-
/* Loop through our collection and render to our container */
|
328 |
-
this.collection.each(function(font) {
|
329 |
-
this.addRender(font);
|
330 |
-
}, this);
|
331 |
-
} else {
|
332 |
-
/* Display getting started message to user */
|
333 |
-
this.$el.html(_.template($( '#GravityPDFFontsEmpty' ).html(), null, UnderscoreSettingsOverride));
|
334 |
-
}
|
335 |
-
|
336 |
-
/* Return for chaining purposes */
|
337 |
-
return this;
|
338 |
-
},
|
339 |
-
|
340 |
-
/**
|
341 |
-
* Creates our individual Item View and append to the container
|
342 |
-
* @param Object font The individual collection model
|
343 |
-
* @since 4.0
|
344 |
-
*/
|
345 |
-
addRender: function(font) {
|
346 |
-
|
347 |
-
/* Empty our container if no models exist (as we display a welcome message if list is empty) */
|
348 |
-
if(this.collection.length === 1) {
|
349 |
-
this.$el.empty();
|
350 |
-
}
|
351 |
-
|
352 |
-
/* Create an individual font view */
|
353 |
-
var item = new Fonts.View.Item({
|
354 |
-
model: font,
|
355 |
-
collection: this.collection
|
356 |
-
});
|
357 |
-
|
358 |
-
/* Append it to our container */
|
359 |
-
this.$el.append(item.render().el);
|
360 |
-
|
361 |
-
/* Return for chaining purposes */
|
362 |
-
return this;
|
363 |
-
}
|
364 |
-
});
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
/**
|
369 |
-
* Handles the individual display of our font model
|
370 |
-
*
|
371 |
-
* Multiple DOM events are used to process form interactions, such as toggling the interface, deleting a model and savings.
|
372 |
-
* Multiple custom event listeners are used to display validation errors in our form.
|
373 |
-
*
|
374 |
-
* The Backbone.ModelBinder() object is used to add two-way data binding between our model and view
|
375 |
-
*
|
376 |
-
* @since 4.0
|
377 |
-
*/
|
378 |
-
Fonts.View.Item = Backbone.View.extend({
|
379 |
-
|
380 |
-
/**
|
381 |
-
* The ID of our Underscore HTML template
|
382 |
-
* This can be found in /src/view/html/Settings/tools.php
|
383 |
-
* @type String
|
384 |
-
* @since 4.0
|
385 |
-
*/
|
386 |
-
template: '#GravityPDFFonts',
|
387 |
-
|
388 |
-
/**
|
389 |
-
* Our View wrapper tag
|
390 |
-
* @type String
|
391 |
-
* @since 4.0
|
392 |
-
*/
|
393 |
-
tagName: 'li',
|
394 |
-
|
395 |
-
/**
|
396 |
-
* Our DOM Events
|
397 |
-
* @type Object
|
398 |
-
* @since 4.0
|
399 |
-
*/
|
400 |
-
events: {
|
401 |
-
|
402 |
-
/* Click event for toggling our form interface for editing */
|
403 |
-
'click .font-name' : 'toggleView',
|
404 |
-
|
405 |
-
/* Click event to delete a model */
|
406 |
-
'click .delete-font': 'deleteModel',
|
407 |
-
|
408 |
-
/* Submit event for saving a model */
|
409 |
-
'submit form': 'formSubmission',
|
410 |
-
},
|
411 |
-
|
412 |
-
/**
|
413 |
-
* Initialize our model-view data binder object and set up
|
414 |
-
* our event listeners for displaying visual validation queues to the user
|
415 |
-
* @since 4.0
|
416 |
-
*/
|
417 |
-
initialize: function() {
|
418 |
-
|
419 |
-
/* Intialize our two-way data binder */
|
420 |
-
this.modelBinder = new Backbone.ModelBinder();
|
421 |
-
|
422 |
-
/* Show Name Validation Errors */
|
423 |
-
this.listenTo(this.model, 'invalid valid_name', this.nameError);
|
424 |
-
|
425 |
-
/* Show Font Group Validation Errors */
|
426 |
-
this.listenTo(this.model, 'invalid_font valid_font', this.fontError);
|
427 |
-
|
428 |
-
/* Enable / Disable the Submit button based on validation errors */
|
429 |
-
this.listenTo(this.model, 'invalid', this.disableSubmitButton);
|
430 |
-
this.listenTo(this.model, 'validation_passed', this.enableSubmitButton);
|
431 |
-
},
|
432 |
-
|
433 |
-
/**
|
434 |
-
* Render the individual view based on an Underscore template
|
435 |
-
* @return Object Return 'this' for chaining
|
436 |
-
* @since 4.0
|
437 |
-
*/
|
438 |
-
render: function() {
|
439 |
-
|
440 |
-
/* Set up our Underscore template file */
|
441 |
-
this.template = _.template($( this.template ).html(), null, UnderscoreSettingsOverride);
|
442 |
-
|
443 |
-
/* Set View Element HTML to our Underscore template, passing in our model */
|
444 |
-
this.$el.html(this.template({
|
445 |
-
model: this.model,
|
446 |
-
}));
|
447 |
-
|
448 |
-
/**
|
449 |
-
* Enable two-way data binding between our model and view
|
450 |
-
*
|
451 |
-
* By default updates are only triggered on change events but our name field
|
452 |
-
* should also trigger on keyUp.
|
453 |
-
*
|
454 |
-
* We also want to run our validation routine on the this.model.set() command (by default this is disabled)
|
455 |
-
* so the user isn't confused with the live-update display of the Font Name field.
|
456 |
-
*/
|
457 |
-
this.modelBinder.bind(this.model, this.el, {
|
458 |
-
font_name: [ { selector: '[name=font_name]' } , {selector: '[name=usage]', converter: this.model.cssDeclaration } ],
|
459 |
-
regular: '[name=regular]',
|
460 |
-
bold: '[name=bold]',
|
461 |
-
italics: '[name=italics]',
|
462 |
-
bolditalics: '[name=bolditalics]',
|
463 |
-
},
|
464 |
-
|
465 |
-
{
|
466 |
-
|
467 |
-
changeTriggers: {
|
468 |
-
'': 'change',
|
469 |
-
'.font-name-field': 'keyup'
|
470 |
-
},
|
471 |
-
|
472 |
-
modelSetOptions: {
|
473 |
-
validate: true
|
474 |
-
}
|
475 |
-
});
|
476 |
-
|
477 |
-
/* Return for chaining purposes */
|
478 |
-
return this;
|
479 |
-
},
|
480 |
-
|
481 |
-
/**
|
482 |
-
* Show / Hide the Font Manager (Editor)
|
483 |
-
* @param Object ev The Backbone event object
|
484 |
-
* @since 4.0
|
485 |
-
*/
|
486 |
-
toggleView: function(ev) {
|
487 |
-
|
488 |
-
/* Prevent default anchor action */
|
489 |
-
ev.preventDefault();
|
490 |
-
|
491 |
-
/* Toggle our Font Manager Container */
|
492 |
-
$(ev.currentTarget).next().toggle();
|
493 |
-
|
494 |
-
},
|
495 |
-
|
496 |
-
/**
|
497 |
-
* Highlight field with red border when error is detected
|
498 |
-
* @param Object model The model currently being modified
|
499 |
-
* @param String error The name of the error triggered
|
500 |
-
* @since 4.0
|
501 |
-
*/
|
502 |
-
nameError: function(model, error) {
|
503 |
-
|
504 |
-
if(error && error == 'invalid_characters') {
|
505 |
-
|
506 |
-
/* highlight errors */
|
507 |
-
this.$el.find('input[name="font_name"]').css('border-color', 'red');
|
508 |
-
} else {
|
509 |
-
|
510 |
-
/* un-highlight errors */
|
511 |
-
this.$el.find('input[name="font_name"]').removeAttr('style');
|
512 |
-
}
|
513 |
-
},
|
514 |
-
|
515 |
-
/**
|
516 |
-
* Highlight / Un-highlight Font Field that failed validation
|
517 |
-
* @param Object model The model currently being modified
|
518 |
-
* @param String error The name of the error triggered
|
519 |
-
* @param {[type]} name The name of the field which failed validation
|
520 |
-
* @since 4.0
|
521 |
-
*/
|
522 |
-
fontError: function(model, error, name) {
|
523 |
-
|
524 |
-
/* Get the input that failed validation */
|
525 |
-
$input = this.$el.find('input[name="' + name + '"]');
|
526 |
-
|
527 |
-
/* If error is triggered display message to user */
|
528 |
-
if(error) {
|
529 |
-
|
530 |
-
/* Set up an error message */
|
531 |
-
$error = $('<span class="gf_settings_description"><label>Only TTF font files are supported.</label></span>');
|
532 |
-
|
533 |
-
/* Tell user about error */
|
534 |
-
if(! $input.hasClass('invalid')) {
|
535 |
-
$input.addClass('invalid').next().after($error.clone());
|
536 |
-
}
|
537 |
-
} else {
|
538 |
-
|
539 |
-
/* Remove validation error */
|
540 |
-
if($input.hasClass('invalid')) {
|
541 |
-
$input.removeClass('invalid').next().next().remove();
|
542 |
-
}
|
543 |
-
}
|
544 |
-
},
|
545 |
-
|
546 |
-
/**
|
547 |
-
* Disable the form submit button due to validation failure and mark is
|
548 |
-
* as currently disabled to prevent any funny business
|
549 |
-
* @param Object model An instance of Fonts.Model.Core()
|
550 |
-
* @since 4.0
|
551 |
-
*/
|
552 |
-
disableSubmitButton: function(model) {
|
553 |
-
|
554 |
-
this.$el.find('.font-submit button').prop('disabled', true);
|
555 |
-
model.set('disabled', true);
|
556 |
-
},
|
557 |
-
|
558 |
-
/**
|
559 |
-
* Enable the form submit button due to validation passing and mark is
|
560 |
-
* as currently enabled. Users can now save the model.
|
561 |
-
* @param Object model An instance of Fonts.Model.Core()
|
562 |
-
* @since 4.0
|
563 |
-
*/
|
564 |
-
enableSubmitButton: function(model) {
|
565 |
-
|
566 |
-
this.$el.find('.font-submit button').prop('disabled', false);
|
567 |
-
model.set('disabled', false);
|
568 |
-
},
|
569 |
-
|
570 |
-
/**
|
571 |
-
* Save model after checking browser's native validation API passes and that model isn't enabled.
|
572 |
-
* @param Object ev The Backbone event object
|
573 |
-
* @since 4.0
|
574 |
-
*/
|
575 |
-
formSubmission: function(ev) {
|
576 |
-
|
577 |
-
/* Allow native validation without submitting actual form to backend */
|
578 |
-
ev.preventDefault();
|
579 |
-
|
580 |
-
var $form = $(ev.currentTarget);
|
581 |
-
|
582 |
-
/* Check if the native form validation is a success */
|
583 |
-
if(ev.currentTarget.checkValidity() && this.model.get('disabled') === false) {
|
584 |
-
|
585 |
-
/* Show saving spinner */
|
586 |
-
this.addSpinner();
|
587 |
-
|
588 |
-
/* Remove previous message */
|
589 |
-
this.removeMessage();
|
590 |
-
|
591 |
-
console.log(this.model);
|
592 |
-
|
593 |
-
this.model.save({
|
594 |
-
nonce: this.$el.find('input[name=wpnonce]').val()
|
595 |
-
}, {
|
596 |
-
success: $.proxy(function(model, response, options) {
|
597 |
-
|
598 |
-
/* Remove saving spinner */
|
599 |
-
this.removeSpinner();
|
600 |
-
|
601 |
-
/* Display Message */
|
602 |
-
this.displayMessage(GFPDF.updateSuccess);
|
603 |
-
|
604 |
-
/* Keep our model in sync */
|
605 |
-
this.model.set(model);
|
606 |
-
|
607 |
-
}, this),
|
608 |
-
|
609 |
-
error: $.proxy(function(response, type, errorName) {
|
610 |
-
|
611 |
-
/* Remove saving spinner */
|
612 |
-
this.removeSpinner();
|
613 |
-
|
614 |
-
/* Display Error */
|
615 |
-
if(response.responseJSON.error) {
|
616 |
-
this.displayMessage(response.responseJSON.error, true);
|
617 |
-
}
|
618 |
-
}, this)
|
619 |
-
});
|
620 |
-
}
|
621 |
-
},
|
622 |
-
|
623 |
-
/**
|
624 |
-
* Delete our model
|
625 |
-
* @param Object ev The Backbone event object
|
626 |
-
* @since 4.0
|
627 |
-
*/
|
628 |
-
deleteModel: function(ev) {
|
629 |
-
|
630 |
-
/* Prevent default anchor action */
|
631 |
-
ev.preventDefault();
|
632 |
-
|
633 |
-
/* Get our dialog box */
|
634 |
-
var $dialog = $( '#delete-confirm' );
|
635 |
-
|
636 |
-
/* Set up our dialog box buttons */
|
637 |
-
var deleteButtons = [{
|
638 |
-
text: GFPDF.delete,
|
639 |
-
click: $.proxy(function() {
|
640 |
-
|
641 |
-
/* Hide the confirmation dialog */
|
642 |
-
$dialog.wpdialog( 'destroy' );
|
643 |
-
|
644 |
-
/* If an ID is set (pulled from DB) do our AJAX delete call */
|
645 |
-
if(this.model.get('id')) {
|
646 |
-
|
647 |
-
/* Show saving spinner */
|
648 |
-
this.addSpinner();
|
649 |
-
|
650 |
-
/* Remove previous message */
|
651 |
-
this.removeMessage();
|
652 |
-
|
653 |
-
/* Hide the container */
|
654 |
-
this.$el.hide();
|
655 |
-
|
656 |
-
this.model.destroy({
|
657 |
-
nonce: this.$el.find('input[name=wpnonce]').val()
|
658 |
-
}, {
|
659 |
-
success: $.proxy(function(model, response, options) {
|
660 |
-
|
661 |
-
/* Remove saving spinner */
|
662 |
-
this.removeSpinner();
|
663 |
-
|
664 |
-
/* Display Message */
|
665 |
-
this.displayMessage(GFPDF.deleteSuccess);
|
666 |
-
|
667 |
-
/* Remove from collection */
|
668 |
-
this.collection.remove(this.model);
|
669 |
-
|
670 |
-
}, this),
|
671 |
-
|
672 |
-
error: $.proxy(function(response, type, errorName) {
|
673 |
-
|
674 |
-
/* Remove saving spinner */
|
675 |
-
this.removeSpinner();
|
676 |
-
|
677 |
-
/* Remove from collection */
|
678 |
-
this.collection.remove(this.model);
|
679 |
-
|
680 |
-
/* Display Error */
|
681 |
-
if(response.responseJSON.error) {
|
682 |
-
this.displayMessage(response.responseJSON.error, true);
|
683 |
-
}
|
684 |
-
|
685 |
-
}, this)
|
686 |
-
});
|
687 |
-
|
688 |
-
/* TODO: if destroy() is successful remove the hidden item */
|
689 |
-
} else {
|
690 |
-
this.collection.remove(this.model);
|
691 |
-
}
|
692 |
-
|
693 |
-
}, this)
|
694 |
-
},
|
695 |
-
{
|
696 |
-
text: GFPDF.cancel,
|
697 |
-
click: function() {
|
698 |
-
|
699 |
-
/* Cancel */
|
700 |
-
$dialog.wpdialog( 'destroy' );
|
701 |
-
}
|
702 |
-
}];
|
703 |
-
|
704 |
-
/* Set up our dialog box */
|
705 |
-
Fonts.Misc.Dialog($dialog, deleteButtons, 300, 175);
|
706 |
-
|
707 |
-
/* Open the dialog box */
|
708 |
-
$dialog.wpdialog( 'open' );
|
709 |
-
},
|
710 |
-
|
711 |
-
/**
|
712 |
-
* Adds an AJAX loader so the user knows a query is being made
|
713 |
-
* @since 4.0
|
714 |
-
*/
|
715 |
-
addSpinner: function() {
|
716 |
-
var $spinner = $('<img alt="Loading" src="' + GFPDF.spinnerUrl + '" class="gfpdf-spinner" style="margin-top: 4px;" />');
|
717 |
-
this.$el.find('.font-submit button').after($spinner);
|
718 |
-
},
|
719 |
-
|
720 |
-
/**
|
721 |
-
* Remove AJAX loader so the user knows a query is finished
|
722 |
-
* @since 4.0
|
723 |
-
*/
|
724 |
-
removeSpinner: function() {
|
725 |
-
this.$el.find('.gfpdf-spinner').remove();
|
726 |
-
},
|
727 |
-
|
728 |
-
/**
|
729 |
-
* Show message to the user
|
730 |
-
* @param String msg The message to be displayed
|
731 |
-
* @param Boolean isError If set to true an error will be displayed
|
732 |
-
* @since 4.0
|
733 |
-
*/
|
734 |
-
displayMessage: function(msg, isError) {
|
735 |
-
|
736 |
-
/* Generate our error template */
|
737 |
-
var $message = $('<div class="updated notice">');
|
738 |
-
|
739 |
-
/* Add our error class if requested */
|
740 |
-
if(isError === true) {
|
741 |
-
$message.addClass('error');
|
742 |
-
}
|
743 |
-
|
744 |
-
/* Add the message to be displayed */
|
745 |
-
$message.html('<p>' + msg + '</p>');
|
746 |
-
|
747 |
-
/* Add message to the DOM */
|
748 |
-
this.$el.find('form').before($message);
|
749 |
-
},
|
750 |
-
|
751 |
-
/**
|
752 |
-
* Remove any messages currently being shown to the user
|
753 |
-
* @since 4.0
|
754 |
-
*/
|
755 |
-
removeMessage: function() {
|
756 |
-
this.$el.find('div.notice').slideUp(function() {
|
757 |
-
$(this).remove();
|
758 |
-
});
|
759 |
-
}
|
760 |
-
});
|
761 |
-
|
762 |
-
/**
|
763 |
-
* A simple view that creates an interface for adding new models to our collection
|
764 |
-
* @since 4.0
|
765 |
-
*/
|
766 |
-
Fonts.View.Add = Backbone.View.extend({
|
767 |
-
|
768 |
-
/**
|
769 |
-
* Our View Target Element
|
770 |
-
* @type String
|
771 |
-
* @since 4.0
|
772 |
-
*/
|
773 |
-
el: '#font-add-list',
|
774 |
-
|
775 |
-
/**
|
776 |
-
* Our DOM Events
|
777 |
-
* @type Object
|
778 |
-
* @since 4.0
|
779 |
-
*/
|
780 |
-
events: {
|
781 |
-
'click': 'addFont',
|
782 |
-
},
|
783 |
-
|
784 |
-
/**
|
785 |
-
* Store our Fonts.Container.Core() object so our view can easily add new models
|
786 |
-
* and renders the view
|
787 |
-
* @param Object options User-passed parameters
|
788 |
-
* @since 4.0
|
789 |
-
*/
|
790 |
-
initialize: function(options) {
|
791 |
-
|
792 |
-
this.container = options.container;
|
793 |
-
this.render();
|
794 |
-
},
|
795 |
-
|
796 |
-
/**
|
797 |
-
* Renders our View
|
798 |
-
* @since 4.0
|
799 |
-
*/
|
800 |
-
render: function() {
|
801 |
-
this.$el.html('<i class="fa fa-plus fa-4x"></i><span>Add Font</span>');
|
802 |
-
},
|
803 |
-
|
804 |
-
/**
|
805 |
-
* Add a new model to our collection
|
806 |
-
* @param Object ev The Backbone event object
|
807 |
-
* @since 4.0
|
808 |
-
*/
|
809 |
-
addFont: function(ev) {
|
810 |
-
|
811 |
-
/* Create an empty model */
|
812 |
-
var font = new Fonts.Model.Core();
|
813 |
-
|
814 |
-
/* Add new model to our collection */
|
815 |
-
this.collection.add(font);
|
816 |
-
|
817 |
-
/* Toggle the new model's font manager and set focus to our name field */
|
818 |
-
this.container.$el.find('li:last .font-settings').toggle()
|
819 |
-
.find('input[type="text"]:first').focus();
|
820 |
-
}
|
821 |
-
});
|
822 |
-
|
823 |
-
|
824 |
-
/**
|
825 |
-
* Generate a WP Dialog box
|
826 |
-
* @param jQuery Object $elm The element we want to bind the dialog box to
|
827 |
-
* @param Object buttonsList Handles the button creation process. More information found in the jQuery UI Dialog Documentation
|
828 |
-
* @param Integer boxWidth How wide should the dialog box be
|
829 |
-
* @param Integer boxHeight How tall should the dialog box be
|
830 |
-
* @since 4.0
|
831 |
-
*/
|
832 |
-
Fonts.Misc.Dialog = function($elm, buttonsList, boxWidth, boxHeight) {
|
833 |
-
$elm.wpdialog({
|
834 |
-
autoOpen: false,
|
835 |
-
resizable: false,
|
836 |
-
draggable: false,
|
837 |
-
width: boxWidth,
|
838 |
-
height: boxHeight,
|
839 |
-
modal: true,
|
840 |
-
dialogClass: 'wp-dialog',
|
841 |
-
zIndex: 300000,
|
842 |
-
buttons: buttonsList,
|
843 |
-
|
844 |
-
/**
|
845 |
-
* Open our dialog box and set focus to the first button find
|
846 |
-
* Also add an event listener to close the dialog when the background is clicked
|
847 |
-
*/
|
848 |
-
open: function() {
|
849 |
-
$(this).siblings('.ui-dialog-buttonpane').find('button:eq(1)').focus();
|
850 |
-
|
851 |
-
$('.ui-widget-overlay').bind('click', function() {
|
852 |
-
$elm.wpdialog('close');
|
853 |
-
});
|
854 |
-
}
|
855 |
-
});
|
856 |
-
};
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
/**
|
862 |
-
* Our Documentation Search API
|
863 |
-
* We'll add a search bar and output the results of the search
|
864 |
-
* from our API to assist users with our software.
|
865 |
-
* @since 4.0
|
866 |
-
*/
|
867 |
-
|
868 |
-
var help = {}; // create namespace for our app
|
869 |
-
|
870 |
-
help.SearchModel = Backbone.Model.extend({});
|
871 |
-
|
872 |
-
help.SearchCollection = Backbone.Collection.extend({
|
873 |
-
model: help.SearchModel,
|
874 |
-
|
875 |
-
initialize: function(models, options) {
|
876 |
-
this.url = options.url;
|
877 |
-
},
|
878 |
-
|
879 |
-
});
|
880 |
-
|
881 |
-
help.ContainerView = Backbone.View.extend({
|
882 |
-
el: '#search-knowledgebase',
|
883 |
-
|
884 |
-
events: {
|
885 |
-
'keyup #search-help-input' : 'doSearch',
|
886 |
-
'change #search-help-input' : 'doSearch',
|
887 |
-
},
|
888 |
-
|
889 |
-
initialize: function() {
|
890 |
-
/* initialise our timer */
|
891 |
-
this.timer = true;
|
892 |
-
|
893 |
-
/* render the container view */
|
894 |
-
this.render();
|
895 |
-
},
|
896 |
-
|
897 |
-
render: function() {
|
898 |
-
this.addSearchBar();
|
899 |
-
|
900 |
-
return this;
|
901 |
-
},
|
902 |
-
|
903 |
-
addSearchBar: function() {
|
904 |
-
/* create our search element */
|
905 |
-
var $input = $('<input>').attr('type', 'text')
|
906 |
-
.attr('placeholder', ' ' + GFPDF.searchPlaceholder)
|
907 |
-
.attr('id', 'search-help-input');
|
908 |
-
|
909 |
-
/* add out search box and give it focus */
|
910 |
-
this.$el.prepend($input);
|
911 |
-
|
912 |
-
$input.tooltip({
|
913 |
-
items: 'input',
|
914 |
-
content: 'The search must be more than 3 characters.',
|
915 |
-
tooltipClass: 'ui-state-error',
|
916 |
-
}).tooltip( 'disable' );
|
917 |
-
|
918 |
-
/* give our search box focus */
|
919 |
-
$input.focus();
|
920 |
-
},
|
921 |
-
|
922 |
-
doSearch: function(ev) {
|
923 |
-
var $search = $(ev.currentTarget);
|
924 |
-
|
925 |
-
/* clear any previous events */
|
926 |
-
window.clearTimeout(this.timer);
|
927 |
-
|
928 |
-
/* only trigger our search if user has entered more than 3 characters */
|
929 |
-
var value = $.trim($search.val());
|
930 |
-
var previousValue = $search.data('currentValue');
|
931 |
-
|
932 |
-
if(value.length > 3 && $search.data('previousValue') !== value) {
|
933 |
-
$search.tooltip( 'disable' );
|
934 |
-
|
935 |
-
/* track the data value */
|
936 |
-
$search.data('currentValue', value);
|
937 |
-
|
938 |
-
this.timer = window.setTimeout(_.bind(function() {
|
939 |
-
this.processSearch(value);
|
940 |
-
}, this), 500);
|
941 |
-
} else if(value.length <= 3 && ev.keyCode == 13) {
|
942 |
-
$search.tooltip( 'enable' ).tooltip( 'open' );
|
943 |
-
}
|
944 |
-
},
|
945 |
-
|
946 |
-
processSearch: function(search) {
|
947 |
-
/* Initialise our Collection and pull the data from our source */
|
948 |
-
console.log('Searching our collection...');
|
949 |
-
|
950 |
-
new help.DocsView({
|
951 |
-
s: search,
|
952 |
-
});
|
953 |
-
}
|
954 |
-
|
955 |
-
});
|
956 |
-
|
957 |
-
help.MainView = Backbone.View.extend({
|
958 |
-
|
959 |
-
callAPI: function(url) {
|
960 |
-
/* do our search */
|
961 |
-
this.collection.fetch({
|
962 |
-
success: _.bind(this.renderSearch, this),
|
963 |
-
error: _.bind(this.renderSearchError),
|
964 |
-
});
|
965 |
-
},
|
966 |
-
|
967 |
-
renderSearch: function(collection, response) {
|
968 |
-
console.log('Rendering Search Results');
|
969 |
-
|
970 |
-
this.hideSpinner();
|
971 |
-
|
972 |
-
var $container = this.$el.find('.inside ul');
|
973 |
-
|
974 |
-
$container.html(this.template({
|
975 |
-
collection: this.collection.toJSON(),
|
976 |
-
url: this.url,
|
977 |
-
}));
|
978 |
-
|
979 |
-
var $wrapper = $container.parent();
|
980 |
-
if(!$wrapper.is(':visible')) {
|
981 |
-
$wrapper.slideDown(500);
|
982 |
-
}
|
983 |
-
|
984 |
-
},
|
985 |
-
|
986 |
-
renderSearchError: function(collection, response) {
|
987 |
-
console.log('Search Failed');
|
988 |
-
console.log(collection);
|
989 |
-
console.log(response);
|
990 |
-
},
|
991 |
-
|
992 |
-
|
993 |
-
showSpinner: function() {
|
994 |
-
this.$el.find('.spinner').addClass('is-active');
|
995 |
-
|
996 |
-
if(!this.$el.is(':visible')) {
|
997 |
-
this.$el.slideDown(500);
|
998 |
-
}
|
999 |
-
},
|
1000 |
-
|
1001 |
-
hideSpinner: function() {
|
1002 |
-
this.$el.find('.spinner').removeClass('is-active');
|
1003 |
-
},
|
1004 |
-
});
|
1005 |
-
|
1006 |
-
help.DocsView = help.MainView.extend({
|
1007 |
-
el: '#documentation-api',
|
1008 |
-
|
1009 |
-
template: '#GravityPDFSearchResultsDocumentation',
|
1010 |
-
|
1011 |
-
initialize: function(options) {
|
1012 |
-
this.url = 'https://gravitypdf.com/wp-json/wp/v2/v4_docs/';
|
1013 |
-
this.s = options.s;
|
1014 |
-
this.render();
|
1015 |
-
},
|
1016 |
-
|
1017 |
-
render: function() {
|
1018 |
-
/* set up out template */
|
1019 |
-
this.template = _.template($(this.template).html(), null, UnderscoreSettingsOverride);
|
1020 |
-
|
1021 |
-
/* show the loading spinner */
|
1022 |
-
this.showSpinner();
|
1023 |
-
|
1024 |
-
/* set up view search params */
|
1025 |
-
var s = encodeURIComponent(this.s);
|
1026 |
-
var url = this.url + '?search=' + s;
|
1027 |
-
|
1028 |
-
/* initialise our collection */
|
1029 |
-
this.collection = new help.SearchCollection([], {
|
1030 |
-
url: url,
|
1031 |
-
});
|
1032 |
-
|
1033 |
-
/* ping api for results */
|
1034 |
-
this.callAPI(url);
|
1035 |
-
|
1036 |
-
return this;
|
1037 |
-
},
|
1038 |
-
});
|
1039 |
-
|
1040 |
-
/**
|
1041 |
-
* Our Admin controller
|
1042 |
-
* Applies correct JS to settings pages
|
1043 |
-
*/
|
1044 |
-
function GravityPDF () {
|
1045 |
-
var self = this;
|
1046 |
-
|
1047 |
-
this.init = function() {
|
1048 |
-
if(this.is_settings()) {
|
1049 |
-
this.processSettings();
|
1050 |
-
}
|
1051 |
-
};
|
1052 |
-
|
1053 |
-
this.is_settings = function() {
|
1054 |
-
return $('#tab_PDF').length;
|
1055 |
-
};
|
1056 |
-
|
1057 |
-
this.processSettings = function() {
|
1058 |
-
var active = $('.nav-tab-wrapper a.nav-tab-active:first').data('id');
|
1059 |
-
|
1060 |
-
switch (active) {
|
1061 |
-
case 'tools':
|
1062 |
-
this.tools_settings();
|
1063 |
-
break;
|
1064 |
-
|
1065 |
-
case 'help':
|
1066 |
-
this.help_settings();
|
1067 |
-
break;
|
1068 |
-
}
|
1069 |
-
};
|
1070 |
-
|
1071 |
-
/**
|
1072 |
-
* The help settings model method
|
1073 |
-
* This sets up and processes any of the JS that needs to be applied on the help settings tab
|
1074 |
-
* @since 4.0
|
1075 |
-
*/
|
1076 |
-
this.help_settings = function() {
|
1077 |
-
/**
|
1078 |
-
* Load our settings dependancy
|
1079 |
-
*/
|
1080 |
-
new help.ContainerView();
|
1081 |
-
};
|
1082 |
-
|
1083 |
-
/**
|
1084 |
-
* The help tools model method
|
1085 |
-
* This sets up and processes any of the JS that needs to be applied on the tools settings tab
|
1086 |
-
* @since 4.0
|
1087 |
-
*/
|
1088 |
-
this.tools_settings = function() {
|
1089 |
-
|
1090 |
-
var json = JSON.parse(GFPDF.customFontData);
|
1091 |
-
|
1092 |
-
/* Initialise our collection and load with our font JSON data */
|
1093 |
-
var fontCollection = new Fonts.Collection.Core(json);
|
1094 |
-
|
1095 |
-
/* Create a container View and pass in our collection */
|
1096 |
-
var container = new Fonts.View.Container({
|
1097 |
-
collection: fontCollection
|
1098 |
-
});
|
1099 |
-
|
1100 |
-
/* Create a Add View so user's can add new fonts and pass in our collection and container */
|
1101 |
-
new Fonts.View.Add({
|
1102 |
-
collection: fontCollection,
|
1103 |
-
container: container
|
1104 |
-
});
|
1105 |
-
};
|
1106 |
-
|
1107 |
-
}
|
1108 |
-
|
1109 |
-
var pdf = new GravityPDF();
|
1110 |
-
pdf.init();
|
1111 |
-
|
1112 |
-
});
|
1113 |
-
})(jQuery);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/gfpdf-entries.js
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Gravity PDF Entries
|
3 |
-
* Dependancies: jQuery
|
4 |
-
* @since 4.0
|
5 |
-
*/
|
6 |
-
|
7 |
-
(function($) {
|
8 |
-
|
9 |
-
var GFPDF = {
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Do a better hover when accessing the PDF submenu
|
13 |
-
* This allows for a longer timeout before the submenu is hidden again
|
14 |
-
* @since 4.0
|
15 |
-
*/
|
16 |
-
PDFSubmenuHover: function() {
|
17 |
-
$('table .gf_form_action_has_submenu').hover(function() {
|
18 |
-
|
19 |
-
clearTimeout($(this).data('timeout'));
|
20 |
-
|
21 |
-
$(this).find('.gf_submenu').show();
|
22 |
-
}, function() {
|
23 |
-
|
24 |
-
var self = this;
|
25 |
-
var t = setTimeout(function() {
|
26 |
-
$(self).find('.gf_submenu').hide();
|
27 |
-
}, 350);
|
28 |
-
|
29 |
-
$(this).data('timeout', t);
|
30 |
-
});
|
31 |
-
}
|
32 |
-
};
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Fires on the Document Ready Event (the same as $(document).ready(function() { ... });)
|
36 |
-
* @since 4.0
|
37 |
-
*/
|
38 |
-
$(function() {
|
39 |
-
GFPDF.PDFSubmenuHover();
|
40 |
-
});
|
41 |
-
})(jQuery);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/gfpdf-migration.js
DELETED
@@ -1,74 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Gravity PDF Multisite v3 to v4 Migration Script
|
3 |
-
* Dependancies: jQuery
|
4 |
-
* @since 4.0
|
5 |
-
*/
|
6 |
-
|
7 |
-
(function($) {
|
8 |
-
|
9 |
-
function ajax_migration( blog_id, nonce, $container ) {
|
10 |
-
$container.append( '<p>' + GFPDF.migratingSite.replace( /%s/g, blog_id ) + ' <img alt="' + GFPDF.spinnerAlt + '" src="' + GFPDF.spinnerUrl + '" class="gfpdf-spinner" style="width:20px;vertical-align: middle;padding-left:5px" /></p>' );
|
11 |
-
|
12 |
-
$.ajax({
|
13 |
-
type : "post",
|
14 |
-
dataType : "json",
|
15 |
-
url : GFPDF.ajaxUrl,
|
16 |
-
data : {
|
17 |
-
'action': 'multisite_v3_migration',
|
18 |
-
'nonce': nonce,
|
19 |
-
'blog_id': blog_id,
|
20 |
-
},
|
21 |
-
success: function( json ) {
|
22 |
-
/* Remove the spinner */
|
23 |
-
$container.find( '.gfpdf-spinner' ).remove();
|
24 |
-
|
25 |
-
/* Display appropriate response. Either complete, specific error or generic error */
|
26 |
-
if( json.results === "complete" ) {
|
27 |
-
$container.append( '<p>' + GFPDF.siteMigrationComplete.replace( /%s/g, blog_id ) + '</p>' );
|
28 |
-
} else if( json.results.error ) {
|
29 |
-
$container.append( '<p><strong>' + GFPDF.migrationError + ': ' + json.results.error + '</strong></p>' );
|
30 |
-
} else {
|
31 |
-
$container.append( '<p><strong>' + GFPDF.siteMigrationErrors.replace( /%s/g, blog_id ) + '</strong></p>' );
|
32 |
-
}
|
33 |
-
|
34 |
-
/* Run the next migration, if it exists, or show as complete */
|
35 |
-
if( gfpdf_migration_multisite_ids.length > 0 ) {
|
36 |
-
ajax_migration( gfpdf_migration_multisite_ids.shift(), nonce, $container );
|
37 |
-
} else {
|
38 |
-
$( '#gfpdf-multisite-migration-complete' ).show();
|
39 |
-
}
|
40 |
-
},
|
41 |
-
error: function() {
|
42 |
-
/* Remove the spinner */
|
43 |
-
$container.find( '.gfpdf-spinner' ).remove();
|
44 |
-
|
45 |
-
/* Add a generic error */
|
46 |
-
$container.append( '<p><strong>' + GFPDF.siteMigrationErrors.replace( /%s/g, blog_id ) + '</strong></p>' );
|
47 |
-
|
48 |
-
/* Run the next migration, if it exists, or show as complete */
|
49 |
-
if( gfpdf_migration_multisite_ids.length > 0 ) {
|
50 |
-
ajax_migration( gfpdf_migration_multisite_ids.shift(), nonce, $container );
|
51 |
-
} else {
|
52 |
-
$( '#gfpdf-multisite-migration-complete' ).show();
|
53 |
-
}
|
54 |
-
},
|
55 |
-
});
|
56 |
-
}
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Fires on the Document Ready Event (the same as $(document).ready(function() { ... });)
|
60 |
-
* @since 4.0
|
61 |
-
*/
|
62 |
-
$(function() {
|
63 |
-
|
64 |
-
/* Grab the container and nonce */
|
65 |
-
var $container = $( '#gfpdf-multisite-migration-copy' );
|
66 |
-
var nonce = $container.data( 'nonce' );
|
67 |
-
|
68 |
-
/* Begin the migration */
|
69 |
-
if( gfpdf_migration_multisite_ids.length > 0 ) {
|
70 |
-
ajax_migration( gfpdf_migration_multisite_ids.shift(), nonce, $container );
|
71 |
-
}
|
72 |
-
});
|
73 |
-
|
74 |
-
})( jQuery );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/gfpdf-settings.js
DELETED
@@ -1,1462 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Gravity PDF Settings JS Logic
|
3 |
-
* Dependancies: backbone, underscore, jquery
|
4 |
-
* @since 4.0
|
5 |
-
*/
|
6 |
-
|
7 |
-
(function ($) {
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Fires on the Document Ready Event (the same as $(document).ready(function() { ... });)
|
11 |
-
* @since 4.0
|
12 |
-
*/
|
13 |
-
$(function () {
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Our Admin controller
|
17 |
-
* Applies correct JS to our Gravity PDF pages
|
18 |
-
* @since 4.0
|
19 |
-
*/
|
20 |
-
function GravityPDF () {
|
21 |
-
|
22 |
-
/**
|
23 |
-
* A reference to the GravityPDF object when 'this' refers to a different object
|
24 |
-
* Usage is inside AJAX closures. All other functions should use $.proxy() to set this appropriately
|
25 |
-
* @type Object
|
26 |
-
* @since 4.0
|
27 |
-
*/
|
28 |
-
var self = this
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Process the correct settings area (the global PDF settings or individual form PDF settings)
|
32 |
-
* Also set up any event listeners needed
|
33 |
-
* @return void
|
34 |
-
* @since 4.0
|
35 |
-
*/
|
36 |
-
this.init = function () {
|
37 |
-
|
38 |
-
/* Process any common functions */
|
39 |
-
this.initCommon()
|
40 |
-
|
41 |
-
/* Process the global PDF settings */
|
42 |
-
if (this.isSettings()) {
|
43 |
-
this.processSettings()
|
44 |
-
}
|
45 |
-
|
46 |
-
/* Process the individual form PDF settings */
|
47 |
-
if (this.isFormSettings()) {
|
48 |
-
this.processFormSettings()
|
49 |
-
}
|
50 |
-
}
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Initialise any common elements
|
54 |
-
* @return void
|
55 |
-
* @since 4.0
|
56 |
-
*/
|
57 |
-
this.initCommon = function () {
|
58 |
-
|
59 |
-
/* Change some Gravity Forms parameters */
|
60 |
-
this.setupGravityForms()
|
61 |
-
|
62 |
-
/* If we have a upload field handle the logic */
|
63 |
-
this.doUploadListener()
|
64 |
-
|
65 |
-
/* If we have a colour picker handle the logic */
|
66 |
-
this.doColorPicker()
|
67 |
-
|
68 |
-
/* If we have any select boxes to handle */
|
69 |
-
this.setupSelectBoxes()
|
70 |
-
|
71 |
-
/* Enable tooltips, if needed */
|
72 |
-
this.showTooltips()
|
73 |
-
|
74 |
-
/* Setup custom paper size, if needed */
|
75 |
-
this.setupCustomPaperSize()
|
76 |
-
|
77 |
-
/* Setup toggled fields, if needed */
|
78 |
-
this.setupToggledFields()
|
79 |
-
|
80 |
-
/* Setup our template loader, if needed */
|
81 |
-
this.setupDynamicTemplateFields()
|
82 |
-
|
83 |
-
/* Setup license deactivation, if needed */
|
84 |
-
this.setupLicenseDeactivation()
|
85 |
-
}
|
86 |
-
|
87 |
-
/**
|
88 |
-
* Replace some of Gravity Forms JS variables so it functions correctly with our PDF version
|
89 |
-
*
|
90 |
-
* @since 4.1
|
91 |
-
*/
|
92 |
-
this.setupGravityForms = function () {
|
93 |
-
/**
|
94 |
-
* Check if the global gf_vars has been set and if so replace the .thisFormButton, .show, .hide objects with our
|
95 |
-
* customised options.
|
96 |
-
* @since 4.0
|
97 |
-
*/
|
98 |
-
if (typeof gf_vars !== 'undefined') {
|
99 |
-
gf_vars.thisFormButton = GFPDF.conditionalText
|
100 |
-
gf_vars.show = GFPDF.enable
|
101 |
-
gf_vars.hide = GFPDF.disable
|
102 |
-
}
|
103 |
-
|
104 |
-
/*
|
105 |
-
* Backwards compatibility support prior to Gravity Forms 2.3
|
106 |
-
*
|
107 |
-
* Override the gfMergeTagsObj.getTargetElement prototype to better handle CSS special characters in selectors
|
108 |
-
* This is because Gravity Forms doesn't correctly espace meta-characters such a [ and ] (which we use extensively as IDs)
|
109 |
-
* This functionality assists with the merge tag loader
|
110 |
-
* @since 4.0
|
111 |
-
*/
|
112 |
-
if (window.gfMergeTags && typeof form != 'undefined') {
|
113 |
-
window.gfMergeTags.getTargetElement = this.resetGfMergeTags
|
114 |
-
}
|
115 |
-
}
|
116 |
-
|
117 |
-
/**
|
118 |
-
* Get if on the global PDF settings pages
|
119 |
-
* @return Integer
|
120 |
-
* @since 4.0
|
121 |
-
*/
|
122 |
-
this.isSettings = function () {
|
123 |
-
return $('#tab_PDF').length
|
124 |
-
}
|
125 |
-
|
126 |
-
/**
|
127 |
-
* Check if on the individual PDF form settings pages
|
128 |
-
* @return Integer
|
129 |
-
* @since 4.0
|
130 |
-
*/
|
131 |
-
this.isFormSettings = function () {
|
132 |
-
return $('#tab_pdf').length
|
133 |
-
}
|
134 |
-
|
135 |
-
/**
|
136 |
-
* See if we are on the form settings list page
|
137 |
-
* @return Integer
|
138 |
-
* @since 4.0
|
139 |
-
*/
|
140 |
-
this.isFormSettingsList = function () {
|
141 |
-
return $('#gfpdf_list_form').length
|
142 |
-
}
|
143 |
-
|
144 |
-
/**
|
145 |
-
* See if we are on the form settings edit page
|
146 |
-
* @return Integer
|
147 |
-
* @since 4.0
|
148 |
-
*/
|
149 |
-
this.isFormSettingsEdit = function () {
|
150 |
-
return $('#gfpdf_pdf_form').length
|
151 |
-
}
|
152 |
-
|
153 |
-
/**
|
154 |
-
* Check the current active PDF settings page
|
155 |
-
* @return String
|
156 |
-
* @since 4.0
|
157 |
-
*/
|
158 |
-
this.getCurrentSettingsPage = function () {
|
159 |
-
if (this.isSettings()) {
|
160 |
-
return $('.nav-tab-wrapper a.nav-tab-active:first').data('id')
|
161 |
-
}
|
162 |
-
return ''
|
163 |
-
}
|
164 |
-
|
165 |
-
/**
|
166 |
-
* Process the global settings page
|
167 |
-
* @return void
|
168 |
-
* @since 4.0
|
169 |
-
*/
|
170 |
-
this.processSettings = function () {
|
171 |
-
|
172 |
-
/* Ensure the Gravity Forms settings navigation (Form Settings / Notifications / Confirmation) has the 'tab' URI stripped from it */
|
173 |
-
this.cleanupGFNavigation()
|
174 |
-
|
175 |
-
/* Run our direct PDF status check */
|
176 |
-
this.runPDFAccessCheck()
|
177 |
-
|
178 |
-
/* Run the appropriate settings page */
|
179 |
-
switch (this.getCurrentSettingsPage()) {
|
180 |
-
case 'general':
|
181 |
-
this.generalSettings()
|
182 |
-
break
|
183 |
-
|
184 |
-
case 'tools':
|
185 |
-
this.toolsSettings()
|
186 |
-
break
|
187 |
-
}
|
188 |
-
}
|
189 |
-
|
190 |
-
/**
|
191 |
-
* Routing functionality for the individual form settings page
|
192 |
-
* @return void
|
193 |
-
* @since 4.0
|
194 |
-
*/
|
195 |
-
this.processFormSettings = function () {
|
196 |
-
|
197 |
-
/* Process PDF list page */
|
198 |
-
if (this.isFormSettingsList()) {
|
199 |
-
this.doFormSettingsListPage()
|
200 |
-
}
|
201 |
-
|
202 |
-
/* Process single edit page */
|
203 |
-
if (this.isFormSettingsEdit()) {
|
204 |
-
this.doFormSettingsEditPage()
|
205 |
-
}
|
206 |
-
}
|
207 |
-
|
208 |
-
/**
|
209 |
-
* Process the individual PDF GF Form Settings Page
|
210 |
-
* @return void
|
211 |
-
* @since 4.0
|
212 |
-
*/
|
213 |
-
this.doFormSettingsEditPage = function () {
|
214 |
-
|
215 |
-
this.setupRequiredFields($('#gfpdf_pdf_form'))
|
216 |
-
/* highlight which fields are required and disable in-browser validation */
|
217 |
-
this.setupPdfTabs()
|
218 |
-
this.handleSecurityConditionals()
|
219 |
-
this.handlePDFConditionalLogic()
|
220 |
-
this.handleOwnerRestriction()
|
221 |
-
this.toggleFontAppearance($('#gfpdf_settings\\[template\\]').data('template_group'))
|
222 |
-
this.toggleAppearanceTab()
|
223 |
-
|
224 |
-
/*
|
225 |
-
* Workaround for Firefix TinyMCE Editor Bug NS_ERROR_UNEXPECTED (http://www.tinymce.com/develop/bugtracker_view.php?id=3152) when loading wp_editor via AJAX
|
226 |
-
* Manual save TinyMCE editors on form submission
|
227 |
-
*/
|
228 |
-
$('#gfpdf_pdf_form').submit(function () {
|
229 |
-
try {
|
230 |
-
tinyMCE.triggerSave()
|
231 |
-
} catch (e) {}
|
232 |
-
|
233 |
-
})
|
234 |
-
|
235 |
-
/* Add listener on submit functionality */
|
236 |
-
$('#gfpdf_pdf_form').submit(function () {
|
237 |
-
/* JSONify the conditional logic so we can pass it through the form and use it in PHP (after running json_decode) */
|
238 |
-
$('#gfpdf_settings\\[conditionalLogic\\]').val(jQuery.toJSON(window.gfpdf_current_pdf.conditionalLogic))
|
239 |
-
})
|
240 |
-
|
241 |
-
}
|
242 |
-
|
243 |
-
/**
|
244 |
-
* Handles our DOM security conditional logic based on the user selection
|
245 |
-
* @return void
|
246 |
-
* @since 4.0
|
247 |
-
*/
|
248 |
-
this.handleSecurityConditionals = function () {
|
249 |
-
|
250 |
-
/* Get the appropriate elements for use */
|
251 |
-
var $secTable = $('#pdf-general-advanced')
|
252 |
-
var $pdfSecurity = $secTable.find('input[name="gfpdf_settings[security]"]')
|
253 |
-
var $format = $secTable.find('input[name="gfpdf_settings[format]"]')
|
254 |
-
|
255 |
-
/* Add change event to admin restrictions to show/hide dependant fields */
|
256 |
-
$pdfSecurity.change(function () {
|
257 |
-
|
258 |
-
if ($(this).is(':checked')) {
|
259 |
-
|
260 |
-
/* Get the format dependancy */
|
261 |
-
var format = $format.filter(':checked').val()
|
262 |
-
|
263 |
-
if ($(this).val() === GFPDF.no || format !== GFPDF.standard) {
|
264 |
-
/* hide security password / privileges */
|
265 |
-
$secTable.find('tr:nth-child(3),tr:nth-child(4),tr:nth-child(5):not(.gfpdf-hidden)').hide()
|
266 |
-
} else {
|
267 |
-
/* show security password / privileges */
|
268 |
-
$secTable.find('tr:nth-child(3),tr:nth-child(4),tr:nth-child(5):not(.gfpdf-hidden)').show()
|
269 |
-
}
|
270 |
-
|
271 |
-
if (format !== GFPDF.standard) {
|
272 |
-
$secTable.find('tr:nth-child(2)').hide()
|
273 |
-
} else {
|
274 |
-
$secTable.find('tr:nth-child(2)').show()
|
275 |
-
}
|
276 |
-
}
|
277 |
-
|
278 |
-
}).trigger('change')
|
279 |
-
|
280 |
-
/* The format field effects the security field. When it changes it triggers the security field as changed */
|
281 |
-
$format.change(function () {
|
282 |
-
if ($(this).is(':checked')) {
|
283 |
-
$pdfSecurity.trigger('change')
|
284 |
-
}
|
285 |
-
}).trigger('change')
|
286 |
-
}
|
287 |
-
|
288 |
-
/**
|
289 |
-
* Add GF JS filter to change the conditional logic object type to our PDF
|
290 |
-
* @return Object
|
291 |
-
* @since 4.0
|
292 |
-
*/
|
293 |
-
this.handlePDFConditionalLogic = function () {
|
294 |
-
|
295 |
-
gform.addFilter('gform_conditional_object', function (object, objectType) {
|
296 |
-
if (objectType === 'gfpdf') {
|
297 |
-
return window.gfpdf_current_pdf
|
298 |
-
}
|
299 |
-
return object
|
300 |
-
})
|
301 |
-
|
302 |
-
/* Add change event to conditional logic field */
|
303 |
-
$('#gfpdf_conditional_logic').change(function () {
|
304 |
-
|
305 |
-
/* Only set up a .conditionalLogic object if it doesn't exist */
|
306 |
-
if (typeof window.gfpdf_current_pdf.conditionalLogic == 'undefined' && $(this).prop('checked')) {
|
307 |
-
|
308 |
-
window.gfpdf_current_pdf.conditionalLogic = new ConditionalLogic()
|
309 |
-
} else if (!$(this).prop('checked')) {
|
310 |
-
|
311 |
-
window.gfpdf_current_pdf.conditionalLogic = null
|
312 |
-
}
|
313 |
-
ToggleConditionalLogic(false, 'gfpdf')
|
314 |
-
|
315 |
-
}).trigger('change')
|
316 |
-
}
|
317 |
-
|
318 |
-
/**
|
319 |
-
* Show / Hide the Restrict Owner when `Enable Public Access` is set to "Yes"
|
320 |
-
* @since 4.0
|
321 |
-
*/
|
322 |
-
this.handleOwnerRestriction = function () {
|
323 |
-
|
324 |
-
var $table = $('#gfpdf-advanced-pdf-options')
|
325 |
-
var $publicAccess = $table.find('input[name="gfpdf_settings[public_access]"]')
|
326 |
-
|
327 |
-
/*
|
328 |
-
* Add change event to admin restrictions to show/hide dependant fields
|
329 |
-
*/
|
330 |
-
$publicAccess.change(function () {
|
331 |
-
|
332 |
-
if ($(this).is(':checked')) {
|
333 |
-
if ($(this).val() === 'Yes') {
|
334 |
-
/* hide user restrictions */
|
335 |
-
$table.find('tr:nth-child(8)').hide()
|
336 |
-
} else {
|
337 |
-
/* show user restrictions */
|
338 |
-
$table.find('tr:nth-child(8)').show()
|
339 |
-
}
|
340 |
-
}
|
341 |
-
}).trigger('change')
|
342 |
-
}
|
343 |
-
|
344 |
-
/**
|
345 |
-
* Process the functionality for the PDF form settings 'list' page
|
346 |
-
* @return void
|
347 |
-
* @since 4.0
|
348 |
-
*/
|
349 |
-
this.doFormSettingsListPage = function () {
|
350 |
-
|
351 |
-
this.setupAJAXListDeleteListener()
|
352 |
-
this.setupAJAXListDuplicateListener()
|
353 |
-
this.setupAJAXListStateListener()
|
354 |
-
}
|
355 |
-
|
356 |
-
/**
|
357 |
-
* Handles the state change of a PDF list item via AJAX
|
358 |
-
* @return void
|
359 |
-
* @since 4.0
|
360 |
-
*/
|
361 |
-
this.setupAJAXListStateListener = function () {
|
362 |
-
|
363 |
-
/* Add live state listener to change active / inactive value */
|
364 |
-
$('#gfpdf_list_form').on('click', '.check-column img', function () {
|
365 |
-
var id = String($(this).data('id'))
|
366 |
-
var that = this
|
367 |
-
|
368 |
-
if (id.length > 0) {
|
369 |
-
var is_active = that.src.indexOf('active1.png') >= 0
|
370 |
-
|
371 |
-
if (is_active) {
|
372 |
-
that.src = that.src.replace('active1.png', 'active0.png')
|
373 |
-
$(that).attr('title', GFPDF.inactive).attr('alt', GFPDF.inactive)
|
374 |
-
} else {
|
375 |
-
that.src = that.src.replace('active0.png', 'active1.png')
|
376 |
-
$(that).attr('title', GFPDF.active).attr('alt', GFPDF.active)
|
377 |
-
}
|
378 |
-
|
379 |
-
/* Set up ajax data */
|
380 |
-
var data = {
|
381 |
-
'action': 'gfpdf_change_state',
|
382 |
-
'nonce': $(this).data('nonce'),
|
383 |
-
'fid': $(this).data('fid'),
|
384 |
-
'pid': $(this).data('id'),
|
385 |
-
}
|
386 |
-
|
387 |
-
/* Do ajax call */
|
388 |
-
self.ajax(data, function (response) {
|
389 |
-
/* Don't do anything with a successful response */
|
390 |
-
})
|
391 |
-
}
|
392 |
-
})
|
393 |
-
}
|
394 |
-
|
395 |
-
/**
|
396 |
-
* Handles the duplicate of a PDF list item via AJAX and fixes up all the nonce actions
|
397 |
-
* @return void
|
398 |
-
* @since 4.0
|
399 |
-
*/
|
400 |
-
this.setupAJAXListDuplicateListener = function () {
|
401 |
-
|
402 |
-
/* Add live duplicate listener */
|
403 |
-
$('#gfpdf_list_form').on('click', 'a.submitduplicate', function () {
|
404 |
-
|
405 |
-
var id = String($(this).data('id'))
|
406 |
-
var that = this
|
407 |
-
|
408 |
-
/* Add spinner */
|
409 |
-
var $spinner = $('<img alt="' + GFPDF.spinnerAlt + '" src="' + GFPDF.spinnerUrl + '" class="gfpdf-spinner gfpdf-spinner-small" />')
|
410 |
-
|
411 |
-
/* Add our spinner */
|
412 |
-
$(this).after($spinner).parent().parent().attr('style', 'position:static; visibility: visible;')
|
413 |
-
|
414 |
-
if (id.length > 0) {
|
415 |
-
/* Set up ajax data */
|
416 |
-
var data = {
|
417 |
-
'action': 'gfpdf_list_duplicate',
|
418 |
-
'nonce': $(this).data('nonce'),
|
419 |
-
'fid': $(this).data('fid'),
|
420 |
-
'pid': $(this).data('id'),
|
421 |
-
}
|
422 |
-
|
423 |
-
/* Do ajax call */
|
424 |
-
self.ajax(data, function (response) {
|
425 |
-
if (response.msg) {
|
426 |
-
|
427 |
-
/* Remove the spinner */
|
428 |
-
$(that).parent().parent().attr('style', '').find('.gfpdf-spinner').remove()
|
429 |
-
|
430 |
-
/* Provide feedback to use */
|
431 |
-
self.show_message(response.msg)
|
432 |
-
|
433 |
-
/* Clone the row to be duplicated */
|
434 |
-
var $row = $(that).parents('tr')
|
435 |
-
var $newRow = $row.clone().css('background', '#baffb8')
|
436 |
-
|
437 |
-
/* Update the edit links to point to the new location */
|
438 |
-
$newRow.find('.column-name > a, .edit a').each(function () {
|
439 |
-
var href = $(this).attr('href')
|
440 |
-
href = self.updateURLParameter(href, 'pid', response.pid)
|
441 |
-
$(this).attr('href', href)
|
442 |
-
})
|
443 |
-
|
444 |
-
/* Update the name field */
|
445 |
-
$newRow.find('.column-name > a').html(response.name)
|
446 |
-
|
447 |
-
/* Find duplicate and delete elements */
|
448 |
-
var $duplicate = $newRow.find('.duplicate a')
|
449 |
-
var $delete = $newRow.find('.delete a')
|
450 |
-
var $state = $newRow.find('.check-column img')
|
451 |
-
var $shortcode = $newRow.find('.column-shortcode input')
|
452 |
-
|
453 |
-
/* Update duplicate ID and nonce pointers so the actions are valid */
|
454 |
-
$duplicate.data('id', response.pid)
|
455 |
-
$duplicate.data('nonce', response.dup_nonce)
|
456 |
-
|
457 |
-
/* Update delete ID and nonce pointers so the actions are valid */
|
458 |
-
$delete.data('id', response.pid)
|
459 |
-
$delete.data('nonce', response.del_nonce)
|
460 |
-
|
461 |
-
/* update state ID and nonce pointers so the actions are valid */
|
462 |
-
$state.data('id', response.pid)
|
463 |
-
$state.data('nonce', response.state_nonce)
|
464 |
-
|
465 |
-
/* Update our shortcode ID */
|
466 |
-
var shortcodeValue = $shortcode.val()
|
467 |
-
shortcodeValue = shortcodeValue.replace(id, response.pid)
|
468 |
-
$shortcode.val(shortcodeValue)
|
469 |
-
|
470 |
-
/* Add fix for alternate row background */
|
471 |
-
var background = ''
|
472 |
-
if ($row.hasClass('alternate')) {
|
473 |
-
$newRow.removeClass('alternate')
|
474 |
-
background = '#FFF'
|
475 |
-
} else {
|
476 |
-
$newRow.addClass('alternate')
|
477 |
-
background = '#f9f9f9'
|
478 |
-
}
|
479 |
-
|
480 |
-
/* Add fix for toggle image */
|
481 |
-
var toggle_src = $state.attr('src')
|
482 |
-
$state
|
483 |
-
.attr('title', GFPDF.inactive)
|
484 |
-
.attr('alt', GFPDF.inactive)
|
485 |
-
.attr('src', toggle_src.replace('active1.png', 'active0.png'))
|
486 |
-
|
487 |
-
/* Add row to node and fade in */
|
488 |
-
$newRow.hide().insertAfter($row).fadeIn().animate({backgroundColor: background})
|
489 |
-
}
|
490 |
-
})
|
491 |
-
}
|
492 |
-
})
|
493 |
-
}
|
494 |
-
|
495 |
-
/**
|
496 |
-
* Check if the last item was just deleted
|
497 |
-
*/
|
498 |
-
this.maybeShowEmptyRow = function () {
|
499 |
-
var $container = $('#gfpdf_list_form tbody')
|
500 |
-
|
501 |
-
if ($container.find('tr').length === 0) {
|
502 |
-
var $row = $('<tr>').addClass('no-items')
|
503 |
-
var $cell = $('<td>').attr('colspan', '5').addClass('colspanchange')
|
504 |
-
var $add_new = $('<a>').attr('href', $('#add-new-pdf').attr('href')).append(GFPDF.letsGoCreateOne + '.')
|
505 |
-
$cell.append(GFPDF.thisFormHasNoPdfs).append(' ').append($add_new)
|
506 |
-
$row.append($cell)
|
507 |
-
$container.append($row)
|
508 |
-
}
|
509 |
-
}
|
510 |
-
|
511 |
-
/**
|
512 |
-
* Handles the deletion of a PDF list item via AJAX
|
513 |
-
* @return void
|
514 |
-
* @since 4.0
|
515 |
-
*/
|
516 |
-
this.setupAJAXListDeleteListener = function () {
|
517 |
-
|
518 |
-
/* Set up our delete dialog */
|
519 |
-
var $deleteDialog = $('#delete-confirm')
|
520 |
-
|
521 |
-
var deleteButtons = [{
|
522 |
-
text: GFPDF.delete,
|
523 |
-
click: function () {
|
524 |
-
/* handle ajax call */
|
525 |
-
$deleteDialog.wpdialog('close')
|
526 |
-
$elm = $($deleteDialog.data('elm'))
|
527 |
-
|
528 |
-
/* Add spinner */
|
529 |
-
var $spinner = $('<img alt="' + GFPDF.spinnerAlt + '" src="' + GFPDF.spinnerUrl + '" class="gfpdf-spinner gfpdf-spinner-small" />')
|
530 |
-
|
531 |
-
/* Add the spinner */
|
532 |
-
$elm.append($spinner).parent().parent().attr('style', 'position:static; visibility: visible;')
|
533 |
-
|
534 |
-
var data = {
|
535 |
-
'action': 'gfpdf_list_delete',
|
536 |
-
'nonce': $elm.data('nonce'),
|
537 |
-
'fid': $elm.data('fid'),
|
538 |
-
'pid': $elm.data('id'),
|
539 |
-
}
|
540 |
-
|
541 |
-
self.ajax(data, function (response) {
|
542 |
-
if (response.msg) {
|
543 |
-
/* Remove spinner */
|
544 |
-
$elm.parent().parent().attr('style', '').find('.gfpdf-spinner').remove()
|
545 |
-
|
546 |
-
self.show_message(response.msg)
|
547 |
-
var $row = $elm.parents('tr')
|
548 |
-
$row.css('background', '#ffb8b8').fadeOut(400, function () {
|
549 |
-
this.remove()
|
550 |
-
self.maybeShowEmptyRow()
|
551 |
-
})
|
552 |
-
}
|
553 |
-
|
554 |
-
$deleteDialog.data('elm', null)
|
555 |
-
})
|
556 |
-
|
557 |
-
}
|
558 |
-
},
|
559 |
-
{
|
560 |
-
text: GFPDF.cancel,
|
561 |
-
click: function () {
|
562 |
-
/* cancel */
|
563 |
-
$deleteDialog.wpdialog('close').data('elm', null)
|
564 |
-
}
|
565 |
-
}]
|
566 |
-
|
567 |
-
/* Add our delete dialog box */
|
568 |
-
this.wp_dialog($deleteDialog, deleteButtons, 300, 175)
|
569 |
-
|
570 |
-
/* Add live delete listener */
|
571 |
-
$('#gfpdf_list_form').on('click', 'a.submitdelete', function () {
|
572 |
-
var id = String($(this).data('id'))
|
573 |
-
if (id.length > 0 && !$deleteDialog.data('elm')) {
|
574 |
-
/* Allow responsiveness */
|
575 |
-
self.resizeDialogIfNeeded($deleteDialog, 300, 175)
|
576 |
-
|
577 |
-
$deleteDialog.wpdialog('open').data('elm', this)
|
578 |
-
}
|
579 |
-
})
|
580 |
-
}
|
581 |
-
|
582 |
-
/**
|
583 |
-
* Handle our AJAX tabs to make it easier to navigate around our settings
|
584 |
-
* @return void
|
585 |
-
* @since 4.0
|
586 |
-
*/
|
587 |
-
this.setupPdfTabs = function () {
|
588 |
-
|
589 |
-
/* Hide all containers except the first one */
|
590 |
-
$('.gfpdf-tab-container').not(":eq(0)").hide()
|
591 |
-
|
592 |
-
/* Add click handler when our nav is selected */
|
593 |
-
$('.gfpdf-tab-wrapper a').click(function () {
|
594 |
-
|
595 |
-
/* Reset the active class */
|
596 |
-
$(this).parents('ul').find('a').removeClass('current')
|
597 |
-
|
598 |
-
/* Add the new active class */
|
599 |
-
$(this).addClass('current').blur()
|
600 |
-
|
601 |
-
/* Hide all containers */
|
602 |
-
$('.gfpdf-tab-container').hide()
|
603 |
-
|
604 |
-
/* Show new active container */
|
605 |
-
$($(this).attr('href')).show()
|
606 |
-
|
607 |
-
return false
|
608 |
-
|
609 |
-
})
|
610 |
-
}
|
611 |
-
|
612 |
-
/**
|
613 |
-
* Add change event listeners on our toggle params and toggle the container
|
614 |
-
* @return void
|
615 |
-
* @since 4.0
|
616 |
-
*/
|
617 |
-
this.setupToggledFields = function () {
|
618 |
-
|
619 |
-
$('form').off('change', '.gfpdf-input-toggle').on('change', '.gfpdf-input-toggle', function () {
|
620 |
-
|
621 |
-
var $container = $(this).parent().next()
|
622 |
-
|
623 |
-
/* Currently checked so hide out input and if cotains rich_text, textarea or input we will delete values */
|
624 |
-
if ($(this).prop('checked')) {
|
625 |
-
$container.slideDown('slow')
|
626 |
-
} else {
|
627 |
-
$container.slideUp('slow')
|
628 |
-
|
629 |
-
/* Remove TinyMCE Content */
|
630 |
-
$container.find('.wp-editor-area').each(function () {
|
631 |
-
var editor = tinyMCE.get($(this).attr('id'))
|
632 |
-
|
633 |
-
if (editor !== null) {
|
634 |
-
editor.setContent('')
|
635 |
-
}
|
636 |
-
|
637 |
-
})
|
638 |
-
|
639 |
-
/* Remove textarea content */
|
640 |
-
$container.find('textarea').each(function () {
|
641 |
-
$(this).val('')
|
642 |
-
})
|
643 |
-
}
|
644 |
-
})
|
645 |
-
}
|
646 |
-
|
647 |
-
/**
|
648 |
-
* PDF Templates can assign their own custom settings which can enhance a template
|
649 |
-
* This function setups the required listeners and functionality to allow this behaviour
|
650 |
-
* @return return
|
651 |
-
* @since 4.0
|
652 |
-
*/
|
653 |
-
this.setupDynamicTemplateFields = function () {
|
654 |
-
|
655 |
-
/* Add change listener to our template */
|
656 |
-
$('#gfpdf_settings\\[template\\]').off('change').change(function () {
|
657 |
-
|
658 |
-
/* Add spinner */
|
659 |
-
var $spinner = $('<img alt="' + GFPDF.spinnerAlt + '" src="' + GFPDF.spinnerUrl + '" class="gfpdf-spinner" />')
|
660 |
-
|
661 |
-
$(this).next().after($spinner)
|
662 |
-
|
663 |
-
var data = {
|
664 |
-
'action': 'gfpdf_get_template_fields',
|
665 |
-
'nonce': GFPDF.ajaxNonce,
|
666 |
-
'template': $(this).val(),
|
667 |
-
'type': $(this).attr('id'),
|
668 |
-
'id': $('#gform_id').val(),
|
669 |
-
'gform_pdf_id': $('#gform_pdf_id').val(),
|
670 |
-
}
|
671 |
-
|
672 |
-
self.ajax(data, function (response) {
|
673 |
-
|
674 |
-
/* Remove our UI loader */
|
675 |
-
$spinner.remove()
|
676 |
-
|
677 |
-
/* Reset our legacy Advanced Template option */
|
678 |
-
$('input[name="gfpdf_settings[advanced_template]"][value="No"]').prop("checked", true).trigger('change')
|
679 |
-
|
680 |
-
/* Only process if the response is valid */
|
681 |
-
if (response.fields) {
|
682 |
-
|
683 |
-
/* Backwards compatibility support prior to Gravity Forms 2.3 */
|
684 |
-
if (window.gfMergeTags) {
|
685 |
-
/* Remove any existing mergetag-marked inputs so they aren't processed twice after we add our new fields to the DOM */
|
686 |
-
$('.merge-tag-support').removeClass('merge-tag-support')
|
687 |
-
$('.all-merge-tags a.open-list').off('click')
|
688 |
-
}
|
689 |
-
|
690 |
-
/* Remove any previously loaded editors to prevent conflicts loading an editor with same name */
|
691 |
-
$.each(response.editors, function (index, value) {
|
692 |
-
|
693 |
-
var editor = tinyMCE.get(value)
|
694 |
-
if (editor !== null) {
|
695 |
-
/* Bug Fix for Firefox - http://www.tinymce.com/develop/bugtracker_view.php?id=3152 */
|
696 |
-
try {
|
697 |
-
tinyMCE.remove(editor)
|
698 |
-
} catch (e) {}
|
699 |
-
}
|
700 |
-
|
701 |
-
})
|
702 |
-
|
703 |
-
/* Replace the custom appearance with the AJAX response fields */
|
704 |
-
$('#pdf-custom-appearance').hide().html(response.fields).fadeIn()
|
705 |
-
|
706 |
-
/* Ensure our template nav item isn't hidden */
|
707 |
-
$('#gfpdf-custom-appearance-nav').show()
|
708 |
-
|
709 |
-
/* Load our new editors */
|
710 |
-
self.loadTinyMCEEditor(response.editors, response.editor_init)
|
711 |
-
|
712 |
-
/* reinitialise new dom elements */
|
713 |
-
self.initCommon()
|
714 |
-
self.doMergetags()
|
715 |
-
|
716 |
-
} else {
|
717 |
-
/* Hide our template nav item as there are no fields and clear our the HTML */
|
718 |
-
$('#gfpdf-custom-appearance-nav').hide()
|
719 |
-
$('#pdf-custom-appearance').html('')
|
720 |
-
}
|
721 |
-
|
722 |
-
/* Check if we should hide or show our font fields */
|
723 |
-
if (response.template_type) {
|
724 |
-
self.toggleFontAppearance(response.template_type)
|
725 |
-
}
|
726 |
-
})
|
727 |
-
})
|
728 |
-
}
|
729 |
-
|
730 |
-
/**
|
731 |
-
* Handles individual add-on license key deactivation via AJAX
|
732 |
-
* @since 4.2
|
733 |
-
*/
|
734 |
-
this.setupLicenseDeactivation = function () {
|
735 |
-
$('.gfpdf-deactivate-license').click(function () {
|
736 |
-
/* Do AJAX call so user can deactivate license */
|
737 |
-
var $container = $(this).parent()
|
738 |
-
$container.find('.gf_settings_description label').html('')
|
739 |
-
|
740 |
-
/* Add spinner */
|
741 |
-
var $spinner = $('<img alt="' + GFPDF.spinnerAlt + '" src="' + GFPDF.spinnerUrl + '" class="gfpdf-spinner" />')
|
742 |
-
|
743 |
-
/* Add our spinner */
|
744 |
-
$(this).append($spinner)
|
745 |
-
|
746 |
-
/* Set up ajax data */
|
747 |
-
var slug = $(this).data('addon-name')
|
748 |
-
|
749 |
-
var data = {
|
750 |
-
'action': 'gfpdf_deactivate_license',
|
751 |
-
'addon_name': slug,
|
752 |
-
'license': $(this).data('license'),
|
753 |
-
'nonce': $(this).data('nonce'),
|
754 |
-
}
|
755 |
-
|
756 |
-
/* Do ajax call */
|
757 |
-
self.ajax(data, function (response) {
|
758 |
-
|
759 |
-
/* Remove our loading spinner */
|
760 |
-
$spinner.remove()
|
761 |
-
|
762 |
-
if (response.success) {
|
763 |
-
/* cleanup inputs */
|
764 |
-
$('#gfpdf_settings\\[license_' + slug + '\\]').val('')
|
765 |
-
$('#gfpdf_settings\\[license_' + slug + '_message\\]').val('')
|
766 |
-
$('#gfpdf_settings\\[license_' + slug + '_status\\]').val('')
|
767 |
-
$container.find('i').remove()
|
768 |
-
$container.find('a').remove()
|
769 |
-
|
770 |
-
$container.find('.gf_settings_description label').html(response.success)
|
771 |
-
} else {
|
772 |
-
/* Show error message */
|
773 |
-
$container.find('.gf_settings_description label').html(response.error)
|
774 |
-
}
|
775 |
-
})
|
776 |
-
|
777 |
-
return false
|
778 |
-
})
|
779 |
-
}
|
780 |
-
|
781 |
-
/**
|
782 |
-
* Check if the template type is 'legacy' and hide the font type, size and colour, otherwise show those fields
|
783 |
-
* @param type
|
784 |
-
* @since 4.0
|
785 |
-
*/
|
786 |
-
this.toggleFontAppearance = function (type) {
|
787 |
-
var $rows = $('#pdf-general-appearance').find('tr.gfpdf_font_type, tr.gfpdf_font_size, tr.gfpdf_font_colour')
|
788 |
-
|
789 |
-
/* Hide our font fields if processing a legacy template */
|
790 |
-
if (type == 'legacy') {
|
791 |
-
$rows.hide()
|
792 |
-
} else { /* Ensure the fields are showing */
|
793 |
-
$rows.show()
|
794 |
-
}
|
795 |
-
}
|
796 |
-
|
797 |
-
/**
|
798 |
-
* Check if the current PDF template selection uses the legacy Enable Advanced Templating option
|
799 |
-
* and hide the Appearance tab altogether
|
800 |
-
* @since 4.0
|
801 |
-
*/
|
802 |
-
this.toggleAppearanceTab = function () {
|
803 |
-
|
804 |
-
$('input[name="gfpdf_settings[advanced_template]"]').change(function () {
|
805 |
-
if ($(this).val() == 'Yes') {
|
806 |
-
$('#gfpdf-appearance-nav').hide()
|
807 |
-
} else {
|
808 |
-
$('#gfpdf-appearance-nav').show()
|
809 |
-
}
|
810 |
-
})
|
811 |
-
|
812 |
-
$('input[name="gfpdf_settings[advanced_template]"]:checked').trigger('change')
|
813 |
-
}
|
814 |
-
|
815 |
-
/**
|
816 |
-
* Initialises AJAX-loaded wp_editor TinyMCE containers for use
|
817 |
-
* @param Array editors The DOM element IDs to parse
|
818 |
-
* @param Object settings The TinyMCE settings to use
|
819 |
-
* @return void
|
820 |
-
* @since 4.0
|
821 |
-
*/
|
822 |
-
this.loadTinyMCEEditor = function (editors, settings) {
|
823 |
-
|
824 |
-
if (settings != null) {
|
825 |
-
/* Ensure appropriate settings defaults */
|
826 |
-
settings.body_class = 'id post-type-post post-status-publish post-format-standard'
|
827 |
-
settings.formats = {
|
828 |
-
alignleft: [
|
829 |
-
{selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles: {textAlign: 'left'}},
|
830 |
-
{selector: 'img,table,dl.wp-caption', classes: 'alignleft'}
|
831 |
-
],
|
832 |
-
aligncenter: [
|
833 |
-
{selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles: {textAlign: 'center'}},
|
834 |
-
{selector: 'img,table,dl.wp-caption', classes: 'aligncenter'}
|
835 |
-
],
|
836 |
-
alignright: [
|
837 |
-
{selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles: {textAlign: 'right'}},
|
838 |
-
{selector: 'img,table,dl.wp-caption', classes: 'alignright'}
|
839 |
-
],
|
840 |
-
strikethrough: {inline: 'del'}
|
841 |
-
}
|
842 |
-
}
|
843 |
-
|
844 |
-
/* Load our new editors */
|
845 |
-
$.each(editors, function (index, fullId) {
|
846 |
-
|
847 |
-
/* Setup out selector */
|
848 |
-
settings.selector = '#' + fullId
|
849 |
-
|
850 |
-
/* Initialise our editor */
|
851 |
-
tinyMCE.init(settings)
|
852 |
-
|
853 |
-
/* Add our editor to the DOM */
|
854 |
-
tinyMCE.execCommand('mceAddEditor', false, fullId)
|
855 |
-
|
856 |
-
/* Enable WP quick tags */
|
857 |
-
if (typeof(QTags) == 'function') {
|
858 |
-
QTags({'id': fullId})
|
859 |
-
QTags._buttonsInit()
|
860 |
-
|
861 |
-
/* remember last tab selected */
|
862 |
-
if (typeof switchEditors.switchto === 'function') {
|
863 |
-
switchEditors.switchto(jQuery('#wp-' + fullId + '-wrap').find('.wp-switch-editor.switch-' + ( getUserSetting('editor') == 'html' ? 'html' : 'tmce' ))[0])
|
864 |
-
}
|
865 |
-
}
|
866 |
-
|
867 |
-
})
|
868 |
-
}
|
869 |
-
|
870 |
-
/**
|
871 |
-
* Rich Media Uploader
|
872 |
-
* JS Pulled straight from Easy Digital Download's admin-scripts.js
|
873 |
-
* @return void
|
874 |
-
* @since 4.0
|
875 |
-
*/
|
876 |
-
this.doUploadListener = function () {
|
877 |
-
// WP 3.5+ uploader
|
878 |
-
var file_frame
|
879 |
-
window.formfield = ''
|
880 |
-
|
881 |
-
$('body').off('click', '.gfpdf_settings_upload_button').on('click', '.gfpdf_settings_upload_button', function (e) {
|
882 |
-
e.preventDefault()
|
883 |
-
|
884 |
-
var $button = $(this)
|
885 |
-
window.formfield = $(this).parent().prev()
|
886 |
-
|
887 |
-
/* If the media frame already exists, reopen it. */
|
888 |
-
if (file_frame) {
|
889 |
-
file_frame.open()
|
890 |
-
return
|
891 |
-
}
|
892 |
-
|
893 |
-
/* Create the media frame. */
|
894 |
-
file_frame = wp.media.frames.file_frame = wp.media({
|
895 |
-
title: $button.data('uploader-title'),
|
896 |
-
button: {
|
897 |
-
text: $button.data('uploader-button-text')
|
898 |
-
},
|
899 |
-
multiple: false,
|
900 |
-
})
|
901 |
-
|
902 |
-
/* When a file is selected, run a callback. */
|
903 |
-
file_frame.on('select', function () {
|
904 |
-
var selection = file_frame.state().get('selection')
|
905 |
-
selection.each(function (attachment, index) {
|
906 |
-
attachment = attachment.toJSON()
|
907 |
-
window.formfield.val(attachment.url).change()
|
908 |
-
})
|
909 |
-
})
|
910 |
-
|
911 |
-
/* Finally, open the modal */
|
912 |
-
file_frame.open()
|
913 |
-
})
|
914 |
-
}
|
915 |
-
|
916 |
-
/**
|
917 |
-
* Check if a Gravity PDF color picker field is present and initialise
|
918 |
-
* @return void
|
919 |
-
* @since 4.0
|
920 |
-
*/
|
921 |
-
this.doColorPicker = function () {
|
922 |
-
|
923 |
-
$('.gfpdf-color-picker').each(function () {
|
924 |
-
$(this).wpColorPicker()
|
925 |
-
})
|
926 |
-
}
|
927 |
-
|
928 |
-
/**
|
929 |
-
* Remove any existing merge tags and reinitialise
|
930 |
-
* @return void
|
931 |
-
* @since 4.0
|
932 |
-
*/
|
933 |
-
this.doMergetags = function () {
|
934 |
-
|
935 |
-
/* Backwards compatibility support prior to Gravity Forms 2.3 */
|
936 |
-
if (window.gfMergeTags && typeof form != 'undefined') {
|
937 |
-
window.gfMergeTags = new gfMergeTagsObj(form)
|
938 |
-
window.gfMergeTags.getTargetElement = this.resetGfMergeTags
|
939 |
-
}
|
940 |
-
|
941 |
-
/* Gravity Forms 2.3+ Merge tag support */
|
942 |
-
if (!window.gfMergeTags && typeof form != 'undefined' && $('.merge-tag-support').length >= 0) {
|
943 |
-
$('.merge-tag-support').each(function () {
|
944 |
-
new gfMergeTagsObj(form, $(this))
|
945 |
-
})
|
946 |
-
}
|
947 |
-
}
|
948 |
-
|
949 |
-
/**
|
950 |
-
* Escape any meta characters in the target element ID, as per the jQuery spec
|
951 |
-
*
|
952 |
-
* @param elem
|
953 |
-
* @returns {*|HTMLElement}
|
954 |
-
* @since 4.1
|
955 |
-
*/
|
956 |
-
this.resetGfMergeTags = function (elem) {
|
957 |
-
var $elem = $(elem)
|
958 |
-
var selector = $elem.parents('span.all-merge-tags').data('targetElement')
|
959 |
-
|
960 |
-
/* escape any meta-characters as per jQuery Spec http://api.jquery.com/category/selectors/ */
|
961 |
-
selector = selector.replace(/[!"#$%&'()*+,.\/:;<=>?@[\\\]^`{|}~]/g, "\\$&")
|
962 |
-
|
963 |
-
return $('#' + selector)
|
964 |
-
}
|
965 |
-
|
966 |
-
/**
|
967 |
-
* Show / Hide our custom paper size as needed
|
968 |
-
* @return void
|
969 |
-
* @since 4.0
|
970 |
-
*/
|
971 |
-
this.setupCustomPaperSize = function () {
|
972 |
-
|
973 |
-
$('.gfpdf_paper_size').each(function () {
|
974 |
-
var $customPaperSize = $(this).nextAll('.gfpdf_paper_size_other').first()
|
975 |
-
var $paperSize = $(this).find('select')
|
976 |
-
|
977 |
-
/* Add our change event */
|
978 |
-
$paperSize.off('change').change(function () {
|
979 |
-
if ($(this).val() === 'CUSTOM') {
|
980 |
-
$customPaperSize.fadeIn()
|
981 |
-
} else {
|
982 |
-
$customPaperSize.fadeOut()
|
983 |
-
}
|
984 |
-
}).trigger('change')
|
985 |
-
|
986 |
-
})
|
987 |
-
|
988 |
-
}
|
989 |
-
|
990 |
-
/**
|
991 |
-
* Our &tab=(.+?) url param causes issues with the default GF navigation
|
992 |
-
* @return void
|
993 |
-
* @since 4.0
|
994 |
-
*/
|
995 |
-
this.cleanupGFNavigation = function () {
|
996 |
-
var $nav = $('#gform_tabs a')
|
997 |
-
|
998 |
-
$nav.each(function () {
|
999 |
-
var href = $(this).attr('href')
|
1000 |
-
var regex = new RegExp('&tab=[^&;]*', 'g')
|
1001 |
-
|
1002 |
-
$(this).attr('href', href.replace(regex, ''))
|
1003 |
-
})
|
1004 |
-
}
|
1005 |
-
|
1006 |
-
/**
|
1007 |
-
* Do an AJAX call to verify a user is protected
|
1008 |
-
* @return void
|
1009 |
-
* @since 4.0
|
1010 |
-
*/
|
1011 |
-
this.runPDFAccessCheck = function () {
|
1012 |
-
var $status = $('#gfpdf-direct-pdf-protection-check')
|
1013 |
-
|
1014 |
-
if ($status.length > 0) {
|
1015 |
-
/* Do our AJAX call */
|
1016 |
-
|
1017 |
-
/* Add spinner */
|
1018 |
-
var $spinner = $('<img alt="' + GFPDF.spinnerAlt + '" src="' + GFPDF.spinnerUrl + '" class="gfpdf-spinner" />')
|
1019 |
-
|
1020 |
-
/* Add our spinner */
|
1021 |
-
$status.append($spinner)
|
1022 |
-
|
1023 |
-
/* Set up ajax data */
|
1024 |
-
var data = {
|
1025 |
-
'action': 'gfpdf_has_pdf_protection',
|
1026 |
-
'nonce': $status.data('nonce'),
|
1027 |
-
}
|
1028 |
-
|
1029 |
-
/* Do ajax call */
|
1030 |
-
this.ajax(data, function (response) {
|
1031 |
-
|
1032 |
-
/* Remove our loading spinner */
|
1033 |
-
$spinner.remove()
|
1034 |
-
|
1035 |
-
if (response === true) {
|
1036 |
-
/* enable our protected message */
|
1037 |
-
$status.find('#gfpdf-direct-pdf-check-protected').show()
|
1038 |
-
} else {
|
1039 |
-
/* enable our unprotected message */
|
1040 |
-
$status.find('#gfpdf-direct-pdf-check-unprotected').show()
|
1041 |
-
}
|
1042 |
-
})
|
1043 |
-
}
|
1044 |
-
}
|
1045 |
-
|
1046 |
-
/**
|
1047 |
-
* Enable dynamic required fields on the Gravity Forms PDF Settings page
|
1048 |
-
* This function will highlight to the user which fields should be processed, and disable in-browser validation
|
1049 |
-
* @return void
|
1050 |
-
* @since 4.0
|
1051 |
-
*/
|
1052 |
-
this.setupRequiredFields = function ($elm) {
|
1053 |
-
/* prevent in browser validation */
|
1054 |
-
$elm.attr('novalidate', 'novalidate')
|
1055 |
-
|
1056 |
-
/* gf compatibility + disable automatic field validation */
|
1057 |
-
$elm.find('tr input[type="submit"]').click(function () {
|
1058 |
-
$elm.addClass('formSubmitted')
|
1059 |
-
})
|
1060 |
-
|
1061 |
-
/* add the required star to make it easier for users */
|
1062 |
-
$elm.find('tr').each(function () {
|
1063 |
-
$(this).find(':input[required=""]:first, :input[required]:first').parents('tr').find('th').append('<span class="gfield_required">*</span>')
|
1064 |
-
})
|
1065 |
-
}
|
1066 |
-
|
1067 |
-
/**
|
1068 |
-
* Because we are using the WordPress Settings API Gravity Forms tooltip support was lacking
|
1069 |
-
* This method fixes that issue
|
1070 |
-
* @return void
|
1071 |
-
* @since 4.0
|
1072 |
-
*/
|
1073 |
-
this.showTooltips = function () {
|
1074 |
-
|
1075 |
-
if (typeof gform_initialize_tooltips !== 'function') {
|
1076 |
-
return
|
1077 |
-
}
|
1078 |
-
|
1079 |
-
$('.gf_hidden_tooltip').each(function () {
|
1080 |
-
$(this)
|
1081 |
-
.parent()
|
1082 |
-
.siblings('th:first')
|
1083 |
-
.append(' ')
|
1084 |
-
.append(
|
1085 |
-
self.get_tooltip($(this).html())
|
1086 |
-
)
|
1087 |
-
|
1088 |
-
$(this).remove()
|
1089 |
-
})
|
1090 |
-
|
1091 |
-
gform_initialize_tooltips()
|
1092 |
-
}
|
1093 |
-
|
1094 |
-
/**
|
1095 |
-
* Set up 'chosen' select boxes
|
1096 |
-
* @return void
|
1097 |
-
* @since 4.0
|
1098 |
-
*/
|
1099 |
-
this.setupSelectBoxes = function () {
|
1100 |
-
var $chosen = $('.gfpdf-chosen')
|
1101 |
-
var chosenSettings = {
|
1102 |
-
disable_search_threshold: 5,
|
1103 |
-
width: '100%',
|
1104 |
-
}
|
1105 |
-
|
1106 |
-
if ($('body').hasClass('rtl')) {
|
1107 |
-
$chosen.addClass('chosen-rtl')
|
1108 |
-
chosenSettings.rtl = true
|
1109 |
-
}
|
1110 |
-
|
1111 |
-
console.log(chosenSettings)
|
1112 |
-
|
1113 |
-
$chosen.each(function () {
|
1114 |
-
$(this).chosen(chosenSettings)
|
1115 |
-
})
|
1116 |
-
}
|
1117 |
-
|
1118 |
-
/**
|
1119 |
-
* Controls the Advanced Options hide / show functionality
|
1120 |
-
* By default these fields are hidden, but are show automatically if an error occurs.
|
1121 |
-
* @return void
|
1122 |
-
* @since 4.0
|
1123 |
-
*/
|
1124 |
-
this.setup_advanced_options = function () {
|
1125 |
-
var $advanced_options_toggle_container = $('.gfpdf-advanced-options')
|
1126 |
-
var $advanced_options_container = $advanced_options_toggle_container.prev()
|
1127 |
-
var $advanced_options = $advanced_options_toggle_container.find('a')
|
1128 |
-
|
1129 |
-
/*
|
1130 |
-
* Show / Hide Advanced options
|
1131 |
-
*/
|
1132 |
-
$advanced_options.click(function () {
|
1133 |
-
var click = this
|
1134 |
-
|
1135 |
-
/* toggle our slider */
|
1136 |
-
$advanced_options_container.slideToggle(600, function () {
|
1137 |
-
/* Toggle our link text */
|
1138 |
-
var text = $(click).text()
|
1139 |
-
$(click).text(
|
1140 |
-
text == GFPDF.showAdvancedOptions ? GFPDF.hideAdvancedOptions : GFPDF.showAdvancedOptions
|
1141 |
-
)
|
1142 |
-
})
|
1143 |
-
|
1144 |
-
return false
|
1145 |
-
})
|
1146 |
-
|
1147 |
-
if ($('.gfpdf-advanced-options').prev().find('.gfield_error').length) {
|
1148 |
-
$advanced_options_container.show()
|
1149 |
-
}
|
1150 |
-
}
|
1151 |
-
|
1152 |
-
/**
|
1153 |
-
* The general settings model method
|
1154 |
-
* This sets up and processes any of the JS that needs to be applied on the general settings tab
|
1155 |
-
* @return void
|
1156 |
-
* @since 4.0
|
1157 |
-
*/
|
1158 |
-
this.generalSettings = function () {
|
1159 |
-
this.setupRequiredFields($('#pdfextended-settings > form'))
|
1160 |
-
|
1161 |
-
var $table = $('#pdf-general-security')
|
1162 |
-
var $adminRestrictions = $table.find('input[name="gfpdf_settings[default_restrict_owner]"]')
|
1163 |
-
|
1164 |
-
/*
|
1165 |
-
* Add change event to admin restrictions to show/hide dependant fields
|
1166 |
-
*/
|
1167 |
-
$adminRestrictions.change(function () {
|
1168 |
-
|
1169 |
-
if ($(this).is(':checked')) {
|
1170 |
-
if ($(this).val() === 'Yes') {
|
1171 |
-
/* hide user restrictions and logged out user timeout */
|
1172 |
-
$table.find('tr:nth-child(3)').hide()
|
1173 |
-
} else {
|
1174 |
-
/* hide user restrictions and logged out user timeout */
|
1175 |
-
$table.find('tr:nth-child(3)').show()
|
1176 |
-
}
|
1177 |
-
}
|
1178 |
-
}).trigger('change')
|
1179 |
-
|
1180 |
-
/* setup advanced options */
|
1181 |
-
this.setup_advanced_options()
|
1182 |
-
}
|
1183 |
-
|
1184 |
-
/**
|
1185 |
-
* The tools settings model method
|
1186 |
-
* This sets up and processes any of the JS that needs to be applied on the tools settings tab
|
1187 |
-
* @since 4.0
|
1188 |
-
*/
|
1189 |
-
this.toolsSettings = function () {
|
1190 |
-
this.setupToolsTemplateInstallerDialog()
|
1191 |
-
this.setupToolsFontsDialog()
|
1192 |
-
this.setupToolsUninstallDialog()
|
1193 |
-
}
|
1194 |
-
|
1195 |
-
/**
|
1196 |
-
* Handles the Template Installer Dialog Box
|
1197 |
-
* @return void
|
1198 |
-
* @since 4.0
|
1199 |
-
*/
|
1200 |
-
this.setupToolsTemplateInstallerDialog = function () {
|
1201 |
-
|
1202 |
-
var $copy = $('#gfpdf_settings\\[setup_templates\\]')
|
1203 |
-
/* escape braces */
|
1204 |
-
var $copyDialog = $('#setup-templates-confirm')
|
1205 |
-
|
1206 |
-
/* Set up copy dialog */
|
1207 |
-
var copyButtons = [{
|
1208 |
-
text: GFPDF.continue,
|
1209 |
-
click: function () {
|
1210 |
-
/* submit form */
|
1211 |
-
$copy.unbind().click()
|
1212 |
-
}
|
1213 |
-
},
|
1214 |
-
{
|
1215 |
-
text: GFPDF.cancel,
|
1216 |
-
click: function () {
|
1217 |
-
/* cancel */
|
1218 |
-
$copyDialog.wpdialog('close')
|
1219 |
-
}
|
1220 |
-
}]
|
1221 |
-
|
1222 |
-
if ($copyDialog.length) {
|
1223 |
-
this.wp_dialog($copyDialog, copyButtons, 500, 350)
|
1224 |
-
|
1225 |
-
$copy.click(function () {
|
1226 |
-
/* Allow responsiveness */
|
1227 |
-
self.resizeDialogIfNeeded($copyDialog, 500, 350)
|
1228 |
-
|
1229 |
-
$copyDialog.wpdialog('open')
|
1230 |
-
return false
|
1231 |
-
})
|
1232 |
-
}
|
1233 |
-
}
|
1234 |
-
|
1235 |
-
/**
|
1236 |
-
* Handles the Fonts Dialog Box
|
1237 |
-
* @return void
|
1238 |
-
* @since 4.0
|
1239 |
-
*/
|
1240 |
-
this.setupToolsFontsDialog = function () {
|
1241 |
-
var $font = $('#gfpdf_settings\\[manage_fonts\\]')
|
1242 |
-
/* escape braces */
|
1243 |
-
var $fontDialog = $('#manage-font-files')
|
1244 |
-
|
1245 |
-
/* setup fonts dialog */
|
1246 |
-
this.wp_dialog($fontDialog, [], 500, 500)
|
1247 |
-
|
1248 |
-
$font.click(function () {
|
1249 |
-
/* Allow responsiveness */
|
1250 |
-
self.resizeDialogIfNeeded($fontDialog, 500, 500)
|
1251 |
-
|
1252 |
-
$fontDialog.wpdialog('open')
|
1253 |
-
return false
|
1254 |
-
})
|
1255 |
-
|
1256 |
-
/* Check if our manage_fonts hash and open the dialog */
|
1257 |
-
if (window.location.hash) {
|
1258 |
-
if (window.location.hash == '#manage_fonts') {
|
1259 |
-
$font.click()
|
1260 |
-
}
|
1261 |
-
}
|
1262 |
-
}
|
1263 |
-
|
1264 |
-
/**
|
1265 |
-
* Handles the Uninstall Dialog Box
|
1266 |
-
* @return void
|
1267 |
-
* @since 4.0
|
1268 |
-
*/
|
1269 |
-
this.setupToolsUninstallDialog = function () {
|
1270 |
-
var $uninstall = $('#gfpdf-uninstall')
|
1271 |
-
var $uninstallDialog = $('#uninstall-confirm')
|
1272 |
-
|
1273 |
-
/* Set up uninstall dialog */
|
1274 |
-
var uninstallButtons = [{
|
1275 |
-
text: GFPDF.uninstall,
|
1276 |
-
click: function () {
|
1277 |
-
/* submit form */
|
1278 |
-
$uninstall.parents('form').submit()
|
1279 |
-
}
|
1280 |
-
},
|
1281 |
-
{
|
1282 |
-
text: GFPDF.cancel,
|
1283 |
-
click: function () {
|
1284 |
-
/* cancel */
|
1285 |
-
$uninstallDialog.wpdialog('close')
|
1286 |
-
}
|
1287 |
-
}]
|
1288 |
-
|
1289 |
-
this.wp_dialog($uninstallDialog, uninstallButtons, 500, 175)
|
1290 |
-
|
1291 |
-
$uninstall.click(function () {
|
1292 |
-
/* Allow responsiveness */
|
1293 |
-
self.resizeDialogIfNeeded($uninstallDialog, 500, 175)
|
1294 |
-
|
1295 |
-
$uninstallDialog.wpdialog('open')
|
1296 |
-
return false
|
1297 |
-
})
|
1298 |
-
}
|
1299 |
-
|
1300 |
-
/**
|
1301 |
-
* Check the current browser width and height and set the dialog box size to fit
|
1302 |
-
* If the size is over 500 pixels (width or height) it will default to 500
|
1303 |
-
*
|
1304 |
-
* @param $dialog an object initialised with this.wp_dialog
|
1305 |
-
* @param Integer maxWidth The maximum width of the dialog box, if it will fit
|
1306 |
-
* @param Integer maxHeight The maximum height of the dialog box, if it will fit
|
1307 |
-
* @return void
|
1308 |
-
* @since 4.0
|
1309 |
-
*/
|
1310 |
-
this.resizeDialogIfNeeded = function ($dialog, maxWidth, maxHeight) {
|
1311 |
-
var windowWidth = $(window).width()
|
1312 |
-
var windowHeight = $(window).height()
|
1313 |
-
|
1314 |
-
var dialogWidth = (windowWidth < 500) ? windowWidth - 20 : maxWidth
|
1315 |
-
var dialogHeight = (windowHeight < 500) ? windowHeight - 50 : maxHeight
|
1316 |
-
|
1317 |
-
$dialog.wpdialog('option', 'width', dialogWidth)
|
1318 |
-
$dialog.wpdialog('option', 'height', dialogHeight)
|
1319 |
-
}
|
1320 |
-
|
1321 |
-
/**
|
1322 |
-
* Generate a WP Dialog box
|
1323 |
-
* @param jQuery Object $elm [description]
|
1324 |
-
* @param Object buttonsList [description]
|
1325 |
-
* @param Integer boxWidth [description]
|
1326 |
-
* @param Integer boxHeight [description]
|
1327 |
-
* @return void
|
1328 |
-
* @since 4.0
|
1329 |
-
*/
|
1330 |
-
this.wp_dialog = function ($elm, buttonsList, boxWidth, boxHeight) {
|
1331 |
-
$elm.wpdialog({
|
1332 |
-
autoOpen: false,
|
1333 |
-
resizable: false,
|
1334 |
-
draggable: false,
|
1335 |
-
width: boxWidth,
|
1336 |
-
height: boxHeight,
|
1337 |
-
modal: true,
|
1338 |
-
dialogClass: 'wp-dialog',
|
1339 |
-
zIndex: 300000,
|
1340 |
-
buttons: buttonsList,
|
1341 |
-
open: function () {
|
1342 |
-
$(this).siblings('.ui-dialog-buttonpane').find('button:eq(1)').focus()
|
1343 |
-
|
1344 |
-
$('.ui-widget-overlay').bind('click', function () {
|
1345 |
-
$elm.wpdialog('close')
|
1346 |
-
})
|
1347 |
-
}
|
1348 |
-
})
|
1349 |
-
}
|
1350 |
-
|
1351 |
-
/**
|
1352 |
-
* Create the tooltip HTML
|
1353 |
-
* @param String html The tooltip message
|
1354 |
-
* @return String
|
1355 |
-
* @since 4.0
|
1356 |
-
*/
|
1357 |
-
this.get_tooltip = function (html) {
|
1358 |
-
var $a = $('<a>')
|
1359 |
-
var $i = $('<i class="fa fa-question-circle">')
|
1360 |
-
|
1361 |
-
$a.append($i)
|
1362 |
-
$a.addClass('gf_tooltip tooltip')
|
1363 |
-
$a.click(function () {
|
1364 |
-
return false
|
1365 |
-
})
|
1366 |
-
|
1367 |
-
$a.attr('title', html)
|
1368 |
-
|
1369 |
-
return $a
|
1370 |
-
}
|
1371 |
-
|
1372 |
-
/**
|
1373 |
-
* An AJAX Wrapper function we can use to ajaxify our plugin
|
1374 |
-
* @param post Object an object of data to submit to our ajax endpoint. This MUST include an 'nonce' and an 'action'
|
1375 |
-
* @param successCallback a callback function
|
1376 |
-
* @return void
|
1377 |
-
* @since 4.0
|
1378 |
-
*/
|
1379 |
-
this.ajax = function (post, successCallback) {
|
1380 |
-
$.ajax({
|
1381 |
-
type: "post",
|
1382 |
-
dataType: "json",
|
1383 |
-
url: GFPDF.ajaxUrl,
|
1384 |
-
data: post,
|
1385 |
-
success: successCallback,
|
1386 |
-
error: this.ajax_error,
|
1387 |
-
})
|
1388 |
-
}
|
1389 |
-
|
1390 |
-
/**
|
1391 |
-
* Log the error to the console
|
1392 |
-
* @return void
|
1393 |
-
* @since 4.0
|
1394 |
-
*/
|
1395 |
-
this.ajax_error = function (jqXHR, textStatus, errorThrown) {
|
1396 |
-
console.log(textStatus)
|
1397 |
-
console.log(errorThrown)
|
1398 |
-
}
|
1399 |
-
|
1400 |
-
/**
|
1401 |
-
* Display a message or error to the user with an appropriate timeout
|
1402 |
-
* @param String msg The message to be displayed
|
1403 |
-
* @param Integer timeout How long to show the message
|
1404 |
-
* @param Boolean error Whether to show an error (true) or a message (false or undefined)
|
1405 |
-
* @return void
|
1406 |
-
* @since 4.0
|
1407 |
-
*/
|
1408 |
-
this.show_message = function (msg, timeout, error) {
|
1409 |
-
timeout = typeof timeout !== 'undefined' ? timeout : 4500
|
1410 |
-
error = typeof error !== 'undefined' ? error : false
|
1411 |
-
|
1412 |
-
var $elm = $('<div id="message">').html('<p>' + msg + '</p>')
|
1413 |
-
|
1414 |
-
if (error === true) {
|
1415 |
-
$elm.addClass('error')
|
1416 |
-
} else {
|
1417 |
-
$elm.addClass('updated')
|
1418 |
-
}
|
1419 |
-
|
1420 |
-
$('.wrap > h2').after($elm)
|
1421 |
-
|
1422 |
-
setTimeout(function () {
|
1423 |
-
$elm.slideUp()
|
1424 |
-
}, timeout)
|
1425 |
-
|
1426 |
-
}
|
1427 |
-
|
1428 |
-
/**
|
1429 |
-
* Update the URL parameter
|
1430 |
-
* @param String The URL to parse
|
1431 |
-
* @param String The URL parameter to want to update
|
1432 |
-
* @param String The replacement string for the URL parameter
|
1433 |
-
* @return String The processed URL
|
1434 |
-
* @since 4.0
|
1435 |
-
* @link http://stackoverflow.com/a/10997390/11236
|
1436 |
-
*/
|
1437 |
-
this.updateURLParameter = function (url, param, paramVal) {
|
1438 |
-
var newAdditionalURL = ""
|
1439 |
-
var tempArray = url.split("?")
|
1440 |
-
var baseURL = tempArray[0]
|
1441 |
-
var additionalURL = tempArray[1]
|
1442 |
-
var temp = ""
|
1443 |
-
if (additionalURL) {
|
1444 |
-
tempArray = additionalURL.split("&")
|
1445 |
-
for (i = 0; i < tempArray.length; i++) {
|
1446 |
-
if (tempArray[i].split('=')[0] != param) {
|
1447 |
-
newAdditionalURL += temp + tempArray[i]
|
1448 |
-
temp = "&"
|
1449 |
-
}
|
1450 |
-
}
|
1451 |
-
}
|
1452 |
-
|
1453 |
-
var rows_txt = temp + "" + param + "=" + paramVal
|
1454 |
-
return baseURL + "?" + newAdditionalURL + rows_txt
|
1455 |
-
}
|
1456 |
-
}
|
1457 |
-
|
1458 |
-
var pdf = new GravityPDF()
|
1459 |
-
pdf.init()
|
1460 |
-
|
1461 |
-
})
|
1462 |
-
})(jQuery)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/react/actionTypes/templates.js
DELETED
@@ -1,35 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Our Redux Action Type Constants
|
3 |
-
*
|
4 |
-
* @package Gravity PDF
|
5 |
-
* @copyright Copyright (c) 2017, Blue Liquid Designs
|
6 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
7 |
-
* @since 4.1
|
8 |
-
*/
|
9 |
-
|
10 |
-
/*
|
11 |
-
This file is part of Gravity PDF.
|
12 |
-
|
13 |
-
Gravity PDF – Copyright (C) 2017, Blue Liquid Designs
|
14 |
-
|
15 |
-
This program is free software; you can redistribute it and/or modify
|
16 |
-
it under the terms of the GNU General Public License as published by
|
17 |
-
the Free Software Foundation; either version 2 of the License, or
|
18 |
-
(at your option) any later version.
|
19 |
-
|
20 |
-
This program is distributed in the hope that it will be useful,
|
21 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23 |
-
GNU General Public License for more details.
|
24 |
-
|
25 |
-
You should have received a copy of the GNU General Public License
|
26 |
-
along with this program; if not, write to the Free Software
|
27 |
-
Found
|
28 |
-
*/
|
29 |
-
|
30 |
-
export const SEARCH_TEMPLATES = 'SEARCH_TEMPLATES'
|
31 |
-
export const SELECT_TEMPLATE = 'SELECT_TEMPLATE'
|
32 |
-
export const ADD_TEMPLATE = 'ADD_TEMPLATE'
|
33 |
-
export const UPDATE_TEMPLATE = 'UPDATE_TEMPLATE'
|
34 |
-
export const UPDATE_TEMPLATE_PARAM = 'UPDATE_TEMPLATE_PARAM'
|
35 |
-
export const DELETE_TEMPLATE = 'DELETE_TEMPLATE'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/react/actions/templates.js
DELETED
@@ -1,137 +0,0 @@
|
|
1 |
-
import {
|
2 |
-
SEARCH_TEMPLATES,
|
3 |
-
SELECT_TEMPLATE,
|
4 |
-
ADD_TEMPLATE,
|
5 |
-
UPDATE_TEMPLATE,
|
6 |
-
UPDATE_TEMPLATE_PARAM,
|
7 |
-
DELETE_TEMPLATE,
|
8 |
-
} from '../actionTypes/templates'
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Redux Actions - payloads of information that send data from your application to your store
|
12 |
-
*
|
13 |
-
* @package Gravity PDF
|
14 |
-
* @copyright Copyright (c) 2017, Blue Liquid Designs
|
15 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
16 |
-
* @since 4.1
|
17 |
-
*/
|
18 |
-
|
19 |
-
/*
|
20 |
-
This file is part of Gravity PDF.
|
21 |
-
|
22 |
-
Gravity PDF – Copyright (C) 2017, Blue Liquid Designs
|
23 |
-
|
24 |
-
This program is free software; you can redistribute it and/or modify
|
25 |
-
it under the terms of the GNU General Public License as published by
|
26 |
-
the Free Software Foundation; either version 2 of the License, or
|
27 |
-
(at your option) any later version.
|
28 |
-
|
29 |
-
This program is distributed in the hope that it will be useful,
|
30 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
31 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
32 |
-
GNU General Public License for more details.
|
33 |
-
|
34 |
-
You should have received a copy of the GNU General Public License
|
35 |
-
along with this program; if not, write to the Free Software
|
36 |
-
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
37 |
-
*/
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Fires the Advanced Template Search action
|
41 |
-
*
|
42 |
-
* @param {string} text
|
43 |
-
*
|
44 |
-
* @returns {{type, text: *}}
|
45 |
-
*
|
46 |
-
* @since 4.1
|
47 |
-
*/
|
48 |
-
export const searchTemplates = (text) => {
|
49 |
-
return {
|
50 |
-
type: SEARCH_TEMPLATES,
|
51 |
-
text
|
52 |
-
}
|
53 |
-
}
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Fires the Advanced Template select/activate action
|
57 |
-
*
|
58 |
-
* @param {string} id The template ID
|
59 |
-
*
|
60 |
-
* @returns {{type, id: *}}
|
61 |
-
*
|
62 |
-
* @since 4.1
|
63 |
-
*/
|
64 |
-
export const selectTemplate = (id) => {
|
65 |
-
return {
|
66 |
-
type: SELECT_TEMPLATE,
|
67 |
-
id
|
68 |
-
}
|
69 |
-
}
|
70 |
-
|
71 |
-
/**
|
72 |
-
* Fires the Advanced Template add new template action
|
73 |
-
*
|
74 |
-
* @param {object} template An Immutable Map
|
75 |
-
*
|
76 |
-
* @returns {{type, template: *}}
|
77 |
-
*
|
78 |
-
* @since 4.1
|
79 |
-
*/
|
80 |
-
export const addTemplate = (template) => {
|
81 |
-
return {
|
82 |
-
type: ADD_TEMPLATE,
|
83 |
-
template
|
84 |
-
}
|
85 |
-
}
|
86 |
-
|
87 |
-
/**
|
88 |
-
* Fires the Advanced Template update action which overrides the entire template object with a new one
|
89 |
-
*
|
90 |
-
* @param {object} template An Immutable Map
|
91 |
-
*
|
92 |
-
* @returns {{type, template: *}}
|
93 |
-
*
|
94 |
-
* @since 4.1
|
95 |
-
*/
|
96 |
-
export const updateTemplate = (template) => {
|
97 |
-
return {
|
98 |
-
type: UPDATE_TEMPLATE,
|
99 |
-
template
|
100 |
-
}
|
101 |
-
}
|
102 |
-
|
103 |
-
/**
|
104 |
-
* Fires the Advanced Template update action which replaces a template parameter with a new value
|
105 |
-
*
|
106 |
-
* @param {string} id The template ID
|
107 |
-
* @param {string} name The parameter key to update
|
108 |
-
* @param {string} value The new value for the parameter
|
109 |
-
*
|
110 |
-
* @returns {{type, id: *, name: *, value: *}}
|
111 |
-
*
|
112 |
-
* @since 4.1
|
113 |
-
*/
|
114 |
-
export const updateTemplateParam = (id, name, value) => {
|
115 |
-
return {
|
116 |
-
type: UPDATE_TEMPLATE_PARAM,
|
117 |
-
id,
|
118 |
-
name,
|
119 |
-
value
|
120 |
-
}
|
121 |
-
}
|
122 |
-
|
123 |
-
/**
|
124 |
-
* Fires the Advanced Template delete action which removes the template from our store
|
125 |
-
*
|
126 |
-
* @param {string} id The template ID
|
127 |
-
*
|
128 |
-
* @returns {{type, id: *}}
|
129 |
-
*
|
130 |
-
* @since 4.1
|
131 |
-
*/
|
132 |
-
export const deleteTemplate = (id) => {
|
133 |
-
return {
|
134 |
-
type: DELETE_TEMPLATE,
|
135 |
-
id
|
136 |
-
}
|
137 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/react/bootstrap/templateBootstrap.js
DELETED
@@ -1,179 +0,0 @@
|
|
1 |
-
import React from 'react'
|
2 |
-
import { render } from 'react-dom'
|
3 |
-
import { HashRouter as Router, Route } from 'react-router-dom'
|
4 |
-
import request from 'superagent'
|
5 |
-
|
6 |
-
import { createStore, combineReducers } from 'redux'
|
7 |
-
import watch from 'redux-watch'
|
8 |
-
|
9 |
-
import { selectTemplate } from '../actions/templates'
|
10 |
-
import templateRouter from '../router/templateRouter'
|
11 |
-
import templateReducer from '../reducers/templateReducer'
|
12 |
-
import TemplateButton from '../components/TemplateButton'
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Advanced Template Selector Bootstrap
|
16 |
-
*
|
17 |
-
* @package Gravity PDF
|
18 |
-
* @copyright Copyright (c) 2017, Blue Liquid Designs
|
19 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
20 |
-
* @since 4.1
|
21 |
-
*/
|
22 |
-
|
23 |
-
/*
|
24 |
-
This file is part of Gravity PDF.
|
25 |
-
|
26 |
-
Gravity PDF – Copyright (C) 2017, Blue Liquid Designs
|
27 |
-
|
28 |
-
This program is free software; you can redistribute it and/or modify
|
29 |
-
it under the terms of the GNU General Public License as published by
|
30 |
-
the Free Software Foundation; either version 2 of the License, or
|
31 |
-
(at your option) any later version.
|
32 |
-
|
33 |
-
This program is distributed in the hope that it will be useful,
|
34 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
35 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
36 |
-
GNU General Public License for more details.
|
37 |
-
|
38 |
-
You should have received a copy of the GNU General Public License
|
39 |
-
along with this program; if not, write to the Free Software
|
40 |
-
Found
|
41 |
-
*/
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Handles the loading of our Fancy Template Selector
|
45 |
-
*
|
46 |
-
* @param {Object} $templateField The jQuery select box we should attach the fancy template selector to
|
47 |
-
*
|
48 |
-
* @since 4.1
|
49 |
-
*/
|
50 |
-
export default function templateBootstrap ($templateField) {
|
51 |
-
|
52 |
-
/* Combine our Redux Reducers */
|
53 |
-
const reducers = setupReducers()
|
54 |
-
|
55 |
-
/* Create our store and enable the Redux dev tools, if they exist */
|
56 |
-
const store = createStore(reducers, window.devToolsExtension && window.devToolsExtension())
|
57 |
-
|
58 |
-
/* Create our button container and render our component in it */
|
59 |
-
createTemplateMarkup($templateField)
|
60 |
-
|
61 |
-
/* Render our React Component in the DOM */
|
62 |
-
render(
|
63 |
-
<Router>
|
64 |
-
<Route render={(props) => <TemplateButton {...props} store={store} buttonText={GFPDF.advanced}/>} />
|
65 |
-
</Router>,
|
66 |
-
document.getElementById('gpdf-advance-template-selector')
|
67 |
-
)
|
68 |
-
|
69 |
-
/* Mount our router */
|
70 |
-
templateRouter(store)
|
71 |
-
|
72 |
-
/*
|
73 |
-
* Listen for Redux store updates and do DOM updates
|
74 |
-
*/
|
75 |
-
activeTemplateStoreListener(store, $templateField)
|
76 |
-
templateChangeStoreListener(store, $templateField)
|
77 |
-
}
|
78 |
-
|
79 |
-
/**
|
80 |
-
* Combine our Redux reducers for use in a single store
|
81 |
-
* If you want to add new top-level keys to our store, this is the place
|
82 |
-
*
|
83 |
-
* @returns {Function}
|
84 |
-
*
|
85 |
-
* @since 4.1
|
86 |
-
*/
|
87 |
-
export function setupReducers () {
|
88 |
-
return combineReducers({
|
89 |
-
template: templateReducer,
|
90 |
-
})
|
91 |
-
}
|
92 |
-
|
93 |
-
/**
|
94 |
-
* Dynamically add the required markup to attach our React components to.
|
95 |
-
*
|
96 |
-
* @param {Object} $templateField The jQuery select box we should attach the fancy template selector to
|
97 |
-
*
|
98 |
-
* @since 4.1
|
99 |
-
*/
|
100 |
-
export function createTemplateMarkup ($templateField) {
|
101 |
-
$templateField
|
102 |
-
.next()
|
103 |
-
.after('<span id="gpdf-advance-template-selector">')
|
104 |
-
.next()
|
105 |
-
.after('<div id="gfpdf-overlay" class="theme-overlay">')
|
106 |
-
}
|
107 |
-
|
108 |
-
/**
|
109 |
-
* Listen for updates to the template.activeTemplate data in our Redux store
|
110 |
-
* and update the select box value based on this change. Also, listen for changes
|
111 |
-
* to our select box and update the store when needed.
|
112 |
-
*
|
113 |
-
* @param {Object} store The Redux store returned from createStore()
|
114 |
-
* @param {Object} $templateField The jQuery select box we should attach the fancy template selector to
|
115 |
-
*
|
116 |
-
* @since 4.1
|
117 |
-
*/
|
118 |
-
export function activeTemplateStoreListener (store, $templateField) {
|
119 |
-
|
120 |
-
/* Watch our store for changes */
|
121 |
-
let w = watch(store.getState, 'template.activeTemplate')
|
122 |
-
store.subscribe(w((template) => {
|
123 |
-
|
124 |
-
/* Check store and DOM are different to prevent any update recursions */
|
125 |
-
if ($templateField.val() !== template) {
|
126 |
-
$templateField
|
127 |
-
.val(template)
|
128 |
-
.trigger('chosen:updated')
|
129 |
-
.trigger('change')
|
130 |
-
}
|
131 |
-
}))
|
132 |
-
|
133 |
-
/* Watch our DOM for changes */
|
134 |
-
$templateField.change(function () {
|
135 |
-
/* Check store and DOM are different to prevent any update recursions */
|
136 |
-
if (this.value !== store.getState().template.activeTemplate) {
|
137 |
-
store.dispatch(selectTemplate(this.value))
|
138 |
-
}
|
139 |
-
})
|
140 |
-
}
|
141 |
-
|
142 |
-
/**
|
143 |
-
* PHP builds the Select box DOM for the templates and when we add or delete a template we need to rebuild this.
|
144 |
-
* Instead of duplicating the code on both server and client side we do an AJAX call to get the new Selex box HTML when
|
145 |
-
* the template.list length changes and update the DOM accordingly.
|
146 |
-
*
|
147 |
-
* @param {Object} store The Redux store returned from createStore()
|
148 |
-
* @param {Object} $templateField The jQuery select box we should attach the fancy template selector to
|
149 |
-
*
|
150 |
-
* @since 4.1
|
151 |
-
*/
|
152 |
-
export function templateChangeStoreListener (store, $templateField) {
|
153 |
-
|
154 |
-
/* Track the initial list size */
|
155 |
-
let listCount = store.getState().template.list.size
|
156 |
-
|
157 |
-
/* Watch our store for changes */
|
158 |
-
let w = watch(store.getState, 'template.list')
|
159 |
-
store.subscribe(w((list) => {
|
160 |
-
|
161 |
-
/* Only update if the list size differs from what we expect */
|
162 |
-
if (listCount !== list.size) {
|
163 |
-
/* update the list size so we don't run it twice */
|
164 |
-
listCount = list.size
|
165 |
-
|
166 |
-
/* Do our AJAX call to get the new Select Box DOM */
|
167 |
-
request
|
168 |
-
.post(GFPDF.ajaxUrl)
|
169 |
-
.field('action', 'gfpdf_get_template_options')
|
170 |
-
.field('nonce', GFPDF.ajaxNonce)
|
171 |
-
.then((response) => {
|
172 |
-
$templateField
|
173 |
-
.html(response.text)
|
174 |
-
.trigger('chosen:updated')
|
175 |
-
.trigger('change')
|
176 |
-
})
|
177 |
-
}
|
178 |
-
}))
|
179 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/react/components/Dropzone.js
DELETED
@@ -1,79 +0,0 @@
|
|
1 |
-
import PropTypes from 'prop-types';
|
2 |
-
import React from 'react'
|
3 |
-
import ReactDropzone from 'react-dropzone'
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Our Drag and Drop File upload Component which is a wrapper
|
7 |
-
* for react-dropzone
|
8 |
-
*
|
9 |
-
* @package Gravity PDF
|
10 |
-
* @copyright Copyright (c) 2017, Blue Liquid Designs
|
11 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
12 |
-
* @since 4.1
|
13 |
-
*/
|
14 |
-
|
15 |
-
/*
|
16 |
-
This file is part of Gravity PDF.
|
17 |
-
|
18 |
-
Gravity PDF – Copyright (C) 2017, Blue Liquid Designs
|
19 |
-
|
20 |
-
This program is free software; you can redistribute it and/or modify
|
21 |
-
it under the terms of the GNU General Public License as published by
|
22 |
-
the Free Software Foundation; either version 2 of the License, or
|
23 |
-
(at your option) any later version.
|
24 |
-
|
25 |
-
This program is distributed in the hope that it will be useful,
|
26 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
27 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
28 |
-
GNU General Public License for more details.
|
29 |
-
|
30 |
-
You should have received a copy of the GNU General Public License
|
31 |
-
along with this program; if not, write to the Free Software
|
32 |
-
Found
|
33 |
-
*/
|
34 |
-
|
35 |
-
/**
|
36 |
-
* React Component
|
37 |
-
*
|
38 |
-
* @since 4.1
|
39 |
-
*/
|
40 |
-
class Dropzone extends React.Component {
|
41 |
-
/**
|
42 |
-
* @since 4.1
|
43 |
-
*/
|
44 |
-
static propTypes = {
|
45 |
-
children: PropTypes.node.isRequired,
|
46 |
-
onDrop: PropTypes.func.isRequired,
|
47 |
-
multiple: PropTypes.bool,
|
48 |
-
className: PropTypes.string,
|
49 |
-
activeClassName: PropTypes.string
|
50 |
-
};
|
51 |
-
|
52 |
-
/**
|
53 |
-
* @since 4.1
|
54 |
-
*/
|
55 |
-
static defaultProps = {
|
56 |
-
multiple: false,
|
57 |
-
maxSize: Infinity,
|
58 |
-
className: 'gfpdf-dropzone',
|
59 |
-
activeClassName: 'gfpdf-dropzone-active'
|
60 |
-
};
|
61 |
-
|
62 |
-
/**
|
63 |
-
* @since 4.1
|
64 |
-
*/
|
65 |
-
render() {
|
66 |
-
return (
|
67 |
-
<ReactDropzone
|
68 |
-
onDrop={this.props.onDrop}
|
69 |
-
multiple={this.props.multiple}
|
70 |
-
disablePreview={true}
|
71 |
-
className={this.props.className}
|
72 |
-
activeClassName={this.props.activeClassName}>
|
73 |
-
{this.props.children}
|
74 |
-
</ReactDropzone>
|
75 |
-
)
|
76 |
-
}
|
77 |
-
}
|
78 |
-
|
79 |
-
export default Dropzone
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/react/components/Empty.js
DELETED
@@ -1,37 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Render a blank component for use with React Router's default route
|
3 |
-
*
|
4 |
-
* @package Gravity PDF
|
5 |
-
* @copyright Copyright (c) 2017, Blue Liquid Designs
|
6 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
7 |
-
* @since 4.1
|
8 |
-
*/
|
9 |
-
|
10 |
-
/*
|
11 |
-
This file is part of Gravity PDF.
|
12 |
-
|
13 |
-
Gravity PDF – Copyright (C) 2017, Blue Liquid Designs
|
14 |
-
|
15 |
-
This program is free software; you can redistribute it and/or modify
|
16 |
-
it under the terms of the GNU General Public License as published by
|
17 |
-
the Free Software Foundation; either version 2 of the License, or
|
18 |
-
(at your option) any later version.
|
19 |
-
|
20 |
-
This program is distributed in the hope that it will be useful,
|
21 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23 |
-
GNU General Public License for more details.
|
24 |
-
|
25 |
-
You should have received a copy of the GNU General Public License
|
26 |
-
along with this program; if not, write to the Free Software
|
27 |
-
Found
|
28 |
-
*/
|
29 |
-
|
30 |
-
/**
|
31 |
-
* React Component
|
32 |
-
*
|
33 |
-
* @since 4.1
|
34 |
-
*/
|
35 |
-
export default () => {
|
36 |
-
return false
|
37 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/react/components/ShowMessage.js
DELETED
@@ -1,167 +0,0 @@
|
|
1 |
-
import PropTypes from 'prop-types';
|
2 |
-
import React from 'react'
|
3 |
-
import $ from 'jquery'
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Renders a message or error, with the option to self-clear itself
|
7 |
-
*
|
8 |
-
* @package Gravity PDF
|
9 |
-
* @copyright Copyright (c) 2017, Blue Liquid Designs
|
10 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
-
* @since 4.1
|
12 |
-
*/
|
13 |
-
|
14 |
-
/*
|
15 |
-
This file is part of Gravity PDF.
|
16 |
-
|
17 |
-
Gravity PDF – Copyright (C) 2017, Blue Liquid Designs
|
18 |
-
|
19 |
-
This program is free software; you can redistribute it and/or modify
|
20 |
-
it under the terms of the GNU General Public License as published by
|
21 |
-
the Free Software Foundation; either version 2 of the License, or
|
22 |
-
(at your option) any later version.
|
23 |
-
|
24 |
-
This program is distributed in the hope that it will be useful,
|
25 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
26 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
27 |
-
GNU General Public License for more details.
|
28 |
-
|
29 |
-
You should have received a copy of the GNU General Public License
|
30 |
-
along with this program; if not, write to the Free Software
|
31 |
-
Found
|
32 |
-
*/
|
33 |
-
|
34 |
-
/**
|
35 |
-
* React Component
|
36 |
-
*
|
37 |
-
* @since 4.1
|
38 |
-
*/
|
39 |
-
class showMessage extends React.Component {
|
40 |
-
/**
|
41 |
-
* Pass the "dismissable" prop to enable auto-clearing
|
42 |
-
*
|
43 |
-
* @returns {{delay: number, dismissable: boolean}}
|
44 |
-
*
|
45 |
-
* @since 4.1
|
46 |
-
*/
|
47 |
-
static defaultProps = {
|
48 |
-
delay: 4000,
|
49 |
-
dismissable: false,
|
50 |
-
};
|
51 |
-
|
52 |
-
/**
|
53 |
-
* @since 4.1
|
54 |
-
*/
|
55 |
-
static propTypes = {
|
56 |
-
text: PropTypes.string.isRequired,
|
57 |
-
error: PropTypes.bool,
|
58 |
-
|
59 |
-
delay: PropTypes.number,
|
60 |
-
dismissable: PropTypes.bool,
|
61 |
-
dismissableCallback: PropTypes.func,
|
62 |
-
};
|
63 |
-
|
64 |
-
/**
|
65 |
-
* @returns {{visible: boolean}}
|
66 |
-
*
|
67 |
-
* @since 4.1
|
68 |
-
*/
|
69 |
-
state = {
|
70 |
-
visible: true
|
71 |
-
};
|
72 |
-
|
73 |
-
/**
|
74 |
-
* Resets our state and timer when new props received
|
75 |
-
*
|
76 |
-
* @since 4.1
|
77 |
-
*/
|
78 |
-
componentWillReceiveProps() {
|
79 |
-
this.setState({ visible: true })
|
80 |
-
this.shouldSetTimer()
|
81 |
-
}
|
82 |
-
|
83 |
-
/**
|
84 |
-
* On mount, maybe set dismissable timer
|
85 |
-
*
|
86 |
-
* @since 4.1
|
87 |
-
*/
|
88 |
-
componentDidMount() {
|
89 |
-
this.shouldSetTimer()
|
90 |
-
}
|
91 |
-
|
92 |
-
/**
|
93 |
-
* Check if we should make the message auto-dismissable
|
94 |
-
*
|
95 |
-
* @since 4.1
|
96 |
-
*/
|
97 |
-
shouldSetTimer = () => {
|
98 |
-
if (this.props.dismissable) {
|
99 |
-
this.setTimer()
|
100 |
-
}
|
101 |
-
};
|
102 |
-
|
103 |
-
/**
|
104 |
-
* Slide message up after "X" milliseconds (see props.delay)
|
105 |
-
* and triggers callback if passed in (see props.dismissableCallback)
|
106 |
-
*
|
107 |
-
* Also clears the initial timeout if called multiple times before removal
|
108 |
-
*
|
109 |
-
* @since 4.1
|
110 |
-
*/
|
111 |
-
setTimer = () => {
|
112 |
-
// clear any existing timer
|
113 |
-
this._timer != null ? clearTimeout(this._timer) : null
|
114 |
-
|
115 |
-
// hide after `delay` milliseconds
|
116 |
-
this._timer = setTimeout(() => {
|
117 |
-
|
118 |
-
$(this._message)
|
119 |
-
.removeClass('inline')
|
120 |
-
.slideUp(400, () => {
|
121 |
-
$(this._message).removeAttr('style')
|
122 |
-
this.setState({ visible: false })
|
123 |
-
this._timer = null
|
124 |
-
|
125 |
-
if(this.props.dismissableCallback) {
|
126 |
-
this.props.dismissableCallback()
|
127 |
-
}
|
128 |
-
})
|
129 |
-
|
130 |
-
}, this.props.delay)
|
131 |
-
};
|
132 |
-
|
133 |
-
/**
|
134 |
-
* Clear timeout on unmount
|
135 |
-
*
|
136 |
-
* @since 4.1
|
137 |
-
*/
|
138 |
-
componentWillUnmount() {
|
139 |
-
if (this.props.dismissable) {
|
140 |
-
clearTimeout(this._timer)
|
141 |
-
}
|
142 |
-
}
|
143 |
-
|
144 |
-
/**
|
145 |
-
* Renders our message or error
|
146 |
-
*
|
147 |
-
* @since 4.1
|
148 |
-
*/
|
149 |
-
render() {
|
150 |
-
const { text, error } = this.props
|
151 |
-
|
152 |
-
let classes = 'notice inline'
|
153 |
-
|
154 |
-
if (error) {
|
155 |
-
classes = classes + ' error'
|
156 |
-
}
|
157 |
-
|
158 |
-
return this.state.visible ?
|
159 |
-
(
|
160 |
-
<div ref={(message) => this._message = message} className={classes}>
|
161 |
-
<p>{text}</p>
|
162 |
-
</div>
|
163 |
-
) : <div />
|
164 |
-
}
|
165 |
-
}
|
166 |
-
|
167 |
-
export default showMessage
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/react/components/TemplateActivateButton.js
DELETED
@@ -1,106 +0,0 @@
|
|
1 |
-
import PropTypes from 'prop-types';
|
2 |
-
import React from 'react'
|
3 |
-
import { connect } from 'react-redux'
|
4 |
-
import { selectTemplate } from '../actions/templates'
|
5 |
-
import { withRouter } from 'react-router-dom'
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Renders the button used to trigger the current active PDF template
|
9 |
-
* On click it triggers our Redux action.
|
10 |
-
*
|
11 |
-
* @package Gravity PDF
|
12 |
-
* @copyright Copyright (c) 2017, Blue Liquid Designs
|
13 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
14 |
-
* @since 4.1
|
15 |
-
*/
|
16 |
-
|
17 |
-
/*
|
18 |
-
This file is part of Gravity PDF.
|
19 |
-
|
20 |
-
Gravity PDF – Copyright (C) 2017, Blue Liquid Designs
|
21 |
-
|
22 |
-
This program is free software; you can redistribute it and/or modify
|
23 |
-
it under the terms of the GNU General Public License as published by
|
24 |
-
the Free Software Foundation; either version 2 of the License, or
|
25 |
-
(at your option) any later version.
|
26 |
-
|
27 |
-
This program is distributed in the hope that it will be useful,
|
28 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
29 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
30 |
-
GNU General Public License for more details.
|
31 |
-
|
32 |
-
You should have received a copy of the GNU General Public License
|
33 |
-
along with this program; if not, write to the Free Software
|
34 |
-
Found
|
35 |
-
*/
|
36 |
-
|
37 |
-
/**
|
38 |
-
* React Component
|
39 |
-
*
|
40 |
-
* @since 4.1
|
41 |
-
*/
|
42 |
-
export class TemplateActivateButton extends React.Component {
|
43 |
-
/**
|
44 |
-
* @since 4.1
|
45 |
-
*/
|
46 |
-
static propTypes = {
|
47 |
-
template: PropTypes.object,
|
48 |
-
onTemplateSelect: PropTypes.func,
|
49 |
-
buttonText: PropTypes.string,
|
50 |
-
};
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Update our route and trigger a Redux action to select the current template
|
54 |
-
*
|
55 |
-
* @param {Object} e Event
|
56 |
-
*
|
57 |
-
* @since 4.1
|
58 |
-
*/
|
59 |
-
selectTemplate = (e) => {
|
60 |
-
e.preventDefault()
|
61 |
-
e.stopPropagation()
|
62 |
-
|
63 |
-
this.props.history.push('')
|
64 |
-
this.props.onTemplateSelect(this.props.template.get('id'))
|
65 |
-
};
|
66 |
-
|
67 |
-
/**
|
68 |
-
* @since 4.1
|
69 |
-
*/
|
70 |
-
render() {
|
71 |
-
return (
|
72 |
-
<a
|
73 |
-
onClick={this.selectTemplate}
|
74 |
-
href="#"
|
75 |
-
tabIndex="150"
|
76 |
-
className="button button-primary activate">
|
77 |
-
{this.props.buttonText}
|
78 |
-
</a>
|
79 |
-
)
|
80 |
-
}
|
81 |
-
}
|
82 |
-
|
83 |
-
/**
|
84 |
-
* Map actions to props
|
85 |
-
*
|
86 |
-
* @param {func} dispatch Redux dispatcher
|
87 |
-
*
|
88 |
-
* @returns {{onTemplateSelect: (function(id=string))}}
|
89 |
-
*
|
90 |
-
* @since 4.1
|
91 |
-
*/
|
92 |
-
const mapDispatchToProps = (dispatch) => {
|
93 |
-
return {
|
94 |
-
onTemplateSelect: (id) => {
|
95 |
-
dispatch(selectTemplate(id))
|
96 |
-
}
|
97 |
-
}
|
98 |
-
}
|
99 |
-
|
100 |
-
/**
|
101 |
-
* Maps our Redux store to our React component
|
102 |
-
*
|
103 |
-
* @since 4.1
|
104 |
-
*/
|
105 |
-
export default withRouter(connect(null, mapDispatchToProps)(TemplateActivateButton))
|
106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/react/components/TemplateButton.js
DELETED
@@ -1,78 +0,0 @@
|
|
1 |
-
import PropTypes from 'prop-types';
|
2 |
-
import React from 'react'
|
3 |
-
|
4 |
-
/**
|
5 |
-
* Render the button used to option our Fancy PDF template selector
|
6 |
-
*
|
7 |
-
* @package Gravity PDF
|
8 |
-
* @copyright Copyright (c) 2017, Blue Liquid Designs
|
9 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
10 |
-
* @since 4.1
|
11 |
-
*/
|
12 |
-
|
13 |
-
/*
|
14 |
-
This file is part of Gravity PDF.
|
15 |
-
|
16 |
-
Gravity PDF – Copyright (C) 2017, Blue Liquid Designs
|
17 |
-
|
18 |
-
This program is free software; you can redistribute it and/or modify
|
19 |
-
it under the terms of the GNU General Public License as published by
|
20 |
-
the Free Software Foundation; either version 2 of the License, or
|
21 |
-
(at your option) any later version.
|
22 |
-
|
23 |
-
This program is distributed in the hope that it will be useful,
|
24 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
GNU General Public License for more details.
|
27 |
-
|
28 |
-
You should have received a copy of the GNU General Public License
|
29 |
-
along with this program; if not, write to the Free Software
|
30 |
-
Found
|
31 |
-
*/
|
32 |
-
|
33 |
-
/**
|
34 |
-
* React Component
|
35 |
-
*
|
36 |
-
* @since 4.1
|
37 |
-
*/
|
38 |
-
class TemplateButton extends React.Component {
|
39 |
-
/**
|
40 |
-
* @since 4.1
|
41 |
-
*/
|
42 |
-
static propTypes = {
|
43 |
-
buttonText: PropTypes.string,
|
44 |
-
};
|
45 |
-
|
46 |
-
/**
|
47 |
-
* When the button is clicked we'll display the `/template` route
|
48 |
-
*
|
49 |
-
* @param {Object} e Event
|
50 |
-
*
|
51 |
-
* @since 4.1
|
52 |
-
*/
|
53 |
-
handleClick = (e) => {
|
54 |
-
e.preventDefault()
|
55 |
-
e.stopPropagation()
|
56 |
-
|
57 |
-
this.props.history.push('/template')
|
58 |
-
};
|
59 |
-
|
60 |
-
/**
|
61 |
-
* @since 4.1
|
62 |
-
*/
|
63 |
-
render() {
|
64 |
-
return (
|
65 |
-
<button
|
66 |
-
type="button"
|
67 |
-
id="fancy-template-selector"
|
68 |
-
className="button gfpdf-button"
|
69 |
-
onClick={this.handleClick}
|
70 |
-
ref={node => this.button = node}
|
71 |
-
>
|
72 |
-
{this.props.buttonText}
|
73 |
-
</button>
|
74 |
-
)
|
75 |
-
}
|
76 |
-
}
|
77 |
-
|
78 |
-
export default TemplateButton
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/react/components/TemplateCloseDialog.js
DELETED
@@ -1,105 +0,0 @@
|
|
1 |
-
import PropTypes from 'prop-types';
|
2 |
-
import React from 'react'
|
3 |
-
import { withRouter } from 'react-router-dom'
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Renders our close dialog element
|
7 |
-
*
|
8 |
-
* @package Gravity PDF
|
9 |
-
* @copyright Copyright (c) 2017, Blue Liquid Designs
|
10 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
-
* @since 4.1
|
12 |
-
*/
|
13 |
-
|
14 |
-
/*
|
15 |
-
This file is part of Gravity PDF.
|
16 |
-
|
17 |
-
Gravity PDF – Copyright (C) 2017, Blue Liquid Designs
|
18 |
-
|
19 |
-
This program is free software; you can redistribute it and/or modify
|
20 |
-
it under the terms of the GNU General Public License as published by
|
21 |
-
the Free Software Foundation; either version 2 of the License, or
|
22 |
-
(at your option) any later version.
|
23 |
-
|
24 |
-
This program is distributed in the hope that it will be useful,
|
25 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
26 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
27 |
-
GNU General Public License for more details.
|
28 |
-
|
29 |
-
You should have received a copy of the GNU General Public License
|
30 |
-
along with this program; if not, write to the Free Software
|
31 |
-
Found
|
32 |
-
*/
|
33 |
-
|
34 |
-
/**
|
35 |
-
* React Component
|
36 |
-
*
|
37 |
-
* @since 4.1
|
38 |
-
*/
|
39 |
-
export class TemplateCloseDialog extends React.Component {
|
40 |
-
/**
|
41 |
-
* @since 4.1
|
42 |
-
*/
|
43 |
-
static propTypes = {
|
44 |
-
closeRoute: PropTypes.string
|
45 |
-
};
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Assign keydown listener to document on mount
|
49 |
-
*
|
50 |
-
* @since 4.1
|
51 |
-
*/
|
52 |
-
componentDidMount() {
|
53 |
-
document.addEventListener('keydown', this.handleKeyPress, false)
|
54 |
-
}
|
55 |
-
|
56 |
-
/**
|
57 |
-
* Remove keydown listener to document on mount
|
58 |
-
*
|
59 |
-
* @since 4.1
|
60 |
-
*/
|
61 |
-
componentWillUnmount() {
|
62 |
-
document.removeEventListener('keydown', this.handleKeyPress, false)
|
63 |
-
}
|
64 |
-
|
65 |
-
/**
|
66 |
-
* Check if Escape key pressed and current event target isn't our search box,
|
67 |
-
* or the search box is blank already
|
68 |
-
*
|
69 |
-
* @param {Object} e Event
|
70 |
-
*
|
71 |
-
* @since 4.1
|
72 |
-
*/
|
73 |
-
handleKeyPress = (e) => {
|
74 |
-
/* Escape Key */
|
75 |
-
if (e.keyCode === 27 && (e.target.className !== 'wp-filter-search' || e.target.value === '')) {
|
76 |
-
this.closeDialog()
|
77 |
-
}
|
78 |
-
};
|
79 |
-
|
80 |
-
/**
|
81 |
-
* @since 4.1
|
82 |
-
*/
|
83 |
-
closeDialog = () => {
|
84 |
-
/* trigger router */
|
85 |
-
this.props.history.push(this.props.closeRoute || '/')
|
86 |
-
};
|
87 |
-
|
88 |
-
/**
|
89 |
-
* @since 4.1
|
90 |
-
*/
|
91 |
-
render() {
|
92 |
-
return (
|
93 |
-
<button
|
94 |
-
className="close dashicons dashicons-no"
|
95 |
-
tabIndex="142"
|
96 |
-
onClick={this.closeDialog}
|
97 |
-
onKeyDown={this.handleKeyPress}
|
98 |
-
aria-label="close">
|
99 |
-
<span className="screen-reader-text">Close dialog</span>
|
100 |
-
</button>
|
101 |
-
)
|
102 |
-
}
|
103 |
-
}
|
104 |
-
|
105 |
-
export default withRouter(TemplateCloseDialog)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/react/components/TemplateContainer.js
DELETED
@@ -1,122 +0,0 @@
|
|
1 |
-
import PropTypes from 'prop-types';
|
2 |
-
import React from 'react'
|
3 |
-
import TemplateCloseDialog from './TemplateCloseDialog'
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Renders our Advanced Template Selector container which is shared amongst the components
|
7 |
-
*
|
8 |
-
* @package Gravity PDF
|
9 |
-
* @copyright Copyright (c) 2017, Blue Liquid Designs
|
10 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
-
* @since 4.1
|
12 |
-
*/
|
13 |
-
|
14 |
-
/*
|
15 |
-
This file is part of Gravity PDF.
|
16 |
-
|
17 |
-
Gravity PDF – Copyright (C) 2017, Blue Liquid Designs
|
18 |
-
|
19 |
-
This program is free software; you can redistribute it and/or modify
|
20 |
-
it under the terms of the GNU General Public License as published by
|
21 |
-
the Free Software Foundation; either version 2 of the License, or
|
22 |
-
(at your option) any later version.
|
23 |
-
|
24 |
-
This program is distributed in the hope that it will be useful,
|
25 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
26 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
27 |
-
GNU General Public License for more details.
|
28 |
-
|
29 |
-
You should have received a copy of the GNU General Public License
|
30 |
-
along with this program; if not, write to the Free Software
|
31 |
-
Found
|
32 |
-
*/
|
33 |
-
|
34 |
-
/**
|
35 |
-
* React Component
|
36 |
-
*
|
37 |
-
* @since 4.1
|
38 |
-
*/
|
39 |
-
class Container extends React.Component {
|
40 |
-
/**
|
41 |
-
* @since 4.1
|
42 |
-
*/
|
43 |
-
static propTypes = {
|
44 |
-
header: PropTypes.oneOfType([ PropTypes.string, PropTypes.element ]),
|
45 |
-
footer: PropTypes.oneOfType([ PropTypes.string, PropTypes.element ]),
|
46 |
-
children: PropTypes.node.isRequired,
|
47 |
-
closeRoute: PropTypes.string,
|
48 |
-
};
|
49 |
-
|
50 |
-
/**
|
51 |
-
* On mount, add focus event to document option on mount
|
52 |
-
* Also, if focus isn't currently applied to the search box we'll apply it
|
53 |
-
* to our container to help with tabbing between elements
|
54 |
-
*
|
55 |
-
* @since 4.1
|
56 |
-
*/
|
57 |
-
componentDidMount() {
|
58 |
-
document.addEventListener('focus', this.handleFocus, true)
|
59 |
-
|
60 |
-
/* Add focus if not currently applied to search box */
|
61 |
-
if (document.activeElement && document.activeElement.className !== 'wp-filter-search') {
|
62 |
-
this.container.focus()
|
63 |
-
}
|
64 |
-
}
|
65 |
-
|
66 |
-
/**
|
67 |
-
* Cleanup our document event listeners
|
68 |
-
*
|
69 |
-
* @since 4.1
|
70 |
-
*/
|
71 |
-
componentWillUnmount() {
|
72 |
-
document.removeEventListener('focus', this.handleFocus, true)
|
73 |
-
}
|
74 |
-
|
75 |
-
/**
|
76 |
-
* When a focus event is fired and it's not apart of any DOM elements in our
|
77 |
-
* container we will focus the container instead. In most cases this keeps the focus from
|
78 |
-
* jumping outside our Template Container and allows for better keyboard navigation.
|
79 |
-
*
|
80 |
-
* @param e
|
81 |
-
*
|
82 |
-
* @since 4.1
|
83 |
-
*/
|
84 |
-
handleFocus = (e) => {
|
85 |
-
if (!this.container.contains(e.target)) {
|
86 |
-
e.stopPropagation()
|
87 |
-
this.container.focus()
|
88 |
-
}
|
89 |
-
};
|
90 |
-
|
91 |
-
/**
|
92 |
-
* @since 4.1
|
93 |
-
*/
|
94 |
-
render() {
|
95 |
-
const header = this.props.header,
|
96 |
-
footer = this.props.footer,
|
97 |
-
children = this.props.children,
|
98 |
-
closeRoute = this.props.closeRoute
|
99 |
-
|
100 |
-
return (
|
101 |
-
<div ref={node => this.container = node} tabIndex="140">
|
102 |
-
<div className="backdrop theme-backdrop"></div>
|
103 |
-
<div className="container theme-wrap">
|
104 |
-
<div className="theme-header">
|
105 |
-
{header}
|
106 |
-
<TemplateCloseDialog closeRoute={closeRoute}/>
|
107 |
-
</div>
|
108 |
-
|
109 |
-
<div
|
110 |
-
id="gfpdf-template-container"
|
111 |
-
className="theme-about wp-clearfix theme-browser rendered">
|
112 |
-
{children}
|
113 |
-
</div>
|
114 |
-
|
115 |
-
{footer}
|
116 |
-
</div>
|
117 |
-
</div>
|
118 |
-
)
|
119 |
-
}
|
120 |
-
}
|
121 |
-
|
122 |
-
export default Container
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/react/components/TemplateDeleteButton.js
DELETED
@@ -1,153 +0,0 @@
|
|
1 |
-
import PropTypes from 'prop-types';
|
2 |
-
import React from 'react'
|
3 |
-
import { connect } from 'react-redux'
|
4 |
-
import { addTemplate, deleteTemplate } from '../actions/templates'
|
5 |
-
import { withRouter } from 'react-router-dom'
|
6 |
-
import request from 'superagent'
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Renders a delete button which then queries our server and
|
10 |
-
* removes the selected PDF template
|
11 |
-
*
|
12 |
-
* @package Gravity PDF
|
13 |
-
* @copyright Copyright (c) 2017, Blue Liquid Designs
|
14 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
15 |
-
* @since 4.1
|
16 |
-
*/
|
17 |
-
|
18 |
-
/*
|
19 |
-
This file is part of Gravity PDF.
|
20 |
-
|
21 |
-
Gravity PDF – Copyright (C) 2017, Blue Liquid Designs
|
22 |
-
|
23 |
-
This program is free software; you can redistribute it and/or modify
|
24 |
-
it under the terms of the GNU General Public License as published by
|
25 |
-
the Free Software Foundation; either version 2 of the License, or
|
26 |
-
(at your option) any later version.
|
27 |
-
|
28 |
-
This program is distributed in the hope that it will be useful,
|
29 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
30 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
31 |
-
GNU General Public License for more details.
|
32 |
-
|
33 |
-
You should have received a copy of the GNU General Public License
|
34 |
-
along with this program; if not, write to the Free Software
|
35 |
-
Found
|
36 |
-
*/
|
37 |
-
|
38 |
-
/**
|
39 |
-
* React Component
|
40 |
-
*
|
41 |
-
* @since 4.1
|
42 |
-
*/
|
43 |
-
export class TemplateDeleteButton extends React.Component {
|
44 |
-
/**
|
45 |
-
* @since 4.1
|
46 |
-
*/
|
47 |
-
static propTypes = {
|
48 |
-
ajaxUrl: PropTypes.string,
|
49 |
-
ajaxNonce: PropTypes.string,
|
50 |
-
|
51 |
-
template: PropTypes.object,
|
52 |
-
addTemplate: PropTypes.func,
|
53 |
-
onTemplateDelete: PropTypes.func,
|
54 |
-
callbackFunction: PropTypes.func,
|
55 |
-
|
56 |
-
buttonText: PropTypes.string,
|
57 |
-
templateConfirmDeleteText: PropTypes.string,
|
58 |
-
templateDeleteErrorText: PropTypes.string,
|
59 |
-
};
|
60 |
-
|
61 |
-
/**
|
62 |
-
* Display a confirmation window asking user to verify they want template deleted.
|
63 |
-
*
|
64 |
-
* Once verified, we make an AJAX call to the server requesting template to be deleted.
|
65 |
-
*
|
66 |
-
* Before we receive the response we remove the PDF template automatically and update the
|
67 |
-
* URL to /template. If the AJAX call fails the PDF template gets restored to our list with
|
68 |
-
* an appropriate error message (it feels snapper this way).
|
69 |
-
*
|
70 |
-
* @param {Object} e Event
|
71 |
-
*/
|
72 |
-
deleteTemplate = (e) => {
|
73 |
-
e.preventDefault()
|
74 |
-
e.stopPropagation()
|
75 |
-
|
76 |
-
if (window.confirm(this.props.templateConfirmDeleteText)) {
|
77 |
-
|
78 |
-
const templateId = this.props.template.get('id')
|
79 |
-
|
80 |
-
/* POST the PDF template to our endpoint for processing */
|
81 |
-
request
|
82 |
-
.post(this.props.ajaxUrl)
|
83 |
-
.field('action', 'gfpdf_delete_template')
|
84 |
-
.field('nonce', this.props.ajaxNonce)
|
85 |
-
.field('id', templateId)
|
86 |
-
.then(
|
87 |
-
() => { /* success. Leave blank */},
|
88 |
-
this.ajaxFailed
|
89 |
-
)
|
90 |
-
|
91 |
-
this.props.history.push('/template')
|
92 |
-
this.props.onTemplateDelete(templateId)
|
93 |
-
}
|
94 |
-
};
|
95 |
-
|
96 |
-
/**
|
97 |
-
* If the server cannot delete the template we re-add the template to our list
|
98 |
-
* and display an appropriate inline error message
|
99 |
-
*
|
100 |
-
* @since 4.1
|
101 |
-
*/
|
102 |
-
ajaxFailed = () => {
|
103 |
-
const errorTemplate = this.props.template.set('error', this.props.templateDeleteErrorText)
|
104 |
-
this.props.addTemplate(errorTemplate)
|
105 |
-
};
|
106 |
-
|
107 |
-
/**
|
108 |
-
* @since 4.1
|
109 |
-
*/
|
110 |
-
render() {
|
111 |
-
|
112 |
-
const callback = (this.props.callbackFunction) ? this.props.callbackFunction : this.deleteTemplate
|
113 |
-
|
114 |
-
return (
|
115 |
-
<a
|
116 |
-
onClick={callback}
|
117 |
-
href="#"
|
118 |
-
tabIndex="150"
|
119 |
-
className="button button-secondary delete-theme">
|
120 |
-
{this.props.buttonText}
|
121 |
-
</a>
|
122 |
-
)
|
123 |
-
}
|
124 |
-
}
|
125 |
-
|
126 |
-
/**
|
127 |
-
* Map actions to props
|
128 |
-
*
|
129 |
-
* @param {func} dispatch Redux dispatcher
|
130 |
-
*
|
131 |
-
* @returns {{addTemplate: (function(template=Immutable List)), onTemplateDelete: (function(id=string))}}
|
132 |
-
*
|
133 |
-
* @since 4.1
|
134 |
-
*/
|
135 |
-
const mapDispatchToProps = (dispatch) => {
|
136 |
-
return {
|
137 |
-
addTemplate: (template) => {
|
138 |
-
dispatch(addTemplate(template))
|
139 |
-
},
|
140 |
-
|
141 |
-
onTemplateDelete: (id) => {
|
142 |
-
dispatch(deleteTemplate(id))
|
143 |
-
}
|
144 |
-
}
|
145 |
-
}
|
146 |
-
|
147 |
-
/**
|
148 |
-
* Maps our Redux store to our React component
|
149 |
-
*
|
150 |
-
* @since 4.1
|
151 |
-
*/
|
152 |
-
export default withRouter(connect(null, mapDispatchToProps)(TemplateDeleteButton))
|
153 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/react/components/TemplateFooterActions.js
DELETED
@@ -1,106 +0,0 @@
|
|
1 |
-
import PropTypes from 'prop-types';
|
2 |
-
import React from 'react'
|
3 |
-
import TemplateActivateButton from './TemplateActivateButton'
|
4 |
-
import TemplateDeleteButton from './TemplateDeleteButton'
|
5 |
-
|
6 |
-
/**
|
7 |
-
* Renders the template footer actions that get displayed on the
|
8 |
-
* /template/:id pages.
|
9 |
-
*
|
10 |
-
* @package Gravity PDF
|
11 |
-
* @copyright Copyright (c) 2017, Blue Liquid Designs
|
12 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
-
* @since 4.1
|
14 |
-
*/
|
15 |
-
|
16 |
-
/*
|
17 |
-
This file is part of Gravity PDF.
|
18 |
-
|
19 |
-
Gravity PDF – Copyright (C) 2017, Blue Liquid Designs
|
20 |
-
|
21 |
-
This program is free software; you can redistribute it and/or modify
|
22 |
-
it under the terms of the GNU General Public License as published by
|
23 |
-
the Free Software Foundation; either version 2 of the License, or
|
24 |
-
(at your option) any later version.
|
25 |
-
|
26 |
-
This program is distributed in the hope that it will be useful,
|
27 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
28 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
29 |
-
GNU General Public License for more details.
|
30 |
-
|
31 |
-
You should have received a copy of the GNU General Public License
|
32 |
-
along with this program; if not, write to the Free Software
|
33 |
-
Found
|
34 |
-
*/
|
35 |
-
|
36 |
-
/**
|
37 |
-
* React Component
|
38 |
-
*
|
39 |
-
* @since 4.1
|
40 |
-
*/
|
41 |
-
class TemplateFooterActions extends React.Component {
|
42 |
-
/**
|
43 |
-
* @since 4.1
|
44 |
-
*/
|
45 |
-
static propTypes = {
|
46 |
-
template: PropTypes.object.isRequired,
|
47 |
-
isActiveTemplate: PropTypes.bool,
|
48 |
-
|
49 |
-
ajaxUrl: PropTypes.string,
|
50 |
-
ajaxNonce: PropTypes.string,
|
51 |
-
|
52 |
-
activateText: PropTypes.string,
|
53 |
-
pdfWorkingDirPath: PropTypes.string,
|
54 |
-
templateDeleteText: PropTypes.string,
|
55 |
-
templateConfirmDeleteText: PropTypes.string,
|
56 |
-
templateDeleteErrorText: PropTypes.string,
|
57 |
-
};
|
58 |
-
|
59 |
-
/**
|
60 |
-
* Check if the current PDF template is a core template or not (i.e is shipped with Gravity PDF)
|
61 |
-
*
|
62 |
-
* @param {Object} template Immutable Map
|
63 |
-
*
|
64 |
-
* @returns {boolean}
|
65 |
-
*
|
66 |
-
* @since 4.1
|
67 |
-
*/
|
68 |
-
notCoreTemplate = (template) => {
|
69 |
-
return template.get('path').indexOf(this.props.pdfWorkingDirPath) !== -1
|
70 |
-
};
|
71 |
-
|
72 |
-
/**
|
73 |
-
* @since 4.1
|
74 |
-
*/
|
75 |
-
render() {
|
76 |
-
const template = this.props.template
|
77 |
-
const isCompatible = template.get('compatible')
|
78 |
-
|
79 |
-
return (
|
80 |
-
<div className="theme-actions">
|
81 |
-
{!this.props.isActiveTemplate && isCompatible ?
|
82 |
-
<TemplateActivateButton
|
83 |
-
template={template}
|
84 |
-
buttonText={this.props.activateText}/>
|
85 |
-
: null
|
86 |
-
}
|
87 |
-
|
88 |
-
{!this.props.isActiveTemplate && this.notCoreTemplate(template) ?
|
89 |
-
<TemplateDeleteButton
|
90 |
-
template={template}
|
91 |
-
|
92 |
-
ajaxUrl={this.props.ajaxUrl}
|
93 |
-
ajaxNonce={this.props.ajaxNonce}
|
94 |
-
|
95 |
-
buttonText={this.props.templateDeleteText}
|
96 |
-
templateConfirmDeleteText={this.props.templateConfirmDeleteText}
|
97 |
-
templateDeleteErrorText={this.props.templateDeleteErrorText}/>
|
98 |
-
: null
|
99 |
-
}
|
100 |
-
</div>
|
101 |
-
)
|
102 |
-
}
|
103 |
-
}
|
104 |
-
|
105 |
-
export default TemplateFooterActions
|
106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/react/components/TemplateHeaderNavigation.js
DELETED
@@ -1,210 +0,0 @@
|
|
1 |
-
import PropTypes from 'prop-types';
|
2 |
-
import React from 'react'
|
3 |
-
import { connect } from 'react-redux'
|
4 |
-
import { withRouter } from 'react-router-dom'
|
5 |
-
import { List } from 'immutable'
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Renders the template navigation header that get displayed on the
|
9 |
-
* /template/:id pages.
|
10 |
-
*
|
11 |
-
* @package Gravity PDF
|
12 |
-
* @copyright Copyright (c) 2017, Blue Liquid Designs
|
13 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
14 |
-
* @since 4.1
|
15 |
-
*/
|
16 |
-
|
17 |
-
/*
|
18 |
-
This file is part of Gravity PDF.
|
19 |
-
|
20 |
-
Gravity PDF – Copyright (C) 2017, Blue Liquid Designs
|
21 |
-
|
22 |
-
This program is free software; you can redistribute it and/or modify
|
23 |
-
it under the terms of the GNU General Public License as published by
|
24 |
-
the Free Software Foundation; either version 2 of the License, or
|
25 |
-
(at your option) any later version.
|
26 |
-
|
27 |
-
This program is distributed in the hope that it will be useful,
|
28 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
29 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
30 |
-
GNU General Public License for more details.
|
31 |
-
|
32 |
-
You should have received a copy of the GNU General Public License
|
33 |
-
along with this program; if not, write to the Free Software
|
34 |
-
Found
|
35 |
-
*/
|
36 |
-
|
37 |
-
/**
|
38 |
-
* React Component
|
39 |
-
*
|
40 |
-
* @since 4.1
|
41 |
-
*/
|
42 |
-
export class TemplateHeaderNavigation extends React.Component {
|
43 |
-
/**
|
44 |
-
* @since 4.1
|
45 |
-
*/
|
46 |
-
static propTypes = {
|
47 |
-
templates: PropTypes.object.isRequired,
|
48 |
-
templateIndex: PropTypes.number.isRequired,
|
49 |
-
isFirst: PropTypes.bool,
|
50 |
-
isLast: PropTypes.bool,
|
51 |
-
|
52 |
-
showPreviousTemplateText: PropTypes.string,
|
53 |
-
showNextTemplateText: PropTypes.string
|
54 |
-
};
|
55 |
-
|
56 |
-
/**
|
57 |
-
* Add window event listeners
|
58 |
-
*
|
59 |
-
* @since 4.1
|
60 |
-
*/
|
61 |
-
componentDidMount() {
|
62 |
-
window.addEventListener('keydown', this.handleKeyPress, false)
|
63 |
-
}
|
64 |
-
|
65 |
-
/**
|
66 |
-
* Cleanup window event listeners
|
67 |
-
*
|
68 |
-
* @since 4.1
|
69 |
-
*/
|
70 |
-
componentWillUnmount() {
|
71 |
-
window.removeEventListener('keydown', this.handleKeyPress, false)
|
72 |
-
}
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Attempt to get the previous template in our Immutable list and update the URL
|
76 |
-
*
|
77 |
-
* @param {Object} e Event
|
78 |
-
*
|
79 |
-
* @since 4.1
|
80 |
-
*/
|
81 |
-
previousTemplate = (e) => {
|
82 |
-
e.preventDefault()
|
83 |
-
e.stopPropagation()
|
84 |
-
|
85 |
-
const prevId = this.props.templates.get(this.props.templateIndex - 1).get('id')
|
86 |
-
|
87 |
-
if (prevId) {
|
88 |
-
this.props.history.push('/template/' + prevId)
|
89 |
-
}
|
90 |
-
};
|
91 |
-
|
92 |
-
/**
|
93 |
-
* Attempt to get the next template in our Immutable list and update the URL
|
94 |
-
*
|
95 |
-
* @param {Object} e Event
|
96 |
-
*
|
97 |
-
* @since 4.1
|
98 |
-
*/
|
99 |
-
nextTemplate = (e) => {
|
100 |
-
e.preventDefault()
|
101 |
-
e.stopPropagation()
|
102 |
-
|
103 |
-
const nextId = this.props.templates.get(this.props.templateIndex + 1).get('id')
|
104 |
-
|
105 |
-
if (nextId) {
|
106 |
-
this.props.history.push('/template/' + nextId)
|
107 |
-
}
|
108 |
-
};
|
109 |
-
|
110 |
-
/**
|
111 |
-
* Checks if the Left or Right arrow keys are pressed and fires appropriate functions
|
112 |
-
*
|
113 |
-
* @param {Object} e Event
|
114 |
-
*
|
115 |
-
* @since 4.1
|
116 |
-
*/
|
117 |
-
handleKeyPress = (e) => {
|
118 |
-
/* Left Arrow */
|
119 |
-
if (!this.props.isFirst && e.keyCode === 37) {
|
120 |
-
this.previousTemplate(e)
|
121 |
-
}
|
122 |
-
|
123 |
-
/* Right Arrow */
|
124 |
-
if (!this.props.isLast && e.keyCode === 39) {
|
125 |
-
this.nextTemplate(e)
|
126 |
-
}
|
127 |
-
};
|
128 |
-
|
129 |
-
/**
|
130 |
-
* @since 4.1
|
131 |
-
*/
|
132 |
-
render() {
|
133 |
-
|
134 |
-
/*
|
135 |
-
* Work our the correct classes and attributes for our left and right arrows
|
136 |
-
* based on if we are currently showing the first or last templates
|
137 |
-
*/
|
138 |
-
const isFirst = this.props.isFirst
|
139 |
-
const isLast = this.props.isLast
|
140 |
-
|
141 |
-
let baseClass = List([ 'dashicons', 'dashicons-no' ])
|
142 |
-
|
143 |
-
let prevClass = baseClass.push('left')
|
144 |
-
let nextClass = baseClass.push('right')
|
145 |
-
prevClass = (isFirst) ? prevClass.push('disabled') : prevClass
|
146 |
-
nextClass = (isLast) ? nextClass.push('disabled') : nextClass
|
147 |
-
|
148 |
-
let leftDisabled = (isFirst) ? 'disabled' : ''
|
149 |
-
let rightDisabled = (isLast) ? 'disabled' : ''
|
150 |
-
|
151 |
-
return (
|
152 |
-
<span>
|
153 |
-
<button
|
154 |
-
onClick={this.previousTemplate}
|
155 |
-
onKeyDown={this.handleKeyPress}
|
156 |
-
className={prevClass.join(' ')}
|
157 |
-
tabIndex="141"
|
158 |
-
disabled={leftDisabled}>
|
159 |
-
<span
|
160 |
-
className="screen-reader-text">
|
161 |
-
{this.props.showPreviousTemplateText}
|
162 |
-
</span>
|
163 |
-
</button>
|
164 |
-
|
165 |
-
<button
|
166 |
-
onClick={this.nextTemplate}
|
167 |
-
onKeyDown={this.handleKeyPress}
|
168 |
-
className={nextClass.join(' ')}
|
169 |
-
tabIndex="141"
|
170 |
-
disabled={rightDisabled}>
|
171 |
-
<span
|
172 |
-
className="screen-reader-text">
|
173 |
-
{this.props.showNextTemplateText}
|
174 |
-
</span>
|
175 |
-
</button>
|
176 |
-
</span>
|
177 |
-
)
|
178 |
-
}
|
179 |
-
}
|
180 |
-
|
181 |
-
/**
|
182 |
-
* Map state to props
|
183 |
-
*
|
184 |
-
* @param {Object} state The current Redux State
|
185 |
-
* @param {Object} props The current React props
|
186 |
-
*
|
187 |
-
* @returns {{isFirst: boolean, isLast: boolean}}
|
188 |
-
*
|
189 |
-
* @since 4.1
|
190 |
-
*/
|
191 |
-
const MapStateToProps = (state, props) => {
|
192 |
-
/* Check if the current template is the first or last in our templates */
|
193 |
-
const templates = props.templates
|
194 |
-
const currentTemplateId = props.template.get('id')
|
195 |
-
const first = templates.first().get('id')
|
196 |
-
const last = templates.last().get('id')
|
197 |
-
|
198 |
-
return {
|
199 |
-
isFirst: first === currentTemplateId,
|
200 |
-
isLast: last === currentTemplateId,
|
201 |
-
}
|
202 |
-
}
|
203 |
-
|
204 |
-
/**
|
205 |
-
* Maps our Redux store to our React component
|
206 |
-
*
|
207 |
-
* @since 4.1
|
208 |
-
*/
|
209 |
-
export default withRouter(connect(MapStateToProps)(TemplateHeaderNavigation))
|
210 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/react/components/TemplateHeaderTitle.js
DELETED
@@ -1,49 +0,0 @@
|
|
1 |
-
import PropTypes from 'prop-types';
|
2 |
-
import React from 'react'
|
3 |
-
|
4 |
-
/**
|
5 |
-
* Renders the Template Header Title
|
6 |
-
*
|
7 |
-
* @package Gravity PDF
|
8 |
-
* @copyright Copyright (c) 2017, Blue Liquid Designs
|
9 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
10 |
-
* @since 4.1
|
11 |
-
*/
|
12 |
-
|
13 |
-
/*
|
14 |
-
This file is part of Gravity PDF.
|
15 |
-
|
16 |
-
Gravity PDF – Copyright (C) 2017, Blue Liquid Designs
|
17 |
-
|
18 |
-
This program is free software; you can redistribute it and/or modify
|
19 |
-
it under the terms of the GNU General Public License as published by
|
20 |
-
the Free Software Foundation; either version 2 of the License, or
|
21 |
-
(at your option) any later version.
|
22 |
-
|
23 |
-
This program is distributed in the hope that it will be useful,
|
24 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
GNU General Public License for more details.
|
27 |
-
|
28 |
-
You should have received a copy of the GNU General Public License
|
29 |
-
along with this program; if not, write to the Free Software
|
30 |
-
Found
|
31 |
-
*/
|
32 |
-
|
33 |
-
/**
|
34 |
-
* React Component
|
35 |
-
*
|
36 |
-
* @since 4.1
|
37 |
-
*/
|
38 |
-
const TemplateHeaderTitle = ({ header }) => (
|
39 |
-
<h1>{header}</h1>
|
40 |
-
)
|
41 |
-
|
42 |
-
/**
|
43 |
-
* @since 4.1
|
44 |
-
*/
|
45 |
-
TemplateHeaderTitle.propTypes = {
|
46 |
-
header: PropTypes.string
|
47 |
-
}
|
48 |
-
|
49 |
-
export default TemplateHeaderTitle
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/react/components/TemplateList.js
DELETED
@@ -1,115 +0,0 @@
|
|
1 |
-
import PropTypes from 'prop-types';
|
2 |
-
import React from 'react'
|
3 |
-
import { connect } from 'react-redux'
|
4 |
-
|
5 |
-
import getTemplates from '../selectors/getTemplates'
|
6 |
-
|
7 |
-
import TemplateContainer from './TemplateContainer'
|
8 |
-
import TemplateListItem from './TemplateListItem'
|
9 |
-
import TemplateSearch from './TemplateSearch'
|
10 |
-
import TemplateHeaderTitle from './TemplateHeaderTitle'
|
11 |
-
import TemplateUploader from './TemplateUploader'
|
12 |
-
|
13 |
-
/**
|
14 |
-
* The master component for rendering the all PDF templates as a list
|
15 |
-
*
|
16 |
-
* @package Gravity PDF
|
17 |
-
* @copyright Copyright (c) 2017, Blue Liquid Designs
|
18 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
-
* @since 4.1
|
20 |
-
*/
|
21 |
-
|
22 |
-
/*
|
23 |
-
This file is part of Gravity PDF.
|
24 |
-
|
25 |
-
Gravity PDF – Copyright (C) 2017, Blue Liquid Designs
|
26 |
-
|
27 |
-
This program is free software; you can redistribute it and/or modify
|
28 |
-
it under the terms of the GNU General Public License as published by
|
29 |
-
the Free Software Foundation; either version 2 of the License, or
|
30 |
-
(at your option) any later version.
|
31 |
-
|
32 |
-
This program is distributed in the hope that it will be useful,
|
33 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
34 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
35 |
-
GNU General Public License for more details.
|
36 |
-
|
37 |
-
You should have received a copy of the GNU General Public License
|
38 |
-
along with this program; if not, write to the Free Software
|
39 |
-
Found
|
40 |
-
*/
|
41 |
-
|
42 |
-
/**
|
43 |
-
* React Component
|
44 |
-
*
|
45 |
-
* @since 4.1
|
46 |
-
*/
|
47 |
-
export class TemplateList extends React.Component {
|
48 |
-
/**
|
49 |
-
* @since 4.1
|
50 |
-
*/
|
51 |
-
static propTypes = {
|
52 |
-
templates: PropTypes.object,
|
53 |
-
route: PropTypes.object
|
54 |
-
};
|
55 |
-
|
56 |
-
/**
|
57 |
-
* @since 4.1
|
58 |
-
*/
|
59 |
-
render () {
|
60 |
-
const header = <TemplateHeaderTitle header={this.props.templateHeaderText}/>
|
61 |
-
|
62 |
-
return (
|
63 |
-
<TemplateContainer header={header} closeRoute="/">
|
64 |
-
<TemplateSearch />
|
65 |
-
<div>
|
66 |
-
{
|
67 |
-
this.props.templates.map((value, index) => {
|
68 |
-
return <TemplateListItem
|
69 |
-
key={index}
|
70 |
-
template={value}
|
71 |
-
templateDetailsText={this.props.templateDetailsText}
|
72 |
-
activateText={this.props.activateText}/>
|
73 |
-
})
|
74 |
-
}
|
75 |
-
|
76 |
-
<TemplateUploader
|
77 |
-
ajaxUrl={this.props.ajaxUrl}
|
78 |
-
ajaxNonce={this.props.ajaxNonce}
|
79 |
-
addTemplateText={this.props.addTemplateText}
|
80 |
-
genericUploadErrorText={this.props.genericUploadErrorText}
|
81 |
-
filenameErrorText={this.props.filenameErrorText}
|
82 |
-
filesizeErrorText={this.props.filesizeErrorText}
|
83 |
-
installSuccessText={this.props.installSuccessText}
|
84 |
-
installUpdatedText={this.props.installUpdatedText}
|
85 |
-
templateSuccessfullyInstalledUpdated={this.props.templateSuccessfullyInstalledUpdated}
|
86 |
-
templateInstallInstructions={this.props.templateInstallInstructions}
|
87 |
-
/>
|
88 |
-
|
89 |
-
</div>
|
90 |
-
</TemplateContainer>
|
91 |
-
)
|
92 |
-
}
|
93 |
-
}
|
94 |
-
|
95 |
-
/**
|
96 |
-
* Map state to props
|
97 |
-
*
|
98 |
-
* @param {Object} state The current Redux State
|
99 |
-
*
|
100 |
-
* @returns {{templates}}
|
101 |
-
*
|
102 |
-
* @since 4.1
|
103 |
-
*/
|
104 |
-
const mapStateToProps = (state) => {
|
105 |
-
return {
|
106 |
-
templates: getTemplates(state)
|
107 |
-
}
|
108 |
-
}
|
109 |
-
|
110 |
-
/**
|
111 |
-
* Maps our Redux store to our React component
|
112 |
-
*
|
113 |
-
* @since 4.1
|
114 |
-
*/
|
115 |
-
export default connect(mapStateToProps)(TemplateList)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/react/components/TemplateListItem.js
DELETED
@@ -1,170 +0,0 @@
|
|
1 |
-
import PropTypes from 'prop-types';
|
2 |
-
import React from 'react'
|
3 |
-
import { connect } from 'react-redux'
|
4 |
-
import { withRouter } from 'react-router-dom'
|
5 |
-
import { updateTemplateParam } from '../actions/templates'
|
6 |
-
|
7 |
-
import TemplateScreenshot from './TemplateScreenshot'
|
8 |
-
import ShowMessage from './ShowMessage'
|
9 |
-
|
10 |
-
import {
|
11 |
-
TemplateDetails,
|
12 |
-
Group
|
13 |
-
} from './TemplateListItemComponents'
|
14 |
-
|
15 |
-
import { Name } from './TemplateSingleComponents'
|
16 |
-
import TemplateActivateButton from './TemplateActivateButton'
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Display the individual template item for usage our template list
|
20 |
-
*
|
21 |
-
* @package Gravity PDF
|
22 |
-
* @copyright Copyright (c) 2017, Blue Liquid Designs
|
23 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
24 |
-
* @since 4.1
|
25 |
-
*/
|
26 |
-
|
27 |
-
/*
|
28 |
-
This file is part of Gravity PDF.
|
29 |
-
|
30 |
-
Gravity PDF – Copyright (C) 2017, Blue Liquid Designs
|
31 |
-
|
32 |
-
This program is free software; you can redistribute it and/or modify
|
33 |
-
it under the terms of the GNU General Public License as published by
|
34 |
-
the Free Software Foundation; either version 2 of the License, or
|
35 |
-
(at your option) any later version.
|
36 |
-
|
37 |
-
This program is distributed in the hope that it will be useful,
|
38 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
39 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
40 |
-
GNU General Public License for more details.
|
41 |
-
|
42 |
-
You should have received a copy of the GNU General Public License
|
43 |
-
along with this program; if not, write to the Free Software
|
44 |
-
Found
|
45 |
-
*/
|
46 |
-
|
47 |
-
/**
|
48 |
-
* React Component
|
49 |
-
*
|
50 |
-
* @since 4.1
|
51 |
-
*/
|
52 |
-
export class TemplateListItem extends React.Component {
|
53 |
-
/**
|
54 |
-
* @since 4.1
|
55 |
-
*/
|
56 |
-
static propTypes = {
|
57 |
-
template: PropTypes.object,
|
58 |
-
|
59 |
-
activeTemplate: PropTypes.string,
|
60 |
-
updateTemplateParam: PropTypes.func,
|
61 |
-
|
62 |
-
activateText: PropTypes.string,
|
63 |
-
templateDetailsText: PropTypes.string,
|
64 |
-
};
|
65 |
-
|
66 |
-
/**
|
67 |
-
* Check if the Enter key is pressed and not focused on a button
|
68 |
-
* then display the template details page
|
69 |
-
*
|
70 |
-
* @param {Object} e Event
|
71 |
-
*
|
72 |
-
* @since 4.1
|
73 |
-
*/
|
74 |
-
maybeShowDetailedTemplate = (e) => {
|
75 |
-
/* Show detailed template when the Enter key is pressed and the active element doesn't include a 'button' class */
|
76 |
-
if (e.keyCode === 13 && (e.target.className.indexOf('button') === -1)) {
|
77 |
-
this.showDetailedTemplate()
|
78 |
-
}
|
79 |
-
};
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Update the URL to show the PDF template details page
|
83 |
-
*
|
84 |
-
* @since 4.1
|
85 |
-
*/
|
86 |
-
showDetailedTemplate = () => {
|
87 |
-
this.props.history.push('/template/' + this.props.template.get('id'))
|
88 |
-
};
|
89 |
-
|
90 |
-
/**
|
91 |
-
* Call Redux action to remove any stored messages for this template
|
92 |
-
*
|
93 |
-
* @since 4.1
|
94 |
-
*/
|
95 |
-
removeMessage = () => {
|
96 |
-
this.props.updateTemplateParam(this.props.template.get('id'), 'message', null)
|
97 |
-
};
|
98 |
-
|
99 |
-
/**
|
100 |
-
* @since 4.1
|
101 |
-
*/
|
102 |
-
render() {
|
103 |
-
const item = this.props.template
|
104 |
-
const isActiveTemplate = this.props.activeTemplate === item.get('id')
|
105 |
-
const isCompatible = item.get('compatible')
|
106 |
-
const activeTemplate = (isActiveTemplate) ? 'active theme' : 'theme'
|
107 |
-
|
108 |
-
return (
|
109 |
-
<div
|
110 |
-
onClick={this.showDetailedTemplate}
|
111 |
-
onKeyDown={this.maybeShowDetailedTemplate}
|
112 |
-
className={activeTemplate}
|
113 |
-
data-slug={item.get('id')}
|
114 |
-
tabIndex="150">
|
115 |
-
|
116 |
-
<TemplateScreenshot image={item.get('screenshot')}/>
|
117 |
-
{item.get('error') ? <ShowMessage text={item.get('error')} error={true}/> : null}
|
118 |
-
{item.get('message') ? <ShowMessage text={item.get('message')} dismissableCallback={this.removeMessage} dismissable={true} delay={12000} /> : null}
|
119 |
-
|
120 |
-
<TemplateDetails label={this.props.templateDetailsText} />
|
121 |
-
<Group group={item.get('group')}/>
|
122 |
-
<Name name={item.get('template')}/>
|
123 |
-
|
124 |
-
<div className="theme-actions">
|
125 |
-
{!isActiveTemplate && isCompatible ?
|
126 |
-
<TemplateActivateButton template={this.props.template} buttonText={this.props.activateText}/> : null}
|
127 |
-
</div>
|
128 |
-
</div>
|
129 |
-
)
|
130 |
-
}
|
131 |
-
}
|
132 |
-
|
133 |
-
/**
|
134 |
-
* Map state to props
|
135 |
-
*
|
136 |
-
* @param {Object} state The current Redux State
|
137 |
-
*
|
138 |
-
* @returns {{activeTemplate: string}}
|
139 |
-
*
|
140 |
-
* @since 4.1
|
141 |
-
*/
|
142 |
-
const mapStateToProps = (state) => {
|
143 |
-
return {
|
144 |
-
activeTemplate: state.template.activeTemplate
|
145 |
-
}
|
146 |
-
}
|
147 |
-
|
148 |
-
/**
|
149 |
-
* Map actions to props
|
150 |
-
*
|
151 |
-
* @param {func} dispatch Redux dispatcher
|
152 |
-
*
|
153 |
-
* @returns {{updateTemplateParam: (function(id=string, name=string, value=string))}}
|
154 |
-
*
|
155 |
-
* @since 4.1
|
156 |
-
*/
|
157 |
-
const mapDispatchToProps = (dispatch) => {
|
158 |
-
return {
|
159 |
-
updateTemplateParam: (id, name, value) => {
|
160 |
-
dispatch(updateTemplateParam(id, name, value))
|
161 |
-
}
|
162 |
-
}
|
163 |
-
}
|
164 |
-
|
165 |
-
/**
|
166 |
-
* Maps our Redux store to our React component
|
167 |
-
*
|
168 |
-
* @since 4.1
|
169 |
-
*/
|
170 |
-
export default withRouter(connect(mapStateToProps, mapDispatchToProps)(TemplateListItem))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/react/components/TemplateListItemComponents.js
DELETED
@@ -1,61 +0,0 @@
|
|
1 |
-
import PropTypes from 'prop-types';
|
2 |
-
import React from 'react'
|
3 |
-
|
4 |
-
/**
|
5 |
-
* Contains stateless React components for our Template List Items
|
6 |
-
*
|
7 |
-
* @package Gravity PDF
|
8 |
-
* @copyright Copyright (c) 2017, Blue Liquid Designs
|
9 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
10 |
-
* @since 4.1
|
11 |
-
*/
|
12 |
-
|
13 |
-
/*
|
14 |
-
This file is part of Gravity PDF.
|
15 |
-
|
16 |
-
Gravity PDF – Copyright (C) 2017, Blue Liquid Designs
|
17 |
-
|
18 |
-
This program is free software; you can redistribute it and/or modify
|
19 |
-
it under the terms of the GNU General Public License as published by
|
20 |
-
the Free Software Foundation; either version 2 of the License, or
|
21 |
-
(at your option) any later version.
|
22 |
-
|
23 |
-
This program is distributed in the hope that it will be useful,
|
24 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
GNU General Public License for more details.
|
27 |
-
|
28 |
-
You should have received a copy of the GNU General Public License
|
29 |
-
along with this program; if not, write to the Free Software
|
30 |
-
Found
|
31 |
-
*/
|
32 |
-
|
33 |
-
/**
|
34 |
-
* React Stateless Component
|
35 |
-
*
|
36 |
-
* Display the Template Details hover
|
37 |
-
*
|
38 |
-
* @since 4.1
|
39 |
-
*/
|
40 |
-
export const TemplateDetails = ({ label }) => (
|
41 |
-
<span className="more-details">{label}</span>
|
42 |
-
)
|
43 |
-
|
44 |
-
TemplateDetails.propTypes = {
|
45 |
-
name: PropTypes.string,
|
46 |
-
}
|
47 |
-
|
48 |
-
/**
|
49 |
-
* React Stateless Component
|
50 |
-
*
|
51 |
-
* Display the template group
|
52 |
-
*
|
53 |
-
* @since 4.1
|
54 |
-
*/
|
55 |
-
export const Group = ({ group }) => (
|
56 |
-
<p className="theme-author">{group}</p>
|
57 |
-
)
|
58 |
-
|
59 |
-
Group.propTypes = {
|
60 |
-
group: PropTypes.string,
|
61 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/react/components/TemplateScreenshot.js
DELETED
@@ -1,52 +0,0 @@
|
|
1 |
-
import PropTypes from 'prop-types';
|
2 |
-
import React from 'react'
|
3 |
-
|
4 |
-
/**
|
5 |
-
* Display the Template Screenshot for the List Items
|
6 |
-
*
|
7 |
-
* @package Gravity PDF
|
8 |
-
* @copyright Copyright (c) 2017, Blue Liquid Designs
|
9 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
10 |
-
* @since 4.1
|
11 |
-
*/
|
12 |
-
|
13 |
-
/*
|
14 |
-
This file is part of Gravity PDF.
|
15 |
-
|
16 |
-
Gravity PDF – Copyright (C) 2017, Blue Liquid Designs
|
17 |
-
|
18 |
-
This program is free software; you can redistribute it and/or modify
|
19 |
-
it under the terms of the GNU General Public License as published by
|
20 |
-
the Free Software Foundation; either version 2 of the License, or
|
21 |
-
(at your option) any later version.
|
22 |
-
|
23 |
-
This program is distributed in the hope that it will be useful,
|
24 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
GNU General Public License for more details.
|
27 |
-
|
28 |
-
You should have received a copy of the GNU General Public License
|
29 |
-
along with this program; if not, write to the Free Software
|
30 |
-
Found
|
31 |
-
*/
|
32 |
-
|
33 |
-
/**
|
34 |
-
* React Stateless Component
|
35 |
-
*
|
36 |
-
* @since 4.1
|
37 |
-
*/
|
38 |
-
const TemplateScreenshot = ({ image }) => {
|
39 |
-
const className = (image) ? 'theme-screenshot' : 'theme-screenshot blank'
|
40 |
-
|
41 |
-
return (
|
42 |
-
<div className={className}>
|
43 |
-
{image ? <img src={image} alt=""/> : null}
|
44 |
-
</div>
|
45 |
-
)
|
46 |
-
}
|
47 |
-
|
48 |
-
TemplateScreenshot.propTypes = {
|
49 |
-
image: PropTypes.string
|
50 |
-
}
|
51 |
-
|
52 |
-
export default TemplateScreenshot
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/react/components/TemplateScreenshots.js
DELETED
@@ -1,54 +0,0 @@
|
|
1 |
-
import PropTypes from 'prop-types';
|
2 |
-
import React from 'react'
|
3 |
-
|
4 |
-
/**
|
5 |
-
* Display the Template Screenshot for the individual templates (uses different markup - out of our control)
|
6 |
-
*
|
7 |
-
* @package Gravity PDF
|
8 |
-
* @copyright Copyright (c) 2017, Blue Liquid Designs
|
9 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
10 |
-
* @since 4.1
|
11 |
-
*/
|
12 |
-
|
13 |
-
/*
|
14 |
-
This file is part of Gravity PDF.
|
15 |
-
|
16 |
-
Gravity PDF – Copyright (C) 2017, Blue Liquid Designs
|
17 |
-
|
18 |
-
This program is free software; you can redistribute it and/or modify
|
19 |
-
it under the terms of the GNU General Public License as published by
|
20 |
-
the Free Software Foundation; either version 2 of the License, or
|
21 |
-
(at your option) any later version.
|
22 |
-
|
23 |
-
This program is distributed in the hope that it will be useful,
|
24 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
GNU General Public License for more details.
|
27 |
-
|
28 |
-
You should have received a copy of the GNU General Public License
|
29 |
-
along with this program; if not, write to the Free Software
|
30 |
-
Found
|
31 |
-
*/
|
32 |
-
|
33 |
-
/**
|
34 |
-
* React Stateless Component
|
35 |
-
*
|
36 |
-
* @since 4.1
|
37 |
-
*/
|
38 |
-
const TemplateScreenshots = ({ image }) => {
|
39 |
-
const className = (image) ? 'screenshot' : 'screenshot blank'
|
40 |
-
|
41 |
-
return (
|
42 |
-
<div className="theme-screenshots">
|
43 |
-
<div className={className}>
|
44 |
-
{image ? <img src={image} alt=""/> : null}
|
45 |
-
</div>
|
46 |
-
</div>
|
47 |
-
)
|
48 |
-
}
|
49 |
-
|
50 |
-
TemplateScreenshots.propTypes = {
|
51 |
-
image: PropTypes.string
|
52 |
-
}
|
53 |
-
|
54 |
-
export default TemplateScreenshots
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/react/components/TemplateSearch.js
DELETED
@@ -1,155 +0,0 @@
|
|
1 |
-
import PropTypes from 'prop-types';
|
2 |
-
import React from 'react'
|
3 |
-
import { connect } from 'react-redux'
|
4 |
-
import debounce from 'lodash.debounce'
|
5 |
-
|
6 |
-
import { searchTemplates } from '../actions/templates'
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Handles the PDF template search functionality
|
10 |
-
*
|
11 |
-
* @package Gravity PDF
|
12 |
-
* @copyright Copyright (c) 2017, Blue Liquid Designs
|
13 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
14 |
-
* @since 4.1
|
15 |
-
*/
|
16 |
-
|
17 |
-
/*
|
18 |
-
This file is part of Gravity PDF.
|
19 |
-
|
20 |
-
Gravity PDF – Copyright (C) 2017, Blue Liquid Designs
|
21 |
-
|
22 |
-
This program is free software; you can redistribute it and/or modify
|
23 |
-
it under the terms of the GNU General Public License as published by
|
24 |
-
the Free Software Foundation; either version 2 of the License, or
|
25 |
-
(at your option) any later version.
|
26 |
-
|
27 |
-
This program is distributed in the hope that it will be useful,
|
28 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
29 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
30 |
-
GNU General Public License for more details.
|
31 |
-
|
32 |
-
You should have received a copy of the GNU General Public License
|
33 |
-
along with this program; if not, write to the Free Software
|
34 |
-
Found
|
35 |
-
*/
|
36 |
-
|
37 |
-
/**
|
38 |
-
* React Component
|
39 |
-
*
|
40 |
-
* @since 4.1
|
41 |
-
*/
|
42 |
-
export class TemplateSearch extends React.Component {
|
43 |
-
/**
|
44 |
-
* @since 4.1
|
45 |
-
*/
|
46 |
-
static propTypes = {
|
47 |
-
onSearch: PropTypes.func,
|
48 |
-
search: PropTypes.string
|
49 |
-
};
|
50 |
-
|
51 |
-
/**
|
52 |
-
* Debounce our runSearch function so it can only be run once every 200 milliseconds
|
53 |
-
*
|
54 |
-
* @since 4.1
|
55 |
-
*/
|
56 |
-
componentWillMount() {
|
57 |
-
this.runSearch = debounce(this.runSearch, 200)
|
58 |
-
}
|
59 |
-
|
60 |
-
/**
|
61 |
-
* On mount, add focus to the search box
|
62 |
-
*
|
63 |
-
* @since 4.1
|
64 |
-
*/
|
65 |
-
componentDidMount() {
|
66 |
-
/* add focus to element */
|
67 |
-
this.input.focus()
|
68 |
-
}
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Handles our search event
|
72 |
-
*
|
73 |
-
* Because ReactJS pools SyntheticEvent and we delay the search with debounce we need
|
74 |
-
* to ensure the event is persisted (see https://facebook.github.io/react/docs/events.html#event-pooling)
|
75 |
-
*
|
76 |
-
* @param {Object} e Event
|
77 |
-
*
|
78 |
-
* @since 4.1
|
79 |
-
*/
|
80 |
-
handleSearch = (e) => {
|
81 |
-
e.persist()
|
82 |
-
this.runSearch(e)
|
83 |
-
};
|
84 |
-
|
85 |
-
/**
|
86 |
-
* Update our Redux store with the search value
|
87 |
-
*
|
88 |
-
* @param {Object} e Event
|
89 |
-
*
|
90 |
-
* @since 4.1
|
91 |
-
*/
|
92 |
-
runSearch = (e) => {
|
93 |
-
this.props.onSearch(e.target.value || '')
|
94 |
-
};
|
95 |
-
|
96 |
-
/**
|
97 |
-
* @since 4.1
|
98 |
-
*/
|
99 |
-
render() {
|
100 |
-
return (
|
101 |
-
<div>
|
102 |
-
<input
|
103 |
-
className="wp-filter-search"
|
104 |
-
id="wp-filter-search-input"
|
105 |
-
ref={node => this.input = node}
|
106 |
-
placeholder="Search Installed Templates"
|
107 |
-
type="search"
|
108 |
-
aria-describedby="live-search-desc"
|
109 |
-
tabIndex="145"
|
110 |
-
onChange={this.handleSearch}
|
111 |
-
defaultValue={this.props.search}
|
112 |
-
/>
|
113 |
-
</div>
|
114 |
-
)
|
115 |
-
}
|
116 |
-
}
|
117 |
-
|
118 |
-
/**
|
119 |
-
* Map state to props
|
120 |
-
*
|
121 |
-
* @param {Object} state The current Redux State
|
122 |
-
*
|
123 |
-
* @returns {{search: string}}
|
124 |
-
*
|
125 |
-
* @since 4.1
|
126 |
-
*/
|
127 |
-
const mapStateToProps = (state) => {
|
128 |
-
return {
|
129 |
-
search: state.template.search
|
130 |
-
}
|
131 |
-
}
|
132 |
-
|
133 |
-
/**
|
134 |
-
* Map actions to props
|
135 |
-
*
|
136 |
-
* @param {func} dispatch Redux dispatcher
|
137 |
-
*
|
138 |
-
* @returns {{onSearch: (function(text=string))}}
|
139 |
-
*
|
140 |
-
* @since 4.1
|
141 |
-
*/
|
142 |
-
const mapDispatchToProps = (dispatch) => {
|
143 |
-
return {
|
144 |
-
onSearch: (text) => {
|
145 |
-
dispatch(searchTemplates(text))
|
146 |
-
}
|
147 |
-
}
|
148 |
-
}
|
149 |
-
|
150 |
-
/**
|
151 |
-
* Maps our Redux store to our React component
|
152 |
-
*
|
153 |
-
* @since 4.1
|
154 |
-
*/
|
155 |
-
export default connect(mapStateToProps, mapDispatchToProps)(TemplateSearch)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/react/components/TemplateSingle.js
DELETED
@@ -1,174 +0,0 @@
|
|
1 |
-
import PropTypes from 'prop-types';
|
2 |
-
import React from 'react'
|
3 |
-
import { connect } from 'react-redux'
|
4 |
-
|
5 |
-
import getTemplates from '../selectors/getTemplates'
|
6 |
-
|
7 |
-
import TemplateContainer from './TemplateContainer'
|
8 |
-
import TemplateHeaderNavigation from './TemplateHeaderNavigation'
|
9 |
-
import TemplateFooterActions from './TemplateFooterActions'
|
10 |
-
import TemplateScreenshots from './TemplateScreenshots'
|
11 |
-
import ShowMessage from './ShowMessage'
|
12 |
-
|
13 |
-
import {
|
14 |
-
CurrentTemplate,
|
15 |
-
Name,
|
16 |
-
Author,
|
17 |
-
Group,
|
18 |
-
Description,
|
19 |
-
Tags
|
20 |
-
} from './TemplateSingleComponents'
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Renders a single PDF template, which get displayed on the /template/:id page.
|
24 |
-
*
|
25 |
-
* @package Gravity PDF
|
26 |
-
* @copyright Copyright (c) 2017, Blue Liquid Designs
|
27 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
28 |
-
* @since 4.1
|
29 |
-
*/
|
30 |
-
|
31 |
-
/*
|
32 |
-
This file is part of Gravity PDF.
|
33 |
-
|
34 |
-
Gravity PDF – Copyright (C) 2017, Blue Liquid Designs
|
35 |
-
|
36 |
-
This program is free software; you can redistribute it and/or modify
|
37 |
-
it under the terms of the GNU General Public License as published by
|
38 |
-
the Free Software Foundation; either version 2 of the License, or
|
39 |
-
(at your option) any later version.
|
40 |
-
|
41 |
-
This program is distributed in the hope that it will be useful,
|
42 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
43 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
44 |
-
GNU General Public License for more details.
|
45 |
-
|
46 |
-
You should have received a copy of the GNU General Public License
|
47 |
-
along with this program; if not, write to the Free Software
|
48 |
-
Found
|
49 |
-
*/
|
50 |
-
|
51 |
-
/**
|
52 |
-
* React Component
|
53 |
-
*
|
54 |
-
* @since 4.1
|
55 |
-
*/
|
56 |
-
export class TemplateSingle extends React.Component {
|
57 |
-
/**
|
58 |
-
* @since 4.1
|
59 |
-
*/
|
60 |
-
static propTypes = {
|
61 |
-
route: PropTypes.object,
|
62 |
-
|
63 |
-
template: PropTypes.object,
|
64 |
-
activeTemplate: PropTypes.string,
|
65 |
-
templateIndex: PropTypes.number,
|
66 |
-
templates: PropTypes.object,
|
67 |
-
};
|
68 |
-
|
69 |
-
/**
|
70 |
-
* Ensure the component doesn't try and re-render when a template isn't found
|
71 |
-
*
|
72 |
-
* @param nextProps
|
73 |
-
* @param nextState
|
74 |
-
*
|
75 |
-
* @Internal This problem seems to be prevelant due to a race condition when deleting a template and updating the URL
|
76 |
-
*
|
77 |
-
* @since 4.2
|
78 |
-
*/
|
79 |
-
shouldComponentUpdate (nextProps, nextState) {
|
80 |
-
if (nextProps.template == null) {
|
81 |
-
return false
|
82 |
-
}
|
83 |
-
|
84 |
-
return true
|
85 |
-
};
|
86 |
-
|
87 |
-
/**
|
88 |
-
* @since 4.1
|
89 |
-
*/
|
90 |
-
render () {
|
91 |
-
const item = this.props.template
|
92 |
-
const isCurrentTemplate = this.props.activeTemplate === item.get('id')
|
93 |
-
|
94 |
-
/* Assign our header / footer components to constants */
|
95 |
-
const header = <TemplateHeaderNavigation
|
96 |
-
template={item}
|
97 |
-
templateIndex={this.props.templateIndex}
|
98 |
-
templates={this.props.templates}
|
99 |
-
showPreviousTemplateText={this.props.showPreviousTemplateText}
|
100 |
-
showNextTemplateText={this.props.showNextTemplateText}/>
|
101 |
-
|
102 |
-
const footer = <TemplateFooterActions
|
103 |
-
template={item}
|
104 |
-
isActiveTemplate={isCurrentTemplate}
|
105 |
-
|
106 |
-
ajaxUrl={this.props.ajaxUrl}
|
107 |
-
ajaxNonce={this.props.ajaxNonce}
|
108 |
-
|
109 |
-
activateText={this.props.activateText}
|
110 |
-
pdfWorkingDirPath={this.props.pdfWorkingDirPath}
|
111 |
-
templateDeleteText={this.props.templateDeleteText}
|
112 |
-
templateConfirmDeleteText={this.props.templateConfirmDeleteText}
|
113 |
-
templateDeleteErrorText={this.props.templateDeleteErrorText}
|
114 |
-
/>
|
115 |
-
|
116 |
-
/* Display our Single Template container */
|
117 |
-
return (
|
118 |
-
<TemplateContainer header={header} footer={footer} closeRoute="/template">
|
119 |
-
<div id="gfpdf-template-detail-view" className="gfpdf-template-detail">
|
120 |
-
<TemplateScreenshots image={item.get('screenshot')}/>
|
121 |
-
|
122 |
-
<div className="theme-info">
|
123 |
-
<CurrentTemplate isCurrentTemplate={isCurrentTemplate} label={this.props.currentTemplateText}/>
|
124 |
-
<Name name={item.get('template')} version={item.get('version')}
|
125 |
-
versionLabel={this.props.versionText}/>
|
126 |
-
<Author author={item.get('author')} uri={item.get('author uri')}/>
|
127 |
-
<Group group={item.get('group')} label={this.props.groupText}/>
|
128 |
-
|
129 |
-
{item.get('long_message') ? <ShowMessage text={item.get('long_message')}/> : null}
|
130 |
-
{item.get('long_error') ? <ShowMessage text={item.get('long_error')} error={true}/> : null}
|
131 |
-
|
132 |
-
<Description desc={item.get('description')}/>
|
133 |
-
<Tags tags={item.get('tags')} label={this.props.tagsText}/>
|
134 |
-
</div>
|
135 |
-
</div>
|
136 |
-
</TemplateContainer>
|
137 |
-
)
|
138 |
-
}
|
139 |
-
}
|
140 |
-
|
141 |
-
/**
|
142 |
-
* Map state to props
|
143 |
-
*
|
144 |
-
* @param {Object} state The current Redux State
|
145 |
-
* @param {Object} props The current React props
|
146 |
-
*
|
147 |
-
* @returns {{template: Immutable Map, templateIndex: number, templates: Immutable List, activeTemplate: string}}
|
148 |
-
*
|
149 |
-
* @since 4.1
|
150 |
-
*/
|
151 |
-
const MapStateToProps = (state, props) => {
|
152 |
-
|
153 |
-
/* found our selected template */
|
154 |
-
const templates = getTemplates(state)
|
155 |
-
const id = props.match.params.id
|
156 |
-
|
157 |
-
const findCurrentTemplate = (item) => {
|
158 |
-
return (item.get('id') === id)
|
159 |
-
}
|
160 |
-
|
161 |
-
return {
|
162 |
-
template: templates.find(findCurrentTemplate),
|
163 |
-
templateIndex: templates.findIndex(findCurrentTemplate),
|
164 |
-
templates: templates,
|
165 |
-
activeTemplate: state.template.activeTemplate,
|
166 |
-
}
|
167 |
-
}
|
168 |
-
|
169 |
-
/**
|
170 |
-
* Maps our Redux store to our React component
|
171 |
-
*
|
172 |
-
* @since 4.1
|
173 |
-
*/
|
174 |
-
export default connect(MapStateToProps)(TemplateSingle)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/react/components/TemplateSingleComponents.js
DELETED
@@ -1,180 +0,0 @@
|
|
1 |
-
import PropTypes from 'prop-types';
|
2 |
-
import React from 'react'
|
3 |
-
|
4 |
-
/**
|
5 |
-
* Contains stateless React components for our Single Template
|
6 |
-
*
|
7 |
-
* @package Gravity PDF
|
8 |
-
* @copyright Copyright (c) 2017, Blue Liquid Designs
|
9 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
10 |
-
* @since 4.1
|
11 |
-
*/
|
12 |
-
|
13 |
-
/*
|
14 |
-
This file is part of Gravity PDF.
|
15 |
-
|
16 |
-
Gravity PDF – Copyright (C) 2017, Blue Liquid Designs
|
17 |
-
|
18 |
-
This program is free software; you can redistribute it and/or modify
|
19 |
-
it under the terms of the GNU General Public License as published by
|
20 |
-
the Free Software Foundation; either version 2 of the License, or
|
21 |
-
(at your option) any later version.
|
22 |
-
|
23 |
-
This program is distributed in the hope that it will be useful,
|
24 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
GNU General Public License for more details.
|
27 |
-
|
28 |
-
You should have received a copy of the GNU General Public License
|
29 |
-
along with this program; if not, write to the Free Software
|
30 |
-
Found
|
31 |
-
*/
|
32 |
-
|
33 |
-
/**
|
34 |
-
* React Stateless Component
|
35 |
-
*
|
36 |
-
* Display the current template label
|
37 |
-
*
|
38 |
-
* @since 4.1
|
39 |
-
*/
|
40 |
-
export const CurrentTemplate = ({ isCurrentTemplate, label }) => {
|
41 |
-
return (isCurrentTemplate) ? (
|
42 |
-
<span className="current-label">{label}</span>
|
43 |
-
) : (
|
44 |
-
<span />
|
45 |
-
)
|
46 |
-
}
|
47 |
-
|
48 |
-
CurrentTemplate.propTypes = {
|
49 |
-
isCurrentTemplate: PropTypes.bool,
|
50 |
-
label: PropTypes.string
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* React Stateless Component
|
55 |
-
*
|
56 |
-
* Display the template name and version number
|
57 |
-
*
|
58 |
-
* @since 4.1
|
59 |
-
*/
|
60 |
-
export const Name = ({ name, version, versionLabel }) => (
|
61 |
-
<h2 className="theme-name">
|
62 |
-
{name}
|
63 |
-
|
64 |
-
<Version version={version} label={versionLabel}/>
|
65 |
-
</h2>
|
66 |
-
)
|
67 |
-
|
68 |
-
Name.propTypes = {
|
69 |
-
name: PropTypes.string,
|
70 |
-
version: PropTypes.string,
|
71 |
-
versionLabel: PropTypes.string
|
72 |
-
}
|
73 |
-
|
74 |
-
/**
|
75 |
-
* React Stateless Component
|
76 |
-
*
|
77 |
-
* Display the template version number
|
78 |
-
*
|
79 |
-
* @since 4.1
|
80 |
-
*/
|
81 |
-
export const Version = ({ label, version }) => {
|
82 |
-
return (version) ? (
|
83 |
-
<span className="theme-version">{label}: {version}</span>
|
84 |
-
) : (
|
85 |
-
<span />
|
86 |
-
)
|
87 |
-
}
|
88 |
-
|
89 |
-
Version.propTypes = {
|
90 |
-
label: PropTypes.string,
|
91 |
-
version: PropTypes.string
|
92 |
-
}
|
93 |
-
|
94 |
-
/**
|
95 |
-
* React Stateless Component
|
96 |
-
*
|
97 |
-
* Display the template author (and link to website, if any)
|
98 |
-
*
|
99 |
-
* @since 4.1
|
100 |
-
*/
|
101 |
-
export const Author = ({ author, uri }) => {
|
102 |
-
|
103 |
-
if (uri) {
|
104 |
-
return (
|
105 |
-
<p className="theme-author">
|
106 |
-
<a href={uri}>
|
107 |
-
{author}
|
108 |
-
</a>
|
109 |
-
</p>
|
110 |
-
)
|
111 |
-
} else {
|
112 |
-
return (
|
113 |
-
<p className="theme-author">
|
114 |
-
{author}
|
115 |
-
</p>
|
116 |
-
)
|
117 |
-
}
|
118 |
-
}
|
119 |
-
|
120 |
-
Author.propTypes = {
|
121 |
-
author: PropTypes.string,
|
122 |
-
uri: PropTypes.string
|
123 |
-
}
|
124 |
-
|
125 |
-
/**
|
126 |
-
* React Stateless Component
|
127 |
-
*
|
128 |
-
* Display the template group
|
129 |
-
*
|
130 |
-
* @since 4.1
|
131 |
-
*/
|
132 |
-
export const Group = ({ label, group }) => (
|
133 |
-
<p className="theme-author">
|
134 |
-
<strong>{label}: {group}</strong>
|
135 |
-
</p>
|
136 |
-
)
|
137 |
-
|
138 |
-
Group.propTypes = {
|
139 |
-
label: PropTypes.string,
|
140 |
-
group: PropTypes.string,
|
141 |
-
}
|
142 |
-
|
143 |
-
/**
|
144 |
-
* React Stateless Component
|
145 |
-
*
|
146 |
-
* Display the template description
|
147 |
-
*
|
148 |
-
* @since 4.1
|
149 |
-
*/
|
150 |
-
export const Description = ({ desc }) => (
|
151 |
-
<p className="theme-description">
|
152 |
-
{desc}
|
153 |
-
</p>
|
154 |
-
)
|
155 |
-
|
156 |
-
Description.propTypes = {
|
157 |
-
desc: PropTypes.string,
|
158 |
-
}
|
159 |
-
|
160 |
-
/**
|
161 |
-
* React Stateless Component
|
162 |
-
*
|
163 |
-
* Display the template tags
|
164 |
-
*
|
165 |
-
* @since 4.1
|
166 |
-
*/
|
167 |
-
export const Tags = ({ label, tags }) => {
|
168 |
-
return (tags) ? (
|
169 |
-
<p className="theme-tags">
|
170 |
-
<span>{label}:</span> {tags}
|
171 |
-
</p>
|
172 |
-
) : (
|
173 |
-
<span />
|
174 |
-
)
|
175 |
-
}
|
176 |
-
|
177 |
-
Tags.propTypes = {
|
178 |
-
label: PropTypes.string,
|
179 |
-
tags: PropTypes.string,
|
180 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/react/components/TemplateUploader.js
DELETED
@@ -1,301 +0,0 @@
|
|
1 |
-
import PropTypes from 'prop-types';
|
2 |
-
import React from 'react'
|
3 |
-
import { connect } from 'react-redux'
|
4 |
-
import request from 'superagent'
|
5 |
-
import { fromJS } from 'immutable'
|
6 |
-
|
7 |
-
import { addTemplate, updateTemplateParam } from '../actions/templates'
|
8 |
-
import Dropzone from './Dropzone'
|
9 |
-
import ShowMessage from './ShowMessage'
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Handles the uploading of new PDF templates to the server
|
13 |
-
*
|
14 |
-
* @package Gravity PDF
|
15 |
-
* @copyright Copyright (c) 2017, Blue Liquid Designs
|
16 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
17 |
-
* @since 4.1
|
18 |
-
*/
|
19 |
-
|
20 |
-
/*
|
21 |
-
This file is part of Gravity PDF.
|
22 |
-
|
23 |
-
Gravity PDF – Copyright (C) 2017, Blue Liquid Designs
|
24 |
-
|
25 |
-
This program is free software; you can redistribute it and/or modify
|
26 |
-
it under the terms of the GNU General Public License as published by
|
27 |
-
the Free Software Foundation; either version 2 of the License, or
|
28 |
-
(at your option) any later version.
|
29 |
-
|
30 |
-
This program is distributed in the hope that it will be useful,
|
31 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
32 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
33 |
-
GNU General Public License for more details.
|
34 |
-
|
35 |
-
You should have received a copy of the GNU General Public License
|
36 |
-
along with this program; if not, write to the Free Software
|
37 |
-
Found
|
38 |
-
*/
|
39 |
-
|
40 |
-
/**
|
41 |
-
* React Component
|
42 |
-
*
|
43 |
-
* @since 4.1
|
44 |
-
*/
|
45 |
-
export class TemplateUploader extends React.Component {
|
46 |
-
/**
|
47 |
-
* @since 4.1
|
48 |
-
*/
|
49 |
-
static propTypes = {
|
50 |
-
ajaxUrl: PropTypes.string,
|
51 |
-
ajaxNonce: PropTypes.string,
|
52 |
-
|
53 |
-
genericUploadErrorText: PropTypes.string,
|
54 |
-
addTemplateText: PropTypes.string,
|
55 |
-
filenameErrorText: PropTypes.string,
|
56 |
-
filesizeErrorText: PropTypes.string,
|
57 |
-
installSuccessText: PropTypes.string,
|
58 |
-
installUpdatedText: PropTypes.string,
|
59 |
-
templateSuccessfullyInstalledUpdated: PropTypes.string,
|
60 |
-
templateInstallInstructions: PropTypes.string,
|
61 |
-
|
62 |
-
addNewTemplate: PropTypes.func,
|
63 |
-
updateTemplateParam: PropTypes.func,
|
64 |
-
templates: PropTypes.object
|
65 |
-
};
|
66 |
-
|
67 |
-
/**
|
68 |
-
* Setup internal component state that doesn't need to be in Redux
|
69 |
-
*
|
70 |
-
* @returns {{ajax: boolean, error: string, message: string}}
|
71 |
-
*
|
72 |
-
* @since 4.1
|
73 |
-
*/
|
74 |
-
state = {
|
75 |
-
ajax: false,
|
76 |
-
error: '',
|
77 |
-
message: ''
|
78 |
-
};
|
79 |
-
|
80 |
-
/**
|
81 |
-
* Manages the template file upload
|
82 |
-
*
|
83 |
-
* @param {array} acceptedFiles The array of uploaded files we should send to the server
|
84 |
-
*
|
85 |
-
* @since 4.1
|
86 |
-
*/
|
87 |
-
onDrop = (acceptedFiles) => {
|
88 |
-
/* Handle file upload and pass in an nonce!!! */
|
89 |
-
if (acceptedFiles instanceof Array && acceptedFiles.length > 0) {
|
90 |
-
|
91 |
-
acceptedFiles.forEach((file) => {
|
92 |
-
const filename = file.name
|
93 |
-
|
94 |
-
/* Do validation */
|
95 |
-
if (!this.checkFilename(filename) || !this.checkFilesize(file.size)) {
|
96 |
-
return
|
97 |
-
}
|
98 |
-
|
99 |
-
/* Add our loader */
|
100 |
-
this.setState({
|
101 |
-
ajax: true,
|
102 |
-
error: '',
|
103 |
-
message: '',
|
104 |
-
})
|
105 |
-
|
106 |
-
/* POST the PDF template to our endpoint for processing */
|
107 |
-
request
|
108 |
-
.post(this.props.ajaxUrl)
|
109 |
-
.field('action', 'gfpdf_upload_template')
|
110 |
-
.field('nonce', this.props.ajaxNonce)
|
111 |
-
.attach('template', file, filename)
|
112 |
-
.then(this.ajaxSuccess, this.ajaxFailed)
|
113 |
-
})
|
114 |
-
|
115 |
-
}
|
116 |
-
};
|
117 |
-
|
118 |
-
/**
|
119 |
-
* Checks if the uploaded file has a .zip extension
|
120 |
-
* We do this instead of mime type checking as it doesn't work in all browsers
|
121 |
-
*
|
122 |
-
* @param {string} name
|
123 |
-
*
|
124 |
-
* @returns {boolean}
|
125 |
-
*
|
126 |
-
* @since 4.1
|
127 |
-
*/
|
128 |
-
checkFilename = (name) => {
|
129 |
-
if (name.substr(name.length - 4) !== '.zip') {
|
130 |
-
|
131 |
-
/* Tell use about incorrect file type */
|
132 |
-
this.setState({
|
133 |
-
error: this.props.filenameErrorText
|
134 |
-
})
|
135 |
-
|
136 |
-
return false
|
137 |
-
}
|
138 |
-
|
139 |
-
return true
|
140 |
-
};
|
141 |
-
|
142 |
-
/**
|
143 |
-
* Checks if the file size is larger than 5MB
|
144 |
-
*
|
145 |
-
* @param {int} size File size in bytes
|
146 |
-
*
|
147 |
-
* @returns {boolean}
|
148 |
-
*
|
149 |
-
* @since 4.1
|
150 |
-
*/
|
151 |
-
checkFilesize = (size) => {
|
152 |
-
/* Check the file is no larger than 5MB (convert from bytes to KB) */
|
153 |
-
if (size / 1024 > 5120) {
|
154 |
-
/* Tell use about incorrect file type */
|
155 |
-
this.setState({
|
156 |
-
error: this.props.filesizeErrorText
|
157 |
-
})
|
158 |
-
|
159 |
-
return false
|
160 |
-
}
|
161 |
-
|
162 |
-
return true
|
163 |
-
};
|
164 |
-
|
165 |
-
/**
|
166 |
-
* Update our Redux store with the new PDF template details
|
167 |
-
* If our upload AJAX call to the server passed this function gets fired
|
168 |
-
*
|
169 |
-
* @param {Object} response
|
170 |
-
*
|
171 |
-
* @since 4.1
|
172 |
-
*/
|
173 |
-
ajaxSuccess = (response) => {
|
174 |
-
|
175 |
-
/* Update our Redux Store with the new template(s) */
|
176 |
-
response.body.templates.forEach((template) => {
|
177 |
-
|
178 |
-
/* Check if template already in the list before adding to our store */
|
179 |
-
const matched = this.props.templates.find((item) => {
|
180 |
-
return (item.get('id') === template.id)
|
181 |
-
})
|
182 |
-
|
183 |
-
if (matched === undefined) {
|
184 |
-
template.new = true //ensure new templates go to end of list
|
185 |
-
template.message = this.props.installSuccessText
|
186 |
-
this.props.addNewTemplate(fromJS(template))
|
187 |
-
} else {
|
188 |
-
this.props.updateTemplateParam(template.id, 'message', this.props.installUpdatedText)
|
189 |
-
}
|
190 |
-
})
|
191 |
-
|
192 |
-
/* Mark as success and stop AJAX spinner */
|
193 |
-
this.setState({
|
194 |
-
ajax: false,
|
195 |
-
message: this.props.templateSuccessfullyInstalledUpdated
|
196 |
-
})
|
197 |
-
};
|
198 |
-
|
199 |
-
/**
|
200 |
-
* Show any errors to the user when AJAX request fails for any reason
|
201 |
-
*
|
202 |
-
* @param {Object} error
|
203 |
-
*
|
204 |
-
* @since 4.1
|
205 |
-
*/
|
206 |
-
ajaxFailed = (error) => {
|
207 |
-
/* Let the user know there was a problem with the upload */
|
208 |
-
this.setState({
|
209 |
-
error: (error.response.body && error.response.body.error !== undefined) ? error.response.body.error : this.props.genericUploadErrorText,
|
210 |
-
ajax: false
|
211 |
-
})
|
212 |
-
};
|
213 |
-
|
214 |
-
/**
|
215 |
-
* Remove message from state once the timeout has finished
|
216 |
-
*
|
217 |
-
* @since 4.1
|
218 |
-
*/
|
219 |
-
removeMessage = () => {
|
220 |
-
this.setState( {
|
221 |
-
message: ''
|
222 |
-
})
|
223 |
-
};
|
224 |
-
|
225 |
-
/**
|
226 |
-
* Prevent normal behaviour when this event fires
|
227 |
-
*
|
228 |
-
* @param {Object} e Event
|
229 |
-
*
|
230 |
-
* @since 4.1
|
231 |
-
*/
|
232 |
-
openDropzone = (e) => {
|
233 |
-
e.preventDefault()
|
234 |
-
};
|
235 |
-
|
236 |
-
/**
|
237 |
-
* @since 4.1
|
238 |
-
*/
|
239 |
-
render() {
|
240 |
-
return (
|
241 |
-
<Dropzone
|
242 |
-
onDrop={this.onDrop}
|
243 |
-
maxSize={10240000}
|
244 |
-
multiple={true}
|
245 |
-
className="theme add-new-theme gfpdf-dropzone">
|
246 |
-
<a href="#" onClick={this.openDropzone} className={this.state.ajax ? 'doing-ajax' : ''}>
|
247 |
-
<div className="theme-screenshot"><span /></div>
|
248 |
-
|
249 |
-
{this.state.error !== '' ? <ShowMessage text={this.state.error} error={true}/> : null}
|
250 |
-
{this.state.message !== '' ? <ShowMessage text={this.state.message} dismissable={true} dismissableCallback={this.removeMessage} /> : null}
|
251 |
-
|
252 |
-
<h2 className="theme-name">{this.props.addTemplateText}</h2>
|
253 |
-
</a>
|
254 |
-
<div className="gfpdf-template-install-instructions">{this.props.templateInstallInstructions}</div>
|
255 |
-
</Dropzone>
|
256 |
-
)
|
257 |
-
}
|
258 |
-
}
|
259 |
-
|
260 |
-
/**
|
261 |
-
* Map state to props
|
262 |
-
*
|
263 |
-
* @param {Object} state The current Redux State
|
264 |
-
*
|
265 |
-
* @returns {{templates}}
|
266 |
-
*
|
267 |
-
* @since 4.1
|
268 |
-
*/
|
269 |
-
const mapStateToProps = (state) => {
|
270 |
-
return {
|
271 |
-
templates: state.template.list
|
272 |
-
}
|
273 |
-
}
|
274 |
-
|
275 |
-
/**
|
276 |
-
* Map actions to props
|
277 |
-
*
|
278 |
-
* @param {func} dispatch Redux dispatcher
|
279 |
-
*
|
280 |
-
* @returns {{addNewTemplate: (function(template=Immutable Map)), updateTemplateParam: (function(id=string, name=string, value=*))}}
|
281 |
-
*
|
282 |
-
* @since 4.1
|
283 |
-
*/
|
284 |
-
const mapDispatchToProps = (dispatch) => {
|
285 |
-
return {
|
286 |
-
addNewTemplate: (template) => {
|
287 |
-
dispatch(addTemplate(template))
|
288 |
-
},
|
289 |
-
|
290 |
-
updateTemplateParam: (id, name, value) => {
|
291 |
-
dispatch(updateTemplateParam(id, name, value))
|
292 |
-
}
|
293 |
-
}
|
294 |
-
}
|
295 |
-
|
296 |
-
/**
|
297 |
-
* Maps our Redux store to our React component
|
298 |
-
*
|
299 |
-
* @since 4.1
|
300 |
-
*/
|
301 |
-
export default connect(mapStateToProps, mapDispatchToProps)(TemplateUploader)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/react/gfpdf-main.js
DELETED
@@ -1,63 +0,0 @@
|
|
1 |
-
import $ from 'jquery'
|
2 |
-
import Promise from 'promise-polyfill'
|
3 |
-
import templateBootstrap from './bootstrap/templateBootstrap'
|
4 |
-
|
5 |
-
/**
|
6 |
-
* JS Entry point for WebPack
|
7 |
-
*
|
8 |
-
* @package Gravity PDF
|
9 |
-
* @copyright Copyright (c) 2017, Blue Liquid Designs
|
10 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
-
* @since 4.1
|
12 |
-
*/
|
13 |
-
|
14 |
-
/*
|
15 |
-
This file is part of Gravity PDF.
|
16 |
-
|
17 |
-
Gravity PDF – Copyright (C) 2017, Blue Liquid Designs
|
18 |
-
|
19 |
-
This program is free software; you can redistribute it and/or modify
|
20 |
-
it under the terms of the GNU General Public License as published by
|
21 |
-
the Free Software Foundation; either version 2 of the License, or
|
22 |
-
(at your option) any later version.
|
23 |
-
|
24 |
-
This program is distributed in the hope that it will be useful,
|
25 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
26 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
27 |
-
GNU General Public License for more details.
|
28 |
-
|
29 |
-
You should have received a copy of the GNU General Public License
|
30 |
-
along with this program; if not, write to the Free Software
|
31 |
-
Found
|
32 |
-
*/
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Our main entry point for our modern unit-tested JS
|
36 |
-
* This file gets run through Webpack to built it into valid ES5
|
37 |
-
*
|
38 |
-
* As we convert more JS to ES6 we'll likely load it from this file (unless we decide to make each feature modular)
|
39 |
-
*
|
40 |
-
* @since 4.1
|
41 |
-
*/
|
42 |
-
$(function () {
|
43 |
-
|
44 |
-
'use strict'
|
45 |
-
|
46 |
-
/* Initialise the Fancy Template Picker */
|
47 |
-
if (GFPDF.templateList !== undefined) {
|
48 |
-
|
49 |
-
// To add to window
|
50 |
-
if (!window.Promise) {
|
51 |
-
window.Promise = Promise;
|
52 |
-
}
|
53 |
-
|
54 |
-
/* Check if we should show the Fancy Template Picker */
|
55 |
-
var templateId = '#gfpdf_settings\\[template\\], #gfpdf_settings\\[default_template\\]'
|
56 |
-
var $templateField = $(templateId)
|
57 |
-
|
58 |
-
/* Run this code if the element exists */
|
59 |
-
if ($templateField.length > 0) {
|
60 |
-
templateBootstrap($templateField)
|
61 |
-
}
|
62 |
-
}
|
63 |
-
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/react/reducers/templateReducer.js
DELETED
@@ -1,155 +0,0 @@
|
|
1 |
-
import { fromJS } from 'immutable'
|
2 |
-
import {
|
3 |
-
SEARCH_TEMPLATES,
|
4 |
-
SELECT_TEMPLATE,
|
5 |
-
ADD_TEMPLATE,
|
6 |
-
UPDATE_TEMPLATE,
|
7 |
-
UPDATE_TEMPLATE_PARAM,
|
8 |
-
DELETE_TEMPLATE,
|
9 |
-
} from '../actionTypes/templates'
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Our Redux Template Reducer that take the objects returned from our Redux Template Actions
|
13 |
-
* and updates the template portion of our store in an immutable way
|
14 |
-
*
|
15 |
-
* @package Gravity PDF
|
16 |
-
* @copyright Copyright (c) 2017, Blue Liquid Designs
|
17 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
18 |
-
* @since 4.1
|
19 |
-
*/
|
20 |
-
|
21 |
-
/*
|
22 |
-
This file is part of Gravity PDF.
|
23 |
-
|
24 |
-
Gravity PDF – Copyright (C) 2017, Blue Liquid Designs
|
25 |
-
|
26 |
-
This program is free software; you can redistribute it and/or modify
|
27 |
-
it under the terms of the GNU General Public License as published by
|
28 |
-
the Free Software Foundation; either version 2 of the License, or
|
29 |
-
(at your option) any later version.
|
30 |
-
|
31 |
-
This program is distributed in the hope that it will be useful,
|
32 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
33 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
34 |
-
GNU General Public License for more details.
|
35 |
-
|
36 |
-
You should have received a copy of the GNU General Public License
|
37 |
-
along with this program; if not, write to the Free Software
|
38 |
-
Found
|
39 |
-
*/
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Setup the initial state of the "template" portion of our Redux store
|
43 |
-
*
|
44 |
-
* @type {{list: any, activeTemplate: (any), search: string}}
|
45 |
-
*
|
46 |
-
* @since 4.1
|
47 |
-
*/
|
48 |
-
export const initialState = {
|
49 |
-
list: fromJS(GFPDF.templateList),
|
50 |
-
activeTemplate: GFPDF.activeTemplate || GFPDF.activeDefaultTemplate,
|
51 |
-
search: '',
|
52 |
-
}
|
53 |
-
|
54 |
-
/**
|
55 |
-
* Returns the first Immutable Map in our Immutable List which
|
56 |
-
* matches the template id passed.
|
57 |
-
*
|
58 |
-
* @param {Object} list The Immutable list of templates
|
59 |
-
* @param {string} id The template ID
|
60 |
-
*
|
61 |
-
* @returns object Immutable Map object of our template
|
62 |
-
*
|
63 |
-
* @since 4.1
|
64 |
-
*/
|
65 |
-
const getTemplateIndex = (list, id) => {
|
66 |
-
return list.findKey((template) => {
|
67 |
-
if (template.get('id') === id) {
|
68 |
-
return true
|
69 |
-
}
|
70 |
-
})
|
71 |
-
}
|
72 |
-
|
73 |
-
/**
|
74 |
-
* The action template reducer which updates our state
|
75 |
-
*
|
76 |
-
* @param {Object} state The current state of our template store
|
77 |
-
* @param {Object} action The Redux action details being triggered
|
78 |
-
*
|
79 |
-
* @returns {Object} State (whether updated or not)
|
80 |
-
*
|
81 |
-
* @since 4.1
|
82 |
-
*/
|
83 |
-
export default function (state = initialState, action) {
|
84 |
-
|
85 |
-
switch (action.type) {
|
86 |
-
/**
|
87 |
-
* Update the search key
|
88 |
-
*
|
89 |
-
* @since 4.1
|
90 |
-
*/
|
91 |
-
case SEARCH_TEMPLATES:
|
92 |
-
return {
|
93 |
-
...state,
|
94 |
-
search: action.text
|
95 |
-
}
|
96 |
-
|
97 |
-
/**
|
98 |
-
* Update the activeTemplate key
|
99 |
-
*
|
100 |
-
* @since 4.1
|
101 |
-
*/
|
102 |
-
case SELECT_TEMPLATE:
|
103 |
-
return {
|
104 |
-
...state,
|
105 |
-
activeTemplate: action.id
|
106 |
-
}
|
107 |
-
|
108 |
-
/**
|
109 |
-
* Push a new template Immutable Map onto our Immutable List
|
110 |
-
*
|
111 |
-
* @since 4.1
|
112 |
-
*/
|
113 |
-
case ADD_TEMPLATE:
|
114 |
-
return {
|
115 |
-
...state,
|
116 |
-
list: state.list.push(action.template)
|
117 |
-
}
|
118 |
-
|
119 |
-
/**
|
120 |
-
* Replace template Immutable Map with new Map
|
121 |
-
*
|
122 |
-
* @since 4.1
|
123 |
-
*/
|
124 |
-
case UPDATE_TEMPLATE:
|
125 |
-
return {
|
126 |
-
...state,
|
127 |
-
list: state.list.set(getTemplateIndex(state.list, action.template.get('id')), action.template)
|
128 |
-
}
|
129 |
-
|
130 |
-
/**
|
131 |
-
* Replace single parameter in template Immutable Map with new value
|
132 |
-
*
|
133 |
-
* @since 4.1
|
134 |
-
*/
|
135 |
-
case UPDATE_TEMPLATE_PARAM:
|
136 |
-
return {
|
137 |
-
...state,
|
138 |
-
list: state.list.setIn([ getTemplateIndex(state.list, action.id), action.name ], action.value)
|
139 |
-
}
|
140 |
-
|
141 |
-
/**
|
142 |
-
* Remove template Immutable Map from Immutable List
|
143 |
-
*
|
144 |
-
* @since 4.1
|
145 |
-
*/
|
146 |
-
case DELETE_TEMPLATE:
|
147 |
-
return {
|
148 |
-
...state,
|
149 |
-
list: state.list.delete(getTemplateIndex(state.list, action.id))
|
150 |
-
}
|
151 |
-
}
|
152 |
-
|
153 |
-
/* None of these actions fired so return state */
|
154 |
-
return state
|
155 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/react/router/templateRouter.js
DELETED
@@ -1,122 +0,0 @@
|
|
1 |
-
import React from 'react'
|
2 |
-
|
3 |
-
import { render } from 'react-dom'
|
4 |
-
import { Provider } from 'react-redux'
|
5 |
-
|
6 |
-
import { HashRouter as Router, Route, Switch } from 'react-router-dom'
|
7 |
-
|
8 |
-
import TemplateList from '../components/TemplateList'
|
9 |
-
import TemplateSingle from '../components/TemplateSingle'
|
10 |
-
import Empty from '../components/Empty'
|
11 |
-
|
12 |
-
/**
|
13 |
-
* React Router v3 Routes with our Redux store integrated
|
14 |
-
*
|
15 |
-
* Once React Router v4 becomes stable we'll update as required, or if we need to decouple our
|
16 |
-
* routes for another module.
|
17 |
-
*
|
18 |
-
* @package Gravity PDF
|
19 |
-
* @copyright Copyright (c) 2017, Blue Liquid Designs
|
20 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
21 |
-
* @since 4.1
|
22 |
-
*/
|
23 |
-
|
24 |
-
/*
|
25 |
-
This file is part of Gravity PDF.
|
26 |
-
|
27 |
-
Gravity PDF – Copyright (C) 2017, Blue Liquid Designs
|
28 |
-
|
29 |
-
This program is free software; you can redistribute it and/or modify
|
30 |
-
it under the terms of the GNU General Public License as published by
|
31 |
-
the Free Software Foundation; either version 2 of the License, or
|
32 |
-
(at your option) any later version.
|
33 |
-
|
34 |
-
This program is distributed in the hope that it will be useful,
|
35 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
36 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
37 |
-
GNU General Public License for more details.
|
38 |
-
|
39 |
-
You should have received a copy of the GNU General Public License
|
40 |
-
along with this program; if not, write to the Free Software
|
41 |
-
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
42 |
-
*/
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Contains the React Router Routes for our Advanced Template Selector.
|
46 |
-
* We are using hashHistory instead of browserHistory so as not to affect the backend
|
47 |
-
*
|
48 |
-
* Routes include:
|
49 |
-
*
|
50 |
-
* /template/ (../components/TemplateList)
|
51 |
-
* /template/:id (../components/TemplateSingle)
|
52 |
-
* All other routes (../components/Empty)
|
53 |
-
*
|
54 |
-
* @since 4.1
|
55 |
-
*/
|
56 |
-
export const Routes = () => (
|
57 |
-
<Router>
|
58 |
-
<Switch>
|
59 |
-
<Route path="/template"
|
60 |
-
exact
|
61 |
-
render={(props) => (
|
62 |
-
<TemplateList
|
63 |
-
{...props}
|
64 |
-
|
65 |
-
ajaxUrl={GFPDF.ajaxUrl}
|
66 |
-
ajaxNonce={GFPDF.ajaxNonce}
|
67 |
-
|
68 |
-
templateDetailsText={GFPDF.templateDetails}
|
69 |
-
templateHeaderText={GFPDF.installedPdfs}
|
70 |
-
|
71 |
-
genericUploadErrorText={GFPDF.problemWithTheUpload}
|
72 |
-
activateText={GFPDF.select}
|
73 |
-
addTemplateText={GFPDF.addNewTemplate}
|
74 |
-
filenameErrorText={GFPDF.uploadInvalidNotZipFile}
|
75 |
-
filesizeErrorText={GFPDF.uploadInvalidExceedsFileSizeLimit}
|
76 |
-
installSuccessText={GFPDF.templateSuccessfullyInstalled}
|
77 |
-
installUpdatedText={GFPDF.templateSuccessfullyUpdated}
|
78 |
-
templateSuccessfullyInstalledUpdated={GFPDF.templateSuccessfullyInstalledUpdated}
|
79 |
-
templateInstallInstructions={GFPDF.templateInstallInstructions}
|
80 |
-
/>
|
81 |
-
)}
|
82 |
-
/>
|
83 |
-
|
84 |
-
<Route path="/template/:id"
|
85 |
-
render={(props) => (
|
86 |
-
<TemplateSingle
|
87 |
-
{...props}
|
88 |
-
|
89 |
-
ajaxUrl={GFPDF.ajaxUrl}
|
90 |
-
ajaxNonce={GFPDF.ajaxNonce}
|
91 |
-
pdfWorkingDirPath={GFPDF.pdfWorkingDir}
|
92 |
-
|
93 |
-
activateText={GFPDF.select}
|
94 |
-
templateDeleteText={GFPDF.delete}
|
95 |
-
templateConfirmDeleteText={GFPDF.doYouWantToDeleteTemplate}
|
96 |
-
templateDeleteErrorText={GFPDF.couldNotDeleteTemplate}
|
97 |
-
currentTemplateText={GFPDF.currentTemplate}
|
98 |
-
versionText={GFPDF.version}
|
99 |
-
groupText={GFPDF.group}
|
100 |
-
tagsText={GFPDF.tags}
|
101 |
-
showPreviousTemplateText={GFPDF.showPreviousTemplate}
|
102 |
-
showNextTemplateText={GFPDF.showNextTemplate}
|
103 |
-
/>
|
104 |
-
)}
|
105 |
-
/>
|
106 |
-
|
107 |
-
<Route component={Empty}/>
|
108 |
-
</Switch>
|
109 |
-
</Router>)
|
110 |
-
|
111 |
-
/**
|
112 |
-
* Setup React Router with our Redux Store
|
113 |
-
*
|
114 |
-
* @param {Object} store Redux Store
|
115 |
-
*
|
116 |
-
* @since 4.1
|
117 |
-
*/
|
118 |
-
export default function TemplatesRouter (store) {
|
119 |
-
render((<Provider store={store}>
|
120 |
-
<Routes />
|
121 |
-
</Provider>), document.getElementById('gfpdf-overlay'))
|
122 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/react/selectors/getTemplates.js
DELETED
@@ -1,186 +0,0 @@
|
|
1 |
-
import { createSelector } from 'reselect'
|
2 |
-
import versionCompare from '../utilities/versionCompare'
|
3 |
-
|
4 |
-
/**
|
5 |
-
* Uses the Redux Reselect library to sort, filter and search our templates.
|
6 |
-
* It also checks if the PDF templates are compatible with the current version of Gravity PDF
|
7 |
-
*
|
8 |
-
* @package Gravity PDF
|
9 |
-
* @copyright Copyright (c) 2017, Blue Liquid Designs
|
10 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
-
* @since 4.1
|
12 |
-
*/
|
13 |
-
|
14 |
-
/*
|
15 |
-
This file is part of Gravity PDF.
|
16 |
-
|
17 |
-
Gravity PDF – Copyright (C) 2017, Blue Liquid Designs
|
18 |
-
|
19 |
-
This program is free software; you can redistribute it and/or modify
|
20 |
-
it under the terms of the GNU General Public License as published by
|
21 |
-
the Free Software Foundation; either version 2 of the License, or
|
22 |
-
(at your option) any later version.
|
23 |
-
|
24 |
-
This program is distributed in the hope that it will be useful,
|
25 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
26 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
27 |
-
GNU General Public License for more details.
|
28 |
-
|
29 |
-
You should have received a copy of the GNU General Public License
|
30 |
-
along with this program; if not, write to the Free Software
|
31 |
-
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
32 |
-
*/
|
33 |
-
|
34 |
-
/* Assign specific parts of the Redux store to constants (note, we are returning functions) */
|
35 |
-
const getTemplates = (state) => state.template.list
|
36 |
-
const getSearch = (state) => state.template.search
|
37 |
-
const getActiveTemplate = (state) => state.template.activeTemplate
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Searches our templates for specific terms and returns the results
|
41 |
-
* This function is adapted from the Backbone.js filter for themes
|
42 |
-
*
|
43 |
-
* @param {string} term
|
44 |
-
* @param {Object} templates Immutable List of templates
|
45 |
-
*
|
46 |
-
* @returns {Object} Filtered Immutable list of templates
|
47 |
-
*
|
48 |
-
* @since 4.1
|
49 |
-
*/
|
50 |
-
export const searchTemplates = (term, templates) => {
|
51 |
-
/*
|
52 |
-
* Escape the term string for RegExp meta characters
|
53 |
-
* Consider spaces as word delimiters and match the whole string
|
54 |
-
*/
|
55 |
-
term = term.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')
|
56 |
-
term = term.replace(/ /g, ')(?=.*')
|
57 |
-
|
58 |
-
const match = new RegExp('^(?=.*' + term + ').+', 'i')
|
59 |
-
|
60 |
-
/* Filter through the templates. Any templates return "true" in out match.test() statement will be included */
|
61 |
-
const results = templates.filter((template) => {
|
62 |
-
|
63 |
-
/* Do very basic HTML tag removal from the fields we are interested in */
|
64 |
-
const name = template.get('template').replace(/(<([^>]+)>)/ig, '')
|
65 |
-
const description = template.get('description').replace(/(<([^>]+)>)/ig, '')
|
66 |
-
const author = template.get('author').replace(/(<([^>]+)>)/ig, '')
|
67 |
-
const group = template.get('group').replace(/(<([^>]+)>)/ig, '')
|
68 |
-
|
69 |
-
/* Check if our matching term(s) are found in the string */
|
70 |
-
return match.test([ name, template.get('id'), group, description, author ].toString())
|
71 |
-
})
|
72 |
-
|
73 |
-
return results
|
74 |
-
}
|
75 |
-
|
76 |
-
/**
|
77 |
-
* A PDF template sorting function
|
78 |
-
*
|
79 |
-
* The sort order is as follows:
|
80 |
-
*
|
81 |
-
* 1. Any new templates get auto-shifted to the back of the list (just installed)
|
82 |
-
* 2. The active template gets auto-shifted to the front of the list
|
83 |
-
* 3. The templates are then sorted alphabetically by group
|
84 |
-
* 4. Then alphabetically by name
|
85 |
-
*
|
86 |
-
* @param {Object} templates The Immutable list of templates
|
87 |
-
* @param {string} activeTemplate The current active PDF template
|
88 |
-
*
|
89 |
-
* @returns {Object} Sorted Immutable List
|
90 |
-
*
|
91 |
-
* @since 4.1
|
92 |
-
*/
|
93 |
-
export const sortTemplates = (templates, activeTemplate) => {
|
94 |
-
/* Sort out template list using our comparator function */
|
95 |
-
return templates.sort((a, b) => {
|
96 |
-
|
97 |
-
/* Shift new templates to the bottom (only on install) */
|
98 |
-
if (a.get('new', false) === true && a.get('new', false) === true) {
|
99 |
-
return 0 //equal
|
100 |
-
}
|
101 |
-
|
102 |
-
if (a.get('new', false) === true) {
|
103 |
-
return 1
|
104 |
-
}
|
105 |
-
|
106 |
-
if (b.get('new', false) === true) {
|
107 |
-
return -1
|
108 |
-
}
|
109 |
-
|
110 |
-
/* Hoist the active template above the rest */
|
111 |
-
if (activeTemplate === a.get('id')) {
|
112 |
-
return -1
|
113 |
-
}
|
114 |
-
|
115 |
-
if (activeTemplate === b.get('id')) {
|
116 |
-
return 1
|
117 |
-
}
|
118 |
-
|
119 |
-
/* Order alphabetically by the group name */
|
120 |
-
if (a.get('group') < b.get('group')) {
|
121 |
-
return -1 //before
|
122 |
-
}
|
123 |
-
|
124 |
-
if (a.get('group') > b.get('group')) {
|
125 |
-
return 1 //after
|
126 |
-
}
|
127 |
-
|
128 |
-
/* Then order alphabetically by the template name */
|
129 |
-
if (a.get('template') < b.get('template')) {
|
130 |
-
return -1 //before
|
131 |
-
}
|
132 |
-
|
133 |
-
if (a.get('template') > b.get('template')) {
|
134 |
-
return 1 //after
|
135 |
-
}
|
136 |
-
|
137 |
-
return 0 //equal
|
138 |
-
})
|
139 |
-
}
|
140 |
-
|
141 |
-
/**
|
142 |
-
* Check all PDF templates for compatibility with the current verison of Gravity PDF
|
143 |
-
* If they don't pass we'll also dynamically apply error messages
|
144 |
-
*
|
145 |
-
* @param {Object} templates The Immutable list of templates
|
146 |
-
*
|
147 |
-
* @returns {Object} The Immutable list of templates
|
148 |
-
*
|
149 |
-
* @since 4.1
|
150 |
-
*/
|
151 |
-
export const addCompatibilityCheck = (templates) => {
|
152 |
-
/* Apply this function to all templates */
|
153 |
-
return templates.map((template) => {
|
154 |
-
/* Get the PDF version and check it against the Gravity PDF version */
|
155 |
-
const requiredVersion = template.get('required_pdf_version')
|
156 |
-
if (versionCompare(requiredVersion, GFPDF.currentVersion, '>')) {
|
157 |
-
/* Not compatible, so let's mark it */
|
158 |
-
return template.merge({
|
159 |
-
'compatible': false,
|
160 |
-
'error': GFPDF.requiresGravityPdfVersion.replace(/%s/g, requiredVersion),
|
161 |
-
'long_error': GFPDF.templateNotCompatibleWithGravityPdfVersion.replace(/%s/g, requiredVersion)
|
162 |
-
})
|
163 |
-
}
|
164 |
-
/* If versionCompare() passed we'll mark as true */
|
165 |
-
return template.set('compatible', true)
|
166 |
-
})
|
167 |
-
}
|
168 |
-
|
169 |
-
/**
|
170 |
-
* Create our Reselect selector and apply to our store
|
171 |
-
*
|
172 |
-
* @since 4.1
|
173 |
-
*/
|
174 |
-
export default createSelector(
|
175 |
-
[ getTemplates, getSearch, getActiveTemplate ],
|
176 |
-
(templates, search, activeTemplate) => {
|
177 |
-
|
178 |
-
templates = addCompatibilityCheck(templates)
|
179 |
-
|
180 |
-
if (search) {
|
181 |
-
templates = searchTemplates(search, templates)
|
182 |
-
}
|
183 |
-
|
184 |
-
return sortTemplates(templates, activeTemplate)
|
185 |
-
}
|
186 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/js/react/utilities/versionCompare.js
DELETED
@@ -1,153 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* A JS-port of PHP's version_compare()
|
3 |
-
*
|
4 |
-
* This function is taken from the Locutus project which has an MIT license.
|
5 |
-
* The MIT license and copyright notice is included
|
6 |
-
*
|
7 |
-
* https://github.com/kvz/locutus
|
8 |
-
* https://github.com/kvz/locutus/blob/master/src/php/info/version_compare.js
|
9 |
-
*
|
10 |
-
* @param string v1 First version number
|
11 |
-
* @param string v2 Second version number
|
12 |
-
* @param string operator optional If the third optional operator argument is specified, test for a particular relationship.
|
13 |
-
* The possible operators are: <, lt, <=, le, >, gt, >=, ge, ==, =, eq, !=, <>, ne respectively.
|
14 |
-
* @returns -1 if the first version is lower than the second, 0 if they are equal, and 1 if the second is lower.
|
15 |
-
* When using the optional operator argument, the function will return TRUE if the relationship is the one specified by the operator, FALSE otherwise.
|
16 |
-
*/
|
17 |
-
|
18 |
-
/*
|
19 |
-
Copyright (c) 2007-2016 Kevin van Zonneveld (http://kvz.io)
|
20 |
-
and Contributors (http://locutus.io/authors)
|
21 |
-
|
22 |
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
23 |
-
this software and associated documentation files (the "Software"), to deal in
|
24 |
-
the Software without restriction, including without limitation the rights to
|
25 |
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
26 |
-
of the Software, and to permit persons to whom the Software is furnished to do
|
27 |
-
so, subject to the following conditions:
|
28 |
-
|
29 |
-
The above copyright notice and this permission notice shall be included in all
|
30 |
-
copies or substantial portions of the Software.
|
31 |
-
|
32 |
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
33 |
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
34 |
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
35 |
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
36 |
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
37 |
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
38 |
-
SOFTWARE.
|
39 |
-
*/
|
40 |
-
export default (v1, v2, operator) => {
|
41 |
-
// discuss at: http://locutus.io/php/version_compare/
|
42 |
-
// original by: Philippe Jausions (http://pear.php.net/user/jausions)
|
43 |
-
// original by: Aidan Lister (http://aidanlister.com/)
|
44 |
-
// reimplemented by: Kankrelune (http://www.webfaktory.info/)
|
45 |
-
// improved by: Brett Zamir (http://brett-zamir.me)
|
46 |
-
// improved by: Scott Baker
|
47 |
-
// improved by: Theriault (https://github.com/Theriault)
|
48 |
-
// example 1: version_compare('8.2.5rc', '8.2.5a')
|
49 |
-
// returns 1: 1
|
50 |
-
// example 2: version_compare('8.2.50', '8.2.52', '<')
|
51 |
-
// returns 2: true
|
52 |
-
// example 3: version_compare('5.3.0-dev', '5.3.0')
|
53 |
-
// returns 3: -1
|
54 |
-
// example 4: version_compare('4.1.0.52','4.01.0.51')
|
55 |
-
// returns 4: 1
|
56 |
-
|
57 |
-
// Important: compare must be initialized at 0.
|
58 |
-
var i
|
59 |
-
var x
|
60 |
-
var compare = 0
|
61 |
-
|
62 |
-
// vm maps textual PHP versions to negatives so they're less than 0.
|
63 |
-
// PHP currently defines these as CASE-SENSITIVE. It is important to
|
64 |
-
// leave these as negatives so that they can come before numerical versions
|
65 |
-
// and as if no letters were there to begin with.
|
66 |
-
// (1alpha is < 1 and < 1.1 but > 1dev1)
|
67 |
-
// If a non-numerical value can't be mapped to this table, it receives
|
68 |
-
// -7 as its value.
|
69 |
-
var vm = {
|
70 |
-
'dev': -6,
|
71 |
-
'alpha': -5,
|
72 |
-
'a': -5,
|
73 |
-
'beta': -4,
|
74 |
-
'b': -4,
|
75 |
-
'RC': -3,
|
76 |
-
'rc': -3,
|
77 |
-
'#': -2,
|
78 |
-
'p': 1,
|
79 |
-
'pl': 1
|
80 |
-
}
|
81 |
-
|
82 |
-
// This function will be called to prepare each version argument.
|
83 |
-
// It replaces every _, -, and + with a dot.
|
84 |
-
// It surrounds any nonsequence of numbers/dots with dots.
|
85 |
-
// It replaces sequences of dots with a single dot.
|
86 |
-
// version_compare('4..0', '4.0') === 0
|
87 |
-
// Important: A string of 0 length needs to be converted into a value
|
88 |
-
// even less than an unexisting value in vm (-7), hence [-8].
|
89 |
-
// It's also important to not strip spaces because of this.
|
90 |
-
// version_compare('', ' ') === 1
|
91 |
-
var _prepVersion = function _prepVersion (v) {
|
92 |
-
v = ('' + v).replace(/[_\-+]/g, '.')
|
93 |
-
v = v.replace(/([^.\d]+)/g, '.$1.').replace(/\.{2,}/g, '.')
|
94 |
-
return !v.length ? [ -8 ] : v.split('.')
|
95 |
-
}
|
96 |
-
// This converts a version component to a number.
|
97 |
-
// Empty component becomes 0.
|
98 |
-
// Non-numerical component becomes a negative number.
|
99 |
-
// Numerical component becomes itself as an integer.
|
100 |
-
var _numVersion = function _numVersion (v) {
|
101 |
-
return !v ? 0 : isNaN(v) ? vm[ v ] || -7 : parseInt(v, 10)
|
102 |
-
}
|
103 |
-
|
104 |
-
v1 = _prepVersion(v1)
|
105 |
-
v2 = _prepVersion(v2)
|
106 |
-
x = Math.max(v1.length, v2.length)
|
107 |
-
for (i = 0; i < x; i++) {
|
108 |
-
if (v1[ i ] === v2[ i ]) {
|
109 |
-
continue
|
110 |
-
}
|
111 |
-
v1[ i ] = _numVersion(v1[ i ])
|
112 |
-
v2[ i ] = _numVersion(v2[ i ])
|
113 |
-
if (v1[ i ] < v2[ i ]) {
|
114 |
-
compare = -1
|
115 |
-
break
|
116 |
-
} else if (v1[ i ] > v2[ i ]) {
|
117 |
-
compare = 1
|
118 |
-
break
|
119 |
-
}
|
120 |
-
}
|
121 |
-
if (!operator) {
|
122 |
-
return compare
|
123 |
-
}
|
124 |
-
|
125 |
-
// Important: operator is CASE-SENSITIVE.
|
126 |
-
// "No operator" seems to be treated as "<."
|
127 |
-
// Any other values seem to make the function return null.
|
128 |
-
switch (operator) {
|
129 |
-
case '>':
|
130 |
-
case 'gt':
|
131 |
-
return compare > 0
|
132 |
-
case '>=':
|
133 |
-
case 'ge':
|
134 |
-
return compare >= 0
|
135 |
-
case '<=':
|
136 |
-
case 'le':
|
137 |
-
return compare <= 0
|
138 |
-
case '===':
|
139 |
-
case '=':
|
140 |
-
case 'eq':
|
141 |
-
return compare === 0
|
142 |
-
case '<>':
|
143 |
-
case '!==':
|
144 |
-
case 'ne':
|
145 |
-
return compare !== 0
|
146 |
-
case '':
|
147 |
-
case '<':
|
148 |
-
case 'lt':
|
149 |
-
return compare < 0
|
150 |
-
default:
|
151 |
-
return null
|
152 |
-
}
|
153 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/assets/languages/gravity-forms-pdf-extended.pot
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
# Copyright (C)
|
2 |
# This file is distributed under the same license as the Gravity PDF package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
@@ -102,11 +102,19 @@ msgid "Support"
|
|
102 |
msgstr ""
|
103 |
|
104 |
#: src/bootstrap.php:335
|
105 |
-
msgid "View Gravity PDF
|
106 |
msgstr ""
|
107 |
|
108 |
-
#: src/bootstrap.php:335
|
109 |
-
msgid "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
msgstr ""
|
111 |
|
112 |
#: src/controller/Controller_Actions.php:156
|
@@ -117,7 +125,7 @@ msgstr ""
|
|
117 |
msgid "Begin Migration"
|
118 |
msgstr ""
|
119 |
|
120 |
-
#: src/controller/Controller_Actions.php:235, src/model/Model_Form_Settings.php:
|
121 |
msgid "You do not have permission to access this page"
|
122 |
msgstr ""
|
123 |
|
@@ -129,7 +137,7 @@ msgstr ""
|
|
129 |
msgid "There was a problem uninstalling Gravity PDF. Please try again."
|
130 |
msgstr ""
|
131 |
|
132 |
-
#: src/controller/Controller_PDF.php:
|
133 |
msgid "There was a problem generating your PDF"
|
134 |
msgstr ""
|
135 |
|
@@ -137,7 +145,7 @@ msgstr ""
|
|
137 |
msgid "There was a problem installing the PDF templates. Please try again."
|
138 |
msgstr ""
|
139 |
|
140 |
-
#: src/controller/Controller_Shortcodes.php:
|
141 |
msgid "Gravity PDF"
|
142 |
msgstr ""
|
143 |
|
@@ -197,11 +205,11 @@ msgstr ""
|
|
197 |
msgid "Delete"
|
198 |
msgstr ""
|
199 |
|
200 |
-
#: src/helper/Helper_Data.php:237, src/helper/Helper_PDF_List_Table.php:247, src/helper/Helper_PDF_List_Table.php:248, src/model/Model_Form_Settings.php:
|
201 |
msgid "Active"
|
202 |
msgstr ""
|
203 |
|
204 |
-
#: src/helper/Helper_Data.php:238, src/helper/Helper_PDF_List_Table.php:247, src/helper/Helper_PDF_List_Table.php:248, src/model/Model_Form_Settings.php:
|
205 |
msgid "Inactive"
|
206 |
msgstr ""
|
207 |
|
@@ -377,7 +385,7 @@ msgstr ""
|
|
377 |
msgid "Set the default paper size used when generating PDFs."
|
378 |
msgstr ""
|
379 |
|
380 |
-
#: src/helper/Helper_Options_Fields.php:99, src/helper/Helper_Options_Fields.php:362, src/helper/abstract/Helper_Abstract_Options.php:
|
381 |
msgid "Custom Paper Size"
|
382 |
msgstr ""
|
383 |
|
@@ -390,15 +398,11 @@ msgid "Default Template"
|
|
390 |
msgstr ""
|
391 |
|
392 |
#: src/helper/Helper_Options_Fields.php:111, src/helper/Helper_Options_Fields.php:291
|
393 |
-
msgid "Choose an existing template or purchased more %sfrom our
|
394 |
msgstr ""
|
395 |
|
396 |
#: src/helper/Helper_Options_Fields.php:117, src/helper/Helper_Options_Fields.php:297
|
397 |
-
msgid "
|
398 |
-
msgstr ""
|
399 |
-
|
400 |
-
#: src/helper/Helper_Options_Fields.php:117, src/helper/Helper_Options_Fields.php:297
|
401 |
-
msgid "Gravity PDF comes with %sfour completely-free and highly customizable designs%s. You can also purchase additional templates from our theme shop, hire us to integrate existing PDFs or, with a bit of technical know-how, build your own."
|
402 |
msgstr ""
|
403 |
|
404 |
#: src/helper/Helper_Options_Fields.php:122
|
@@ -873,7 +877,7 @@ msgstr ""
|
|
873 |
msgid "For the best results, use a JPG or non-interlaced 8-Bit PNG that has the same dimensions as the paper size."
|
874 |
msgstr ""
|
875 |
|
876 |
-
#: src/helper/Helper_PDF.php:
|
877 |
msgid "The PDF Template %s requires Gravity PDF version %s. Upgrade to the latest version."
|
878 |
msgstr ""
|
879 |
|
@@ -917,7 +921,7 @@ msgstr ""
|
|
917 |
msgid "Requires Gravity PDF"
|
918 |
msgstr ""
|
919 |
|
920 |
-
#: src/helper/Helper_Templates.php:392, src/view/View_PDF.php:
|
921 |
msgid "Legacy"
|
922 |
msgstr ""
|
923 |
|
@@ -929,47 +933,47 @@ msgstr ""
|
|
929 |
msgid "Database import problem for site #%s"
|
930 |
msgstr ""
|
931 |
|
932 |
-
#: src/model/Model_Form_Settings.php:
|
933 |
msgid "Update PDF"
|
934 |
msgstr ""
|
935 |
|
936 |
-
#: src/model/Model_Form_Settings.php:
|
937 |
msgid "Add PDF"
|
938 |
msgstr ""
|
939 |
|
940 |
-
#: src/model/Model_Form_Settings.php:
|
941 |
msgid "There was a problem saving your PDF settings. Please try again."
|
942 |
msgstr ""
|
943 |
|
944 |
-
#: src/model/Model_Form_Settings.php:
|
945 |
msgid "PDF could not be saved. Please enter all required information below."
|
946 |
msgstr ""
|
947 |
|
948 |
-
#: src/model/Model_Form_Settings.php:
|
949 |
msgid "PDF saved successfully. %sBack to PDF list.%s"
|
950 |
msgstr ""
|
951 |
|
952 |
-
#: src/model/Model_Form_Settings.php:
|
953 |
msgid "PDF successfully deleted."
|
954 |
msgstr ""
|
955 |
|
956 |
-
#: src/model/Model_Form_Settings.php:
|
957 |
msgid "PDF successfully duplicated."
|
958 |
msgstr ""
|
959 |
|
960 |
-
#: src/model/Model_Install.php:
|
961 |
msgid "There was a problem creating the %s directory. Ensure you have write permissions to your uploads folder."
|
962 |
msgstr ""
|
963 |
|
964 |
-
#: src/model/Model_Install.php:
|
965 |
msgid "Gravity PDF does not have write permission to the %s directory. Contact your web hosting provider to fix the issue."
|
966 |
msgstr ""
|
967 |
|
968 |
-
#: src/model/Model_Install.php:
|
969 |
msgid "There was a problem removing the Gravity Form \"%s\" PDF configuration. Try delete manually."
|
970 |
msgstr ""
|
971 |
|
972 |
-
#: src/model/Model_Install.php:
|
973 |
msgid "There was a problem removing the %s directory. Clean up manually via (S)FTP."
|
974 |
msgstr ""
|
975 |
|
@@ -985,15 +989,15 @@ msgstr ""
|
|
985 |
msgid "Your PDF is no longer accessible."
|
986 |
msgstr ""
|
987 |
|
988 |
-
#: src/model/Model_PDF.php:
|
989 |
msgid "You do not have access to view this PDF."
|
990 |
msgstr ""
|
991 |
|
992 |
-
#: src/model/Model_PDF.php:
|
993 |
msgid "The PDF could not be saved."
|
994 |
msgstr ""
|
995 |
|
996 |
-
#: src/model/Model_PDF.php:
|
997 |
msgid "Could not find PDF configuration requested"
|
998 |
msgstr ""
|
999 |
|
@@ -1029,11 +1033,11 @@ msgstr ""
|
|
1029 |
msgid "A font with the same name already exists. Try a different name."
|
1030 |
msgstr ""
|
1031 |
|
1032 |
-
#: src/model/Model_Settings.php:
|
1033 |
msgid "License deactivated."
|
1034 |
msgstr ""
|
1035 |
|
1036 |
-
#: src/model/Model_Settings.php:
|
1037 |
msgid "An error occurred during deactivation, please try again"
|
1038 |
msgstr ""
|
1039 |
|
@@ -1065,23 +1069,19 @@ msgstr ""
|
|
1065 |
msgid "License"
|
1066 |
msgstr ""
|
1067 |
|
1068 |
-
#: src/view/View_Settings.php:
|
1069 |
-
msgid "Extensions"
|
1070 |
-
msgstr ""
|
1071 |
-
|
1072 |
-
#: src/view/View_Settings.php:349, src/view/html/Settings/system_status.php:52
|
1073 |
msgid "WP Memory Available"
|
1074 |
msgstr ""
|
1075 |
|
1076 |
-
#: src/view/View_Settings.php:
|
1077 |
msgid "Producing PDF documents is hard work and Gravity PDF requires more resources than most plugins. We strongly recommend you have at least 128MB, but you may need more."
|
1078 |
msgstr ""
|
1079 |
|
1080 |
-
#: src/view/View_Settings.php:
|
1081 |
msgid "Direct PDF Protection"
|
1082 |
msgstr ""
|
1083 |
|
1084 |
-
#: src/view/View_Settings.php:
|
1085 |
msgid "Apache and Litespeed servers automatically disable public access to the Gravity PDF temporary directory using a %s.htaccess%s file, but other web servers like Nginx do not support this feature. We will check if your PDFs are automatically protected, and let you know what you can do to protect your data if they are not."
|
1086 |
msgstr ""
|
1087 |
|
@@ -1097,307 +1097,307 @@ msgstr ""
|
|
1097 |
msgid "You must pass in a valid form ID"
|
1098 |
msgstr ""
|
1099 |
|
1100 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1101 |
msgid "You must pass in a valid PDF ID"
|
1102 |
msgstr ""
|
1103 |
|
1104 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1105 |
msgid "Common Sizes"
|
1106 |
msgstr ""
|
1107 |
|
1108 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1109 |
msgid "A4 (210 x 297mm)"
|
1110 |
msgstr ""
|
1111 |
|
1112 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1113 |
msgid "Letter (8.5 x 11in)"
|
1114 |
msgstr ""
|
1115 |
|
1116 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1117 |
msgid "Legal (8.5 x 14in)"
|
1118 |
msgstr ""
|
1119 |
|
1120 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1121 |
msgid "Ledger / Tabloid (11 x 17in)"
|
1122 |
msgstr ""
|
1123 |
|
1124 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1125 |
msgid "Executive (7 x 10in)"
|
1126 |
msgstr ""
|
1127 |
|
1128 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1129 |
msgid "\"A\" Sizes"
|
1130 |
msgstr ""
|
1131 |
|
1132 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1133 |
msgid "A0 (841 x 1189mm)"
|
1134 |
msgstr ""
|
1135 |
|
1136 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1137 |
msgid "A1 (594 x 841mm)"
|
1138 |
msgstr ""
|
1139 |
|
1140 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1141 |
msgid "A2 (420 x 594mm)"
|
1142 |
msgstr ""
|
1143 |
|
1144 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1145 |
msgid "A3 (297 x 420mm)"
|
1146 |
msgstr ""
|
1147 |
|
1148 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1149 |
msgid "A5 (210 x 297mm)"
|
1150 |
msgstr ""
|
1151 |
|
1152 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1153 |
msgid "A6 (105 x 148mm)"
|
1154 |
msgstr ""
|
1155 |
|
1156 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1157 |
msgid "A7 (74 x 105mm)"
|
1158 |
msgstr ""
|
1159 |
|
1160 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1161 |
msgid "A8 (52 x 74mm)"
|
1162 |
msgstr ""
|
1163 |
|
1164 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1165 |
msgid "A9 (37 x 52mm)"
|
1166 |
msgstr ""
|
1167 |
|
1168 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1169 |
msgid "A10 (26 x 37mm)"
|
1170 |
msgstr ""
|
1171 |
|
1172 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1173 |
msgid "\"B\" Sizes"
|
1174 |
msgstr ""
|
1175 |
|
1176 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1177 |
msgid "B0 (1414 x 1000mm)"
|
1178 |
msgstr ""
|
1179 |
|
1180 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1181 |
msgid "B1 (1000 x 707mm)"
|
1182 |
msgstr ""
|
1183 |
|
1184 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1185 |
msgid "B2 (707 x 500mm)"
|
1186 |
msgstr ""
|
1187 |
|
1188 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1189 |
msgid "B3 (500 x 353mm)"
|
1190 |
msgstr ""
|
1191 |
|
1192 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1193 |
msgid "B4 (353 x 250mm)"
|
1194 |
msgstr ""
|
1195 |
|
1196 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1197 |
msgid "B5 (250 x 176mm)"
|
1198 |
msgstr ""
|
1199 |
|
1200 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1201 |
msgid "B6 (176 x 125mm)"
|
1202 |
msgstr ""
|
1203 |
|
1204 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1205 |
msgid "B7 (125 x 88mm)"
|
1206 |
msgstr ""
|
1207 |
|
1208 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1209 |
msgid "B8 (88 x 62mm)"
|
1210 |
msgstr ""
|
1211 |
|
1212 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1213 |
msgid "B9 (62 x 44mm)"
|
1214 |
msgstr ""
|
1215 |
|
1216 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1217 |
msgid "B10 (44 x 31mm)"
|
1218 |
msgstr ""
|
1219 |
|
1220 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1221 |
msgid "\"C\" Sizes"
|
1222 |
msgstr ""
|
1223 |
|
1224 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1225 |
msgid "C0 (1297 x 917mm)"
|
1226 |
msgstr ""
|
1227 |
|
1228 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1229 |
msgid "C1 (917 x 648mm)"
|
1230 |
msgstr ""
|
1231 |
|
1232 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1233 |
msgid "C2 (648 x 458mm)"
|
1234 |
msgstr ""
|
1235 |
|
1236 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1237 |
msgid "C3 (458 x 324mm)"
|
1238 |
msgstr ""
|
1239 |
|
1240 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1241 |
msgid "C4 (324 x 229mm)"
|
1242 |
msgstr ""
|
1243 |
|
1244 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1245 |
msgid "C5 (229 x 162mm)"
|
1246 |
msgstr ""
|
1247 |
|
1248 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1249 |
msgid "C6 (162 x 114mm)"
|
1250 |
msgstr ""
|
1251 |
|
1252 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1253 |
msgid "C7 (114 x 81mm)"
|
1254 |
msgstr ""
|
1255 |
|
1256 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1257 |
msgid "C8 (81 x 57mm)"
|
1258 |
msgstr ""
|
1259 |
|
1260 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1261 |
msgid "C9 (57 x 40mm)"
|
1262 |
msgstr ""
|
1263 |
|
1264 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1265 |
msgid "C10 (40 x 28mm)"
|
1266 |
msgstr ""
|
1267 |
|
1268 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1269 |
msgid "\"RA\" and \"SRA\" Sizes"
|
1270 |
msgstr ""
|
1271 |
|
1272 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1273 |
msgid "RA0 (860 x 1220mm)"
|
1274 |
msgstr ""
|
1275 |
|
1276 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1277 |
msgid "RA1 (610 x 860mm)"
|
1278 |
msgstr ""
|
1279 |
|
1280 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1281 |
msgid "RA2 (430 x 610mm)"
|
1282 |
msgstr ""
|
1283 |
|
1284 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1285 |
msgid "RA3 (305 x 430mm)"
|
1286 |
msgstr ""
|
1287 |
|
1288 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1289 |
msgid "RA4 (215 x 305mm)"
|
1290 |
msgstr ""
|
1291 |
|
1292 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1293 |
msgid "SRA0 (900 x 1280mm)"
|
1294 |
msgstr ""
|
1295 |
|
1296 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1297 |
msgid "SRA1 (640 x 900mm)"
|
1298 |
msgstr ""
|
1299 |
|
1300 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1301 |
msgid "SRA2 (450 x 640mm)"
|
1302 |
msgstr ""
|
1303 |
|
1304 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1305 |
msgid "SRA3 (320 x 450mm)"
|
1306 |
msgstr ""
|
1307 |
|
1308 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1309 |
msgid "SRA4 (225 x 320mm)"
|
1310 |
msgstr ""
|
1311 |
|
1312 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1313 |
msgid "Unicode"
|
1314 |
msgstr ""
|
1315 |
|
1316 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1317 |
msgid "Indic"
|
1318 |
msgstr ""
|
1319 |
|
1320 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1321 |
msgid "Arabic"
|
1322 |
msgstr ""
|
1323 |
|
1324 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1325 |
msgid "Other"
|
1326 |
msgstr ""
|
1327 |
|
1328 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1329 |
msgid "User-Defined Fonts"
|
1330 |
msgstr ""
|
1331 |
|
1332 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1333 |
msgid "Copy"
|
1334 |
msgstr ""
|
1335 |
|
1336 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1337 |
msgid "Print - Low Resolution"
|
1338 |
msgstr ""
|
1339 |
|
1340 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1341 |
msgid "Print - High Resolution"
|
1342 |
msgstr ""
|
1343 |
|
1344 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1345 |
msgid "Modify"
|
1346 |
msgstr ""
|
1347 |
|
1348 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1349 |
msgid "Annotate"
|
1350 |
msgstr ""
|
1351 |
|
1352 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1353 |
msgid "Fill Forms"
|
1354 |
msgstr ""
|
1355 |
|
1356 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1357 |
msgid "Extract"
|
1358 |
msgstr ""
|
1359 |
|
1360 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1361 |
msgid "Assemble"
|
1362 |
msgstr ""
|
1363 |
|
1364 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1365 |
msgid "Settings updated."
|
1366 |
msgstr ""
|
1367 |
|
1368 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1369 |
msgid "PDF Settings could not be saved. Please enter all required information below."
|
1370 |
msgstr ""
|
1371 |
|
1372 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1373 |
msgid "Deactivate License"
|
1374 |
msgstr ""
|
1375 |
|
1376 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1377 |
msgid "Select Media"
|
1378 |
msgstr ""
|
1379 |
|
1380 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1381 |
msgid "Upload File"
|
1382 |
msgstr ""
|
1383 |
|
1384 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1385 |
msgid "Width"
|
1386 |
msgstr ""
|
1387 |
|
1388 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1389 |
msgid "Height"
|
1390 |
msgstr ""
|
1391 |
|
1392 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1393 |
msgid "mm"
|
1394 |
msgstr ""
|
1395 |
|
1396 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1397 |
msgid "inches"
|
1398 |
msgstr ""
|
1399 |
|
1400 |
-
#: src/helper/abstract/Helper_Abstract_Options.php:
|
1401 |
msgid "The callback used for the %s setting is missing."
|
1402 |
msgstr ""
|
1403 |
|
@@ -1413,7 +1413,7 @@ msgstr ""
|
|
1413 |
msgid "Shipping (%s)"
|
1414 |
msgstr ""
|
1415 |
|
1416 |
-
#: src/helper/fields/Field_Tos.php:
|
1417 |
msgid "Not accepted"
|
1418 |
msgstr ""
|
1419 |
|
@@ -1497,6 +1497,10 @@ msgstr ""
|
|
1497 |
msgid "%sOr let your Twitter follows know how good it is%s (or anyone else for that matter)."
|
1498 |
msgstr ""
|
1499 |
|
|
|
|
|
|
|
|
|
1500 |
#: src/view/html/FormSettings/list.php:56
|
1501 |
msgid "Delete PDF?"
|
1502 |
msgstr ""
|
@@ -1533,6 +1537,10 @@ msgstr ""
|
|
1533 |
msgid "Security Settings"
|
1534 |
msgstr ""
|
1535 |
|
|
|
|
|
|
|
|
|
1536 |
#: src/view/html/Settings/help.php:44
|
1537 |
msgid "Getting Help With Gravity PDF"
|
1538 |
msgstr ""
|
@@ -1542,7 +1550,7 @@ msgid "This is your portal to find quality help, support and documentation for G
|
|
1542 |
msgstr ""
|
1543 |
|
1544 |
#: src/view/html/Settings/help.php:48
|
1545 |
-
msgid "(This is not the place to get Gravity Forms support. %sPlease use their official support channel%s for assistance)"
|
1546 |
msgstr ""
|
1547 |
|
1548 |
#: src/view/html/Settings/help.php:57
|
@@ -1566,38 +1574,34 @@ msgid "We’ve got in-depth articles to help you learn the ins and outs of Gravi
|
|
1566 |
msgstr ""
|
1567 |
|
1568 |
#: src/view/html/Settings/help.php:91
|
1569 |
-
msgid "
|
1570 |
msgstr ""
|
1571 |
|
1572 |
#: src/view/html/Settings/help.php:92
|
1573 |
-
msgid "
|
1574 |
-
msgstr ""
|
1575 |
-
|
1576 |
-
#: src/view/html/Settings/help.php:98
|
1577 |
-
msgid "Developer Documentation"
|
1578 |
msgstr ""
|
1579 |
|
1580 |
-
#: src/view/html/Settings/help.php:
|
1581 |
-
msgid "
|
1582 |
msgstr ""
|
1583 |
|
1584 |
-
#: src/view/html/Settings/help.php:
|
1585 |
msgid "View All Documentation"
|
1586 |
msgstr ""
|
1587 |
|
1588 |
-
#: src/view/html/Settings/help.php:
|
1589 |
msgid "Contact Support"
|
1590 |
msgstr ""
|
1591 |
|
1592 |
-
#: src/view/html/Settings/help.php:
|
1593 |
msgid "Our support hours are 9:00am-5:00pm Monday to Friday, %sSydney Australia time%s (public holidays excluded)."
|
1594 |
msgstr ""
|
1595 |
|
1596 |
-
#: src/view/html/Settings/help.php:
|
1597 |
msgid "It doesn't look like there are any topics related to your issue."
|
1598 |
msgstr ""
|
1599 |
|
1600 |
-
#: src/view/html/Settings/help.php:
|
1601 |
msgid "Maybe one of these articles will help..."
|
1602 |
msgstr ""
|
1603 |
|
@@ -1614,7 +1618,7 @@ msgid "Your license key is located in your Purchase Confirmation email you recei
|
|
1614 |
msgstr ""
|
1615 |
|
1616 |
#: src/view/html/Settings/license.php:69
|
1617 |
-
msgid "By
|
1618 |
msgstr ""
|
1619 |
|
1620 |
#: src/view/html/Settings/system_status.php:45
|
@@ -1762,35 +1766,39 @@ msgid "It's like a theme shop, but for Gravity PDF templates. %sHead over to our
|
|
1762 |
msgstr ""
|
1763 |
|
1764 |
#: src/view/html/Welcome/more.php:51
|
1765 |
-
msgid "
|
1766 |
msgstr ""
|
1767 |
|
1768 |
#: src/view/html/Welcome/more.php:53
|
1769 |
-
msgid "
|
1770 |
-
msgstr ""
|
1771 |
-
|
1772 |
-
#: src/view/html/Welcome/more.php:59
|
1773 |
-
msgid "Tailored PDFs"
|
1774 |
msgstr ""
|
1775 |
|
1776 |
#: src/view/html/Welcome/more.php:61
|
1777 |
-
msgid "If
|
1778 |
msgstr ""
|
1779 |
|
1780 |
#: src/view/html/Welcome/more.php:63
|
1781 |
-
msgid "
|
1782 |
msgstr ""
|
1783 |
|
1784 |
#: src/view/html/Welcome/more.php:65
|
1785 |
-
msgid "
|
1786 |
msgstr ""
|
1787 |
|
1788 |
#: src/view/html/Welcome/more.php:71
|
1789 |
-
msgid "
|
1790 |
msgstr ""
|
1791 |
|
1792 |
#: src/view/html/Welcome/more.php:73
|
1793 |
-
msgid "If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1794 |
msgstr ""
|
1795 |
|
1796 |
#: src/view/html/Welcome/welcome.php:43
|
1 |
+
# Copyright (C) 2018 Gravity PDF
|
2 |
# This file is distributed under the same license as the Gravity PDF package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
102 |
msgstr ""
|
103 |
|
104 |
#: src/bootstrap.php:335
|
105 |
+
msgid "View Gravity PDF Extensions Shop"
|
106 |
msgstr ""
|
107 |
|
108 |
+
#: src/bootstrap.php:335, src/view/View_Settings.php:215
|
109 |
+
msgid "Extensions"
|
110 |
+
msgstr ""
|
111 |
+
|
112 |
+
#: src/bootstrap.php:336
|
113 |
+
msgid "View Gravity PDF Template Shop"
|
114 |
+
msgstr ""
|
115 |
+
|
116 |
+
#: src/bootstrap.php:336, src/helper/Helper_Options_Fields.php:117, src/helper/Helper_Options_Fields.php:297
|
117 |
+
msgid "Templates"
|
118 |
msgstr ""
|
119 |
|
120 |
#: src/controller/Controller_Actions.php:156
|
125 |
msgid "Begin Migration"
|
126 |
msgstr ""
|
127 |
|
128 |
+
#: src/controller/Controller_Actions.php:235, src/model/Model_Form_Settings.php:191, src/model/Model_Form_Settings.php:226, src/model/Model_Form_Settings.php:290, src/view/View_Settings.php:319
|
129 |
msgid "You do not have permission to access this page"
|
130 |
msgstr ""
|
131 |
|
137 |
msgid "There was a problem uninstalling Gravity PDF. Please try again."
|
138 |
msgstr ""
|
139 |
|
140 |
+
#: src/controller/Controller_PDF.php:320
|
141 |
msgid "There was a problem generating your PDF"
|
142 |
msgstr ""
|
143 |
|
145 |
msgid "There was a problem installing the PDF templates. Please try again."
|
146 |
msgstr ""
|
147 |
|
148 |
+
#: src/controller/Controller_Shortcodes.php:149, src/helper/Helper_Data.php:169
|
149 |
msgid "Gravity PDF"
|
150 |
msgstr ""
|
151 |
|
205 |
msgid "Delete"
|
206 |
msgstr ""
|
207 |
|
208 |
+
#: src/helper/Helper_Data.php:237, src/helper/Helper_PDF_List_Table.php:247, src/helper/Helper_PDF_List_Table.php:248, src/model/Model_Form_Settings.php:880
|
209 |
msgid "Active"
|
210 |
msgstr ""
|
211 |
|
212 |
+
#: src/helper/Helper_Data.php:238, src/helper/Helper_PDF_List_Table.php:247, src/helper/Helper_PDF_List_Table.php:248, src/model/Model_Form_Settings.php:880
|
213 |
msgid "Inactive"
|
214 |
msgstr ""
|
215 |
|
385 |
msgid "Set the default paper size used when generating PDFs."
|
386 |
msgstr ""
|
387 |
|
388 |
+
#: src/helper/Helper_Options_Fields.php:99, src/helper/Helper_Options_Fields.php:362, src/helper/abstract/Helper_Abstract_Options.php:834
|
389 |
msgid "Custom Paper Size"
|
390 |
msgstr ""
|
391 |
|
398 |
msgstr ""
|
399 |
|
400 |
#: src/helper/Helper_Options_Fields.php:111, src/helper/Helper_Options_Fields.php:291
|
401 |
+
msgid "Choose an existing template or purchased more %sfrom our template shop%s. You can also %sbuild your own%s or %shire us%s to create a custom solution."
|
402 |
msgstr ""
|
403 |
|
404 |
#: src/helper/Helper_Options_Fields.php:117, src/helper/Helper_Options_Fields.php:297
|
405 |
+
msgid "Gravity PDF comes with %sfour completely-free and highly customizable designs%s. You can also purchase additional templates from our template shop, hire us to integrate existing PDFs or, with a bit of technical know-how, build your own."
|
|
|
|
|
|
|
|
|
406 |
msgstr ""
|
407 |
|
408 |
#: src/helper/Helper_Options_Fields.php:122
|
877 |
msgid "For the best results, use a JPG or non-interlaced 8-Bit PNG that has the same dimensions as the paper size."
|
878 |
msgstr ""
|
879 |
|
880 |
+
#: src/helper/Helper_PDF.php:389
|
881 |
msgid "The PDF Template %s requires Gravity PDF version %s. Upgrade to the latest version."
|
882 |
msgstr ""
|
883 |
|
921 |
msgid "Requires Gravity PDF"
|
922 |
msgstr ""
|
923 |
|
924 |
+
#: src/helper/Helper_Templates.php:392, src/view/View_PDF.php:569
|
925 |
msgid "Legacy"
|
926 |
msgstr ""
|
927 |
|
933 |
msgid "Database import problem for site #%s"
|
934 |
msgstr ""
|
935 |
|
936 |
+
#: src/model/Model_Form_Settings.php:257
|
937 |
msgid "Update PDF"
|
938 |
msgstr ""
|
939 |
|
940 |
+
#: src/model/Model_Form_Settings.php:257
|
941 |
msgid "Add PDF"
|
942 |
msgstr ""
|
943 |
|
944 |
+
#: src/model/Model_Form_Settings.php:296, src/model/Model_Form_Settings.php:315, src/model/Model_Form_Settings.php:361, src/model/Model_Form_Settings.php:390
|
945 |
msgid "There was a problem saving your PDF settings. Please try again."
|
946 |
msgstr ""
|
947 |
|
948 |
+
#: src/model/Model_Form_Settings.php:336
|
949 |
msgid "PDF could not be saved. Please enter all required information below."
|
950 |
msgstr ""
|
951 |
|
952 |
+
#: src/model/Model_Form_Settings.php:355
|
953 |
msgid "PDF saved successfully. %sBack to PDF list.%s"
|
954 |
msgstr ""
|
955 |
|
956 |
+
#: src/model/Model_Form_Settings.php:770
|
957 |
msgid "PDF successfully deleted."
|
958 |
msgstr ""
|
959 |
|
960 |
+
#: src/model/Model_Form_Settings.php:831
|
961 |
msgid "PDF successfully duplicated."
|
962 |
msgstr ""
|
963 |
|
964 |
+
#: src/model/Model_Install.php:303
|
965 |
msgid "There was a problem creating the %s directory. Ensure you have write permissions to your uploads folder."
|
966 |
msgstr ""
|
967 |
|
968 |
+
#: src/model/Model_Install.php:312
|
969 |
msgid "Gravity PDF does not have write permission to the %s directory. Contact your web hosting provider to fix the issue."
|
970 |
msgstr ""
|
971 |
|
972 |
+
#: src/model/Model_Install.php:466
|
973 |
msgid "There was a problem removing the Gravity Form \"%s\" PDF configuration. Try delete manually."
|
974 |
msgstr ""
|
975 |
|
976 |
+
#: src/model/Model_Install.php:498
|
977 |
msgid "There was a problem removing the %s directory. Clean up manually via (S)FTP."
|
978 |
msgstr ""
|
979 |
|
989 |
msgid "Your PDF is no longer accessible."
|
990 |
msgstr ""
|
991 |
|
992 |
+
#: src/model/Model_PDF.php:513, src/model/Model_PDF.php:553
|
993 |
msgid "You do not have access to view this PDF."
|
994 |
msgstr ""
|
995 |
|
996 |
+
#: src/model/Model_PDF.php:928
|
997 |
msgid "The PDF could not be saved."
|
998 |
msgstr ""
|
999 |
|
1000 |
+
#: src/model/Model_PDF.php:1847
|
1001 |
msgid "Could not find PDF configuration requested"
|
1002 |
msgstr ""
|
1003 |
|
1033 |
msgid "A font with the same name already exists. Try a different name."
|
1034 |
msgstr ""
|
1035 |
|
1036 |
+
#: src/model/Model_Settings.php:869
|
1037 |
msgid "License deactivated."
|
1038 |
msgstr ""
|
1039 |
|
1040 |
+
#: src/model/Model_Settings.php:878
|
1041 |
msgid "An error occurred during deactivation, please try again"
|
1042 |
msgstr ""
|
1043 |
|
1069 |
msgid "License"
|
1070 |
msgstr ""
|
1071 |
|
1072 |
+
#: src/view/View_Settings.php:345, src/view/html/Settings/system_status.php:52
|
|
|
|
|
|
|
|
|
1073 |
msgid "WP Memory Available"
|
1074 |
msgstr ""
|
1075 |
|
1076 |
+
#: src/view/View_Settings.php:345
|
1077 |
msgid "Producing PDF documents is hard work and Gravity PDF requires more resources than most plugins. We strongly recommend you have at least 128MB, but you may need more."
|
1078 |
msgstr ""
|
1079 |
|
1080 |
+
#: src/view/View_Settings.php:346, src/view/html/Settings/system_status.php:112
|
1081 |
msgid "Direct PDF Protection"
|
1082 |
msgstr ""
|
1083 |
|
1084 |
+
#: src/view/View_Settings.php:346
|
1085 |
msgid "Apache and Litespeed servers automatically disable public access to the Gravity PDF temporary directory using a %s.htaccess%s file, but other web servers like Nginx do not support this feature. We will check if your PDFs are automatically protected, and let you know what you can do to protect your data if they are not."
|
1086 |
msgstr ""
|
1087 |
|
1097 |
msgid "You must pass in a valid form ID"
|
1098 |
msgstr ""
|
1099 |
|
1100 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:458
|
1101 |
msgid "You must pass in a valid PDF ID"
|
1102 |
msgstr ""
|
1103 |
|
1104 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:828
|
1105 |
msgid "Common Sizes"
|
1106 |
msgstr ""
|
1107 |
|
1108 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:829
|
1109 |
msgid "A4 (210 x 297mm)"
|
1110 |
msgstr ""
|
1111 |
|
1112 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:830
|
1113 |
msgid "Letter (8.5 x 11in)"
|
1114 |
msgstr ""
|
1115 |
|
1116 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:831
|
1117 |
msgid "Legal (8.5 x 14in)"
|
1118 |
msgstr ""
|
1119 |
|
1120 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:832
|
1121 |
msgid "Ledger / Tabloid (11 x 17in)"
|
1122 |
msgstr ""
|
1123 |
|
1124 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:833
|
1125 |
msgid "Executive (7 x 10in)"
|
1126 |
msgstr ""
|
1127 |
|
1128 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:837
|
1129 |
msgid "\"A\" Sizes"
|
1130 |
msgstr ""
|
1131 |
|
1132 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:838
|
1133 |
msgid "A0 (841 x 1189mm)"
|
1134 |
msgstr ""
|
1135 |
|
1136 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:839
|
1137 |
msgid "A1 (594 x 841mm)"
|
1138 |
msgstr ""
|
1139 |
|
1140 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:840
|
1141 |
msgid "A2 (420 x 594mm)"
|
1142 |
msgstr ""
|
1143 |
|
1144 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:841
|
1145 |
msgid "A3 (297 x 420mm)"
|
1146 |
msgstr ""
|
1147 |
|
1148 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:842
|
1149 |
msgid "A5 (210 x 297mm)"
|
1150 |
msgstr ""
|
1151 |
|
1152 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:843
|
1153 |
msgid "A6 (105 x 148mm)"
|
1154 |
msgstr ""
|
1155 |
|
1156 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:844
|
1157 |
msgid "A7 (74 x 105mm)"
|
1158 |
msgstr ""
|
1159 |
|
1160 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:845
|
1161 |
msgid "A8 (52 x 74mm)"
|
1162 |
msgstr ""
|
1163 |
|
1164 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:846
|
1165 |
msgid "A9 (37 x 52mm)"
|
1166 |
msgstr ""
|
1167 |
|
1168 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:847
|
1169 |
msgid "A10 (26 x 37mm)"
|
1170 |
msgstr ""
|
1171 |
|
1172 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:850
|
1173 |
msgid "\"B\" Sizes"
|
1174 |
msgstr ""
|
1175 |
|
1176 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:851
|
1177 |
msgid "B0 (1414 x 1000mm)"
|
1178 |
msgstr ""
|
1179 |
|
1180 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:852
|
1181 |
msgid "B1 (1000 x 707mm)"
|
1182 |
msgstr ""
|
1183 |
|
1184 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:853
|
1185 |
msgid "B2 (707 x 500mm)"
|
1186 |
msgstr ""
|
1187 |
|
1188 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:854
|
1189 |
msgid "B3 (500 x 353mm)"
|
1190 |
msgstr ""
|
1191 |
|
1192 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:855
|
1193 |
msgid "B4 (353 x 250mm)"
|
1194 |
msgstr ""
|
1195 |
|
1196 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:856
|
1197 |
msgid "B5 (250 x 176mm)"
|
1198 |
msgstr ""
|
1199 |
|
1200 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:857
|
1201 |
msgid "B6 (176 x 125mm)"
|
1202 |
msgstr ""
|
1203 |
|
1204 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:858
|
1205 |
msgid "B7 (125 x 88mm)"
|
1206 |
msgstr ""
|
1207 |
|
1208 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:859
|
1209 |
msgid "B8 (88 x 62mm)"
|
1210 |
msgstr ""
|
1211 |
|
1212 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:860
|
1213 |
msgid "B9 (62 x 44mm)"
|
1214 |
msgstr ""
|
1215 |
|
1216 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:861
|
1217 |
msgid "B10 (44 x 31mm)"
|
1218 |
msgstr ""
|
1219 |
|
1220 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:864
|
1221 |
msgid "\"C\" Sizes"
|
1222 |
msgstr ""
|
1223 |
|
1224 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:865
|
1225 |
msgid "C0 (1297 x 917mm)"
|
1226 |
msgstr ""
|
1227 |
|
1228 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:866
|
1229 |
msgid "C1 (917 x 648mm)"
|
1230 |
msgstr ""
|
1231 |
|
1232 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:867
|
1233 |
msgid "C2 (648 x 458mm)"
|
1234 |
msgstr ""
|
1235 |
|
1236 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:868
|
1237 |
msgid "C3 (458 x 324mm)"
|
1238 |
msgstr ""
|
1239 |
|
1240 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:869
|
1241 |
msgid "C4 (324 x 229mm)"
|
1242 |
msgstr ""
|
1243 |
|
1244 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:870
|
1245 |
msgid "C5 (229 x 162mm)"
|
1246 |
msgstr ""
|
1247 |
|
1248 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:871
|
1249 |
msgid "C6 (162 x 114mm)"
|
1250 |
msgstr ""
|
1251 |
|
1252 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:872
|
1253 |
msgid "C7 (114 x 81mm)"
|
1254 |
msgstr ""
|
1255 |
|
1256 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:873
|
1257 |
msgid "C8 (81 x 57mm)"
|
1258 |
msgstr ""
|
1259 |
|
1260 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:874
|
1261 |
msgid "C9 (57 x 40mm)"
|
1262 |
msgstr ""
|
1263 |
|
1264 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:875
|
1265 |
msgid "C10 (40 x 28mm)"
|
1266 |
msgstr ""
|
1267 |
|
1268 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:878
|
1269 |
msgid "\"RA\" and \"SRA\" Sizes"
|
1270 |
msgstr ""
|
1271 |
|
1272 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:879
|
1273 |
msgid "RA0 (860 x 1220mm)"
|
1274 |
msgstr ""
|
1275 |
|
1276 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:880
|
1277 |
msgid "RA1 (610 x 860mm)"
|
1278 |
msgstr ""
|
1279 |
|
1280 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:881
|
1281 |
msgid "RA2 (430 x 610mm)"
|
1282 |
msgstr ""
|
1283 |
|
1284 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:882
|
1285 |
msgid "RA3 (305 x 430mm)"
|
1286 |
msgstr ""
|
1287 |
|
1288 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:883
|
1289 |
msgid "RA4 (215 x 305mm)"
|
1290 |
msgstr ""
|
1291 |
|
1292 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:884
|
1293 |
msgid "SRA0 (900 x 1280mm)"
|
1294 |
msgstr ""
|
1295 |
|
1296 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:885
|
1297 |
msgid "SRA1 (640 x 900mm)"
|
1298 |
msgstr ""
|
1299 |
|
1300 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:886
|
1301 |
msgid "SRA2 (450 x 640mm)"
|
1302 |
msgstr ""
|
1303 |
|
1304 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:887
|
1305 |
msgid "SRA3 (320 x 450mm)"
|
1306 |
msgstr ""
|
1307 |
|
1308 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:888
|
1309 |
msgid "SRA4 (225 x 320mm)"
|
1310 |
msgstr ""
|
1311 |
|
1312 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:903
|
1313 |
msgid "Unicode"
|
1314 |
msgstr ""
|
1315 |
|
1316 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:917
|
1317 |
msgid "Indic"
|
1318 |
msgstr ""
|
1319 |
|
1320 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:922
|
1321 |
msgid "Arabic"
|
1322 |
msgstr ""
|
1323 |
|
1324 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:928
|
1325 |
msgid "Other"
|
1326 |
msgstr ""
|
1327 |
|
1328 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:980
|
1329 |
msgid "User-Defined Fonts"
|
1330 |
msgstr ""
|
1331 |
|
1332 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:1052
|
1333 |
msgid "Copy"
|
1334 |
msgstr ""
|
1335 |
|
1336 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:1053
|
1337 |
msgid "Print - Low Resolution"
|
1338 |
msgstr ""
|
1339 |
|
1340 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:1054
|
1341 |
msgid "Print - High Resolution"
|
1342 |
msgstr ""
|
1343 |
|
1344 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:1055
|
1345 |
msgid "Modify"
|
1346 |
msgstr ""
|
1347 |
|
1348 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:1056
|
1349 |
msgid "Annotate"
|
1350 |
msgstr ""
|
1351 |
|
1352 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:1057
|
1353 |
msgid "Fill Forms"
|
1354 |
msgstr ""
|
1355 |
|
1356 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:1058
|
1357 |
msgid "Extract"
|
1358 |
msgstr ""
|
1359 |
|
1360 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:1059
|
1361 |
msgid "Assemble"
|
1362 |
msgstr ""
|
1363 |
|
1364 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:1184
|
1365 |
msgid "Settings updated."
|
1366 |
msgstr ""
|
1367 |
|
1368 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:1333, src/helper/abstract/Helper_Abstract_Options.php:1341, src/helper/abstract/Helper_Abstract_Options.php:1349
|
1369 |
msgid "PDF Settings could not be saved. Please enter all required information below."
|
1370 |
msgstr ""
|
1371 |
|
1372 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:1665
|
1373 |
msgid "Deactivate License"
|
1374 |
msgstr ""
|
1375 |
|
1376 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:1956, src/helper/abstract/Helper_Abstract_Options.php:1957
|
1377 |
msgid "Select Media"
|
1378 |
msgstr ""
|
1379 |
|
1380 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:1958
|
1381 |
msgid "Upload File"
|
1382 |
msgstr ""
|
1383 |
|
1384 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:2115
|
1385 |
msgid "Width"
|
1386 |
msgstr ""
|
1387 |
|
1388 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:2116
|
1389 |
msgid "Height"
|
1390 |
msgstr ""
|
1391 |
|
1392 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:2119
|
1393 |
msgid "mm"
|
1394 |
msgstr ""
|
1395 |
|
1396 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:2120
|
1397 |
msgid "inches"
|
1398 |
msgstr ""
|
1399 |
|
1400 |
+
#: src/helper/abstract/Helper_Abstract_Options.php:2180
|
1401 |
msgid "The callback used for the %s setting is missing."
|
1402 |
msgstr ""
|
1403 |
|
1413 |
msgid "Shipping (%s)"
|
1414 |
msgstr ""
|
1415 |
|
1416 |
+
#: src/helper/fields/Field_Tos.php:125
|
1417 |
msgid "Not accepted"
|
1418 |
msgstr ""
|
1419 |
|
1497 |
msgid "%sOr let your Twitter follows know how good it is%s (or anyone else for that matter)."
|
1498 |
msgstr ""
|
1499 |
|
1500 |
+
#: src/view/html/FormSettings/add_edit.php:135
|
1501 |
+
msgid "Want more features? See the Extension Shop."
|
1502 |
+
msgstr ""
|
1503 |
+
|
1504 |
#: src/view/html/FormSettings/list.php:56
|
1505 |
msgid "Delete PDF?"
|
1506 |
msgstr ""
|
1537 |
msgid "Security Settings"
|
1538 |
msgstr ""
|
1539 |
|
1540 |
+
#: src/view/html/Settings/general.php:80
|
1541 |
+
msgid "Want more features? Take a look at our Extension Shop."
|
1542 |
+
msgstr ""
|
1543 |
+
|
1544 |
#: src/view/html/Settings/help.php:44
|
1545 |
msgid "Getting Help With Gravity PDF"
|
1546 |
msgstr ""
|
1550 |
msgstr ""
|
1551 |
|
1552 |
#: src/view/html/Settings/help.php:48
|
1553 |
+
msgid "(This is not the place to get Gravity Forms support. %sPlease use their official support channel%s for assistance. Using the search box below will search gravitypdf.com for results.)"
|
1554 |
msgstr ""
|
1555 |
|
1556 |
#: src/view/html/Settings/help.php:57
|
1574 |
msgstr ""
|
1575 |
|
1576 |
#: src/view/html/Settings/help.php:91
|
1577 |
+
msgid "Developer Documentation"
|
1578 |
msgstr ""
|
1579 |
|
1580 |
#: src/view/html/Settings/help.php:92
|
1581 |
+
msgid "You’ll find all the info and examples you’ll need to create your own custom PDF templates."
|
|
|
|
|
|
|
|
|
1582 |
msgstr ""
|
1583 |
|
1584 |
+
#: src/view/html/Settings/help.php:97
|
1585 |
+
msgid "Common Questions"
|
1586 |
msgstr ""
|
1587 |
|
1588 |
+
#: src/view/html/Settings/help.php:109
|
1589 |
msgid "View All Documentation"
|
1590 |
msgstr ""
|
1591 |
|
1592 |
+
#: src/view/html/Settings/help.php:110
|
1593 |
msgid "Contact Support"
|
1594 |
msgstr ""
|
1595 |
|
1596 |
+
#: src/view/html/Settings/help.php:113
|
1597 |
msgid "Our support hours are 9:00am-5:00pm Monday to Friday, %sSydney Australia time%s (public holidays excluded)."
|
1598 |
msgstr ""
|
1599 |
|
1600 |
+
#: src/view/html/Settings/help.php:127
|
1601 |
msgid "It doesn't look like there are any topics related to your issue."
|
1602 |
msgstr ""
|
1603 |
|
1604 |
+
#: src/view/html/Settings/help.php:129
|
1605 |
msgid "Maybe one of these articles will help..."
|
1606 |
msgstr ""
|
1607 |
|
1618 |
msgstr ""
|
1619 |
|
1620 |
#: src/view/html/Settings/license.php:69
|
1621 |
+
msgid "By installing a Gravity PDF extension you are automatically giving permission for us to periodically poll GravityPDF.com via HTTPS for your current license status and any new plugin updates. The only personal data sent is your website domain name and license key. To opt-out you will need to deactivate all Gravity PDF extensions."
|
1622 |
msgstr ""
|
1623 |
|
1624 |
#: src/view/html/Settings/system_status.php:45
|
1766 |
msgstr ""
|
1767 |
|
1768 |
#: src/view/html/Welcome/more.php:51
|
1769 |
+
msgid "Roll your Own"
|
1770 |
msgstr ""
|
1771 |
|
1772 |
#: src/view/html/Welcome/more.php:53
|
1773 |
+
msgid "If PHP, HTML and CSS come easy to you, you'll find creating your own PDF templates a breeze. With %sextensive documentation and great examples%s you'll be up and running in no time."
|
|
|
|
|
|
|
|
|
1774 |
msgstr ""
|
1775 |
|
1776 |
#: src/view/html/Welcome/more.php:61
|
1777 |
+
msgid "If you're looking to enhance Gravity PDF %sour Extension Shop is your first port of call%s. Advanced functionality will be at your fingertips with a premium Gravity PDF extension."
|
1778 |
msgstr ""
|
1779 |
|
1780 |
#: src/view/html/Welcome/more.php:63
|
1781 |
+
msgid "Stay Up To Date"
|
1782 |
msgstr ""
|
1783 |
|
1784 |
#: src/view/html/Welcome/more.php:65
|
1785 |
+
msgid "%sSign up to our newsletter%s to be amongst the first to receive the latest news and details on upcoming feature."
|
1786 |
msgstr ""
|
1787 |
|
1788 |
#: src/view/html/Welcome/more.php:71
|
1789 |
+
msgid "Tailored PDFs"
|
1790 |
msgstr ""
|
1791 |
|
1792 |
#: src/view/html/Welcome/more.php:73
|
1793 |
+
msgid "If the PDF Shop doesn't have what you're after %sour friendly team can build a document just for you%s. With an addon, our devs can even create templates that auto fill existing PDFs – like government and legal documents."
|
1794 |
+
msgstr ""
|
1795 |
+
|
1796 |
+
#: src/view/html/Welcome/more.php:75
|
1797 |
+
msgid "Get Support"
|
1798 |
+
msgstr ""
|
1799 |
+
|
1800 |
+
#: src/view/html/Welcome/more.php:77
|
1801 |
+
msgid "Have trouble using Gravity PDF? %sContact our friendly staff%s who are avaliable 9am to 5pm Monday to Friday, %sAustralian Eastern Standard Time%s."
|
1802 |
msgstr ""
|
1803 |
|
1804 |
#: src/view/html/Welcome/welcome.php:43
|
src/autoload.php
CHANGED
@@ -6,7 +6,7 @@ namespace GFPDF;
|
|
6 |
* Autoloader Functionality
|
7 |
*
|
8 |
* @package Gravity PDF
|
9 |
-
* @copyright Copyright (c)
|
10 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
* @since 4.0
|
12 |
*/
|
@@ -19,7 +19,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
19 |
/*
|
20 |
This file is part of Gravity PDF.
|
21 |
|
22 |
-
Gravity PDF – Copyright (C)
|
23 |
|
24 |
This program is free software; you can redistribute it and/or modify
|
25 |
it under the terms of the GNU General Public License as published by
|
6 |
* Autoloader Functionality
|
7 |
*
|
8 |
* @package Gravity PDF
|
9 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
10 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
* @since 4.0
|
12 |
*/
|
19 |
/*
|
20 |
This file is part of Gravity PDF.
|
21 |
|
22 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
23 |
|
24 |
This program is free software; you can redistribute it and/or modify
|
25 |
it under the terms of the GNU General Public License as published by
|
src/bootstrap.php
CHANGED
@@ -14,7 +14,7 @@ use GFPDF_Core;
|
|
14 |
* The bootstrap is loaded on WordPress 'plugins_loaded' functionality
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
-
Gravity PDF – Copyright (C)
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
@@ -330,9 +330,10 @@ class Router implements Helper\Helper_Interface_Actions, Helper\Helper_Interface
|
|
330 |
|
331 |
if ( $file == PDF_PLUGIN_BASENAME ) {
|
332 |
$row_meta = [
|
333 |
-
'docs'
|
334 |
-
'support'
|
335 |
-
'shop'
|
|
|
336 |
];
|
337 |
|
338 |
return array_merge( $links, $row_meta );
|
@@ -450,6 +451,9 @@ class Router implements Helper\Helper_Interface_Actions, Helper\Helper_Interface
|
|
450 |
wp_enqueue_media();
|
451 |
|
452 |
wp_enqueue_script( 'gfpdf_js_entrypoint' );
|
|
|
|
|
|
|
453 |
}
|
454 |
|
455 |
if ( $this->misc->is_gfpdf_settings_tab( 'help' ) || $this->misc->is_gfpdf_settings_tab( 'tools' ) ) {
|
@@ -466,6 +470,21 @@ class Router implements Helper\Helper_Interface_Actions, Helper\Helper_Interface
|
|
466 |
}
|
467 |
}
|
468 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
469 |
/**
|
470 |
* Auto no-conflict any preloaded scripts that begin with 'gfpdf_'
|
471 |
*
|
@@ -582,8 +601,12 @@ class Router implements Helper\Helper_Interface_Actions, Helper\Helper_Interface
|
|
582 |
* @return 4.0
|
583 |
*/
|
584 |
public function setup_settings_fields() {
|
585 |
-
|
586 |
-
|
|
|
|
|
|
|
|
|
587 |
}
|
588 |
|
589 |
/**
|
14 |
* The bootstrap is loaded on WordPress 'plugins_loaded' functionality
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
330 |
|
331 |
if ( $file == PDF_PLUGIN_BASENAME ) {
|
332 |
$row_meta = [
|
333 |
+
'docs' => '<a href="' . esc_url( 'https://gravitypdf.com/documentation/v4/five-minute-install/' ) . '" title="' . esc_attr__( 'View Gravity PDF Documentation', 'gravity-forms-pdf-extended' ) . '">' . esc_html__( 'Docs', 'gravity-forms-pdf-extended' ) . '</a>',
|
334 |
+
'support' => '<a href="' . esc_url( $this->data->settings_url . '&tab=help' ) . '" title="' . esc_attr__( 'Get Help and Support', 'gravity-forms-pdf-extended' ) . '">' . esc_html__( 'Support', 'gravity-forms-pdf-extended' ) . '</a>',
|
335 |
+
'extension-shop' => '<a href="' . esc_url( 'https://gravitypdf.com/extension-shop/' ) . '" title="' . esc_attr__( 'View Gravity PDF Extensions Shop', 'gravity-forms-pdf-extended' ) . '">' . esc_html__( 'Extensions', 'gravity-forms-pdf-extended' ) . '</a>',
|
336 |
+
'template-shop' => '<a href="' . esc_url( 'https://gravitypdf.com/template-shop/' ) . '" title="' . esc_attr__( 'View Gravity PDF Template Shop', 'gravity-forms-pdf-extended' ) . '">' . esc_html__( 'Templates', 'gravity-forms-pdf-extended' ) . '</a>',
|
337 |
];
|
338 |
|
339 |
return array_merge( $links, $row_meta );
|
451 |
wp_enqueue_media();
|
452 |
|
453 |
wp_enqueue_script( 'gfpdf_js_entrypoint' );
|
454 |
+
|
455 |
+
/* Load TinyMCE styles */
|
456 |
+
add_filter( 'tiny_mce_before_init', [ $this, 'tinymce_styles' ] );
|
457 |
}
|
458 |
|
459 |
if ( $this->misc->is_gfpdf_settings_tab( 'help' ) || $this->misc->is_gfpdf_settings_tab( 'tools' ) ) {
|
470 |
}
|
471 |
}
|
472 |
|
473 |
+
/**
|
474 |
+
* Insert our own styles into the TinyMCE editor
|
475 |
+
*
|
476 |
+
* @param array $mceInit
|
477 |
+
*
|
478 |
+
* @return array
|
479 |
+
*
|
480 |
+
* @since 4.4
|
481 |
+
*/
|
482 |
+
public function tinymce_styles( $mceInit ) {
|
483 |
+
$style = "body#tinymce { max-width: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;}";
|
484 |
+
$mceInit['content_style'] = ( isset( $mceInit['content_style'] ) ) ? $mceInit['content_style'] . ' ' . $style : $style;
|
485 |
+
return $mceInit;
|
486 |
+
}
|
487 |
+
|
488 |
/**
|
489 |
* Auto no-conflict any preloaded scripts that begin with 'gfpdf_'
|
490 |
*
|
601 |
* @return 4.0
|
602 |
*/
|
603 |
public function setup_settings_fields() {
|
604 |
+
global $pagenow;
|
605 |
+
|
606 |
+
if ( $this->misc->is_gfpdf_page() || $pagenow === 'options.php' ) {
|
607 |
+
/* register our options settings */
|
608 |
+
$this->options->register_settings( $this->options->get_registered_fields() );
|
609 |
+
}
|
610 |
}
|
611 |
|
612 |
/**
|
src/controller/Controller_Actions.php
CHANGED
@@ -15,7 +15,7 @@ use Psr\Log\LoggerInterface;
|
|
15 |
* Actions Controller
|
16 |
*
|
17 |
* @package Gravity PDF
|
18 |
-
* @copyright Copyright (c)
|
19 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
20 |
* @since 4.0
|
21 |
*/
|
@@ -28,7 +28,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
28 |
/*
|
29 |
This file is part of Gravity PDF.
|
30 |
|
31 |
-
Gravity PDF – Copyright (C)
|
32 |
|
33 |
This program is free software; you can redistribute it and/or modify
|
34 |
it under the terms of the GNU General Public License as published by
|
15 |
* Actions Controller
|
16 |
*
|
17 |
* @package Gravity PDF
|
18 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
19 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
20 |
* @since 4.0
|
21 |
*/
|
28 |
/*
|
29 |
This file is part of Gravity PDF.
|
30 |
|
31 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
32 |
|
33 |
This program is free software; you can redistribute it and/or modify
|
34 |
it under the terms of the GNU General Public License as published by
|
src/controller/Controller_Activation.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* Install Update Controller
|
7 |
*
|
8 |
* @package Gravity PDF
|
9 |
-
* @copyright Copyright (c)
|
10 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
* @since 4.0
|
12 |
*/
|
@@ -25,7 +25,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
25 |
/*
|
26 |
This file is part of Gravity PDF.
|
27 |
|
28 |
-
Gravity PDF – Copyright (C)
|
29 |
|
30 |
This program is free software; you can redistribute it and/or modify
|
31 |
it under the terms of the GNU General Public License as published by
|
6 |
* Install Update Controller
|
7 |
*
|
8 |
* @package Gravity PDF
|
9 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
10 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
* @since 4.0
|
12 |
*/
|
25 |
/*
|
26 |
This file is part of Gravity PDF.
|
27 |
|
28 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
29 |
|
30 |
This program is free software; you can redistribute it and/or modify
|
31 |
it under the terms of the GNU General Public License as published by
|
src/controller/Controller_Form_Settings.php
CHANGED
@@ -16,7 +16,7 @@ use GFPDF\Helper\Helper_Form;
|
|
16 |
* Form Settings (PDF Configuration) Controller
|
17 |
*
|
18 |
* @package Gravity PDF
|
19 |
-
* @copyright Copyright (c)
|
20 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
21 |
* @since 4.0
|
22 |
*/
|
@@ -29,7 +29,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
29 |
/*
|
30 |
This file is part of Gravity PDF.
|
31 |
|
32 |
-
Gravity PDF – Copyright (C)
|
33 |
|
34 |
This program is free software; you can redistribute it and/or modify
|
35 |
it under the terms of the GNU General Public License as published by
|
16 |
* Form Settings (PDF Configuration) Controller
|
17 |
*
|
18 |
* @package Gravity PDF
|
19 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
20 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
21 |
* @since 4.0
|
22 |
*/
|
29 |
/*
|
30 |
This file is part of Gravity PDF.
|
31 |
|
32 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
33 |
|
34 |
This program is free software; you can redistribute it and/or modify
|
35 |
it under the terms of the GNU General Public License as published by
|
src/controller/Controller_Install.php
CHANGED
@@ -17,7 +17,7 @@ use Psr\Log\LoggerInterface;
|
|
17 |
* Install Update Controller
|
18 |
*
|
19 |
* @package Gravity PDF
|
20 |
-
* @copyright Copyright (c)
|
21 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
22 |
* @since 4.0
|
23 |
*/
|
@@ -30,7 +30,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
30 |
/*
|
31 |
This file is part of Gravity PDF.
|
32 |
|
33 |
-
Gravity PDF – Copyright (C)
|
34 |
|
35 |
This program is free software; you can redistribute it and/or modify
|
36 |
it under the terms of the GNU General Public License as published by
|
17 |
* Install Update Controller
|
18 |
*
|
19 |
* @package Gravity PDF
|
20 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
21 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
22 |
* @since 4.0
|
23 |
*/
|
30 |
/*
|
31 |
This file is part of Gravity PDF.
|
32 |
|
33 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
34 |
|
35 |
This program is free software; you can redistribute it and/or modify
|
36 |
it under the terms of the GNU General Public License as published by
|
src/controller/Controller_Mergetags.php
CHANGED
@@ -12,7 +12,7 @@ use Psr\Log\LoggerInterface;
|
|
12 |
* PDF Merge tag Controller
|
13 |
*
|
14 |
* @package Gravity PDF
|
15 |
-
* @copyright Copyright (c)
|
16 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
17 |
* @since 4.0
|
18 |
*/
|
@@ -25,7 +25,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
25 |
/*
|
26 |
This file is part of Gravity PDF.
|
27 |
|
28 |
-
Gravity PDF – Copyright (C)
|
29 |
|
30 |
This program is free software; you can redistribute it and/or modify
|
31 |
it under the terms of the GNU General Public License as published by
|
12 |
* PDF Merge tag Controller
|
13 |
*
|
14 |
* @package Gravity PDF
|
15 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
16 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
17 |
* @since 4.0
|
18 |
*/
|
25 |
/*
|
26 |
This file is part of Gravity PDF.
|
27 |
|
28 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
29 |
|
30 |
This program is free software; you can redistribute it and/or modify
|
31 |
it under the terms of the GNU General Public License as published by
|
src/controller/Controller_PDF.php
CHANGED
@@ -17,7 +17,7 @@ use Psr\Log\LoggerInterface;
|
|
17 |
* PDF Display Controller
|
18 |
*
|
19 |
* @package Gravity PDF
|
20 |
-
* @copyright Copyright (c)
|
21 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
22 |
* @since 4.0
|
23 |
*/
|
@@ -30,7 +30,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
30 |
/*
|
31 |
This file is part of Gravity PDF.
|
32 |
|
33 |
-
Gravity PDF – Copyright (C)
|
34 |
|
35 |
This program is free software; you can redistribute it and/or modify
|
36 |
it under the terms of the GNU General Public License as published by
|
@@ -192,6 +192,7 @@ class Controller_PDF extends Helper_Abstract_Controller implements Helper_Interf
|
|
192 |
add_filter( 'mpdf_current_font_path', [ $this->model, 'set_current_pdf_font' ], 10, 2 );
|
193 |
add_filter( 'mpdf_font_data', [ $this->model, 'register_custom_font_data_with_mPDF' ] );
|
194 |
add_filter( 'mpdf_font_data', [ $this->model, 'add_unregistered_fonts_to_mPDF' ], 20 );
|
|
|
195 |
|
196 |
/* Process mergetags and shortcodes in PDF */
|
197 |
add_filter( 'gfpdf_pdf_html_output', [ $this->gform, 'process_tags' ], 10, 3 );
|
17 |
* PDF Display Controller
|
18 |
*
|
19 |
* @package Gravity PDF
|
20 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
21 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
22 |
* @since 4.0
|
23 |
*/
|
30 |
/*
|
31 |
This file is part of Gravity PDF.
|
32 |
|
33 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
34 |
|
35 |
This program is free software; you can redistribute it and/or modify
|
36 |
it under the terms of the GNU General Public License as published by
|
192 |
add_filter( 'mpdf_current_font_path', [ $this->model, 'set_current_pdf_font' ], 10, 2 );
|
193 |
add_filter( 'mpdf_font_data', [ $this->model, 'register_custom_font_data_with_mPDF' ] );
|
194 |
add_filter( 'mpdf_font_data', [ $this->model, 'add_unregistered_fonts_to_mPDF' ], 20 );
|
195 |
+
add_filter( 'gfpdf_mpdf_init_class', [ $this->model, 'set_watermark_font' ], 10, 4 );
|
196 |
|
197 |
/* Process mergetags and shortcodes in PDF */
|
198 |
add_filter( 'gfpdf_pdf_html_output', [ $this->gform, 'process_tags' ], 10, 3 );
|
src/controller/Controller_Settings.php
CHANGED
@@ -20,7 +20,7 @@ use GFForms;
|
|
20 |
* Settings Controller
|
21 |
*
|
22 |
* @package Gravity PDF
|
23 |
-
* @copyright Copyright (c)
|
24 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
25 |
* @since 4.0
|
26 |
*/
|
@@ -33,7 +33,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
33 |
/*
|
34 |
This file is part of Gravity PDF.
|
35 |
|
36 |
-
Gravity PDF – Copyright (C)
|
37 |
|
38 |
This program is free software; you can redistribute it and/or modify
|
39 |
it under the terms of the GNU General Public License as published by
|
20 |
* Settings Controller
|
21 |
*
|
22 |
* @package Gravity PDF
|
23 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
24 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
25 |
* @since 4.0
|
26 |
*/
|
33 |
/*
|
34 |
This file is part of Gravity PDF.
|
35 |
|
36 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
37 |
|
38 |
This program is free software; you can redistribute it and/or modify
|
39 |
it under the terms of the GNU General Public License as published by
|
src/controller/Controller_Shortcodes.php
CHANGED
@@ -13,7 +13,7 @@ use Psr\Log\LoggerInterface;
|
|
13 |
* PDF Shortcode Controller
|
14 |
*
|
15 |
* @package Gravity PDF
|
16 |
-
* @copyright Copyright (c)
|
17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
18 |
* @since 4.0
|
19 |
*/
|
@@ -26,7 +26,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
26 |
/*
|
27 |
This file is part of Gravity PDF.
|
28 |
|
29 |
-
Gravity PDF – Copyright (C)
|
30 |
|
31 |
This program is free software; you can redistribute it and/or modify
|
32 |
it under the terms of the GNU General Public License as published by
|
@@ -144,8 +144,6 @@ class Controller_Shortcodes extends Helper_Abstract_Controller implements Helper
|
|
144 |
return null;
|
145 |
}
|
146 |
|
147 |
-
$this->log->addNotice( 'Enable Shortcake support.' );
|
148 |
-
|
149 |
/* Enhance further */
|
150 |
shortcode_ui_register_for_shortcode( 'gravitypdf', [
|
151 |
'label' => esc_html__( 'Gravity PDF', 'gravity-forms-pdf-extended' ),
|
13 |
* PDF Shortcode Controller
|
14 |
*
|
15 |
* @package Gravity PDF
|
16 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
18 |
* @since 4.0
|
19 |
*/
|
26 |
/*
|
27 |
This file is part of Gravity PDF.
|
28 |
|
29 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
30 |
|
31 |
This program is free software; you can redistribute it and/or modify
|
32 |
it under the terms of the GNU General Public License as published by
|
144 |
return null;
|
145 |
}
|
146 |
|
|
|
|
|
147 |
/* Enhance further */
|
148 |
shortcode_ui_register_for_shortcode( 'gravitypdf', [
|
149 |
'label' => esc_html__( 'Gravity PDF', 'gravity-forms-pdf-extended' ),
|
src/controller/Controller_Templates.php
CHANGED
@@ -11,7 +11,7 @@ use GFPDF\Helper\Helper_Interface_Actions;
|
|
11 |
* The Template Nanagement controller
|
12 |
*
|
13 |
* @package Gravity PDF
|
14 |
-
* @copyright Copyright (c)
|
15 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
16 |
* @since 4.1
|
17 |
*/
|
@@ -24,7 +24,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
24 |
/*
|
25 |
This file is part of Gravity PDF.
|
26 |
|
27 |
-
Gravity PDF – Copyright (C)
|
28 |
|
29 |
This program is free software; you can redistribute it and/or modify
|
30 |
it under the terms of the GNU General Public License as published by
|
11 |
* The Template Nanagement controller
|
12 |
*
|
13 |
* @package Gravity PDF
|
14 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
15 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
16 |
* @since 4.1
|
17 |
*/
|
24 |
/*
|
25 |
This file is part of Gravity PDF.
|
26 |
|
27 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
28 |
|
29 |
This program is free software; you can redistribute it and/or modify
|
30 |
it under the terms of the GNU General Public License as published by
|
src/controller/Controller_Welcome_Screen.php
CHANGED
@@ -16,7 +16,7 @@ use Psr\Log\LoggerInterface;
|
|
16 |
* Welcome Screen Controller
|
17 |
*
|
18 |
* @package Gravity PDF
|
19 |
-
* @copyright Copyright (c)
|
20 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
21 |
* @since 4.0
|
22 |
*/
|
@@ -29,7 +29,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
29 |
/*
|
30 |
This file is part of Gravity PDF.
|
31 |
|
32 |
-
Gravity PDF – Copyright (C)
|
33 |
|
34 |
This program is free software; you can redistribute it and/or modify
|
35 |
it under the terms of the GNU General Public License as published by
|
16 |
* Welcome Screen Controller
|
17 |
*
|
18 |
* @package Gravity PDF
|
19 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
20 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
21 |
* @since 4.0
|
22 |
*/
|
29 |
/*
|
30 |
This file is part of Gravity PDF.
|
31 |
|
32 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
33 |
|
34 |
This program is free software; you can redistribute it and/or modify
|
35 |
it under the terms of the GNU General Public License as published by
|
src/deprecated.php
CHANGED
@@ -7,7 +7,7 @@ use GFPDF\Helper\Fields\Field_v3_Products;
|
|
7 |
* Deprecated Functionality / Classes
|
8 |
*
|
9 |
* @package Gravity PDF
|
10 |
-
* @copyright Copyright (c)
|
11 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
12 |
* @since 4.0
|
13 |
*/
|
@@ -20,7 +20,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
20 |
/*
|
21 |
This file is part of Gravity PDF.
|
22 |
|
23 |
-
Gravity PDF – Copyright (C)
|
24 |
|
25 |
This program is free software; you can redistribute it and/or modify
|
26 |
it under the terms of the GNU General Public License as published by
|
@@ -320,6 +320,13 @@ class PDF_Common extends GFPDF_Deprecated_Abstract {
|
|
320 |
|
321 |
return $misc->strip_invalid_characters( $name );
|
322 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
323 |
}
|
324 |
|
325 |
/**
|
7 |
* Deprecated Functionality / Classes
|
8 |
*
|
9 |
* @package Gravity PDF
|
10 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
11 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
12 |
* @since 4.0
|
13 |
*/
|
20 |
/*
|
21 |
This file is part of Gravity PDF.
|
22 |
|
23 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
24 |
|
25 |
This program is free software; you can redistribute it and/or modify
|
26 |
it under the terms of the GNU General Public License as published by
|
320 |
|
321 |
return $misc->strip_invalid_characters( $name );
|
322 |
}
|
323 |
+
|
324 |
+
/**
|
325 |
+
* Prevent deprecated warning for legacy Tier 2 templates
|
326 |
+
*
|
327 |
+
* @since 3.0
|
328 |
+
*/
|
329 |
+
public static function setup_ids() {}
|
330 |
}
|
331 |
|
332 |
/**
|
src/helper/Helper_Data.php
CHANGED
@@ -7,7 +7,7 @@ namespace GFPDF\Helper;
|
|
7 |
* Cache shared data across the plugin
|
8 |
*
|
9 |
* @package Gravity PDF
|
10 |
-
* @copyright Copyright (c)
|
11 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
12 |
* @since 4.0
|
13 |
*/
|
@@ -20,7 +20,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
20 |
/*
|
21 |
This file is part of Gravity PDF.
|
22 |
|
23 |
-
Gravity PDF – Copyright (C)
|
24 |
|
25 |
This program is free software; you can redistribute it and/or modify
|
26 |
it under the terms of the GNU General Public License as published by
|
7 |
* Cache shared data across the plugin
|
8 |
*
|
9 |
* @package Gravity PDF
|
10 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
11 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
12 |
* @since 4.0
|
13 |
*/
|
20 |
/*
|
21 |
This file is part of Gravity PDF.
|
22 |
|
23 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
24 |
|
25 |
This program is free software; you can redistribute it and/or modify
|
26 |
it under the terms of the GNU General Public License as published by
|
src/helper/Helper_Field_Container.php
CHANGED
@@ -9,7 +9,7 @@ use GF_Field;
|
|
9 |
* Gravity Forms CSS Ready Classes.
|
10 |
*
|
11 |
* @package Gravity PDF
|
12 |
-
* @copyright Copyright (c)
|
13 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
14 |
* @since 4.0
|
15 |
*/
|
@@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
22 |
/*
|
23 |
This file is part of Gravity PDF.
|
24 |
|
25 |
-
Gravity PDF – Copyright (C)
|
26 |
|
27 |
This program is free software; you can redistribute it and/or modify
|
28 |
it under the terms of the GNU General Public License as published by
|
@@ -100,6 +100,15 @@ class Helper_Field_Container {
|
|
100 |
*/
|
101 |
private $close_tag = '</div>';
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
/**
|
104 |
* The Gravity Form fields we should not wrap in a container
|
105 |
*
|
@@ -161,6 +170,7 @@ class Helper_Field_Container {
|
|
161 |
$this->close_tag = apply_filters( 'gfpdf_container_close_tag', $this->close_tag );
|
162 |
$this->skip_fields = apply_filters( 'gfpdf_container_skip_fields', $this->skip_fields );
|
163 |
$this->row_stopper_classes = apply_filters( 'gfpdf_container_row_stopper_classes', $this->row_stopper_classes );
|
|
|
164 |
}
|
165 |
|
166 |
|
@@ -239,7 +249,7 @@ class Helper_Field_Container {
|
|
239 |
public function maybe_display_faux_column( GF_Field $field ) {
|
240 |
|
241 |
/* Check if we should create a placeholder column */
|
242 |
-
if ( $this->does_fit_in_row( $field ) ) {
|
243 |
echo '<div id="field-' . $field->id . '" class="gfpdf-column-placeholder gfpdf-field ' . $field->cssClass . '"></div>';
|
244 |
|
245 |
/* Increase column width */
|
9 |
* Gravity Forms CSS Ready Classes.
|
10 |
*
|
11 |
* @package Gravity PDF
|
12 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
13 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
14 |
* @since 4.0
|
15 |
*/
|
22 |
/*
|
23 |
This file is part of Gravity PDF.
|
24 |
|
25 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
26 |
|
27 |
This program is free software; you can redistribute it and/or modify
|
28 |
it under the terms of the GNU General Public License as published by
|
100 |
*/
|
101 |
private $close_tag = '</div>';
|
102 |
|
103 |
+
/**
|
104 |
+
* Whether to enable/disable the faux column feature
|
105 |
+
*
|
106 |
+
* @var bool
|
107 |
+
*
|
108 |
+
* @since 5.0
|
109 |
+
*/
|
110 |
+
private $faux_column = true;
|
111 |
+
|
112 |
/**
|
113 |
* The Gravity Form fields we should not wrap in a container
|
114 |
*
|
170 |
$this->close_tag = apply_filters( 'gfpdf_container_close_tag', $this->close_tag );
|
171 |
$this->skip_fields = apply_filters( 'gfpdf_container_skip_fields', $this->skip_fields );
|
172 |
$this->row_stopper_classes = apply_filters( 'gfpdf_container_row_stopper_classes', $this->row_stopper_classes );
|
173 |
+
$this->faux_column = apply_filters( 'gfpdf_container_disable_faux_columns', $this->faux_column );
|
174 |
}
|
175 |
|
176 |
|
249 |
public function maybe_display_faux_column( GF_Field $field ) {
|
250 |
|
251 |
/* Check if we should create a placeholder column */
|
252 |
+
if ( $this->faux_column && $this->does_fit_in_row( $field ) ) {
|
253 |
echo '<div id="field-' . $field->id . '" class="gfpdf-column-placeholder gfpdf-field ' . $field->cssClass . '"></div>';
|
254 |
|
255 |
/* Increase column width */
|
src/helper/Helper_Field_Container_Void.php
CHANGED
@@ -9,7 +9,7 @@ use GF_Field;
|
|
9 |
* Gravity Forms CSS Ready Class support
|
10 |
*
|
11 |
* @package Gravity PDF
|
12 |
-
* @copyright Copyright (c)
|
13 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
14 |
* @since 4.0
|
15 |
*/
|
@@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
22 |
/*
|
23 |
This file is part of Gravity PDF.
|
24 |
|
25 |
-
Gravity PDF – Copyright (C)
|
26 |
|
27 |
This program is free software; you can redistribute it and/or modify
|
28 |
it under the terms of the GNU General Public License as published by
|
9 |
* Gravity Forms CSS Ready Class support
|
10 |
*
|
11 |
* @package Gravity PDF
|
12 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
13 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
14 |
* @since 4.0
|
15 |
*/
|
22 |
/*
|
23 |
This file is part of Gravity PDF.
|
24 |
|
25 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
26 |
|
27 |
This program is free software; you can redistribute it and/or modify
|
28 |
it under the terms of the GNU General Public License as published by
|
src/helper/Helper_Form.php
CHANGED
@@ -10,7 +10,7 @@ use GFFormsModel;
|
|
10 |
* Gravity Forms Abstraction Method Class
|
11 |
*
|
12 |
* @package Gravity PDF
|
13 |
-
* @copyright Copyright (c)
|
14 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
15 |
* @since 4.0
|
16 |
*/
|
@@ -18,7 +18,7 @@ use GFFormsModel;
|
|
18 |
/*
|
19 |
This file is part of Gravity PDF.
|
20 |
|
21 |
-
Gravity PDF – Copyright (C)
|
22 |
|
23 |
This program is free software; you can redistribute it and/or modify
|
24 |
it under the terms of the GNU General Public License as published by
|
10 |
* Gravity Forms Abstraction Method Class
|
11 |
*
|
12 |
* @package Gravity PDF
|
13 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
14 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
15 |
* @since 4.0
|
16 |
*/
|
18 |
/*
|
19 |
This file is part of Gravity PDF.
|
20 |
|
21 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
22 |
|
23 |
This program is free software; you can redistribute it and/or modify
|
24 |
it under the terms of the GNU General Public License as published by
|
src/helper/Helper_Logger.php
CHANGED
@@ -18,7 +18,7 @@ use GFFormsModel;
|
|
18 |
* Abstract Helper Logger
|
19 |
*
|
20 |
* @package Gravity PDF
|
21 |
-
* @copyright Copyright (c)
|
22 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
23 |
* @since 4.2
|
24 |
*/
|
@@ -31,7 +31,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
31 |
/*
|
32 |
This file is part of Gravity PDF.
|
33 |
|
34 |
-
Gravity PDF – Copyright (C)
|
35 |
|
36 |
This program is free software; you can redistribute it and/or modify
|
37 |
it under the terms of the GNU General Public License as published by
|
@@ -151,14 +151,18 @@ class Helper_Logger {
|
|
151 |
$this->log = new Logger( $this->slug );
|
152 |
|
153 |
/* Setup our Gravity Forms local file logger, if enabled */
|
154 |
-
|
|
|
155 |
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
|
161 |
-
|
|
|
|
|
|
|
162 |
}
|
163 |
|
164 |
/* Disable logging if using CLI, or if Gravity Forms logging isn't enabled */
|
18 |
* Abstract Helper Logger
|
19 |
*
|
20 |
* @package Gravity PDF
|
21 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
22 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
23 |
* @since 4.2
|
24 |
*/
|
31 |
/*
|
32 |
This file is part of Gravity PDF.
|
33 |
|
34 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
35 |
|
36 |
This program is free software; you can redistribute it and/or modify
|
37 |
it under the terms of the GNU General Public License as published by
|
151 |
$this->log = new Logger( $this->slug );
|
152 |
|
153 |
/* Setup our Gravity Forms local file logger, if enabled */
|
154 |
+
try {
|
155 |
+
$this->setup_gravityforms_logging();
|
156 |
|
157 |
+
/* Check if we have a handler pushed and add our Introspection and Memory Peak usage processors */
|
158 |
+
if ( count( $this->log->getHandlers() ) > 0 && substr( php_sapi_name(), 0, 3 ) !== 'cli' ) {
|
159 |
+
$this->log->pushProcessor( new IntrospectionProcessor );
|
160 |
+
$this->log->pushProcessor( new MemoryPeakUsageProcessor );
|
161 |
|
162 |
+
return;
|
163 |
+
}
|
164 |
+
} catch( Exception $e ) {
|
165 |
+
/* do nothing */
|
166 |
}
|
167 |
|
168 |
/* Disable logging if using CLI, or if Gravity Forms logging isn't enabled */
|
src/helper/Helper_Migration.php
CHANGED
@@ -8,7 +8,7 @@ use Exception;
|
|
8 |
|
9 |
/**
|
10 |
* @package Gravity PDF
|
11 |
-
* @copyright Copyright (c)
|
12 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
* @since 4.0
|
14 |
*/
|
@@ -16,7 +16,7 @@ use Exception;
|
|
16 |
/*
|
17 |
This file is part of Gravity PDF.
|
18 |
|
19 |
-
Gravity PDF – Copyright (C)
|
20 |
|
21 |
This program is free software; you can redistribute it and/or modify
|
22 |
it under the terms of the GNU General Public License as published by
|
@@ -536,12 +536,12 @@ class Helper_Migration {
|
|
536 |
|
537 |
if ( $results ) {
|
538 |
/* return the ID if successful */
|
539 |
-
$this->log->addNotice( 'Successfully
|
540 |
'pdf' => $node,
|
541 |
] );
|
542 |
} else {
|
543 |
/* Log errors */
|
544 |
-
$this->log->addError( 'Error
|
545 |
'error' => $results,
|
546 |
'pdf' => $node,
|
547 |
] );
|
8 |
|
9 |
/**
|
10 |
* @package Gravity PDF
|
11 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
12 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
* @since 4.0
|
14 |
*/
|
16 |
/*
|
17 |
This file is part of Gravity PDF.
|
18 |
|
19 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
20 |
|
21 |
This program is free software; you can redistribute it and/or modify
|
22 |
it under the terms of the GNU General Public License as published by
|
536 |
|
537 |
if ( $results ) {
|
538 |
/* return the ID if successful */
|
539 |
+
$this->log->addNotice( 'Successfully Imported v3 Node', [
|
540 |
'pdf' => $node,
|
541 |
] );
|
542 |
} else {
|
543 |
/* Log errors */
|
544 |
+
$this->log->addError( 'Error Importing v3 Node', [
|
545 |
'error' => $results,
|
546 |
'pdf' => $node,
|
547 |
] );
|
src/helper/Helper_Misc.php
CHANGED
@@ -17,7 +17,7 @@ use Exception;
|
|
17 |
* Common Functions shared throughour Gravity PDF
|
18 |
*
|
19 |
* @package Gravity PDF
|
20 |
-
* @copyright Copyright (c)
|
21 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
22 |
* @since 4.0
|
23 |
*/
|
@@ -30,7 +30,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
30 |
/*
|
31 |
This file is part of Gravity PDF.
|
32 |
|
33 |
-
Gravity PDF – Copyright (C)
|
34 |
|
35 |
This program is free software; you can redistribute it and/or modify
|
36 |
it under the terms of the GNU General Public License as published by
|
17 |
* Common Functions shared throughour Gravity PDF
|
18 |
*
|
19 |
* @package Gravity PDF
|
20 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
21 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
22 |
* @since 4.0
|
23 |
*/
|
30 |
/*
|
31 |
This file is part of Gravity PDF.
|
32 |
|
33 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
34 |
|
35 |
This program is free software; you can redistribute it and/or modify
|
36 |
it under the terms of the GNU General Public License as published by
|
src/helper/Helper_Notices.php
CHANGED
@@ -6,7 +6,7 @@ namespace GFPDF\Helper;
|
|
6 |
* Give a standardised format to queue admin notices
|
7 |
*
|
8 |
* @package Gravity PDF
|
9 |
-
* @copyright Copyright (c)
|
10 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
* @since 4.0
|
12 |
*/
|
@@ -19,7 +19,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
19 |
/*
|
20 |
This file is part of Gravity PDF.
|
21 |
|
22 |
-
Gravity PDF – Copyright (C)
|
23 |
|
24 |
This program is free software; you can redistribute it and/or modify
|
25 |
it under the terms of the GNU General Public License as published by
|
6 |
* Give a standardised format to queue admin notices
|
7 |
*
|
8 |
* @package Gravity PDF
|
9 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
10 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
* @since 4.0
|
12 |
*/
|
19 |
/*
|
20 |
This file is part of Gravity PDF.
|
21 |
|
22 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
23 |
|
24 |
This program is free software; you can redistribute it and/or modify
|
25 |
it under the terms of the GNU General Public License as published by
|
src/helper/Helper_Options_Fields.php
CHANGED
@@ -6,7 +6,7 @@ namespace GFPDF\Helper;
|
|
6 |
* Give a standardised format to queue admin notices
|
7 |
*
|
8 |
* @package Gravity PDF
|
9 |
-
* @copyright Copyright (c)
|
10 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
* @since 4.0
|
12 |
*/
|
@@ -19,7 +19,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
19 |
/*
|
20 |
This file is part of Gravity PDF.
|
21 |
|
22 |
-
Gravity PDF – Copyright (C)
|
23 |
|
24 |
This program is free software; you can redistribute it and/or modify
|
25 |
it under the terms of the GNU General Public License as published by
|
@@ -108,13 +108,13 @@ class Helper_Options_Fields extends Helper_Abstract_Options implements Helper_In
|
|
108 |
'default_template' => [
|
109 |
'id' => 'default_template',
|
110 |
'name' => esc_html__( 'Default Template', 'gravity-forms-pdf-extended' ),
|
111 |
-
'desc' => sprintf( esc_html__( 'Choose an existing template or purchased more %sfrom our
|
112 |
'type' => 'select',
|
113 |
'options' => $this->templates->get_all_templates_by_group(),
|
114 |
'std' => 'zadani',
|
115 |
'inputClass' => 'large',
|
116 |
'chosen' => true,
|
117 |
-
'tooltip' => '<h6>' . esc_html__( 'Templates', 'gravity-forms-pdf-extended' ) . '</h6>' . sprintf( esc_html__( 'Gravity PDF comes with %sfour completely-free and highly customizable designs%s. You can also purchase additional templates from our
|
118 |
],
|
119 |
|
120 |
'default_font' => [
|
@@ -265,7 +265,7 @@ class Helper_Options_Fields extends Helper_Abstract_Options implements Helper_In
|
|
265 |
'type' => 'button',
|
266 |
'std' => esc_html__( 'Manage Fonts', 'gravity-forms-pdf-extended' ),
|
267 |
'options' => 'install_fonts',
|
268 |
-
'tooltip' => '<h6>' . esc_html__( 'Install Fonts', 'gravity-forms-pdf-extended' ) . '</h6>' . sprintf( esc_html__( 'Custom fonts can be installed for use in your PDFs. Only %s.ttf%s font files are supported.', 'gravity-forms-pdf-extended' ), '<code>', '</code>'
|
269 |
],
|
270 |
]
|
271 |
),
|
@@ -288,13 +288,13 @@ class Helper_Options_Fields extends Helper_Abstract_Options implements Helper_In
|
|
288 |
'template' => [
|
289 |
'id' => 'template',
|
290 |
'name' => esc_html__( 'Template', 'gravity-forms-pdf-extended' ),
|
291 |
-
'desc' => sprintf( esc_html__( 'Choose an existing template or purchased more %sfrom our
|
292 |
'type' => 'select',
|
293 |
'options' => $this->templates->get_all_templates_by_group(),
|
294 |
'std' => $this->get_option( 'default_template', 'zadani' ),
|
295 |
'inputClass' => 'large',
|
296 |
'chosen' => true,
|
297 |
-
'tooltip' => '<h6>' . esc_html__( 'Templates', 'gravity-forms-pdf-extended' ) . '</h6>' . sprintf( esc_html__( 'Gravity PDF comes with %sfour completely-free and highly customizable designs%s. You can also purchase additional templates from our
|
298 |
],
|
299 |
|
300 |
'notification' => [
|
@@ -668,7 +668,7 @@ class Helper_Options_Fields extends Helper_Abstract_Options implements Helper_In
|
|
668 |
return apply_filters( 'gfpdf_page_names_display_setting', [
|
669 |
'id' => 'show_page_names',
|
670 |
'name' => esc_html__( 'Show Page Names', 'gravity-forms-pdf-extended' ),
|
671 |
-
'desc' => sprintf( esc_html__( 'Display form page names on the PDF. Requires the use of the %sPage Break field%s.', 'gravity-forms-pdf-extended' ), '<a href="https://
|
672 |
'type' => 'radio',
|
673 |
'options' => [
|
674 |
'Yes' => esc_html__( 'Yes', 'gravity-forms-pdf-extended' ),
|
6 |
* Give a standardised format to queue admin notices
|
7 |
*
|
8 |
* @package Gravity PDF
|
9 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
10 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
* @since 4.0
|
12 |
*/
|
19 |
/*
|
20 |
This file is part of Gravity PDF.
|
21 |
|
22 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
23 |
|
24 |
This program is free software; you can redistribute it and/or modify
|
25 |
it under the terms of the GNU General Public License as published by
|
108 |
'default_template' => [
|
109 |
'id' => 'default_template',
|
110 |
'name' => esc_html__( 'Default Template', 'gravity-forms-pdf-extended' ),
|
111 |
+
'desc' => sprintf( esc_html__( 'Choose an existing template or purchased more %sfrom our template shop%s. You can also %sbuild your own%s or %shire us%s to create a custom solution.', 'gravity-forms-pdf-extended' ), '<a href="https://gravitypdf.com/template-shop/">', '</a>', '<a href="https://gravitypdf.com/documentation/v4/developer-start-customising/">', '</a>', '<a href="https://gravitypdf.com/integration-services/">', '</a>' ),
|
112 |
'type' => 'select',
|
113 |
'options' => $this->templates->get_all_templates_by_group(),
|
114 |
'std' => 'zadani',
|
115 |
'inputClass' => 'large',
|
116 |
'chosen' => true,
|
117 |
+
'tooltip' => '<h6>' . esc_html__( 'Templates', 'gravity-forms-pdf-extended' ) . '</h6>' . sprintf( esc_html__( 'Gravity PDF comes with %sfour completely-free and highly customizable designs%s. You can also purchase additional templates from our template shop, hire us to integrate existing PDFs or, with a bit of technical know-how, build your own.', 'gravity-forms-pdf-extended' ), '<strong>', '</strong>' ),
|
118 |
],
|
119 |
|
120 |
'default_font' => [
|
265 |
'type' => 'button',
|
266 |
'std' => esc_html__( 'Manage Fonts', 'gravity-forms-pdf-extended' ),
|
267 |
'options' => 'install_fonts',
|
268 |
+
'tooltip' => '<h6>' . esc_html__( 'Install Fonts', 'gravity-forms-pdf-extended' ) . '</h6>' . sprintf( esc_html__( 'Custom fonts can be installed for use in your PDFs. Only %s.ttf%s font files are supported.', 'gravity-forms-pdf-extended' ), '<code>', '</code>' ),
|
269 |
],
|
270 |
]
|
271 |
),
|
288 |
'template' => [
|
289 |
'id' => 'template',
|
290 |
'name' => esc_html__( 'Template', 'gravity-forms-pdf-extended' ),
|
291 |
+
'desc' => sprintf( esc_html__( 'Choose an existing template or purchased more %sfrom our template shop%s. You can also %sbuild your own%s or %shire us%s to create a custom solution.', 'gravity-forms-pdf-extended' ), '<a href="https://gravitypdf.com/template-shop/">', '</a>', '<a href="https://gravitypdf.com/documentation/v4/developer-start-customising/">', '</a>', '<a href="https://gravitypdf.com/integration-services/">', '</a>' ),
|
292 |
'type' => 'select',
|
293 |
'options' => $this->templates->get_all_templates_by_group(),
|
294 |
'std' => $this->get_option( 'default_template', 'zadani' ),
|
295 |
'inputClass' => 'large',
|
296 |
'chosen' => true,
|
297 |
+
'tooltip' => '<h6>' . esc_html__( 'Templates', 'gravity-forms-pdf-extended' ) . '</h6>' . sprintf( esc_html__( 'Gravity PDF comes with %sfour completely-free and highly customizable designs%s. You can also purchase additional templates from our template shop, hire us to integrate existing PDFs or, with a bit of technical know-how, build your own.', 'gravity-forms-pdf-extended' ), '<strong>', '</strong>' ),
|
298 |
],
|
299 |
|
300 |
'notification' => [
|
668 |
return apply_filters( 'gfpdf_page_names_display_setting', [
|
669 |
'id' => 'show_page_names',
|
670 |
'name' => esc_html__( 'Show Page Names', 'gravity-forms-pdf-extended' ),
|
671 |
+
'desc' => sprintf( esc_html__( 'Display form page names on the PDF. Requires the use of the %sPage Break field%s.', 'gravity-forms-pdf-extended' ), '<a href="https://docs.gravityforms.com/page-break/">', '</a>' ),
|
672 |
'type' => 'radio',
|
673 |
'options' => [
|
674 |
'Yes' => esc_html__( 'Yes', 'gravity-forms-pdf-extended' ),
|
src/helper/Helper_PDF.php
CHANGED
@@ -10,7 +10,7 @@ use Exception;
|
|
10 |
* Generates our PDF document using mPDF
|
11 |
*
|
12 |
* @package Gravity PDF
|
13 |
-
* @copyright Copyright (c)
|
14 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
15 |
* @since 4.0
|
16 |
*/
|
@@ -23,7 +23,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
23 |
/*
|
24 |
This file is part of Gravity PDF.
|
25 |
|
26 |
-
Gravity PDF – Copyright (C)
|
27 |
|
28 |
This program is free software; you can redistribute it and/or modify
|
29 |
it under the terms of the GNU General Public License as published by
|
@@ -248,6 +248,13 @@ class Helper_PDF {
|
|
248 |
|
249 |
$form = $this->form;
|
250 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
/* Load in our PHP template */
|
252 |
if ( empty( $html ) ) {
|
253 |
$html = $this->load_html( $args );
|
@@ -337,7 +344,7 @@ class Helper_PDF {
|
|
337 |
/* create our path */
|
338 |
if ( ! is_dir( $this->path ) ) {
|
339 |
if ( ! wp_mkdir_p( $this->path ) ) {
|
340 |
-
throw new Exception( sprintf( 'Could not create directory: %s'
|
341 |
}
|
342 |
}
|
343 |
|
@@ -623,6 +630,13 @@ class Helper_PDF {
|
|
623 |
$this->mpdf = apply_filters( 'gfpdf_mpdf_init_class', $this->mpdf, $this->form, $this->entry, $this->settings, $this );
|
624 |
}
|
625 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
626 |
/**
|
627 |
* Set up the paper size and orentation
|
628 |
*
|
10 |
* Generates our PDF document using mPDF
|
11 |
*
|
12 |
* @package Gravity PDF
|
13 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
14 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
15 |
* @since 4.0
|
16 |
*/
|
23 |
/*
|
24 |
This file is part of Gravity PDF.
|
25 |
|
26 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
27 |
|
28 |
This program is free software; you can redistribute it and/or modify
|
29 |
it under the terms of the GNU General Public License as published by
|
248 |
|
249 |
$form = $this->form;
|
250 |
|
251 |
+
/* Allow this method to be short circuited */
|
252 |
+
if ( apply_filters( 'gfpdf_skip_pdf_html_render', false, $args, $this ) ) {
|
253 |
+
do_action( 'gfpdf_skipped_html_render', $args, $this );
|
254 |
+
|
255 |
+
return false;
|
256 |
+
}
|
257 |
+
|
258 |
/* Load in our PHP template */
|
259 |
if ( empty( $html ) ) {
|
260 |
$html = $this->load_html( $args );
|
344 |
/* create our path */
|
345 |
if ( ! is_dir( $this->path ) ) {
|
346 |
if ( ! wp_mkdir_p( $this->path ) ) {
|
347 |
+
throw new Exception( sprintf( 'Could not create directory: %s', esc_html( $this->path ) ) );
|
348 |
}
|
349 |
}
|
350 |
|
630 |
$this->mpdf = apply_filters( 'gfpdf_mpdf_init_class', $this->mpdf, $this->form, $this->entry, $this->settings, $this );
|
631 |
}
|
632 |
|
633 |
+
/**
|
634 |
+
* @return \mPDF
|
635 |
+
*/
|
636 |
+
public function get_pdf_class() {
|
637 |
+
return $this->mpdf;
|
638 |
+
}
|
639 |
+
|
640 |
/**
|
641 |
* Set up the paper size and orentation
|
642 |
*
|
src/helper/Helper_PDF_List_Table.php
CHANGED
@@ -9,7 +9,7 @@ use WP_List_Table;
|
|
9 |
* WP_List_Table Helper Controller
|
10 |
*
|
11 |
* @package Gravity PDF
|
12 |
-
* @copyright Copyright (c)
|
13 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
14 |
* @since 4.0
|
15 |
*/
|
@@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
22 |
/*
|
23 |
This file is part of Gravity PDF.
|
24 |
|
25 |
-
Gravity PDF – Copyright (C)
|
26 |
|
27 |
This program is free software; you can redistribute it and/or modify
|
28 |
it under the terms of the GNU General Public License as published by
|
9 |
* WP_List_Table Helper Controller
|
10 |
*
|
11 |
* @package Gravity PDF
|
12 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
13 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
14 |
* @since 4.0
|
15 |
*/
|
22 |
/*
|
23 |
This file is part of Gravity PDF.
|
24 |
|
25 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
26 |
|
27 |
This program is free software; you can redistribute it and/or modify
|
28 |
it under the terms of the GNU General Public License as published by
|
src/helper/Helper_QueryPath.php
CHANGED
@@ -10,7 +10,7 @@ use \QueryPath;
|
|
10 |
* Extends Query Path to make it more useful to us when using the HTML5 methods (which are UTF-8 compatible).
|
11 |
*
|
12 |
* @package Gravity PDF
|
13 |
-
* @copyright Copyright (c)
|
14 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
15 |
* @since 4.0
|
16 |
*/
|
@@ -23,7 +23,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
23 |
/*
|
24 |
This file is part of Gravity PDF.
|
25 |
|
26 |
-
Gravity PDF – Copyright (C)
|
27 |
|
28 |
This program is free software; you can redistribute it and/or modify
|
29 |
it under the terms of the GNU General Public License as published by
|
10 |
* Extends Query Path to make it more useful to us when using the HTML5 methods (which are UTF-8 compatible).
|
11 |
*
|
12 |
* @package Gravity PDF
|
13 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
14 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
15 |
* @since 4.0
|
16 |
*/
|
23 |
/*
|
24 |
This file is part of Gravity PDF.
|
25 |
|
26 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
27 |
|
28 |
This program is free software; you can redistribute it and/or modify
|
29 |
it under the terms of the GNU General Public License as published by
|
src/helper/Helper_Singleton.php
CHANGED
@@ -9,7 +9,7 @@ namespace GFPDF\Helper;
|
|
9 |
* This isn't considered an actual `Singleton` pattern as we're not modifying our classes in any way (no static methods / disabling of the __construct), but it has the same objectives
|
10 |
*
|
11 |
* @package Gravity PDF
|
12 |
-
* @copyright Copyright (c)
|
13 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
14 |
* @since 4.0
|
15 |
*/
|
@@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
22 |
/*
|
23 |
This file is part of Gravity PDF.
|
24 |
|
25 |
-
Gravity PDF – Copyright (C)
|
26 |
|
27 |
This program is free software; you can redistribute it and/or modify
|
28 |
it under the terms of the GNU General Public License as published by
|
9 |
* This isn't considered an actual `Singleton` pattern as we're not modifying our classes in any way (no static methods / disabling of the __construct), but it has the same objectives
|
10 |
*
|
11 |
* @package Gravity PDF
|
12 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
13 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
14 |
* @since 4.0
|
15 |
*/
|
22 |
/*
|
23 |
This file is part of Gravity PDF.
|
24 |
|
25 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
26 |
|
27 |
This program is free software; you can redistribute it and/or modify
|
28 |
it under the terms of the GNU General Public License as published by
|
src/helper/Helper_Templates.php
CHANGED
@@ -11,7 +11,7 @@ use stdClass;
|
|
11 |
* Handles all the template-related functionality
|
12 |
*
|
13 |
* @package Gravity PDF
|
14 |
-
* @copyright Copyright (c)
|
15 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
16 |
* @since 4.1
|
17 |
*/
|
@@ -24,7 +24,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
24 |
/*
|
25 |
This file is part of Gravity PDF.
|
26 |
|
27 |
-
Gravity PDF – Copyright (C)
|
28 |
|
29 |
This program is free software; you can redistribute it and/or modify
|
30 |
it under the terms of the GNU General Public License as published by
|
11 |
* Handles all the template-related functionality
|
12 |
*
|
13 |
* @package Gravity PDF
|
14 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
15 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
16 |
* @since 4.1
|
17 |
*/
|
24 |
/*
|
25 |
This file is part of Gravity PDF.
|
26 |
|
27 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
28 |
|
29 |
This program is free software; you can redistribute it and/or modify
|
30 |
it under the terms of the GNU General Public License as published by
|
src/helper/abstract/Helper_Abstract_Addon.php
CHANGED
@@ -6,7 +6,7 @@ namespace GFPDF\Helper;
|
|
6 |
* Abstract Helper Addon
|
7 |
*
|
8 |
* @package Gravity PDF
|
9 |
-
* @copyright Copyright (c)
|
10 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
* @since 4.2
|
12 |
*/
|
@@ -19,7 +19,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
19 |
/*
|
20 |
This file is part of Gravity PDF.
|
21 |
|
22 |
-
Gravity PDF – Copyright (C)
|
23 |
|
24 |
This program is free software; you can redistribute it and/or modify
|
25 |
it under the terms of the GNU General Public License as published by
|
6 |
* Abstract Helper Addon
|
7 |
*
|
8 |
* @package Gravity PDF
|
9 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
10 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
* @since 4.2
|
12 |
*/
|
19 |
/*
|
20 |
This file is part of Gravity PDF.
|
21 |
|
22 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
23 |
|
24 |
This program is free software; you can redistribute it and/or modify
|
25 |
it under the terms of the GNU General Public License as published by
|
src/helper/abstract/Helper_Abstract_Controller.php
CHANGED
@@ -6,7 +6,7 @@ namespace GFPDF\Helper;
|
|
6 |
* Abstract Helper Controller
|
7 |
*
|
8 |
* @package Gravity PDF
|
9 |
-
* @copyright Copyright (c)
|
10 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
* @since 4.0
|
12 |
*/
|
@@ -19,7 +19,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
19 |
/*
|
20 |
This file is part of Gravity PDF.
|
21 |
|
22 |
-
Gravity PDF – Copyright (C)
|
23 |
|
24 |
This program is free software; you can redistribute it and/or modify
|
25 |
it under the terms of the GNU General Public License as published by
|
6 |
* Abstract Helper Controller
|
7 |
*
|
8 |
* @package Gravity PDF
|
9 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
10 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
* @since 4.0
|
12 |
*/
|
19 |
/*
|
20 |
This file is part of Gravity PDF.
|
21 |
|
22 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
23 |
|
24 |
This program is free software; you can redistribute it and/or modify
|
25 |
it under the terms of the GNU General Public License as published by
|
src/helper/abstract/Helper_Abstract_Field_Products.php
CHANGED
@@ -13,7 +13,7 @@ use Exception;
|
|
13 |
* Abstract Helper Fields
|
14 |
*
|
15 |
* @package Gravity PDF
|
16 |
-
* @copyright Copyright (c)
|
17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
18 |
* @since 4.0
|
19 |
*/
|
@@ -26,7 +26,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
26 |
/*
|
27 |
This file is part of Gravity PDF.
|
28 |
|
29 |
-
Gravity PDF – Copyright (C)
|
30 |
|
31 |
This program is free software; you can redistribute it and/or modify
|
32 |
it under the terms of the GNU General Public License as published by
|
13 |
* Abstract Helper Fields
|
14 |
*
|
15 |
* @package Gravity PDF
|
16 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
18 |
* @since 4.0
|
19 |
*/
|
26 |
/*
|
27 |
This file is part of Gravity PDF.
|
28 |
|
29 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
30 |
|
31 |
This program is free software; you can redistribute it and/or modify
|
32 |
it under the terms of the GNU General Public License as published by
|
src/helper/abstract/Helper_Abstract_Fields.php
CHANGED
@@ -13,7 +13,7 @@ use Exception;
|
|
13 |
* Abstract Helper Fields
|
14 |
*
|
15 |
* @package Gravity PDF
|
16 |
-
* @copyright Copyright (c)
|
17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
18 |
* @since 4.0
|
19 |
*/
|
@@ -26,7 +26,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
26 |
/*
|
27 |
This file is part of Gravity PDF.
|
28 |
|
29 |
-
Gravity PDF – Copyright (C)
|
30 |
|
31 |
This program is free software; you can redistribute it and/or modify
|
32 |
it under the terms of the GNU General Public License as published by
|
@@ -225,7 +225,7 @@ abstract class Helper_Abstract_Fields {
|
|
225 |
* See https://gravitypdf.com/documentation/v4/gfpdf_field_value/ for more details about this filter
|
226 |
*/
|
227 |
|
228 |
-
return apply_filters( 'gfpdf_field_value', GFFormsModel::get_lead_field_value( $this->entry, $this->field ), $this->field, $this->entry );
|
229 |
}
|
230 |
|
231 |
/**
|
13 |
* Abstract Helper Fields
|
14 |
*
|
15 |
* @package Gravity PDF
|
16 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
17 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
18 |
* @since 4.0
|
19 |
*/
|
26 |
/*
|
27 |
This file is part of Gravity PDF.
|
28 |
|
29 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
30 |
|
31 |
This program is free software; you can redistribute it and/or modify
|
32 |
it under the terms of the GNU General Public License as published by
|
225 |
* See https://gravitypdf.com/documentation/v4/gfpdf_field_value/ for more details about this filter
|
226 |
*/
|
227 |
|
228 |
+
return apply_filters( 'gfpdf_field_value', GFFormsModel::get_lead_field_value( $this->entry, $this->field ), $this->field, $this->entry, $this->form, $this );
|
229 |
}
|
230 |
|
231 |
/**
|
src/helper/abstract/Helper_Abstract_Form.php
CHANGED
@@ -9,7 +9,7 @@ namespace GFPDF\Helper;
|
|
9 |
* Gravity Form-specific areas of code will have limited decoupling as it would need to be rewritten specifically for the replacement plugin (eg. /src/helper/fields/)
|
10 |
*
|
11 |
* @package Gravity PDF
|
12 |
-
* @copyright Copyright (c)
|
13 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
14 |
* @since 4.0
|
15 |
*/
|
@@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
22 |
/*
|
23 |
This file is part of Gravity PDF.
|
24 |
|
25 |
-
Gravity PDF – Copyright (C)
|
26 |
|
27 |
This program is free software; you can redistribute it and/or modify
|
28 |
it under the terms of the GNU General Public License as published by
|
9 |
* Gravity Form-specific areas of code will have limited decoupling as it would need to be rewritten specifically for the replacement plugin (eg. /src/helper/fields/)
|
10 |
*
|
11 |
* @package Gravity PDF
|
12 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
13 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
14 |
* @since 4.0
|
15 |
*/
|
22 |
/*
|
23 |
This file is part of Gravity PDF.
|
24 |
|
25 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
26 |
|
27 |
This program is free software; you can redistribute it and/or modify
|
28 |
it under the terms of the GNU General Public License as published by
|
src/helper/abstract/Helper_Abstract_Model.php
CHANGED
@@ -6,7 +6,7 @@ namespace GFPDF\Helper;
|
|
6 |
* Abstract Helper Model
|
7 |
*
|
8 |
* @package Gravity PDF
|
9 |
-
* @copyright Copyright (c)
|
10 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
* @since 4.0
|
12 |
*/
|
@@ -19,7 +19,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
19 |
/*
|
20 |
This file is part of Gravity PDF.
|
21 |
|
22 |
-
Gravity PDF – Copyright (C)
|
23 |
|
24 |
This program is free software; you can redistribute it and/or modify
|
25 |
it under the terms of the GNU General Public License as published by
|
6 |
* Abstract Helper Model
|
7 |
*
|
8 |
* @package Gravity PDF
|
9 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
10 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
* @since 4.0
|
12 |
*/
|
19 |
/*
|
20 |
This file is part of Gravity PDF.
|
21 |
|
22 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
23 |
|
24 |
This program is free software; you can redistribute it and/or modify
|
25 |
it under the terms of the GNU General Public License as published by
|
src/helper/abstract/Helper_Abstract_Options.php
CHANGED
@@ -10,7 +10,7 @@ use WP_Error;
|
|
10 |
* Our Gravity PDF Options API
|
11 |
*
|
12 |
* @package Gravity PDF
|
13 |
-
* @copyright Copyright (c)
|
14 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
15 |
* @since 4.0
|
16 |
*/
|
@@ -18,7 +18,7 @@ use WP_Error;
|
|
18 |
/*
|
19 |
This file is part of Gravity PDF.
|
20 |
|
21 |
-
Gravity PDF – Copyright (C)
|
22 |
|
23 |
This program is free software; you can redistribute it and/or modify
|
24 |
it under the terms of the GNU General Public License as published by
|
@@ -450,12 +450,6 @@ abstract class Helper_Abstract_Options implements Helper_Interface_Filters {
|
|
450 |
* @return array|WP_Error
|
451 |
*/
|
452 |
public function get_pdf( $form_id, $pdf_id ) {
|
453 |
-
|
454 |
-
$this->log->addNotice( 'Getting Settings.', [
|
455 |
-
'form_id' => $form_id,
|
456 |
-
'pdf_id' => $pdf_id,
|
457 |
-
] );
|
458 |
-
|
459 |
$gfpdf_options = $this->get_form_pdfs( $form_id );
|
460 |
|
461 |
if ( ! is_wp_error( $gfpdf_options ) ) {
|
@@ -493,13 +487,6 @@ abstract class Helper_Abstract_Options implements Helper_Interface_Filters {
|
|
493 |
* @since 4.0
|
494 |
*/
|
495 |
public function add_pdf( $form_id, $pdf = [] ) {
|
496 |
-
|
497 |
-
$this->log->addNotice( 'Adding Settings.', [
|
498 |
-
'form_id' => $form_id,
|
499 |
-
'new_settings' => $pdf,
|
500 |
-
] );
|
501 |
-
|
502 |
-
/* First let's grab the current settings */
|
503 |
$options = $this->get_form_pdfs( $form_id );
|
504 |
|
505 |
if ( ! is_wp_error( $options ) ) {
|
@@ -517,14 +504,14 @@ abstract class Helper_Abstract_Options implements Helper_Interface_Filters {
|
|
517 |
if ( $results ) {
|
518 |
|
519 |
/* return the ID if successful */
|
520 |
-
$this->log->addNotice( 'Successfuly Added
|
521 |
'pdf' => $pdf,
|
522 |
] );
|
523 |
|
524 |
return $pdf['id'];
|
525 |
}
|
526 |
|
527 |
-
$this->log->addError( 'Error Saving
|
528 |
'error' => $results,
|
529 |
'pdf' => $pdf,
|
530 |
] );
|
@@ -552,7 +539,7 @@ abstract class Helper_Abstract_Options implements Helper_Interface_Filters {
|
|
552 |
*/
|
553 |
public function update_pdf( $form_id, $pdf_id, $pdf = '', $update_db = true, $filters = true ) {
|
554 |
|
555 |
-
$this->log->addNotice( 'Updating Settings
|
556 |
'form_id' => $form_id,
|
557 |
'pdf_id' => $pdf_id,
|
558 |
'new_settings' => $pdf,
|
@@ -572,8 +559,7 @@ abstract class Helper_Abstract_Options implements Helper_Interface_Filters {
|
|
572 |
|
573 |
/* Don't run when adding a new PDF */
|
574 |
if ( $filters ) {
|
575 |
-
|
576 |
-
$this->log->addNotice( 'Trigger Filters.' );
|
577 |
|
578 |
/* See https://gravitypdf.com/documentation/v4/gfpdf_form_update_pdf/ for more details about these filters */
|
579 |
$pdf = apply_filters( 'gfpdf_form_update_pdf', $pdf, $form_id, $pdf_id );
|
@@ -592,7 +578,7 @@ abstract class Helper_Abstract_Options implements Helper_Interface_Filters {
|
|
592 |
$did_update = false;
|
593 |
if ( $update_db ) {
|
594 |
|
595 |
-
$this->log->addNotice( '
|
596 |
'form_id' => $form['id'],
|
597 |
] );
|
598 |
|
@@ -601,18 +587,15 @@ abstract class Helper_Abstract_Options implements Helper_Interface_Filters {
|
|
601 |
}
|
602 |
|
603 |
if ( ! $update_db || $did_update !== false ) {
|
604 |
-
|
605 |
-
/* If it updated successfully let's update the global variable */
|
606 |
-
$this->log->addNotice( 'Save Local Form Cache.' );
|
607 |
-
|
608 |
$this->data->form_settings[ $form_id ] = $options;
|
609 |
}
|
610 |
|
611 |
/* true if successful, false if failed */
|
612 |
-
|
613 |
return $did_update;
|
614 |
}
|
615 |
|
|
|
|
|
616 |
return false;
|
617 |
}
|
618 |
|
@@ -630,7 +613,7 @@ abstract class Helper_Abstract_Options implements Helper_Interface_Filters {
|
|
630 |
*/
|
631 |
public function delete_pdf( $form_id, $pdf_id ) {
|
632 |
|
633 |
-
$this->log->addNotice( 'Deleting Setting
|
634 |
'form_id' => $form_id,
|
635 |
'pdf_id' => $pdf_id,
|
636 |
] );
|
@@ -642,11 +625,6 @@ abstract class Helper_Abstract_Options implements Helper_Interface_Filters {
|
|
642 |
|
643 |
/* Next let's try to update the value */
|
644 |
if ( isset( $options[ $pdf_id ] ) ) {
|
645 |
-
|
646 |
-
$this->log->addNotice( 'Found Setting. Now deleting...', [
|
647 |
-
'pdf' => $options[ $pdf_id ],
|
648 |
-
] );
|
649 |
-
|
650 |
unset( $options[ $pdf_id ] );
|
651 |
}
|
652 |
|
@@ -662,7 +640,7 @@ abstract class Helper_Abstract_Options implements Helper_Interface_Filters {
|
|
662 |
/* If it updated, let's update the global variable */
|
663 |
if ( $did_update !== false ) {
|
664 |
|
665 |
-
$this->log->addNotice( 'Setting
|
666 |
'form_id' => $form_id,
|
667 |
'pdf_id' => $pdf_id,
|
668 |
] );
|
@@ -675,7 +653,7 @@ abstract class Helper_Abstract_Options implements Helper_Interface_Filters {
|
|
675 |
return $did_update;
|
676 |
}
|
677 |
|
678 |
-
$this->log->addError( 'PDF
|
679 |
'form_id' => $form_id,
|
680 |
'pdf_id' => $pdf_id,
|
681 |
] );
|
@@ -725,8 +703,7 @@ abstract class Helper_Abstract_Options implements Helper_Interface_Filters {
|
|
725 |
public function update_option( $key = '', $value = false ) {
|
726 |
|
727 |
if ( empty( $key ) ) {
|
728 |
-
$this->log->addError( 'Option
|
729 |
-
'key' => $key,
|
730 |
'value' => $value,
|
731 |
] );
|
732 |
|
10 |
* Our Gravity PDF Options API
|
11 |
*
|
12 |
* @package Gravity PDF
|
13 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
14 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
15 |
* @since 4.0
|
16 |
*/
|
18 |
/*
|
19 |
This file is part of Gravity PDF.
|
20 |
|
21 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
22 |
|
23 |
This program is free software; you can redistribute it and/or modify
|
24 |
it under the terms of the GNU General Public License as published by
|
450 |
* @return array|WP_Error
|
451 |
*/
|
452 |
public function get_pdf( $form_id, $pdf_id ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
453 |
$gfpdf_options = $this->get_form_pdfs( $form_id );
|
454 |
|
455 |
if ( ! is_wp_error( $gfpdf_options ) ) {
|
487 |
* @since 4.0
|
488 |
*/
|
489 |
public function add_pdf( $form_id, $pdf = [] ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
490 |
$options = $this->get_form_pdfs( $form_id );
|
491 |
|
492 |
if ( ! is_wp_error( $options ) ) {
|
504 |
if ( $results ) {
|
505 |
|
506 |
/* return the ID if successful */
|
507 |
+
$this->log->addNotice( 'Successfuly Added New PDF', [
|
508 |
'pdf' => $pdf,
|
509 |
] );
|
510 |
|
511 |
return $pdf['id'];
|
512 |
}
|
513 |
|
514 |
+
$this->log->addError( 'Error Saving New PDF', [
|
515 |
'error' => $results,
|
516 |
'pdf' => $pdf,
|
517 |
] );
|
539 |
*/
|
540 |
public function update_pdf( $form_id, $pdf_id, $pdf = '', $update_db = true, $filters = true ) {
|
541 |
|
542 |
+
$this->log->addNotice( 'Begin Updating PDF Settings', [
|
543 |
'form_id' => $form_id,
|
544 |
'pdf_id' => $pdf_id,
|
545 |
'new_settings' => $pdf,
|
559 |
|
560 |
/* Don't run when adding a new PDF */
|
561 |
if ( $filters ) {
|
562 |
+
$this->log->addNotice( 'Run PDF Update Filters' );
|
|
|
563 |
|
564 |
/* See https://gravitypdf.com/documentation/v4/gfpdf_form_update_pdf/ for more details about these filters */
|
565 |
$pdf = apply_filters( 'gfpdf_form_update_pdf', $pdf, $form_id, $pdf_id );
|
578 |
$did_update = false;
|
579 |
if ( $update_db ) {
|
580 |
|
581 |
+
$this->log->addNotice( 'Updating PDF Settings in Form Object', [
|
582 |
'form_id' => $form['id'],
|
583 |
] );
|
584 |
|
587 |
}
|
588 |
|
589 |
if ( ! $update_db || $did_update !== false ) {
|
|
|
|
|
|
|
|
|
590 |
$this->data->form_settings[ $form_id ] = $options;
|
591 |
}
|
592 |
|
593 |
/* true if successful, false if failed */
|
|
|
594 |
return $did_update;
|
595 |
}
|
596 |
|
597 |
+
$this->log->addNotice( 'Completed Updating PDF Settings' );
|
598 |
+
|
599 |
return false;
|
600 |
}
|
601 |
|
613 |
*/
|
614 |
public function delete_pdf( $form_id, $pdf_id ) {
|
615 |
|
616 |
+
$this->log->addNotice( 'Begin Deleting PDF Setting', [
|
617 |
'form_id' => $form_id,
|
618 |
'pdf_id' => $pdf_id,
|
619 |
] );
|
625 |
|
626 |
/* Next let's try to update the value */
|
627 |
if ( isset( $options[ $pdf_id ] ) ) {
|
|
|
|
|
|
|
|
|
|
|
628 |
unset( $options[ $pdf_id ] );
|
629 |
}
|
630 |
|
640 |
/* If it updated, let's update the global variable */
|
641 |
if ( $did_update !== false ) {
|
642 |
|
643 |
+
$this->log->addNotice( 'Completed Deleting PDF Setting', [
|
644 |
'form_id' => $form_id,
|
645 |
'pdf_id' => $pdf_id,
|
646 |
] );
|
653 |
return $did_update;
|
654 |
}
|
655 |
|
656 |
+
$this->log->addError( 'Failed Deleting PDF Setting', [
|
657 |
'form_id' => $form_id,
|
658 |
'pdf_id' => $pdf_id,
|
659 |
] );
|
703 |
public function update_option( $key = '', $value = false ) {
|
704 |
|
705 |
if ( empty( $key ) ) {
|
706 |
+
$this->log->addError( 'Empty Option Key', [
|
|
|
707 |
'value' => $value,
|
708 |
] );
|
709 |
|
src/helper/abstract/Helper_Abstract_View.php
CHANGED
@@ -8,7 +8,7 @@ use WP_Error;
|
|
8 |
* Abstract Helper View
|
9 |
*
|
10 |
* @package Gravity PDF
|
11 |
-
* @copyright Copyright (c)
|
12 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
* @since 4.0
|
14 |
*/
|
@@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
21 |
/*
|
22 |
This file is part of Gravity PDF.
|
23 |
|
24 |
-
Gravity PDF – Copyright (C)
|
25 |
|
26 |
This program is free software; you can redistribute it and/or modify
|
27 |
it under the terms of the GNU General Public License as published by
|
8 |
* Abstract Helper View
|
9 |
*
|
10 |
* @package Gravity PDF
|
11 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
12 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
* @since 4.0
|
14 |
*/
|
21 |
/*
|
22 |
This file is part of Gravity PDF.
|
23 |
|
24 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
25 |
|
26 |
This program is free software; you can redistribute it and/or modify
|
27 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_Address.php
CHANGED
@@ -14,7 +14,7 @@ use Exception;
|
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
-
Gravity PDF – Copyright (C)
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_Chainedselect.php
ADDED
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace GFPDF\Helper\Fields;
|
4 |
+
|
5 |
+
use GFPDF\Helper\Helper_Abstract_Form;
|
6 |
+
use GFPDF\Helper\Helper_Misc;
|
7 |
+
use GFPDF\Helper\Helper_Abstract_Fields;
|
8 |
+
|
9 |
+
use GF_Chained_Field_Select;
|
10 |
+
|
11 |
+
use GFCommon;
|
12 |
+
use Exception;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Gravity Forms Field
|
16 |
+
*
|
17 |
+
* @package Gravity PDF
|
18 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
19 |
+
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
20 |
+
* @since 4.0
|
21 |
+
*/
|
22 |
+
|
23 |
+
/* Exit if accessed directly */
|
24 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
25 |
+
exit;
|
26 |
+
}
|
27 |
+
|
28 |
+
/*
|
29 |
+
This file is part of Gravity PDF.
|
30 |
+
|
31 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
32 |
+
|
33 |
+
This program is free software; you can redistribute it and/or modify
|
34 |
+
it under the terms of the GNU General Public License as published by
|
35 |
+
the Free Software Foundation; either version 2 of the License, or
|
36 |
+
(at your option) any later version.
|
37 |
+
|
38 |
+
This program is distributed in the hope that it will be useful,
|
39 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
40 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
41 |
+
GNU General Public License for more details.
|
42 |
+
|
43 |
+
You should have received a copy of the GNU General Public License
|
44 |
+
along with this program; if not, write to the Free Software
|
45 |
+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
46 |
+
*/
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Controls the display and output of a Gravity Form field
|
50 |
+
*
|
51 |
+
* @since 4.0
|
52 |
+
*/
|
53 |
+
class Field_Chainedselect extends Helper_Abstract_Fields {
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Check the appropriate variables are parsed in send to the parent construct
|
57 |
+
*
|
58 |
+
* @param object $field The GF_Field_* Object
|
59 |
+
* @param array $entry The Gravity Forms Entry
|
60 |
+
*
|
61 |
+
* @param \GFPDF\Helper\Helper_Abstract_Form $gform
|
62 |
+
* @param \GFPDF\Helper\Helper_Misc $misc
|
63 |
+
*
|
64 |
+
* @throws Exception
|
65 |
+
*
|
66 |
+
* @since 4.0
|
67 |
+
*/
|
68 |
+
public function __construct( $field, $entry, Helper_Abstract_Form $gform, Helper_Misc $misc ) {
|
69 |
+
|
70 |
+
if ( ! is_object( $field ) || ! $field instanceof GF_Chained_Field_Select ) {
|
71 |
+
throw new Exception( '$field needs to be in instance of GF_Chained_Field_Select' );
|
72 |
+
}
|
73 |
+
|
74 |
+
/* call our parent method */
|
75 |
+
parent::__construct( $field, $entry, $gform, $misc );
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Display the HTML version of this field
|
80 |
+
*
|
81 |
+
* @param string $value
|
82 |
+
* @param bool $label
|
83 |
+
*
|
84 |
+
* @return string
|
85 |
+
*
|
86 |
+
* @since 4.0
|
87 |
+
*/
|
88 |
+
public function html( $value = '', $label = true ) {
|
89 |
+
$html = GFCommon::get_lead_field_display( $this->field, $this->get_value(), $this->entry['currency'] );
|
90 |
+
$html = apply_filters( 'gform_entry_field_value', $html, $this->field, $this->entry, $this->form );
|
91 |
+
|
92 |
+
return parent::html( $html );
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Standardised method for returning the field's correct $form_data['field'] keys
|
97 |
+
*
|
98 |
+
* @return array
|
99 |
+
*
|
100 |
+
* @since 4.0
|
101 |
+
*/
|
102 |
+
public function form_data() {
|
103 |
+
$value = array_values( $this->value() );
|
104 |
+
$label = $this->get_label();
|
105 |
+
$field_id = (int) $this->field->id;
|
106 |
+
$data = [];
|
107 |
+
|
108 |
+
/* Add field data using standardised naming convesion */
|
109 |
+
$data[ $field_id . '.' . $label ] = $value;
|
110 |
+
|
111 |
+
/* Add field data using standardised naming convesion */
|
112 |
+
$data[ $field_id ] = $value;
|
113 |
+
|
114 |
+
/* Keep backwards compatibility */
|
115 |
+
$data[ $label ] = $value;
|
116 |
+
|
117 |
+
return [ 'field' => $data ];
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Get the standard GF value of this field
|
122 |
+
*
|
123 |
+
* @return string|array
|
124 |
+
*
|
125 |
+
* @since 4.0
|
126 |
+
*/
|
127 |
+
public function value() {
|
128 |
+
if ( $this->has_cache() ) {
|
129 |
+
return $this->cache();
|
130 |
+
}
|
131 |
+
|
132 |
+
$this->cache( $this->get_value() );
|
133 |
+
|
134 |
+
return $this->cache();
|
135 |
+
}
|
136 |
+
}
|
src/helper/fields/Field_Checkbox.php
CHANGED
@@ -15,7 +15,7 @@ use Exception;
|
|
15 |
* Gravity Forms Field
|
16 |
*
|
17 |
* @package Gravity PDF
|
18 |
-
* @copyright Copyright (c)
|
19 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
20 |
* @since 4.0
|
21 |
*/
|
@@ -28,7 +28,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
28 |
/*
|
29 |
This file is part of Gravity PDF.
|
30 |
|
31 |
-
Gravity PDF – Copyright (C)
|
32 |
|
33 |
This program is free software; you can redistribute it and/or modify
|
34 |
it under the terms of the GNU General Public License as published by
|
@@ -175,10 +175,10 @@ class Field_Checkbox extends Helper_Abstract_Fields {
|
|
175 |
|
176 |
foreach ( $value as $key => $item ) {
|
177 |
$label = esc_html( GFCommon::selection_display( $item, $this->field, '', true ) );
|
178 |
-
$label = wp_kses_post( wp_specialchars_decode( $label, ENT_QUOTES ) );
|
179 |
|
180 |
$value = esc_html( GFCommon::selection_display( $item, $this->field ) );
|
181 |
-
$value = wp_kses_post( wp_specialchars_decode( $value, ENT_QUOTES ) );
|
182 |
|
183 |
$items[] = [
|
184 |
'value' => $value,
|
15 |
* Gravity Forms Field
|
16 |
*
|
17 |
* @package Gravity PDF
|
18 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
19 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
20 |
* @since 4.0
|
21 |
*/
|
28 |
/*
|
29 |
This file is part of Gravity PDF.
|
30 |
|
31 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
32 |
|
33 |
This program is free software; you can redistribute it and/or modify
|
34 |
it under the terms of the GNU General Public License as published by
|
175 |
|
176 |
foreach ( $value as $key => $item ) {
|
177 |
$label = esc_html( GFCommon::selection_display( $item, $this->field, '', true ) );
|
178 |
+
$label = wp_kses_post( $this->gform->process_tags( wp_specialchars_decode( $label, ENT_QUOTES ), $this->form, $this->entry ) );
|
179 |
|
180 |
$value = esc_html( GFCommon::selection_display( $item, $this->field ) );
|
181 |
+
$value = wp_kses_post( $this->gform->process_tags( wp_specialchars_decode( $value, ENT_QUOTES ), $this->form, $this->entry ) );
|
182 |
|
183 |
$items[] = [
|
184 |
'value' => $value,
|
src/helper/fields/Field_Coupon.php
CHANGED
@@ -14,7 +14,7 @@ use Exception;
|
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
-
Gravity PDF – Copyright (C)
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_Creditcard.php
CHANGED
@@ -14,7 +14,7 @@ use Exception;
|
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
-
Gravity PDF – Copyright (C)
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_Date.php
CHANGED
@@ -15,7 +15,7 @@ use Exception;
|
|
15 |
* Gravity Forms Field
|
16 |
*
|
17 |
* @package Gravity PDF
|
18 |
-
* @copyright Copyright (c)
|
19 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
20 |
* @since 4.0
|
21 |
*/
|
@@ -28,7 +28,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
28 |
/*
|
29 |
This file is part of Gravity PDF.
|
30 |
|
31 |
-
Gravity PDF – Copyright (C)
|
32 |
|
33 |
This program is free software; you can redistribute it and/or modify
|
34 |
it under the terms of the GNU General Public License as published by
|
15 |
* Gravity Forms Field
|
16 |
*
|
17 |
* @package Gravity PDF
|
18 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
19 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
20 |
* @since 4.0
|
21 |
*/
|
28 |
/*
|
29 |
This file is part of Gravity PDF.
|
30 |
|
31 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
32 |
|
33 |
This program is free software; you can redistribute it and/or modify
|
34 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_Default.php
CHANGED
@@ -10,7 +10,7 @@ use GFCommon;
|
|
10 |
* Gravity Forms Field
|
11 |
*
|
12 |
* @package Gravity PDF
|
13 |
-
* @copyright Copyright (c)
|
14 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
15 |
* @since 4.0
|
16 |
*/
|
@@ -23,7 +23,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
23 |
/*
|
24 |
This file is part of Gravity PDF.
|
25 |
|
26 |
-
Gravity PDF – Copyright (C)
|
27 |
|
28 |
This program is free software; you can redistribute it and/or modify
|
29 |
it under the terms of the GNU General Public License as published by
|
10 |
* Gravity Forms Field
|
11 |
*
|
12 |
* @package Gravity PDF
|
13 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
14 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
15 |
* @since 4.0
|
16 |
*/
|
23 |
/*
|
24 |
This file is part of Gravity PDF.
|
25 |
|
26 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
27 |
|
28 |
This program is free software; you can redistribute it and/or modify
|
29 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_Discount.php
CHANGED
@@ -8,7 +8,7 @@ use GFPDF\Helper\Helper_Abstract_Field_Products;
|
|
8 |
* Gravity Forms Subtotal
|
9 |
*
|
10 |
* @package Gravity PDF
|
11 |
-
* @copyright Copyright (c)
|
12 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
* @since 4.3
|
14 |
*/
|
@@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
21 |
/*
|
22 |
This file is part of Gravity PDF.
|
23 |
|
24 |
-
Gravity PDF – Copyright (C)
|
25 |
|
26 |
This program is free software; you can redistribute it and/or modify
|
27 |
it under the terms of the GNU General Public License as published by
|
@@ -76,7 +76,7 @@ class Field_Discount extends Helper_Abstract_Field_Products {
|
|
76 |
return $this->set_form_data( $name, $price );
|
77 |
}
|
78 |
|
79 |
-
return
|
80 |
}
|
81 |
|
82 |
/**
|
8 |
* Gravity Forms Subtotal
|
9 |
*
|
10 |
* @package Gravity PDF
|
11 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
12 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
* @since 4.3
|
14 |
*/
|
21 |
/*
|
22 |
This file is part of Gravity PDF.
|
23 |
|
24 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
25 |
|
26 |
This program is free software; you can redistribute it and/or modify
|
27 |
it under the terms of the GNU General Public License as published by
|
76 |
return $this->set_form_data( $name, $price );
|
77 |
}
|
78 |
|
79 |
+
return $this->set_form_data( '', '' );
|
80 |
}
|
81 |
|
82 |
/**
|
src/helper/fields/Field_Email.php
CHANGED
@@ -14,7 +14,7 @@ use Exception;
|
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
-
Gravity PDF – Copyright (C)
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_Fileupload.php
CHANGED
@@ -14,7 +14,7 @@ use Exception;
|
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
-
Gravity PDF – Copyright (C)
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_Hidden.php
CHANGED
@@ -14,7 +14,7 @@ use Exception;
|
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
-
Gravity PDF – Copyright (C)
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_Html.php
CHANGED
@@ -14,7 +14,7 @@ use Exception;
|
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
-
Gravity PDF – Copyright (C)
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
@@ -120,7 +120,11 @@ class Field_Html extends Helper_Abstract_Fields {
|
|
120 |
return $this->cache();
|
121 |
}
|
122 |
|
123 |
-
$value = ( isset( $this->field->content ) ) ? wpautop(
|
|
|
|
|
|
|
|
|
124 |
|
125 |
$this->cache( $value );
|
126 |
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
120 |
return $this->cache();
|
121 |
}
|
122 |
|
123 |
+
$value = ( isset( $this->field->content ) ) ? wpautop(
|
124 |
+
wp_kses_post(
|
125 |
+
$this->gform->process_tags( $this->field->content, $this->form, $this->entry )
|
126 |
+
)
|
127 |
+
) : '';
|
128 |
|
129 |
$this->cache( $value );
|
130 |
|
src/helper/fields/Field_Likert.php
CHANGED
@@ -10,7 +10,7 @@ use GFCommon;
|
|
10 |
* Gravity Forms Field
|
11 |
*
|
12 |
* @package Gravity PDF
|
13 |
-
* @copyright Copyright (c)
|
14 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
15 |
* @since 4.0
|
16 |
*/
|
@@ -23,7 +23,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
23 |
/*
|
24 |
This file is part of Gravity PDF.
|
25 |
|
26 |
-
Gravity PDF – Copyright (C)
|
27 |
|
28 |
This program is free software; you can redistribute it and/or modify
|
29 |
it under the terms of the GNU General Public License as published by
|
10 |
* Gravity Forms Field
|
11 |
*
|
12 |
* @package Gravity PDF
|
13 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
14 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
15 |
* @since 4.0
|
16 |
*/
|
23 |
/*
|
24 |
This file is part of Gravity PDF.
|
25 |
|
26 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
27 |
|
28 |
This program is free software; you can redistribute it and/or modify
|
29 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_List.php
CHANGED
@@ -14,7 +14,7 @@ use Exception;
|
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
-
Gravity PDF – Copyright (C)
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_Multiselect.php
CHANGED
@@ -15,7 +15,7 @@ use Exception;
|
|
15 |
* Gravity Forms Field
|
16 |
*
|
17 |
* @package Gravity PDF
|
18 |
-
* @copyright Copyright (c)
|
19 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
20 |
* @since 4.0
|
21 |
*/
|
@@ -28,7 +28,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
28 |
/*
|
29 |
This file is part of Gravity PDF.
|
30 |
|
31 |
-
Gravity PDF – Copyright (C)
|
32 |
|
33 |
This program is free software; you can redistribute it and/or modify
|
34 |
it under the terms of the GNU General Public License as published by
|
15 |
* Gravity Forms Field
|
16 |
*
|
17 |
* @package Gravity PDF
|
18 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
19 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
20 |
* @since 4.0
|
21 |
*/
|
28 |
/*
|
29 |
This file is part of Gravity PDF.
|
30 |
|
31 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
32 |
|
33 |
This program is free software; you can redistribute it and/or modify
|
34 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_Name.php
CHANGED
@@ -14,7 +14,7 @@ use Exception;
|
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
-
Gravity PDF – Copyright (C)
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_Number.php
CHANGED
@@ -15,7 +15,7 @@ use Exception;
|
|
15 |
* Gravity Forms Field
|
16 |
*
|
17 |
* @package Gravity PDF
|
18 |
-
* @copyright Copyright (c)
|
19 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
20 |
* @since 4.0
|
21 |
*/
|
@@ -28,7 +28,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
28 |
/*
|
29 |
This file is part of Gravity PDF.
|
30 |
|
31 |
-
Gravity PDF – Copyright (C)
|
32 |
|
33 |
This program is free software; you can redistribute it and/or modify
|
34 |
it under the terms of the GNU General Public License as published by
|
15 |
* Gravity Forms Field
|
16 |
*
|
17 |
* @package Gravity PDF
|
18 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
19 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
20 |
* @since 4.0
|
21 |
*/
|
28 |
/*
|
29 |
This file is part of Gravity PDF.
|
30 |
|
31 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
32 |
|
33 |
This program is free software; you can redistribute it and/or modify
|
34 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_Option.php
CHANGED
@@ -11,7 +11,7 @@ use GFCommon;
|
|
11 |
* Gravity Forms Options field
|
12 |
*
|
13 |
* @package Gravity PDF
|
14 |
-
* @copyright Copyright (c)
|
15 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
16 |
* @since 4.3
|
17 |
*/
|
@@ -24,7 +24,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
24 |
/*
|
25 |
This file is part of Gravity PDF.
|
26 |
|
27 |
-
Gravity PDF – Copyright (C)
|
28 |
|
29 |
This program is free software; you can redistribute it and/or modify
|
30 |
it under the terms of the GNU General Public License as published by
|
11 |
* Gravity Forms Options field
|
12 |
*
|
13 |
* @package Gravity PDF
|
14 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
15 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
16 |
* @since 4.3
|
17 |
*/
|
24 |
/*
|
25 |
This file is part of Gravity PDF.
|
26 |
|
27 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
28 |
|
29 |
This program is free software; you can redistribute it and/or modify
|
30 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_Phone.php
CHANGED
@@ -14,7 +14,7 @@ use Exception;
|
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
-
Gravity PDF – Copyright (C)
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_Poll.php
CHANGED
@@ -12,7 +12,7 @@ use Exception;
|
|
12 |
* Gravity Forms Field
|
13 |
*
|
14 |
* @package Gravity PDF
|
15 |
-
* @copyright Copyright (c)
|
16 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
17 |
* @since 4.0
|
18 |
*/
|
@@ -25,7 +25,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
25 |
/*
|
26 |
This file is part of Gravity PDF.
|
27 |
|
28 |
-
Gravity PDF – Copyright (C)
|
29 |
|
30 |
This program is free software; you can redistribute it and/or modify
|
31 |
it under the terms of the GNU General Public License as published by
|
12 |
* Gravity Forms Field
|
13 |
*
|
14 |
* @package Gravity PDF
|
15 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
16 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
17 |
* @since 4.0
|
18 |
*/
|
25 |
/*
|
26 |
This file is part of Gravity PDF.
|
27 |
|
28 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
29 |
|
30 |
This program is free software; you can redistribute it and/or modify
|
31 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_Post_Category.php
CHANGED
@@ -14,7 +14,7 @@ use Exception;
|
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
-
Gravity PDF – Copyright (C)
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_Post_Content.php
CHANGED
@@ -14,7 +14,7 @@ use Exception;
|
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
-
Gravity PDF – Copyright (C)
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
@@ -105,7 +105,9 @@ class Field_Post_Content extends Helper_Abstract_Fields {
|
|
105 |
$value = $this->get_value();
|
106 |
|
107 |
if ( isset( $this->field->useRichTextEditor ) && true === $this->field->useRichTextEditor ) {
|
108 |
-
$html = wp_kses_post(
|
|
|
|
|
109 |
} else {
|
110 |
$html = nl2br( esc_html( $value ) );
|
111 |
}
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
105 |
$value = $this->get_value();
|
106 |
|
107 |
if ( isset( $this->field->useRichTextEditor ) && true === $this->field->useRichTextEditor ) {
|
108 |
+
$html = wp_kses_post(
|
109 |
+
$this->gform->process_tags( $value, $this->form, $this->entry )
|
110 |
+
);
|
111 |
} else {
|
112 |
$html = nl2br( esc_html( $value ) );
|
113 |
}
|
src/helper/fields/Field_Post_Custom_Field.php
CHANGED
@@ -12,7 +12,7 @@ use Exception;
|
|
12 |
* Gravity Forms Field
|
13 |
*
|
14 |
* @package Gravity PDF
|
15 |
-
* @copyright Copyright (c)
|
16 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
17 |
* @since 4.0
|
18 |
*/
|
@@ -25,7 +25,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
25 |
/*
|
26 |
This file is part of Gravity PDF.
|
27 |
|
28 |
-
Gravity PDF – Copyright (C)
|
29 |
|
30 |
This program is free software; you can redistribute it and/or modify
|
31 |
it under the terms of the GNU General Public License as published by
|
12 |
* Gravity Forms Field
|
13 |
*
|
14 |
* @package Gravity PDF
|
15 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
16 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
17 |
* @since 4.0
|
18 |
*/
|
25 |
/*
|
26 |
This file is part of Gravity PDF.
|
27 |
|
28 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
29 |
|
30 |
This program is free software; you can redistribute it and/or modify
|
31 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_Post_Excerpt.php
CHANGED
@@ -14,7 +14,7 @@ use Exception;
|
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
-
Gravity PDF – Copyright (C)
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_Post_Image.php
CHANGED
@@ -14,7 +14,7 @@ use Exception;
|
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
-
Gravity PDF – Copyright (C)
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_Post_Tags.php
CHANGED
@@ -14,7 +14,7 @@ use Exception;
|
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
-
Gravity PDF – Copyright (C)
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_Post_Title.php
CHANGED
@@ -14,7 +14,7 @@ use Exception;
|
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
-
Gravity PDF – Copyright (C)
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_Product.php
CHANGED
@@ -8,7 +8,7 @@ use GFPDF\Helper\Helper_Abstract_Field_Products;
|
|
8 |
* Gravity Forms Single Product Field
|
9 |
*
|
10 |
* @package Gravity PDF
|
11 |
-
* @copyright Copyright (c)
|
12 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
* @since 4.3
|
14 |
*/
|
@@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
21 |
/*
|
22 |
This file is part of Gravity PDF.
|
23 |
|
24 |
-
Gravity PDF – Copyright (C)
|
25 |
|
26 |
This program is free software; you can redistribute it and/or modify
|
27 |
it under the terms of the GNU General Public License as published by
|
@@ -63,7 +63,7 @@ class Field_Product extends Helper_Abstract_Field_Products {
|
|
63 |
return $this->set_form_data( $name, $price );
|
64 |
}
|
65 |
|
66 |
-
return
|
67 |
}
|
68 |
|
69 |
/**
|
8 |
* Gravity Forms Single Product Field
|
9 |
*
|
10 |
* @package Gravity PDF
|
11 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
12 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
* @since 4.3
|
14 |
*/
|
21 |
/*
|
22 |
This file is part of Gravity PDF.
|
23 |
|
24 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
25 |
|
26 |
This program is free software; you can redistribute it and/or modify
|
27 |
it under the terms of the GNU General Public License as published by
|
63 |
return $this->set_form_data( $name, $price );
|
64 |
}
|
65 |
|
66 |
+
return $this->set_form_data( '', '' );
|
67 |
}
|
68 |
|
69 |
/**
|
src/helper/fields/Field_Products.php
CHANGED
@@ -10,7 +10,7 @@ use GFCommon;
|
|
10 |
* Gravity Forms Field
|
11 |
*
|
12 |
* @package Gravity PDF
|
13 |
-
* @copyright Copyright (c)
|
14 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
15 |
* @since 4.0
|
16 |
*/
|
@@ -23,7 +23,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
23 |
/*
|
24 |
This file is part of Gravity PDF.
|
25 |
|
26 |
-
Gravity PDF – Copyright (C)
|
27 |
|
28 |
This program is free software; you can redistribute it and/or modify
|
29 |
it under the terms of the GNU General Public License as published by
|
@@ -191,8 +191,8 @@ class Field_Products extends Helper_Abstract_Fields {
|
|
191 |
<?php endif; ?>
|
192 |
</td>
|
193 |
<td class="textcenter"><?php echo $product['quantity']; ?></td>
|
194 |
-
<td><?php echo
|
195 |
-
<td><?php echo $product['subtotal_formatted'] ?></td>
|
196 |
</tr>
|
197 |
<?php endforeach; ?>
|
198 |
|
@@ -212,7 +212,7 @@ class Field_Products extends Helper_Abstract_Fields {
|
|
212 |
colspan="2"
|
213 |
rowspan="<?php echo $gpecommerce->get_order_summary_item_count( $order_summary ); ?>"></td>
|
214 |
<?php endif; ?>
|
215 |
-
<td class="
|
216 |
<?php echo $item['name']; ?>
|
217 |
</td>
|
218 |
|
@@ -227,12 +227,12 @@ class Field_Products extends Helper_Abstract_Fields {
|
|
227 |
<tr>
|
228 |
<td rowspan="3" class="emptycell"></td>
|
229 |
<td colspan="2"
|
230 |
-
class="
|
231 |
<td class="subtotal_amount totals"><?php echo $products['products_totals']['subtotal_formatted']; ?></td>
|
232 |
</tr>
|
233 |
<tr>
|
234 |
<td colspan="2"
|
235 |
-
class="
|
236 |
<td class="shipping_amount totals"><?php echo $products['products_totals']['shipping_formatted']; ?></td>
|
237 |
</tr>
|
238 |
<?php endif; ?>
|
@@ -243,7 +243,7 @@ class Field_Products extends Helper_Abstract_Fields {
|
|
243 |
<?php endif; ?>
|
244 |
|
245 |
<td colspan="2"
|
246 |
-
class="
|
247 |
<td class="grandtotal_amount totals"><?php echo $products['products_totals']['total_formatted']; ?></td>
|
248 |
</tr>
|
249 |
|
10 |
* Gravity Forms Field
|
11 |
*
|
12 |
* @package Gravity PDF
|
13 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
14 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
15 |
* @since 4.0
|
16 |
*/
|
23 |
/*
|
24 |
This file is part of Gravity PDF.
|
25 |
|
26 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
27 |
|
28 |
This program is free software; you can redistribute it and/or modify
|
29 |
it under the terms of the GNU General Public License as published by
|
191 |
<?php endif; ?>
|
192 |
</td>
|
193 |
<td class="textcenter"><?php echo $product['quantity']; ?></td>
|
194 |
+
<td class="textright"><?php echo $product['price']; ?></td>
|
195 |
+
<td class="textright"><?php echo $product['subtotal_formatted'] ?></td>
|
196 |
</tr>
|
197 |
<?php endforeach; ?>
|
198 |
|
212 |
colspan="2"
|
213 |
rowspan="<?php echo $gpecommerce->get_order_summary_item_count( $order_summary ); ?>"></td>
|
214 |
<?php endif; ?>
|
215 |
+
<td class="totals" style="<?php $gpecommerce->style( ".order-summary/tfoot/{$class}/td.column-3" ); ?>">
|
216 |
<?php echo $item['name']; ?>
|
217 |
</td>
|
218 |
|
227 |
<tr>
|
228 |
<td rowspan="3" class="emptycell"></td>
|
229 |
<td colspan="2"
|
230 |
+
class="subtotal totals"><?php esc_html_e( 'Subtotal', 'gravity-forms-pdf-extended' ); ?></td>
|
231 |
<td class="subtotal_amount totals"><?php echo $products['products_totals']['subtotal_formatted']; ?></td>
|
232 |
</tr>
|
233 |
<tr>
|
234 |
<td colspan="2"
|
235 |
+
class="shipping totals"><?php echo sprintf( esc_html__( 'Shipping (%s)', 'gravity-forms-pdf-extended' ), $products['products_totals']['shipping_name'] ); ?></td>
|
236 |
<td class="shipping_amount totals"><?php echo $products['products_totals']['shipping_formatted']; ?></td>
|
237 |
</tr>
|
238 |
<?php endif; ?>
|
243 |
<?php endif; ?>
|
244 |
|
245 |
<td colspan="2"
|
246 |
+
class="grandtotal totals"><?php esc_html_e( 'Total', 'gravityforms' ) ?></td>
|
247 |
<td class="grandtotal_amount totals"><?php echo $products['products_totals']['total_formatted']; ?></td>
|
248 |
</tr>
|
249 |
|
src/helper/fields/Field_Quantity.php
CHANGED
@@ -8,7 +8,7 @@ use GFPDF\Helper\Helper_Abstract_Field_Products;
|
|
8 |
* Gravity Forms Quantity Field
|
9 |
*
|
10 |
* @package Gravity PDF
|
11 |
-
* @copyright Copyright (c)
|
12 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
* @since 4.3
|
14 |
*/
|
@@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
21 |
/*
|
22 |
This file is part of Gravity PDF.
|
23 |
|
24 |
-
Gravity PDF – Copyright (C)
|
25 |
|
26 |
This program is free software; you can redistribute it and/or modify
|
27 |
it under the terms of the GNU General Public License as published by
|
@@ -51,15 +51,8 @@ class Field_Quantity extends Helper_Abstract_Field_Products {
|
|
51 |
* @since 4.3
|
52 |
*/
|
53 |
public function form_data() {
|
54 |
-
$value = $this->value();
|
55 |
-
|
56 |
-
$name = ( isset( $value['name'] ) && isset( $value['price'] ) ) ? $value['name'] . " ({$value['price']})" : '';
|
57 |
-
$name = esc_html( $name );
|
58 |
-
|
59 |
-
$price = ( isset( $value['price_unformatted'] ) ) ? $value['price_unformatted'] : '';
|
60 |
-
$price = esc_html( $price );
|
61 |
-
|
62 |
-
return $this->set_form_data( $name, $price );
|
63 |
}
|
64 |
|
65 |
/**
|
8 |
* Gravity Forms Quantity Field
|
9 |
*
|
10 |
* @package Gravity PDF
|
11 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
12 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
* @since 4.3
|
14 |
*/
|
21 |
/*
|
22 |
This file is part of Gravity PDF.
|
23 |
|
24 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
25 |
|
26 |
This program is free software; you can redistribute it and/or modify
|
27 |
it under the terms of the GNU General Public License as published by
|
51 |
* @since 4.3
|
52 |
*/
|
53 |
public function form_data() {
|
54 |
+
$value = esc_html( $this->value() );
|
55 |
+
return $this->set_form_data( $value, $value );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
}
|
57 |
|
58 |
/**
|
src/helper/fields/Field_Quiz.php
CHANGED
@@ -11,7 +11,7 @@ use Exception;
|
|
11 |
* Gravity Forms Field
|
12 |
*
|
13 |
* @package Gravity PDF
|
14 |
-
* @copyright Copyright (c)
|
15 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
16 |
* @since 4.0
|
17 |
*/
|
@@ -24,7 +24,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
24 |
/*
|
25 |
This file is part of Gravity PDF.
|
26 |
|
27 |
-
Gravity PDF – Copyright (C)
|
28 |
|
29 |
This program is free software; you can redistribute it and/or modify
|
30 |
it under the terms of the GNU General Public License as published by
|
11 |
* Gravity Forms Field
|
12 |
*
|
13 |
* @package Gravity PDF
|
14 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
15 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
16 |
* @since 4.0
|
17 |
*/
|
24 |
/*
|
25 |
This file is part of Gravity PDF.
|
26 |
|
27 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
28 |
|
29 |
This program is free software; you can redistribute it and/or modify
|
30 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_Radio.php
CHANGED
@@ -15,7 +15,7 @@ use Exception;
|
|
15 |
* Gravity Forms Field
|
16 |
*
|
17 |
* @package Gravity PDF
|
18 |
-
* @copyright Copyright (c)
|
19 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
20 |
* @since 4.0
|
21 |
*/
|
@@ -28,7 +28,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
28 |
/*
|
29 |
This file is part of Gravity PDF.
|
30 |
|
31 |
-
Gravity PDF – Copyright (C)
|
32 |
|
33 |
This program is free software; you can redistribute it and/or modify
|
34 |
it under the terms of the GNU General Public License as published by
|
@@ -163,11 +163,10 @@ class Field_Radio extends Helper_Abstract_Fields {
|
|
163 |
|
164 |
/* Allow HTML if the radio value isn't the "other" option */
|
165 |
if ( ! $this->is_user_defined_value( $value ) ) {
|
166 |
-
$value = wp_kses_post( wp_specialchars_decode( $value, ENT_QUOTES ) );
|
167 |
-
$label = wp_kses_post( wp_specialchars_decode( $label, ENT_QUOTES ) );
|
168 |
}
|
169 |
|
170 |
-
|
171 |
/* return value / label as an array */
|
172 |
$this->cache( [
|
173 |
'value' => $value,
|
15 |
* Gravity Forms Field
|
16 |
*
|
17 |
* @package Gravity PDF
|
18 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
19 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
20 |
* @since 4.0
|
21 |
*/
|
28 |
/*
|
29 |
This file is part of Gravity PDF.
|
30 |
|
31 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
32 |
|
33 |
This program is free software; you can redistribute it and/or modify
|
34 |
it under the terms of the GNU General Public License as published by
|
163 |
|
164 |
/* Allow HTML if the radio value isn't the "other" option */
|
165 |
if ( ! $this->is_user_defined_value( $value ) ) {
|
166 |
+
$value = wp_kses_post( $this->gform->process_tags( wp_specialchars_decode( $value, ENT_QUOTES ), $this->form, $this->entry ) );
|
167 |
+
$label = wp_kses_post( $this->gform->process_tags( wp_specialchars_decode( $label, ENT_QUOTES ), $this->form, $this->entry ) );
|
168 |
}
|
169 |
|
|
|
170 |
/* return value / label as an array */
|
171 |
$this->cache( [
|
172 |
'value' => $value,
|
src/helper/fields/Field_Rank.php
CHANGED
@@ -10,7 +10,7 @@ use GFCommon;
|
|
10 |
* Gravity Forms Field
|
11 |
*
|
12 |
* @package Gravity PDF
|
13 |
-
* @copyright Copyright (c)
|
14 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
15 |
* @since 4.0
|
16 |
*/
|
@@ -23,7 +23,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
23 |
/*
|
24 |
This file is part of Gravity PDF.
|
25 |
|
26 |
-
Gravity PDF – Copyright (C)
|
27 |
|
28 |
This program is free software; you can redistribute it and/or modify
|
29 |
it under the terms of the GNU General Public License as published by
|
10 |
* Gravity Forms Field
|
11 |
*
|
12 |
* @package Gravity PDF
|
13 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
14 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
15 |
* @since 4.0
|
16 |
*/
|
23 |
/*
|
24 |
This file is part of Gravity PDF.
|
25 |
|
26 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
27 |
|
28 |
This program is free software; you can redistribute it and/or modify
|
29 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_Rating.php
CHANGED
@@ -10,7 +10,7 @@ use GFCommon;
|
|
10 |
* Gravity Forms Field
|
11 |
*
|
12 |
* @package Gravity PDF
|
13 |
-
* @copyright Copyright (c)
|
14 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
15 |
* @since 4.0
|
16 |
*/
|
@@ -23,7 +23,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
23 |
/*
|
24 |
This file is part of Gravity PDF.
|
25 |
|
26 |
-
Gravity PDF – Copyright (C)
|
27 |
|
28 |
This program is free software; you can redistribute it and/or modify
|
29 |
it under the terms of the GNU General Public License as published by
|
10 |
* Gravity Forms Field
|
11 |
*
|
12 |
* @package Gravity PDF
|
13 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
14 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
15 |
* @since 4.0
|
16 |
*/
|
23 |
/*
|
24 |
This file is part of Gravity PDF.
|
25 |
|
26 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
27 |
|
28 |
This program is free software; you can redistribute it and/or modify
|
29 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_Section.php
CHANGED
@@ -18,7 +18,7 @@ use Exception;
|
|
18 |
* Gravity Forms Field
|
19 |
*
|
20 |
* @package Gravity PDF
|
21 |
-
* @copyright Copyright (c)
|
22 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
23 |
* @since 4.0
|
24 |
*/
|
@@ -31,7 +31,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
31 |
/*
|
32 |
This file is part of Gravity PDF.
|
33 |
|
34 |
-
Gravity PDF – Copyright (C)
|
35 |
|
36 |
This program is free software; you can redistribute it and/or modify
|
37 |
it under the terms of the GNU General Public License as published by
|
@@ -184,7 +184,9 @@ class Field_Section extends Helper_Abstract_Fields {
|
|
184 |
|
185 |
$this->cache( [
|
186 |
'title' => esc_html( $this->field->label ),
|
187 |
-
'description' => wp_kses_post(
|
|
|
|
|
188 |
] );
|
189 |
|
190 |
return $this->cache();
|
18 |
* Gravity Forms Field
|
19 |
*
|
20 |
* @package Gravity PDF
|
21 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
22 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
23 |
* @since 4.0
|
24 |
*/
|
31 |
/*
|
32 |
This file is part of Gravity PDF.
|
33 |
|
34 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
35 |
|
36 |
This program is free software; you can redistribute it and/or modify
|
37 |
it under the terms of the GNU General Public License as published by
|
184 |
|
185 |
$this->cache( [
|
186 |
'title' => esc_html( $this->field->label ),
|
187 |
+
'description' => wp_kses_post(
|
188 |
+
$this->gform->process_tags( $this->field->description, $this->form, $this->entry )
|
189 |
+
),
|
190 |
] );
|
191 |
|
192 |
return $this->cache();
|
src/helper/fields/Field_Select.php
CHANGED
@@ -15,7 +15,7 @@ use Exception;
|
|
15 |
* Gravity Forms Field
|
16 |
*
|
17 |
* @package Gravity PDF
|
18 |
-
* @copyright Copyright (c)
|
19 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
20 |
* @since 4.0
|
21 |
*/
|
@@ -28,7 +28,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
28 |
/*
|
29 |
This file is part of Gravity PDF.
|
30 |
|
31 |
-
Gravity PDF – Copyright (C)
|
32 |
|
33 |
This program is free software; you can redistribute it and/or modify
|
34 |
it under the terms of the GNU General Public License as published by
|
15 |
* Gravity Forms Field
|
16 |
*
|
17 |
* @package Gravity PDF
|
18 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
19 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
20 |
* @since 4.0
|
21 |
*/
|
28 |
/*
|
29 |
This file is part of Gravity PDF.
|
30 |
|
31 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
32 |
|
33 |
This program is free software; you can redistribute it and/or modify
|
34 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_Shipping.php
CHANGED
@@ -8,7 +8,7 @@ use GFPDF\Helper\Helper_Abstract_Field_Products;
|
|
8 |
* Gravity Forms Shipping Field
|
9 |
*
|
10 |
* @package Gravity PDF
|
11 |
-
* @copyright Copyright (c)
|
12 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
* @since 4.3
|
14 |
*/
|
@@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
21 |
/*
|
22 |
This file is part of Gravity PDF.
|
23 |
|
24 |
-
Gravity PDF – Copyright (C)
|
25 |
|
26 |
This program is free software; you can redistribute it and/or modify
|
27 |
it under the terms of the GNU General Public License as published by
|
@@ -63,7 +63,7 @@ class Field_Shipping extends Helper_Abstract_Field_Products {
|
|
63 |
return $this->set_form_data( $name, $price );
|
64 |
}
|
65 |
|
66 |
-
return
|
67 |
}
|
68 |
|
69 |
/**
|
8 |
* Gravity Forms Shipping Field
|
9 |
*
|
10 |
* @package Gravity PDF
|
11 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
12 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
* @since 4.3
|
14 |
*/
|
21 |
/*
|
22 |
This file is part of Gravity PDF.
|
23 |
|
24 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
25 |
|
26 |
This program is free software; you can redistribute it and/or modify
|
27 |
it under the terms of the GNU General Public License as published by
|
63 |
return $this->set_form_data( $name, $price );
|
64 |
}
|
65 |
|
66 |
+
return $this->set_form_data( '', '' );
|
67 |
}
|
68 |
|
69 |
/**
|
src/helper/fields/Field_Signature.php
CHANGED
@@ -10,7 +10,7 @@ use GFFormsModel;
|
|
10 |
* Gravity Forms Field
|
11 |
*
|
12 |
* @package Gravity PDF
|
13 |
-
* @copyright Copyright (c)
|
14 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
15 |
* @since 4.0
|
16 |
*/
|
@@ -23,7 +23,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
23 |
/*
|
24 |
This file is part of Gravity PDF.
|
25 |
|
26 |
-
Gravity PDF – Copyright (C)
|
27 |
|
28 |
This program is free software; you can redistribute it and/or modify
|
29 |
it under the terms of the GNU General Public License as published by
|
10 |
* Gravity Forms Field
|
11 |
*
|
12 |
* @package Gravity PDF
|
13 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
14 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
15 |
* @since 4.0
|
16 |
*/
|
23 |
/*
|
24 |
This file is part of Gravity PDF.
|
25 |
|
26 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
27 |
|
28 |
This program is free software; you can redistribute it and/or modify
|
29 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_Subtotal.php
CHANGED
@@ -10,7 +10,7 @@ use GFCommon;
|
|
10 |
* Gravity Forms Subtotal
|
11 |
*
|
12 |
* @package Gravity PDF
|
13 |
-
* @copyright Copyright (c)
|
14 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
15 |
* @since 4.3
|
16 |
*/
|
@@ -23,7 +23,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
23 |
/*
|
24 |
This file is part of Gravity PDF.
|
25 |
|
26 |
-
Gravity PDF – Copyright (C)
|
27 |
|
28 |
This program is free software; you can redistribute it and/or modify
|
29 |
it under the terms of the GNU General Public License as published by
|
@@ -75,7 +75,7 @@ class Field_Subtotal extends Helper_Abstract_Field_Products {
|
|
75 |
return $this->set_form_data( $name, $price );
|
76 |
}
|
77 |
|
78 |
-
return
|
79 |
}
|
80 |
|
81 |
/**
|
@@ -111,17 +111,12 @@ class Field_Subtotal extends Helper_Abstract_Field_Products {
|
|
111 |
return $this->cache();
|
112 |
}
|
113 |
|
114 |
-
|
115 |
-
$use_value = (bool) apply_filters( 'gfpdf_show_field_value', false ); /* Set to `true` to show a field's value instead of the label */
|
116 |
-
$subtotal = $this->field->get_subtotal( GFCommon::get_product_fields( $this->form, $this->entry, ! $use_value ) );
|
117 |
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
} else {
|
123 |
-
$this->cache( [] );
|
124 |
-
}
|
125 |
|
126 |
return $this->cache();
|
127 |
}
|
10 |
* Gravity Forms Subtotal
|
11 |
*
|
12 |
* @package Gravity PDF
|
13 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
14 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
15 |
* @since 4.3
|
16 |
*/
|
23 |
/*
|
24 |
This file is part of Gravity PDF.
|
25 |
|
26 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
27 |
|
28 |
This program is free software; you can redistribute it and/or modify
|
29 |
it under the terms of the GNU General Public License as published by
|
75 |
return $this->set_form_data( $name, $price );
|
76 |
}
|
77 |
|
78 |
+
return $this->set_form_data( '', '' );
|
79 |
}
|
80 |
|
81 |
/**
|
111 |
return $this->cache();
|
112 |
}
|
113 |
|
114 |
+
$subtotal = $this->get_value();
|
|
|
|
|
115 |
|
116 |
+
$this->cache( [
|
117 |
+
'total' => esc_html( $subtotal ),
|
118 |
+
'total_formatted' => esc_html( GFCommon::to_money( $subtotal ), $this->entry['currency'] ),
|
119 |
+
] );
|
|
|
|
|
|
|
120 |
|
121 |
return $this->cache();
|
122 |
}
|
src/helper/fields/Field_Survey.php
CHANGED
@@ -12,7 +12,7 @@ use Exception;
|
|
12 |
* Gravity Forms Field
|
13 |
*
|
14 |
* @package Gravity PDF
|
15 |
-
* @copyright Copyright (c)
|
16 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
17 |
* @since 4.0
|
18 |
*/
|
@@ -25,7 +25,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
25 |
/*
|
26 |
This file is part of Gravity PDF.
|
27 |
|
28 |
-
Gravity PDF – Copyright (C)
|
29 |
|
30 |
This program is free software; you can redistribute it and/or modify
|
31 |
it under the terms of the GNU General Public License as published by
|
12 |
* Gravity Forms Field
|
13 |
*
|
14 |
* @package Gravity PDF
|
15 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
16 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
17 |
* @since 4.0
|
18 |
*/
|
25 |
/*
|
26 |
This file is part of Gravity PDF.
|
27 |
|
28 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
29 |
|
30 |
This program is free software; you can redistribute it and/or modify
|
31 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_Tax.php
CHANGED
@@ -8,7 +8,7 @@ use GFPDF\Helper\Helper_Abstract_Field_Products;
|
|
8 |
* Gravity Forms Subtotal
|
9 |
*
|
10 |
* @package Gravity PDF
|
11 |
-
* @copyright Copyright (c)
|
12 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
* @since 4.3
|
14 |
*/
|
@@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
21 |
/*
|
22 |
This file is part of Gravity PDF.
|
23 |
|
24 |
-
Gravity PDF – Copyright (C)
|
25 |
|
26 |
This program is free software; you can redistribute it and/or modify
|
27 |
it under the terms of the GNU General Public License as published by
|
@@ -76,7 +76,7 @@ class Field_Tax extends Helper_Abstract_Field_Products {
|
|
76 |
return $this->set_form_data( $name, $price );
|
77 |
}
|
78 |
|
79 |
-
return
|
80 |
}
|
81 |
|
82 |
/**
|
8 |
* Gravity Forms Subtotal
|
9 |
*
|
10 |
* @package Gravity PDF
|
11 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
12 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
* @since 4.3
|
14 |
*/
|
21 |
/*
|
22 |
This file is part of Gravity PDF.
|
23 |
|
24 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
25 |
|
26 |
This program is free software; you can redistribute it and/or modify
|
27 |
it under the terms of the GNU General Public License as published by
|
76 |
return $this->set_form_data( $name, $price );
|
77 |
}
|
78 |
|
79 |
+
return $this->set_form_data( '', '' );
|
80 |
}
|
81 |
|
82 |
/**
|
src/helper/fields/Field_Text.php
CHANGED
@@ -14,7 +14,7 @@ use Exception;
|
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
-
Gravity PDF – Copyright (C)
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_Textarea.php
CHANGED
@@ -14,7 +14,7 @@ use Exception;
|
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
-
Gravity PDF – Copyright (C)
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
@@ -95,7 +95,11 @@ class Field_Textarea extends Helper_Abstract_Fields {
|
|
95 |
$value = $this->get_value();
|
96 |
|
97 |
if ( isset( $this->field->useRichTextEditor ) && true === $this->field->useRichTextEditor ) {
|
98 |
-
$html = wp_kses_post(
|
|
|
|
|
|
|
|
|
99 |
} else {
|
100 |
$html = nl2br( esc_html( $value ) );
|
101 |
}
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
95 |
$value = $this->get_value();
|
96 |
|
97 |
if ( isset( $this->field->useRichTextEditor ) && true === $this->field->useRichTextEditor ) {
|
98 |
+
$html = wp_kses_post(
|
99 |
+
wpautop(
|
100 |
+
$this->gform->process_tags( $value, $this->form, $this->entry )
|
101 |
+
)
|
102 |
+
);
|
103 |
} else {
|
104 |
$html = nl2br( esc_html( $value ) );
|
105 |
}
|
src/helper/fields/Field_Time.php
CHANGED
@@ -14,7 +14,7 @@ use Exception;
|
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
-
Gravity PDF – Copyright (C)
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_Tos.php
CHANGED
@@ -14,7 +14,7 @@ use Exception;
|
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
-
* @copyright Copyright (c)
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
-
Gravity PDF – Copyright (C)
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
@@ -108,7 +108,11 @@ class Field_Tos extends Helper_Abstract_Fields {
|
|
108 |
*/
|
109 |
public function html( $value = '', $label = true ) {
|
110 |
|
111 |
-
$terms = wp_kses_post(
|
|
|
|
|
|
|
|
|
112 |
$value = $this->value();
|
113 |
|
114 |
$html = "
|
14 |
* Gravity Forms Field
|
15 |
*
|
16 |
* @package Gravity PDF
|
17 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
18 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
* @since 4.0
|
20 |
*/
|
27 |
/*
|
28 |
This file is part of Gravity PDF.
|
29 |
|
30 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
31 |
|
32 |
This program is free software; you can redistribute it and/or modify
|
33 |
it under the terms of the GNU General Public License as published by
|
108 |
*/
|
109 |
public function html( $value = '', $label = true ) {
|
110 |
|
111 |
+
$terms = wp_kses_post(
|
112 |
+
wpautop(
|
113 |
+
$this->gform->process_tags( $this->field->gwtermsofservice_terms , $this->form, $this->entry )
|
114 |
+
)
|
115 |
+
);
|
116 |
$value = $this->value();
|
117 |
|
118 |
$html = "
|
src/helper/fields/Field_Total.php
CHANGED
@@ -8,7 +8,7 @@ use GFPDF\Helper\Helper_Abstract_Field_Products;
|
|
8 |
* Gravity Forms Total Field
|
9 |
*
|
10 |
* @package Gravity PDF
|
11 |
-
* @copyright Copyright (c)
|
12 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
* @since 4.3
|
14 |
*/
|
@@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
21 |
/*
|
22 |
This file is part of Gravity PDF.
|
23 |
|
24 |
-
Gravity PDF – Copyright (C)
|
25 |
|
26 |
This program is free software; you can redistribute it and/or modify
|
27 |
it under the terms of the GNU General Public License as published by
|
@@ -60,7 +60,7 @@ class Field_Total extends Helper_Abstract_Field_Products {
|
|
60 |
return $this->set_form_data( $name, $price );
|
61 |
}
|
62 |
|
63 |
-
return
|
64 |
}
|
65 |
|
66 |
/**
|
8 |
* Gravity Forms Total Field
|
9 |
*
|
10 |
* @package Gravity PDF
|
11 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
12 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
* @since 4.3
|
14 |
*/
|
21 |
/*
|
22 |
This file is part of Gravity PDF.
|
23 |
|
24 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
25 |
|
26 |
This program is free software; you can redistribute it and/or modify
|
27 |
it under the terms of the GNU General Public License as published by
|
60 |
return $this->set_form_data( $name, $price );
|
61 |
}
|
62 |
|
63 |
+
return $this->set_form_data( '', '' );
|
64 |
}
|
65 |
|
66 |
/**
|
src/helper/fields/Field_Website.php
CHANGED
@@ -15,7 +15,7 @@ use Exception;
|
|
15 |
* Gravity Forms Field
|
16 |
*
|
17 |
* @package Gravity PDF
|
18 |
-
* @copyright Copyright (c)
|
19 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
20 |
* @since 4.0
|
21 |
*/
|
@@ -28,7 +28,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
28 |
/*
|
29 |
This file is part of Gravity PDF.
|
30 |
|
31 |
-
Gravity PDF – Copyright (C)
|
32 |
|
33 |
This program is free software; you can redistribute it and/or modify
|
34 |
it under the terms of the GNU General Public License as published by
|
15 |
* Gravity Forms Field
|
16 |
*
|
17 |
* @package Gravity PDF
|
18 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
19 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
20 |
* @since 4.0
|
21 |
*/
|
28 |
/*
|
29 |
This file is part of Gravity PDF.
|
30 |
|
31 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
32 |
|
33 |
This program is free software; you can redistribute it and/or modify
|
34 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_v3_List.php
CHANGED
@@ -8,7 +8,7 @@ use GFPDF\Helper\Helper_Abstract_Fields;
|
|
8 |
* Gravity Forms Field
|
9 |
*
|
10 |
* @package Gravity PDF
|
11 |
-
* @copyright Copyright (c)
|
12 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
* @since 4.0
|
14 |
*/
|
@@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
21 |
/*
|
22 |
This file is part of Gravity PDF.
|
23 |
|
24 |
-
Gravity PDF – Copyright (C)
|
25 |
|
26 |
This program is free software; you can redistribute it and/or modify
|
27 |
it under the terms of the GNU General Public License as published by
|
8 |
* Gravity Forms Field
|
9 |
*
|
10 |
* @package Gravity PDF
|
11 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
12 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
* @since 4.0
|
14 |
*/
|
21 |
/*
|
22 |
This file is part of Gravity PDF.
|
23 |
|
24 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
25 |
|
26 |
This program is free software; you can redistribute it and/or modify
|
27 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_v3_Products.php
CHANGED
@@ -8,7 +8,7 @@ use GFPDF\Helper\Helper_QueryPath;
|
|
8 |
* Gravity Forms Field
|
9 |
*
|
10 |
* @package Gravity PDF
|
11 |
-
* @copyright Copyright (c)
|
12 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
* @since 4.0
|
14 |
*/
|
@@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
21 |
/*
|
22 |
This file is part of Gravity PDF.
|
23 |
|
24 |
-
Gravity PDF – Copyright (C)
|
25 |
|
26 |
This program is free software; you can redistribute it and/or modify
|
27 |
it under the terms of the GNU General Public License as published by
|
8 |
* Gravity Forms Field
|
9 |
*
|
10 |
* @package Gravity PDF
|
11 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
12 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
* @since 4.0
|
14 |
*/
|
21 |
/*
|
22 |
This file is part of Gravity PDF.
|
23 |
|
24 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
25 |
|
26 |
This program is free software; you can redistribute it and/or modify
|
27 |
it under the terms of the GNU General Public License as published by
|
src/helper/fields/Field_v3_Section.php
CHANGED
@@ -6,7 +6,7 @@ namespace GFPDF\Helper\Fields;
|
|
6 |
* Gravity Forms Field
|
7 |
*
|
8 |
* @package Gravity PDF
|
9 |
-
* @copyright Copyright (c)
|
10 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
* @since 4.0
|
12 |
*/
|
@@ -19,7 +19,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
19 |
/*
|
20 |
This file is part of Gravity PDF.
|
21 |
|
22 |
-
Gravity PDF – Copyright (C)
|
23 |
|
24 |
This program is free software; you can redistribute it and/or modify
|
25 |
it under the terms of the GNU General Public License as published by
|
6 |
* Gravity Forms Field
|
7 |
*
|
8 |
* @package Gravity PDF
|
9 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
10 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
* @since 4.0
|
12 |
*/
|
19 |
/*
|
20 |
This file is part of Gravity PDF.
|
21 |
|
22 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
23 |
|
24 |
This program is free software; you can redistribute it and/or modify
|
25 |
it under the terms of the GNU General Public License as published by
|
src/helper/interface/Helper_Interface_Actions.php
CHANGED
@@ -6,7 +6,7 @@ namespace GFPDF\Helper;
|
|
6 |
* Actions Interface
|
7 |
*
|
8 |
* @package Gravity PDF
|
9 |
-
* @copyright Copyright (c)
|
10 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
* @since 4.0
|
12 |
*/
|
@@ -19,7 +19,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
19 |
/*
|
20 |
This file is part of Gravity PDF.
|
21 |
|
22 |
-
Gravity PDF – Copyright (C)
|
23 |
|
24 |
This program is free software; you can redistribute it and/or modify
|
25 |
it under the terms of the GNU General Public License as published by
|
6 |
* Actions Interface
|
7 |
*
|
8 |
* @package Gravity PDF
|
9 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
10 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
* @since 4.0
|
12 |
*/
|
19 |
/*
|
20 |
This file is part of Gravity PDF.
|
21 |
|
22 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
23 |
|
24 |
This program is free software; you can redistribute it and/or modify
|
25 |
it under the terms of the GNU General Public License as published by
|
src/helper/interface/Helper_Interface_Config.php
CHANGED
@@ -6,7 +6,7 @@ namespace GFPDF\Helper;
|
|
6 |
* Actions Interface
|
7 |
*
|
8 |
* @package Gravity PDF
|
9 |
-
* @copyright Copyright (c)
|
10 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
* @since 4.0
|
12 |
*/
|
@@ -19,7 +19,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
19 |
/*
|
20 |
This file is part of Gravity PDF.
|
21 |
|
22 |
-
Gravity PDF – Copyright (C)
|
23 |
|
24 |
This program is free software; you can redistribute it and/or modify
|
25 |
it under the terms of the GNU General Public License as published by
|
6 |
* Actions Interface
|
7 |
*
|
8 |
* @package Gravity PDF
|
9 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
10 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
* @since 4.0
|
12 |
*/
|
19 |
/*
|
20 |
This file is part of Gravity PDF.
|
21 |
|
22 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
23 |
|
24 |
This program is free software; you can redistribute it and/or modify
|
25 |
it under the terms of the GNU General Public License as published by
|
src/helper/interface/Helper_Interface_Extension_Settings.php
CHANGED
@@ -4,7 +4,7 @@ namespace GFPDF\Helper;
|
|
4 |
|
5 |
/**
|
6 |
* @package Gravity PDF
|
7 |
-
* @copyright Copyright (c)
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.2
|
10 |
*/
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
-
Gravity PDF – Copyright (C)
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
4 |
|
5 |
/**
|
6 |
* @package Gravity PDF
|
7 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.2
|
10 |
*/
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
src/helper/interface/Helper_Interface_Filters.php
CHANGED
@@ -6,7 +6,7 @@ namespace GFPDF\Helper;
|
|
6 |
* Actions Interface
|
7 |
*
|
8 |
* @package Gravity PDF
|
9 |
-
* @copyright Copyright (c)
|
10 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
* @since 4.0
|
12 |
*/
|
@@ -19,7 +19,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
19 |
/*
|
20 |
This file is part of Gravity PDF.
|
21 |
|
22 |
-
Gravity PDF – Copyright (C)
|
23 |
|
24 |
This program is free software; you can redistribute it and/or modify
|
25 |
it under the terms of the GNU General Public License as published by
|
6 |
* Actions Interface
|
7 |
*
|
8 |
* @package Gravity PDF
|
9 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
10 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
* @since 4.0
|
12 |
*/
|
19 |
/*
|
20 |
This file is part of Gravity PDF.
|
21 |
|
22 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
23 |
|
24 |
This program is free software; you can redistribute it and/or modify
|
25 |
it under the terms of the GNU General Public License as published by
|
src/helper/interface/Helper_Interface_Setup_TearDown.php
CHANGED
@@ -6,7 +6,7 @@ namespace GFPDF\Helper;
|
|
6 |
* The PDF template Setup / Tear Down interface
|
7 |
*
|
8 |
* @package Gravity PDF
|
9 |
-
* @copyright Copyright (c)
|
10 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
* @since 4.1
|
12 |
*/
|
@@ -19,7 +19,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
19 |
/*
|
20 |
This file is part of Gravity PDF.
|
21 |
|
22 |
-
Gravity PDF – Copyright (C)
|
23 |
|
24 |
This program is free software; you can redistribute it and/or modify
|
25 |
it under the terms of the GNU General Public License as published by
|
6 |
* The PDF template Setup / Tear Down interface
|
7 |
*
|
8 |
* @package Gravity PDF
|
9 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
10 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
11 |
* @since 4.1
|
12 |
*/
|
19 |
/*
|
20 |
This file is part of Gravity PDF.
|
21 |
|
22 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
23 |
|
24 |
This program is free software; you can redistribute it and/or modify
|
25 |
it under the terms of the GNU General Public License as published by
|
src/helper/licensing/EDD_SL_Plugin_Updater.php
CHANGED
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
-
Gravity PDF – Copyright (C)
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
src/helper/trait/Helper_Trait_Logger.php
CHANGED
@@ -8,7 +8,7 @@ use Monolog\Logger;
|
|
8 |
* Add logger support to class
|
9 |
*
|
10 |
* @package Gravity PDF
|
11 |
-
* @copyright Copyright (c)
|
12 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
* @since 4.3
|
14 |
*/
|
@@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
21 |
/*
|
22 |
This file is part of Gravity PDF.
|
23 |
|
24 |
-
Gravity PDF – Copyright (C)
|
25 |
|
26 |
This program is free software; you can redistribute it and/or modify
|
27 |
it under the terms of the GNU General Public License as published by
|
8 |
* Add logger support to class
|
9 |
*
|
10 |
* @package Gravity PDF
|
11 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
12 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
* @since 4.3
|
14 |
*/
|
21 |
/*
|
22 |
This file is part of Gravity PDF.
|
23 |
|
24 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
25 |
|
26 |
This program is free software; you can redistribute it and/or modify
|
27 |
it under the terms of the GNU General Public License as published by
|
src/model/Model_Actions.php
CHANGED
@@ -15,7 +15,7 @@ use GFForms;
|
|
15 |
* Action Model
|
16 |
*
|
17 |
* @package Gravity PDF
|
18 |
-
* @copyright Copyright (c)
|
19 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
20 |
* @since 4.0
|
21 |
*/
|
@@ -28,7 +28,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
28 |
/*
|
29 |
This file is part of Gravity PDF.
|
30 |
|
31 |
-
Gravity PDF – Copyright (C)
|
32 |
|
33 |
This program is free software; you can redistribute it and/or modify
|
34 |
it under the terms of the GNU General Public License as published by
|
15 |
* Action Model
|
16 |
*
|
17 |
* @package Gravity PDF
|
18 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
19 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
20 |
* @since 4.0
|
21 |
*/
|
28 |
/*
|
29 |
This file is part of Gravity PDF.
|
30 |
|
31 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
32 |
|
33 |
This program is free software; you can redistribute it and/or modify
|
34 |
it under the terms of the GNU General Public License as published by
|
src/model/Model_Form_Settings.php
CHANGED
@@ -15,12 +15,13 @@ use GFPDF\Helper\Helper_Abstract_Options;
|
|
15 |
use Psr\Log\LoggerInterface;
|
16 |
|
17 |
use _WP_Editors;
|
|
|
18 |
|
19 |
/**
|
20 |
* Settings Model
|
21 |
*
|
22 |
* @package Gravity PDF
|
23 |
-
* @copyright Copyright (c)
|
24 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
25 |
* @since 4.0
|
26 |
*/
|
@@ -33,7 +34,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
33 |
/*
|
34 |
This file is part of Gravity PDF.
|
35 |
|
36 |
-
Gravity PDF – Copyright (C)
|
37 |
|
38 |
This program is free software; you can redistribute it and/or modify
|
39 |
it under the terms of the GNU General Public License as published by
|
@@ -229,6 +230,7 @@ class Model_Form_Settings extends Helper_Abstract_Model {
|
|
229 |
|
230 |
/* get the form object */
|
231 |
$form = $this->gform->get_form( $form_id );
|
|
|
232 |
|
233 |
/* parse input and get required information */
|
234 |
if ( ! $pdf_id ) {
|
@@ -239,6 +241,9 @@ class Model_Form_Settings extends Helper_Abstract_Model {
|
|
239 |
}
|
240 |
}
|
241 |
|
|
|
|
|
|
|
242 |
/* re-register all our settings to show form-specific options */
|
243 |
$this->options->register_settings( $this->options->get_registered_fields() );
|
244 |
|
@@ -257,6 +262,7 @@ class Model_Form_Settings extends Helper_Abstract_Model {
|
|
257 |
'title' => $label,
|
258 |
'button_label' => $label,
|
259 |
'form' => $form,
|
|
|
260 |
'pdf' => $pdf,
|
261 |
'wp_editor_loaded' => class_exists( '_WP_Editors' ),
|
262 |
] );
|
@@ -276,7 +282,6 @@ class Model_Form_Settings extends Helper_Abstract_Model {
|
|
276 |
|
277 |
/* prevent unauthorized access */
|
278 |
if ( ! $this->gform->has_capability( 'gravityforms_edit_settings' ) ) {
|
279 |
-
|
280 |
$this->log->addCritical( 'Lack of User Capabilities.', [
|
281 |
'user' => wp_get_current_user(),
|
282 |
'user_meta' => get_user_meta( get_current_user_id() ),
|
@@ -328,8 +333,6 @@ class Model_Form_Settings extends Helper_Abstract_Model {
|
|
328 |
if ( empty( $sanitized['name'] ) || empty( $sanitized['filename'] ) ||
|
329 |
( $sanitized['pdf_size'] == 'CUSTOM' && ( (int) $sanitized['custom_pdf_size'][0] === 0 || (int) $sanitized['custom_pdf_size'][1] === 0 ) )
|
330 |
) {
|
331 |
-
|
332 |
-
$this->log->addNotice( 'Validation failed.' );
|
333 |
$this->notices->add_error( esc_html__( 'PDF could not be saved. Please enter all required information below.', 'gravity-forms-pdf-extended' ) );
|
334 |
|
335 |
return false;
|
@@ -343,8 +346,7 @@ class Model_Form_Settings extends Helper_Abstract_Model {
|
|
343 |
|
344 |
/* If it updated, let's update the global variable */
|
345 |
if ( $did_update !== false ) {
|
346 |
-
|
347 |
-
$this->log->addNotice( 'Successfully Saved.', [
|
348 |
'form_id' => $form_id,
|
349 |
'pdf_id' => $pdf_id,
|
350 |
'settings' => $sanitized,
|
@@ -355,7 +357,7 @@ class Model_Form_Settings extends Helper_Abstract_Model {
|
|
355 |
return true;
|
356 |
}
|
357 |
|
358 |
-
$this->log->addError( '
|
359 |
$this->notices->add_error( esc_html__( 'There was a problem saving your PDF settings. Please try again.', 'gravity-forms-pdf-extended' ) );
|
360 |
|
361 |
return false;
|
@@ -384,7 +386,6 @@ class Model_Form_Settings extends Helper_Abstract_Model {
|
|
384 |
|
385 |
/* Check we have a valid nonce, or throw an error */
|
386 |
if ( ! wp_verify_nonce( rgpost( 'gfpdf_save_pdf' ), 'gfpdf_save_pdf' ) ) {
|
387 |
-
|
388 |
$this->log->addWarning( 'Nonce Verification Failed.' );
|
389 |
$this->notices->add_error( esc_html__( 'There was a problem saving your PDF settings. Please try again.', 'gravity-forms-pdf-extended' ) );
|
390 |
|
@@ -626,10 +627,6 @@ class Model_Form_Settings extends Helper_Abstract_Model {
|
|
626 |
|
627 |
$settings = $this->setup_core_custom_appearance_settings( $settings, $class, $template_settings );
|
628 |
|
629 |
-
$this->log->addNotice( 'Setup Template-Specific Settings', [
|
630 |
-
'settings' => $settings,
|
631 |
-
] );
|
632 |
-
|
633 |
return $settings;
|
634 |
}
|
635 |
|
@@ -767,7 +764,7 @@ class Model_Form_Settings extends Helper_Abstract_Model {
|
|
767 |
|
768 |
if ( $results && ! is_wp_error( $results ) ) {
|
769 |
|
770 |
-
$this->log->addNotice( 'AJAX
|
771 |
|
772 |
$return = [
|
773 |
'msg' => esc_html__( 'PDF successfully deleted.', 'gravity-forms-pdf-extended' ),
|
@@ -823,7 +820,7 @@ class Model_Form_Settings extends Helper_Abstract_Model {
|
|
823 |
$results = $this->options->update_pdf( $fid, $config['id'], $config );
|
824 |
|
825 |
if ( $results ) {
|
826 |
-
$this->log->addNotice( 'AJAX
|
827 |
|
828 |
/* @todo just use the same nonce for all requests since WP nonces aren't one-time user (time based) */
|
829 |
$dup_nonce = wp_create_nonce( "gfpdf_duplicate_nonce_{$fid}_{$config['id']}" );
|
@@ -886,7 +883,7 @@ class Model_Form_Settings extends Helper_Abstract_Model {
|
|
886 |
$results = $this->options->update_pdf( $fid, $config['id'], $config );
|
887 |
|
888 |
if ( $results ) {
|
889 |
-
$this->log->addNotice( 'AJAX
|
890 |
|
891 |
$return = [
|
892 |
'state' => $state,
|
@@ -942,6 +939,9 @@ class Model_Form_Settings extends Helper_Abstract_Model {
|
|
942 |
return $settings;
|
943 |
}, 100 );
|
944 |
|
|
|
|
|
|
|
945 |
/* Ensure our new fields are registered */
|
946 |
$this->options->register_settings( $this->options->get_registered_fields() );
|
947 |
|
@@ -977,7 +977,7 @@ class Model_Form_Settings extends Helper_Abstract_Model {
|
|
977 |
'template_type' => $template_type,
|
978 |
];
|
979 |
|
980 |
-
$this->log->addNotice( 'AJAX
|
981 |
|
982 |
echo json_encode( $return );
|
983 |
|
15 |
use Psr\Log\LoggerInterface;
|
16 |
|
17 |
use _WP_Editors;
|
18 |
+
use GFFormsModel;
|
19 |
|
20 |
/**
|
21 |
* Settings Model
|
22 |
*
|
23 |
* @package Gravity PDF
|
24 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
25 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
26 |
* @since 4.0
|
27 |
*/
|
34 |
/*
|
35 |
This file is part of Gravity PDF.
|
36 |
|
37 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
38 |
|
39 |
This program is free software; you can redistribute it and/or modify
|
40 |
it under the terms of the GNU General Public License as published by
|
230 |
|
231 |
/* get the form object */
|
232 |
$form = $this->gform->get_form( $form_id );
|
233 |
+
$form = apply_filters( 'gform_admin_pre_render', $form );
|
234 |
|
235 |
/* parse input and get required information */
|
236 |
if ( ! $pdf_id ) {
|
241 |
}
|
242 |
}
|
243 |
|
244 |
+
$entry_meta = GFFormsModel::get_entry_meta( $form_id );
|
245 |
+
$entry_meta = apply_filters( 'gform_entry_meta_conditional_logic_confirmations', $entry_meta, $form, '' );
|
246 |
+
|
247 |
/* re-register all our settings to show form-specific options */
|
248 |
$this->options->register_settings( $this->options->get_registered_fields() );
|
249 |
|
262 |
'title' => $label,
|
263 |
'button_label' => $label,
|
264 |
'form' => $form,
|
265 |
+
'entry_meta' => $entry_meta,
|
266 |
'pdf' => $pdf,
|
267 |
'wp_editor_loaded' => class_exists( '_WP_Editors' ),
|
268 |
] );
|
282 |
|
283 |
/* prevent unauthorized access */
|
284 |
if ( ! $this->gform->has_capability( 'gravityforms_edit_settings' ) ) {
|
|
|
285 |
$this->log->addCritical( 'Lack of User Capabilities.', [
|
286 |
'user' => wp_get_current_user(),
|
287 |
'user_meta' => get_user_meta( get_current_user_id() ),
|
333 |
if ( empty( $sanitized['name'] ) || empty( $sanitized['filename'] ) ||
|
334 |
( $sanitized['pdf_size'] == 'CUSTOM' && ( (int) $sanitized['custom_pdf_size'][0] === 0 || (int) $sanitized['custom_pdf_size'][1] === 0 ) )
|
335 |
) {
|
|
|
|
|
336 |
$this->notices->add_error( esc_html__( 'PDF could not be saved. Please enter all required information below.', 'gravity-forms-pdf-extended' ) );
|
337 |
|
338 |
return false;
|
346 |
|
347 |
/* If it updated, let's update the global variable */
|
348 |
if ( $did_update !== false ) {
|
349 |
+
$this->log->addNotice( 'Successfully Saved Global PDF Settings.', [
|
|
|
350 |
'form_id' => $form_id,
|
351 |
'pdf_id' => $pdf_id,
|
352 |
'settings' => $sanitized,
|
357 |
return true;
|
358 |
}
|
359 |
|
360 |
+
$this->log->addError( 'Failed to Save Global PDF Settings.' );
|
361 |
$this->notices->add_error( esc_html__( 'There was a problem saving your PDF settings. Please try again.', 'gravity-forms-pdf-extended' ) );
|
362 |
|
363 |
return false;
|
386 |
|
387 |
/* Check we have a valid nonce, or throw an error */
|
388 |
if ( ! wp_verify_nonce( rgpost( 'gfpdf_save_pdf' ), 'gfpdf_save_pdf' ) ) {
|
|
|
389 |
$this->log->addWarning( 'Nonce Verification Failed.' );
|
390 |
$this->notices->add_error( esc_html__( 'There was a problem saving your PDF settings. Please try again.', 'gravity-forms-pdf-extended' ) );
|
391 |
|
627 |
|
628 |
$settings = $this->setup_core_custom_appearance_settings( $settings, $class, $template_settings );
|
629 |
|
|
|
|
|
|
|
|
|
630 |
return $settings;
|
631 |
}
|
632 |
|
764 |
|
765 |
if ( $results && ! is_wp_error( $results ) ) {
|
766 |
|
767 |
+
$this->log->addNotice( 'AJAX – Successfully Deleted PDF Settings' );
|
768 |
|
769 |
$return = [
|
770 |
'msg' => esc_html__( 'PDF successfully deleted.', 'gravity-forms-pdf-extended' ),
|
820 |
$results = $this->options->update_pdf( $fid, $config['id'], $config );
|
821 |
|
822 |
if ( $results ) {
|
823 |
+
$this->log->addNotice( 'AJAX – Successfully Duplicated PDF Setting' );
|
824 |
|
825 |
/* @todo just use the same nonce for all requests since WP nonces aren't one-time user (time based) */
|
826 |
$dup_nonce = wp_create_nonce( "gfpdf_duplicate_nonce_{$fid}_{$config['id']}" );
|
883 |
$results = $this->options->update_pdf( $fid, $config['id'], $config );
|
884 |
|
885 |
if ( $results ) {
|
886 |
+
$this->log->addNotice( 'AJAX – Successfully Updated PDF State' );
|
887 |
|
888 |
$return = [
|
889 |
'state' => $state,
|
939 |
return $settings;
|
940 |
}, 100 );
|
941 |
|
942 |
+
/* Remove any TinyMCE custom plugins which causes loading issues */
|
943 |
+
remove_all_filters( 'mce_external_plugins' );
|
944 |
+
|
945 |
/* Ensure our new fields are registered */
|
946 |
$this->options->register_settings( $this->options->get_registered_fields() );
|
947 |
|
977 |
'template_type' => $template_type,
|
978 |
];
|
979 |
|
980 |
+
$this->log->addNotice( 'AJAX – Successfully Rendered Template Custom Fields', $return );
|
981 |
|
982 |
echo json_encode( $return );
|
983 |
|
src/model/Model_Install.php
CHANGED
@@ -16,7 +16,7 @@ use GFCommon;
|
|
16 |
* Welcome Screen Model
|
17 |
*
|
18 |
* @package Gravity PDF
|
19 |
-
* @copyright Copyright (c)
|
20 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
21 |
* @since 4.0
|
22 |
*/
|
@@ -29,7 +29,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
29 |
/*
|
30 |
This file is part of Gravity PDF.
|
31 |
|
32 |
-
Gravity PDF – Copyright (C)
|
33 |
|
34 |
This program is free software; you can redistribute it and/or modify
|
35 |
it under the terms of the GNU General Public License as published by
|
@@ -132,7 +132,6 @@ class Model_Install extends Helper_Abstract_Model {
|
|
132 |
* @since 4.0
|
133 |
*/
|
134 |
public function install_plugin() {
|
135 |
-
|
136 |
$this->log->addNotice( 'Gravity PDF Installed' );
|
137 |
update_option( 'gfpdf_is_installed', true );
|
138 |
$this->data->is_installed = true;
|
@@ -219,14 +218,6 @@ class Model_Install extends Helper_Abstract_Model {
|
|
219 |
|
220 |
/* See https://gravitypdf.com/documentation/v4/gfpdf_tmp_location/ for more details about this filter */
|
221 |
$this->data->template_tmp_location = apply_filters( 'gfpdf_tmp_location', $this->data->template_location . 'tmp/', $working_folder, $upload_dir_url ); /* encouraged to move this to a directory not accessible via the web */
|
222 |
-
|
223 |
-
$this->log->addNotice( 'Template Locations', [
|
224 |
-
'path' => $this->data->template_location,
|
225 |
-
'url' => $this->data->template_location_url,
|
226 |
-
'font' => $this->data->template_font_location,
|
227 |
-
'fontdata' => $this->data->template_fontdata_location,
|
228 |
-
'tmp' => $this->data->template_tmp_location,
|
229 |
-
] );
|
230 |
}
|
231 |
|
232 |
/**
|
@@ -265,11 +256,6 @@ class Model_Install extends Helper_Abstract_Model {
|
|
265 |
/* Per-blog filters */
|
266 |
$this->data->multisite_template_location = apply_filters( 'gfpdf_multisite_template_location_' . $blog_id, $this->data->multisite_template_location, $working_folder, $upload_dir, $blog_id );
|
267 |
$this->data->multisite_template_location_url = apply_filters( 'gfpdf_multisite_template_location_uri_' . $blog_id, $this->data->multisite_template_location_url, $working_folder, $upload_dir_url, $blog_id );
|
268 |
-
|
269 |
-
$this->log->addNotice( 'Multisite Template Locations', [
|
270 |
-
'path' => $this->data->multisite_template_location,
|
271 |
-
'url' => $this->data->multisite_template_location_url,
|
272 |
-
] );
|
273 |
}
|
274 |
}
|
275 |
|
@@ -334,9 +320,15 @@ class Model_Install extends Helper_Abstract_Model {
|
|
334 |
}
|
335 |
|
336 |
/* create deny htaccess file to prevent direct access to files */
|
337 |
-
if ( is_dir( $this->data->template_tmp_location )
|
338 |
-
$this->
|
339 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
340 |
}
|
341 |
}
|
342 |
|
@@ -362,11 +354,6 @@ class Model_Install extends Helper_Abstract_Model {
|
|
362 |
add_rewrite_rule( $query[0], $rewrite_to, 'top' );
|
363 |
add_rewrite_rule( $query[1], $rewrite_to, 'top' );
|
364 |
|
365 |
-
$this->log->addNotice( 'Add Rewrite Rules', [
|
366 |
-
'query' => $query,
|
367 |
-
'rewrite' => $rewrite_to,
|
368 |
-
] );
|
369 |
-
|
370 |
/* check to see if we need to flush the rewrite rules */
|
371 |
$this->maybe_flush_rewrite_rules( $query );
|
372 |
}
|
@@ -420,8 +407,6 @@ class Model_Install extends Helper_Abstract_Model {
|
|
420 |
* @since 4.0
|
421 |
*/
|
422 |
public function uninstall_plugin() {
|
423 |
-
$this->log->addNotice( 'Uninstall Gravity PDF.' );
|
424 |
-
|
425 |
/* Clean up database */
|
426 |
if ( is_multisite() ) {
|
427 |
$sites = ( function_exists( 'get_sites' ) ) ? get_sites() : wp_get_sites();
|
16 |
* Welcome Screen Model
|
17 |
*
|
18 |
* @package Gravity PDF
|
19 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
20 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
21 |
* @since 4.0
|
22 |
*/
|
29 |
/*
|
30 |
This file is part of Gravity PDF.
|
31 |
|
32 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
33 |
|
34 |
This program is free software; you can redistribute it and/or modify
|
35 |
it under the terms of the GNU General Public License as published by
|
132 |
* @since 4.0
|
133 |
*/
|
134 |
public function install_plugin() {
|
|
|
135 |
$this->log->addNotice( 'Gravity PDF Installed' );
|
136 |
update_option( 'gfpdf_is_installed', true );
|
137 |
$this->data->is_installed = true;
|
218 |
|
219 |
/* See https://gravitypdf.com/documentation/v4/gfpdf_tmp_location/ for more details about this filter */
|
220 |
$this->data->template_tmp_location = apply_filters( 'gfpdf_tmp_location', $this->data->template_location . 'tmp/', $working_folder, $upload_dir_url ); /* encouraged to move this to a directory not accessible via the web */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
}
|
222 |
|
223 |
/**
|
256 |
/* Per-blog filters */
|
257 |
$this->data->multisite_template_location = apply_filters( 'gfpdf_multisite_template_location_' . $blog_id, $this->data->multisite_template_location, $working_folder, $upload_dir, $blog_id );
|
258 |
$this->data->multisite_template_location_url = apply_filters( 'gfpdf_multisite_template_location_uri_' . $blog_id, $this->data->multisite_template_location_url, $working_folder, $upload_dir_url, $blog_id );
|
|
|
|
|
|
|
|
|
|
|
259 |
}
|
260 |
}
|
261 |
|
320 |
}
|
321 |
|
322 |
/* create deny htaccess file to prevent direct access to files */
|
323 |
+
if ( is_dir( $this->data->template_tmp_location ) ) {
|
324 |
+
if ( ! is_file( $this->data->template_tmp_location . 'index.html' ) ) {
|
325 |
+
GFCommon::recursive_add_index_file( $this->data->template_tmp_location );
|
326 |
+
}
|
327 |
+
|
328 |
+
if ( ! is_file( $this->data->template_tmp_location . '.htaccess' ) ) {
|
329 |
+
$this->log->addNotice( 'Create Apache .htaccess Security file' );
|
330 |
+
file_put_contents( $this->data->template_tmp_location . '.htaccess', 'deny from all' );
|
331 |
+
}
|
332 |
}
|
333 |
}
|
334 |
|
354 |
add_rewrite_rule( $query[0], $rewrite_to, 'top' );
|
355 |
add_rewrite_rule( $query[1], $rewrite_to, 'top' );
|
356 |
|
|
|
|
|
|
|
|
|
|
|
357 |
/* check to see if we need to flush the rewrite rules */
|
358 |
$this->maybe_flush_rewrite_rules( $query );
|
359 |
}
|
407 |
* @since 4.0
|
408 |
*/
|
409 |
public function uninstall_plugin() {
|
|
|
|
|
410 |
/* Clean up database */
|
411 |
if ( is_multisite() ) {
|
412 |
$sites = ( function_exists( 'get_sites' ) ) ? get_sites() : wp_get_sites();
|
src/model/Model_Mergetags.php
CHANGED
@@ -12,7 +12,7 @@ use Psr\Log\LoggerInterface;
|
|
12 |
* PDF Mergetags Model
|
13 |
*
|
14 |
* @package Gravity PDF
|
15 |
-
* @copyright Copyright (c)
|
16 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
17 |
* @since 4.1
|
18 |
*/
|
@@ -25,7 +25,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
25 |
/*
|
26 |
This file is part of Gravity PDF.
|
27 |
|
28 |
-
Gravity PDF – Copyright (C)
|
29 |
|
30 |
This program is free software; you can redistribute it and/or modify
|
31 |
it under the terms of the GNU General Public License as published by
|
@@ -172,7 +172,7 @@ class Model_Mergetags extends Helper_Abstract_Model {
|
|
172 |
/* Verify we have a match */
|
173 |
if ( $results ) {
|
174 |
|
175 |
-
$this->log->addNotice( 'Converting PDF
|
176 |
'form_id' => $form['id'],
|
177 |
'entry_id' => $entry['id'],
|
178 |
|
12 |
* PDF Mergetags Model
|
13 |
*
|
14 |
* @package Gravity PDF
|
15 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
16 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
17 |
* @since 4.1
|
18 |
*/
|
25 |
/*
|
26 |
This file is part of Gravity PDF.
|
27 |
|
28 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
29 |
|
30 |
This program is free software; you can redistribute it and/or modify
|
31 |
it under the terms of the GNU General Public License as published by
|
172 |
/* Verify we have a match */
|
173 |
if ( $results ) {
|
174 |
|
175 |
+
$this->log->addNotice( 'Begin Converting PDF Mergetags', [
|
176 |
'form_id' => $form['id'],
|
177 |
'entry_id' => $entry['id'],
|
178 |
|
src/model/Model_PDF.php
CHANGED
@@ -35,7 +35,7 @@ use Exception;
|
|
35 |
* PDF Display Model, including the $form_data array
|
36 |
*
|
37 |
* @package Gravity PDF
|
38 |
-
* @copyright Copyright (c)
|
39 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
40 |
* @since 4.0
|
41 |
*/
|
@@ -48,7 +48,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
48 |
/*
|
49 |
This file is part of Gravity PDF.
|
50 |
|
51 |
-
Gravity PDF – Copyright (C)
|
52 |
|
53 |
This program is free software; you can redistribute it and/or modify
|
54 |
it under the terms of the GNU General Public License as published by
|
@@ -410,7 +410,7 @@ class Model_PDF extends Helper_Abstract_Model {
|
|
410 |
|
411 |
if ( $owner_restriction === 'Yes' && ! is_user_logged_in() ) {
|
412 |
|
413 |
-
$this->log->addNotice( 'Redirecting to Login.', [
|
414 |
'entry' => $entry,
|
415 |
'settings' => $settings,
|
416 |
] );
|
@@ -442,7 +442,7 @@ class Model_PDF extends Helper_Abstract_Model {
|
|
442 |
/* only check if PDF timed out if our logged out restriction is not 'Yes' and the user is not logged in */
|
443 |
if ( ! is_user_logged_in() && $this->is_current_pdf_owner( $entry, 'logged_out' ) === true ) {
|
444 |
/* get the global PDF settings */
|
445 |
-
$timeout = (int) $this->options->get_option( 'logged_out_timeout', '
|
446 |
|
447 |
/* if '0' there is no timeout, or if the logged out restrictions are enabled we'll ignore this */
|
448 |
if ( $timeout !== 0 ) {
|
@@ -459,7 +459,7 @@ class Model_PDF extends Helper_Abstract_Model {
|
|
459 |
return new WP_Error( 'timeout_expired', esc_html__( 'Your PDF is no longer accessible.', 'gravity-forms-pdf-extended' ) );
|
460 |
} else {
|
461 |
|
462 |
-
$this->log->addNotice( 'Redirecting to Login.', [
|
463 |
'entry' => $entry,
|
464 |
'settings' => $settings,
|
465 |
] );
|
@@ -495,7 +495,7 @@ class Model_PDF extends Helper_Abstract_Model {
|
|
495 |
/* check if there is actually a user who owns entry */
|
496 |
if ( ! empty( $entry['created_by'] ) ) {
|
497 |
|
498 |
-
$this->log->addNotice( 'Redirecting to Login.', [
|
499 |
'entry' => $entry,
|
500 |
'settings' => $settings,
|
501 |
] );
|
@@ -503,8 +503,14 @@ class Model_PDF extends Helper_Abstract_Model {
|
|
503 |
/* prompt user to login to get access */
|
504 |
auth_redirect();
|
505 |
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
506 |
/* there's no returning, throw generic error */
|
507 |
-
return new WP_Error( '
|
508 |
}
|
509 |
}
|
510 |
}
|
@@ -569,11 +575,6 @@ class Model_PDF extends Helper_Abstract_Model {
|
|
569 |
$controller = $this->getController();
|
570 |
$pdf_list = $this->get_pdf_display_list( $entry );
|
571 |
|
572 |
-
$this->log->addNotice( 'Display PDF Entry List.', [
|
573 |
-
'pdfs' => $pdf_list,
|
574 |
-
'entry' => $entry,
|
575 |
-
] );
|
576 |
-
|
577 |
if ( ! empty( $pdf_list ) ) {
|
578 |
|
579 |
if ( sizeof( $pdf_list ) > 1 ) {
|
@@ -610,11 +611,6 @@ class Model_PDF extends Helper_Abstract_Model {
|
|
610 |
$controller = $this->getController();
|
611 |
$pdf_list = $this->get_pdf_display_list( $entry );
|
612 |
|
613 |
-
$this->log->addNotice( 'Display PDF Entry Detail List.', [
|
614 |
-
'pdfs' => $pdf_list,
|
615 |
-
'entry' => $entry,
|
616 |
-
] );
|
617 |
-
|
618 |
if ( ! empty( $pdf_list ) ) {
|
619 |
$args = [
|
620 |
'pdfs' => $pdf_list,
|
@@ -983,7 +979,6 @@ class Model_PDF extends Helper_Abstract_Model {
|
|
983 |
'attachments' => $notifications['attachments'],
|
984 |
'notification' => $notifications,
|
985 |
] );
|
986 |
-
|
987 |
}
|
988 |
|
989 |
return $notifications;
|
@@ -1085,44 +1080,38 @@ class Model_PDF extends Helper_Abstract_Model {
|
|
1085 |
}
|
1086 |
|
1087 |
/**
|
1088 |
-
*
|
1089 |
*
|
1090 |
* @return void
|
1091 |
*
|
1092 |
* @since 4.0
|
1093 |
*/
|
1094 |
public function cleanup_tmp_dir() {
|
1095 |
-
|
1096 |
-
$max_file_age = 24 * 3600; /* Max age is 24 hours old */
|
1097 |
$tmp_directory = $this->data->template_tmp_location;
|
1098 |
|
1099 |
if ( is_dir( $tmp_directory ) ) {
|
1100 |
-
/* Scan the tmp directory and get a list of files / folders */
|
1101 |
-
$directory_list = array_diff( scandir( $tmp_directory ), [ '..', '.', '.htaccess' ] );
|
1102 |
-
|
1103 |
-
foreach ( $directory_list as $item ) {
|
1104 |
-
$file = $tmp_directory . $item;
|
1105 |
-
$directory = false;
|
1106 |
-
|
1107 |
-
/* Fix to allow filemtime to work on directories too */
|
1108 |
-
if ( is_dir( $file ) ) {
|
1109 |
-
$file .= '.';
|
1110 |
-
$directory = true;
|
1111 |
-
}
|
1112 |
|
1113 |
-
|
1114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1115 |
|
1116 |
-
if ( $
|
1117 |
-
$this->misc->rmdir(
|
1118 |
-
} else {
|
1119 |
-
if ( ! unlink( $file ) ) {
|
1120 |
-
$this->log->addError( 'Filesystem Delete Error', [
|
1121 |
-
'file' => $file,
|
1122 |
-
] );
|
1123 |
-
}
|
1124 |
}
|
1125 |
}
|
|
|
|
|
|
|
|
|
|
|
1126 |
}
|
1127 |
}
|
1128 |
}
|
@@ -1386,7 +1375,7 @@ class Model_PDF extends Helper_Abstract_Model {
|
|
1386 |
}
|
1387 |
|
1388 |
/* Re-order the array keys to make it more readable */
|
1389 |
-
$order = [
|
1390 |
'misc',
|
1391 |
'field',
|
1392 |
'list',
|
@@ -1403,7 +1392,7 @@ class Model_PDF extends Helper_Abstract_Model {
|
|
1403 |
'signature',
|
1404 |
'signature_details',
|
1405 |
'html',
|
1406 |
-
];
|
1407 |
|
1408 |
foreach ( $order as $key ) {
|
1409 |
|
@@ -1415,10 +1404,6 @@ class Model_PDF extends Helper_Abstract_Model {
|
|
1415 |
}
|
1416 |
}
|
1417 |
|
1418 |
-
$this->log->addNotice( 'Form Data Array Created', [
|
1419 |
-
'data' => $data,
|
1420 |
-
] );
|
1421 |
-
|
1422 |
/**
|
1423 |
* See https://gravitypdf.com/documentation/v4/gfpdf_form_data/ for usage
|
1424 |
* @since 4.2
|
@@ -1503,8 +1488,8 @@ class Model_PDF extends Helper_Abstract_Model {
|
|
1503 |
$fields = GFCommon::get_fields_by_type( $form, [ 'survey' ] );
|
1504 |
|
1505 |
/* Include the survey score, if any */
|
1506 |
-
if ( isset( $
|
1507 |
-
$data['survey']['score'] = $
|
1508 |
}
|
1509 |
|
1510 |
$results = $this->get_addon_global_data( $form, [], $fields );
|
@@ -1844,7 +1829,7 @@ class Model_PDF extends Helper_Abstract_Model {
|
|
1844 |
$pdfs = array_values( $pdfs );
|
1845 |
|
1846 |
/* Use the legacy aid to determine which PDF to load */
|
1847 |
-
if ( $config['aid'] !== false ) {
|
1848 |
$selector = $config['aid'] - 1;
|
1849 |
|
1850 |
if ( isset( $pdfs[ $selector ] ) && $pdfs[ $selector ]['template'] == $config['template'] ) {
|
@@ -2032,4 +2017,22 @@ class Model_PDF extends Helper_Abstract_Model {
|
|
2032 |
|
2033 |
return $ignored;
|
2034 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2035 |
}
|
35 |
* PDF Display Model, including the $form_data array
|
36 |
*
|
37 |
* @package Gravity PDF
|
38 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
39 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
40 |
* @since 4.0
|
41 |
*/
|
48 |
/*
|
49 |
This file is part of Gravity PDF.
|
50 |
|
51 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
52 |
|
53 |
This program is free software; you can redistribute it and/or modify
|
54 |
it under the terms of the GNU General Public License as published by
|
410 |
|
411 |
if ( $owner_restriction === 'Yes' && ! is_user_logged_in() ) {
|
412 |
|
413 |
+
$this->log->addNotice( 'Security – Owner Restrictions: Redirecting to Login.', [
|
414 |
'entry' => $entry,
|
415 |
'settings' => $settings,
|
416 |
] );
|
442 |
/* only check if PDF timed out if our logged out restriction is not 'Yes' and the user is not logged in */
|
443 |
if ( ! is_user_logged_in() && $this->is_current_pdf_owner( $entry, 'logged_out' ) === true ) {
|
444 |
/* get the global PDF settings */
|
445 |
+
$timeout = (int) $this->options->get_option( 'logged_out_timeout', '20' );
|
446 |
|
447 |
/* if '0' there is no timeout, or if the logged out restrictions are enabled we'll ignore this */
|
448 |
if ( $timeout !== 0 ) {
|
459 |
return new WP_Error( 'timeout_expired', esc_html__( 'Your PDF is no longer accessible.', 'gravity-forms-pdf-extended' ) );
|
460 |
} else {
|
461 |
|
462 |
+
$this->log->addNotice( 'Security – Logged Out Timeout: Redirecting to Login.', [
|
463 |
'entry' => $entry,
|
464 |
'settings' => $settings,
|
465 |
] );
|
495 |
/* check if there is actually a user who owns entry */
|
496 |
if ( ! empty( $entry['created_by'] ) ) {
|
497 |
|
498 |
+
$this->log->addNotice( 'Security – Auth Logged Out User: Redirecting to Login.', [
|
499 |
'entry' => $entry,
|
500 |
'settings' => $settings,
|
501 |
] );
|
503 |
/* prompt user to login to get access */
|
504 |
auth_redirect();
|
505 |
} else {
|
506 |
+
$this->log->addWarning( 'Access denied.', [
|
507 |
+
'entry' => $entry,
|
508 |
+
'settings' => $settings,
|
509 |
+
'SERVER' => $_SERVER,
|
510 |
+
] );
|
511 |
+
|
512 |
/* there's no returning, throw generic error */
|
513 |
+
return new WP_Error( 'access_denied', esc_html__( 'You do not have access to view this PDF.', 'gravity-forms-pdf-extended' ) );
|
514 |
}
|
515 |
}
|
516 |
}
|
575 |
$controller = $this->getController();
|
576 |
$pdf_list = $this->get_pdf_display_list( $entry );
|
577 |
|
|
|
|
|
|
|
|
|
|
|
578 |
if ( ! empty( $pdf_list ) ) {
|
579 |
|
580 |
if ( sizeof( $pdf_list ) > 1 ) {
|
611 |
$controller = $this->getController();
|
612 |
$pdf_list = $this->get_pdf_display_list( $entry );
|
613 |
|
|
|
|
|
|
|
|
|
|
|
614 |
if ( ! empty( $pdf_list ) ) {
|
615 |
$args = [
|
616 |
'pdfs' => $pdf_list,
|
979 |
'attachments' => $notifications['attachments'],
|
980 |
'notification' => $notifications,
|
981 |
] );
|
|
|
982 |
}
|
983 |
|
984 |
return $notifications;
|
1080 |
}
|
1081 |
|
1082 |
/**
|
1083 |
+
* Clean-up our tmp directory every 24 hours
|
1084 |
*
|
1085 |
* @return void
|
1086 |
*
|
1087 |
* @since 4.0
|
1088 |
*/
|
1089 |
public function cleanup_tmp_dir() {
|
1090 |
+
$max_file_age = time() - 24 * 3600; /* Max age is 24 hours old */
|
|
|
1091 |
$tmp_directory = $this->data->template_tmp_location;
|
1092 |
|
1093 |
if ( is_dir( $tmp_directory ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1094 |
|
1095 |
+
try {
|
1096 |
+
$directory_list = new \RecursiveIteratorIterator(
|
1097 |
+
new \RecursiveDirectoryIterator( $tmp_directory, \RecursiveDirectoryIterator::SKIP_DOTS ),
|
1098 |
+
\RecursiveIteratorIterator::CHILD_FIRST
|
1099 |
+
);
|
1100 |
+
|
1101 |
+
foreach ( $directory_list as $file ) {
|
1102 |
+
if ( in_array( $file->getFilename(), [ '.htaccess', 'index.html' ] ) ) {
|
1103 |
+
continue;
|
1104 |
+
}
|
1105 |
|
1106 |
+
if ( $file->isReadable() && $file->getMTime() < $max_file_age ) {
|
1107 |
+
( $file->isDir() ) ? $this->misc->rmdir( $file->getPathName() ) : unlink( $file->getPathName() );
|
|
|
|
|
|
|
|
|
|
|
|
|
1108 |
}
|
1109 |
}
|
1110 |
+
} catch ( Exception $e ) {
|
1111 |
+
$this->log->addError( 'Filesystem Delete Error', [
|
1112 |
+
'dir' => $tmp_directory,
|
1113 |
+
'exception' => $e->getMessage(),
|
1114 |
+
] );
|
1115 |
}
|
1116 |
}
|
1117 |
}
|
1375 |
}
|
1376 |
|
1377 |
/* Re-order the array keys to make it more readable */
|
1378 |
+
$order = apply_filters( 'gfpdf_form_data_key_order', [
|
1379 |
'misc',
|
1380 |
'field',
|
1381 |
'list',
|
1392 |
'signature',
|
1393 |
'signature_details',
|
1394 |
'html',
|
1395 |
+
] );
|
1396 |
|
1397 |
foreach ( $order as $key ) {
|
1398 |
|
1404 |
}
|
1405 |
}
|
1406 |
|
|
|
|
|
|
|
|
|
1407 |
/**
|
1408 |
* See https://gravitypdf.com/documentation/v4/gfpdf_form_data/ for usage
|
1409 |
* @since 4.2
|
1488 |
$fields = GFCommon::get_fields_by_type( $form, [ 'survey' ] );
|
1489 |
|
1490 |
/* Include the survey score, if any */
|
1491 |
+
if ( isset( $entry['gsurvey_score'] ) ) {
|
1492 |
+
$data['survey']['score'] = $entry['gsurvey_score'];
|
1493 |
}
|
1494 |
|
1495 |
$results = $this->get_addon_global_data( $form, [], $fields );
|
1829 |
$pdfs = array_values( $pdfs );
|
1830 |
|
1831 |
/* Use the legacy aid to determine which PDF to load */
|
1832 |
+
if ( isset( $config['aid'] ) && $config['aid'] !== false ) {
|
1833 |
$selector = $config['aid'] - 1;
|
1834 |
|
1835 |
if ( isset( $pdfs[ $selector ] ) && $pdfs[ $selector ]['template'] == $config['template'] ) {
|
2017 |
|
2018 |
return $ignored;
|
2019 |
}
|
2020 |
+
|
2021 |
+
/**
|
2022 |
+
* Set the watermark font to the current PDF font
|
2023 |
+
*
|
2024 |
+
* @param Mpdf $mpdf
|
2025 |
+
* @param array $form
|
2026 |
+
* @param array $entry
|
2027 |
+
* @param array $settings
|
2028 |
+
*
|
2029 |
+
* @return Mpdf
|
2030 |
+
*
|
2031 |
+
* @since 5.0
|
2032 |
+
*/
|
2033 |
+
public function set_watermark_font( $mpdf, $form, $entry, $settings ) {
|
2034 |
+
$mpdf->watermark_font = ( isset( $settings['watermark_font'] ) ) ? $settings['watermark_font'] : $settings['font'];
|
2035 |
+
|
2036 |
+
return $mpdf;
|
2037 |
+
}
|
2038 |
}
|
src/model/Model_Settings.php
CHANGED
@@ -17,7 +17,7 @@ use Psr\Log\LoggerInterface;
|
|
17 |
* Settings Model
|
18 |
*
|
19 |
* @package Gravity PDF
|
20 |
-
* @copyright Copyright (c)
|
21 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
22 |
* @since 4.0
|
23 |
*/
|
@@ -30,7 +30,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
30 |
/*
|
31 |
This file is part of Gravity PDF.
|
32 |
|
33 |
-
Gravity PDF – Copyright (C)
|
34 |
|
35 |
This program is free software; you can redistribute it and/or modify
|
36 |
it under the terms of the GNU General Public License as published by
|
@@ -458,7 +458,7 @@ class Model_Settings extends Helper_Abstract_Model {
|
|
458 |
$results = $this->process_font( $payload );
|
459 |
|
460 |
/* If we reached this point the results were successful so return the new object */
|
461 |
-
$this->log->addNotice( 'AJAX
|
462 |
'results' => $results,
|
463 |
] );
|
464 |
|
@@ -493,7 +493,7 @@ class Model_Settings extends Helper_Abstract_Model {
|
|
493 |
|
494 |
if ( $this->options->update_option( 'custom_fonts', $fonts ) ) {
|
495 |
/* Success */
|
496 |
-
$this->log->addNotice( 'AJAX
|
497 |
echo json_encode( [ 'success' => true ] );
|
498 |
wp_die();
|
499 |
}
|
@@ -535,7 +535,7 @@ class Model_Settings extends Helper_Abstract_Model {
|
|
535 |
'error' => esc_html__( 'Required fields have not been included.', 'gravity-forms-pdf-extended' ),
|
536 |
];
|
537 |
|
538 |
-
$this->log->addWarning( 'Validation Failed
|
539 |
|
540 |
echo json_encode( $return );
|
541 |
|
@@ -552,7 +552,7 @@ class Model_Settings extends Helper_Abstract_Model {
|
|
552 |
'error' => esc_html__( 'Font name is not valid. Only alphanumeric characters and spaces are accepted.', 'gravity-forms-pdf-extended' ),
|
553 |
];
|
554 |
|
555 |
-
$this->log->addWarning( 'Validation Failed
|
556 |
|
557 |
echo json_encode( $return );
|
558 |
|
@@ -570,7 +570,7 @@ class Model_Settings extends Helper_Abstract_Model {
|
|
570 |
'error' => esc_html__( 'A font with the same name already exists. Try a different name.', 'gravity-forms-pdf-extended' ),
|
571 |
];
|
572 |
|
573 |
-
$this->log->addWarning( 'Validation Failed
|
574 |
|
575 |
echo json_encode( $return );
|
576 |
|
@@ -588,7 +588,7 @@ class Model_Settings extends Helper_Abstract_Model {
|
|
588 |
'error' => $installation,
|
589 |
];
|
590 |
|
591 |
-
$this->log->addWarning( 'Validation Failed
|
592 |
|
593 |
echo json_encode( $return );
|
594 |
|
@@ -597,7 +597,6 @@ class Model_Settings extends Helper_Abstract_Model {
|
|
597 |
}
|
598 |
|
599 |
/* If we got here the installation was successful so return the data */
|
600 |
-
|
601 |
return $installation;
|
602 |
}
|
603 |
|
@@ -865,7 +864,7 @@ class Model_Settings extends Helper_Abstract_Model {
|
|
865 |
|
866 |
/* Check add-on currently installed */
|
867 |
if ( isset( $this->data->addon[ $addon_slug ] ) && $this->deactivate_license_key( $this->data->addon[ $addon_slug ], $license ) ) {
|
868 |
-
$this->log->addNotice( 'AJAX
|
869 |
echo json_encode( [
|
870 |
'success' => esc_html__( 'License deactivated.', 'gravity-forms-pdf-extended' ) ]
|
871 |
);
|
17 |
* Settings Model
|
18 |
*
|
19 |
* @package Gravity PDF
|
20 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
21 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
22 |
* @since 4.0
|
23 |
*/
|
30 |
/*
|
31 |
This file is part of Gravity PDF.
|
32 |
|
33 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
34 |
|
35 |
This program is free software; you can redistribute it and/or modify
|
36 |
it under the terms of the GNU General Public License as published by
|
458 |
$results = $this->process_font( $payload );
|
459 |
|
460 |
/* If we reached this point the results were successful so return the new object */
|
461 |
+
$this->log->addNotice( 'AJAX – Successfully Saved Font', [
|
462 |
'results' => $results,
|
463 |
] );
|
464 |
|
493 |
|
494 |
if ( $this->options->update_option( 'custom_fonts', $fonts ) ) {
|
495 |
/* Success */
|
496 |
+
$this->log->addNotice( 'AJAX – Successfully Deleted Font' );
|
497 |
echo json_encode( [ 'success' => true ] );
|
498 |
wp_die();
|
499 |
}
|
535 |
'error' => esc_html__( 'Required fields have not been included.', 'gravity-forms-pdf-extended' ),
|
536 |
];
|
537 |
|
538 |
+
$this->log->addWarning( 'Font Validation Failed', $return );
|
539 |
|
540 |
echo json_encode( $return );
|
541 |
|
552 |
'error' => esc_html__( 'Font name is not valid. Only alphanumeric characters and spaces are accepted.', 'gravity-forms-pdf-extended' ),
|
553 |
];
|
554 |
|
555 |
+
$this->log->addWarning( 'Font Validation Failed', $return );
|
556 |
|
557 |
echo json_encode( $return );
|
558 |
|
570 |
'error' => esc_html__( 'A font with the same name already exists. Try a different name.', 'gravity-forms-pdf-extended' ),
|
571 |
];
|
572 |
|
573 |
+
$this->log->addWarning( 'Font Validation Failed', $return );
|
574 |
|
575 |
echo json_encode( $return );
|
576 |
|
588 |
'error' => $installation,
|
589 |
];
|
590 |
|
591 |
+
$this->log->addWarning( 'Font Validation Failed', $return );
|
592 |
|
593 |
echo json_encode( $return );
|
594 |
|
597 |
}
|
598 |
|
599 |
/* If we got here the installation was successful so return the data */
|
|
|
600 |
return $installation;
|
601 |
}
|
602 |
|
864 |
|
865 |
/* Check add-on currently installed */
|
866 |
if ( isset( $this->data->addon[ $addon_slug ] ) && $this->deactivate_license_key( $this->data->addon[ $addon_slug ], $license ) ) {
|
867 |
+
$this->log->addNotice( 'AJAX – Successfully Deactivated License' );
|
868 |
echo json_encode( [
|
869 |
'success' => esc_html__( 'License deactivated.', 'gravity-forms-pdf-extended' ) ]
|
870 |
);
|
src/model/Model_Shortcodes.php
CHANGED
@@ -17,7 +17,7 @@ use GravityView_View;
|
|
17 |
* PDF Shortcode Model
|
18 |
*
|
19 |
* @package Gravity PDF
|
20 |
-
* @copyright Copyright (c)
|
21 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
22 |
* @since 4.0
|
23 |
*/
|
@@ -30,7 +30,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
30 |
/*
|
31 |
This file is part of Gravity PDF.
|
32 |
|
33 |
-
Gravity PDF – Copyright (C)
|
34 |
|
35 |
This program is free software; you can redistribute it and/or modify
|
36 |
it under the terms of the GNU General Public License as published by
|
@@ -123,10 +123,7 @@ class Model_Shortcodes extends Helper_Abstract_Model {
|
|
123 |
* @since 4.0
|
124 |
*/
|
125 |
public function gravitypdf( $attributes ) {
|
126 |
-
|
127 |
-
$this->log->addNotice( 'Generating Shortcode' );
|
128 |
-
|
129 |
-
$controller = $this->getController();
|
130 |
|
131 |
$global_settings = $this->options->get_settings();
|
132 |
$shortcode_error_messages_enabled = ( isset( $global_settings['shortcode_debug_messages'] ) && $global_settings['shortcode_debug_messages'] === 'Yes' ) ? true : false;
|
@@ -359,7 +356,7 @@ class Model_Shortcodes extends Helper_Abstract_Model {
|
|
359 |
/* check if the confirmation is currently being saved */
|
360 |
if ( isset( $_POST['form_confirmation_url'] ) ) {
|
361 |
|
362 |
-
$this->log->addNotice( '
|
363 |
'form_id' => $form['id'],
|
364 |
'post' => $_POST,
|
365 |
] );
|
17 |
* PDF Shortcode Model
|
18 |
*
|
19 |
* @package Gravity PDF
|
20 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
21 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
22 |
* @since 4.0
|
23 |
*/
|
30 |
/*
|
31 |
This file is part of Gravity PDF.
|
32 |
|
33 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
34 |
|
35 |
This program is free software; you can redistribute it and/or modify
|
36 |
it under the terms of the GNU General Public License as published by
|
123 |
* @since 4.0
|
124 |
*/
|
125 |
public function gravitypdf( $attributes ) {
|
126 |
+
$controller = $this->getController();
|
|
|
|
|
|
|
127 |
|
128 |
$global_settings = $this->options->get_settings();
|
129 |
$shortcode_error_messages_enabled = ( isset( $global_settings['shortcode_debug_messages'] ) && $global_settings['shortcode_debug_messages'] === 'Yes' ) ? true : false;
|
356 |
/* check if the confirmation is currently being saved */
|
357 |
if ( isset( $_POST['form_confirmation_url'] ) ) {
|
358 |
|
359 |
+
$this->log->addNotice( 'Begin Converting Shortcode to URL for Redirect Confirmation', [
|
360 |
'form_id' => $form['id'],
|
361 |
'post' => $_POST,
|
362 |
] );
|
src/model/Model_Templates.php
CHANGED
@@ -22,7 +22,7 @@ use Exception;
|
|
22 |
* Template Model
|
23 |
*
|
24 |
* @package Gravity PDF
|
25 |
-
* @copyright Copyright (c)
|
26 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
27 |
* @since 4.1
|
28 |
*/
|
@@ -35,7 +35,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
35 |
/*
|
36 |
This file is part of Gravity PDF.
|
37 |
|
38 |
-
Gravity PDF – Copyright (C)
|
39 |
|
40 |
This program is free software; you can redistribute it and/or modify
|
41 |
it under the terms of the GNU General Public License as published by
|
22 |
* Template Model
|
23 |
*
|
24 |
* @package Gravity PDF
|
25 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
26 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
27 |
* @since 4.1
|
28 |
*/
|
35 |
/*
|
36 |
This file is part of Gravity PDF.
|
37 |
|
38 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
39 |
|
40 |
This program is free software; you can redistribute it and/or modify
|
41 |
it under the terms of the GNU General Public License as published by
|
src/model/Model_Welcome_Screen.php
CHANGED
@@ -10,7 +10,7 @@ use Psr\Log\LoggerInterface;
|
|
10 |
* Welcome Screen Model
|
11 |
*
|
12 |
* @package Gravity PDF
|
13 |
-
* @copyright Copyright (c)
|
14 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
15 |
* @since 4.0
|
16 |
*/
|
@@ -23,7 +23,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
23 |
/*
|
24 |
This file is part of Gravity PDF.
|
25 |
|
26 |
-
Gravity PDF – Copyright (C)
|
27 |
|
28 |
This program is free software; you can redistribute it and/or modify
|
29 |
it under the terms of the GNU General Public License as published by
|
@@ -135,8 +135,6 @@ class Model_Welcome_Screen extends Helper_Abstract_Model {
|
|
135 |
|
136 |
switch ( rgget( 'page' ) ) {
|
137 |
case 'gfpdf-getting-started':
|
138 |
-
$this->log->addNotice( 'Display Welcome Screen' );
|
139 |
-
|
140 |
return $this->welcome_title;
|
141 |
break;
|
142 |
}
|
10 |
* Welcome Screen Model
|
11 |
*
|
12 |
* @package Gravity PDF
|
13 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
14 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
15 |
* @since 4.0
|
16 |
*/
|
23 |
/*
|
24 |
This file is part of Gravity PDF.
|
25 |
|
26 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
27 |
|
28 |
This program is free software; you can redistribute it and/or modify
|
29 |
it under the terms of the GNU General Public License as published by
|
135 |
|
136 |
switch ( rgget( 'page' ) ) {
|
137 |
case 'gfpdf-getting-started':
|
|
|
|
|
138 |
return $this->welcome_title;
|
139 |
break;
|
140 |
}
|
src/templates/config/blank-slate.php
CHANGED
@@ -12,7 +12,7 @@ use GFPDF\Helper\Helper_Interface_Config;
|
|
12 |
* If running a multisite that would be the PDF_EXTENDED_TEMPLATES/:id/config/ folder, where :id is the subsite ID number
|
13 |
*
|
14 |
* @package Gravity PDF
|
15 |
-
* @copyright Copyright (c)
|
16 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
17 |
* @since 4.0
|
18 |
*
|
@@ -26,7 +26,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
26 |
/*
|
27 |
This file is part of Gravity PDF.
|
28 |
|
29 |
-
Gravity PDF – Copyright (C)
|
30 |
|
31 |
This program is free software; you can redistribute it and/or modify
|
32 |
it under the terms of the GNU General Public License as published by
|
12 |
* If running a multisite that would be the PDF_EXTENDED_TEMPLATES/:id/config/ folder, where :id is the subsite ID number
|
13 |
*
|
14 |
* @package Gravity PDF
|
15 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
16 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
17 |
* @since 4.0
|
18 |
*
|
26 |
/*
|
27 |
This file is part of Gravity PDF.
|
28 |
|
29 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
30 |
|
31 |
This program is free software; you can redistribute it and/or modify
|
32 |
it under the terms of the GNU General Public License as published by
|
src/templates/config/focus-gravity.php
CHANGED
@@ -12,7 +12,7 @@ use GFPDF\Helper\Helper_Interface_Config;
|
|
12 |
* If running a multisite that would be the PDF_EXTENDED_TEMPLATES/:id/config/ folder, where :id is the subsite ID number
|
13 |
*
|
14 |
* @package Gravity PDF
|
15 |
-
* @copyright Copyright (c)
|
16 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
17 |
* @since 4.0
|
18 |
*
|
@@ -26,7 +26,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
26 |
/*
|
27 |
This file is part of Gravity PDF.
|
28 |
|
29 |
-
Gravity PDF – Copyright (C)
|
30 |
|
31 |
This program is free software; you can redistribute it and/or modify
|
32 |
it under the terms of the GNU General Public License as published by
|
12 |
* If running a multisite that would be the PDF_EXTENDED_TEMPLATES/:id/config/ folder, where :id is the subsite ID number
|
13 |
*
|
14 |
* @package Gravity PDF
|
15 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
16 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
17 |
* @since 4.0
|
18 |
*
|
26 |
/*
|
27 |
This file is part of Gravity PDF.
|
28 |
|
29 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
30 |
|
31 |
This program is free software; you can redistribute it and/or modify
|
32 |
it under the terms of the GNU General Public License as published by
|
src/templates/config/legacy.php
CHANGED
@@ -8,7 +8,7 @@ use GFPDF\Helper\Helper_Interface_Config;
|
|
8 |
* Handles our v3 legacy templates configuration (default-template.php, default-template-two-rows.php and default-template-no-style.php)
|
9 |
*
|
10 |
* @package Gravity PDF
|
11 |
-
* @copyright Copyright (c)
|
12 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
* @since 4.0
|
14 |
*
|
@@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
22 |
/*
|
23 |
This file is part of Gravity PDF.
|
24 |
|
25 |
-
Gravity PDF – Copyright (C)
|
26 |
|
27 |
This program is free software; you can redistribute it and/or modify
|
28 |
it under the terms of the GNU General Public License as published by
|
8 |
* Handles our v3 legacy templates configuration (default-template.php, default-template-two-rows.php and default-template-no-style.php)
|
9 |
*
|
10 |
* @package Gravity PDF
|
11 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
12 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
* @since 4.0
|
14 |
*
|
22 |
/*
|
23 |
This file is part of Gravity PDF.
|
24 |
|
25 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
26 |
|
27 |
This program is free software; you can redistribute it and/or modify
|
28 |
it under the terms of the GNU General Public License as published by
|
src/templates/config/rubix.php
CHANGED
@@ -12,7 +12,7 @@ use GFPDF\Helper\Helper_Interface_Config;
|
|
12 |
* If running a multisite that would be the PDF_EXTENDED_TEMPLATES/:id/config/ folder, where :id is the subsite ID number
|
13 |
*
|
14 |
* @package Gravity PDF
|
15 |
-
* @copyright Copyright (c)
|
16 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
17 |
* @since 4.0
|
18 |
*
|
@@ -26,7 +26,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
26 |
/*
|
27 |
This file is part of Gravity PDF.
|
28 |
|
29 |
-
Gravity PDF – Copyright (C)
|
30 |
|
31 |
This program is free software; you can redistribute it and/or modify
|
32 |
it under the terms of the GNU General Public License as published by
|
12 |
* If running a multisite that would be the PDF_EXTENDED_TEMPLATES/:id/config/ folder, where :id is the subsite ID number
|
13 |
*
|
14 |
* @package Gravity PDF
|
15 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
16 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
17 |
* @since 4.0
|
18 |
*
|
26 |
/*
|
27 |
This file is part of Gravity PDF.
|
28 |
|
29 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
30 |
|
31 |
This program is free software; you can redistribute it and/or modify
|
32 |
it under the terms of the GNU General Public License as published by
|
src/templates/config/zadani.php
CHANGED
@@ -12,7 +12,7 @@ use GFPDF\Helper\Helper_Interface_Config;
|
|
12 |
* If running a multisite that would be the PDF_EXTENDED_TEMPLATES/:id/config/ folder, where :id is the subsite ID number
|
13 |
*
|
14 |
* @package Gravity PDF
|
15 |
-
* @copyright Copyright (c)
|
16 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
17 |
* @since 4.0
|
18 |
*
|
@@ -26,7 +26,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
26 |
/*
|
27 |
This file is part of Gravity PDF.
|
28 |
|
29 |
-
Gravity PDF – Copyright (C)
|
30 |
|
31 |
This program is free software; you can redistribute it and/or modify
|
32 |
it under the terms of the GNU General Public License as published by
|
12 |
* If running a multisite that would be the PDF_EXTENDED_TEMPLATES/:id/config/ folder, where :id is the subsite ID number
|
13 |
*
|
14 |
* @package Gravity PDF
|
15 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
16 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
17 |
* @since 4.0
|
18 |
*
|
26 |
/*
|
27 |
This file is part of Gravity PDF.
|
28 |
|
29 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
30 |
|
31 |
This program is free software; you can redistribute it and/or modify
|
32 |
it under the terms of the GNU General Public License as published by
|
src/view/View_Actions.php
CHANGED
@@ -8,7 +8,7 @@ use GFPDF\Helper\Helper_Abstract_View;
|
|
8 |
* Actions View
|
9 |
*
|
10 |
* @package Gravity PDF
|
11 |
-
* @copyright Copyright (c)
|
12 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
* @since 4.0
|
14 |
*/
|
@@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
21 |
/*
|
22 |
This file is part of Gravity PDF.
|
23 |
|
24 |
-
Gravity PDF – Copyright (C)
|
25 |
|
26 |
This program is free software; you can redistribute it and/or modify
|
27 |
it under the terms of the GNU General Public License as published by
|
8 |
* Actions View
|
9 |
*
|
10 |
* @package Gravity PDF
|
11 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
12 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
* @since 4.0
|
14 |
*/
|
21 |
/*
|
22 |
This file is part of Gravity PDF.
|
23 |
|
24 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
25 |
|
26 |
This program is free software; you can redistribute it and/or modify
|
27 |
it under the terms of the GNU General Public License as published by
|
src/view/View_Form_Settings.php
CHANGED
@@ -8,7 +8,7 @@ use GFPDF\Helper\Helper_Abstract_View;
|
|
8 |
* Settings View
|
9 |
*
|
10 |
* @package Gravity PDF
|
11 |
-
* @copyright Copyright (c)
|
12 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
* @since 4.0
|
14 |
*/
|
@@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
21 |
/*
|
22 |
This file is part of Gravity PDF.
|
23 |
|
24 |
-
Gravity PDF – Copyright (C)
|
25 |
|
26 |
This program is free software; you can redistribute it and/or modify
|
27 |
it under the terms of the GNU General Public License as published by
|
8 |
* Settings View
|
9 |
*
|
10 |
* @package Gravity PDF
|
11 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
12 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
* @since 4.0
|
14 |
*/
|
21 |
/*
|
22 |
This file is part of Gravity PDF.
|
23 |
|
24 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
25 |
|
26 |
This program is free software; you can redistribute it and/or modify
|
27 |
it under the terms of the GNU General Public License as published by
|
src/view/View_PDF.php
CHANGED
@@ -28,7 +28,7 @@ use Exception;
|
|
28 |
* PDF View
|
29 |
*
|
30 |
* @package Gravity PDF
|
31 |
-
* @copyright Copyright (c)
|
32 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
33 |
* @since 4.0
|
34 |
*/
|
@@ -41,7 +41,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
41 |
/*
|
42 |
This file is part of Gravity PDF.
|
43 |
|
44 |
-
Gravity PDF – Copyright (C)
|
45 |
|
46 |
This program is free software; you can redistribute it and/or modify
|
47 |
it under the terms of the GNU General Public License as published by
|
@@ -534,8 +534,17 @@ class View_PDF extends Helper_Abstract_View {
|
|
534 |
/* correctly close / cleanup the HTML container if needed */
|
535 |
$container->close();
|
536 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
537 |
/* Load our HTML */
|
538 |
-
$html = $this->load( 'page_title', [ 'form' => $form, 'page' => $page ], false );
|
539 |
|
540 |
/* Run it through a filter and output */
|
541 |
echo apply_filters( 'gfpdf_field_page_name_html', $html, $page, $form );
|
@@ -579,7 +588,7 @@ class View_PDF extends Helper_Abstract_View {
|
|
579 |
public function get_core_template_styles( $settings, $entry ) {
|
580 |
$form = $this->gform->get_form( $entry['form_id'] );
|
581 |
|
582 |
-
$html = $this->load_core_template_styles( $settings );
|
583 |
|
584 |
$html = apply_filters( 'gfpdf_pdf_core_template_html_output', $html, $form, $entry, $settings );
|
585 |
$html = apply_filters( 'gfpdf_pdf_core_template_html_output_' . $form['id'], $html, $form, $entry, $settings );
|
@@ -591,17 +600,23 @@ class View_PDF extends Helper_Abstract_View {
|
|
591 |
* Load our core PDF template settings
|
592 |
*
|
593 |
* @param $settings
|
|
|
|
|
594 |
*
|
595 |
* @return string|\WP_Error
|
596 |
*
|
597 |
* @since 4.0
|
598 |
*/
|
599 |
-
public function load_core_template_styles( $settings ) {
|
600 |
$controller = $this->getController();
|
601 |
$model = $controller->model;
|
602 |
|
603 |
/* Run our settings through the preprocessor which requires an array with a 'settings' key */
|
604 |
-
$args = $model->preprocess_template_arguments( [
|
|
|
|
|
|
|
|
|
605 |
$settings = $args['settings'];
|
606 |
|
607 |
return $this->load( 'core_template_styles', [ 'settings' => $settings ], false );
|
28 |
* PDF View
|
29 |
*
|
30 |
* @package Gravity PDF
|
31 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
32 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
33 |
* @since 4.0
|
34 |
*/
|
41 |
/*
|
42 |
This file is part of Gravity PDF.
|
43 |
|
44 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
45 |
|
46 |
This program is free software; you can redistribute it and/or modify
|
47 |
it under the terms of the GNU General Public License as published by
|
534 |
/* correctly close / cleanup the HTML container if needed */
|
535 |
$container->close();
|
536 |
|
537 |
+
/* Find any CSS assigned to the page */
|
538 |
+
$classes = '';
|
539 |
+
foreach( $form['fields'] as $field ) {
|
540 |
+
if( $field->type === 'page' && $field->pageNumber === ($page + 1 ) ) {
|
541 |
+
$classes = $field->cssClass;
|
542 |
+
break;
|
543 |
+
}
|
544 |
+
}
|
545 |
+
|
546 |
/* Load our HTML */
|
547 |
+
$html = $this->load( 'page_title', [ 'form' => $form, 'page' => $page, 'classes' => $classes ], false );
|
548 |
|
549 |
/* Run it through a filter and output */
|
550 |
echo apply_filters( 'gfpdf_field_page_name_html', $html, $page, $form );
|
588 |
public function get_core_template_styles( $settings, $entry ) {
|
589 |
$form = $this->gform->get_form( $entry['form_id'] );
|
590 |
|
591 |
+
$html = $this->load_core_template_styles( $settings, $entry, $form );
|
592 |
|
593 |
$html = apply_filters( 'gfpdf_pdf_core_template_html_output', $html, $form, $entry, $settings );
|
594 |
$html = apply_filters( 'gfpdf_pdf_core_template_html_output_' . $form['id'], $html, $form, $entry, $settings );
|
600 |
* Load our core PDF template settings
|
601 |
*
|
602 |
* @param $settings
|
603 |
+
* @param $entry
|
604 |
+
* @param $form
|
605 |
*
|
606 |
* @return string|\WP_Error
|
607 |
*
|
608 |
* @since 4.0
|
609 |
*/
|
610 |
+
public function load_core_template_styles( $settings, $entry, $form ) {
|
611 |
$controller = $this->getController();
|
612 |
$model = $controller->model;
|
613 |
|
614 |
/* Run our settings through the preprocessor which requires an array with a 'settings' key */
|
615 |
+
$args = $model->preprocess_template_arguments( [
|
616 |
+
'settings' => $settings,
|
617 |
+
'entry' => $entry,
|
618 |
+
'form' => $form,
|
619 |
+
] );
|
620 |
$settings = $args['settings'];
|
621 |
|
622 |
return $this->load( 'core_template_styles', [ 'settings' => $settings ], false );
|
src/view/View_Settings.php
CHANGED
@@ -16,7 +16,7 @@ use Psr\Log\LoggerInterface;
|
|
16 |
* Settings View
|
17 |
*
|
18 |
* @package Gravity PDF
|
19 |
-
* @copyright Copyright (c)
|
20 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
21 |
* @since 4.0
|
22 |
*/
|
@@ -29,7 +29,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
29 |
/*
|
30 |
This file is part of Gravity PDF.
|
31 |
|
32 |
-
Gravity PDF – Copyright (C)
|
33 |
|
34 |
This program is free software; you can redistribute it and/or modify
|
35 |
it under the terms of the GNU General Public License as published by
|
@@ -249,10 +249,6 @@ class View_Settings extends Helper_Abstract_View {
|
|
249 |
'gf' => $this->gform->get_version(),
|
250 |
];
|
251 |
|
252 |
-
$this->log->addNotice( 'System Status', [
|
253 |
-
'status' => $vars,
|
254 |
-
] );
|
255 |
-
|
256 |
/* load the system status view */
|
257 |
$this->load( 'system_status', $vars );
|
258 |
}
|
16 |
* Settings View
|
17 |
*
|
18 |
* @package Gravity PDF
|
19 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
20 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
21 |
* @since 4.0
|
22 |
*/
|
29 |
/*
|
30 |
This file is part of Gravity PDF.
|
31 |
|
32 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
33 |
|
34 |
This program is free software; you can redistribute it and/or modify
|
35 |
it under the terms of the GNU General Public License as published by
|
249 |
'gf' => $this->gform->get_version(),
|
250 |
];
|
251 |
|
|
|
|
|
|
|
|
|
252 |
/* load the system status view */
|
253 |
$this->load( 'system_status', $vars );
|
254 |
}
|
src/view/View_Shortcodes.php
CHANGED
@@ -8,7 +8,7 @@ use GFPDF\Helper\Helper_Abstract_View;
|
|
8 |
* Shortcode View
|
9 |
*
|
10 |
* @package Gravity PDF
|
11 |
-
* @copyright Copyright (c)
|
12 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
* @since 4.0
|
14 |
*/
|
@@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
21 |
/*
|
22 |
This file is part of Gravity PDF.
|
23 |
|
24 |
-
Gravity PDF – Copyright (C)
|
25 |
|
26 |
This program is free software; you can redistribute it and/or modify
|
27 |
it under the terms of the GNU General Public License as published by
|
8 |
* Shortcode View
|
9 |
*
|
10 |
* @package Gravity PDF
|
11 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
12 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
13 |
* @since 4.0
|
14 |
*/
|
21 |
/*
|
22 |
This file is part of Gravity PDF.
|
23 |
|
24 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
25 |
|
26 |
This program is free software; you can redistribute it and/or modify
|
27 |
it under the terms of the GNU General Public License as published by
|
src/view/View_Welcome_Screen.php
CHANGED
@@ -9,7 +9,7 @@ use GFPDF\Helper\Helper_Abstract_Form;
|
|
9 |
* Welcome Screen View
|
10 |
*
|
11 |
* @package Gravity PDF
|
12 |
-
* @copyright Copyright (c)
|
13 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
14 |
* @since 4.0
|
15 |
*/
|
@@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
22 |
/*
|
23 |
This file is part of Gravity PDF.
|
24 |
|
25 |
-
Gravity PDF – Copyright (C)
|
26 |
|
27 |
This program is free software; you can redistribute it and/or modify
|
28 |
it under the terms of the GNU General Public License as published by
|
9 |
* Welcome Screen View
|
10 |
*
|
11 |
* @package Gravity PDF
|
12 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
13 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
14 |
* @since 4.0
|
15 |
*/
|
22 |
/*
|
23 |
This file is part of Gravity PDF.
|
24 |
|
25 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
26 |
|
27 |
This program is free software; you can redistribute it and/or modify
|
28 |
it under the terms of the GNU General Public License as published by
|
src/view/html/Actions/action_buttons.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* The Dismisal Button
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
-
* @copyright Copyright (c)
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
-
Gravity PDF – Copyright (C)
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
4 |
* The Dismisal Button
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
src/view/html/Actions/begin_multisite_migration.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* The start of the multisite migration
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
-
* @copyright Copyright (c)
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
-
Gravity PDF – Copyright (C)
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
4 |
* The start of the multisite migration
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
src/view/html/Actions/end_multisite_migration.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* The start of the multisite migration
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
-
* @copyright Copyright (c)
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
@@ -17,7 +17,7 @@ if (! defined('ABSPATH')) {
|
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
-
Gravity PDF – Copyright (C)
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
4 |
* The start of the multisite migration
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
src/view/html/Actions/migration.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* The Review Plugin Notice
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
-
* @copyright Copyright (c)
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
-
Gravity PDF – Copyright (C)
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
4 |
* The Review Plugin Notice
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
src/view/html/Actions/review_plugin.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* The Review Plugin Notice
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
-
* @copyright Copyright (c)
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
-
Gravity PDF – Copyright (C)
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
4 |
* The Review Plugin Notice
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
src/view/html/FormSettings/add_edit.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* The Add/Edit Form Settings View
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
-
* @copyright Copyright (c)
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
-
Gravity PDF – Copyright (C)
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
@@ -44,6 +44,7 @@ global $wp_settings_fields;
|
|
44 |
<?php GFCommon::gf_vars(); ?>
|
45 |
var form = <?php echo json_encode( $args['form'] ); ?>;
|
46 |
var gfpdf_current_pdf = <?php echo json_encode( $args['pdf'] ); ?>;
|
|
|
47 |
|
48 |
<?php GFFormSettings::output_field_scripts(); ?>
|
49 |
</script>
|
@@ -103,7 +104,6 @@ global $wp_settings_fields;
|
|
103 |
<table id="pdf-form-settings" class="form-table">
|
104 |
<?php do_settings_fields( 'gfpdf_settings_form_settings', 'gfpdf_settings_form_settings' ); ?>
|
105 |
</table>
|
106 |
-
|
107 |
</div>
|
108 |
|
109 |
<!-- display appearance fields -->
|
@@ -130,6 +130,11 @@ global $wp_settings_fields;
|
|
130 |
</table>
|
131 |
</div>
|
132 |
|
|
|
|
|
|
|
|
|
|
|
133 |
|
134 |
<p class="submit">
|
135 |
<input class="button-primary" type="submit" value="<?php echo $args['button_label']; ?>" name="save"/>
|
4 |
* The Add/Edit Form Settings View
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
44 |
<?php GFCommon::gf_vars(); ?>
|
45 |
var form = <?php echo json_encode( $args['form'] ); ?>;
|
46 |
var gfpdf_current_pdf = <?php echo json_encode( $args['pdf'] ); ?>;
|
47 |
+
var entry_meta = <?php echo json_encode( $args['entry_meta'] ); ?>;
|
48 |
|
49 |
<?php GFFormSettings::output_field_scripts(); ?>
|
50 |
</script>
|
104 |
<table id="pdf-form-settings" class="form-table">
|
105 |
<?php do_settings_fields( 'gfpdf_settings_form_settings', 'gfpdf_settings_form_settings' ); ?>
|
106 |
</table>
|
|
|
107 |
</div>
|
108 |
|
109 |
<!-- display appearance fields -->
|
130 |
</table>
|
131 |
</div>
|
132 |
|
133 |
+
<div class="extensions-upsell">
|
134 |
+
<a href="https://gravitypdf.com/extension-shop/">
|
135 |
+
<?php esc_html_e( 'Want more features? See the Extension Shop.', 'gravity-forms-pdf-extended' ); ?>
|
136 |
+
</a>
|
137 |
+
</div>
|
138 |
|
139 |
<p class="submit">
|
140 |
<input class="button-primary" type="submit" value="<?php echo $args['button_label']; ?>" name="save"/>
|
src/view/html/FormSettings/list.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* List of Form Settings View
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
-
* @copyright Copyright (c)
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
-
Gravity PDF – Copyright (C)
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
4 |
* List of Form Settings View
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
src/view/html/PDF/core_template_styles.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* The styles needed to display our core PDF styles like header, footer, font and colour
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
-
* @copyright Copyright (c)
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
-
Gravity PDF – Copyright (C)
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
@@ -132,7 +132,7 @@ $include_product_styles = apply_filters( 'gfpdf_include_product_styles', tru
|
|
132 |
/* Product Field Styles */
|
133 |
<?php if ( $include_product_styles ) : ?>
|
134 |
table.entry-products th {
|
135 |
-
background-color: <?php echo $contrast_background_color;
|
136 |
border-bottom: 1px solid <?php echo $contrast_border_color; ?>;
|
137 |
border-right: 1px solid <?php echo $contrast_border_color; ?> !important;
|
138 |
}
|
@@ -175,7 +175,8 @@ $include_product_styles = apply_filters( 'gfpdf_include_product_styles', tru
|
|
175 |
padding-top: 7px;
|
176 |
}
|
177 |
|
178 |
-
|
|
|
179 |
text-align: right;
|
180 |
}
|
181 |
<?php endif; ?>
|
4 |
* The styles needed to display our core PDF styles like header, footer, font and colour
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
132 |
/* Product Field Styles */
|
133 |
<?php if ( $include_product_styles ) : ?>
|
134 |
table.entry-products th {
|
135 |
+
background-color: <?php echo $contrast_background_color; ?>;
|
136 |
border-bottom: 1px solid <?php echo $contrast_border_color; ?>;
|
137 |
border-right: 1px solid <?php echo $contrast_border_color; ?> !important;
|
138 |
}
|
175 |
padding-top: 7px;
|
176 |
}
|
177 |
|
178 |
+
table.entry-products td.totals,
|
179 |
+
table.entry-products .textright {
|
180 |
text-align: right;
|
181 |
}
|
182 |
<?php endif; ?>
|
src/view/html/PDF/entry_detailed_pdf.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* The "View PDF" link for the entry list page
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
-
* @copyright Copyright (c)
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
-
Gravity PDF – Copyright (C)
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
4 |
* The "View PDF" link for the entry list page
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
src/view/html/PDF/entry_list_pdf_multiple.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* The "View PDF" link for the entry list page
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
-
* @copyright Copyright (c)
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
-
Gravity PDF – Copyright (C)
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
4 |
* The "View PDF" link for the entry list page
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
src/view/html/PDF/entry_list_pdf_single.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* The "View PDF" link for the entry list page
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
-
* @copyright Copyright (c)
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
-
Gravity PDF – Copyright (C)
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
4 |
* The "View PDF" link for the entry list page
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
src/view/html/PDF/form_title.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* The HTML mark-up needed to display our core PDF title
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
-
* @copyright Copyright (c)
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
-
Gravity PDF – Copyright (C)
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
4 |
* The HTML mark-up needed to display our core PDF title
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
src/view/html/PDF/page_title.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* The HTML mark-up to display our core PDF page
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
-
* @copyright Copyright (c)
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
-
Gravity PDF – Copyright (C)
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
@@ -37,7 +37,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
37 |
?>
|
38 |
|
39 |
<div class="row-separator">
|
40 |
-
<h3 class="gfpdf-page gfpdf-field">
|
41 |
<?php echo $form['pagination']['pages'][ $page ]; ?>
|
42 |
</h3>
|
43 |
</div>
|
4 |
* The HTML mark-up to display our core PDF page
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
37 |
?>
|
38 |
|
39 |
<div class="row-separator">
|
40 |
+
<h3 class="gfpdf-page gfpdf-field <?php echo $classes; ?>">
|
41 |
<?php echo $form['pagination']['pages'][ $page ]; ?>
|
42 |
</h3>
|
43 |
</div>
|
src/view/html/Settings/extensions.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Extensions Settings View
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
-
* @copyright Copyright (c)
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
-
Gravity PDF – Copyright (C)
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
4 |
* Extensions Settings View
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
src/view/html/Settings/general.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* General Settings View
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
-
* @copyright Copyright (c)
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
-
Gravity PDF – Copyright (C)
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
@@ -74,6 +74,12 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
74 |
submit_button();
|
75 |
}
|
76 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
</form>
|
78 |
|
79 |
<?php
|
4 |
* General Settings View
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
74 |
submit_button();
|
75 |
}
|
76 |
?>
|
77 |
+
|
78 |
+
<div class="extensions-upsell">
|
79 |
+
<a href="https://gravitypdf.com/extension-shop/">
|
80 |
+
<?php esc_html_e( 'Want more features? Take a look at our Extension Shop.', 'gravity-forms-pdf-extended' ); ?>
|
81 |
+
</a>
|
82 |
+
</div>
|
83 |
</form>
|
84 |
|
85 |
<?php
|
src/view/html/Settings/help.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Help Settings View
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
-
* @copyright Copyright (c)
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
-
Gravity PDF – Copyright (C)
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
@@ -45,7 +45,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
45 |
|
46 |
<div class="about-text">
|
47 |
<?php esc_html_e( 'This is your portal to find quality help, support and documentation for Gravity PDF', 'gravity-forms-pdf-extended' ); ?>
|
48 |
-
<div class="about-text-disclaimer"><?php printf( esc_html__( '(This is not the place to get Gravity Forms support. %sPlease use their official support channel%s for assistance)', 'gravity-forms-pdf-extended' ), '<a href="https://www.
|
49 |
</div>
|
50 |
|
51 |
<div id="search-knowledgebase">
|
@@ -86,18 +86,22 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
86 |
</a>
|
87 |
</div>
|
88 |
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
<?php esc_html_e( '
|
93 |
-
|
94 |
-
|
95 |
|
96 |
<div class="postbox-container">
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
|
|
|
|
|
|
|
|
101 |
</div>
|
102 |
</div>
|
103 |
|
4 |
* Help Settings View
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
45 |
|
46 |
<div class="about-text">
|
47 |
<?php esc_html_e( 'This is your portal to find quality help, support and documentation for Gravity PDF', 'gravity-forms-pdf-extended' ); ?>
|
48 |
+
<div class="about-text-disclaimer"><?php printf( esc_html__( '(This is not the place to get Gravity Forms support. %sPlease use their official support channel%s for assistance. Using the search box below will search gravitypdf.com for results.)', 'gravity-forms-pdf-extended' ), '<a href="https://www.gravityforms.com/support/">', '</a>' ); ?></div>
|
49 |
</div>
|
50 |
|
51 |
<div id="search-knowledgebase">
|
86 |
</a>
|
87 |
</div>
|
88 |
|
89 |
+
<div class="postbox-container">
|
90 |
+
<a href="https://gravitypdf.com/documentation/v4/developer-start-customising/">
|
91 |
+
<span><?php esc_html_e( 'Developer Documentation', 'gravity-forms-pdf-extended' ); ?></span><br>
|
92 |
+
<?php esc_html_e( 'You’ll find all the info and examples you’ll need to create your own custom PDF templates.', 'gravity-forms-pdf-extended' ); ?>
|
93 |
+
</a>
|
94 |
+
</div>
|
95 |
|
96 |
<div class="postbox-container">
|
97 |
+
<strong><?php esc_html_e( 'Common Questions', 'gravity-forms-pdf-extended' ); ?></strong><br>
|
98 |
+
<ul>
|
99 |
+
<li><a href="https://gravitypdf.com/documentation/v4/user-setup-pdf/">How do I setup a PDF on my form?</a></li>
|
100 |
+
<li><a href="https://gravitypdf.com/documentation/v4/user-setup-pdf/#notifications">How do you attach the PDF to a notification email?</a></li>
|
101 |
+
<li><a href="https://gravitypdf.com/documentation/v4/user-shortcodes/">How do you add a PDF download link to the form's confirmation page?</a></li>
|
102 |
+
<li><a href="https://gravitypdf.com/documentation/v4/user-managing-pdfs/">How can I add two or more PDFs to a single form?</a></li>
|
103 |
+
<li><a href="https://gravitypdf.com/documentation/v4/gravityview-support/">How can I allow logged in users to download their past PDFs?</a></li>
|
104 |
+
</ul>
|
105 |
</div>
|
106 |
</div>
|
107 |
|
src/view/html/Settings/license.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* License Settings View
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
-
* @copyright Copyright (c)
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.2
|
10 |
*/
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
-
Gravity PDF – Copyright (C)
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
@@ -66,7 +66,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
66 |
</form>
|
67 |
|
68 |
<em>
|
69 |
-
– <?php esc_html_e( 'By
|
70 |
</em>
|
71 |
|
72 |
<?php
|
4 |
* License Settings View
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.2
|
10 |
*/
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
66 |
</form>
|
67 |
|
68 |
<em>
|
69 |
+
– <?php esc_html_e( 'By installing a Gravity PDF extension you are automatically giving permission for us to periodically poll GravityPDF.com via HTTPS for your current license status and any new plugin updates. The only personal data sent is your website domain name and license key. To opt-out you will need to deactivate all Gravity PDF extensions.', 'gravity-forms-pdf-extended' ); ?>
|
70 |
</em>
|
71 |
|
72 |
<?php
|
src/view/html/Settings/system_status.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* System Status Settings View
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
-
* @copyright Copyright (c)
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*
|
@@ -18,7 +18,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
18 |
/*
|
19 |
This file is part of Gravity PDF.
|
20 |
|
21 |
-
Gravity PDF – Copyright (C)
|
22 |
|
23 |
This program is free software; you can redistribute it and/or modify
|
24 |
it under the terms of the GNU General Public License as published by
|
4 |
* System Status Settings View
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*
|
18 |
/*
|
19 |
This file is part of Gravity PDF.
|
20 |
|
21 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
22 |
|
23 |
This program is free software; you can redistribute it and/or modify
|
24 |
it under the terms of the GNU General Public License as published by
|
src/view/html/Settings/tabs.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Navigation Settings View
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
-
* @copyright Copyright (c)
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
-
Gravity PDF – Copyright (C)
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
4 |
* Navigation Settings View
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
src/view/html/Settings/tools.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Tools Settings View
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
-
* @copyright Copyright (c)
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
-
Gravity PDF – Copyright (C)
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
4 |
* Tools Settings View
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
src/view/html/Settings/uninstaller.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Uninstaller Settings View
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
-
* @copyright Copyright (c)
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
-
Gravity PDF – Copyright (C)
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
4 |
* Uninstaller Settings View
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
src/view/html/Shortcodes/conditional_logic_not_met.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* PDF Conditional Logic not met
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
-
* @copyright Copyright (c)
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
-
Gravity PDF – Copyright (C)
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
4 |
* PDF Conditional Logic not met
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
src/view/html/Shortcodes/gravitypdf.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* The [gravitypdf] shortcode output
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
-
* @copyright Copyright (c)
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
-
Gravity PDF – Copyright (C)
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
4 |
* The [gravitypdf] shortcode output
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
src/view/html/Shortcodes/invalid_pdf_config.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* No Entry ID for Shortcode
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
-
* @copyright Copyright (c)
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
-
Gravity PDF – Copyright (C)
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
4 |
* No Entry ID for Shortcode
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
src/view/html/Shortcodes/no_entry_id.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* No Entry ID for Shortcode
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
-
* @copyright Copyright (c)
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
-
Gravity PDF – Copyright (C)
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
4 |
* No Entry ID for Shortcode
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
src/view/html/Shortcodes/pdf_not_active.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* PDF is not active.
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
-
* @copyright Copyright (c)
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
-
Gravity PDF – Copyright (C)
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
4 |
* PDF is not active.
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
src/view/html/Welcome/more.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Common welcome and update screen content
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
-
* @copyright Copyright (c)
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
-
Gravity PDF – Copyright (C)
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
@@ -46,31 +46,35 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
46 |
|
47 |
<h4><?php esc_html_e( 'PDF Template Shop', 'gravity-forms-pdf-extended' ); ?></h4>
|
48 |
|
49 |
-
<p><?php printf( esc_html__( "It's like a theme shop, but for Gravity PDF templates. %sHead over to our online store%s and view our growing selection of premium PDF templates.", 'gravity-forms-pdf-extended' ), '<a href="https://gravitypdf.com/shop/">', '</a>' ); ?></p>
|
50 |
|
51 |
-
|
52 |
|
53 |
-
|
54 |
|
55 |
</div>
|
56 |
|
57 |
<div class="col gfpdf-breakdown">
|
58 |
|
59 |
-
|
60 |
|
61 |
-
|
62 |
|
63 |
-
|
64 |
|
65 |
-
|
66 |
|
67 |
</div>
|
68 |
|
69 |
<div class="col gfpdf-breakdown last-feature">
|
70 |
|
71 |
-
|
72 |
|
73 |
-
|
|
|
|
|
|
|
|
|
74 |
|
75 |
</div>
|
76 |
|
4 |
* Common welcome and update screen content
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
46 |
|
47 |
<h4><?php esc_html_e( 'PDF Template Shop', 'gravity-forms-pdf-extended' ); ?></h4>
|
48 |
|
49 |
+
<p><?php printf( esc_html__( "It's like a theme shop, but for Gravity PDF templates. %sHead over to our online store%s and view our growing selection of premium PDF templates.", 'gravity-forms-pdf-extended' ), '<a href="https://gravitypdf.com/template-shop/">', '</a>' ); ?></p>
|
50 |
|
51 |
+
<h4><?php esc_html_e( 'Roll your Own', 'gravity-forms-pdf-extended' ); ?></h4>
|
52 |
|
53 |
+
<p><?php printf( esc_html__( "If PHP, HTML and CSS come easy to you, you'll find creating your own PDF templates a breeze. With %sextensive documentation and great examples%s you'll be up and running in no time.", 'gravity-forms-pdf-extended' ), '<a href="https://gravitypdf.com/documentation/v4/developer-start-customising/">', '</a>' ); ?></p>
|
54 |
|
55 |
</div>
|
56 |
|
57 |
<div class="col gfpdf-breakdown">
|
58 |
|
59 |
+
<h4>PDF Extension Shop</h4>
|
60 |
|
61 |
+
<p><?php printf( esc_html__( "If you're looking to enhance Gravity PDF %sour Extension Shop is your first port of call%s. Advanced functionality will be at your fingertips with a premium Gravity PDF extension.", 'gravity-forms-pdf-extended' ), '<a href="https://gravitypdf.com/extension-shop/">', '</a>' ); ?></p>
|
62 |
|
63 |
+
<h4><?php esc_html_e( 'Stay Up To Date', 'gravity-forms-pdf-extended' ); ?></h4>
|
64 |
|
65 |
+
<p><?php printf( esc_html__( '%sSign up to our newsletter%s to be amongst the first to receive the latest news and details on upcoming feature.', 'gravity-forms-pdf-extended' ), '<a href="https://gravitypdf.com/#signup-top">', '</a>' ); ?></p>
|
66 |
|
67 |
</div>
|
68 |
|
69 |
<div class="col gfpdf-breakdown last-feature">
|
70 |
|
71 |
+
<h4><?php esc_html_e( 'Tailored PDFs', 'gravity-forms-pdf-extended' ); ?></h4>
|
72 |
|
73 |
+
<p><?php printf( esc_html__( "If the PDF Shop doesn't have what you're after %sour friendly team can build a document just for you%s. With an addon, our devs can even create templates that auto fill existing PDFs – like government and legal documents.", 'gravity-forms-pdf-extended' ), '<a href="https://gravitypdf.com/integration-services/">', '</a>' ); ?></p>
|
74 |
+
|
75 |
+
<h4><?php esc_html_e( 'Get Support', 'gravity-forms-pdf-extended' ); ?></h4>
|
76 |
+
|
77 |
+
<p><?php printf( esc_html__( 'Have trouble using Gravity PDF? %sContact our friendly staff%s who are avaliable 9am to 5pm Monday to Friday, %sAustralian Eastern Standard Time%s.', 'gravity-forms-pdf-extended' ), '<a href="https://gravitypdf.com/support/">', '</a>', '<a href="http://www.timeanddate.com/worldclock/australia/sydney">', '</a>' ); ?></p>
|
78 |
|
79 |
</div>
|
80 |
|
src/view/html/Welcome/welcome.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Getting Started - Welcome Screen View
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
-
* @copyright Copyright (c)
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
-
Gravity PDF – Copyright (C)
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
4 |
* Getting Started - Welcome Screen View
|
5 |
*
|
6 |
* @package Gravity PDF
|
7 |
+
* @copyright Copyright (c) 2018, Blue Liquid Designs
|
8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
* @since 4.0
|
10 |
*/
|
17 |
/*
|
18 |
This file is part of Gravity PDF.
|
19 |
|
20 |
+
Gravity PDF – Copyright (C) 2018, Blue Liquid Designs
|
21 |
|
22 |
This program is free software; you can redistribute it and/or modify
|
23 |
it under the terms of the GNU General Public License as published by
|
vendor/composer/autoload_classmap.php
CHANGED
@@ -27,6 +27,7 @@ return array(
|
|
27 |
'GFPDF\\Controller\\Controller_Templates' => $baseDir . '/src/controller/Controller_Templates.php',
|
28 |
'GFPDF\\Controller\\Controller_Welcome_Screen' => $baseDir . '/src/controller/Controller_Welcome_Screen.php',
|
29 |
'GFPDF\\Helper\\Fields\\Field_Address' => $baseDir . '/src/helper/fields/Field_Address.php',
|
|
|
30 |
'GFPDF\\Helper\\Fields\\Field_Checkbox' => $baseDir . '/src/helper/fields/Field_Checkbox.php',
|
31 |
'GFPDF\\Helper\\Fields\\Field_Coupon' => $baseDir . '/src/helper/fields/Field_Coupon.php',
|
32 |
'GFPDF\\Helper\\Fields\\Field_CreditCard' => $baseDir . '/src/helper/fields/Field_Creditcard.php',
|
@@ -151,6 +152,7 @@ return array(
|
|
151 |
'Monolog\\Formatter\\ChromePHPFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php',
|
152 |
'Monolog\\Formatter\\ElasticaFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php',
|
153 |
'Monolog\\Formatter\\FlowdockFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php',
|
|
|
154 |
'Monolog\\Formatter\\FormatterInterface' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php',
|
155 |
'Monolog\\Formatter\\GelfMessageFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php',
|
156 |
'Monolog\\Formatter\\HtmlFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php',
|
@@ -172,6 +174,7 @@ return array(
|
|
172 |
'Monolog\\Handler\\CouchDBHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php',
|
173 |
'Monolog\\Handler\\CubeHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/CubeHandler.php',
|
174 |
'Monolog\\Handler\\Curl\\Util' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/Curl/Util.php',
|
|
|
175 |
'Monolog\\Handler\\DoctrineCouchDBHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php',
|
176 |
'Monolog\\Handler\\DynamoDbHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php',
|
177 |
'Monolog\\Handler\\ElasticSearchHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php',
|
@@ -187,6 +190,7 @@ return array(
|
|
187 |
'Monolog\\Handler\\GelfHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/GelfHandler.php',
|
188 |
'Monolog\\Handler\\GroupHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/GroupHandler.php',
|
189 |
'Monolog\\Handler\\HandlerInterface' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/HandlerInterface.php',
|
|
|
190 |
'Monolog\\Handler\\HipChatHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/HipChatHandler.php',
|
191 |
'Monolog\\Handler\\IFTTTHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php',
|
192 |
'Monolog\\Handler\\LogEntriesHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php',
|
@@ -207,6 +211,9 @@ return array(
|
|
207 |
'Monolog\\Handler\\RotatingFileHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php',
|
208 |
'Monolog\\Handler\\SamplingHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SamplingHandler.php',
|
209 |
'Monolog\\Handler\\SlackHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SlackHandler.php',
|
|
|
|
|
|
|
210 |
'Monolog\\Handler\\SocketHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SocketHandler.php',
|
211 |
'Monolog\\Handler\\StreamHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/StreamHandler.php',
|
212 |
'Monolog\\Handler\\SwiftMailerHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php',
|
@@ -222,6 +229,7 @@ return array(
|
|
222 |
'Monolog\\Processor\\MemoryPeakUsageProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php',
|
223 |
'Monolog\\Processor\\MemoryProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php',
|
224 |
'Monolog\\Processor\\MemoryUsageProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php',
|
|
|
225 |
'Monolog\\Processor\\ProcessIdProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php',
|
226 |
'Monolog\\Processor\\PsrLogMessageProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php',
|
227 |
'Monolog\\Processor\\TagProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/TagProcessor.php',
|
27 |
'GFPDF\\Controller\\Controller_Templates' => $baseDir . '/src/controller/Controller_Templates.php',
|
28 |
'GFPDF\\Controller\\Controller_Welcome_Screen' => $baseDir . '/src/controller/Controller_Welcome_Screen.php',
|
29 |
'GFPDF\\Helper\\Fields\\Field_Address' => $baseDir . '/src/helper/fields/Field_Address.php',
|
30 |
+
'GFPDF\\Helper\\Fields\\Field_Chainedselect' => $baseDir . '/src/helper/fields/Field_Chainedselect.php',
|
31 |
'GFPDF\\Helper\\Fields\\Field_Checkbox' => $baseDir . '/src/helper/fields/Field_Checkbox.php',
|
32 |
'GFPDF\\Helper\\Fields\\Field_Coupon' => $baseDir . '/src/helper/fields/Field_Coupon.php',
|
33 |
'GFPDF\\Helper\\Fields\\Field_CreditCard' => $baseDir . '/src/helper/fields/Field_Creditcard.php',
|
152 |
'Monolog\\Formatter\\ChromePHPFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php',
|
153 |
'Monolog\\Formatter\\ElasticaFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php',
|
154 |
'Monolog\\Formatter\\FlowdockFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php',
|
155 |
+
'Monolog\\Formatter\\FluentdFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php',
|
156 |
'Monolog\\Formatter\\FormatterInterface' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php',
|
157 |
'Monolog\\Formatter\\GelfMessageFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php',
|
158 |
'Monolog\\Formatter\\HtmlFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php',
|
174 |
'Monolog\\Handler\\CouchDBHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php',
|
175 |
'Monolog\\Handler\\CubeHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/CubeHandler.php',
|
176 |
'Monolog\\Handler\\Curl\\Util' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/Curl/Util.php',
|
177 |
+
'Monolog\\Handler\\DeduplicationHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php',
|
178 |
'Monolog\\Handler\\DoctrineCouchDBHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php',
|
179 |
'Monolog\\Handler\\DynamoDbHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php',
|
180 |
'Monolog\\Handler\\ElasticSearchHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php',
|
190 |
'Monolog\\Handler\\GelfHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/GelfHandler.php',
|
191 |
'Monolog\\Handler\\GroupHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/GroupHandler.php',
|
192 |
'Monolog\\Handler\\HandlerInterface' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/HandlerInterface.php',
|
193 |
+
'Monolog\\Handler\\HandlerWrapper' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php',
|
194 |
'Monolog\\Handler\\HipChatHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/HipChatHandler.php',
|
195 |
'Monolog\\Handler\\IFTTTHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php',
|
196 |
'Monolog\\Handler\\LogEntriesHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php',
|
211 |
'Monolog\\Handler\\RotatingFileHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php',
|
212 |
'Monolog\\Handler\\SamplingHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SamplingHandler.php',
|
213 |
'Monolog\\Handler\\SlackHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SlackHandler.php',
|
214 |
+
'Monolog\\Handler\\SlackWebhookHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php',
|
215 |
+
'Monolog\\Handler\\Slack\\SlackRecord' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php',
|
216 |
+
'Monolog\\Handler\\SlackbotHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php',
|
217 |
'Monolog\\Handler\\SocketHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SocketHandler.php',
|
218 |
'Monolog\\Handler\\StreamHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/StreamHandler.php',
|
219 |
'Monolog\\Handler\\SwiftMailerHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php',
|
229 |
'Monolog\\Processor\\MemoryPeakUsageProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php',
|
230 |
'Monolog\\Processor\\MemoryProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php',
|
231 |
'Monolog\\Processor\\MemoryUsageProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php',
|
232 |
+
'Monolog\\Processor\\MercurialProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php',
|
233 |
'Monolog\\Processor\\ProcessIdProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php',
|
234 |
'Monolog\\Processor\\PsrLogMessageProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php',
|
235 |
'Monolog\\Processor\\TagProcessor' => $vendorDir . '/monolog/monolog/src/Monolog/Processor/TagProcessor.php',
|
vendor/composer/autoload_static.php
CHANGED
@@ -122,6 +122,7 @@ class ComposerStaticInitGravityPDFPlugin
|
|
122 |
'GFPDF\\Controller\\Controller_Templates' => __DIR__ . '/../..' . '/src/controller/Controller_Templates.php',
|
123 |
'GFPDF\\Controller\\Controller_Welcome_Screen' => __DIR__ . '/../..' . '/src/controller/Controller_Welcome_Screen.php',
|
124 |
'GFPDF\\Helper\\Fields\\Field_Address' => __DIR__ . '/../..' . '/src/helper/fields/Field_Address.php',
|
|
|
125 |
'GFPDF\\Helper\\Fields\\Field_Checkbox' => __DIR__ . '/../..' . '/src/helper/fields/Field_Checkbox.php',
|
126 |
'GFPDF\\Helper\\Fields\\Field_Coupon' => __DIR__ . '/../..' . '/src/helper/fields/Field_Coupon.php',
|
127 |
'GFPDF\\Helper\\Fields\\Field_CreditCard' => __DIR__ . '/../..' . '/src/helper/fields/Field_Creditcard.php',
|
@@ -246,6 +247,7 @@ class ComposerStaticInitGravityPDFPlugin
|
|
246 |
'Monolog\\Formatter\\ChromePHPFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php',
|
247 |
'Monolog\\Formatter\\ElasticaFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php',
|
248 |
'Monolog\\Formatter\\FlowdockFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php',
|
|
|
249 |
'Monolog\\Formatter\\FormatterInterface' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php',
|
250 |
'Monolog\\Formatter\\GelfMessageFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php',
|
251 |
'Monolog\\Formatter\\HtmlFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php',
|
@@ -267,6 +269,7 @@ class ComposerStaticInitGravityPDFPlugin
|
|
267 |
'Monolog\\Handler\\CouchDBHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php',
|
268 |
'Monolog\\Handler\\CubeHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/CubeHandler.php',
|
269 |
'Monolog\\Handler\\Curl\\Util' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/Curl/Util.php',
|
|
|
270 |
'Monolog\\Handler\\DoctrineCouchDBHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php',
|
271 |
'Monolog\\Handler\\DynamoDbHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php',
|
272 |
'Monolog\\Handler\\ElasticSearchHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php',
|
@@ -282,6 +285,7 @@ class ComposerStaticInitGravityPDFPlugin
|
|
282 |
'Monolog\\Handler\\GelfHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/GelfHandler.php',
|
283 |
'Monolog\\Handler\\GroupHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/GroupHandler.php',
|
284 |
'Monolog\\Handler\\HandlerInterface' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/HandlerInterface.php',
|
|
|
285 |
'Monolog\\Handler\\HipChatHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/HipChatHandler.php',
|
286 |
'Monolog\\Handler\\IFTTTHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php',
|
287 |
'Monolog\\Handler\\LogEntriesHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php',
|
@@ -302,6 +306,9 @@ class ComposerStaticInitGravityPDFPlugin
|
|
302 |
'Monolog\\Handler\\RotatingFileHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php',
|
303 |
'Monolog\\Handler\\SamplingHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SamplingHandler.php',
|
304 |
'Monolog\\Handler\\SlackHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SlackHandler.php',
|
|
|
|
|
|
|
305 |
'Monolog\\Handler\\SocketHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SocketHandler.php',
|
306 |
'Monolog\\Handler\\StreamHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/StreamHandler.php',
|
307 |
'Monolog\\Handler\\SwiftMailerHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php',
|
@@ -317,6 +324,7 @@ class ComposerStaticInitGravityPDFPlugin
|
|
317 |
'Monolog\\Processor\\MemoryPeakUsageProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php',
|
318 |
'Monolog\\Processor\\MemoryProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php',
|
319 |
'Monolog\\Processor\\MemoryUsageProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php',
|
|
|
320 |
'Monolog\\Processor\\ProcessIdProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php',
|
321 |
'Monolog\\Processor\\PsrLogMessageProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php',
|
322 |
'Monolog\\Processor\\TagProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/TagProcessor.php',
|
122 |
'GFPDF\\Controller\\Controller_Templates' => __DIR__ . '/../..' . '/src/controller/Controller_Templates.php',
|
123 |
'GFPDF\\Controller\\Controller_Welcome_Screen' => __DIR__ . '/../..' . '/src/controller/Controller_Welcome_Screen.php',
|
124 |
'GFPDF\\Helper\\Fields\\Field_Address' => __DIR__ . '/../..' . '/src/helper/fields/Field_Address.php',
|
125 |
+
'GFPDF\\Helper\\Fields\\Field_Chainedselect' => __DIR__ . '/../..' . '/src/helper/fields/Field_Chainedselect.php',
|
126 |
'GFPDF\\Helper\\Fields\\Field_Checkbox' => __DIR__ . '/../..' . '/src/helper/fields/Field_Checkbox.php',
|
127 |
'GFPDF\\Helper\\Fields\\Field_Coupon' => __DIR__ . '/../..' . '/src/helper/fields/Field_Coupon.php',
|
128 |
'GFPDF\\Helper\\Fields\\Field_CreditCard' => __DIR__ . '/../..' . '/src/helper/fields/Field_Creditcard.php',
|
247 |
'Monolog\\Formatter\\ChromePHPFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php',
|
248 |
'Monolog\\Formatter\\ElasticaFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php',
|
249 |
'Monolog\\Formatter\\FlowdockFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php',
|
250 |
+
'Monolog\\Formatter\\FluentdFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php',
|
251 |
'Monolog\\Formatter\\FormatterInterface' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php',
|
252 |
'Monolog\\Formatter\\GelfMessageFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php',
|
253 |
'Monolog\\Formatter\\HtmlFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php',
|
269 |
'Monolog\\Handler\\CouchDBHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php',
|
270 |
'Monolog\\Handler\\CubeHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/CubeHandler.php',
|
271 |
'Monolog\\Handler\\Curl\\Util' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/Curl/Util.php',
|
272 |
+
'Monolog\\Handler\\DeduplicationHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php',
|
273 |
'Monolog\\Handler\\DoctrineCouchDBHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php',
|
274 |
'Monolog\\Handler\\DynamoDbHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php',
|
275 |
'Monolog\\Handler\\ElasticSearchHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php',
|
285 |
'Monolog\\Handler\\GelfHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/GelfHandler.php',
|
286 |
'Monolog\\Handler\\GroupHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/GroupHandler.php',
|
287 |
'Monolog\\Handler\\HandlerInterface' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/HandlerInterface.php',
|
288 |
+
'Monolog\\Handler\\HandlerWrapper' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php',
|
289 |
'Monolog\\Handler\\HipChatHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/HipChatHandler.php',
|
290 |
'Monolog\\Handler\\IFTTTHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php',
|
291 |
'Monolog\\Handler\\LogEntriesHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php',
|
306 |
'Monolog\\Handler\\RotatingFileHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php',
|
307 |
'Monolog\\Handler\\SamplingHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SamplingHandler.php',
|
308 |
'Monolog\\Handler\\SlackHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SlackHandler.php',
|
309 |
+
'Monolog\\Handler\\SlackWebhookHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php',
|
310 |
+
'Monolog\\Handler\\Slack\\SlackRecord' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php',
|
311 |
+
'Monolog\\Handler\\SlackbotHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php',
|
312 |
'Monolog\\Handler\\SocketHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SocketHandler.php',
|
313 |
'Monolog\\Handler\\StreamHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/StreamHandler.php',
|
314 |
'Monolog\\Handler\\SwiftMailerHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php',
|
324 |
'Monolog\\Processor\\MemoryPeakUsageProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php',
|
325 |
'Monolog\\Processor\\MemoryProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php',
|
326 |
'Monolog\\Processor\\MemoryUsageProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php',
|
327 |
+
'Monolog\\Processor\\MercurialProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php',
|
328 |
'Monolog\\Processor\\ProcessIdProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php',
|
329 |
'Monolog\\Processor\\PsrLogMessageProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php',
|
330 |
'Monolog\\Processor\\TagProcessor' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Processor/TagProcessor.php',
|
vendor/composer/installed.json
CHANGED
@@ -154,17 +154,17 @@
|
|
154 |
},
|
155 |
{
|
156 |
"name": "monolog/monolog",
|
157 |
-
"version": "1.
|
158 |
-
"version_normalized": "1.
|
159 |
"source": {
|
160 |
"type": "git",
|
161 |
"url": "https://github.com/Seldaek/monolog.git",
|
162 |
-
"reference": "
|
163 |
},
|
164 |
"dist": {
|
165 |
"type": "zip",
|
166 |
-
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/
|
167 |
-
"reference": "
|
168 |
"shasum": ""
|
169 |
},
|
170 |
"require": {
|
@@ -175,16 +175,17 @@
|
|
175 |
"psr/log-implementation": "1.0.0"
|
176 |
},
|
177 |
"require-dev": {
|
178 |
-
"aws/aws-sdk-php": "^2.4.9",
|
179 |
"doctrine/couchdb": "~1.0@dev",
|
180 |
"graylog2/gelf-php": "~1.0",
|
|
|
|
|
181 |
"php-console/php-console": "^3.1.3",
|
182 |
"phpunit/phpunit": "~4.5",
|
183 |
"phpunit/phpunit-mock-objects": "2.3.0",
|
184 |
-
"raven/raven": "~0.8",
|
185 |
"ruflin/elastica": ">=0.90 <3.0",
|
186 |
-
"
|
187 |
-
"
|
188 |
},
|
189 |
"suggest": {
|
190 |
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
|
@@ -192,17 +193,18 @@
|
|
192 |
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
|
193 |
"ext-mongo": "Allow sending log messages to a MongoDB server",
|
194 |
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
|
|
|
|
|
195 |
"php-console/php-console": "Allow sending log messages to Google Chrome",
|
196 |
-
"raven/raven": "Allow sending log messages to a Sentry server",
|
197 |
"rollbar/rollbar": "Allow sending log messages to Rollbar",
|
198 |
"ruflin/elastica": "Allow sending log messages to an Elastic Search server",
|
199 |
-
"
|
200 |
},
|
201 |
-
"time": "
|
202 |
"type": "library",
|
203 |
"extra": {
|
204 |
"branch-alias": {
|
205 |
-
"dev-master": "
|
206 |
}
|
207 |
},
|
208 |
"installation-source": "dist",
|
154 |
},
|
155 |
{
|
156 |
"name": "monolog/monolog",
|
157 |
+
"version": "1.23.0",
|
158 |
+
"version_normalized": "1.23.0.0",
|
159 |
"source": {
|
160 |
"type": "git",
|
161 |
"url": "https://github.com/Seldaek/monolog.git",
|
162 |
+
"reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4"
|
163 |
},
|
164 |
"dist": {
|
165 |
"type": "zip",
|
166 |
+
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd8c787753b3a2ad11bc60c063cff1358a32a3b4",
|
167 |
+
"reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4",
|
168 |
"shasum": ""
|
169 |
},
|
170 |
"require": {
|
175 |
"psr/log-implementation": "1.0.0"
|
176 |
},
|
177 |
"require-dev": {
|
178 |
+
"aws/aws-sdk-php": "^2.4.9 || ^3.0",
|
179 |
"doctrine/couchdb": "~1.0@dev",
|
180 |
"graylog2/gelf-php": "~1.0",
|
181 |
+
"jakub-onderka/php-parallel-lint": "0.9",
|
182 |
+
"php-amqplib/php-amqplib": "~2.4",
|
183 |
"php-console/php-console": "^3.1.3",
|
184 |
"phpunit/phpunit": "~4.5",
|
185 |
"phpunit/phpunit-mock-objects": "2.3.0",
|
|
|
186 |
"ruflin/elastica": ">=0.90 <3.0",
|
187 |
+
"sentry/sentry": "^0.13",
|
188 |
+
"swiftmailer/swiftmailer": "^5.3|^6.0"
|
189 |
},
|
190 |
"suggest": {
|
191 |
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
|
193 |
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
|
194 |
"ext-mongo": "Allow sending log messages to a MongoDB server",
|
195 |
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
|
196 |
+
"mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver",
|
197 |
+
"php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
|
198 |
"php-console/php-console": "Allow sending log messages to Google Chrome",
|
|
|
199 |
"rollbar/rollbar": "Allow sending log messages to Rollbar",
|
200 |
"ruflin/elastica": "Allow sending log messages to an Elastic Search server",
|
201 |
+
"sentry/sentry": "Allow sending log messages to a Sentry server"
|
202 |
},
|
203 |
+
"time": "2017-06-19T01:22:40+00:00",
|
204 |
"type": "library",
|
205 |
"extra": {
|
206 |
"branch-alias": {
|
207 |
+
"dev-master": "2.0.x-dev"
|
208 |
}
|
209 |
},
|
210 |
"installation-source": "dist",
|
vendor/monolog/monolog/.php_cs
CHANGED
@@ -1,15 +1,59 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
$
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
)
|
14 |
-
->
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$header = <<<EOF
|
4 |
+
This file is part of the Monolog package.
|
5 |
+
|
6 |
+
(c) Jordi Boggiano <j.boggiano@seld.be>
|
7 |
+
|
8 |
+
For the full copyright and license information, please view the LICENSE
|
9 |
+
file that was distributed with this source code.
|
10 |
+
EOF;
|
11 |
+
|
12 |
+
$finder = Symfony\CS\Finder::create()
|
13 |
+
->files()
|
14 |
+
->name('*.php')
|
15 |
+
->exclude('Fixtures')
|
16 |
+
->in(__DIR__.'/src')
|
17 |
+
->in(__DIR__.'/tests')
|
18 |
+
;
|
19 |
+
|
20 |
+
return Symfony\CS\Config::create()
|
21 |
+
->setUsingCache(true)
|
22 |
+
//->setUsingLinter(false)
|
23 |
+
->setRiskyAllowed(true)
|
24 |
+
->setRules(array(
|
25 |
+
'@PSR2' => true,
|
26 |
+
'binary_operator_spaces' => true,
|
27 |
+
'blank_line_before_return' => true,
|
28 |
+
'header_comment' => array('header' => $header),
|
29 |
+
'include' => true,
|
30 |
+
'long_array_syntax' => true,
|
31 |
+
'method_separation' => true,
|
32 |
+
'no_blank_lines_after_class_opening' => true,
|
33 |
+
'no_blank_lines_after_phpdoc' => true,
|
34 |
+
'no_blank_lines_between_uses' => true,
|
35 |
+
'no_duplicate_semicolons' => true,
|
36 |
+
'no_extra_consecutive_blank_lines' => true,
|
37 |
+
'no_leading_import_slash' => true,
|
38 |
+
'no_leading_namespace_whitespace' => true,
|
39 |
+
'no_trailing_comma_in_singleline_array' => true,
|
40 |
+
'no_unused_imports' => true,
|
41 |
+
'object_operator_without_whitespace' => true,
|
42 |
+
'phpdoc_align' => true,
|
43 |
+
'phpdoc_indent' => true,
|
44 |
+
'phpdoc_no_access' => true,
|
45 |
+
'phpdoc_no_package' => true,
|
46 |
+
'phpdoc_order' => true,
|
47 |
+
'phpdoc_scalar' => true,
|
48 |
+
'phpdoc_trim' => true,
|
49 |
+
'phpdoc_type_to_var' => true,
|
50 |
+
'psr0' => true,
|
51 |
+
'single_blank_line_before_namespace' => true,
|
52 |
+
'spaces_cast' => true,
|
53 |
+
'standardize_not_equals' => true,
|
54 |
+
'ternary_operator_spaces' => true,
|
55 |
+
'trailing_comma_in_multiline_array' => true,
|
56 |
+
'whitespacy_lines' => true,
|
57 |
+
))
|
58 |
+
->finder($finder)
|
59 |
+
;
|
vendor/monolog/monolog/{CHANGELOG.mdown → CHANGELOG.md}
RENAMED
@@ -1,3 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
### 1.16.0 (2015-08-09)
|
2 |
|
3 |
* Added IFTTTHandler to notify ifttt.com triggers
|
1 |
+
### 1.23.0 (2017-06-19)
|
2 |
+
|
3 |
+
* Improved SyslogUdpHandler's support for RFC5424 and added optional `$ident` argument
|
4 |
+
* Fixed GelfHandler truncation to be per field and not per message
|
5 |
+
* Fixed compatibility issue with PHP <5.3.6
|
6 |
+
* Fixed support for headless Chrome in ChromePHPHandler
|
7 |
+
* Fixed support for latest Aws SDK in DynamoDbHandler
|
8 |
+
* Fixed support for SwiftMailer 6.0+ in SwiftMailerHandler
|
9 |
+
|
10 |
+
### 1.22.1 (2017-03-13)
|
11 |
+
|
12 |
+
* Fixed lots of minor issues in the new Slack integrations
|
13 |
+
* Fixed support for allowInlineLineBreaks in LineFormatter when formatting exception backtraces
|
14 |
+
|
15 |
+
### 1.22.0 (2016-11-26)
|
16 |
+
|
17 |
+
* Added SlackbotHandler and SlackWebhookHandler to set up Slack integration more easily
|
18 |
+
* Added MercurialProcessor to add mercurial revision and branch names to log records
|
19 |
+
* Added support for AWS SDK v3 in DynamoDbHandler
|
20 |
+
* Fixed fatal errors occuring when normalizing generators that have been fully consumed
|
21 |
+
* Fixed RollbarHandler to include a level (rollbar level), monolog_level (original name), channel and datetime (unix)
|
22 |
+
* Fixed RollbarHandler not flushing records automatically, calling close() explicitly is not necessary anymore
|
23 |
+
* Fixed SyslogUdpHandler to avoid sending empty frames
|
24 |
+
* Fixed a few PHP 7.0 and 7.1 compatibility issues
|
25 |
+
|
26 |
+
### 1.21.0 (2016-07-29)
|
27 |
+
|
28 |
+
* Break: Reverted the addition of $context when the ErrorHandler handles regular php errors from 1.20.0 as it was causing issues
|
29 |
+
* Added support for more formats in RotatingFileHandler::setFilenameFormat as long as they have Y, m and d in order
|
30 |
+
* Added ability to format the main line of text the SlackHandler sends by explictly setting a formatter on the handler
|
31 |
+
* Added information about SoapFault instances in NormalizerFormatter
|
32 |
+
* Added $handleOnlyReportedErrors option on ErrorHandler::registerErrorHandler (default true) to allow logging of all errors no matter the error_reporting level
|
33 |
+
|
34 |
+
### 1.20.0 (2016-07-02)
|
35 |
+
|
36 |
+
* Added FingersCrossedHandler::activate() to manually trigger the handler regardless of the activation policy
|
37 |
+
* Added StreamHandler::getUrl to retrieve the stream's URL
|
38 |
+
* Added ability to override addRow/addTitle in HtmlFormatter
|
39 |
+
* Added the $context to context information when the ErrorHandler handles a regular php error
|
40 |
+
* Deprecated RotatingFileHandler::setFilenameFormat to only support 3 formats: Y, Y-m and Y-m-d
|
41 |
+
* Fixed WhatFailureGroupHandler to work with PHP7 throwables
|
42 |
+
* Fixed a few minor bugs
|
43 |
+
|
44 |
+
### 1.19.0 (2016-04-12)
|
45 |
+
|
46 |
+
* Break: StreamHandler will not close streams automatically that it does not own. If you pass in a stream (not a path/url), then it will not close it for you. You can retrieve those using getStream() if needed
|
47 |
+
* Added DeduplicationHandler to remove duplicate records from notifications across multiple requests, useful for email or other notifications on errors
|
48 |
+
* Added ability to use `%message%` and other LineFormatter replacements in the subject line of emails sent with NativeMailHandler and SwiftMailerHandler
|
49 |
+
* Fixed HipChatHandler handling of long messages
|
50 |
+
|
51 |
+
### 1.18.2 (2016-04-02)
|
52 |
+
|
53 |
+
* Fixed ElasticaFormatter to use more precise dates
|
54 |
+
* Fixed GelfMessageFormatter sending too long messages
|
55 |
+
|
56 |
+
### 1.18.1 (2016-03-13)
|
57 |
+
|
58 |
+
* Fixed SlackHandler bug where slack dropped messages randomly
|
59 |
+
* Fixed RedisHandler issue when using with the PHPRedis extension
|
60 |
+
* Fixed AmqpHandler content-type being incorrectly set when using with the AMQP extension
|
61 |
+
* Fixed BrowserConsoleHandler regression
|
62 |
+
|
63 |
+
### 1.18.0 (2016-03-01)
|
64 |
+
|
65 |
+
* Added optional reduction of timestamp precision via `Logger->useMicrosecondTimestamps(false)`, disabling it gets you a bit of performance boost but reduces the precision to the second instead of microsecond
|
66 |
+
* Added possibility to skip some extra stack frames in IntrospectionProcessor if you have some library wrapping Monolog that is always adding frames
|
67 |
+
* Added `Logger->withName` to clone a logger (keeping all handlers) with a new name
|
68 |
+
* Added FluentdFormatter for the Fluentd unix socket protocol
|
69 |
+
* Added HandlerWrapper base class to ease the creation of handler wrappers, just extend it and override as needed
|
70 |
+
* Added support for replacing context sub-keys using `%context.*%` in LineFormatter
|
71 |
+
* Added support for `payload` context value in RollbarHandler
|
72 |
+
* Added setRelease to RavenHandler to describe the application version, sent with every log
|
73 |
+
* Added support for `fingerprint` context value in RavenHandler
|
74 |
+
* Fixed JSON encoding errors that would gobble up the whole log record, we now handle those more gracefully by dropping chars as needed
|
75 |
+
* Fixed write timeouts in SocketHandler and derivatives, set to 10sec by default, lower it with `setWritingTimeout()`
|
76 |
+
* Fixed PHP7 compatibility with regard to Exception/Throwable handling in a few places
|
77 |
+
|
78 |
+
### 1.17.2 (2015-10-14)
|
79 |
+
|
80 |
+
* Fixed ErrorHandler compatibility with non-Monolog PSR-3 loggers
|
81 |
+
* Fixed SlackHandler handling to use slack functionalities better
|
82 |
+
* Fixed SwiftMailerHandler bug when sending multiple emails they all had the same id
|
83 |
+
* Fixed 5.3 compatibility regression
|
84 |
+
|
85 |
+
### 1.17.1 (2015-08-31)
|
86 |
+
|
87 |
+
* Fixed RollbarHandler triggering PHP notices
|
88 |
+
|
89 |
+
### 1.17.0 (2015-08-30)
|
90 |
+
|
91 |
+
* Added support for `checksum` and `release` context/extra values in RavenHandler
|
92 |
+
* Added better support for exceptions in RollbarHandler
|
93 |
+
* Added UidProcessor::getUid
|
94 |
+
* Added support for showing the resource type in NormalizedFormatter
|
95 |
+
* Fixed IntrospectionProcessor triggering PHP notices
|
96 |
+
|
97 |
### 1.16.0 (2015-08-09)
|
98 |
|
99 |
* Added IFTTTHandler to notify ifttt.com triggers
|
vendor/monolog/monolog/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
Copyright (c) 2011-
|
2 |
|
3 |
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
of this software and associated documentation files (the "Software"), to deal
|
1 |
+
Copyright (c) 2011-2016 Jordi Boggiano
|
2 |
|
3 |
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
of this software and associated documentation files (the "Software"), to deal
|
vendor/monolog/monolog/{README.mdown → README.md}
RENAMED
File without changes
|
vendor/monolog/monolog/composer.json
CHANGED
@@ -19,24 +19,26 @@
|
|
19 |
"require-dev": {
|
20 |
"phpunit/phpunit": "~4.5",
|
21 |
"graylog2/gelf-php": "~1.0",
|
22 |
-
"
|
23 |
"ruflin/elastica": ">=0.90 <3.0",
|
24 |
"doctrine/couchdb": "~1.0@dev",
|
25 |
-
"aws/aws-sdk-php": "^2.4.9",
|
26 |
-
"
|
27 |
-
"swiftmailer/swiftmailer": "
|
28 |
"php-console/php-console": "^3.1.3",
|
29 |
-
"phpunit/phpunit-mock-objects": "2.3.0"
|
|
|
30 |
},
|
31 |
"_": "phpunit/phpunit-mock-objects required in 2.3.0 due to https://github.com/sebastianbergmann/phpunit-mock-objects/issues/223 - needs hhvm 3.8+ on travis",
|
32 |
"suggest": {
|
33 |
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
|
34 |
-
"
|
35 |
"doctrine/couchdb": "Allow sending log messages to a CouchDB server",
|
36 |
"ruflin/elastica": "Allow sending log messages to an Elastic Search server",
|
37 |
-
"
|
38 |
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
|
39 |
"ext-mongo": "Allow sending log messages to a MongoDB server",
|
|
|
40 |
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
|
41 |
"rollbar/rollbar": "Allow sending log messages to Rollbar",
|
42 |
"php-console/php-console": "Allow sending log messages to Google Chrome"
|
@@ -52,10 +54,13 @@
|
|
52 |
},
|
53 |
"extra": {
|
54 |
"branch-alias": {
|
55 |
-
"dev-master": "
|
56 |
}
|
57 |
},
|
58 |
"scripts": {
|
59 |
-
"test":
|
|
|
|
|
|
|
60 |
}
|
61 |
}
|
19 |
"require-dev": {
|
20 |
"phpunit/phpunit": "~4.5",
|
21 |
"graylog2/gelf-php": "~1.0",
|
22 |
+
"sentry/sentry": "^0.13",
|
23 |
"ruflin/elastica": ">=0.90 <3.0",
|
24 |
"doctrine/couchdb": "~1.0@dev",
|
25 |
+
"aws/aws-sdk-php": "^2.4.9 || ^3.0",
|
26 |
+
"php-amqplib/php-amqplib": "~2.4",
|
27 |
+
"swiftmailer/swiftmailer": "^5.3|^6.0",
|
28 |
"php-console/php-console": "^3.1.3",
|
29 |
+
"phpunit/phpunit-mock-objects": "2.3.0",
|
30 |
+
"jakub-onderka/php-parallel-lint": "0.9"
|
31 |
},
|
32 |
"_": "phpunit/phpunit-mock-objects required in 2.3.0 due to https://github.com/sebastianbergmann/phpunit-mock-objects/issues/223 - needs hhvm 3.8+ on travis",
|
33 |
"suggest": {
|
34 |
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
|
35 |
+
"sentry/sentry": "Allow sending log messages to a Sentry server",
|
36 |
"doctrine/couchdb": "Allow sending log messages to a CouchDB server",
|
37 |
"ruflin/elastica": "Allow sending log messages to an Elastic Search server",
|
38 |
+
"php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
|
39 |
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
|
40 |
"ext-mongo": "Allow sending log messages to a MongoDB server",
|
41 |
+
"mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver",
|
42 |
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
|
43 |
"rollbar/rollbar": "Allow sending log messages to Rollbar",
|
44 |
"php-console/php-console": "Allow sending log messages to Google Chrome"
|
54 |
},
|
55 |
"extra": {
|
56 |
"branch-alias": {
|
57 |
+
"dev-master": "2.0.x-dev"
|
58 |
}
|
59 |
},
|
60 |
"scripts": {
|
61 |
+
"test": [
|
62 |
+
"parallel-lint . --exclude vendor",
|
63 |
+
"phpunit"
|
64 |
+
]
|
65 |
}
|
66 |
}
|
vendor/monolog/monolog/doc/01-usage.md
CHANGED
@@ -189,6 +189,9 @@ $logger->pushHandler($firephp);
|
|
189 |
$securityLogger = new Logger('security');
|
190 |
$securityLogger->pushHandler($stream);
|
191 |
$securityLogger->pushHandler($firephp);
|
|
|
|
|
|
|
192 |
```
|
193 |
|
194 |
## Customizing the log format
|
189 |
$securityLogger = new Logger('security');
|
190 |
$securityLogger->pushHandler($stream);
|
191 |
$securityLogger->pushHandler($firephp);
|
192 |
+
|
193 |
+
// Or clone the first one to only change the channel
|
194 |
+
$securityLogger = $logger->withName('security');
|
195 |
```
|
196 |
|
197 |
## Customizing the log format
|
vendor/monolog/monolog/doc/02-handlers-formatters-processors.md
CHANGED
@@ -32,7 +32,9 @@
|
|
32 |
- _PushoverHandler_: Sends mobile notifications via the [Pushover](https://www.pushover.net/) API.
|
33 |
- _HipChatHandler_: Logs records to a [HipChat](http://hipchat.com) chat room using its API.
|
34 |
- _FlowdockHandler_: Logs records to a [Flowdock](https://www.flowdock.com/) account.
|
35 |
-
- _SlackHandler_: Logs records to a [Slack](https://www.slack.com/) account.
|
|
|
|
|
36 |
- _MandrillHandler_: Sends emails via the Mandrill API using a [`Swift_Message`](http://swiftmailer.org/) instance.
|
37 |
- _FleepHookHandler_: Logs records to a [Fleep](https://fleep.io/) conversation using Webhooks.
|
38 |
- _IFTTTHandler_: Notifies an [IFTTT](https://ifttt.com/maker) trigger with the log channel, level name and message.
|
@@ -85,6 +87,16 @@
|
|
85 |
when it happens you will have the full information, including debug and info
|
86 |
records. This provides you with all the information you need, but only when
|
87 |
you need it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
- _WhatFailureGroupHandler_: This handler extends the _GroupHandler_ ignoring
|
89 |
exceptions raised by each child handler. This allows you to ignore issues
|
90 |
where a remote tcp connection may have died but you do not want your entire
|
@@ -105,6 +117,8 @@
|
|
105 |
- _PsrHandler_: Can be used to forward log records to an existing PSR-3 logger
|
106 |
- _TestHandler_: Used for testing, it records everything that is sent to it and
|
107 |
has accessors to read out the information.
|
|
|
|
|
108 |
|
109 |
## Formatters
|
110 |
|
@@ -124,6 +138,7 @@
|
|
124 |
|
125 |
## Processors
|
126 |
|
|
|
127 |
- _IntrospectionProcessor_: Adds the line/file/class/method from which the log call originated.
|
128 |
- _WebProcessor_: Adds the current request URI, request method and client IP to a log record.
|
129 |
- _MemoryUsageProcessor_: Adds the current memory usage to a log record.
|
32 |
- _PushoverHandler_: Sends mobile notifications via the [Pushover](https://www.pushover.net/) API.
|
33 |
- _HipChatHandler_: Logs records to a [HipChat](http://hipchat.com) chat room using its API.
|
34 |
- _FlowdockHandler_: Logs records to a [Flowdock](https://www.flowdock.com/) account.
|
35 |
+
- _SlackHandler_: Logs records to a [Slack](https://www.slack.com/) account using the Slack API.
|
36 |
+
- _SlackbotHandler_: Logs records to a [Slack](https://www.slack.com/) account using the Slackbot incoming hook.
|
37 |
+
- _SlackWebhookHandler_: Logs records to a [Slack](https://www.slack.com/) account using Slack Webhooks.
|
38 |
- _MandrillHandler_: Sends emails via the Mandrill API using a [`Swift_Message`](http://swiftmailer.org/) instance.
|
39 |
- _FleepHookHandler_: Logs records to a [Fleep](https://fleep.io/) conversation using Webhooks.
|
40 |
- _IFTTTHandler_: Notifies an [IFTTT](https://ifttt.com/maker) trigger with the log channel, level name and message.
|
87 |
when it happens you will have the full information, including debug and info
|
88 |
records. This provides you with all the information you need, but only when
|
89 |
you need it.
|
90 |
+
- _DeduplicationHandler_: Useful if you are sending notifications or emails
|
91 |
+
when critical errors occur. It takes a logger as parameter and will
|
92 |
+
accumulate log records of all levels until the end of the request (or
|
93 |
+
`flush()` is called). At that point it delivers all records to the handler
|
94 |
+
it wraps, but only if the records are unique over a given time period
|
95 |
+
(60seconds by default). If the records are duplicates they are simply
|
96 |
+
discarded. The main use of this is in case of critical failure like if your
|
97 |
+
database is unreachable for example all your requests will fail and that
|
98 |
+
can result in a lot of notifications being sent. Adding this handler reduces
|
99 |
+
the amount of notifications to a manageable level.
|
100 |
- _WhatFailureGroupHandler_: This handler extends the _GroupHandler_ ignoring
|
101 |
exceptions raised by each child handler. This allows you to ignore issues
|
102 |
where a remote tcp connection may have died but you do not want your entire
|
117 |
- _PsrHandler_: Can be used to forward log records to an existing PSR-3 logger
|
118 |
- _TestHandler_: Used for testing, it records everything that is sent to it and
|
119 |
has accessors to read out the information.
|
120 |
+
- _HandlerWrapper_: A simple handler wrapper you can inherit from to create
|
121 |
+
your own wrappers easily.
|
122 |
|
123 |
## Formatters
|
124 |
|
138 |
|
139 |
## Processors
|
140 |
|
141 |
+
- _PsrLogMessageProcessor_: Processes a log record's message according to PSR-3 rules, replacing `{foo}` with the value from `$context['foo']`.
|
142 |
- _IntrospectionProcessor_: Adds the line/file/class/method from which the log call originated.
|
143 |
- _WebProcessor_: Adds the current request URI, request method and client IP to a log record.
|
144 |
- _MemoryUsageProcessor_: Adds the current memory usage to a log record.
|
vendor/monolog/monolog/src/Monolog/ErrorHandler.php
CHANGED
@@ -33,6 +33,7 @@ class ErrorHandler
|
|
33 |
|
34 |
private $previousErrorHandler;
|
35 |
private $errorLevelMap;
|
|
|
36 |
|
37 |
private $hasFatalErrorHandler;
|
38 |
private $fatalLevel;
|
@@ -57,6 +58,9 @@ class ErrorHandler
|
|
57 |
*/
|
58 |
public static function register(LoggerInterface $logger, $errorLevelMap = array(), $exceptionLevel = null, $fatalLevel = null)
|
59 |
{
|
|
|
|
|
|
|
60 |
$handler = new static($logger);
|
61 |
if ($errorLevelMap !== false) {
|
62 |
$handler->registerErrorHandler($errorLevelMap);
|
@@ -80,13 +84,15 @@ class ErrorHandler
|
|
80 |
}
|
81 |
}
|
82 |
|
83 |
-
public function registerErrorHandler(array $levelMap = array(), $callPrevious = true, $errorTypes = -1)
|
84 |
{
|
85 |
$prev = set_error_handler(array($this, 'handleError'), $errorTypes);
|
86 |
$this->errorLevelMap = array_replace($this->defaultErrorLevelMap(), $levelMap);
|
87 |
if ($callPrevious) {
|
88 |
$this->previousErrorHandler = $prev ?: true;
|
89 |
}
|
|
|
|
|
90 |
}
|
91 |
|
92 |
public function registerFatalHandler($level = null, $reservedMemorySize = 20)
|
@@ -142,7 +148,7 @@ class ErrorHandler
|
|
142 |
*/
|
143 |
public function handleError($code, $message, $file = '', $line = 0, $context = array())
|
144 |
{
|
145 |
-
if (!(error_reporting() & $code)) {
|
146 |
return;
|
147 |
}
|
148 |
|
@@ -174,9 +180,11 @@ class ErrorHandler
|
|
174 |
array('code' => $lastError['type'], 'message' => $lastError['message'], 'file' => $lastError['file'], 'line' => $lastError['line'])
|
175 |
);
|
176 |
|
177 |
-
|
178 |
-
|
179 |
-
$handler
|
|
|
|
|
180 |
}
|
181 |
}
|
182 |
}
|
33 |
|
34 |
private $previousErrorHandler;
|
35 |
private $errorLevelMap;
|
36 |
+
private $handleOnlyReportedErrors;
|
37 |
|
38 |
private $hasFatalErrorHandler;
|
39 |
private $fatalLevel;
|
58 |
*/
|
59 |
public static function register(LoggerInterface $logger, $errorLevelMap = array(), $exceptionLevel = null, $fatalLevel = null)
|
60 |
{
|
61 |
+
//Forces the autoloader to run for LogLevel. Fixes an autoload issue at compile-time on PHP5.3. See https://github.com/Seldaek/monolog/pull/929
|
62 |
+
class_exists('\\Psr\\Log\\LogLevel', true);
|
63 |
+
|
64 |
$handler = new static($logger);
|
65 |
if ($errorLevelMap !== false) {
|
66 |
$handler->registerErrorHandler($errorLevelMap);
|
84 |
}
|
85 |
}
|
86 |
|
87 |
+
public function registerErrorHandler(array $levelMap = array(), $callPrevious = true, $errorTypes = -1, $handleOnlyReportedErrors = true)
|
88 |
{
|
89 |
$prev = set_error_handler(array($this, 'handleError'), $errorTypes);
|
90 |
$this->errorLevelMap = array_replace($this->defaultErrorLevelMap(), $levelMap);
|
91 |
if ($callPrevious) {
|
92 |
$this->previousErrorHandler = $prev ?: true;
|
93 |
}
|
94 |
+
|
95 |
+
$this->handleOnlyReportedErrors = $handleOnlyReportedErrors;
|
96 |
}
|
97 |
|
98 |
public function registerFatalHandler($level = null, $reservedMemorySize = 20)
|
148 |
*/
|
149 |
public function handleError($code, $message, $file = '', $line = 0, $context = array())
|
150 |
{
|
151 |
+
if ($this->handleOnlyReportedErrors && !(error_reporting() & $code)) {
|
152 |
return;
|
153 |
}
|
154 |
|
180 |
array('code' => $lastError['type'], 'message' => $lastError['message'], 'file' => $lastError['file'], 'line' => $lastError['line'])
|
181 |
);
|
182 |
|
183 |
+
if ($this->logger instanceof Logger) {
|
184 |
+
foreach ($this->logger->getHandlers() as $handler) {
|
185 |
+
if ($handler instanceof AbstractHandler) {
|
186 |
+
$handler->close();
|
187 |
+
}
|
188 |
}
|
189 |
}
|
190 |
}
|
vendor/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php
CHANGED
@@ -41,10 +41,9 @@ class ChromePHPFormatter implements FormatterInterface
|
|
41 |
{
|
42 |
// Retrieve the line and file if set and remove them from the formatted extra
|
43 |
$backtrace = 'unknown';
|
44 |
-
if (isset($record['extra']['file']
|
45 |
$backtrace = $record['extra']['file'].' : '.$record['extra']['line'];
|
46 |
-
unset($record['extra']['file']);
|
47 |
-
unset($record['extra']['line']);
|
48 |
}
|
49 |
|
50 |
$message = array('message' => $record['message']);
|
41 |
{
|
42 |
// Retrieve the line and file if set and remove them from the formatted extra
|
43 |
$backtrace = 'unknown';
|
44 |
+
if (isset($record['extra']['file'], $record['extra']['line'])) {
|
45 |
$backtrace = $record['extra']['file'].' : '.$record['extra']['line'];
|
46 |
+
unset($record['extra']['file'], $record['extra']['line']);
|
|
|
47 |
}
|
48 |
|
49 |
$message = array('message' => $record['message']);
|
vendor/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php
CHANGED
@@ -36,7 +36,9 @@ class ElasticaFormatter extends NormalizerFormatter
|
|
36 |
*/
|
37 |
public function __construct($index, $type)
|
38 |
{
|
39 |
-
|
|
|
|
|
40 |
$this->index = $index;
|
41 |
$this->type = $type;
|
42 |
}
|
36 |
*/
|
37 |
public function __construct($index, $type)
|
38 |
{
|
39 |
+
// elasticsearch requires a ISO 8601 format date with optional millisecond precision.
|
40 |
+
parent::__construct('Y-m-d\TH:i:s.uP');
|
41 |
+
|
42 |
$this->index = $index;
|
43 |
$this->type = $type;
|
44 |
}
|
vendor/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Monolog package.
|
5 |
+
*
|
6 |
+
* (c) Jordi Boggiano <j.boggiano@seld.be>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Monolog\Formatter;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Class FluentdFormatter
|
16 |
+
*
|
17 |
+
* Serializes a log message to Fluentd unix socket protocol
|
18 |
+
*
|
19 |
+
* Fluentd config:
|
20 |
+
*
|
21 |
+
* <source>
|
22 |
+
* type unix
|
23 |
+
* path /var/run/td-agent/td-agent.sock
|
24 |
+
* </source>
|
25 |
+
*
|
26 |
+
* Monolog setup:
|
27 |
+
*
|
28 |
+
* $logger = new Monolog\Logger('fluent.tag');
|
29 |
+
* $fluentHandler = new Monolog\Handler\SocketHandler('unix:///var/run/td-agent/td-agent.sock');
|
30 |
+
* $fluentHandler->setFormatter(new Monolog\Formatter\FluentdFormatter());
|
31 |
+
* $logger->pushHandler($fluentHandler);
|
32 |
+
*
|
33 |
+
* @author Andrius Putna <fordnox@gmail.com>
|
34 |
+
*/
|
35 |
+
class FluentdFormatter implements FormatterInterface
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* @var bool $levelTag should message level be a part of the fluentd tag
|
39 |
+
*/
|
40 |
+
protected $levelTag = false;
|
41 |
+
|
42 |
+
public function __construct($levelTag = false)
|
43 |
+
{
|
44 |
+
if (!function_exists('json_encode')) {
|
45 |
+
throw new \RuntimeException('PHP\'s json extension is required to use Monolog\'s FluentdUnixFormatter');
|
46 |
+
}
|
47 |
+
|
48 |
+
$this->levelTag = (bool) $levelTag;
|
49 |
+
}
|
50 |
+
|
51 |
+
public function isUsingLevelsInTag()
|
52 |
+
{
|
53 |
+
return $this->levelTag;
|
54 |
+
}
|
55 |
+
|
56 |
+
public function format(array $record)
|
57 |
+
{
|
58 |
+
$tag = $record['channel'];
|
59 |
+
if ($this->levelTag) {
|
60 |
+
$tag .= '.' . strtolower($record['level_name']);
|
61 |
+
}
|
62 |
+
|
63 |
+
$message = array(
|
64 |
+
'message' => $record['message'],
|
65 |
+
'extra' => $record['extra'],
|
66 |
+
);
|
67 |
+
|
68 |
+
if (!$this->levelTag) {
|
69 |
+
$message['level'] = $record['level'];
|
70 |
+
$message['level_name'] = $record['level_name'];
|
71 |
+
}
|
72 |
+
|
73 |
+
return json_encode(array($tag, $record['datetime']->getTimestamp(), $message));
|
74 |
+
}
|
75 |
+
|
76 |
+
public function formatBatch(array $records)
|
77 |
+
{
|
78 |
+
$message = '';
|
79 |
+
foreach ($records as $record) {
|
80 |
+
$message .= $this->format($record);
|
81 |
+
}
|
82 |
+
|
83 |
+
return $message;
|
84 |
+
}
|
85 |
+
}
|
vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php
CHANGED
@@ -22,6 +22,8 @@ use Gelf\Message;
|
|
22 |
*/
|
23 |
class GelfMessageFormatter extends NormalizerFormatter
|
24 |
{
|
|
|
|
|
25 |
/**
|
26 |
* @var string the name of the system for the Gelf log message
|
27 |
*/
|
@@ -37,6 +39,11 @@ class GelfMessageFormatter extends NormalizerFormatter
|
|
37 |
*/
|
38 |
protected $contextPrefix;
|
39 |
|
|
|
|
|
|
|
|
|
|
|
40 |
/**
|
41 |
* Translates Monolog log levels to Graylog2 log priorities.
|
42 |
*/
|
@@ -51,7 +58,7 @@ class GelfMessageFormatter extends NormalizerFormatter
|
|
51 |
Logger::EMERGENCY => 0,
|
52 |
);
|
53 |
|
54 |
-
public function __construct($systemName = null, $extraPrefix = null, $contextPrefix = 'ctxt_')
|
55 |
{
|
56 |
parent::__construct('U.u');
|
57 |
|
@@ -59,6 +66,7 @@ class GelfMessageFormatter extends NormalizerFormatter
|
|
59 |
|
60 |
$this->extraPrefix = $extraPrefix;
|
61 |
$this->contextPrefix = $contextPrefix;
|
|
|
62 |
}
|
63 |
|
64 |
/**
|
@@ -79,6 +87,13 @@ class GelfMessageFormatter extends NormalizerFormatter
|
|
79 |
->setHost($this->systemName)
|
80 |
->setLevel($this->logLevels[$record['level']]);
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
if (isset($record['channel'])) {
|
83 |
$message->setFacility($record['channel']);
|
84 |
}
|
@@ -92,11 +107,23 @@ class GelfMessageFormatter extends NormalizerFormatter
|
|
92 |
}
|
93 |
|
94 |
foreach ($record['extra'] as $key => $val) {
|
95 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
}
|
97 |
|
98 |
foreach ($record['context'] as $key => $val) {
|
99 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
}
|
101 |
|
102 |
if (null === $message->getFile() && isset($record['context']['exception']['file'])) {
|
22 |
*/
|
23 |
class GelfMessageFormatter extends NormalizerFormatter
|
24 |
{
|
25 |
+
const DEFAULT_MAX_LENGTH = 32766;
|
26 |
+
|
27 |
/**
|
28 |
* @var string the name of the system for the Gelf log message
|
29 |
*/
|
39 |
*/
|
40 |
protected $contextPrefix;
|
41 |
|
42 |
+
/**
|
43 |
+
* @var int max length per field
|
44 |
+
*/
|
45 |
+
protected $maxLength;
|
46 |
+
|
47 |
/**
|
48 |
* Translates Monolog log levels to Graylog2 log priorities.
|
49 |
*/
|
58 |
Logger::EMERGENCY => 0,
|
59 |
);
|
60 |
|
61 |
+
public function __construct($systemName = null, $extraPrefix = null, $contextPrefix = 'ctxt_', $maxLength = null)
|
62 |
{
|
63 |
parent::__construct('U.u');
|
64 |
|
66 |
|
67 |
$this->extraPrefix = $extraPrefix;
|
68 |
$this->contextPrefix = $contextPrefix;
|
69 |
+
$this->maxLength = is_null($maxLength) ? self::DEFAULT_MAX_LENGTH : $maxLength;
|
70 |
}
|
71 |
|
72 |
/**
|
87 |
->setHost($this->systemName)
|
88 |
->setLevel($this->logLevels[$record['level']]);
|
89 |
|
90 |
+
// message length + system name length + 200 for padding / metadata
|
91 |
+
$len = 200 + strlen((string) $record['message']) + strlen($this->systemName);
|
92 |
+
|
93 |
+
if ($len > $this->maxLength) {
|
94 |
+
$message->setShortMessage(substr($record['message'], 0, $this->maxLength));
|
95 |
+
}
|
96 |
+
|
97 |
if (isset($record['channel'])) {
|
98 |
$message->setFacility($record['channel']);
|
99 |
}
|
107 |
}
|
108 |
|
109 |
foreach ($record['extra'] as $key => $val) {
|
110 |
+
$val = is_scalar($val) || null === $val ? $val : $this->toJson($val);
|
111 |
+
$len = strlen($this->extraPrefix . $key . $val);
|
112 |
+
if ($len > $this->maxLength) {
|
113 |
+
$message->setAdditional($this->extraPrefix . $key, substr($val, 0, $this->maxLength));
|
114 |
+
break;
|
115 |
+
}
|
116 |
+
$message->setAdditional($this->extraPrefix . $key, $val);
|
117 |
}
|
118 |
|
119 |
foreach ($record['context'] as $key => $val) {
|
120 |
+
$val = is_scalar($val) || null === $val ? $val : $this->toJson($val);
|
121 |
+
$len = strlen($this->contextPrefix . $key . $val);
|
122 |
+
if ($len > $this->maxLength) {
|
123 |
+
$message->setAdditional($this->contextPrefix . $key, substr($val, 0, $this->maxLength));
|
124 |
+
break;
|
125 |
+
}
|
126 |
+
$message->setAdditional($this->contextPrefix . $key, $val);
|
127 |
}
|
128 |
|
129 |
if (null === $message->getFile() && isset($record['context']['exception']['file'])) {
|
vendor/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php
CHANGED
@@ -24,7 +24,7 @@ class HtmlFormatter extends NormalizerFormatter
|
|
24 |
/**
|
25 |
* Translates Monolog log levels to html color priorities.
|
26 |
*/
|
27 |
-
|
28 |
Logger::DEBUG => '#cccccc',
|
29 |
Logger::INFO => '#468847',
|
30 |
Logger::NOTICE => '#3a87ad',
|
@@ -51,7 +51,7 @@ class HtmlFormatter extends NormalizerFormatter
|
|
51 |
* @param bool $escapeTd false if td content must not be html escaped
|
52 |
* @return string
|
53 |
*/
|
54 |
-
|
55 |
{
|
56 |
$th = htmlspecialchars($th, ENT_NOQUOTES, 'UTF-8');
|
57 |
if ($escapeTd) {
|
@@ -64,16 +64,17 @@ class HtmlFormatter extends NormalizerFormatter
|
|
64 |
/**
|
65 |
* Create a HTML h1 tag
|
66 |
*
|
67 |
-
* @param string
|
68 |
-
* @param
|
69 |
* @return string
|
70 |
*/
|
71 |
-
|
72 |
{
|
73 |
$title = htmlspecialchars($title, ENT_NOQUOTES, 'UTF-8');
|
74 |
|
75 |
return '<h1 style="background: '.$this->logLevels[$level].';color: #ffffff;padding: 5px;" class="monolog-output">'.$title.'</h1>';
|
76 |
}
|
|
|
77 |
/**
|
78 |
* Formats a log record.
|
79 |
*
|
24 |
/**
|
25 |
* Translates Monolog log levels to html color priorities.
|
26 |
*/
|
27 |
+
protected $logLevels = array(
|
28 |
Logger::DEBUG => '#cccccc',
|
29 |
Logger::INFO => '#468847',
|
30 |
Logger::NOTICE => '#3a87ad',
|
51 |
* @param bool $escapeTd false if td content must not be html escaped
|
52 |
* @return string
|
53 |
*/
|
54 |
+
protected function addRow($th, $td = ' ', $escapeTd = true)
|
55 |
{
|
56 |
$th = htmlspecialchars($th, ENT_NOQUOTES, 'UTF-8');
|
57 |
if ($escapeTd) {
|
64 |
/**
|
65 |
* Create a HTML h1 tag
|
66 |
*
|
67 |
+
* @param string $title Text to be in the h1
|
68 |
+
* @param int $level Error level
|
69 |
* @return string
|
70 |
*/
|
71 |
+
protected function addTitle($title, $level)
|
72 |
{
|
73 |
$title = htmlspecialchars($title, ENT_NOQUOTES, 'UTF-8');
|
74 |
|
75 |
return '<h1 style="background: '.$this->logLevels[$level].';color: #ffffff;padding: 5px;" class="monolog-output">'.$title.'</h1>';
|
76 |
}
|
77 |
+
|
78 |
/**
|
79 |
* Formats a log record.
|
80 |
*
|
vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php
CHANGED
@@ -11,6 +11,9 @@
|
|
11 |
|
12 |
namespace Monolog\Formatter;
|
13 |
|
|
|
|
|
|
|
14 |
/**
|
15 |
* Encodes whatever record data is passed to it as json
|
16 |
*
|
@@ -18,7 +21,7 @@ namespace Monolog\Formatter;
|
|
18 |
*
|
19 |
* @author Jordi Boggiano <j.boggiano@seld.be>
|
20 |
*/
|
21 |
-
class JsonFormatter
|
22 |
{
|
23 |
const BATCH_MODE_JSON = 1;
|
24 |
const BATCH_MODE_NEWLINES = 2;
|
@@ -26,8 +29,14 @@ class JsonFormatter implements FormatterInterface
|
|
26 |
protected $batchMode;
|
27 |
protected $appendNewline;
|
28 |
|
|
|
|
|
|
|
|
|
|
|
29 |
/**
|
30 |
* @param int $batchMode
|
|
|
31 |
*/
|
32 |
public function __construct($batchMode = self::BATCH_MODE_JSON, $appendNewline = true)
|
33 |
{
|
@@ -64,7 +73,7 @@ class JsonFormatter implements FormatterInterface
|
|
64 |
*/
|
65 |
public function format(array $record)
|
66 |
{
|
67 |
-
return
|
68 |
}
|
69 |
|
70 |
/**
|
@@ -82,6 +91,14 @@ class JsonFormatter implements FormatterInterface
|
|
82 |
}
|
83 |
}
|
84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
/**
|
86 |
* Return a JSON-encoded array of records.
|
87 |
*
|
@@ -90,7 +107,7 @@ class JsonFormatter implements FormatterInterface
|
|
90 |
*/
|
91 |
protected function formatBatchJson(array $records)
|
92 |
{
|
93 |
-
return
|
94 |
}
|
95 |
|
96 |
/**
|
@@ -113,4 +130,79 @@ class JsonFormatter implements FormatterInterface
|
|
113 |
|
114 |
return implode("\n", $records);
|
115 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
}
|
11 |
|
12 |
namespace Monolog\Formatter;
|
13 |
|
14 |
+
use Exception;
|
15 |
+
use Throwable;
|
16 |
+
|
17 |
/**
|
18 |
* Encodes whatever record data is passed to it as json
|
19 |
*
|
21 |
*
|
22 |
* @author Jordi Boggiano <j.boggiano@seld.be>
|
23 |
*/
|
24 |
+
class JsonFormatter extends NormalizerFormatter
|
25 |
{
|
26 |
const BATCH_MODE_JSON = 1;
|
27 |
const BATCH_MODE_NEWLINES = 2;
|
29 |
protected $batchMode;
|
30 |
protected $appendNewline;
|
31 |
|
32 |
+
/**
|
33 |
+
* @var bool
|
34 |
+
*/
|
35 |
+
protected $includeStacktraces = false;
|
36 |
+
|
37 |
/**
|
38 |
* @param int $batchMode
|
39 |
+
* @param bool $appendNewline
|
40 |
*/
|
41 |
public function __construct($batchMode = self::BATCH_MODE_JSON, $appendNewline = true)
|
42 |
{
|
73 |
*/
|
74 |
public function format(array $record)
|
75 |
{
|
76 |
+
return $this->toJson($this->normalize($record), true) . ($this->appendNewline ? "\n" : '');
|
77 |
}
|
78 |
|
79 |
/**
|
91 |
}
|
92 |
}
|
93 |
|
94 |
+
/**
|
95 |
+
* @param bool $include
|
96 |
+
*/
|
97 |
+
public function includeStacktraces($include = true)
|
98 |
+
{
|
99 |
+
$this->includeStacktraces = $include;
|
100 |
+
}
|
101 |
+
|
102 |
/**
|
103 |
* Return a JSON-encoded array of records.
|
104 |
*
|
107 |
*/
|
108 |
protected function formatBatchJson(array $records)
|
109 |
{
|
110 |
+
return $this->toJson($this->normalize($records), true);
|
111 |
}
|
112 |
|
113 |
/**
|
130 |
|
131 |
return implode("\n", $records);
|
132 |
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Normalizes given $data.
|
136 |
+
*
|
137 |
+
* @param mixed $data
|
138 |
+
*
|
139 |
+
* @return mixed
|
140 |
+
*/
|
141 |
+
protected function normalize($data)
|
142 |
+
{
|
143 |
+
if (is_array($data) || $data instanceof \Traversable) {
|
144 |
+
$normalized = array();
|
145 |
+
|
146 |
+
$count = 1;
|
147 |
+
foreach ($data as $key => $value) {
|
148 |
+
if ($count++ >= 1000) {
|
149 |
+
$normalized['...'] = 'Over 1000 items, aborting normalization';
|
150 |
+
break;
|
151 |
+
}
|
152 |
+
$normalized[$key] = $this->normalize($value);
|
153 |
+
}
|
154 |
+
|
155 |
+
return $normalized;
|
156 |
+
}
|
157 |
+
|
158 |
+
if ($data instanceof Exception || $data instanceof Throwable) {
|
159 |
+
return $this->normalizeException($data);
|
160 |
+
}
|
161 |
+
|
162 |
+
return $data;
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* Normalizes given exception with or without its own stack trace based on
|
167 |
+
* `includeStacktraces` property.
|
168 |
+
*
|
169 |
+
* @param Exception|Throwable $e
|
170 |
+
*
|
171 |
+
* @return array
|
172 |
+
*/
|
173 |
+
protected function normalizeException($e)
|
174 |
+
{
|
175 |
+
// TODO 2.0 only check for Throwable
|
176 |
+
if (!$e instanceof Exception && !$e instanceof Throwable) {
|
177 |
+
throw new \InvalidArgumentException('Exception/Throwable expected, got '.gettype($e).' / '.get_class($e));
|
178 |
+
}
|
179 |
+
|
180 |
+
$data = array(
|
181 |
+
'class' => get_class($e),
|
182 |
+
'message' => $e->getMessage(),
|
183 |
+
'code' => $e->getCode(),
|
184 |
+
'file' => $e->getFile().':'.$e->getLine(),
|
185 |
+
);
|
186 |
+
|
187 |
+
if ($this->includeStacktraces) {
|
188 |
+
$trace = $e->getTrace();
|
189 |
+
foreach ($trace as $frame) {
|
190 |
+
if (isset($frame['file'])) {
|
191 |
+
$data['trace'][] = $frame['file'].':'.$frame['line'];
|
192 |
+
} elseif (isset($frame['function']) && $frame['function'] === '{closure}') {
|
193 |
+
// We should again normalize the frames, because it might contain invalid items
|
194 |
+
$data['trace'][] = $frame['function'];
|
195 |
+
} else {
|
196 |
+
// We should again normalize the frames, because it might contain invalid items
|
197 |
+
$data['trace'][] = $this->normalize($frame);
|
198 |
+
}
|
199 |
+
}
|
200 |
+
}
|
201 |
+
|
202 |
+
if ($previous = $e->getPrevious()) {
|
203 |
+
$data['previous'] = $this->normalizeException($previous);
|
204 |
+
}
|
205 |
+
|
206 |
+
return $data;
|
207 |
+
}
|
208 |
}
|
vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php
CHANGED
@@ -11,8 +11,6 @@
|
|
11 |
|
12 |
namespace Monolog\Formatter;
|
13 |
|
14 |
-
use Exception;
|
15 |
-
|
16 |
/**
|
17 |
* Formats incoming records into a one-line string
|
18 |
*
|
@@ -78,6 +76,14 @@ class LineFormatter extends NormalizerFormatter
|
|
78 |
}
|
79 |
}
|
80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
if ($this->ignoreEmptyContextAndExtra) {
|
82 |
if (empty($vars['context'])) {
|
83 |
unset($vars['context']);
|
@@ -96,6 +102,11 @@ class LineFormatter extends NormalizerFormatter
|
|
96 |
}
|
97 |
}
|
98 |
|
|
|
|
|
|
|
|
|
|
|
99 |
return $output;
|
100 |
}
|
101 |
|
@@ -114,8 +125,13 @@ class LineFormatter extends NormalizerFormatter
|
|
114 |
return $this->replaceNewlines($this->convertToString($value));
|
115 |
}
|
116 |
|
117 |
-
protected function normalizeException(
|
118 |
{
|
|
|
|
|
|
|
|
|
|
|
119 |
$previousText = '';
|
120 |
if ($previous = $e->getPrevious()) {
|
121 |
do {
|
@@ -125,7 +141,7 @@ class LineFormatter extends NormalizerFormatter
|
|
125 |
|
126 |
$str = '[object] ('.get_class($e).'(code: '.$e->getCode().'): '.$e->getMessage().' at '.$e->getFile().':'.$e->getLine().$previousText.')';
|
127 |
if ($this->includeStacktraces) {
|
128 |
-
$str .= "\n[stacktrace]\n".$e->getTraceAsString();
|
129 |
}
|
130 |
|
131 |
return $str;
|
@@ -151,6 +167,10 @@ class LineFormatter extends NormalizerFormatter
|
|
151 |
protected function replaceNewlines($str)
|
152 |
{
|
153 |
if ($this->allowInlineLineBreaks) {
|
|
|
|
|
|
|
|
|
154 |
return $str;
|
155 |
}
|
156 |
|
11 |
|
12 |
namespace Monolog\Formatter;
|
13 |
|
|
|
|
|
14 |
/**
|
15 |
* Formats incoming records into a one-line string
|
16 |
*
|
76 |
}
|
77 |
}
|
78 |
|
79 |
+
|
80 |
+
foreach ($vars['context'] as $var => $val) {
|
81 |
+
if (false !== strpos($output, '%context.'.$var.'%')) {
|
82 |
+
$output = str_replace('%context.'.$var.'%', $this->stringify($val), $output);
|
83 |
+
unset($vars['context'][$var]);
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
if ($this->ignoreEmptyContextAndExtra) {
|
88 |
if (empty($vars['context'])) {
|
89 |
unset($vars['context']);
|
102 |
}
|
103 |
}
|
104 |
|
105 |
+
// remove leftover %extra.xxx% and %context.xxx% if any
|
106 |
+
if (false !== strpos($output, '%')) {
|
107 |
+
$output = preg_replace('/%(?:extra|context)\..+?%/', '', $output);
|
108 |
+
}
|
109 |
+
|
110 |
return $output;
|
111 |
}
|
112 |
|
125 |
return $this->replaceNewlines($this->convertToString($value));
|
126 |
}
|
127 |
|
128 |
+
protected function normalizeException($e)
|
129 |
{
|
130 |
+
// TODO 2.0 only check for Throwable
|
131 |
+
if (!$e instanceof \Exception && !$e instanceof \Throwable) {
|
132 |
+
throw new \InvalidArgumentException('Exception/Throwable expected, got '.gettype($e).' / '.get_class($e));
|
133 |
+
}
|
134 |
+
|
135 |
$previousText = '';
|
136 |
if ($previous = $e->getPrevious()) {
|
137 |
do {
|
141 |
|
142 |
$str = '[object] ('.get_class($e).'(code: '.$e->getCode().'): '.$e->getMessage().' at '.$e->getFile().':'.$e->getLine().$previousText.')';
|
143 |
if ($this->includeStacktraces) {
|
144 |
+
$str .= "\n[stacktrace]\n".$e->getTraceAsString()."\n";
|
145 |
}
|
146 |
|
147 |
return $str;
|
167 |
protected function replaceNewlines($str)
|
168 |
{
|
169 |
if ($this->allowInlineLineBreaks) {
|
170 |
+
if (0 === strpos($str, '{')) {
|
171 |
+
return str_replace(array('\r', '\n'), array("\r", "\n"), $str);
|
172 |
+
}
|
173 |
+
|
174 |
return $str;
|
175 |
}
|
176 |
|
vendor/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php
CHANGED
@@ -22,7 +22,7 @@ class LogglyFormatter extends JsonFormatter
|
|
22 |
* Overrides the default batch mode to new lines for compatibility with the
|
23 |
* Loggly bulk API.
|
24 |
*
|
25 |
-
* @param
|
26 |
*/
|
27 |
public function __construct($batchMode = self::BATCH_MODE_NEWLINES, $appendNewline = false)
|
28 |
{
|
22 |
* Overrides the default batch mode to new lines for compatibility with the
|
23 |
* Loggly bulk API.
|
24 |
*
|
25 |
+
* @param int $batchMode
|
26 |
*/
|
27 |
public function __construct($batchMode = self::BATCH_MODE_NEWLINES, $appendNewline = false)
|
28 |
{
|
vendor/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php
CHANGED
@@ -45,7 +45,7 @@ class LogstashFormatter extends NormalizerFormatter
|
|
45 |
protected $contextPrefix;
|
46 |
|
47 |
/**
|
48 |
-
* @var
|
49 |
*/
|
50 |
protected $version;
|
51 |
|
@@ -54,6 +54,7 @@ class LogstashFormatter extends NormalizerFormatter
|
|
54 |
* @param string $systemName the system/machine name, used as the "source" field of logstash, defaults to the hostname of the machine
|
55 |
* @param string $extraPrefix prefix for extra keys inside logstash "fields"
|
56 |
* @param string $contextPrefix prefix for context keys inside logstash "fields", defaults to ctxt_
|
|
|
57 |
*/
|
58 |
public function __construct($applicationName, $systemName = null, $extraPrefix = null, $contextPrefix = 'ctxt_', $version = self::V0)
|
59 |
{
|
@@ -91,7 +92,7 @@ class LogstashFormatter extends NormalizerFormatter
|
|
91 |
$message = array(
|
92 |
'@timestamp' => $record['datetime'],
|
93 |
'@source' => $this->systemName,
|
94 |
-
'@fields' => array()
|
95 |
);
|
96 |
if (isset($record['message'])) {
|
97 |
$message['@message'] = $record['message'];
|
45 |
protected $contextPrefix;
|
46 |
|
47 |
/**
|
48 |
+
* @var int logstash format version to use
|
49 |
*/
|
50 |
protected $version;
|
51 |
|
54 |
* @param string $systemName the system/machine name, used as the "source" field of logstash, defaults to the hostname of the machine
|
55 |
* @param string $extraPrefix prefix for extra keys inside logstash "fields"
|
56 |
* @param string $contextPrefix prefix for context keys inside logstash "fields", defaults to ctxt_
|
57 |
+
* @param int $version the logstash format version to use, defaults to 0
|
58 |
*/
|
59 |
public function __construct($applicationName, $systemName = null, $extraPrefix = null, $contextPrefix = 'ctxt_', $version = self::V0)
|
60 |
{
|
92 |
$message = array(
|
93 |
'@timestamp' => $record['datetime'],
|
94 |
'@source' => $this->systemName,
|
95 |
+
'@fields' => array(),
|
96 |
);
|
97 |
if (isset($record['message'])) {
|
98 |
$message['@message'] = $record['message'];
|
vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php
CHANGED
@@ -70,13 +70,13 @@ class NormalizerFormatter implements FormatterInterface
|
|
70 |
return $data;
|
71 |
}
|
72 |
|
73 |
-
if (is_array($data)
|
74 |
$normalized = array();
|
75 |
|
76 |
$count = 1;
|
77 |
foreach ($data as $key => $value) {
|
78 |
if ($count++ >= 1000) {
|
79 |
-
$normalized['...'] = 'Over 1000 items, aborting normalization';
|
80 |
break;
|
81 |
}
|
82 |
$normalized[$key] = $this->normalize($value);
|
@@ -90,13 +90,14 @@ class NormalizerFormatter implements FormatterInterface
|
|
90 |
}
|
91 |
|
92 |
if (is_object($data)) {
|
93 |
-
|
|
|
94 |
return $this->normalizeException($data);
|
95 |
}
|
96 |
|
97 |
// non-serializable objects that implement __toString stringified
|
98 |
if (method_exists($data, '__toString') && !$data instanceof \JsonSerializable) {
|
99 |
-
$value = (
|
100 |
} else {
|
101 |
// the rest is json-serialized in some way
|
102 |
$value = $this->toJson($data, true);
|
@@ -106,14 +107,19 @@ class NormalizerFormatter implements FormatterInterface
|
|
106 |
}
|
107 |
|
108 |
if (is_resource($data)) {
|
109 |
-
return '[resource]';
|
110 |
}
|
111 |
|
112 |
return '[unknown('.gettype($data).')]';
|
113 |
}
|
114 |
|
115 |
-
protected function normalizeException(
|
116 |
{
|
|
|
|
|
|
|
|
|
|
|
117 |
$data = array(
|
118 |
'class' => get_class($e),
|
119 |
'message' => $e->getMessage(),
|
@@ -121,10 +127,27 @@ class NormalizerFormatter implements FormatterInterface
|
|
121 |
'file' => $e->getFile().':'.$e->getLine(),
|
122 |
);
|
123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
$trace = $e->getTrace();
|
125 |
foreach ($trace as $frame) {
|
126 |
if (isset($frame['file'])) {
|
127 |
$data['trace'][] = $frame['file'].':'.$frame['line'];
|
|
|
|
|
|
|
128 |
} else {
|
129 |
// We should again normalize the frames, because it might contain invalid items
|
130 |
$data['trace'][] = $this->toJson($this->normalize($frame), true);
|
@@ -138,23 +161,72 @@ class NormalizerFormatter implements FormatterInterface
|
|
138 |
return $data;
|
139 |
}
|
140 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
protected function toJson($data, $ignoreErrors = false)
|
142 |
{
|
143 |
// suppress json_encode errors since it's twitchy with some inputs
|
144 |
if ($ignoreErrors) {
|
145 |
-
|
146 |
-
|
147 |
-
|
|
|
148 |
|
149 |
-
|
|
|
150 |
}
|
151 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
|
153 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
} else {
|
155 |
-
$
|
156 |
}
|
157 |
|
|
|
|
|
158 |
if ($json === false) {
|
159 |
$this->throwEncodeError(json_last_error(), $data);
|
160 |
}
|
@@ -165,8 +237,8 @@ class NormalizerFormatter implements FormatterInterface
|
|
165 |
/**
|
166 |
* Throws an exception according to a given code with a customized message
|
167 |
*
|
168 |
-
* @param
|
169 |
-
* @param
|
170 |
* @throws \RuntimeException
|
171 |
*/
|
172 |
private function throwEncodeError($code, $data)
|
@@ -190,4 +262,36 @@ class NormalizerFormatter implements FormatterInterface
|
|
190 |
|
191 |
throw new \RuntimeException('JSON encoding failed: '.$msg.'. Encoding: '.var_export($data, true));
|
192 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
}
|
70 |
return $data;
|
71 |
}
|
72 |
|
73 |
+
if (is_array($data)) {
|
74 |
$normalized = array();
|
75 |
|
76 |
$count = 1;
|
77 |
foreach ($data as $key => $value) {
|
78 |
if ($count++ >= 1000) {
|
79 |
+
$normalized['...'] = 'Over 1000 items ('.count($data).' total), aborting normalization';
|
80 |
break;
|
81 |
}
|
82 |
$normalized[$key] = $this->normalize($value);
|
90 |
}
|
91 |
|
92 |
if (is_object($data)) {
|
93 |
+
// TODO 2.0 only check for Throwable
|
94 |
+
if ($data instanceof Exception || (PHP_VERSION_ID > 70000 && $data instanceof \Throwable)) {
|
95 |
return $this->normalizeException($data);
|
96 |
}
|
97 |
|
98 |
// non-serializable objects that implement __toString stringified
|
99 |
if (method_exists($data, '__toString') && !$data instanceof \JsonSerializable) {
|
100 |
+
$value = $data->__toString();
|
101 |
} else {
|
102 |
// the rest is json-serialized in some way
|
103 |
$value = $this->toJson($data, true);
|
107 |
}
|
108 |
|
109 |
if (is_resource($data)) {
|
110 |
+
return sprintf('[resource] (%s)', get_resource_type($data));
|
111 |
}
|
112 |
|
113 |
return '[unknown('.gettype($data).')]';
|
114 |
}
|
115 |
|
116 |
+
protected function normalizeException($e)
|
117 |
{
|
118 |
+
// TODO 2.0 only check for Throwable
|
119 |
+
if (!$e instanceof Exception && !$e instanceof \Throwable) {
|
120 |
+
throw new \InvalidArgumentException('Exception/Throwable expected, got '.gettype($e).' / '.get_class($e));
|
121 |
+
}
|
122 |
+
|
123 |
$data = array(
|
124 |
'class' => get_class($e),
|
125 |
'message' => $e->getMessage(),
|
127 |
'file' => $e->getFile().':'.$e->getLine(),
|
128 |
);
|
129 |
|
130 |
+
if ($e instanceof \SoapFault) {
|
131 |
+
if (isset($e->faultcode)) {
|
132 |
+
$data['faultcode'] = $e->faultcode;
|
133 |
+
}
|
134 |
+
|
135 |
+
if (isset($e->faultactor)) {
|
136 |
+
$data['faultactor'] = $e->faultactor;
|
137 |
+
}
|
138 |
+
|
139 |
+
if (isset($e->detail)) {
|
140 |
+
$data['detail'] = $e->detail;
|
141 |
+
}
|
142 |
+
}
|
143 |
+
|
144 |
$trace = $e->getTrace();
|
145 |
foreach ($trace as $frame) {
|
146 |
if (isset($frame['file'])) {
|
147 |
$data['trace'][] = $frame['file'].':'.$frame['line'];
|
148 |
+
} elseif (isset($frame['function']) && $frame['function'] === '{closure}') {
|
149 |
+
// We should again normalize the frames, because it might contain invalid items
|
150 |
+
$data['trace'][] = $frame['function'];
|
151 |
} else {
|
152 |
// We should again normalize the frames, because it might contain invalid items
|
153 |
$data['trace'][] = $this->toJson($this->normalize($frame), true);
|
161 |
return $data;
|
162 |
}
|
163 |
|
164 |
+
/**
|
165 |
+
* Return the JSON representation of a value
|
166 |
+
*
|
167 |
+
* @param mixed $data
|
168 |
+
* @param bool $ignoreErrors
|
169 |
+
* @throws \RuntimeException if encoding fails and errors are not ignored
|
170 |
+
* @return string
|
171 |
+
*/
|
172 |
protected function toJson($data, $ignoreErrors = false)
|
173 |
{
|
174 |
// suppress json_encode errors since it's twitchy with some inputs
|
175 |
if ($ignoreErrors) {
|
176 |
+
return @$this->jsonEncode($data);
|
177 |
+
}
|
178 |
+
|
179 |
+
$json = $this->jsonEncode($data);
|
180 |
|
181 |
+
if ($json === false) {
|
182 |
+
$json = $this->handleJsonError(json_last_error(), $data);
|
183 |
}
|
184 |
|
185 |
+
return $json;
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* @param mixed $data
|
190 |
+
* @return string JSON encoded data or null on failure
|
191 |
+
*/
|
192 |
+
private function jsonEncode($data)
|
193 |
+
{
|
194 |
if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
|
195 |
+
return json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
|
196 |
+
}
|
197 |
+
|
198 |
+
return json_encode($data);
|
199 |
+
}
|
200 |
+
|
201 |
+
/**
|
202 |
+
* Handle a json_encode failure.
|
203 |
+
*
|
204 |
+
* If the failure is due to invalid string encoding, try to clean the
|
205 |
+
* input and encode again. If the second encoding attempt fails, the
|
206 |
+
* inital error is not encoding related or the input can't be cleaned then
|
207 |
+
* raise a descriptive exception.
|
208 |
+
*
|
209 |
+
* @param int $code return code of json_last_error function
|
210 |
+
* @param mixed $data data that was meant to be encoded
|
211 |
+
* @throws \RuntimeException if failure can't be corrected
|
212 |
+
* @return string JSON encoded data after error correction
|
213 |
+
*/
|
214 |
+
private function handleJsonError($code, $data)
|
215 |
+
{
|
216 |
+
if ($code !== JSON_ERROR_UTF8) {
|
217 |
+
$this->throwEncodeError($code, $data);
|
218 |
+
}
|
219 |
+
|
220 |
+
if (is_string($data)) {
|
221 |
+
$this->detectAndCleanUtf8($data);
|
222 |
+
} elseif (is_array($data)) {
|
223 |
+
array_walk_recursive($data, array($this, 'detectAndCleanUtf8'));
|
224 |
} else {
|
225 |
+
$this->throwEncodeError($code, $data);
|
226 |
}
|
227 |
|
228 |
+
$json = $this->jsonEncode($data);
|
229 |
+
|
230 |
if ($json === false) {
|
231 |
$this->throwEncodeError(json_last_error(), $data);
|
232 |
}
|
237 |
/**
|
238 |
* Throws an exception according to a given code with a customized message
|
239 |
*
|
240 |
+
* @param int $code return code of json_last_error function
|
241 |
+
* @param mixed $data data that was meant to be encoded
|
242 |
* @throws \RuntimeException
|
243 |
*/
|
244 |
private function throwEncodeError($code, $data)
|
262 |
|
263 |
throw new \RuntimeException('JSON encoding failed: '.$msg.'. Encoding: '.var_export($data, true));
|
264 |
}
|
265 |
+
|
266 |
+
/**
|
267 |
+
* Detect invalid UTF-8 string characters and convert to valid UTF-8.
|
268 |
+
*
|
269 |
+
* Valid UTF-8 input will be left unmodified, but strings containing
|
270 |
+
* invalid UTF-8 codepoints will be reencoded as UTF-8 with an assumed
|
271 |
+
* original encoding of ISO-8859-15. This conversion may result in
|
272 |
+
* incorrect output if the actual encoding was not ISO-8859-15, but it
|
273 |
+
* will be clean UTF-8 output and will not rely on expensive and fragile
|
274 |
+
* detection algorithms.
|
275 |
+
*
|
276 |
+
* Function converts the input in place in the passed variable so that it
|
277 |
+
* can be used as a callback for array_walk_recursive.
|
278 |
+
*
|
279 |
+
* @param mixed &$data Input to check and convert if needed
|
280 |
+
* @private
|
281 |
+
*/
|
282 |
+
public function detectAndCleanUtf8(&$data)
|
283 |
+
{
|
284 |
+
if (is_string($data) && !preg_match('//u', $data)) {
|
285 |
+
$data = preg_replace_callback(
|
286 |
+
'/[\x80-\xFF]+/',
|
287 |
+
function ($m) { return utf8_encode($m[0]); },
|
288 |
+
$data
|
289 |
+
);
|
290 |
+
$data = str_replace(
|
291 |
+
array('¤', '¦', '¨', '´', '¸', '¼', '½', '¾'),
|
292 |
+
array('€', 'Š', 'š', 'Ž', 'ž', 'Œ', 'œ', 'Ÿ'),
|
293 |
+
$data
|
294 |
+
);
|
295 |
+
}
|
296 |
+
}
|
297 |
}
|
vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php
CHANGED
@@ -32,7 +32,7 @@ abstract class AbstractHandler implements HandlerInterface
|
|
32 |
protected $processors = array();
|
33 |
|
34 |
/**
|
35 |
-
* @param
|
36 |
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
37 |
*/
|
38 |
public function __construct($level = Logger::DEBUG, $bubble = true)
|
@@ -118,7 +118,7 @@ abstract class AbstractHandler implements HandlerInterface
|
|
118 |
/**
|
119 |
* Sets minimum logging level at which this handler will be triggered.
|
120 |
*
|
121 |
-
* @param
|
122 |
* @return self
|
123 |
*/
|
124 |
public function setLevel($level)
|
@@ -131,7 +131,7 @@ abstract class AbstractHandler implements HandlerInterface
|
|
131 |
/**
|
132 |
* Gets minimum logging level at which this handler will be triggered.
|
133 |
*
|
134 |
-
* @return
|
135 |
*/
|
136 |
public function getLevel()
|
137 |
{
|
@@ -169,6 +169,8 @@ abstract class AbstractHandler implements HandlerInterface
|
|
169 |
$this->close();
|
170 |
} catch (\Exception $e) {
|
171 |
// do nothing
|
|
|
|
|
172 |
}
|
173 |
}
|
174 |
|
32 |
protected $processors = array();
|
33 |
|
34 |
/**
|
35 |
+
* @param int $level The minimum logging level at which this handler will be triggered
|
36 |
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
37 |
*/
|
38 |
public function __construct($level = Logger::DEBUG, $bubble = true)
|
118 |
/**
|
119 |
* Sets minimum logging level at which this handler will be triggered.
|
120 |
*
|
121 |
+
* @param int|string $level Level or level name
|
122 |
* @return self
|
123 |
*/
|
124 |
public function setLevel($level)
|
131 |
/**
|
132 |
* Gets minimum logging level at which this handler will be triggered.
|
133 |
*
|
134 |
+
* @return int
|
135 |
*/
|
136 |
public function getLevel()
|
137 |
{
|
169 |
$this->close();
|
170 |
} catch (\Exception $e) {
|
171 |
// do nothing
|
172 |
+
} catch (\Throwable $e) {
|
173 |
+
// do nothing
|
174 |
}
|
175 |
}
|
176 |
|
vendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php
CHANGED
@@ -54,7 +54,7 @@ abstract class AbstractSyslogHandler extends AbstractProcessingHandler
|
|
54 |
|
55 |
/**
|
56 |
* @param mixed $facility
|
57 |
-
* @param
|
58 |
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
59 |
*/
|
60 |
public function __construct($facility = LOG_USER, $level = Logger::DEBUG, $bubble = true)
|
@@ -70,6 +70,15 @@ abstract class AbstractSyslogHandler extends AbstractProcessingHandler
|
|
70 |
$this->facilities['local5'] = LOG_LOCAL5;
|
71 |
$this->facilities['local6'] = LOG_LOCAL6;
|
72 |
$this->facilities['local7'] = LOG_LOCAL7;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
}
|
74 |
|
75 |
// convert textual description of facility to syslog constant
|
54 |
|
55 |
/**
|
56 |
* @param mixed $facility
|
57 |
+
* @param int $level The minimum logging level at which this handler will be triggered
|
58 |
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
59 |
*/
|
60 |
public function __construct($facility = LOG_USER, $level = Logger::DEBUG, $bubble = true)
|
70 |
$this->facilities['local5'] = LOG_LOCAL5;
|
71 |
$this->facilities['local6'] = LOG_LOCAL6;
|
72 |
$this->facilities['local7'] = LOG_LOCAL7;
|
73 |
+
} else {
|
74 |
+
$this->facilities['local0'] = 128; // LOG_LOCAL0
|
75 |
+
$this->facilities['local1'] = 136; // LOG_LOCAL1
|
76 |
+
$this->facilities['local2'] = 144; // LOG_LOCAL2
|
77 |
+
$this->facilities['local3'] = 152; // LOG_LOCAL3
|
78 |
+
$this->facilities['local4'] = 160; // LOG_LOCAL4
|
79 |
+
$this->facilities['local5'] = 168; // LOG_LOCAL5
|
80 |
+
$this->facilities['local6'] = 176; // LOG_LOCAL6
|
81 |
+
$this->facilities['local7'] = 184; // LOG_LOCAL7
|
82 |
}
|
83 |
|
84 |
// convert textual description of facility to syslog constant
|
vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php
CHANGED
@@ -55,39 +55,89 @@ class AmqpHandler extends AbstractProcessingHandler
|
|
55 |
protected function write(array $record)
|
56 |
{
|
57 |
$data = $record["formatted"];
|
58 |
-
|
59 |
-
$routingKey = sprintf(
|
60 |
-
'%s.%s',
|
61 |
-
// TODO 2.0 remove substr call
|
62 |
-
substr($record['level_name'], 0, 4),
|
63 |
-
$record['channel']
|
64 |
-
);
|
65 |
|
66 |
if ($this->exchange instanceof AMQPExchange) {
|
67 |
$this->exchange->publish(
|
68 |
$data,
|
69 |
-
|
70 |
0,
|
71 |
array(
|
72 |
'delivery_mode' => 2,
|
73 |
-
'
|
74 |
)
|
75 |
);
|
76 |
} else {
|
77 |
$this->exchange->basic_publish(
|
78 |
-
|
79 |
-
(string) $data,
|
80 |
-
array(
|
81 |
-
'delivery_mode' => 2,
|
82 |
-
'content_type' => 'application/json'
|
83 |
-
)
|
84 |
-
),
|
85 |
$this->exchangeName,
|
86 |
-
|
87 |
);
|
88 |
}
|
89 |
}
|
90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
/**
|
92 |
* {@inheritDoc}
|
93 |
*/
|
55 |
protected function write(array $record)
|
56 |
{
|
57 |
$data = $record["formatted"];
|
58 |
+
$routingKey = $this->getRoutingKey($record);
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
if ($this->exchange instanceof AMQPExchange) {
|
61 |
$this->exchange->publish(
|
62 |
$data,
|
63 |
+
$routingKey,
|
64 |
0,
|
65 |
array(
|
66 |
'delivery_mode' => 2,
|
67 |
+
'content_type' => 'application/json',
|
68 |
)
|
69 |
);
|
70 |
} else {
|
71 |
$this->exchange->basic_publish(
|
72 |
+
$this->createAmqpMessage($data),
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
$this->exchangeName,
|
74 |
+
$routingKey
|
75 |
);
|
76 |
}
|
77 |
}
|
78 |
|
79 |
+
/**
|
80 |
+
* {@inheritDoc}
|
81 |
+
*/
|
82 |
+
public function handleBatch(array $records)
|
83 |
+
{
|
84 |
+
if ($this->exchange instanceof AMQPExchange) {
|
85 |
+
parent::handleBatch($records);
|
86 |
+
|
87 |
+
return;
|
88 |
+
}
|
89 |
+
|
90 |
+
foreach ($records as $record) {
|
91 |
+
if (!$this->isHandling($record)) {
|
92 |
+
continue;
|
93 |
+
}
|
94 |
+
|
95 |
+
$record = $this->processRecord($record);
|
96 |
+
$data = $this->getFormatter()->format($record);
|
97 |
+
|
98 |
+
$this->exchange->batch_basic_publish(
|
99 |
+
$this->createAmqpMessage($data),
|
100 |
+
$this->exchangeName,
|
101 |
+
$this->getRoutingKey($record)
|
102 |
+
);
|
103 |
+
}
|
104 |
+
|
105 |
+
$this->exchange->publish_batch();
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Gets the routing key for the AMQP exchange
|
110 |
+
*
|
111 |
+
* @param array $record
|
112 |
+
* @return string
|
113 |
+
*/
|
114 |
+
protected function getRoutingKey(array $record)
|
115 |
+
{
|
116 |
+
$routingKey = sprintf(
|
117 |
+
'%s.%s',
|
118 |
+
// TODO 2.0 remove substr call
|
119 |
+
substr($record['level_name'], 0, 4),
|
120 |
+
$record['channel']
|
121 |
+
);
|
122 |
+
|
123 |
+
return strtolower($routingKey);
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* @param string $data
|
128 |
+
* @return AMQPMessage
|
129 |
+
*/
|
130 |
+
private function createAmqpMessage($data)
|
131 |
+
{
|
132 |
+
return new AMQPMessage(
|
133 |
+
(string) $data,
|
134 |
+
array(
|
135 |
+
'delivery_mode' => 2,
|
136 |
+
'content_type' => 'application/json',
|
137 |
+
)
|
138 |
+
);
|
139 |
+
}
|
140 |
+
|
141 |
/**
|
142 |
* {@inheritDoc}
|
143 |
*/
|
vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php
CHANGED
@@ -31,7 +31,6 @@ class BrowserConsoleHandler extends AbstractProcessingHandler
|
|
31 |
* Example of formatted string:
|
32 |
*
|
33 |
* You can do [[blue text]]{color: blue} or [[green background]]{background-color: green; color: white}
|
34 |
-
*
|
35 |
*/
|
36 |
protected function getDefaultFormatter()
|
37 |
{
|
@@ -47,9 +46,9 @@ class BrowserConsoleHandler extends AbstractProcessingHandler
|
|
47 |
self::$records[] = $record;
|
48 |
|
49 |
// Register shutdown handler if not already done
|
50 |
-
if (
|
51 |
self::$initialized = true;
|
52 |
-
|
53 |
}
|
54 |
}
|
55 |
|
@@ -59,26 +58,16 @@ class BrowserConsoleHandler extends AbstractProcessingHandler
|
|
59 |
*/
|
60 |
public static function send()
|
61 |
{
|
62 |
-
$
|
63 |
-
|
64 |
-
|
65 |
-
if (stripos($header, 'content-type:') === 0) {
|
66 |
-
// This handler only works with HTML and javascript outputs
|
67 |
-
// text/javascript is obsolete in favour of application/javascript, but still used
|
68 |
-
if (stripos($header, 'application/javascript') !== false || stripos($header, 'text/javascript') !== false) {
|
69 |
-
$htmlTags = false;
|
70 |
-
} elseif (stripos($header, 'text/html') === false) {
|
71 |
-
return;
|
72 |
-
}
|
73 |
-
break;
|
74 |
-
}
|
75 |
}
|
76 |
|
77 |
if (count(self::$records)) {
|
78 |
-
if ($
|
79 |
-
|
80 |
-
}
|
81 |
-
|
82 |
}
|
83 |
self::reset();
|
84 |
}
|
@@ -92,6 +81,55 @@ class BrowserConsoleHandler extends AbstractProcessingHandler
|
|
92 |
self::$records = array();
|
93 |
}
|
94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
private static function generateScript()
|
96 |
{
|
97 |
$script = array();
|
31 |
* Example of formatted string:
|
32 |
*
|
33 |
* You can do [[blue text]]{color: blue} or [[green background]]{background-color: green; color: white}
|
|
|
34 |
*/
|
35 |
protected function getDefaultFormatter()
|
36 |
{
|
46 |
self::$records[] = $record;
|
47 |
|
48 |
// Register shutdown handler if not already done
|
49 |
+
if (!self::$initialized) {
|
50 |
self::$initialized = true;
|
51 |
+
$this->registerShutdownFunction();
|
52 |
}
|
53 |
}
|
54 |
|
58 |
*/
|
59 |
public static function send()
|
60 |
{
|
61 |
+
$format = self::getResponseFormat();
|
62 |
+
if ($format === 'unknown') {
|
63 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
}
|
65 |
|
66 |
if (count(self::$records)) {
|
67 |
+
if ($format === 'html') {
|
68 |
+
self::writeOutput('<script>' . self::generateScript() . '</script>');
|
69 |
+
} elseif ($format === 'js') {
|
70 |
+
self::writeOutput(self::generateScript());
|
71 |
}
|
72 |
self::reset();
|
73 |
}
|
81 |
self::$records = array();
|
82 |
}
|
83 |
|
84 |
+
/**
|
85 |
+
* Wrapper for register_shutdown_function to allow overriding
|
86 |
+
*/
|
87 |
+
protected function registerShutdownFunction()
|
88 |
+
{
|
89 |
+
if (PHP_SAPI !== 'cli') {
|
90 |
+
register_shutdown_function(array('Monolog\Handler\BrowserConsoleHandler', 'send'));
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Wrapper for echo to allow overriding
|
96 |
+
*
|
97 |
+
* @param string $str
|
98 |
+
*/
|
99 |
+
protected static function writeOutput($str)
|
100 |
+
{
|
101 |
+
echo $str;
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Checks the format of the response
|
106 |
+
*
|
107 |
+
* If Content-Type is set to application/javascript or text/javascript -> js
|
108 |
+
* If Content-Type is set to text/html, or is unset -> html
|
109 |
+
* If Content-Type is anything else -> unknown
|
110 |
+
*
|
111 |
+
* @return string One of 'js', 'html' or 'unknown'
|
112 |
+
*/
|
113 |
+
protected static function getResponseFormat()
|
114 |
+
{
|
115 |
+
// Check content type
|
116 |
+
foreach (headers_list() as $header) {
|
117 |
+
if (stripos($header, 'content-type:') === 0) {
|
118 |
+
// This handler only works with HTML and javascript outputs
|
119 |
+
// text/javascript is obsolete in favour of application/javascript, but still used
|
120 |
+
if (stripos($header, 'application/javascript') !== false || stripos($header, 'text/javascript') !== false) {
|
121 |
+
return 'js';
|
122 |
+
}
|
123 |
+
if (stripos($header, 'text/html') === false) {
|
124 |
+
return 'unknown';
|
125 |
+
}
|
126 |
+
break;
|
127 |
+
}
|
128 |
+
}
|
129 |
+
|
130 |
+
return 'html';
|
131 |
+
}
|
132 |
+
|
133 |
private static function generateScript()
|
134 |
{
|
135 |
$script = array();
|
vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php
CHANGED
@@ -32,8 +32,8 @@ class BufferHandler extends AbstractHandler
|
|
32 |
|
33 |
/**
|
34 |
* @param HandlerInterface $handler Handler.
|
35 |
-
* @param
|
36 |
-
* @param
|
37 |
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
38 |
* @param Boolean $flushOnOverflow If true, the buffer is flushed when the max size has been reached, by default oldest entries are discarded
|
39 |
*/
|
32 |
|
33 |
/**
|
34 |
* @param HandlerInterface $handler Handler.
|
35 |
+
* @param int $bufferLimit How many entries should be buffered at most, beyond that the oldest items are removed from the buffer.
|
36 |
+
* @param int $level The minimum logging level at which this handler will be triggered
|
37 |
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
38 |
* @param Boolean $flushOnOverflow If true, the buffer is flushed when the max size has been reached, by default oldest entries are discarded
|
39 |
*/
|
vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php
CHANGED
@@ -17,6 +17,8 @@ use Monolog\Logger;
|
|
17 |
/**
|
18 |
* Handler sending logs to the ChromePHP extension (http://www.chromephp.com/)
|
19 |
*
|
|
|
|
|
20 |
* @author Christophe Coevoet <stof@notk.org>
|
21 |
*/
|
22 |
class ChromePHPHandler extends AbstractProcessingHandler
|
@@ -30,6 +32,11 @@ class ChromePHPHandler extends AbstractProcessingHandler
|
|
30 |
* Header name
|
31 |
*/
|
32 |
const HEADER_NAME = 'X-ChromeLogger-Data';
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
protected static $initialized = false;
|
35 |
|
@@ -51,7 +58,7 @@ class ChromePHPHandler extends AbstractProcessingHandler
|
|
51 |
protected static $sendHeaders = true;
|
52 |
|
53 |
/**
|
54 |
-
* @param
|
55 |
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
56 |
*/
|
57 |
public function __construct($level = Logger::DEBUG, $bubble = true)
|
@@ -175,7 +182,7 @@ class ChromePHPHandler extends AbstractProcessingHandler
|
|
175 |
return false;
|
176 |
}
|
177 |
|
178 |
-
return preg_match(
|
179 |
}
|
180 |
|
181 |
/**
|
17 |
/**
|
18 |
* Handler sending logs to the ChromePHP extension (http://www.chromephp.com/)
|
19 |
*
|
20 |
+
* This also works out of the box with Firefox 43+
|
21 |
+
*
|
22 |
* @author Christophe Coevoet <stof@notk.org>
|
23 |
*/
|
24 |
class ChromePHPHandler extends AbstractProcessingHandler
|
32 |
* Header name
|
33 |
*/
|
34 |
const HEADER_NAME = 'X-ChromeLogger-Data';
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Regular expression to detect supported browsers (matches any Chrome, or Firefox 43+)
|
38 |
+
*/
|
39 |
+
const USER_AGENT_REGEX = '{\b(?:Chrome/\d+(?:\.\d+)*|HeadlessChrome|Firefox/(?:4[3-9]|[5-9]\d|\d{3,})(?:\.\d)*)\b}';
|
40 |
|
41 |
protected static $initialized = false;
|
42 |
|
58 |
protected static $sendHeaders = true;
|
59 |
|
60 |
/**
|
61 |
+
* @param int $level The minimum logging level at which this handler will be triggered
|
62 |
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
63 |
*/
|
64 |
public function __construct($level = Logger::DEBUG, $bubble = true)
|
182 |
return false;
|
183 |
}
|
184 |
|
185 |
+
return preg_match(self::USER_AGENT_REGEX, $_SERVER['HTTP_USER_AGENT']);
|
186 |
}
|
187 |
|
188 |
/**
|
vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php
CHANGED
@@ -54,7 +54,7 @@ class CouchDBHandler extends AbstractProcessingHandler
|
|
54 |
'ignore_errors' => true,
|
55 |
'max_redirects' => 0,
|
56 |
'header' => 'Content-type: application/json',
|
57 |
-
)
|
58 |
));
|
59 |
|
60 |
if (false === @file_get_contents($url, null, $context)) {
|
54 |
'ignore_errors' => true,
|
55 |
'max_redirects' => 0,
|
56 |
'header' => 'Content-type: application/json',
|
57 |
+
),
|
58 |
));
|
59 |
|
60 |
if (false === @file_get_contents($url, null, $context)) {
|
vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php
CHANGED
@@ -21,37 +21,37 @@ use Monolog\Logger;
|
|
21 |
*/
|
22 |
class CubeHandler extends AbstractProcessingHandler
|
23 |
{
|
24 |
-
private $udpConnection
|
25 |
-
private $httpConnection
|
26 |
-
private $scheme
|
27 |
-
private $host
|
28 |
-
private $port
|
29 |
private $acceptedSchemes = array('http', 'udp');
|
30 |
|
31 |
/**
|
32 |
* Create a Cube handler
|
33 |
*
|
34 |
* @throws \UnexpectedValueException when given url is not a valid url.
|
35 |
-
*
|
36 |
-
*
|
37 |
*/
|
38 |
public function __construct($url, $level = Logger::DEBUG, $bubble = true)
|
39 |
{
|
40 |
-
$
|
41 |
|
42 |
-
if (!isset($
|
43 |
throw new \UnexpectedValueException('URL "'.$url.'" is not valid');
|
44 |
}
|
45 |
|
46 |
-
if (!in_array($
|
47 |
throw new \UnexpectedValueException(
|
48 |
-
'Invalid protocol (' . $
|
49 |
. ' Valid options are ' . implode(', ', $this->acceptedSchemes));
|
50 |
}
|
51 |
|
52 |
-
$this->scheme = $
|
53 |
-
$this->host = $
|
54 |
-
$this->port = $
|
55 |
|
56 |
parent::__construct($level, $bubble);
|
57 |
}
|
@@ -59,7 +59,8 @@ class CubeHandler extends AbstractProcessingHandler
|
|
59 |
/**
|
60 |
* Establish a connection to an UDP socket
|
61 |
*
|
62 |
-
* @throws \LogicException
|
|
|
63 |
*/
|
64 |
protected function connectUdp()
|
65 |
{
|
@@ -79,6 +80,7 @@ class CubeHandler extends AbstractProcessingHandler
|
|
79 |
|
80 |
/**
|
81 |
* Establish a connection to a http server
|
|
|
82 |
*/
|
83 |
protected function connectHttp()
|
84 |
{
|
@@ -140,10 +142,10 @@ class CubeHandler extends AbstractProcessingHandler
|
|
140 |
|
141 |
curl_setopt($this->httpConnection, CURLOPT_POSTFIELDS, '['.$data.']');
|
142 |
curl_setopt($this->httpConnection, CURLOPT_HTTPHEADER, array(
|
143 |
-
|
144 |
-
|
145 |
-
);
|
146 |
|
147 |
-
Curl\Util::execute($
|
148 |
}
|
149 |
}
|
21 |
*/
|
22 |
class CubeHandler extends AbstractProcessingHandler
|
23 |
{
|
24 |
+
private $udpConnection;
|
25 |
+
private $httpConnection;
|
26 |
+
private $scheme;
|
27 |
+
private $host;
|
28 |
+
private $port;
|
29 |
private $acceptedSchemes = array('http', 'udp');
|
30 |
|
31 |
/**
|
32 |
* Create a Cube handler
|
33 |
*
|
34 |
* @throws \UnexpectedValueException when given url is not a valid url.
|
35 |
+
* A valid url must consist of three parts : protocol://host:port
|
36 |
+
* Only valid protocols used by Cube are http and udp
|
37 |
*/
|
38 |
public function __construct($url, $level = Logger::DEBUG, $bubble = true)
|
39 |
{
|
40 |
+
$urlInfo = parse_url($url);
|
41 |
|
42 |
+
if (!isset($urlInfo['scheme'], $urlInfo['host'], $urlInfo['port'])) {
|
43 |
throw new \UnexpectedValueException('URL "'.$url.'" is not valid');
|
44 |
}
|
45 |
|
46 |
+
if (!in_array($urlInfo['scheme'], $this->acceptedSchemes)) {
|
47 |
throw new \UnexpectedValueException(
|
48 |
+
'Invalid protocol (' . $urlInfo['scheme'] . ').'
|
49 |
. ' Valid options are ' . implode(', ', $this->acceptedSchemes));
|
50 |
}
|
51 |
|
52 |
+
$this->scheme = $urlInfo['scheme'];
|
53 |
+
$this->host = $urlInfo['host'];
|
54 |
+
$this->port = $urlInfo['port'];
|
55 |
|
56 |
parent::__construct($level, $bubble);
|
57 |
}
|
59 |
/**
|
60 |
* Establish a connection to an UDP socket
|
61 |
*
|
62 |
+
* @throws \LogicException when unable to connect to the socket
|
63 |
+
* @throws MissingExtensionException when there is no socket extension
|
64 |
*/
|
65 |
protected function connectUdp()
|
66 |
{
|
80 |
|
81 |
/**
|
82 |
* Establish a connection to a http server
|
83 |
+
* @throws \LogicException when no curl extension
|
84 |
*/
|
85 |
protected function connectHttp()
|
86 |
{
|
142 |
|
143 |
curl_setopt($this->httpConnection, CURLOPT_POSTFIELDS, '['.$data.']');
|
144 |
curl_setopt($this->httpConnection, CURLOPT_HTTPHEADER, array(
|
145 |
+
'Content-Type: application/json',
|
146 |
+
'Content-Length: ' . strlen('['.$data.']'),
|
147 |
+
));
|
148 |
|
149 |
+
Curl\Util::execute($this->httpConnection, 5, false);
|
150 |
}
|
151 |
}
|
vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php
CHANGED
@@ -26,20 +26,18 @@ class Util
|
|
26 |
/**
|
27 |
* Executes a CURL request with optional retries and exception on failure
|
28 |
*
|
29 |
-
* @param
|
30 |
* @throws \RuntimeException
|
31 |
*/
|
32 |
public static function execute($ch, $retries = 5, $closeAfterDone = true)
|
33 |
{
|
34 |
while ($retries--) {
|
35 |
if (curl_exec($ch) === false) {
|
36 |
-
|
37 |
$curlErrno = curl_errno($ch);
|
38 |
-
|
39 |
if (false === in_array($curlErrno, self::$retriableErrorCodes, true) || !$retries) {
|
40 |
-
|
41 |
$curlError = curl_error($ch);
|
42 |
-
|
43 |
if ($closeAfterDone) {
|
44 |
curl_close($ch);
|
45 |
}
|
26 |
/**
|
27 |
* Executes a CURL request with optional retries and exception on failure
|
28 |
*
|
29 |
+
* @param resource $ch curl handler
|
30 |
* @throws \RuntimeException
|
31 |
*/
|
32 |
public static function execute($ch, $retries = 5, $closeAfterDone = true)
|
33 |
{
|
34 |
while ($retries--) {
|
35 |
if (curl_exec($ch) === false) {
|
|
|
36 |
$curlErrno = curl_errno($ch);
|
37 |
+
|
38 |
if (false === in_array($curlErrno, self::$retriableErrorCodes, true) || !$retries) {
|
|
|
39 |
$curlError = curl_error($ch);
|
40 |
+
|
41 |
if ($closeAfterDone) {
|
42 |
curl_close($ch);
|
43 |
}
|
vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php
ADDED
@@ -0,0 +1,169 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Monolog package.
|
5 |
+
*
|
6 |
+
* (c) Jordi Boggiano <j.boggiano@seld.be>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Monolog\Handler;
|
13 |
+
|
14 |
+
use Monolog\Logger;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Simple handler wrapper that deduplicates log records across multiple requests
|
18 |
+
*
|
19 |
+
* It also includes the BufferHandler functionality and will buffer
|
20 |
+
* all messages until the end of the request or flush() is called.
|
21 |
+
*
|
22 |
+
* This works by storing all log records' messages above $deduplicationLevel
|
23 |
+
* to the file specified by $deduplicationStore. When further logs come in at the end of the
|
24 |
+
* request (or when flush() is called), all those above $deduplicationLevel are checked
|
25 |
+
* against the existing stored logs. If they match and the timestamps in the stored log is
|
26 |
+
* not older than $time seconds, the new log record is discarded. If no log record is new, the
|
27 |
+
* whole data set is discarded.
|
28 |
+
*
|
29 |
+
* This is mainly useful in combination with Mail handlers or things like Slack or HipChat handlers
|
30 |
+
* that send messages to people, to avoid spamming with the same message over and over in case of
|
31 |
+
* a major component failure like a database server being down which makes all requests fail in the
|
32 |
+
* same way.
|
33 |
+
*
|
34 |
+
* @author Jordi Boggiano <j.boggiano@seld.be>
|
35 |
+
*/
|
36 |
+
class DeduplicationHandler extends BufferHandler
|
37 |
+
{
|
38 |
+
/**
|
39 |
+
* @var string
|
40 |
+
*/
|
41 |
+
protected $deduplicationStore;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @var int
|
45 |
+
*/
|
46 |
+
protected $deduplicationLevel;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* @var int
|
50 |
+
*/
|
51 |
+
protected $time;
|
52 |
+
|
53 |
+
/**
|
54 |
+
* @var bool
|
55 |
+
*/
|
56 |
+
private $gc = false;
|
57 |
+
|
58 |
+
/**
|
59 |
+
* @param HandlerInterface $handler Handler.
|
60 |
+
* @param string $deduplicationStore The file/path where the deduplication log should be kept
|
61 |
+
* @param int $deduplicationLevel The minimum logging level for log records to be looked at for deduplication purposes
|
62 |
+
* @param int $time The period (in seconds) during which duplicate entries should be suppressed after a given log is sent through
|
63 |
+
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
64 |
+
*/
|
65 |
+
public function __construct(HandlerInterface $handler, $deduplicationStore = null, $deduplicationLevel = Logger::ERROR, $time = 60, $bubble = true)
|
66 |
+
{
|
67 |
+
parent::__construct($handler, 0, Logger::DEBUG, $bubble, false);
|
68 |
+
|
69 |
+
$this->deduplicationStore = $deduplicationStore === null ? sys_get_temp_dir() . '/monolog-dedup-' . substr(md5(__FILE__), 0, 20) .'.log' : $deduplicationStore;
|
70 |
+
$this->deduplicationLevel = Logger::toMonologLevel($deduplicationLevel);
|
71 |
+
$this->time = $time;
|
72 |
+
}
|
73 |
+
|
74 |
+
public function flush()
|
75 |
+
{
|
76 |
+
if ($this->bufferSize === 0) {
|
77 |
+
return;
|
78 |
+
}
|
79 |
+
|
80 |
+
$passthru = null;
|
81 |
+
|
82 |
+
foreach ($this->buffer as $record) {
|
83 |
+
if ($record['level'] >= $this->deduplicationLevel) {
|
84 |
+
|
85 |
+
$passthru = $passthru || !$this->isDuplicate($record);
|
86 |
+
if ($passthru) {
|
87 |
+
$this->appendRecord($record);
|
88 |
+
}
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
// default of null is valid as well as if no record matches duplicationLevel we just pass through
|
93 |
+
if ($passthru === true || $passthru === null) {
|
94 |
+
$this->handler->handleBatch($this->buffer);
|
95 |
+
}
|
96 |
+
|
97 |
+
$this->clear();
|
98 |
+
|
99 |
+
if ($this->gc) {
|
100 |
+
$this->collectLogs();
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
private function isDuplicate(array $record)
|
105 |
+
{
|
106 |
+
if (!file_exists($this->deduplicationStore)) {
|
107 |
+
return false;
|
108 |
+
}
|
109 |
+
|
110 |
+
$store = file($this->deduplicationStore, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
111 |
+
if (!is_array($store)) {
|
112 |
+
return false;
|
113 |
+
}
|
114 |
+
|
115 |
+
$yesterday = time() - 86400;
|
116 |
+
$timestampValidity = $record['datetime']->getTimestamp() - $this->time;
|
117 |
+
$expectedMessage = preg_replace('{[\r\n].*}', '', $record['message']);
|
118 |
+
|
119 |
+
for ($i = count($store) - 1; $i >= 0; $i--) {
|
120 |
+
list($timestamp, $level, $message) = explode(':', $store[$i], 3);
|
121 |
+
|
122 |
+
if ($level === $record['level_name'] && $message === $expectedMessage && $timestamp > $timestampValidity) {
|
123 |
+
return true;
|
124 |
+
}
|
125 |
+
|
126 |
+
if ($timestamp < $yesterday) {
|
127 |
+
$this->gc = true;
|
128 |
+
}
|
129 |
+
}
|
130 |
+
|
131 |
+
return false;
|
132 |
+
}
|
133 |
+
|
134 |
+
private function collectLogs()
|
135 |
+
{
|
136 |
+
if (!file_exists($this->deduplicationStore)) {
|
137 |
+
return false;
|
138 |
+
}
|
139 |
+
|
140 |
+
$handle = fopen($this->deduplicationStore, 'rw+');
|
141 |
+
flock($handle, LOCK_EX);
|
142 |
+
$validLogs = array();
|
143 |
+
|
144 |
+
$timestampValidity = time() - $this->time;
|
145 |
+
|
146 |
+
while (!feof($handle)) {
|
147 |
+
$log = fgets($handle);
|
148 |
+
if (substr($log, 0, 10) >= $timestampValidity) {
|
149 |
+
$validLogs[] = $log;
|
150 |
+
}
|
151 |
+
}
|
152 |
+
|
153 |
+
ftruncate($handle, 0);
|
154 |
+
rewind($handle);
|
155 |
+
foreach ($validLogs as $log) {
|
156 |
+
fwrite($handle, $log);
|
157 |
+
}
|
158 |
+
|
159 |
+
flock($handle, LOCK_UN);
|
160 |
+
fclose($handle);
|
161 |
+
|
162 |
+
$this->gc = false;
|
163 |
+
}
|
164 |
+
|
165 |
+
private function appendRecord(array $record)
|
166 |
+
{
|
167 |
+
file_put_contents($this->deduplicationStore, $record['datetime']->getTimestamp() . ':' . $record['level_name'] . ':' . preg_replace('{[\r\n].*}', '', $record['message']) . "\n", FILE_APPEND);
|
168 |
+
}
|
169 |
+
}
|
vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php
CHANGED
@@ -11,8 +11,9 @@
|
|
11 |
|
12 |
namespace Monolog\Handler;
|
13 |
|
14 |
-
use Aws\
|
15 |
use Aws\DynamoDb\DynamoDbClient;
|
|
|
16 |
use Monolog\Formatter\ScalarFormatter;
|
17 |
use Monolog\Logger;
|
18 |
|
@@ -36,16 +37,29 @@ class DynamoDbHandler extends AbstractProcessingHandler
|
|
36 |
*/
|
37 |
protected $table;
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
/**
|
40 |
* @param DynamoDbClient $client
|
41 |
* @param string $table
|
42 |
-
* @param
|
43 |
-
* @param
|
44 |
*/
|
45 |
public function __construct(DynamoDbClient $client, $table, $level = Logger::DEBUG, $bubble = true)
|
46 |
{
|
47 |
-
if (
|
48 |
-
|
|
|
|
|
|
|
49 |
}
|
50 |
|
51 |
$this->client = $client;
|
@@ -60,11 +74,15 @@ class DynamoDbHandler extends AbstractProcessingHandler
|
|
60 |
protected function write(array $record)
|
61 |
{
|
62 |
$filtered = $this->filterEmptyFields($record['formatted']);
|
63 |
-
|
|
|
|
|
|
|
|
|
64 |
|
65 |
$this->client->putItem(array(
|
66 |
'TableName' => $this->table,
|
67 |
-
'Item' => $formatted
|
68 |
));
|
69 |
}
|
70 |
|
11 |
|
12 |
namespace Monolog\Handler;
|
13 |
|
14 |
+
use Aws\Sdk;
|
15 |
use Aws\DynamoDb\DynamoDbClient;
|
16 |
+
use Aws\DynamoDb\Marshaler;
|
17 |
use Monolog\Formatter\ScalarFormatter;
|
18 |
use Monolog\Logger;
|
19 |
|
37 |
*/
|
38 |
protected $table;
|
39 |
|
40 |
+
/**
|
41 |
+
* @var int
|
42 |
+
*/
|
43 |
+
protected $version;
|
44 |
+
|
45 |
+
/**
|
46 |
+
* @var Marshaler
|
47 |
+
*/
|
48 |
+
protected $marshaler;
|
49 |
+
|
50 |
/**
|
51 |
* @param DynamoDbClient $client
|
52 |
* @param string $table
|
53 |
+
* @param int $level
|
54 |
+
* @param bool $bubble
|
55 |
*/
|
56 |
public function __construct(DynamoDbClient $client, $table, $level = Logger::DEBUG, $bubble = true)
|
57 |
{
|
58 |
+
if (defined('Aws\Sdk::VERSION') && version_compare(Sdk::VERSION, '3.0', '>=')) {
|
59 |
+
$this->version = 3;
|
60 |
+
$this->marshaler = new Marshaler;
|
61 |
+
} else {
|
62 |
+
$this->version = 2;
|
63 |
}
|
64 |
|
65 |
$this->client = $client;
|
74 |
protected function write(array $record)
|
75 |
{
|
76 |
$filtered = $this->filterEmptyFields($record['formatted']);
|
77 |
+
if ($this->version === 3) {
|
78 |
+
$formatted = $this->marshaler->marshalItem($filtered);
|
79 |
+
} else {
|
80 |
+
$formatted = $this->client->formatAttributes($filtered);
|
81 |
+
}
|
82 |
|
83 |
$this->client->putItem(array(
|
84 |
'TableName' => $this->table,
|
85 |
+
'Item' => $formatted,
|
86 |
));
|
87 |
}
|
88 |
|
vendor/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php
CHANGED
@@ -48,7 +48,7 @@ class ElasticSearchHandler extends AbstractProcessingHandler
|
|
48 |
/**
|
49 |
* @param Client $client Elastica Client object
|
50 |
* @param array $options Handler configuration
|
51 |
-
* @param
|
52 |
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
53 |
*/
|
54 |
public function __construct(Client $client, array $options = array(), $level = Logger::DEBUG, $bubble = true)
|
48 |
/**
|
49 |
* @param Client $client Elastica Client object
|
50 |
* @param array $options Handler configuration
|
51 |
+
* @param int $level The minimum logging level at which this handler will be triggered
|
52 |
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
53 |
*/
|
54 |
public function __construct(Client $client, array $options = array(), $level = Logger::DEBUG, $bubble = true)
|
vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php
CHANGED
@@ -28,8 +28,8 @@ class ErrorLogHandler extends AbstractProcessingHandler
|
|
28 |
protected $expandNewlines;
|
29 |
|
30 |
/**
|
31 |
-
* @param
|
32 |
-
* @param
|
33 |
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
34 |
* @param Boolean $expandNewlines If set to true, newlines in the message will be expanded to be take multiple log entries
|
35 |
*/
|
28 |
protected $expandNewlines;
|
29 |
|
30 |
/**
|
31 |
+
* @param int $messageType Says where the error should go.
|
32 |
+
* @param int $level The minimum logging level at which this handler will be triggered
|
33 |
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
34 |
* @param Boolean $expandNewlines If set to true, newlines in the message will be expanded to be take multiple log entries
|
35 |
*/
|
vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php
CHANGED
@@ -31,7 +31,7 @@ class FilterHandler extends AbstractHandler
|
|
31 |
protected $handler;
|
32 |
|
33 |
/**
|
34 |
-
* Minimum level for logs that are
|
35 |
*
|
36 |
* @var int[]
|
37 |
*/
|
@@ -70,8 +70,8 @@ class FilterHandler extends AbstractHandler
|
|
70 |
}
|
71 |
|
72 |
/**
|
73 |
-
* @param int|array $minLevelOrList A list of levels to accept or a minimum level if maxLevel is provided
|
74 |
-
* @param int $maxLevel Maximum level to accept, only used if $minLevelOrList is not an array
|
75 |
*/
|
76 |
public function setAcceptedLevels($minLevelOrList = Logger::DEBUG, $maxLevel = Logger::EMERGENCY)
|
77 |
{
|
31 |
protected $handler;
|
32 |
|
33 |
/**
|
34 |
+
* Minimum level for logs that are passed to handler
|
35 |
*
|
36 |
* @var int[]
|
37 |
*/
|
70 |
}
|
71 |
|
72 |
/**
|
73 |
+
* @param int|string|array $minLevelOrList A list of levels to accept or a minimum level or level name if maxLevel is provided
|
74 |
+
* @param int|string $maxLevel Maximum level or level name to accept, only used if $minLevelOrList is not an array
|
75 |
*/
|
76 |
public function setAcceptedLevels($minLevelOrList = Logger::DEBUG, $maxLevel = Logger::EMERGENCY)
|
77 |
{
|
vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php
CHANGED
@@ -2,12 +2,12 @@
|
|
2 |
|
3 |
/*
|
4 |
* This file is part of the Monolog package.
|
5 |
-
*
|
6 |
-
* (c) Jordi Boggiano <j.boggiano@seld.be>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
|
12 |
namespace Monolog\Handler\FingersCrossed;
|
13 |
|
2 |
|
3 |
/*
|
4 |
* This file is part of the Monolog package.
|
5 |
+
*
|
6 |
+
* (c) Jordi Boggiano <j.boggiano@seld.be>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
|
12 |
namespace Monolog\Handler\FingersCrossed;
|
13 |
|
vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php
CHANGED
@@ -79,6 +79,26 @@ class FingersCrossedHandler extends AbstractHandler
|
|
79 |
return true;
|
80 |
}
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
/**
|
83 |
* {@inheritdoc}
|
84 |
*/
|
@@ -96,17 +116,7 @@ class FingersCrossedHandler extends AbstractHandler
|
|
96 |
array_shift($this->buffer);
|
97 |
}
|
98 |
if ($this->activationStrategy->isHandlerActivated($record)) {
|
99 |
-
|
100 |
-
$this->buffering = false;
|
101 |
-
}
|
102 |
-
if (!$this->handler instanceof HandlerInterface) {
|
103 |
-
$this->handler = call_user_func($this->handler, $record, $this);
|
104 |
-
if (!$this->handler instanceof HandlerInterface) {
|
105 |
-
throw new \RuntimeException("The factory callable should return a HandlerInterface");
|
106 |
-
}
|
107 |
-
}
|
108 |
-
$this->handler->handleBatch($this->buffer);
|
109 |
-
$this->buffer = array();
|
110 |
}
|
111 |
} else {
|
112 |
$this->handler->handle($record);
|
79 |
return true;
|
80 |
}
|
81 |
|
82 |
+
/**
|
83 |
+
* Manually activate this logger regardless of the activation strategy
|
84 |
+
*/
|
85 |
+
public function activate()
|
86 |
+
{
|
87 |
+
if ($this->stopBuffering) {
|
88 |
+
$this->buffering = false;
|
89 |
+
}
|
90 |
+
if (!$this->handler instanceof HandlerInterface) {
|
91 |
+
$record = end($this->buffer) ?: null;
|
92 |
+
|
93 |
+
$this->handler = call_user_func($this->handler, $record, $this);
|
94 |
+
if (!$this->handler instanceof HandlerInterface) {
|
95 |
+
throw new \RuntimeException("The factory callable should return a HandlerInterface");
|
96 |
+
}
|
97 |
+
}
|
98 |
+
$this->handler->handleBatch($this->buffer);
|
99 |
+
$this->buffer = array();
|
100 |
+
}
|
101 |
+
|
102 |
/**
|
103 |
* {@inheritdoc}
|
104 |
*/
|
116 |
array_shift($this->buffer);
|
117 |
}
|
118 |
if ($this->activationStrategy->isHandlerActivated($record)) {
|
119 |
+
$this->activate();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
}
|
121 |
} else {
|
122 |
$this->handler->handle($record);
|
vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php
CHANGED
@@ -118,7 +118,7 @@ class FleepHookHandler extends SocketHandler
|
|
118 |
private function buildContent($record)
|
119 |
{
|
120 |
$dataArray = array(
|
121 |
-
'message' => $record['formatted']
|
122 |
);
|
123 |
|
124 |
return http_build_query($dataArray);
|
118 |
private function buildContent($record)
|
119 |
{
|
120 |
$dataArray = array(
|
121 |
+
'message' => $record['formatted'],
|
122 |
);
|
123 |
|
124 |
return http_build_query($dataArray);
|
vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php
CHANGED
@@ -33,15 +33,15 @@ class GelfHandler extends AbstractProcessingHandler
|
|
33 |
|
34 |
/**
|
35 |
* @param PublisherInterface|IMessagePublisher|Publisher $publisher a publisher object
|
36 |
-
* @param
|
37 |
-
* @param
|
38 |
*/
|
39 |
public function __construct($publisher, $level = Logger::DEBUG, $bubble = true)
|
40 |
{
|
41 |
parent::__construct($level, $bubble);
|
42 |
|
43 |
if (!$publisher instanceof Publisher && !$publisher instanceof IMessagePublisher && !$publisher instanceof PublisherInterface) {
|
44 |
-
throw new InvalidArgumentException(
|
45 |
}
|
46 |
|
47 |
$this->publisher = $publisher;
|
33 |
|
34 |
/**
|
35 |
* @param PublisherInterface|IMessagePublisher|Publisher $publisher a publisher object
|
36 |
+
* @param int $level The minimum logging level at which this handler will be triggered
|
37 |
+
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
38 |
*/
|
39 |
public function __construct($publisher, $level = Logger::DEBUG, $bubble = true)
|
40 |
{
|
41 |
parent::__construct($level, $bubble);
|
42 |
|
43 |
if (!$publisher instanceof Publisher && !$publisher instanceof IMessagePublisher && !$publisher instanceof PublisherInterface) {
|
44 |
+
throw new InvalidArgumentException('Invalid publisher, expected a Gelf\Publisher, Gelf\IMessagePublisher or Gelf\PublisherInterface instance');
|
45 |
}
|
46 |
|
47 |
$this->publisher = $publisher;
|
vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php
CHANGED
@@ -11,6 +11,8 @@
|
|
11 |
|
12 |
namespace Monolog\Handler;
|
13 |
|
|
|
|
|
14 |
/**
|
15 |
* Forwards records to multiple handlers
|
16 |
*
|
@@ -73,8 +75,30 @@ class GroupHandler extends AbstractHandler
|
|
73 |
*/
|
74 |
public function handleBatch(array $records)
|
75 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
foreach ($this->handlers as $handler) {
|
77 |
$handler->handleBatch($records);
|
78 |
}
|
79 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
}
|
11 |
|
12 |
namespace Monolog\Handler;
|
13 |
|
14 |
+
use Monolog\Formatter\FormatterInterface;
|
15 |
+
|
16 |
/**
|
17 |
* Forwards records to multiple handlers
|
18 |
*
|
75 |
*/
|
76 |
public function handleBatch(array $records)
|
77 |
{
|
78 |
+
if ($this->processors) {
|
79 |
+
$processed = array();
|
80 |
+
foreach ($records as $record) {
|
81 |
+
foreach ($this->processors as $processor) {
|
82 |
+
$processed[] = call_user_func($processor, $record);
|
83 |
+
}
|
84 |
+
}
|
85 |
+
$records = $processed;
|
86 |
+
}
|
87 |
+
|
88 |
foreach ($this->handlers as $handler) {
|
89 |
$handler->handleBatch($records);
|
90 |
}
|
91 |
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* {@inheritdoc}
|
95 |
+
*/
|
96 |
+
public function setFormatter(FormatterInterface $formatter)
|
97 |
+
{
|
98 |
+
foreach ($this->handlers as $handler) {
|
99 |
+
$handler->setFormatter($formatter);
|
100 |
+
}
|
101 |
+
|
102 |
+
return $this;
|
103 |
+
}
|
104 |
}
|
vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php
ADDED
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Monolog package.
|
5 |
+
*
|
6 |
+
* (c) Jordi Boggiano <j.boggiano@seld.be>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Monolog\Handler;
|
13 |
+
|
14 |
+
use Monolog\Formatter\FormatterInterface;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* This simple wrapper class can be used to extend handlers functionality.
|
18 |
+
*
|
19 |
+
* Example: A custom filtering that can be applied to any handler.
|
20 |
+
*
|
21 |
+
* Inherit from this class and override handle() like this:
|
22 |
+
*
|
23 |
+
* public function handle(array $record)
|
24 |
+
* {
|
25 |
+
* if ($record meets certain conditions) {
|
26 |
+
* return false;
|
27 |
+
* }
|
28 |
+
* return $this->handler->handle($record);
|
29 |
+
* }
|
30 |
+
*
|
31 |
+
* @author Alexey Karapetov <alexey@karapetov.com>
|
32 |
+
*/
|
33 |
+
class HandlerWrapper implements HandlerInterface
|
34 |
+
{
|
35 |
+
/**
|
36 |
+
* @var HandlerInterface
|
37 |
+
*/
|
38 |
+
protected $handler;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* HandlerWrapper constructor.
|
42 |
+
* @param HandlerInterface $handler
|
43 |
+
*/
|
44 |
+
public function __construct(HandlerInterface $handler)
|
45 |
+
{
|
46 |
+
$this->handler = $handler;
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* {@inheritdoc}
|
51 |
+
*/
|
52 |
+
public function isHandling(array $record)
|
53 |
+
{
|
54 |
+
return $this->handler->isHandling($record);
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* {@inheritdoc}
|
59 |
+
*/
|
60 |
+
public function handle(array $record)
|
61 |
+
{
|
62 |
+
return $this->handler->handle($record);
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* {@inheritdoc}
|
67 |
+
*/
|
68 |
+
public function handleBatch(array $records)
|
69 |
+
{
|
70 |
+
return $this->handler->handleBatch($records);
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* {@inheritdoc}
|
75 |
+
*/
|
76 |
+
public function pushProcessor($callback)
|
77 |
+
{
|
78 |
+
$this->handler->pushProcessor($callback);
|
79 |
+
|
80 |
+
return $this;
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* {@inheritdoc}
|
85 |
+
*/
|
86 |
+
public function popProcessor()
|
87 |
+
{
|
88 |
+
return $this->handler->popProcessor();
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* {@inheritdoc}
|
93 |
+
*/
|
94 |
+
public function setFormatter(FormatterInterface $formatter)
|
95 |
+
{
|
96 |
+
$this->handler->setFormatter($formatter);
|
97 |
+
|
98 |
+
return $this;
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* {@inheritdoc}
|
103 |
+
*/
|
104 |
+
public function getFormatter()
|
105 |
+
{
|
106 |
+
return $this->handler->getFormatter();
|
107 |
+
}
|
108 |
+
}
|
vendor/monolog/monolog/src/Monolog/Handler/HipChatHandler.php
CHANGED
@@ -84,16 +84,16 @@ class HipChatHandler extends SocketHandler
|
|
84 |
private $version;
|
85 |
|
86 |
/**
|
87 |
-
* @param string
|
88 |
-
* @param string
|
89 |
-
* @param string
|
90 |
-
* @param bool
|
91 |
-
* @param int
|
92 |
-
* @param bool
|
93 |
-
* @param bool
|
94 |
-
* @param string
|
95 |
-
* @param string
|
96 |
-
* @param string
|
97 |
*/
|
98 |
public function __construct($token, $room, $name = 'Monolog', $notify = false, $level = Logger::CRITICAL, $bubble = true, $useSSL = true, $format = 'text', $host = 'api.hipchat.com', $version = self::API_V1)
|
99 |
{
|
@@ -143,10 +143,23 @@ class HipChatHandler extends SocketHandler
|
|
143 |
'color' => $this->getAlertColor($record['level']),
|
144 |
);
|
145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
// if we are using the legacy API then we need to send some additional information
|
147 |
if ($this->version == self::API_V1) {
|
148 |
$dataArray['room_id'] = $this->room;
|
149 |
-
|
|
|
|
|
|
|
|
|
|
|
150 |
}
|
151 |
|
152 |
return http_build_query($dataArray);
|
@@ -179,7 +192,7 @@ class HipChatHandler extends SocketHandler
|
|
179 |
/**
|
180 |
* Assigns a color to each level of log records.
|
181 |
*
|
182 |
-
* @param
|
183 |
* @return string
|
184 |
*/
|
185 |
protected function getAlertColor($level)
|
@@ -303,7 +316,7 @@ class HipChatHandler extends SocketHandler
|
|
303 |
array(
|
304 |
'level' => $level,
|
305 |
'level_name' => $levelName,
|
306 |
-
'datetime' => $datetime
|
307 |
)
|
308 |
);
|
309 |
}
|
84 |
private $version;
|
85 |
|
86 |
/**
|
87 |
+
* @param string $token HipChat API Token
|
88 |
+
* @param string $room The room that should be alerted of the message (Id or Name)
|
89 |
+
* @param string $name Name used in the "from" field.
|
90 |
+
* @param bool $notify Trigger a notification in clients or not
|
91 |
+
* @param int $level The minimum logging level at which this handler will be triggered
|
92 |
+
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
93 |
+
* @param bool $useSSL Whether to connect via SSL.
|
94 |
+
* @param string $format The format of the messages (default to text, can be set to html if you have html in the messages)
|
95 |
+
* @param string $host The HipChat server hostname.
|
96 |
+
* @param string $version The HipChat API version (default HipChatHandler::API_V1)
|
97 |
*/
|
98 |
public function __construct($token, $room, $name = 'Monolog', $notify = false, $level = Logger::CRITICAL, $bubble = true, $useSSL = true, $format = 'text', $host = 'api.hipchat.com', $version = self::API_V1)
|
99 |
{
|
143 |
'color' => $this->getAlertColor($record['level']),
|
144 |
);
|
145 |
|
146 |
+
if (!$this->validateStringLength($dataArray['message'], static::MAXIMUM_MESSAGE_LENGTH)) {
|
147 |
+
if (function_exists('mb_substr')) {
|
148 |
+
$dataArray['message'] = mb_substr($dataArray['message'], 0, static::MAXIMUM_MESSAGE_LENGTH).' [truncated]';
|
149 |
+
} else {
|
150 |
+
$dataArray['message'] = substr($dataArray['message'], 0, static::MAXIMUM_MESSAGE_LENGTH).' [truncated]';
|
151 |
+
}
|
152 |
+
}
|
153 |
+
|
154 |
// if we are using the legacy API then we need to send some additional information
|
155 |
if ($this->version == self::API_V1) {
|
156 |
$dataArray['room_id'] = $this->room;
|
157 |
+
}
|
158 |
+
|
159 |
+
// append the sender name if it is set
|
160 |
+
// always append it if we use the v1 api (it is required in v1)
|
161 |
+
if ($this->version == self::API_V1 || $this->name !== null) {
|
162 |
+
$dataArray['from'] = (string) $this->name;
|
163 |
}
|
164 |
|
165 |
return http_build_query($dataArray);
|
192 |
/**
|
193 |
* Assigns a color to each level of log records.
|
194 |
*
|
195 |
+
* @param int $level
|
196 |
* @return string
|
197 |
*/
|
198 |
protected function getAlertColor($level)
|
316 |
array(
|
317 |
'level' => $level,
|
318 |
'level_name' => $levelName,
|
319 |
+
'datetime' => $datetime,
|
320 |
)
|
321 |
);
|
322 |
}
|
vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php
CHANGED
@@ -30,10 +30,10 @@ class IFTTTHandler extends AbstractProcessingHandler
|
|
30 |
private $secretKey;
|
31 |
|
32 |
/**
|
33 |
-
* @param string
|
34 |
-
* @param string
|
35 |
-
* @param
|
36 |
-
* @param Boolean
|
37 |
*/
|
38 |
public function __construct($eventName, $secretKey, $level = Logger::ERROR, $bubble = true)
|
39 |
{
|
@@ -51,7 +51,7 @@ class IFTTTHandler extends AbstractProcessingHandler
|
|
51 |
$postData = array(
|
52 |
"value1" => $record["channel"],
|
53 |
"value2" => $record["level_name"],
|
54 |
-
"value3" => $record["message"]
|
55 |
);
|
56 |
$postString = json_encode($postData);
|
57 |
|
@@ -61,7 +61,7 @@ class IFTTTHandler extends AbstractProcessingHandler
|
|
61 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
62 |
curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);
|
63 |
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
64 |
-
"Content-Type: application/json"
|
65 |
));
|
66 |
|
67 |
Curl\Util::execute($ch);
|
30 |
private $secretKey;
|
31 |
|
32 |
/**
|
33 |
+
* @param string $eventName The name of the IFTTT Maker event that should be triggered
|
34 |
+
* @param string $secretKey A valid IFTTT secret key
|
35 |
+
* @param int $level The minimum logging level at which this handler will be triggered
|
36 |
+
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
37 |
*/
|
38 |
public function __construct($eventName, $secretKey, $level = Logger::ERROR, $bubble = true)
|
39 |
{
|
51 |
$postData = array(
|
52 |
"value1" => $record["channel"],
|
53 |
"value2" => $record["level_name"],
|
54 |
+
"value3" => $record["message"],
|
55 |
);
|
56 |
$postString = json_encode($postData);
|
57 |
|
61 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
62 |
curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);
|
63 |
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
64 |
+
"Content-Type: application/json",
|
65 |
));
|
66 |
|
67 |
Curl\Util::execute($ch);
|
vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php
CHANGED
@@ -24,10 +24,10 @@ class LogEntriesHandler extends SocketHandler
|
|
24 |
protected $logToken;
|
25 |
|
26 |
/**
|
27 |
-
* @param string
|
28 |
-
* @param
|
29 |
-
* @param int
|
30 |
-
* @param
|
31 |
*
|
32 |
* @throws MissingExtensionException If SSL encryption is set to true and OpenSSL is missing
|
33 |
*/
|
24 |
protected $logToken;
|
25 |
|
26 |
/**
|
27 |
+
* @param string $token Log token supplied by LogEntries
|
28 |
+
* @param bool $useSSL Whether or not SSL encryption should be used.
|
29 |
+
* @param int $level The minimum logging level to trigger this handler
|
30 |
+
* @param bool $bubble Whether or not messages that are handled should bubble up the stack.
|
31 |
*
|
32 |
* @throws MissingExtensionException If SSL encryption is set to true and OpenSSL is missing
|
33 |
*/
|
vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php
CHANGED
@@ -52,4 +52,16 @@ abstract class MailHandler extends AbstractProcessingHandler
|
|
52 |
{
|
53 |
$this->send((string) $record['formatted'], array($record));
|
54 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
}
|
52 |
{
|
53 |
$this->send((string) $record['formatted'], array($record));
|
54 |
}
|
55 |
+
|
56 |
+
protected function getHighestRecord(array $records)
|
57 |
+
{
|
58 |
+
$highestRecord = null;
|
59 |
+
foreach ($records as $record) {
|
60 |
+
if ($highestRecord === null || $highestRecord['level'] < $record['level']) {
|
61 |
+
$highestRecord = $record;
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
return $highestRecord;
|
66 |
+
}
|
67 |
}
|
vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php
CHANGED
@@ -20,13 +20,13 @@ use Monolog\Logger;
|
|
20 |
*/
|
21 |
class MandrillHandler extends MailHandler
|
22 |
{
|
23 |
-
protected $client;
|
24 |
protected $message;
|
|
|
25 |
|
26 |
/**
|
27 |
* @param string $apiKey A valid Mandrill API key
|
28 |
* @param callable|\Swift_Message $message An example message for real messages, only the body will be replaced
|
29 |
-
* @param
|
30 |
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
31 |
*/
|
32 |
public function __construct($apiKey, $message, $level = Logger::ERROR, $bubble = true)
|
20 |
*/
|
21 |
class MandrillHandler extends MailHandler
|
22 |
{
|
|
|
23 |
protected $message;
|
24 |
+
protected $apiKey;
|
25 |
|
26 |
/**
|
27 |
* @param string $apiKey A valid Mandrill API key
|
28 |
* @param callable|\Swift_Message $message An example message for real messages, only the body will be replaced
|
29 |
+
* @param int $level The minimum logging level at which this handler will be triggered
|
30 |
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
31 |
*/
|
32 |
public function __construct($apiKey, $message, $level = Logger::ERROR, $bubble = true)
|
vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php
CHANGED
@@ -31,8 +31,8 @@ class MongoDBHandler extends AbstractProcessingHandler
|
|
31 |
|
32 |
public function __construct($mongo, $database, $collection, $level = Logger::DEBUG, $bubble = true)
|
33 |
{
|
34 |
-
if (!($mongo instanceof \MongoClient || $mongo instanceof \Mongo)) {
|
35 |
-
throw new \InvalidArgumentException('MongoClient or
|
36 |
}
|
37 |
|
38 |
$this->mongoCollection = $mongo->selectCollection($database, $collection);
|
@@ -42,7 +42,11 @@ class MongoDBHandler extends AbstractProcessingHandler
|
|
42 |
|
43 |
protected function write(array $record)
|
44 |
{
|
45 |
-
$this->mongoCollection
|
|
|
|
|
|
|
|
|
46 |
}
|
47 |
|
48 |
/**
|
31 |
|
32 |
public function __construct($mongo, $database, $collection, $level = Logger::DEBUG, $bubble = true)
|
33 |
{
|
34 |
+
if (!($mongo instanceof \MongoClient || $mongo instanceof \Mongo || $mongo instanceof \MongoDB\Client)) {
|
35 |
+
throw new \InvalidArgumentException('MongoClient, Mongo or MongoDB\Client instance required');
|
36 |
}
|
37 |
|
38 |
$this->mongoCollection = $mongo->selectCollection($database, $collection);
|
42 |
|
43 |
protected function write(array $record)
|
44 |
{
|
45 |
+
if ($this->mongoCollection instanceof \MongoDB\Collection) {
|
46 |
+
$this->mongoCollection->insertOne($record["formatted"]);
|
47 |
+
} else {
|
48 |
+
$this->mongoCollection->save($record["formatted"]);
|
49 |
+
}
|
50 |
}
|
51 |
|
52 |
/**
|
vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php
CHANGED
@@ -12,6 +12,7 @@
|
|
12 |
namespace Monolog\Handler;
|
13 |
|
14 |
use Monolog\Logger;
|
|
|
15 |
|
16 |
/**
|
17 |
* NativeMailerHandler uses the mail() function to send the emails
|
@@ -47,7 +48,7 @@ class NativeMailerHandler extends MailHandler
|
|
47 |
|
48 |
/**
|
49 |
* The wordwrap length for the message
|
50 |
-
* @var
|
51 |
*/
|
52 |
protected $maxColumnWidth;
|
53 |
|
@@ -67,8 +68,8 @@ class NativeMailerHandler extends MailHandler
|
|
67 |
* @param string|array $to The receiver of the mail
|
68 |
* @param string $subject The subject of the mail
|
69 |
* @param string $from The sender of the mail
|
70 |
-
* @param
|
71 |
-
* @param
|
72 |
* @param int $maxColumnWidth The maximum column width that the message lines will have
|
73 |
*/
|
74 |
public function __construct($to, $subject, $from, $level = Logger::ERROR, $bubble = true, $maxColumnWidth = 70)
|
@@ -101,7 +102,7 @@ class NativeMailerHandler extends MailHandler
|
|
101 |
/**
|
102 |
* Add parameters to the message
|
103 |
*
|
104 |
-
* @param
|
105 |
* @return self
|
106 |
*/
|
107 |
public function addParameter($parameters)
|
@@ -122,8 +123,16 @@ class NativeMailerHandler extends MailHandler
|
|
122 |
if ($this->getContentType() == 'text/html' && false === strpos($headers, 'MIME-Version:')) {
|
123 |
$headers .= 'MIME-Version: 1.0' . "\r\n";
|
124 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
foreach ($this->to as $to) {
|
126 |
-
mail($to, $
|
127 |
}
|
128 |
}
|
129 |
|
12 |
namespace Monolog\Handler;
|
13 |
|
14 |
use Monolog\Logger;
|
15 |
+
use Monolog\Formatter\LineFormatter;
|
16 |
|
17 |
/**
|
18 |
* NativeMailerHandler uses the mail() function to send the emails
|
48 |
|
49 |
/**
|
50 |
* The wordwrap length for the message
|
51 |
+
* @var int
|
52 |
*/
|
53 |
protected $maxColumnWidth;
|
54 |
|
68 |
* @param string|array $to The receiver of the mail
|
69 |
* @param string $subject The subject of the mail
|
70 |
* @param string $from The sender of the mail
|
71 |
+
* @param int $level The minimum logging level at which this handler will be triggered
|
72 |
+
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
73 |
* @param int $maxColumnWidth The maximum column width that the message lines will have
|
74 |
*/
|
75 |
public function __construct($to, $subject, $from, $level = Logger::ERROR, $bubble = true, $maxColumnWidth = 70)
|
102 |
/**
|
103 |
* Add parameters to the message
|
104 |
*
|
105 |
+
* @param string|array $parameters Custom added parameters
|
106 |
* @return self
|
107 |
*/
|
108 |
public function addParameter($parameters)
|
123 |
if ($this->getContentType() == 'text/html' && false === strpos($headers, 'MIME-Version:')) {
|
124 |
$headers .= 'MIME-Version: 1.0' . "\r\n";
|
125 |
}
|
126 |
+
|
127 |
+
$subject = $this->subject;
|
128 |
+
if ($records) {
|
129 |
+
$subjectFormatter = new LineFormatter($this->subject);
|
130 |
+
$subject = $subjectFormatter->format($this->getHighestRecord($records));
|
131 |
+
}
|
132 |
+
|
133 |
+
$parameters = implode(' ', $this->parameters);
|
134 |
foreach ($this->to as $to) {
|
135 |
+
mail($to, $subject, $content, $headers, $parameters);
|
136 |
}
|
137 |
}
|
138 |
|
vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php
CHANGED
@@ -41,16 +41,16 @@ class NewRelicHandler extends AbstractProcessingHandler
|
|
41 |
* Some context and extra data is passed into the handler as arrays of values. Do we send them as is
|
42 |
* (useful if we are using the API), or explode them for display on the NewRelic RPM website?
|
43 |
*
|
44 |
-
* @var
|
45 |
*/
|
46 |
protected $explodeArrays;
|
47 |
|
48 |
/**
|
49 |
* {@inheritDoc}
|
50 |
*
|
51 |
-
* @param string
|
52 |
-
* @param
|
53 |
-
* @param string
|
54 |
*/
|
55 |
public function __construct(
|
56 |
$level = Logger::ERROR,
|
@@ -91,23 +91,27 @@ class NewRelicHandler extends AbstractProcessingHandler
|
|
91 |
newrelic_notice_error($record['message']);
|
92 |
}
|
93 |
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
|
|
|
|
|
|
|
|
98 |
}
|
99 |
-
} else {
|
100 |
-
$this->setNewRelicParameter('context_' . $key, $parameter);
|
101 |
}
|
102 |
}
|
103 |
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
|
|
|
|
|
|
|
|
108 |
}
|
109 |
-
} else {
|
110 |
-
$this->setNewRelicParameter('extra_' . $key, $parameter);
|
111 |
}
|
112 |
}
|
113 |
}
|
41 |
* Some context and extra data is passed into the handler as arrays of values. Do we send them as is
|
42 |
* (useful if we are using the API), or explode them for display on the NewRelic RPM website?
|
43 |
*
|
44 |
+
* @var bool
|
45 |
*/
|
46 |
protected $explodeArrays;
|
47 |
|
48 |
/**
|
49 |
* {@inheritDoc}
|
50 |
*
|
51 |
+
* @param string $appName
|
52 |
+
* @param bool $explodeArrays
|
53 |
+
* @param string $transactionName
|
54 |
*/
|
55 |
public function __construct(
|
56 |
$level = Logger::ERROR,
|
91 |
newrelic_notice_error($record['message']);
|
92 |
}
|
93 |
|
94 |
+
if (isset($record['formatted']['context']) && is_array($record['formatted']['context'])) {
|
95 |
+
foreach ($record['formatted']['context'] as $key => $parameter) {
|
96 |
+
if (is_array($parameter) && $this->explodeArrays) {
|
97 |
+
foreach ($parameter as $paramKey => $paramValue) {
|
98 |
+
$this->setNewRelicParameter('context_' . $key . '_' . $paramKey, $paramValue);
|
99 |
+
}
|
100 |
+
} else {
|
101 |
+
$this->setNewRelicParameter('context_' . $key, $parameter);
|
102 |
}
|
|
|
|
|
103 |
}
|
104 |
}
|
105 |
|
106 |
+
if (isset($record['formatted']['extra']) && is_array($record['formatted']['extra'])) {
|
107 |
+
foreach ($record['formatted']['extra'] as $key => $parameter) {
|
108 |
+
if (is_array($parameter) && $this->explodeArrays) {
|
109 |
+
foreach ($parameter as $paramKey => $paramValue) {
|
110 |
+
$this->setNewRelicParameter('extra_' . $key . '_' . $paramKey, $paramValue);
|
111 |
+
}
|
112 |
+
} else {
|
113 |
+
$this->setNewRelicParameter('extra_' . $key, $parameter);
|
114 |
}
|
|
|
|
|
115 |
}
|
116 |
}
|
117 |
}
|
vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php
CHANGED
@@ -24,7 +24,7 @@ use Monolog\Logger;
|
|
24 |
class NullHandler extends AbstractHandler
|
25 |
{
|
26 |
/**
|
27 |
-
* @param
|
28 |
*/
|
29 |
public function __construct($level = Logger::DEBUG)
|
30 |
{
|
24 |
class NullHandler extends AbstractHandler
|
25 |
{
|
26 |
/**
|
27 |
+
* @param int $level The minimum logging level at which this handler will be triggered
|
28 |
*/
|
29 |
public function __construct($level = Logger::DEBUG)
|
30 |
{
|
vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php
CHANGED
@@ -66,10 +66,10 @@ class PHPConsoleHandler extends AbstractProcessingHandler
|
|
66 |
private $connector;
|
67 |
|
68 |
/**
|
69 |
-
* @param
|
70 |
-
* @param
|
71 |
-
* @param
|
72 |
-
* @param
|
73 |
* @throws Exception
|
74 |
*/
|
75 |
public function __construct(array $options = array(), Connector $connector = null, $level = Logger::DEBUG, $bubble = true)
|
66 |
private $connector;
|
67 |
|
68 |
/**
|
69 |
+
* @param array $options See \Monolog\Handler\PHPConsoleHandler::$options for more details
|
70 |
+
* @param Connector|null $connector Instance of \PhpConsole\Connector class (optional)
|
71 |
+
* @param int $level
|
72 |
+
* @param bool $bubble
|
73 |
* @throws Exception
|
74 |
*/
|
75 |
public function __construct(array $options = array(), Connector $connector = null, $level = Logger::DEBUG, $bubble = true)
|
vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php
CHANGED
@@ -68,16 +68,16 @@ class PushoverHandler extends SocketHandler
|
|
68 |
* @param string $token Pushover api token
|
69 |
* @param string|array $users Pushover user id or array of ids the message will be sent to
|
70 |
* @param string $title Title sent to the Pushover API
|
71 |
-
* @param
|
72 |
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
73 |
* @param Boolean $useSSL Whether to connect via SSL. Required when pushing messages to users that are not
|
74 |
* the pushover.net app owner. OpenSSL is required for this option.
|
75 |
-
* @param
|
76 |
* sending "high priority" requests to the Pushover API
|
77 |
-
* @param
|
78 |
* sending "emergency" requests to the Pushover API
|
79 |
-
* @param
|
80 |
-
* @param
|
81 |
*/
|
82 |
public function __construct($token, $users, $title = null, $level = Logger::CRITICAL, $bubble = true, $useSSL = true, $highPriorityLevel = Logger::CRITICAL, $emergencyLevel = Logger::EMERGENCY, $retry = 30, $expire = 25200)
|
83 |
{
|
@@ -115,7 +115,7 @@ class PushoverHandler extends SocketHandler
|
|
115 |
'user' => $this->user,
|
116 |
'message' => $message,
|
117 |
'title' => $this->title,
|
118 |
-
'timestamp' => $timestamp
|
119 |
);
|
120 |
|
121 |
if (isset($record['level']) && $record['level'] >= $this->emergencyLevel) {
|
@@ -176,7 +176,7 @@ class PushoverHandler extends SocketHandler
|
|
176 |
|
177 |
/**
|
178 |
* Use the formatted message?
|
179 |
-
* @param
|
180 |
*/
|
181 |
public function useFormattedMessage($value)
|
182 |
{
|
68 |
* @param string $token Pushover api token
|
69 |
* @param string|array $users Pushover user id or array of ids the message will be sent to
|
70 |
* @param string $title Title sent to the Pushover API
|
71 |
+
* @param int $level The minimum logging level at which this handler will be triggered
|
72 |
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
73 |
* @param Boolean $useSSL Whether to connect via SSL. Required when pushing messages to users that are not
|
74 |
* the pushover.net app owner. OpenSSL is required for this option.
|
75 |
+
* @param int $highPriorityLevel The minimum logging level at which this handler will start
|
76 |
* sending "high priority" requests to the Pushover API
|
77 |
+
* @param int $emergencyLevel The minimum logging level at which this handler will start
|
78 |
* sending "emergency" requests to the Pushover API
|
79 |
+
* @param int $retry The retry parameter specifies how often (in seconds) the Pushover servers will send the same notification to the user.
|
80 |
+
* @param int $expire The expire parameter specifies how many seconds your notification will continue to be retried for (every retry seconds).
|
81 |
*/
|
82 |
public function __construct($token, $users, $title = null, $level = Logger::CRITICAL, $bubble = true, $useSSL = true, $highPriorityLevel = Logger::CRITICAL, $emergencyLevel = Logger::EMERGENCY, $retry = 30, $expire = 25200)
|
83 |
{
|
115 |
'user' => $this->user,
|
116 |
'message' => $message,
|
117 |
'title' => $this->title,
|
118 |
+
'timestamp' => $timestamp,
|
119 |
);
|
120 |
|
121 |
if (isset($record['level']) && $record['level'] >= $this->emergencyLevel) {
|
176 |
|
177 |
/**
|
178 |
* Use the formatted message?
|
179 |
+
* @param bool $value
|
180 |
*/
|
181 |
public function useFormattedMessage($value)
|
182 |
{
|
vendor/monolog/monolog/src/Monolog/Handler/RavenHandler.php
CHANGED
@@ -38,6 +38,12 @@ class RavenHandler extends AbstractProcessingHandler
|
|
38 |
Logger::EMERGENCY => Raven_Client::FATAL,
|
39 |
);
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
/**
|
42 |
* @var Raven_Client the client object that sends the message to the server
|
43 |
*/
|
@@ -50,7 +56,7 @@ class RavenHandler extends AbstractProcessingHandler
|
|
50 |
|
51 |
/**
|
52 |
* @param Raven_Client $ravenClient
|
53 |
-
* @param
|
54 |
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
55 |
*/
|
56 |
public function __construct(Raven_Client $ravenClient, $level = Logger::DEBUG, $bubble = true)
|
@@ -78,7 +84,7 @@ class RavenHandler extends AbstractProcessingHandler
|
|
78 |
|
79 |
// the record with the highest severity is the "main" one
|
80 |
$record = array_reduce($records, function ($highest, $record) {
|
81 |
-
if ($record['level']
|
82 |
return $record;
|
83 |
}
|
84 |
|
@@ -139,12 +145,24 @@ class RavenHandler extends AbstractProcessingHandler
|
|
139 |
$options['tags'] = array_merge($options['tags'], $record['context']['tags']);
|
140 |
unset($record['context']['tags']);
|
141 |
}
|
|
|
|
|
|
|
|
|
142 |
if (!empty($record['context']['logger'])) {
|
143 |
$options['logger'] = $record['context']['logger'];
|
144 |
unset($record['context']['logger']);
|
145 |
} else {
|
146 |
$options['logger'] = $record['channel'];
|
147 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
if (!empty($record['context'])) {
|
149 |
$options['extra']['context'] = $record['context'];
|
150 |
if (!empty($record['context']['user'])) {
|
@@ -157,7 +175,11 @@ class RavenHandler extends AbstractProcessingHandler
|
|
157 |
$options['extra']['extra'] = $record['extra'];
|
158 |
}
|
159 |
|
160 |
-
if (
|
|
|
|
|
|
|
|
|
161 |
$options['extra']['message'] = $record['formatted'];
|
162 |
$this->ravenClient->captureException($record['context']['exception'], $options);
|
163 |
} else {
|
@@ -186,4 +208,25 @@ class RavenHandler extends AbstractProcessingHandler
|
|
186 |
{
|
187 |
return new LineFormatter();
|
188 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
}
|
38 |
Logger::EMERGENCY => Raven_Client::FATAL,
|
39 |
);
|
40 |
|
41 |
+
/**
|
42 |
+
* @var string should represent the current version of the calling
|
43 |
+
* software. Can be any string (git commit, version number)
|
44 |
+
*/
|
45 |
+
private $release;
|
46 |
+
|
47 |
/**
|
48 |
* @var Raven_Client the client object that sends the message to the server
|
49 |
*/
|
56 |
|
57 |
/**
|
58 |
* @param Raven_Client $ravenClient
|
59 |
+
* @param int $level The minimum logging level at which this handler will be triggered
|
60 |
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
61 |
*/
|
62 |
public function __construct(Raven_Client $ravenClient, $level = Logger::DEBUG, $bubble = true)
|
84 |
|
85 |
// the record with the highest severity is the "main" one
|
86 |
$record = array_reduce($records, function ($highest, $record) {
|
87 |
+
if ($record['level'] > $highest['level']) {
|
88 |
return $record;
|
89 |
}
|
90 |
|
145 |
$options['tags'] = array_merge($options['tags'], $record['context']['tags']);
|
146 |
unset($record['context']['tags']);
|
147 |
}
|
148 |
+
if (!empty($record['context']['fingerprint'])) {
|
149 |
+
$options['fingerprint'] = $record['context']['fingerprint'];
|
150 |
+
unset($record['context']['fingerprint']);
|
151 |
+
}
|
152 |
if (!empty($record['context']['logger'])) {
|
153 |
$options['logger'] = $record['context']['logger'];
|
154 |
unset($record['context']['logger']);
|
155 |
} else {
|
156 |
$options['logger'] = $record['channel'];
|
157 |
}
|
158 |
+
foreach ($this->getExtraParameters() as $key) {
|
159 |
+
foreach (array('extra', 'context') as $source) {
|
160 |
+
if (!empty($record[$source][$key])) {
|
161 |
+
$options[$key] = $record[$source][$key];
|
162 |
+
unset($record[$source][$key]);
|
163 |
+
}
|
164 |
+
}
|
165 |
+
}
|
166 |
if (!empty($record['context'])) {
|
167 |
$options['extra']['context'] = $record['context'];
|
168 |
if (!empty($record['context']['user'])) {
|
175 |
$options['extra']['extra'] = $record['extra'];
|
176 |
}
|
177 |
|
178 |
+
if (!empty($this->release) && !isset($options['release'])) {
|
179 |
+
$options['release'] = $this->release;
|
180 |
+
}
|
181 |
+
|
182 |
+
if (isset($record['context']['exception']) && ($record['context']['exception'] instanceof \Exception || (PHP_VERSION_ID >= 70000 && $record['context']['exception'] instanceof \Throwable))) {
|
183 |
$options['extra']['message'] = $record['formatted'];
|
184 |
$this->ravenClient->captureException($record['context']['exception'], $options);
|
185 |
} else {
|
208 |
{
|
209 |
return new LineFormatter();
|
210 |
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* Gets extra parameters supported by Raven that can be found in "extra" and "context"
|
214 |
+
*
|
215 |
+
* @return array
|
216 |
+
*/
|
217 |
+
protected function getExtraParameters()
|
218 |
+
{
|
219 |
+
return array('checksum', 'release', 'event_id');
|
220 |
+
}
|
221 |
+
|
222 |
+
/**
|
223 |
+
* @param string $value
|
224 |
+
* @return self
|
225 |
+
*/
|
226 |
+
public function setRelease($value)
|
227 |
+
{
|
228 |
+
$this->release = $value;
|
229 |
+
|
230 |
+
return $this;
|
231 |
+
}
|
232 |
}
|
vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php
CHANGED
@@ -34,9 +34,9 @@ class RedisHandler extends AbstractProcessingHandler
|
|
34 |
/**
|
35 |
* @param \Predis\Client|\Redis $redis The redis instance
|
36 |
* @param string $key The key name to push records to
|
37 |
-
* @param
|
38 |
-
* @param
|
39 |
-
* @param
|
40 |
*/
|
41 |
public function __construct($redis, $key, $level = Logger::DEBUG, $bubble = true, $capSize = false)
|
42 |
{
|
@@ -67,7 +67,7 @@ class RedisHandler extends AbstractProcessingHandler
|
|
67 |
* Write and cap the collection
|
68 |
* Writes the record to the redis list and caps its
|
69 |
*
|
70 |
-
* @param array
|
71 |
* @return void
|
72 |
*/
|
73 |
protected function writeCapped(array $record)
|
@@ -76,7 +76,7 @@ class RedisHandler extends AbstractProcessingHandler
|
|
76 |
$this->redisClient->multi()
|
77 |
->rpush($this->redisKey, $record["formatted"])
|
78 |
->ltrim($this->redisKey, -$this->capSize, -1)
|
79 |
-
->
|
80 |
} else {
|
81 |
$redisKey = $this->redisKey;
|
82 |
$capSize = $this->capSize;
|
34 |
/**
|
35 |
* @param \Predis\Client|\Redis $redis The redis instance
|
36 |
* @param string $key The key name to push records to
|
37 |
+
* @param int $level The minimum logging level at which this handler will be triggered
|
38 |
+
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
39 |
+
* @param int $capSize Number of entries to limit list size to
|
40 |
*/
|
41 |
public function __construct($redis, $key, $level = Logger::DEBUG, $bubble = true, $capSize = false)
|
42 |
{
|
67 |
* Write and cap the collection
|
68 |
* Writes the record to the redis list and caps its
|
69 |
*
|
70 |
+
* @param array $record associative record array
|
71 |
* @return void
|
72 |
*/
|
73 |
protected function writeCapped(array $record)
|
76 |
$this->redisClient->multi()
|
77 |
->rpush($this->redisKey, $record["formatted"])
|
78 |
->ltrim($this->redisKey, -$this->capSize, -1)
|
79 |
+
->exec();
|
80 |
} else {
|
81 |
$redisKey = $this->redisKey;
|
82 |
$capSize = $this->capSize;
|
vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php
CHANGED
@@ -18,6 +18,17 @@ use Monolog\Logger;
|
|
18 |
/**
|
19 |
* Sends errors to Rollbar
|
20 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
* @author Paul Statezny <paulstatezny@gmail.com>
|
22 |
*/
|
23 |
class RollbarHandler extends AbstractProcessingHandler
|
@@ -29,6 +40,17 @@ class RollbarHandler extends AbstractProcessingHandler
|
|
29 |
*/
|
30 |
protected $rollbarNotifier;
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
/**
|
33 |
* Records whether any log records have been added since the last flush of the rollbar notifier
|
34 |
*
|
@@ -36,10 +58,12 @@ class RollbarHandler extends AbstractProcessingHandler
|
|
36 |
*/
|
37 |
private $hasRecords = false;
|
38 |
|
|
|
|
|
39 |
/**
|
40 |
* @param RollbarNotifier $rollbarNotifier RollbarNotifier object constructed with valid token
|
41 |
-
* @param
|
42 |
-
* @param
|
43 |
*/
|
44 |
public function __construct(RollbarNotifier $rollbarNotifier, $level = Logger::ERROR, $bubble = true)
|
45 |
{
|
@@ -53,33 +77,56 @@ class RollbarHandler extends AbstractProcessingHandler
|
|
53 |
*/
|
54 |
protected function write(array $record)
|
55 |
{
|
56 |
-
if (
|
57 |
-
|
58 |
-
|
59 |
-
$
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
|
|
|
|
65 |
$this->rollbarNotifier->report_message(
|
66 |
$record['message'],
|
67 |
-
$
|
68 |
-
|
|
|
69 |
);
|
70 |
}
|
71 |
|
72 |
$this->hasRecords = true;
|
73 |
}
|
74 |
|
75 |
-
|
76 |
-
* {@inheritdoc}
|
77 |
-
*/
|
78 |
-
public function close()
|
79 |
{
|
80 |
if ($this->hasRecords) {
|
81 |
$this->rollbarNotifier->flush();
|
82 |
$this->hasRecords = false;
|
83 |
}
|
84 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
}
|
18 |
/**
|
19 |
* Sends errors to Rollbar
|
20 |
*
|
21 |
+
* If the context data contains a `payload` key, that is used as an array
|
22 |
+
* of payload options to RollbarNotifier's report_message/report_exception methods.
|
23 |
+
*
|
24 |
+
* Rollbar's context info will contain the context + extra keys from the log record
|
25 |
+
* merged, and then on top of that a few keys:
|
26 |
+
*
|
27 |
+
* - level (rollbar level name)
|
28 |
+
* - monolog_level (monolog level name, raw level, as rollbar only has 5 but monolog 8)
|
29 |
+
* - channel
|
30 |
+
* - datetime (unix timestamp)
|
31 |
+
*
|
32 |
* @author Paul Statezny <paulstatezny@gmail.com>
|
33 |
*/
|
34 |
class RollbarHandler extends AbstractProcessingHandler
|
40 |
*/
|
41 |
protected $rollbarNotifier;
|
42 |
|
43 |
+
protected $levelMap = array(
|
44 |
+
Logger::DEBUG => 'debug',
|
45 |
+
Logger::INFO => 'info',
|
46 |
+
Logger::NOTICE => 'info',
|
47 |
+
Logger::WARNING => 'warning',
|
48 |
+
Logger::ERROR => 'error',
|
49 |
+
Logger::CRITICAL => 'critical',
|
50 |
+
Logger::ALERT => 'critical',
|
51 |
+
Logger::EMERGENCY => 'critical',
|
52 |
+
);
|
53 |
+
|
54 |
/**
|
55 |
* Records whether any log records have been added since the last flush of the rollbar notifier
|
56 |
*
|
58 |
*/
|
59 |
private $hasRecords = false;
|
60 |
|
61 |
+
protected $initialized = false;
|
62 |
+
|
63 |
/**
|
64 |
* @param RollbarNotifier $rollbarNotifier RollbarNotifier object constructed with valid token
|
65 |
+
* @param int $level The minimum logging level at which this handler will be triggered
|
66 |
+
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
67 |
*/
|
68 |
public function __construct(RollbarNotifier $rollbarNotifier, $level = Logger::ERROR, $bubble = true)
|
69 |
{
|
77 |
*/
|
78 |
protected function write(array $record)
|
79 |
{
|
80 |
+
if (!$this->initialized) {
|
81 |
+
// __destructor() doesn't get called on Fatal errors
|
82 |
+
register_shutdown_function(array($this, 'close'));
|
83 |
+
$this->initialized = true;
|
84 |
+
}
|
85 |
+
|
86 |
+
$context = $record['context'];
|
87 |
+
$payload = array();
|
88 |
+
if (isset($context['payload'])) {
|
89 |
+
$payload = $context['payload'];
|
90 |
+
unset($context['payload']);
|
91 |
+
}
|
92 |
+
$context = array_merge($context, $record['extra'], array(
|
93 |
+
'level' => $this->levelMap[$record['level']],
|
94 |
+
'monolog_level' => $record['level_name'],
|
95 |
+
'channel' => $record['channel'],
|
96 |
+
'datetime' => $record['datetime']->format('U'),
|
97 |
+
));
|
98 |
+
|
99 |
+
if (isset($context['exception']) && $context['exception'] instanceof Exception) {
|
100 |
+
$payload['level'] = $context['level'];
|
101 |
+
$exception = $context['exception'];
|
102 |
+
unset($context['exception']);
|
103 |
|
104 |
+
$this->rollbarNotifier->report_exception($exception, $context, $payload);
|
105 |
+
} else {
|
106 |
$this->rollbarNotifier->report_message(
|
107 |
$record['message'],
|
108 |
+
$context['level'],
|
109 |
+
$context,
|
110 |
+
$payload
|
111 |
);
|
112 |
}
|
113 |
|
114 |
$this->hasRecords = true;
|
115 |
}
|
116 |
|
117 |
+
public function flush()
|
|
|
|
|
|
|
118 |
{
|
119 |
if ($this->hasRecords) {
|
120 |
$this->rollbarNotifier->flush();
|
121 |
$this->hasRecords = false;
|
122 |
}
|
123 |
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* {@inheritdoc}
|
127 |
+
*/
|
128 |
+
public function close()
|
129 |
+
{
|
130 |
+
$this->flush();
|
131 |
+
}
|
132 |
}
|
vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php
CHANGED
@@ -24,6 +24,10 @@ use Monolog\Logger;
|
|
24 |
*/
|
25 |
class RotatingFileHandler extends StreamHandler
|
26 |
{
|
|
|
|
|
|
|
|
|
27 |
protected $filename;
|
28 |
protected $maxFiles;
|
29 |
protected $mustRotate;
|
@@ -33,8 +37,8 @@ class RotatingFileHandler extends StreamHandler
|
|
33 |
|
34 |
/**
|
35 |
* @param string $filename
|
36 |
-
* @param
|
37 |
-
* @param
|
38 |
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
39 |
* @param int|null $filePermission Optional file permissions (default (0644) are only for owner read/write)
|
40 |
* @param Boolean $useLocking Try to lock log file before doing any writes
|
@@ -64,6 +68,21 @@ class RotatingFileHandler extends StreamHandler
|
|
64 |
|
65 |
public function setFilenameFormat($filenameFormat, $dateFormat)
|
66 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
$this->filenameFormat = $filenameFormat;
|
68 |
$this->dateFormat = $dateFormat;
|
69 |
$this->url = $this->getTimedFilename();
|
@@ -115,7 +134,11 @@ class RotatingFileHandler extends StreamHandler
|
|
115 |
|
116 |
foreach (array_slice($logFiles, $this->maxFiles) as $file) {
|
117 |
if (is_writable($file)) {
|
|
|
|
|
|
|
118 |
unlink($file);
|
|
|
119 |
}
|
120 |
}
|
121 |
|
24 |
*/
|
25 |
class RotatingFileHandler extends StreamHandler
|
26 |
{
|
27 |
+
const FILE_PER_DAY = 'Y-m-d';
|
28 |
+
const FILE_PER_MONTH = 'Y-m';
|
29 |
+
const FILE_PER_YEAR = 'Y';
|
30 |
+
|
31 |
protected $filename;
|
32 |
protected $maxFiles;
|
33 |
protected $mustRotate;
|
37 |
|
38 |
/**
|
39 |
* @param string $filename
|
40 |
+
* @param int $maxFiles The maximal amount of files to keep (0 means unlimited)
|
41 |
+
* @param int $level The minimum logging level at which this handler will be triggered
|
42 |
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
43 |
* @param int|null $filePermission Optional file permissions (default (0644) are only for owner read/write)
|
44 |
* @param Boolean $useLocking Try to lock log file before doing any writes
|
68 |
|
69 |
public function setFilenameFormat($filenameFormat, $dateFormat)
|
70 |
{
|
71 |
+
if (!preg_match('{^Y(([/_.-]?m)([/_.-]?d)?)?$}', $dateFormat)) {
|
72 |
+
trigger_error(
|
73 |
+
'Invalid date format - format must be one of '.
|
74 |
+
'RotatingFileHandler::FILE_PER_DAY ("Y-m-d"), RotatingFileHandler::FILE_PER_MONTH ("Y-m") '.
|
75 |
+
'or RotatingFileHandler::FILE_PER_YEAR ("Y"), or you can set one of the '.
|
76 |
+
'date formats using slashes, underscores and/or dots instead of dashes.',
|
77 |
+
E_USER_DEPRECATED
|
78 |
+
);
|
79 |
+
}
|
80 |
+
if (substr_count($filenameFormat, '{date}') === 0) {
|
81 |
+
trigger_error(
|
82 |
+
'Invalid filename format - format should contain at least `{date}`, because otherwise rotating is impossible.',
|
83 |
+
E_USER_DEPRECATED
|
84 |
+
);
|
85 |
+
}
|
86 |
$this->filenameFormat = $filenameFormat;
|
87 |
$this->dateFormat = $dateFormat;
|
88 |
$this->url = $this->getTimedFilename();
|
134 |
|
135 |
foreach (array_slice($logFiles, $this->maxFiles) as $file) {
|
136 |
if (is_writable($file)) {
|
137 |
+
// suppress errors here as unlink() might fail if two processes
|
138 |
+
// are cleaning up/rotating at the same time
|
139 |
+
set_error_handler(function ($errno, $errstr, $errfile, $errline) {});
|
140 |
unlink($file);
|
141 |
+
restore_error_handler();
|
142 |
}
|
143 |
}
|
144 |
|
vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php
ADDED
@@ -0,0 +1,294 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Monolog package.
|
5 |
+
*
|
6 |
+
* (c) Jordi Boggiano <j.boggiano@seld.be>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Monolog\Handler\Slack;
|
13 |
+
|
14 |
+
use Monolog\Logger;
|
15 |
+
use Monolog\Formatter\NormalizerFormatter;
|
16 |
+
use Monolog\Formatter\FormatterInterface;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Slack record utility helping to log to Slack webhooks or API.
|
20 |
+
*
|
21 |
+
* @author Greg Kedzierski <greg@gregkedzierski.com>
|
22 |
+
* @author Haralan Dobrev <hkdobrev@gmail.com>
|
23 |
+
* @see https://api.slack.com/incoming-webhooks
|
24 |
+
* @see https://api.slack.com/docs/message-attachments
|
25 |
+
*/
|
26 |
+
class SlackRecord
|
27 |
+
{
|
28 |
+
const COLOR_DANGER = 'danger';
|
29 |
+
|
30 |
+
const COLOR_WARNING = 'warning';
|
31 |
+
|
32 |
+
const COLOR_GOOD = 'good';
|
33 |
+
|
34 |
+
const COLOR_DEFAULT = '#e3e4e6';
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Slack channel (encoded ID or name)
|
38 |
+
* @var string|null
|
39 |
+
*/
|
40 |
+
private $channel;
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Name of a bot
|
44 |
+
* @var string|null
|
45 |
+
*/
|
46 |
+
private $username;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* User icon e.g. 'ghost', 'http://example.com/user.png'
|
50 |
+
* @var string
|
51 |
+
*/
|
52 |
+
private $userIcon;
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Whether the message should be added to Slack as attachment (plain text otherwise)
|
56 |
+
* @var bool
|
57 |
+
*/
|
58 |
+
private $useAttachment;
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Whether the the context/extra messages added to Slack as attachments are in a short style
|
62 |
+
* @var bool
|
63 |
+
*/
|
64 |
+
private $useShortAttachment;
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Whether the attachment should include context and extra data
|
68 |
+
* @var bool
|
69 |
+
*/
|
70 |
+
private $includeContextAndExtra;
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Dot separated list of fields to exclude from slack message. E.g. ['context.field1', 'extra.field2']
|
74 |
+
* @var array
|
75 |
+
*/
|
76 |
+
private $excludeFields;
|
77 |
+
|
78 |
+
/**
|
79 |
+
* @var FormatterInterface
|
80 |
+
*/
|
81 |
+
private $formatter;
|
82 |
+
|
83 |
+
/**
|
84 |
+
* @var NormalizerFormatter
|
85 |
+
*/
|
86 |
+
private $normalizerFormatter;
|
87 |
+
|
88 |
+
public function __construct($channel = null, $username = null, $useAttachment = true, $userIcon = null, $useShortAttachment = false, $includeContextAndExtra = false, array $excludeFields = array(), FormatterInterface $formatter = null)
|
89 |
+
{
|
90 |
+
$this->channel = $channel;
|
91 |
+
$this->username = $username;
|
92 |
+
$this->userIcon = trim($userIcon, ':');
|
93 |
+
$this->useAttachment = $useAttachment;
|
94 |
+
$this->useShortAttachment = $useShortAttachment;
|
95 |
+
$this->includeContextAndExtra = $includeContextAndExtra;
|
96 |
+
$this->excludeFields = $excludeFields;
|
97 |
+
$this->formatter = $formatter;
|
98 |
+
|
99 |
+
if ($this->includeContextAndExtra) {
|
100 |
+
$this->normalizerFormatter = new NormalizerFormatter();
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
public function getSlackData(array $record)
|
105 |
+
{
|
106 |
+
$dataArray = array();
|
107 |
+
$record = $this->excludeFields($record);
|
108 |
+
|
109 |
+
if ($this->username) {
|
110 |
+
$dataArray['username'] = $this->username;
|
111 |
+
}
|
112 |
+
|
113 |
+
if ($this->channel) {
|
114 |
+
$dataArray['channel'] = $this->channel;
|
115 |
+
}
|
116 |
+
|
117 |
+
if ($this->formatter && !$this->useAttachment) {
|
118 |
+
$message = $this->formatter->format($record);
|
119 |
+
} else {
|
120 |
+
$message = $record['message'];
|
121 |
+
}
|
122 |
+
|
123 |
+
if ($this->useAttachment) {
|
124 |
+
$attachment = array(
|
125 |
+
'fallback' => $message,
|
126 |
+
'text' => $message,
|
127 |
+
'color' => $this->getAttachmentColor($record['level']),
|
128 |
+
'fields' => array(),
|
129 |
+
'mrkdwn_in' => array('fields'),
|
130 |
+
'ts' => $record['datetime']->getTimestamp()
|
131 |
+
);
|
132 |
+
|
133 |
+
if ($this->useShortAttachment) {
|
134 |
+
$attachment['title'] = $record['level_name'];
|
135 |
+
} else {
|
136 |
+
$attachment['title'] = 'Message';
|
137 |
+
$attachment['fields'][] = $this->generateAttachmentField('Level', $record['level_name']);
|
138 |
+
}
|
139 |
+
|
140 |
+
|
141 |
+
if ($this->includeContextAndExtra) {
|
142 |
+
foreach (array('extra', 'context') as $key) {
|
143 |
+
if (empty($record[$key])) {
|
144 |
+
continue;
|
145 |
+
}
|
146 |
+
|
147 |
+
if ($this->useShortAttachment) {
|
148 |
+
$attachment['fields'][] = $this->generateAttachmentField(
|
149 |
+
ucfirst($key),
|
150 |
+
$record[$key]
|
151 |
+
);
|
152 |
+
} else {
|
153 |
+
// Add all extra fields as individual fields in attachment
|
154 |
+
$attachment['fields'] = array_merge(
|
155 |
+
$attachment['fields'],
|
156 |
+
$this->generateAttachmentFields($record[$key])
|
157 |
+
);
|
158 |
+
}
|
159 |
+
}
|
160 |
+
}
|
161 |
+
|
162 |
+
$dataArray['attachments'] = array($attachment);
|
163 |
+
} else {
|
164 |
+
$dataArray['text'] = $message;
|
165 |
+
}
|
166 |
+
|
167 |
+
if ($this->userIcon) {
|
168 |
+
if (filter_var($this->userIcon, FILTER_VALIDATE_URL)) {
|
169 |
+
$dataArray['icon_url'] = $this->userIcon;
|
170 |
+
} else {
|
171 |
+
$dataArray['icon_emoji'] = ":{$this->userIcon}:";
|
172 |
+
}
|
173 |
+
}
|
174 |
+
|
175 |
+
return $dataArray;
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Returned a Slack message attachment color associated with
|
180 |
+
* provided level.
|
181 |
+
*
|
182 |
+
* @param int $level
|
183 |
+
* @return string
|
184 |
+
*/
|
185 |
+
public function getAttachmentColor($level)
|
186 |
+
{
|
187 |
+
switch (true) {
|
188 |
+
case $level >= Logger::ERROR:
|
189 |
+
return self::COLOR_DANGER;
|
190 |
+
case $level >= Logger::WARNING:
|
191 |
+
return self::COLOR_WARNING;
|
192 |
+
case $level >= Logger::INFO:
|
193 |
+
return self::COLOR_GOOD;
|
194 |
+
default:
|
195 |
+
return self::COLOR_DEFAULT;
|
196 |
+
}
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Stringifies an array of key/value pairs to be used in attachment fields
|
201 |
+
*
|
202 |
+
* @param array $fields
|
203 |
+
*
|
204 |
+
* @return string
|
205 |
+
*/
|
206 |
+
public function stringify($fields)
|
207 |
+
{
|
208 |
+
$normalized = $this->normalizerFormatter->format($fields);
|
209 |
+
$prettyPrintFlag = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 128;
|
210 |
+
|
211 |
+
$hasSecondDimension = count(array_filter($normalized, 'is_array'));
|
212 |
+
$hasNonNumericKeys = !count(array_filter(array_keys($normalized), 'is_numeric'));
|
213 |
+
|
214 |
+
return $hasSecondDimension || $hasNonNumericKeys
|
215 |
+
? json_encode($normalized, $prettyPrintFlag)
|
216 |
+
: json_encode($normalized);
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Sets the formatter
|
221 |
+
*
|
222 |
+
* @param FormatterInterface $formatter
|
223 |
+
*/
|
224 |
+
public function setFormatter(FormatterInterface $formatter)
|
225 |
+
{
|
226 |
+
$this->formatter = $formatter;
|
227 |
+
}
|
228 |
+
|
229 |
+
/**
|
230 |
+
* Generates attachment field
|
231 |
+
*
|
232 |
+
* @param string $title
|
233 |
+
* @param string|array $value\
|
234 |
+
*
|
235 |
+
* @return array
|
236 |
+
*/
|
237 |
+
private function generateAttachmentField($title, $value)
|
238 |
+
{
|
239 |
+
$value = is_array($value)
|
240 |
+
? sprintf('```%s```', $this->stringify($value))
|
241 |
+
: $value;
|
242 |
+
|
243 |
+
return array(
|
244 |
+
'title' => $title,
|
245 |
+
'value' => $value,
|
246 |
+
'short' => false
|
247 |
+
);
|
248 |
+
}
|
249 |
+
|
250 |
+
/**
|
251 |
+
* Generates a collection of attachment fields from array
|
252 |
+
*
|
253 |
+
* @param array $data
|
254 |
+
*
|
255 |
+
* @return array
|
256 |
+
*/
|
257 |
+
private function generateAttachmentFields(array $data)
|
258 |
+
{
|
259 |
+
$fields = array();
|
260 |
+
foreach ($data as $key => $value) {
|
261 |
+
$fields[] = $this->generateAttachmentField($key, $value);
|
262 |
+
}
|
263 |
+
|
264 |
+
return $fields;
|
265 |
+
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* Get a copy of record with fields excluded according to $this->excludeFields
|
269 |
+
*
|
270 |
+
* @param array $record
|
271 |
+
*
|
272 |
+
* @return array
|
273 |
+
*/
|
274 |
+
private function excludeFields(array $record)
|
275 |
+
{
|
276 |
+
foreach ($this->excludeFields as $field) {
|
277 |
+
$keys = explode('.', $field);
|
278 |
+
$node = &$record;
|
279 |
+
$lastKey = end($keys);
|
280 |
+
foreach ($keys as $key) {
|
281 |
+
if (!isset($node[$key])) {
|
282 |
+
break;
|
283 |
+
}
|
284 |
+
if ($lastKey === $key) {
|
285 |
+
unset($node[$key]);
|
286 |
+
break;
|
287 |
+
}
|
288 |
+
$node = &$node[$key];
|
289 |
+
}
|
290 |
+
}
|
291 |
+
|
292 |
+
return $record;
|
293 |
+
}
|
294 |
+
}
|
vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php
CHANGED
@@ -11,8 +11,9 @@
|
|
11 |
|
12 |
namespace Monolog\Handler;
|
13 |
|
|
|
14 |
use Monolog\Logger;
|
15 |
-
use Monolog\
|
16 |
|
17 |
/**
|
18 |
* Sends notifications through Slack API
|
@@ -29,58 +30,25 @@ class SlackHandler extends SocketHandler
|
|
29 |
private $token;
|
30 |
|
31 |
/**
|
32 |
-
*
|
33 |
-
* @var
|
34 |
-
*/
|
35 |
-
private $channel;
|
36 |
-
|
37 |
-
/**
|
38 |
-
* Name of a bot
|
39 |
-
* @var string
|
40 |
-
*/
|
41 |
-
private $username;
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Emoji icon name
|
45 |
-
* @var string
|
46 |
*/
|
47 |
-
private $
|
48 |
|
49 |
/**
|
50 |
-
*
|
51 |
-
* @
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
*/
|
53 |
-
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Whether the the context/extra messages added to Slack as attachments are in a short style
|
57 |
-
* @var bool
|
58 |
-
*/
|
59 |
-
private $useShortAttachment;
|
60 |
-
|
61 |
-
/**
|
62 |
-
* Whether the attachment should include context and extra data
|
63 |
-
* @var bool
|
64 |
-
*/
|
65 |
-
private $includeContextAndExtra;
|
66 |
-
|
67 |
-
/**
|
68 |
-
* @var LineFormatter
|
69 |
-
*/
|
70 |
-
private $lineFormatter;
|
71 |
-
|
72 |
-
/**
|
73 |
-
* @param string $token Slack API token
|
74 |
-
* @param string $channel Slack channel (encoded ID or name)
|
75 |
-
* @param string $username Name of a bot
|
76 |
-
* @param bool $useAttachment Whether the message should be added to Slack as attachment (plain text otherwise)
|
77 |
-
* @param string|null $iconEmoji The emoji name to use (or null)
|
78 |
-
* @param int $level The minimum logging level at which this handler will be triggered
|
79 |
-
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
80 |
-
* @param bool $useShortAttachment Whether the the context/extra messages added to Slack as attachments are in a short style
|
81 |
-
* @param bool $includeContextAndExtra Whether the attachment should include context and extra data
|
82 |
-
*/
|
83 |
-
public function __construct($token, $channel, $username = 'Monolog', $useAttachment = true, $iconEmoji = null, $level = Logger::CRITICAL, $bubble = true, $useShortAttachment = false, $includeContextAndExtra = false)
|
84 |
{
|
85 |
if (!extension_loaded('openssl')) {
|
86 |
throw new MissingExtensionException('The OpenSSL PHP extension is required to use the SlackHandler');
|
@@ -88,16 +56,23 @@ class SlackHandler extends SocketHandler
|
|
88 |
|
89 |
parent::__construct('ssl://slack.com:443', $level, $bubble);
|
90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
$this->token = $token;
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
$this->
|
97 |
-
$this->includeContextAndExtra = $includeContextAndExtra;
|
98 |
-
if ($this->includeContextAndExtra) {
|
99 |
-
$this->lineFormatter = new LineFormatter;
|
100 |
-
}
|
101 |
}
|
102 |
|
103 |
/**
|
@@ -134,90 +109,11 @@ class SlackHandler extends SocketHandler
|
|
134 |
*/
|
135 |
protected function prepareContentData($record)
|
136 |
{
|
137 |
-
$dataArray =
|
138 |
-
|
139 |
-
'channel' => $this->channel,
|
140 |
-
'username' => $this->username,
|
141 |
-
'text' => '',
|
142 |
-
'attachments' => array()
|
143 |
-
);
|
144 |
-
|
145 |
-
if ($this->useAttachment) {
|
146 |
-
$attachment = array(
|
147 |
-
'fallback' => $record['message'],
|
148 |
-
'color' => $this->getAttachmentColor($record['level'])
|
149 |
-
);
|
150 |
-
|
151 |
-
if ($this->useShortAttachment) {
|
152 |
-
$attachment['fields'] = array(
|
153 |
-
array(
|
154 |
-
'title' => $record['level_name'],
|
155 |
-
'value' => $record['message'],
|
156 |
-
'short' => false
|
157 |
-
)
|
158 |
-
);
|
159 |
-
} else {
|
160 |
-
$attachment['fields'] = array(
|
161 |
-
array(
|
162 |
-
'title' => 'Message',
|
163 |
-
'value' => $record['message'],
|
164 |
-
'short' => false
|
165 |
-
),
|
166 |
-
array(
|
167 |
-
'title' => 'Level',
|
168 |
-
'value' => $record['level_name'],
|
169 |
-
'short' => true
|
170 |
-
)
|
171 |
-
);
|
172 |
-
}
|
173 |
-
|
174 |
-
if ($this->includeContextAndExtra) {
|
175 |
-
if (!empty($record['extra'])) {
|
176 |
-
if ($this->useShortAttachment) {
|
177 |
-
$attachment['fields'][] = array(
|
178 |
-
'title' => "Extra",
|
179 |
-
'value' => $this->stringify($record['extra']),
|
180 |
-
'short' => $this->useShortAttachment
|
181 |
-
);
|
182 |
-
} else {
|
183 |
-
// Add all extra fields as individual fields in attachment
|
184 |
-
foreach ($record['extra'] as $var => $val) {
|
185 |
-
$attachment['fields'][] = array(
|
186 |
-
'title' => $var,
|
187 |
-
'value' => $val,
|
188 |
-
'short' => $this->useShortAttachment
|
189 |
-
);
|
190 |
-
}
|
191 |
-
}
|
192 |
-
}
|
193 |
-
|
194 |
-
if (!empty($record['context'])) {
|
195 |
-
if ($this->useShortAttachment) {
|
196 |
-
$attachment['fields'][] = array(
|
197 |
-
'title' => "Context",
|
198 |
-
'value' => $this->stringify($record['context']),
|
199 |
-
'short' => $this->useShortAttachment
|
200 |
-
);
|
201 |
-
} else {
|
202 |
-
// Add all context fields as individual fields in attachment
|
203 |
-
foreach ($record['context'] as $var => $val) {
|
204 |
-
$attachment['fields'][] = array(
|
205 |
-
'title' => $var,
|
206 |
-
'value' => $val,
|
207 |
-
'short' => $this->useShortAttachment
|
208 |
-
);
|
209 |
-
}
|
210 |
-
}
|
211 |
-
}
|
212 |
-
}
|
213 |
-
|
214 |
-
$dataArray['attachments'] = json_encode(array($attachment));
|
215 |
-
} else {
|
216 |
-
$dataArray['text'] = $record['message'];
|
217 |
-
}
|
218 |
|
219 |
-
if ($
|
220 |
-
$dataArray['
|
221 |
}
|
222 |
|
223 |
return $dataArray;
|
@@ -248,6 +144,21 @@ class SlackHandler extends SocketHandler
|
|
248 |
protected function write(array $record)
|
249 |
{
|
250 |
parent::write($record);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
$this->closeSocket();
|
252 |
}
|
253 |
|
@@ -257,37 +168,48 @@ class SlackHandler extends SocketHandler
|
|
257 |
*
|
258 |
* @param int $level
|
259 |
* @return string
|
|
|
260 |
*/
|
261 |
protected function getAttachmentColor($level)
|
262 |
{
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
return 'good';
|
270 |
-
default:
|
271 |
-
return '#e3e4e6';
|
272 |
-
}
|
273 |
}
|
274 |
|
275 |
/**
|
276 |
* Stringifies an array of key/value pairs to be used in attachment fields
|
277 |
*
|
278 |
-
* @param
|
279 |
-
* @access protected
|
280 |
* @return string
|
|
|
281 |
*/
|
282 |
protected function stringify($fields)
|
283 |
{
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
|
289 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
|
291 |
-
return $
|
292 |
}
|
293 |
}
|
11 |
|
12 |
namespace Monolog\Handler;
|
13 |
|
14 |
+
use Monolog\Formatter\FormatterInterface;
|
15 |
use Monolog\Logger;
|
16 |
+
use Monolog\Handler\Slack\SlackRecord;
|
17 |
|
18 |
/**
|
19 |
* Sends notifications through Slack API
|
30 |
private $token;
|
31 |
|
32 |
/**
|
33 |
+
* Instance of the SlackRecord util class preparing data for Slack API.
|
34 |
+
* @var SlackRecord
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
*/
|
36 |
+
private $slackRecord;
|
37 |
|
38 |
/**
|
39 |
+
* @param string $token Slack API token
|
40 |
+
* @param string $channel Slack channel (encoded ID or name)
|
41 |
+
* @param string|null $username Name of a bot
|
42 |
+
* @param bool $useAttachment Whether the message should be added to Slack as attachment (plain text otherwise)
|
43 |
+
* @param string|null $iconEmoji The emoji name to use (or null)
|
44 |
+
* @param int $level The minimum logging level at which this handler will be triggered
|
45 |
+
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
46 |
+
* @param bool $useShortAttachment Whether the the context/extra messages added to Slack as attachments are in a short style
|
47 |
+
* @param bool $includeContextAndExtra Whether the attachment should include context and extra data
|
48 |
+
* @param array $excludeFields Dot separated list of fields to exclude from slack message. E.g. ['context.field1', 'extra.field2']
|
49 |
+
* @throws MissingExtensionException If no OpenSSL PHP extension configured
|
50 |
*/
|
51 |
+
public function __construct($token, $channel, $username = null, $useAttachment = true, $iconEmoji = null, $level = Logger::CRITICAL, $bubble = true, $useShortAttachment = false, $includeContextAndExtra = false, array $excludeFields = array())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
{
|
53 |
if (!extension_loaded('openssl')) {
|
54 |
throw new MissingExtensionException('The OpenSSL PHP extension is required to use the SlackHandler');
|
56 |
|
57 |
parent::__construct('ssl://slack.com:443', $level, $bubble);
|
58 |
|
59 |
+
$this->slackRecord = new SlackRecord(
|
60 |
+
$channel,
|
61 |
+
$username,
|
62 |
+
$useAttachment,
|
63 |
+
$iconEmoji,
|
64 |
+
$useShortAttachment,
|
65 |
+
$includeContextAndExtra,
|
66 |
+
$excludeFields,
|
67 |
+
$this->formatter
|
68 |
+
);
|
69 |
+
|
70 |
$this->token = $token;
|
71 |
+
}
|
72 |
+
|
73 |
+
public function getSlackRecord()
|
74 |
+
{
|
75 |
+
return $this->slackRecord;
|
|
|
|
|
|
|
|
|
76 |
}
|
77 |
|
78 |
/**
|
109 |
*/
|
110 |
protected function prepareContentData($record)
|
111 |
{
|
112 |
+
$dataArray = $this->slackRecord->getSlackData($record);
|
113 |
+
$dataArray['token'] = $this->token;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
|
115 |
+
if (!empty($dataArray['attachments'])) {
|
116 |
+
$dataArray['attachments'] = json_encode($dataArray['attachments']);
|
117 |
}
|
118 |
|
119 |
return $dataArray;
|
144 |
protected function write(array $record)
|
145 |
{
|
146 |
parent::write($record);
|
147 |
+
$this->finalizeWrite();
|
148 |
+
}
|
149 |
+
|
150 |
+
/**
|
151 |
+
* Finalizes the request by reading some bytes and then closing the socket
|
152 |
+
*
|
153 |
+
* If we do not read some but close the socket too early, slack sometimes
|
154 |
+
* drops the request entirely.
|
155 |
+
*/
|
156 |
+
protected function finalizeWrite()
|
157 |
+
{
|
158 |
+
$res = $this->getResource();
|
159 |
+
if (is_resource($res)) {
|
160 |
+
@fread($res, 2048);
|
161 |
+
}
|
162 |
$this->closeSocket();
|
163 |
}
|
164 |
|
168 |
*
|
169 |
* @param int $level
|
170 |
* @return string
|
171 |
+
* @deprecated Use underlying SlackRecord instead
|
172 |
*/
|
173 |
protected function getAttachmentColor($level)
|
174 |
{
|
175 |
+
trigger_error(
|
176 |
+
'SlackHandler::getAttachmentColor() is deprecated. Use underlying SlackRecord instead.',
|
177 |
+
E_USER_DEPRECATED
|
178 |
+
);
|
179 |
+
|
180 |
+
return $this->slackRecord->getAttachmentColor($level);
|
|
|
|
|
|
|
|
|
181 |
}
|
182 |
|
183 |
/**
|
184 |
* Stringifies an array of key/value pairs to be used in attachment fields
|
185 |
*
|
186 |
+
* @param array $fields
|
|
|
187 |
* @return string
|
188 |
+
* @deprecated Use underlying SlackRecord instead
|
189 |
*/
|
190 |
protected function stringify($fields)
|
191 |
{
|
192 |
+
trigger_error(
|
193 |
+
'SlackHandler::stringify() is deprecated. Use underlying SlackRecord instead.',
|
194 |
+
E_USER_DEPRECATED
|
195 |
+
);
|
196 |
|
197 |
+
return $this->slackRecord->stringify($fields);
|
198 |
+
}
|
199 |
+
|
200 |
+
public function setFormatter(FormatterInterface $formatter)
|
201 |
+
{
|
202 |
+
parent::setFormatter($formatter);
|
203 |
+
$this->slackRecord->setFormatter($formatter);
|
204 |
+
|
205 |
+
return $this;
|
206 |
+
}
|
207 |
+
|
208 |
+
public function getFormatter()
|
209 |
+
{
|
210 |
+
$formatter = parent::getFormatter();
|
211 |
+
$this->slackRecord->setFormatter($formatter);
|
212 |
|
213 |
+
return $formatter;
|
214 |
}
|
215 |
}
|
vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php
ADDED
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Monolog package.
|
5 |
+
*
|
6 |
+
* (c) Jordi Boggiano <j.boggiano@seld.be>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Monolog\Handler;
|
13 |
+
|
14 |
+
use Monolog\Formatter\FormatterInterface;
|
15 |
+
use Monolog\Logger;
|
16 |
+
use Monolog\Handler\Slack\SlackRecord;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Sends notifications through Slack Webhooks
|
20 |
+
*
|
21 |
+
* @author Haralan Dobrev <hkdobrev@gmail.com>
|
22 |
+
* @see https://api.slack.com/incoming-webhooks
|
23 |
+
*/
|
24 |
+
class SlackWebhookHandler extends AbstractProcessingHandler
|
25 |
+
{
|
26 |
+
/**
|
27 |
+
* Slack Webhook token
|
28 |
+
* @var string
|
29 |
+
*/
|
30 |
+
private $webhookUrl;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Instance of the SlackRecord util class preparing data for Slack API.
|
34 |
+
* @var SlackRecord
|
35 |
+
*/
|
36 |
+
private $slackRecord;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @param string $webhookUrl Slack Webhook URL
|
40 |
+
* @param string|null $channel Slack channel (encoded ID or name)
|
41 |
+
* @param string|null $username Name of a bot
|
42 |
+
* @param bool $useAttachment Whether the message should be added to Slack as attachment (plain text otherwise)
|
43 |
+
* @param string|null $iconEmoji The emoji name to use (or null)
|
44 |
+
* @param bool $useShortAttachment Whether the the context/extra messages added to Slack as attachments are in a short style
|
45 |
+
* @param bool $includeContextAndExtra Whether the attachment should include context and extra data
|
46 |
+
* @param int $level The minimum logging level at which this handler will be triggered
|
47 |
+
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
48 |
+
* @param array $excludeFields Dot separated list of fields to exclude from slack message. E.g. ['context.field1', 'extra.field2']
|
49 |
+
*/
|
50 |
+
public function __construct($webhookUrl, $channel = null, $username = null, $useAttachment = true, $iconEmoji = null, $useShortAttachment = false, $includeContextAndExtra = false, $level = Logger::CRITICAL, $bubble = true, array $excludeFields = array())
|
51 |
+
{
|
52 |
+
parent::__construct($level, $bubble);
|
53 |
+
|
54 |
+
$this->webhookUrl = $webhookUrl;
|
55 |
+
|
56 |
+
$this->slackRecord = new SlackRecord(
|
57 |
+
$channel,
|
58 |
+
$username,
|
59 |
+
$useAttachment,
|
60 |
+
$iconEmoji,
|
61 |
+
$useShortAttachment,
|
62 |
+
$includeContextAndExtra,
|
63 |
+
$excludeFields,
|
64 |
+
$this->formatter
|
65 |
+
);
|
66 |
+
}
|
67 |
+
|
68 |
+
public function getSlackRecord()
|
69 |
+
{
|
70 |
+
return $this->slackRecord;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* {@inheritdoc}
|
75 |
+
*
|
76 |
+
* @param array $record
|
77 |
+
*/
|
78 |
+
protected function write(array $record)
|
79 |
+
{
|
80 |
+
$postData = $this->slackRecord->getSlackData($record);
|
81 |
+
$postString = json_encode($postData);
|
82 |
+
|
83 |
+
$ch = curl_init();
|
84 |
+
$options = array(
|
85 |
+
CURLOPT_URL => $this->webhookUrl,
|
86 |
+
CURLOPT_POST => true,
|
87 |
+
CURLOPT_RETURNTRANSFER => true,
|
88 |
+
CURLOPT_HTTPHEADER => array('Content-type: application/json'),
|
89 |
+
CURLOPT_POSTFIELDS => $postString
|
90 |
+
);
|
91 |
+
if (defined('CURLOPT_SAFE_UPLOAD')) {
|
92 |
+
$options[CURLOPT_SAFE_UPLOAD] = true;
|
93 |
+
}
|
94 |
+
|
95 |
+
curl_setopt_array($ch, $options);
|
96 |
+
|
97 |
+
Curl\Util::execute($ch);
|
98 |
+
}
|
99 |
+
|
100 |
+
public function setFormatter(FormatterInterface $formatter)
|
101 |
+
{
|
102 |
+
parent::setFormatter($formatter);
|
103 |
+
$this->slackRecord->setFormatter($formatter);
|
104 |
+
|
105 |
+
return $this;
|
106 |
+
}
|
107 |
+
|
108 |
+
public function getFormatter()
|
109 |
+
{
|
110 |
+
$formatter = parent::getFormatter();
|
111 |
+
$this->slackRecord->setFormatter($formatter);
|
112 |
+
|
113 |
+
return $formatter;
|
114 |
+
}
|
115 |
+
}
|
vendor/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Monolog package.
|
5 |
+
*
|
6 |
+
* (c) Jordi Boggiano <j.boggiano@seld.be>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Monolog\Handler;
|
13 |
+
|
14 |
+
use Monolog\Logger;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Sends notifications through Slack's Slackbot
|
18 |
+
*
|
19 |
+
* @author Haralan Dobrev <hkdobrev@gmail.com>
|
20 |
+
* @see https://slack.com/apps/A0F81R8ET-slackbot
|
21 |
+
*/
|
22 |
+
class SlackbotHandler extends AbstractProcessingHandler
|
23 |
+
{
|
24 |
+
/**
|
25 |
+
* The slug of the Slack team
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
+
private $slackTeam;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Slackbot token
|
32 |
+
* @var string
|
33 |
+
*/
|
34 |
+
private $token;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Slack channel name
|
38 |
+
* @var string
|
39 |
+
*/
|
40 |
+
private $channel;
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @param string $slackTeam Slack team slug
|
44 |
+
* @param string $token Slackbot token
|
45 |
+
* @param string $channel Slack channel (encoded ID or name)
|
46 |
+
* @param int $level The minimum logging level at which this handler will be triggered
|
47 |
+
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
48 |
+
*/
|
49 |
+
public function __construct($slackTeam, $token, $channel, $level = Logger::CRITICAL, $bubble = true)
|
50 |
+
{
|
51 |
+
parent::__construct($level, $bubble);
|
52 |
+
|
53 |
+
$this->slackTeam = $slackTeam;
|
54 |
+
$this->token = $token;
|
55 |
+
$this->channel = $channel;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* {@inheritdoc}
|
60 |
+
*
|
61 |
+
* @param array $record
|
62 |
+
*/
|
63 |
+
protected function write(array $record)
|
64 |
+
{
|
65 |
+
$slackbotUrl = sprintf(
|
66 |
+
'https://%s.slack.com/services/hooks/slackbot?token=%s&channel=%s',
|
67 |
+
$this->slackTeam,
|
68 |
+
$this->token,
|
69 |
+
$this->channel
|
70 |
+
);
|
71 |
+
|
72 |
+
$ch = curl_init();
|
73 |
+
curl_setopt($ch, CURLOPT_URL, $slackbotUrl);
|
74 |
+
curl_setopt($ch, CURLOPT_POST, true);
|
75 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
76 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $record['message']);
|
77 |
+
|
78 |
+
Curl\Util::execute($ch);
|
79 |
+
}
|
80 |
+
}
|
vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php
CHANGED
@@ -25,13 +25,16 @@ class SocketHandler extends AbstractProcessingHandler
|
|
25 |
private $connectionTimeout;
|
26 |
private $resource;
|
27 |
private $timeout = 0;
|
|
|
|
|
28 |
private $persistent = false;
|
29 |
private $errno;
|
30 |
private $errstr;
|
|
|
31 |
|
32 |
/**
|
33 |
* @param string $connectionString Socket connection string
|
34 |
-
* @param
|
35 |
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
36 |
*/
|
37 |
public function __construct($connectionString, $level = Logger::DEBUG, $bubble = true)
|
@@ -80,7 +83,7 @@ class SocketHandler extends AbstractProcessingHandler
|
|
80 |
/**
|
81 |
* Set socket connection to nbe persistent. It only has effect before the connection is initiated.
|
82 |
*
|
83 |
-
* @param
|
84 |
*/
|
85 |
public function setPersistent($persistent)
|
86 |
{
|
@@ -113,6 +116,17 @@ class SocketHandler extends AbstractProcessingHandler
|
|
113 |
$this->timeout = (float) $seconds;
|
114 |
}
|
115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
/**
|
117 |
* Get current connection string
|
118 |
*
|
@@ -126,7 +140,7 @@ class SocketHandler extends AbstractProcessingHandler
|
|
126 |
/**
|
127 |
* Get persistent setting
|
128 |
*
|
129 |
-
* @return
|
130 |
*/
|
131 |
public function isPersistent()
|
132 |
{
|
@@ -153,12 +167,22 @@ class SocketHandler extends AbstractProcessingHandler
|
|
153 |
return $this->timeout;
|
154 |
}
|
155 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
/**
|
157 |
* Check to see if the socket is currently available.
|
158 |
*
|
159 |
* UDP might appear to be connected but might fail when writing. See http://php.net/fsockopen for details.
|
160 |
*
|
161 |
-
* @return
|
162 |
*/
|
163 |
public function isConnected()
|
164 |
{
|
@@ -232,6 +256,14 @@ class SocketHandler extends AbstractProcessingHandler
|
|
232 |
return (string) $record['formatted'];
|
233 |
}
|
234 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
private function connect()
|
236 |
{
|
237 |
$this->createSocketResource();
|
@@ -262,6 +294,7 @@ class SocketHandler extends AbstractProcessingHandler
|
|
262 |
{
|
263 |
$length = strlen($data);
|
264 |
$sent = 0;
|
|
|
265 |
while ($this->isConnected() && $sent < $length) {
|
266 |
if (0 == $sent) {
|
267 |
$chunk = $this->fwrite($data);
|
@@ -276,9 +309,38 @@ class SocketHandler extends AbstractProcessingHandler
|
|
276 |
if ($socketInfo['timed_out']) {
|
277 |
throw new \RuntimeException("Write timed-out");
|
278 |
}
|
|
|
|
|
|
|
|
|
279 |
}
|
280 |
if (!$this->isConnected() && $sent < $length) {
|
281 |
throw new \RuntimeException("End-of-file reached, probably we got disconnected (sent $sent of $length)");
|
282 |
}
|
283 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
}
|
25 |
private $connectionTimeout;
|
26 |
private $resource;
|
27 |
private $timeout = 0;
|
28 |
+
private $writingTimeout = 10;
|
29 |
+
private $lastSentBytes = null;
|
30 |
private $persistent = false;
|
31 |
private $errno;
|
32 |
private $errstr;
|
33 |
+
private $lastWritingAt;
|
34 |
|
35 |
/**
|
36 |
* @param string $connectionString Socket connection string
|
37 |
+
* @param int $level The minimum logging level at which this handler will be triggered
|
38 |
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
39 |
*/
|
40 |
public function __construct($connectionString, $level = Logger::DEBUG, $bubble = true)
|
83 |
/**
|
84 |
* Set socket connection to nbe persistent. It only has effect before the connection is initiated.
|
85 |
*
|
86 |
+
* @param bool $persistent
|
87 |
*/
|
88 |
public function setPersistent($persistent)
|
89 |
{
|
116 |
$this->timeout = (float) $seconds;
|
117 |
}
|
118 |
|
119 |
+
/**
|
120 |
+
* Set writing timeout. Only has effect during connection in the writing cycle.
|
121 |
+
*
|
122 |
+
* @param float $seconds 0 for no timeout
|
123 |
+
*/
|
124 |
+
public function setWritingTimeout($seconds)
|
125 |
+
{
|
126 |
+
$this->validateTimeout($seconds);
|
127 |
+
$this->writingTimeout = (float) $seconds;
|
128 |
+
}
|
129 |
+
|
130 |
/**
|
131 |
* Get current connection string
|
132 |
*
|
140 |
/**
|
141 |
* Get persistent setting
|
142 |
*
|
143 |
+
* @return bool
|
144 |
*/
|
145 |
public function isPersistent()
|
146 |
{
|
167 |
return $this->timeout;
|
168 |
}
|
169 |
|
170 |
+
/**
|
171 |
+
* Get current local writing timeout
|
172 |
+
*
|
173 |
+
* @return float
|
174 |
+
*/
|
175 |
+
public function getWritingTimeout()
|
176 |
+
{
|
177 |
+
return $this->writingTimeout;
|
178 |
+
}
|
179 |
+
|
180 |
/**
|
181 |
* Check to see if the socket is currently available.
|
182 |
*
|
183 |
* UDP might appear to be connected but might fail when writing. See http://php.net/fsockopen for details.
|
184 |
*
|
185 |
+
* @return bool
|
186 |
*/
|
187 |
public function isConnected()
|
188 |
{
|
256 |
return (string) $record['formatted'];
|
257 |
}
|
258 |
|
259 |
+
/**
|
260 |
+
* @return resource|null
|
261 |
+
*/
|
262 |
+
protected function getResource()
|
263 |
+
{
|
264 |
+
return $this->resource;
|
265 |
+
}
|
266 |
+
|
267 |
private function connect()
|
268 |
{
|
269 |
$this->createSocketResource();
|
294 |
{
|
295 |
$length = strlen($data);
|
296 |
$sent = 0;
|
297 |
+
$this->lastSentBytes = $sent;
|
298 |
while ($this->isConnected() && $sent < $length) {
|
299 |
if (0 == $sent) {
|
300 |
$chunk = $this->fwrite($data);
|
309 |
if ($socketInfo['timed_out']) {
|
310 |
throw new \RuntimeException("Write timed-out");
|
311 |
}
|
312 |
+
|
313 |
+
if ($this->writingIsTimedOut($sent)) {
|
314 |
+
throw new \RuntimeException("Write timed-out, no data sent for `{$this->writingTimeout}` seconds, probably we got disconnected (sent $sent of $length)");
|
315 |
+
}
|
316 |
}
|
317 |
if (!$this->isConnected() && $sent < $length) {
|
318 |
throw new \RuntimeException("End-of-file reached, probably we got disconnected (sent $sent of $length)");
|
319 |
}
|
320 |
}
|
321 |
+
|
322 |
+
private function writingIsTimedOut($sent)
|
323 |
+
{
|
324 |
+
$writingTimeout = (int) floor($this->writingTimeout);
|
325 |
+
if (0 === $writingTimeout) {
|
326 |
+
return false;
|
327 |
+
}
|
328 |
+
|
329 |
+
if ($sent !== $this->lastSentBytes) {
|
330 |
+
$this->lastWritingAt = time();
|
331 |
+
$this->lastSentBytes = $sent;
|
332 |
+
|
333 |
+
return false;
|
334 |
+
} else {
|
335 |
+
usleep(100);
|
336 |
+
}
|
337 |
+
|
338 |
+
if ((time() - $this->lastWritingAt) >= $writingTimeout) {
|
339 |
+
$this->closeSocket();
|
340 |
+
|
341 |
+
return true;
|
342 |
+
}
|
343 |
+
|
344 |
+
return false;
|
345 |
+
}
|
346 |
}
|
vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php
CHANGED
@@ -31,7 +31,7 @@ class StreamHandler extends AbstractProcessingHandler
|
|
31 |
|
32 |
/**
|
33 |
* @param resource|string $stream
|
34 |
-
* @param
|
35 |
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
36 |
* @param int|null $filePermission Optional file permissions (default (0644) are only for owner read/write)
|
37 |
* @param Boolean $useLocking Try to lock log file before doing any writes
|
@@ -59,19 +59,39 @@ class StreamHandler extends AbstractProcessingHandler
|
|
59 |
*/
|
60 |
public function close()
|
61 |
{
|
62 |
-
if (is_resource($this->stream)) {
|
63 |
fclose($this->stream);
|
64 |
}
|
65 |
$this->stream = null;
|
66 |
}
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
/**
|
69 |
* {@inheritdoc}
|
70 |
*/
|
71 |
protected function write(array $record)
|
72 |
{
|
73 |
if (!is_resource($this->stream)) {
|
74 |
-
if (
|
75 |
throw new \LogicException('Missing stream url, the stream can not be opened. This may be caused by a premature call to close().');
|
76 |
}
|
77 |
$this->createDir();
|
@@ -93,13 +113,23 @@ class StreamHandler extends AbstractProcessingHandler
|
|
93 |
flock($this->stream, LOCK_EX);
|
94 |
}
|
95 |
|
96 |
-
|
97 |
|
98 |
if ($this->useLocking) {
|
99 |
flock($this->stream, LOCK_UN);
|
100 |
}
|
101 |
}
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
private function customErrorHandler($code, $msg)
|
104 |
{
|
105 |
$this->errorMessage = preg_replace('{^(fopen|mkdir)\(.*?\): }', '', $msg);
|
31 |
|
32 |
/**
|
33 |
* @param resource|string $stream
|
34 |
+
* @param int $level The minimum logging level at which this handler will be triggered
|
35 |
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
36 |
* @param int|null $filePermission Optional file permissions (default (0644) are only for owner read/write)
|
37 |
* @param Boolean $useLocking Try to lock log file before doing any writes
|
59 |
*/
|
60 |
public function close()
|
61 |
{
|
62 |
+
if ($this->url && is_resource($this->stream)) {
|
63 |
fclose($this->stream);
|
64 |
}
|
65 |
$this->stream = null;
|
66 |
}
|
67 |
|
68 |
+
/**
|
69 |
+
* Return the currently active stream if it is open
|
70 |
+
*
|
71 |
+
* @return resource|null
|
72 |
+
*/
|
73 |
+
public function getStream()
|
74 |
+
{
|
75 |
+
return $this->stream;
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Return the stream URL if it was configured with a URL and not an active resource
|
80 |
+
*
|
81 |
+
* @return string|null
|
82 |
+
*/
|
83 |
+
public function getUrl()
|
84 |
+
{
|
85 |
+
return $this->url;
|
86 |
+
}
|
87 |
+
|
88 |
/**
|
89 |
* {@inheritdoc}
|
90 |
*/
|
91 |
protected function write(array $record)
|
92 |
{
|
93 |
if (!is_resource($this->stream)) {
|
94 |
+
if (null === $this->url || '' === $this->url) {
|
95 |
throw new \LogicException('Missing stream url, the stream can not be opened. This may be caused by a premature call to close().');
|
96 |
}
|
97 |
$this->createDir();
|
113 |
flock($this->stream, LOCK_EX);
|
114 |
}
|
115 |
|
116 |
+
$this->streamWrite($this->stream, $record);
|
117 |
|
118 |
if ($this->useLocking) {
|
119 |
flock($this->stream, LOCK_UN);
|
120 |
}
|
121 |
}
|
122 |
|
123 |
+
/**
|
124 |
+
* Write to stream
|
125 |
+
* @param resource $stream
|
126 |
+
* @param array $record
|
127 |
+
*/
|
128 |
+
protected function streamWrite($stream, array $record)
|
129 |
+
{
|
130 |
+
fwrite($stream, (string) $record['formatted']);
|
131 |
+
}
|
132 |
+
|
133 |
private function customErrorHandler($code, $msg)
|
134 |
{
|
135 |
$this->errorMessage = preg_replace('{^(fopen|mkdir)\(.*?\): }', '', $msg);
|
vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php
CHANGED
@@ -12,6 +12,8 @@
|
|
12 |
namespace Monolog\Handler;
|
13 |
|
14 |
use Monolog\Logger;
|
|
|
|
|
15 |
|
16 |
/**
|
17 |
* SwiftMailerHandler uses Swift_Mailer to send the emails
|
@@ -26,7 +28,7 @@ class SwiftMailerHandler extends MailHandler
|
|
26 |
/**
|
27 |
* @param \Swift_Mailer $mailer The mailer to use
|
28 |
* @param callable|\Swift_Message $message An example message for real messages, only the body will be replaced
|
29 |
-
* @param
|
30 |
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
31 |
*/
|
32 |
public function __construct(\Swift_Mailer $mailer, $message, $level = Logger::ERROR, $bubble = true)
|
@@ -48,8 +50,8 @@ class SwiftMailerHandler extends MailHandler
|
|
48 |
/**
|
49 |
* Creates instance of Swift_Message to be sent
|
50 |
*
|
51 |
-
* @param
|
52 |
-
* @param
|
53 |
* @return \Swift_Message
|
54 |
*/
|
55 |
protected function buildMessage($content, array $records)
|
@@ -57,6 +59,7 @@ class SwiftMailerHandler extends MailHandler
|
|
57 |
$message = null;
|
58 |
if ($this->messageTemplate instanceof \Swift_Message) {
|
59 |
$message = clone $this->messageTemplate;
|
|
|
60 |
} elseif (is_callable($this->messageTemplate)) {
|
61 |
$message = call_user_func($this->messageTemplate, $content, $records);
|
62 |
}
|
@@ -65,8 +68,17 @@ class SwiftMailerHandler extends MailHandler
|
|
65 |
throw new \InvalidArgumentException('Could not resolve message as instance of Swift_Message or a callable returning it');
|
66 |
}
|
67 |
|
|
|
|
|
|
|
|
|
|
|
68 |
$message->setBody($content);
|
69 |
-
|
|
|
|
|
|
|
|
|
70 |
|
71 |
return $message;
|
72 |
}
|
12 |
namespace Monolog\Handler;
|
13 |
|
14 |
use Monolog\Logger;
|
15 |
+
use Monolog\Formatter\LineFormatter;
|
16 |
+
use Swift;
|
17 |
|
18 |
/**
|
19 |
* SwiftMailerHandler uses Swift_Mailer to send the emails
|
28 |
/**
|
29 |
* @param \Swift_Mailer $mailer The mailer to use
|
30 |
* @param callable|\Swift_Message $message An example message for real messages, only the body will be replaced
|
31 |
+
* @param int $level The minimum logging level at which this handler will be triggered
|
32 |
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
33 |
*/
|
34 |
public function __construct(\Swift_Mailer $mailer, $message, $level = Logger::ERROR, $bubble = true)
|
50 |
/**
|
51 |
* Creates instance of Swift_Message to be sent
|
52 |
*
|
53 |
+
* @param string $content formatted email body to be sent
|
54 |
+
* @param array $records Log records that formed the content
|
55 |
* @return \Swift_Message
|
56 |
*/
|
57 |
protected function buildMessage($content, array $records)
|
59 |
$message = null;
|
60 |
if ($this->messageTemplate instanceof \Swift_Message) {
|
61 |
$message = clone $this->messageTemplate;
|
62 |
+
$message->generateId();
|
63 |
} elseif (is_callable($this->messageTemplate)) {
|
64 |
$message = call_user_func($this->messageTemplate, $content, $records);
|
65 |
}
|
68 |
throw new \InvalidArgumentException('Could not resolve message as instance of Swift_Message or a callable returning it');
|
69 |
}
|
70 |
|
71 |
+
if ($records) {
|
72 |
+
$subjectFormatter = new LineFormatter($message->getSubject());
|
73 |
+
$message->setSubject($subjectFormatter->format($this->getHighestRecord($records)));
|
74 |
+
}
|
75 |
+
|
76 |
$message->setBody($content);
|
77 |
+
if (version_compare(Swift::VERSION, '6.0.0', '>=')) {
|
78 |
+
$message->setDate(new \DateTimeImmutable());
|
79 |
+
} else {
|
80 |
+
$message->setDate(time());
|
81 |
+
}
|
82 |
|
83 |
return $message;
|
84 |
}
|
vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php
CHANGED
@@ -34,7 +34,7 @@ class SyslogHandler extends AbstractSyslogHandler
|
|
34 |
/**
|
35 |
* @param string $ident
|
36 |
* @param mixed $facility
|
37 |
-
* @param
|
38 |
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
39 |
* @param int $logopts Option flags for the openlog() call, defaults to LOG_PID
|
40 |
*/
|
34 |
/**
|
35 |
* @param string $ident
|
36 |
* @param mixed $facility
|
37 |
+
* @param int $level The minimum logging level at which this handler will be triggered
|
38 |
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
39 |
* @param int $logopts Option flags for the openlog() call, defaults to LOG_PID
|
40 |
*/
|
vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php
CHANGED
@@ -15,6 +15,10 @@ class UdpSocket
|
|
15 |
{
|
16 |
const DATAGRAM_MAX_LENGTH = 65023;
|
17 |
|
|
|
|
|
|
|
|
|
18 |
public function __construct($ip, $port = 514)
|
19 |
{
|
20 |
$this->ip = $ip;
|
15 |
{
|
16 |
const DATAGRAM_MAX_LENGTH = 65023;
|
17 |
|
18 |
+
protected $ip;
|
19 |
+
protected $port;
|
20 |
+
protected $socket;
|
21 |
+
|
22 |
public function __construct($ip, $port = 514)
|
23 |
{
|
24 |
$this->ip = $ip;
|
vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php
CHANGED
@@ -21,17 +21,23 @@ use Monolog\Handler\SyslogUdp\UdpSocket;
|
|
21 |
*/
|
22 |
class SyslogUdpHandler extends AbstractSyslogHandler
|
23 |
{
|
|
|
|
|
|
|
24 |
/**
|
25 |
* @param string $host
|
26 |
* @param int $port
|
27 |
* @param mixed $facility
|
28 |
-
* @param
|
29 |
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
|
|
30 |
*/
|
31 |
-
public function __construct($host, $port = 514, $facility = LOG_USER, $level = Logger::DEBUG, $bubble = true)
|
32 |
{
|
33 |
parent::__construct($facility, $level, $bubble);
|
34 |
|
|
|
|
|
35 |
$this->socket = new UdpSocket($host, $port ?: 514);
|
36 |
}
|
37 |
|
@@ -57,7 +63,7 @@ class SyslogUdpHandler extends AbstractSyslogHandler
|
|
57 |
$message = implode("\n", $message);
|
58 |
}
|
59 |
|
60 |
-
return preg_split('/$\R?^/m', $message);
|
61 |
}
|
62 |
|
63 |
/**
|
@@ -67,7 +73,24 @@ class SyslogUdpHandler extends AbstractSyslogHandler
|
|
67 |
{
|
68 |
$priority = $severity + $this->facility;
|
69 |
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
}
|
72 |
|
73 |
/**
|
21 |
*/
|
22 |
class SyslogUdpHandler extends AbstractSyslogHandler
|
23 |
{
|
24 |
+
protected $socket;
|
25 |
+
protected $ident;
|
26 |
+
|
27 |
/**
|
28 |
* @param string $host
|
29 |
* @param int $port
|
30 |
* @param mixed $facility
|
31 |
+
* @param int $level The minimum logging level at which this handler will be triggered
|
32 |
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
33 |
+
* @param string $ident Program name or tag for each log message.
|
34 |
*/
|
35 |
+
public function __construct($host, $port = 514, $facility = LOG_USER, $level = Logger::DEBUG, $bubble = true, $ident = 'php')
|
36 |
{
|
37 |
parent::__construct($facility, $level, $bubble);
|
38 |
|
39 |
+
$this->ident = $ident;
|
40 |
+
|
41 |
$this->socket = new UdpSocket($host, $port ?: 514);
|
42 |
}
|
43 |
|
63 |
$message = implode("\n", $message);
|
64 |
}
|
65 |
|
66 |
+
return preg_split('/$\R?^/m', $message, -1, PREG_SPLIT_NO_EMPTY);
|
67 |
}
|
68 |
|
69 |
/**
|
73 |
{
|
74 |
$priority = $severity + $this->facility;
|
75 |
|
76 |
+
if (!$pid = getmypid()) {
|
77 |
+
$pid = '-';
|
78 |
+
}
|
79 |
+
|
80 |
+
if (!$hostname = gethostname()) {
|
81 |
+
$hostname = '-';
|
82 |
+
}
|
83 |
+
|
84 |
+
return "<$priority>1 " .
|
85 |
+
$this->getDateTime() . " " .
|
86 |
+
$hostname . " " .
|
87 |
+
$this->ident . " " .
|
88 |
+
$pid . " - - ";
|
89 |
+
}
|
90 |
+
|
91 |
+
protected function getDateTime()
|
92 |
+
{
|
93 |
+
return date(\DateTime::RFC3339);
|
94 |
}
|
95 |
|
96 |
/**
|
vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php
CHANGED
@@ -18,50 +18,50 @@ namespace Monolog\Handler;
|
|
18 |
*
|
19 |
* @author Jordi Boggiano <j.boggiano@seld.be>
|
20 |
*
|
21 |
-
* @method
|
22 |
-
* @method
|
23 |
-
* @method
|
24 |
-
* @method
|
25 |
-
* @method
|
26 |
-
* @method
|
27 |
-
* @method
|
28 |
-
* @method
|
29 |
*
|
30 |
-
* @method
|
31 |
-
* @method
|
32 |
-
* @method
|
33 |
-
* @method
|
34 |
-
* @method
|
35 |
-
* @method
|
36 |
-
* @method
|
37 |
-
* @method
|
38 |
*
|
39 |
-
* @method
|
40 |
-
* @method
|
41 |
-
* @method
|
42 |
-
* @method
|
43 |
-
* @method
|
44 |
-
* @method
|
45 |
-
* @method
|
46 |
-
* @method
|
47 |
*
|
48 |
-
* @method
|
49 |
-
* @method
|
50 |
-
* @method
|
51 |
-
* @method
|
52 |
-
* @method
|
53 |
-
* @method
|
54 |
-
* @method
|
55 |
-
* @method
|
56 |
*
|
57 |
-
* @method
|
58 |
-
* @method
|
59 |
-
* @method
|
60 |
-
* @method
|
61 |
-
* @method
|
62 |
-
* @method
|
63 |
-
* @method
|
64 |
-
* @method
|
65 |
*/
|
66 |
class TestHandler extends AbstractProcessingHandler
|
67 |
{
|
@@ -73,12 +73,18 @@ class TestHandler extends AbstractProcessingHandler
|
|
73 |
return $this->records;
|
74 |
}
|
75 |
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
{
|
78 |
return isset($this->recordsByLevel[$level]);
|
79 |
}
|
80 |
|
81 |
-
|
82 |
{
|
83 |
if (is_array($record)) {
|
84 |
$record = $record['message'];
|
@@ -134,7 +140,7 @@ class TestHandler extends AbstractProcessingHandler
|
|
134 |
public function __call($method, $args)
|
135 |
{
|
136 |
if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) {
|
137 |
-
$genericMethod = $matches[1] . 'Record' . $matches[3];
|
138 |
$level = constant('Monolog\Logger::' . strtoupper($matches[2]));
|
139 |
if (method_exists($this, $genericMethod)) {
|
140 |
$args[] = $level;
|
18 |
*
|
19 |
* @author Jordi Boggiano <j.boggiano@seld.be>
|
20 |
*
|
21 |
+
* @method bool hasEmergency($record)
|
22 |
+
* @method bool hasAlert($record)
|
23 |
+
* @method bool hasCritical($record)
|
24 |
+
* @method bool hasError($record)
|
25 |
+
* @method bool hasWarning($record)
|
26 |
+
* @method bool hasNotice($record)
|
27 |
+
* @method bool hasInfo($record)
|
28 |
+
* @method bool hasDebug($record)
|
29 |
*
|
30 |
+
* @method bool hasEmergencyRecords()
|
31 |
+
* @method bool hasAlertRecords()
|
32 |
+
* @method bool hasCriticalRecords()
|
33 |
+
* @method bool hasErrorRecords()
|
34 |
+
* @method bool hasWarningRecords()
|
35 |
+
* @method bool hasNoticeRecords()
|
36 |
+
* @method bool hasInfoRecords()
|
37 |
+
* @method bool hasDebugRecords()
|
38 |
*
|
39 |
+
* @method bool hasEmergencyThatContains($message)
|
40 |
+
* @method bool hasAlertThatContains($message)
|
41 |
+
* @method bool hasCriticalThatContains($message)
|
42 |
+
* @method bool hasErrorThatContains($message)
|
43 |
+
* @method bool hasWarningThatContains($message)
|
44 |
+
* @method bool hasNoticeThatContains($message)
|
45 |
+
* @method bool hasInfoThatContains($message)
|
46 |
+
* @method bool hasDebugThatContains($message)
|
47 |
*
|
48 |
+
* @method bool hasEmergencyThatMatches($message)
|
49 |
+
* @method bool hasAlertThatMatches($message)
|
50 |
+
* @method bool hasCriticalThatMatches($message)
|
51 |
+
* @method bool hasErrorThatMatches($message)
|
52 |
+
* @method bool hasWarningThatMatches($message)
|
53 |
+
* @method bool hasNoticeThatMatches($message)
|
54 |
+
* @method bool hasInfoThatMatches($message)
|
55 |
+
* @method bool hasDebugThatMatches($message)
|
56 |
*
|
57 |
+
* @method bool hasEmergencyThatPasses($message)
|
58 |
+
* @method bool hasAlertThatPasses($message)
|
59 |
+
* @method bool hasCriticalThatPasses($message)
|
60 |
+
* @method bool hasErrorThatPasses($message)
|
61 |
+
* @method bool hasWarningThatPasses($message)
|
62 |
+
* @method bool hasNoticeThatPasses($message)
|
63 |
+
* @method bool hasInfoThatPasses($message)
|
64 |
+
* @method bool hasDebugThatPasses($message)
|
65 |
*/
|
66 |
class TestHandler extends AbstractProcessingHandler
|
67 |
{
|
73 |
return $this->records;
|
74 |
}
|
75 |
|
76 |
+
public function clear()
|
77 |
+
{
|
78 |
+
$this->records = array();
|
79 |
+
$this->recordsByLevel = array();
|
80 |
+
}
|
81 |
+
|
82 |
+
public function hasRecords($level)
|
83 |
{
|
84 |
return isset($this->recordsByLevel[$level]);
|
85 |
}
|
86 |
|
87 |
+
public function hasRecord($record, $level)
|
88 |
{
|
89 |
if (is_array($record)) {
|
90 |
$record = $record['message'];
|
140 |
public function __call($method, $args)
|
141 |
{
|
142 |
if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) {
|
143 |
+
$genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3];
|
144 |
$level = constant('Monolog\Logger::' . strtoupper($matches[2]));
|
145 |
if (method_exists($this, $genericMethod)) {
|
146 |
$args[] = $level;
|
vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php
CHANGED
@@ -35,6 +35,8 @@ class WhatFailureGroupHandler extends GroupHandler
|
|
35 |
$handler->handle($record);
|
36 |
} catch (\Exception $e) {
|
37 |
// What failure?
|
|
|
|
|
38 |
}
|
39 |
}
|
40 |
|
@@ -51,6 +53,8 @@ class WhatFailureGroupHandler extends GroupHandler
|
|
51 |
$handler->handleBatch($records);
|
52 |
} catch (\Exception $e) {
|
53 |
// What failure?
|
|
|
|
|
54 |
}
|
55 |
}
|
56 |
}
|
35 |
$handler->handle($record);
|
36 |
} catch (\Exception $e) {
|
37 |
// What failure?
|
38 |
+
} catch (\Throwable $e) {
|
39 |
+
// What failure?
|
40 |
}
|
41 |
}
|
42 |
|
53 |
$handler->handleBatch($records);
|
54 |
} catch (\Exception $e) {
|
55 |
// What failure?
|
56 |
+
} catch (\Throwable $e) {
|
57 |
+
// What failure?
|
58 |
}
|
59 |
}
|
60 |
}
|
vendor/monolog/monolog/src/Monolog/Logger.php
CHANGED
@@ -92,14 +92,14 @@ class Logger implements LoggerInterface
|
|
92 |
* @var array $levels Logging levels
|
93 |
*/
|
94 |
protected static $levels = array(
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
);
|
104 |
|
105 |
/**
|
@@ -128,6 +128,11 @@ class Logger implements LoggerInterface
|
|
128 |
*/
|
129 |
protected $processors;
|
130 |
|
|
|
|
|
|
|
|
|
|
|
131 |
/**
|
132 |
* @param string $name The logging channel
|
133 |
* @param HandlerInterface[] $handlers Optional stack of handlers, the first one in the array is called first, etc.
|
@@ -148,10 +153,23 @@ class Logger implements LoggerInterface
|
|
148 |
return $this->name;
|
149 |
}
|
150 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
/**
|
152 |
* Pushes a handler on to the stack.
|
153 |
*
|
154 |
-
* @param
|
155 |
* @return $this
|
156 |
*/
|
157 |
public function pushHandler(HandlerInterface $handler)
|
@@ -180,7 +198,7 @@ class Logger implements LoggerInterface
|
|
180 |
*
|
181 |
* If a map is passed, keys will be ignored.
|
182 |
*
|
183 |
-
* @param
|
184 |
* @return $this
|
185 |
*/
|
186 |
public function setHandlers(array $handlers)
|
@@ -204,7 +222,7 @@ class Logger implements LoggerInterface
|
|
204 |
/**
|
205 |
* Adds a processor on to the stack.
|
206 |
*
|
207 |
-
* @param
|
208 |
* @return $this
|
209 |
*/
|
210 |
public function pushProcessor($callback)
|
@@ -239,10 +257,28 @@ class Logger implements LoggerInterface
|
|
239 |
return $this->processors;
|
240 |
}
|
241 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
/**
|
243 |
* Adds a log record.
|
244 |
*
|
245 |
-
* @param
|
246 |
* @param string $message The log message
|
247 |
* @param array $context The log context
|
248 |
* @return Boolean Whether the record has been processed
|
@@ -257,11 +293,14 @@ class Logger implements LoggerInterface
|
|
257 |
|
258 |
// check if any handler will handle this message so we can return early and save cycles
|
259 |
$handlerKey = null;
|
260 |
-
|
|
|
261 |
if ($handler->isHandling(array('level' => $level))) {
|
262 |
-
$handlerKey = $
|
263 |
break;
|
264 |
}
|
|
|
|
|
265 |
}
|
266 |
|
267 |
if (null === $handlerKey) {
|
@@ -272,22 +311,34 @@ class Logger implements LoggerInterface
|
|
272 |
static::$timezone = new \DateTimeZone(date_default_timezone_get() ?: 'UTC');
|
273 |
}
|
274 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
275 |
$record = array(
|
276 |
'message' => (string) $message,
|
277 |
'context' => $context,
|
278 |
'level' => $level,
|
279 |
'level_name' => $levelName,
|
280 |
'channel' => $this->name,
|
281 |
-
'datetime' =>
|
282 |
'extra' => array(),
|
283 |
);
|
284 |
|
285 |
foreach ($this->processors as $processor) {
|
286 |
$record = call_user_func($processor, $record);
|
287 |
}
|
288 |
-
|
289 |
-
|
290 |
-
$
|
|
|
|
|
|
|
|
|
291 |
}
|
292 |
|
293 |
return true;
|
@@ -402,7 +453,7 @@ class Logger implements LoggerInterface
|
|
402 |
/**
|
403 |
* Gets the name of the logging level.
|
404 |
*
|
405 |
-
* @param
|
406 |
* @return string
|
407 |
*/
|
408 |
public static function getLevelName($level)
|
@@ -432,7 +483,7 @@ class Logger implements LoggerInterface
|
|
432 |
/**
|
433 |
* Checks whether the Logger has a handler that listens on the given level
|
434 |
*
|
435 |
-
* @param
|
436 |
* @return Boolean
|
437 |
*/
|
438 |
public function isHandling($level)
|
92 |
* @var array $levels Logging levels
|
93 |
*/
|
94 |
protected static $levels = array(
|
95 |
+
self::DEBUG => 'DEBUG',
|
96 |
+
self::INFO => 'INFO',
|
97 |
+
self::NOTICE => 'NOTICE',
|
98 |
+
self::WARNING => 'WARNING',
|
99 |
+
self::ERROR => 'ERROR',
|
100 |
+
self::CRITICAL => 'CRITICAL',
|
101 |
+
self::ALERT => 'ALERT',
|
102 |
+
self::EMERGENCY => 'EMERGENCY',
|
103 |
);
|
104 |
|
105 |
/**
|
128 |
*/
|
129 |
protected $processors;
|
130 |
|
131 |
+
/**
|
132 |
+
* @var bool
|
133 |
+
*/
|
134 |
+
protected $microsecondTimestamps = true;
|
135 |
+
|
136 |
/**
|
137 |
* @param string $name The logging channel
|
138 |
* @param HandlerInterface[] $handlers Optional stack of handlers, the first one in the array is called first, etc.
|
153 |
return $this->name;
|
154 |
}
|
155 |
|
156 |
+
/**
|
157 |
+
* Return a new cloned instance with the name changed
|
158 |
+
*
|
159 |
+
* @return static
|
160 |
+
*/
|
161 |
+
public function withName($name)
|
162 |
+
{
|
163 |
+
$new = clone $this;
|
164 |
+
$new->name = $name;
|
165 |
+
|
166 |
+
return $new;
|
167 |
+
}
|
168 |
+
|
169 |
/**
|
170 |
* Pushes a handler on to the stack.
|
171 |
*
|
172 |
+
* @param HandlerInterface $handler
|
173 |
* @return $this
|
174 |
*/
|
175 |
public function pushHandler(HandlerInterface $handler)
|
198 |
*
|
199 |
* If a map is passed, keys will be ignored.
|
200 |
*
|
201 |
+
* @param HandlerInterface[] $handlers
|
202 |
* @return $this
|
203 |
*/
|
204 |
public function setHandlers(array $handlers)
|
222 |
/**
|
223 |
* Adds a processor on to the stack.
|
224 |
*
|
225 |
+
* @param callable $callback
|
226 |
* @return $this
|
227 |
*/
|
228 |
public function pushProcessor($callback)
|
257 |
return $this->processors;
|
258 |
}
|
259 |
|
260 |
+
/**
|
261 |
+
* Control the use of microsecond resolution timestamps in the 'datetime'
|
262 |
+
* member of new records.
|
263 |
+
*
|
264 |
+
* Generating microsecond resolution timestamps by calling
|
265 |
+
* microtime(true), formatting the result via sprintf() and then parsing
|
266 |
+
* the resulting string via \DateTime::createFromFormat() can incur
|
267 |
+
* a measurable runtime overhead vs simple usage of DateTime to capture
|
268 |
+
* a second resolution timestamp in systems which generate a large number
|
269 |
+
* of log events.
|
270 |
+
*
|
271 |
+
* @param bool $micro True to use microtime() to create timestamps
|
272 |
+
*/
|
273 |
+
public function useMicrosecondTimestamps($micro)
|
274 |
+
{
|
275 |
+
$this->microsecondTimestamps = (bool) $micro;
|
276 |
+
}
|
277 |
+
|
278 |
/**
|
279 |
* Adds a log record.
|
280 |
*
|
281 |
+
* @param int $level The logging level
|
282 |
* @param string $message The log message
|
283 |
* @param array $context The log context
|
284 |
* @return Boolean Whether the record has been processed
|
293 |
|
294 |
// check if any handler will handle this message so we can return early and save cycles
|
295 |
$handlerKey = null;
|
296 |
+
reset($this->handlers);
|
297 |
+
while ($handler = current($this->handlers)) {
|
298 |
if ($handler->isHandling(array('level' => $level))) {
|
299 |
+
$handlerKey = key($this->handlers);
|
300 |
break;
|
301 |
}
|
302 |
+
|
303 |
+
next($this->handlers);
|
304 |
}
|
305 |
|
306 |
if (null === $handlerKey) {
|
311 |
static::$timezone = new \DateTimeZone(date_default_timezone_get() ?: 'UTC');
|
312 |
}
|
313 |
|
314 |
+
// php7.1+ always has microseconds enabled, so we do not need this hack
|
315 |
+
if ($this->microsecondTimestamps && PHP_VERSION_ID < 70100) {
|
316 |
+
$ts = \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)), static::$timezone);
|
317 |
+
} else {
|
318 |
+
$ts = new \DateTime(null, static::$timezone);
|
319 |
+
}
|
320 |
+
$ts->setTimezone(static::$timezone);
|
321 |
+
|
322 |
$record = array(
|
323 |
'message' => (string) $message,
|
324 |
'context' => $context,
|
325 |
'level' => $level,
|
326 |
'level_name' => $levelName,
|
327 |
'channel' => $this->name,
|
328 |
+
'datetime' => $ts,
|
329 |
'extra' => array(),
|
330 |
);
|
331 |
|
332 |
foreach ($this->processors as $processor) {
|
333 |
$record = call_user_func($processor, $record);
|
334 |
}
|
335 |
+
|
336 |
+
while ($handler = current($this->handlers)) {
|
337 |
+
if (true === $handler->handle($record)) {
|
338 |
+
break;
|
339 |
+
}
|
340 |
+
|
341 |
+
next($this->handlers);
|
342 |
}
|
343 |
|
344 |
return true;
|
453 |
/**
|
454 |
* Gets the name of the logging level.
|
455 |
*
|
456 |
+
* @param int $level
|
457 |
* @return string
|
458 |
*/
|
459 |
public static function getLevelName($level)
|
483 |
/**
|
484 |
* Checks whether the Logger has a handler that listens on the given level
|
485 |
*
|
486 |
+
* @param int $level
|
487 |
* @return Boolean
|
488 |
*/
|
489 |
public function isHandling($level)
|
vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php
CHANGED
@@ -30,15 +30,18 @@ class IntrospectionProcessor
|
|
30 |
|
31 |
private $skipClassesPartials;
|
32 |
|
|
|
|
|
33 |
private $skipFunctions = array(
|
34 |
'call_user_func',
|
35 |
'call_user_func_array',
|
36 |
);
|
37 |
|
38 |
-
public function __construct($level = Logger::DEBUG, array $skipClassesPartials = array())
|
39 |
{
|
40 |
$this->level = Logger::toMonologLevel($level);
|
41 |
$this->skipClassesPartials = array_merge(array('Monolog\\'), $skipClassesPartials);
|
|
|
42 |
}
|
43 |
|
44 |
/**
|
@@ -52,7 +55,12 @@ class IntrospectionProcessor
|
|
52 |
return $record;
|
53 |
}
|
54 |
|
55 |
-
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
// skip first since it's always the current method
|
58 |
array_shift($trace);
|
@@ -61,7 +69,7 @@ class IntrospectionProcessor
|
|
61 |
|
62 |
$i = 0;
|
63 |
|
64 |
-
while (
|
65 |
if (isset($trace[$i]['class'])) {
|
66 |
foreach ($this->skipClassesPartials as $part) {
|
67 |
if (strpos($trace[$i]['class'], $part) !== false) {
|
@@ -77,6 +85,8 @@ class IntrospectionProcessor
|
|
77 |
break;
|
78 |
}
|
79 |
|
|
|
|
|
80 |
// we should have the call source now
|
81 |
$record['extra'] = array_merge(
|
82 |
$record['extra'],
|
@@ -90,4 +100,13 @@ class IntrospectionProcessor
|
|
90 |
|
91 |
return $record;
|
92 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
}
|
30 |
|
31 |
private $skipClassesPartials;
|
32 |
|
33 |
+
private $skipStackFramesCount;
|
34 |
+
|
35 |
private $skipFunctions = array(
|
36 |
'call_user_func',
|
37 |
'call_user_func_array',
|
38 |
);
|
39 |
|
40 |
+
public function __construct($level = Logger::DEBUG, array $skipClassesPartials = array(), $skipStackFramesCount = 0)
|
41 |
{
|
42 |
$this->level = Logger::toMonologLevel($level);
|
43 |
$this->skipClassesPartials = array_merge(array('Monolog\\'), $skipClassesPartials);
|
44 |
+
$this->skipStackFramesCount = $skipStackFramesCount;
|
45 |
}
|
46 |
|
47 |
/**
|
55 |
return $record;
|
56 |
}
|
57 |
|
58 |
+
/*
|
59 |
+
* http://php.net/manual/en/function.debug-backtrace.php
|
60 |
+
* As of 5.3.6, DEBUG_BACKTRACE_IGNORE_ARGS option was added.
|
61 |
+
* Any version less than 5.3.6 must use the DEBUG_BACKTRACE_IGNORE_ARGS constant value '2'.
|
62 |
+
*/
|
63 |
+
$trace = debug_backtrace((PHP_VERSION_ID < 50306) ? 2 : DEBUG_BACKTRACE_IGNORE_ARGS);
|
64 |
|
65 |
// skip first since it's always the current method
|
66 |
array_shift($trace);
|
69 |
|
70 |
$i = 0;
|
71 |
|
72 |
+
while ($this->isTraceClassOrSkippedFunction($trace, $i)) {
|
73 |
if (isset($trace[$i]['class'])) {
|
74 |
foreach ($this->skipClassesPartials as $part) {
|
75 |
if (strpos($trace[$i]['class'], $part) !== false) {
|
85 |
break;
|
86 |
}
|
87 |
|
88 |
+
$i += $this->skipStackFramesCount;
|
89 |
+
|
90 |
// we should have the call source now
|
91 |
$record['extra'] = array_merge(
|
92 |
$record['extra'],
|
100 |
|
101 |
return $record;
|
102 |
}
|
103 |
+
|
104 |
+
private function isTraceClassOrSkippedFunction(array $trace, $index)
|
105 |
+
{
|
106 |
+
if (!isset($trace[$index])) {
|
107 |
+
return false;
|
108 |
+
}
|
109 |
+
|
110 |
+
return isset($trace[$index]['class']) || in_array($trace[$index]['function'], $this->skipFunctions);
|
111 |
+
}
|
112 |
}
|
vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php
CHANGED
@@ -19,18 +19,18 @@ namespace Monolog\Processor;
|
|
19 |
abstract class MemoryProcessor
|
20 |
{
|
21 |
/**
|
22 |
-
* @var
|
23 |
*/
|
24 |
protected $realUsage;
|
25 |
|
26 |
/**
|
27 |
-
* @var
|
28 |
*/
|
29 |
protected $useFormatting;
|
30 |
|
31 |
/**
|
32 |
-
* @param
|
33 |
-
* @param
|
34 |
*/
|
35 |
public function __construct($realUsage = true, $useFormatting = true)
|
36 |
{
|
19 |
abstract class MemoryProcessor
|
20 |
{
|
21 |
/**
|
22 |
+
* @var bool If true, get the real size of memory allocated from system. Else, only the memory used by emalloc() is reported.
|
23 |
*/
|
24 |
protected $realUsage;
|
25 |
|
26 |
/**
|
27 |
+
* @var bool If true, then format memory size to human readable string (MB, KB, B depending on size)
|
28 |
*/
|
29 |
protected $useFormatting;
|
30 |
|
31 |
/**
|
32 |
+
* @param bool $realUsage Set this to true to get the real size of memory allocated from system.
|
33 |
+
* @param bool $useFormatting If true, then format memory size to human readable string (MB, KB, B depending on size)
|
34 |
*/
|
35 |
public function __construct($realUsage = true, $useFormatting = true)
|
36 |
{
|
vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Monolog package.
|
5 |
+
*
|
6 |
+
* (c) Jonathan A. Schweder <jonathanschweder@gmail.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Monolog\Processor;
|
13 |
+
|
14 |
+
use Monolog\Logger;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Injects Hg branch and Hg revision number in all records
|
18 |
+
*
|
19 |
+
* @author Jonathan A. Schweder <jonathanschweder@gmail.com>
|
20 |
+
*/
|
21 |
+
class MercurialProcessor
|
22 |
+
{
|
23 |
+
private $level;
|
24 |
+
private static $cache;
|
25 |
+
|
26 |
+
public function __construct($level = Logger::DEBUG)
|
27 |
+
{
|
28 |
+
$this->level = Logger::toMonologLevel($level);
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @param array $record
|
33 |
+
* @return array
|
34 |
+
*/
|
35 |
+
public function __invoke(array $record)
|
36 |
+
{
|
37 |
+
// return if the level is not high enough
|
38 |
+
if ($record['level'] < $this->level) {
|
39 |
+
return $record;
|
40 |
+
}
|
41 |
+
|
42 |
+
$record['extra']['hg'] = self::getMercurialInfo();
|
43 |
+
|
44 |
+
return $record;
|
45 |
+
}
|
46 |
+
|
47 |
+
private static function getMercurialInfo()
|
48 |
+
{
|
49 |
+
if (self::$cache) {
|
50 |
+
return self::$cache;
|
51 |
+
}
|
52 |
+
|
53 |
+
$result = explode(' ', trim(`hg id -nb`));
|
54 |
+
if (count($result) >= 3) {
|
55 |
+
return self::$cache = array(
|
56 |
+
'branch' => $result[1],
|
57 |
+
'revision' => $result[2],
|
58 |
+
);
|
59 |
+
}
|
60 |
+
|
61 |
+
return self::$cache = array();
|
62 |
+
}
|
63 |
+
}
|
vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php
CHANGED
@@ -35,4 +35,12 @@ class UidProcessor
|
|
35 |
|
36 |
return $record;
|
37 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
}
|
35 |
|
36 |
return $record;
|
37 |
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* @return string
|
41 |
+
*/
|
42 |
+
public function getUid()
|
43 |
+
{
|
44 |
+
return $this->uid;
|
45 |
+
}
|
46 |
}
|
vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php
CHANGED
@@ -24,6 +24,10 @@ class WebProcessor
|
|
24 |
protected $serverData;
|
25 |
|
26 |
/**
|
|
|
|
|
|
|
|
|
27 |
* @var array
|
28 |
*/
|
29 |
protected $extraFields = array(
|
@@ -36,7 +40,7 @@ class WebProcessor
|
|
36 |
|
37 |
/**
|
38 |
* @param array|\ArrayAccess $serverData Array or object w/ ArrayAccess that provides access to the $_SERVER data
|
39 |
-
* @param array|null $extraFields
|
40 |
*/
|
41 |
public function __construct($serverData = null, array $extraFields = null)
|
42 |
{
|
@@ -49,10 +53,14 @@ class WebProcessor
|
|
49 |
}
|
50 |
|
51 |
if (null !== $extraFields) {
|
52 |
-
|
53 |
-
|
54 |
-
|
|
|
|
|
55 |
}
|
|
|
|
|
56 |
}
|
57 |
}
|
58 |
}
|
24 |
protected $serverData;
|
25 |
|
26 |
/**
|
27 |
+
* Default fields
|
28 |
+
*
|
29 |
+
* Array is structured as [key in record.extra => key in $serverData]
|
30 |
+
*
|
31 |
* @var array
|
32 |
*/
|
33 |
protected $extraFields = array(
|
40 |
|
41 |
/**
|
42 |
* @param array|\ArrayAccess $serverData Array or object w/ ArrayAccess that provides access to the $_SERVER data
|
43 |
+
* @param array|null $extraFields Field names and the related key inside $serverData to be added. If not provided it defaults to: url, ip, http_method, server, referrer
|
44 |
*/
|
45 |
public function __construct($serverData = null, array $extraFields = null)
|
46 |
{
|
53 |
}
|
54 |
|
55 |
if (null !== $extraFields) {
|
56 |
+
if (isset($extraFields[0])) {
|
57 |
+
foreach (array_keys($this->extraFields) as $fieldName) {
|
58 |
+
if (!in_array($fieldName, $extraFields)) {
|
59 |
+
unset($this->extraFields[$fieldName]);
|
60 |
+
}
|
61 |
}
|
62 |
+
} else {
|
63 |
+
$this->extraFields = $extraFields;
|
64 |
}
|
65 |
}
|
66 |
}
|
vendor/monolog/monolog/src/Monolog/Registry.php
CHANGED
@@ -49,7 +49,7 @@ class Registry
|
|
49 |
*
|
50 |
* @param Logger $logger Instance of the logging channel
|
51 |
* @param string|null $name Name of the logging channel ($logger->getName() by default)
|
52 |
-
* @param
|
53 |
* @throws \InvalidArgumentException If $overwrite set to false and named Logger instance already exists
|
54 |
*/
|
55 |
public static function addLogger(Logger $logger, $name = null, $overwrite = false)
|
@@ -107,8 +107,8 @@ class Registry
|
|
107 |
* Gets Logger instance from the registry
|
108 |
*
|
109 |
* @param string $name Name of the requested Logger instance
|
110 |
-
* @return Logger Requested instance of Logger
|
111 |
* @throws \InvalidArgumentException If named Logger instance is not in the registry
|
|
|
112 |
*/
|
113 |
public static function getInstance($name)
|
114 |
{
|
@@ -124,8 +124,8 @@ class Registry
|
|
124 |
*
|
125 |
* @param string $name Name of the requested Logger instance
|
126 |
* @param array $arguments Arguments passed to static method call
|
127 |
-
* @return Logger Requested instance of Logger
|
128 |
* @throws \InvalidArgumentException If named Logger instance is not in the registry
|
|
|
129 |
*/
|
130 |
public static function __callStatic($name, $arguments)
|
131 |
{
|
49 |
*
|
50 |
* @param Logger $logger Instance of the logging channel
|
51 |
* @param string|null $name Name of the logging channel ($logger->getName() by default)
|
52 |
+
* @param bool $overwrite Overwrite instance in the registry if the given name already exists?
|
53 |
* @throws \InvalidArgumentException If $overwrite set to false and named Logger instance already exists
|
54 |
*/
|
55 |
public static function addLogger(Logger $logger, $name = null, $overwrite = false)
|
107 |
* Gets Logger instance from the registry
|
108 |
*
|
109 |
* @param string $name Name of the requested Logger instance
|
|
|
110 |
* @throws \InvalidArgumentException If named Logger instance is not in the registry
|
111 |
+
* @return Logger Requested instance of Logger
|
112 |
*/
|
113 |
public static function getInstance($name)
|
114 |
{
|
124 |
*
|
125 |
* @param string $name Name of the requested Logger instance
|
126 |
* @param array $arguments Arguments passed to static method call
|
|
|
127 |
* @throws \InvalidArgumentException If named Logger instance is not in the registry
|
128 |
+
* @return Logger Requested instance of Logger
|
129 |
*/
|
130 |
public static function __callStatic($name, $arguments)
|
131 |
{
|
vendor/monolog/monolog/tests/Monolog/Formatter/ChromePHPFormatterTest.php
CHANGED
@@ -42,7 +42,7 @@ class ChromePHPFormatterTest extends \PHPUnit_Framework_TestCase
|
|
42 |
'extra' => array('ip' => '127.0.0.1'),
|
43 |
),
|
44 |
'unknown',
|
45 |
-
'error'
|
46 |
),
|
47 |
$message
|
48 |
);
|
@@ -75,7 +75,7 @@ class ChromePHPFormatterTest extends \PHPUnit_Framework_TestCase
|
|
75 |
'extra' => array('ip' => '127.0.0.1'),
|
76 |
),
|
77 |
'test : 14',
|
78 |
-
'error'
|
79 |
),
|
80 |
$message
|
81 |
);
|
@@ -104,7 +104,7 @@ class ChromePHPFormatterTest extends \PHPUnit_Framework_TestCase
|
|
104 |
'meh',
|
105 |
'log',
|
106 |
'unknown',
|
107 |
-
'log'
|
108 |
),
|
109 |
$message
|
110 |
);
|
@@ -143,13 +143,13 @@ class ChromePHPFormatterTest extends \PHPUnit_Framework_TestCase
|
|
143 |
'meh',
|
144 |
'log',
|
145 |
'unknown',
|
146 |
-
'info'
|
147 |
),
|
148 |
array(
|
149 |
'foo',
|
150 |
'log2',
|
151 |
'unknown',
|
152 |
-
'warn'
|
153 |
),
|
154 |
),
|
155 |
$formatter->formatBatch($records)
|
42 |
'extra' => array('ip' => '127.0.0.1'),
|
43 |
),
|
44 |
'unknown',
|
45 |
+
'error',
|
46 |
),
|
47 |
$message
|
48 |
);
|
75 |
'extra' => array('ip' => '127.0.0.1'),
|
76 |
),
|
77 |
'test : 14',
|
78 |
+
'error',
|
79 |
),
|
80 |
$message
|
81 |
);
|
104 |
'meh',
|
105 |
'log',
|
106 |
'unknown',
|
107 |
+
'log',
|
108 |
),
|
109 |
$message
|
110 |
);
|
143 |
'meh',
|
144 |
'log',
|
145 |
'unknown',
|
146 |
+
'info',
|
147 |
),
|
148 |
array(
|
149 |
'foo',
|
150 |
'log2',
|
151 |
'unknown',
|
152 |
+
'warn',
|
153 |
),
|
154 |
),
|
155 |
$formatter->formatBatch($records)
|
vendor/monolog/monolog/tests/Monolog/Formatter/ElasticaFormatterTest.php
CHANGED
@@ -42,7 +42,7 @@ class ElasticaFormatterTest extends \PHPUnit_Framework_TestCase
|
|
42 |
|
43 |
// expected values
|
44 |
$expected = $msg;
|
45 |
-
$expected['datetime'] = '1970-01-01T00:00:00+
|
46 |
$expected['context'] = array(
|
47 |
'class' => '[object] (stdClass: {})',
|
48 |
'foo' => 7,
|
42 |
|
43 |
// expected values
|
44 |
$expected = $msg;
|
45 |
+
$expected['datetime'] = '1970-01-01T00:00:00.000000+00:00';
|
46 |
$expected['context'] = array(
|
47 |
'class' => '[object] (stdClass: {})',
|
48 |
'foo' => 7,
|
vendor/monolog/monolog/tests/Monolog/Formatter/FluentdFormatterTest.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Monolog package.
|
5 |
+
*
|
6 |
+
* (c) Jordi Boggiano <j.boggiano@seld.be>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Monolog\Formatter;
|
13 |
+
|
14 |
+
use Monolog\Logger;
|
15 |
+
use Monolog\TestCase;
|
16 |
+
|
17 |
+
class FluentdFormatterTest extends TestCase
|
18 |
+
{
|
19 |
+
/**
|
20 |
+
* @covers Monolog\Formatter\FluentdFormatter::__construct
|
21 |
+
* @covers Monolog\Formatter\FluentdFormatter::isUsingLevelsInTag
|
22 |
+
*/
|
23 |
+
public function testConstruct()
|
24 |
+
{
|
25 |
+
$formatter = new FluentdFormatter();
|
26 |
+
$this->assertEquals(false, $formatter->isUsingLevelsInTag());
|
27 |
+
$formatter = new FluentdFormatter(false);
|
28 |
+
$this->assertEquals(false, $formatter->isUsingLevelsInTag());
|
29 |
+
$formatter = new FluentdFormatter(true);
|
30 |
+
$this->assertEquals(true, $formatter->isUsingLevelsInTag());
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @covers Monolog\Formatter\FluentdFormatter::format
|
35 |
+
*/
|
36 |
+
public function testFormat()
|
37 |
+
{
|
38 |
+
$record = $this->getRecord(Logger::WARNING);
|
39 |
+
$record['datetime'] = new \DateTime("@0");
|
40 |
+
|
41 |
+
$formatter = new FluentdFormatter();
|
42 |
+
$this->assertEquals(
|
43 |
+
'["test",0,{"message":"test","extra":[],"level":300,"level_name":"WARNING"}]',
|
44 |
+
$formatter->format($record)
|
45 |
+
);
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* @covers Monolog\Formatter\FluentdFormatter::format
|
50 |
+
*/
|
51 |
+
public function testFormatWithTag()
|
52 |
+
{
|
53 |
+
$record = $this->getRecord(Logger::ERROR);
|
54 |
+
$record['datetime'] = new \DateTime("@0");
|
55 |
+
|
56 |
+
$formatter = new FluentdFormatter(true);
|
57 |
+
$this->assertEquals(
|
58 |
+
'["test.error",0,{"message":"test","extra":[]}]',
|
59 |
+
$formatter->format($record)
|
60 |
+
);
|
61 |
+
}
|
62 |
+
}
|
vendor/monolog/monolog/tests/Monolog/Formatter/GelfMessageFormatterTest.php
CHANGED
@@ -108,7 +108,7 @@ class GelfMessageFormatterTest extends \PHPUnit_Framework_TestCase
|
|
108 |
'context' => array('from' => 'logger'),
|
109 |
'datetime' => new \DateTime("@0"),
|
110 |
'extra' => array('key' => 'pair'),
|
111 |
-
'message' => 'log'
|
112 |
);
|
113 |
|
114 |
$message = $formatter->format($record);
|
@@ -145,11 +145,11 @@ class GelfMessageFormatterTest extends \PHPUnit_Framework_TestCase
|
|
145 |
'context' => array('from' => 'logger', 'exception' => array(
|
146 |
'class' => '\Exception',
|
147 |
'file' => '/some/file/in/dir.php:56',
|
148 |
-
'trace' => array('/some/file/1.php:23', '/some/file/2.php:3')
|
149 |
)),
|
150 |
'datetime' => new \DateTime("@0"),
|
151 |
'extra' => array(),
|
152 |
-
'message' => 'log'
|
153 |
);
|
154 |
|
155 |
$message = $formatter->format($record);
|
@@ -173,7 +173,7 @@ class GelfMessageFormatterTest extends \PHPUnit_Framework_TestCase
|
|
173 |
'context' => array('from' => 'logger'),
|
174 |
'datetime' => new \DateTime("@0"),
|
175 |
'extra' => array('key' => 'pair'),
|
176 |
-
'message' => 'log'
|
177 |
);
|
178 |
|
179 |
$message = $formatter->format($record);
|
@@ -197,6 +197,60 @@ class GelfMessageFormatterTest extends \PHPUnit_Framework_TestCase
|
|
197 |
$this->assertEquals('pair', $message_array['_EXTkey']);
|
198 |
}
|
199 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
private function isLegacy()
|
201 |
{
|
202 |
return interface_exists('\Gelf\IMessagePublisher');
|
108 |
'context' => array('from' => 'logger'),
|
109 |
'datetime' => new \DateTime("@0"),
|
110 |
'extra' => array('key' => 'pair'),
|
111 |
+
'message' => 'log',
|
112 |
);
|
113 |
|
114 |
$message = $formatter->format($record);
|
145 |
'context' => array('from' => 'logger', 'exception' => array(
|
146 |
'class' => '\Exception',
|
147 |
'file' => '/some/file/in/dir.php:56',
|
148 |
+
'trace' => array('/some/file/1.php:23', '/some/file/2.php:3'),
|
149 |
)),
|
150 |
'datetime' => new \DateTime("@0"),
|
151 |
'extra' => array(),
|
152 |
+
'message' => 'log',
|
153 |
);
|
154 |
|
155 |
$message = $formatter->format($record);
|
173 |
'context' => array('from' => 'logger'),
|
174 |
'datetime' => new \DateTime("@0"),
|
175 |
'extra' => array('key' => 'pair'),
|
176 |
+
'message' => 'log',
|
177 |
);
|
178 |
|
179 |
$message = $formatter->format($record);
|
197 |
$this->assertEquals('pair', $message_array['_EXTkey']);
|
198 |
}
|
199 |
|
200 |
+
public function testFormatWithLargeData()
|
201 |
+
{
|
202 |
+
$formatter = new GelfMessageFormatter();
|
203 |
+
$record = array(
|
204 |
+
'level' => Logger::ERROR,
|
205 |
+
'level_name' => 'ERROR',
|
206 |
+
'channel' => 'meh',
|
207 |
+
'context' => array('exception' => str_repeat(' ', 32767)),
|
208 |
+
'datetime' => new \DateTime("@0"),
|
209 |
+
'extra' => array('key' => str_repeat(' ', 32767)),
|
210 |
+
'message' => 'log'
|
211 |
+
);
|
212 |
+
$message = $formatter->format($record);
|
213 |
+
$messageArray = $message->toArray();
|
214 |
+
|
215 |
+
// 200 for padding + metadata
|
216 |
+
$length = 200;
|
217 |
+
|
218 |
+
foreach ($messageArray as $key => $value) {
|
219 |
+
if (!in_array($key, array('level', 'timestamp'))) {
|
220 |
+
$length += strlen($value);
|
221 |
+
}
|
222 |
+
}
|
223 |
+
|
224 |
+
$this->assertLessThanOrEqual(65792, $length, 'The message length is no longer than the maximum allowed length');
|
225 |
+
}
|
226 |
+
|
227 |
+
public function testFormatWithUnlimitedLength()
|
228 |
+
{
|
229 |
+
$formatter = new GelfMessageFormatter('LONG_SYSTEM_NAME', null, 'ctxt_', PHP_INT_MAX);
|
230 |
+
$record = array(
|
231 |
+
'level' => Logger::ERROR,
|
232 |
+
'level_name' => 'ERROR',
|
233 |
+
'channel' => 'meh',
|
234 |
+
'context' => array('exception' => str_repeat(' ', 32767 * 2)),
|
235 |
+
'datetime' => new \DateTime("@0"),
|
236 |
+
'extra' => array('key' => str_repeat(' ', 32767 * 2)),
|
237 |
+
'message' => 'log'
|
238 |
+
);
|
239 |
+
$message = $formatter->format($record);
|
240 |
+
$messageArray = $message->toArray();
|
241 |
+
|
242 |
+
// 200 for padding + metadata
|
243 |
+
$length = 200;
|
244 |
+
|
245 |
+
foreach ($messageArray as $key => $value) {
|
246 |
+
if (!in_array($key, array('level', 'timestamp'))) {
|
247 |
+
$length += strlen($value);
|
248 |
+
}
|
249 |
+
}
|
250 |
+
|
251 |
+
$this->assertGreaterThanOrEqual(131289, $length, 'The message should not be truncated');
|
252 |
+
}
|
253 |
+
|
254 |
private function isLegacy()
|
255 |
{
|
256 |
return interface_exists('\Gelf\IMessagePublisher');
|
vendor/monolog/monolog/tests/Monolog/Formatter/JsonFormatterTest.php
CHANGED
@@ -75,4 +75,109 @@ class JsonFormatterTest extends TestCase
|
|
75 |
});
|
76 |
$this->assertEquals(implode("\n", $expected), $formatter->formatBatch($records));
|
77 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
}
|
75 |
});
|
76 |
$this->assertEquals(implode("\n", $expected), $formatter->formatBatch($records));
|
77 |
}
|
78 |
+
|
79 |
+
public function testDefFormatWithException()
|
80 |
+
{
|
81 |
+
$formatter = new JsonFormatter();
|
82 |
+
$exception = new \RuntimeException('Foo');
|
83 |
+
$formattedException = $this->formatException($exception);
|
84 |
+
|
85 |
+
$message = $this->formatRecordWithExceptionInContext($formatter, $exception);
|
86 |
+
|
87 |
+
$this->assertContextContainsFormattedException($formattedException, $message);
|
88 |
+
}
|
89 |
+
|
90 |
+
public function testDefFormatWithPreviousException()
|
91 |
+
{
|
92 |
+
$formatter = new JsonFormatter();
|
93 |
+
$exception = new \RuntimeException('Foo', 0, new \LogicException('Wut?'));
|
94 |
+
$formattedPrevException = $this->formatException($exception->getPrevious());
|
95 |
+
$formattedException = $this->formatException($exception, $formattedPrevException);
|
96 |
+
|
97 |
+
$message = $this->formatRecordWithExceptionInContext($formatter, $exception);
|
98 |
+
|
99 |
+
$this->assertContextContainsFormattedException($formattedException, $message);
|
100 |
+
}
|
101 |
+
|
102 |
+
public function testDefFormatWithThrowable()
|
103 |
+
{
|
104 |
+
if (!class_exists('Error') || !is_subclass_of('Error', 'Throwable')) {
|
105 |
+
$this->markTestSkipped('Requires PHP >=7');
|
106 |
+
}
|
107 |
+
|
108 |
+
$formatter = new JsonFormatter();
|
109 |
+
$throwable = new \Error('Foo');
|
110 |
+
$formattedThrowable = $this->formatException($throwable);
|
111 |
+
|
112 |
+
$message = $this->formatRecordWithExceptionInContext($formatter, $throwable);
|
113 |
+
|
114 |
+
$this->assertContextContainsFormattedException($formattedThrowable, $message);
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* @param string $expected
|
119 |
+
* @param string $actual
|
120 |
+
*
|
121 |
+
* @internal param string $exception
|
122 |
+
*/
|
123 |
+
private function assertContextContainsFormattedException($expected, $actual)
|
124 |
+
{
|
125 |
+
$this->assertEquals(
|
126 |
+
'{"level_name":"CRITICAL","channel":"core","context":{"exception":'.$expected.'},"datetime":null,"extra":[],"message":"foobar"}'."\n",
|
127 |
+
$actual
|
128 |
+
);
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* @param JsonFormatter $formatter
|
133 |
+
* @param \Exception|\Throwable $exception
|
134 |
+
*
|
135 |
+
* @return string
|
136 |
+
*/
|
137 |
+
private function formatRecordWithExceptionInContext(JsonFormatter $formatter, $exception)
|
138 |
+
{
|
139 |
+
$message = $formatter->format(array(
|
140 |
+
'level_name' => 'CRITICAL',
|
141 |
+
'channel' => 'core',
|
142 |
+
'context' => array('exception' => $exception),
|
143 |
+
'datetime' => null,
|
144 |
+
'extra' => array(),
|
145 |
+
'message' => 'foobar',
|
146 |
+
));
|
147 |
+
return $message;
|
148 |
+
}
|
149 |
+
|
150 |
+
/**
|
151 |
+
* @param \Exception|\Throwable $exception
|
152 |
+
*
|
153 |
+
* @return string
|
154 |
+
*/
|
155 |
+
private function formatExceptionFilePathWithLine($exception)
|
156 |
+
{
|
157 |
+
$options = 0;
|
158 |
+
if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
|
159 |
+
$options = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
|
160 |
+
}
|
161 |
+
$path = substr(json_encode($exception->getFile(), $options), 1, -1);
|
162 |
+
return $path . ':' . $exception->getLine();
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* @param \Exception|\Throwable $exception
|
167 |
+
*
|
168 |
+
* @param null|string $previous
|
169 |
+
*
|
170 |
+
* @return string
|
171 |
+
*/
|
172 |
+
private function formatException($exception, $previous = null)
|
173 |
+
{
|
174 |
+
$formattedException =
|
175 |
+
'{"class":"' . get_class($exception) .
|
176 |
+
'","message":"' . $exception->getMessage() .
|
177 |
+
'","code":' . $exception->getCode() .
|
178 |
+
',"file":"' . $this->formatExceptionFilePathWithLine($exception) .
|
179 |
+
($previous ? '","previous":' . $previous : '"') .
|
180 |
+
'}';
|
181 |
+
return $formattedException;
|
182 |
+
}
|
183 |
}
|
vendor/monolog/monolog/tests/Monolog/Formatter/LineFormatterTest.php
CHANGED
@@ -44,7 +44,7 @@ class LineFormatterTest extends \PHPUnit_Framework_TestCase
|
|
44 |
'baz' => 'qux',
|
45 |
'bool' => false,
|
46 |
'null' => null,
|
47 |
-
)
|
48 |
));
|
49 |
$this->assertEquals('['.date('Y-m-d').'] meh.ERROR: foo {"foo":"bar","baz":"qux","bool":false,"null":null} []'."\n", $message);
|
50 |
}
|
@@ -91,6 +91,20 @@ class LineFormatterTest extends \PHPUnit_Framework_TestCase
|
|
91 |
$this->assertEquals('['.date('Y-m-d').'] meh.ERROR: log '."\n", $message);
|
92 |
}
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
public function testDefFormatWithObject()
|
95 |
{
|
96 |
$formatter = new LineFormatter(null, 'Y-m-d');
|
@@ -103,7 +117,7 @@ class LineFormatterTest extends \PHPUnit_Framework_TestCase
|
|
103 |
'message' => 'foobar',
|
104 |
));
|
105 |
|
106 |
-
$this->assertEquals('['.date('Y-m-d').'] meh.ERROR: foobar [] {"foo":"[object] (Monolog\\\\Formatter\\\\TestFoo: {\\"foo\\":\\"foo\\"})","bar":"[object] (Monolog\\\\Formatter\\\\TestBar: bar)","baz":[],"res":"[resource]"}'."\n", $message);
|
107 |
}
|
108 |
|
109 |
public function testDefFormatWithException()
|
44 |
'baz' => 'qux',
|
45 |
'bool' => false,
|
46 |
'null' => null,
|
47 |
+
),
|
48 |
));
|
49 |
$this->assertEquals('['.date('Y-m-d').'] meh.ERROR: foo {"foo":"bar","baz":"qux","bool":false,"null":null} []'."\n", $message);
|
50 |
}
|
91 |
$this->assertEquals('['.date('Y-m-d').'] meh.ERROR: log '."\n", $message);
|
92 |
}
|
93 |
|
94 |
+
public function testContextAndExtraReplacement()
|
95 |
+
{
|
96 |
+
$formatter = new LineFormatter('%context.foo% => %extra.foo%');
|
97 |
+
$message = $formatter->format(array(
|
98 |
+
'level_name' => 'ERROR',
|
99 |
+
'channel' => 'meh',
|
100 |
+
'context' => array('foo' => 'bar'),
|
101 |
+
'datetime' => new \DateTime,
|
102 |
+
'extra' => array('foo' => 'xbar'),
|
103 |
+
'message' => 'log',
|
104 |
+
));
|
105 |
+
$this->assertEquals('bar => xbar', $message);
|
106 |
+
}
|
107 |
+
|
108 |
public function testDefFormatWithObject()
|
109 |
{
|
110 |
$formatter = new LineFormatter(null, 'Y-m-d');
|
117 |
'message' => 'foobar',
|
118 |
));
|
119 |
|
120 |
+
$this->assertEquals('['.date('Y-m-d').'] meh.ERROR: foobar [] {"foo":"[object] (Monolog\\\\Formatter\\\\TestFoo: {\\"foo\\":\\"foo\\"})","bar":"[object] (Monolog\\\\Formatter\\\\TestBar: bar)","baz":[],"res":"[resource] (stream)"}'."\n", $message);
|
121 |
}
|
122 |
|
123 |
public function testDefFormatWithException()
|
vendor/monolog/monolog/tests/Monolog/Formatter/LogstashFormatterTest.php
CHANGED
@@ -15,6 +15,13 @@ use Monolog\Logger;
|
|
15 |
|
16 |
class LogstashFormatterTest extends \PHPUnit_Framework_TestCase
|
17 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
/**
|
19 |
* @covers Monolog\Formatter\LogstashFormatter::format
|
20 |
*/
|
@@ -83,7 +90,7 @@ class LogstashFormatterTest extends \PHPUnit_Framework_TestCase
|
|
83 |
'context' => array('from' => 'logger'),
|
84 |
'datetime' => new \DateTime("@0"),
|
85 |
'extra' => array('key' => 'pair'),
|
86 |
-
'message' => 'log'
|
87 |
);
|
88 |
|
89 |
$message = json_decode($formatter->format($record), true);
|
@@ -116,7 +123,7 @@ class LogstashFormatterTest extends \PHPUnit_Framework_TestCase
|
|
116 |
'context' => array('from' => 'logger'),
|
117 |
'datetime' => new \DateTime("@0"),
|
118 |
'extra' => array('key' => 'pair'),
|
119 |
-
'message' => 'log'
|
120 |
);
|
121 |
|
122 |
$message = json_decode($formatter->format($record), true);
|
@@ -146,7 +153,7 @@ class LogstashFormatterTest extends \PHPUnit_Framework_TestCase
|
|
146 |
'context' => array('from' => 'logger'),
|
147 |
'datetime' => new \DateTime("@0"),
|
148 |
'extra' => array('key' => 'pair'),
|
149 |
-
'message' => 'log'
|
150 |
);
|
151 |
|
152 |
$message = json_decode($formatter->format($record), true);
|
@@ -223,7 +230,7 @@ class LogstashFormatterTest extends \PHPUnit_Framework_TestCase
|
|
223 |
'context' => array('from' => 'logger'),
|
224 |
'datetime' => new \DateTime("@0"),
|
225 |
'extra' => array('key' => 'pair'),
|
226 |
-
'message' => 'log'
|
227 |
);
|
228 |
|
229 |
$message = json_decode($formatter->format($record), true);
|
@@ -252,7 +259,7 @@ class LogstashFormatterTest extends \PHPUnit_Framework_TestCase
|
|
252 |
'context' => array('from' => 'logger'),
|
253 |
'datetime' => new \DateTime("@0"),
|
254 |
'extra' => array('key' => 'pair'),
|
255 |
-
'message' => 'log'
|
256 |
);
|
257 |
|
258 |
$message = json_decode($formatter->format($record), true);
|
@@ -278,7 +285,7 @@ class LogstashFormatterTest extends \PHPUnit_Framework_TestCase
|
|
278 |
'context' => array('from' => 'logger'),
|
279 |
'datetime' => new \DateTime("@0"),
|
280 |
'extra' => array('key' => 'pair'),
|
281 |
-
'message' => 'log'
|
282 |
);
|
283 |
|
284 |
$message = json_decode($formatter->format($record), true);
|
@@ -286,4 +293,41 @@ class LogstashFormatterTest extends \PHPUnit_Framework_TestCase
|
|
286 |
$this->assertArrayHasKey('type', $message);
|
287 |
$this->assertEquals('app', $message['type']);
|
288 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
289 |
}
|
15 |
|
16 |
class LogstashFormatterTest extends \PHPUnit_Framework_TestCase
|
17 |
{
|
18 |
+
public function tearDown()
|
19 |
+
{
|
20 |
+
\PHPUnit_Framework_Error_Warning::$enabled = true;
|
21 |
+
|
22 |
+
return parent::tearDown();
|
23 |
+
}
|
24 |
+
|
25 |
/**
|
26 |
* @covers Monolog\Formatter\LogstashFormatter::format
|
27 |
*/
|
90 |
'context' => array('from' => 'logger'),
|
91 |
'datetime' => new \DateTime("@0"),
|
92 |
'extra' => array('key' => 'pair'),
|
93 |
+
'message' => 'log',
|
94 |
);
|
95 |
|
96 |
$message = json_decode($formatter->format($record), true);
|
123 |
'context' => array('from' => 'logger'),
|
124 |
'datetime' => new \DateTime("@0"),
|
125 |
'extra' => array('key' => 'pair'),
|
126 |
+
'message' => 'log',
|
127 |
);
|
128 |
|
129 |
$message = json_decode($formatter->format($record), true);
|
153 |
'context' => array('from' => 'logger'),
|
154 |
'datetime' => new \DateTime("@0"),
|
155 |
'extra' => array('key' => 'pair'),
|
156 |
+
'message' => 'log',
|
157 |
);
|
158 |
|
159 |
$message = json_decode($formatter->format($record), true);
|
230 |
'context' => array('from' => 'logger'),
|
231 |
'datetime' => new \DateTime("@0"),
|
232 |
'extra' => array('key' => 'pair'),
|
233 |
+
'message' => 'log',
|
234 |
);
|
235 |
|
236 |
$message = json_decode($formatter->format($record), true);
|
259 |
'context' => array('from' => 'logger'),
|
260 |
'datetime' => new \DateTime("@0"),
|
261 |
'extra' => array('key' => 'pair'),
|
262 |
+
'message' => 'log',
|
263 |
);
|
264 |
|
265 |
$message = json_decode($formatter->format($record), true);
|
285 |
'context' => array('from' => 'logger'),
|
286 |
'datetime' => new \DateTime("@0"),
|
287 |
'extra' => array('key' => 'pair'),
|
288 |
+
'message' => 'log',
|
289 |
);
|
290 |
|
291 |
$message = json_decode($formatter->format($record), true);
|
293 |
$this->assertArrayHasKey('type', $message);
|
294 |
$this->assertEquals('app', $message['type']);
|
295 |
}
|
296 |
+
|
297 |
+
public function testFormatWithLatin9Data()
|
298 |
+
{
|
299 |
+
if (version_compare(PHP_VERSION, '5.5.0', '<')) {
|
300 |
+
// Ignore the warning that will be emitted by PHP <5.5.0
|
301 |
+
\PHPUnit_Framework_Error_Warning::$enabled = false;
|
302 |
+
}
|
303 |
+
$formatter = new LogstashFormatter('test', 'hostname');
|
304 |
+
$record = array(
|
305 |
+
'level' => Logger::ERROR,
|
306 |
+
'level_name' => 'ERROR',
|
307 |
+
'channel' => '¯\_(ツ)_/¯',
|
308 |
+
'context' => array(),
|
309 |
+
'datetime' => new \DateTime("@0"),
|
310 |
+
'extra' => array(
|
311 |
+
'user_agent' => "\xD6WN; FBCR/OrangeEspa\xF1a; Vers\xE3o/4.0; F\xE4rist",
|
312 |
+
),
|
313 |
+
'message' => 'log',
|
314 |
+
);
|
315 |
+
|
316 |
+
$message = json_decode($formatter->format($record), true);
|
317 |
+
|
318 |
+
$this->assertEquals("1970-01-01T00:00:00.000000+00:00", $message['@timestamp']);
|
319 |
+
$this->assertEquals('log', $message['@message']);
|
320 |
+
$this->assertEquals('¯\_(ツ)_/¯', $message['@fields']['channel']);
|
321 |
+
$this->assertContains('¯\_(ツ)_/¯', $message['@tags']);
|
322 |
+
$this->assertEquals(Logger::ERROR, $message['@fields']['level']);
|
323 |
+
$this->assertEquals('test', $message['@type']);
|
324 |
+
$this->assertEquals('hostname', $message['@source']);
|
325 |
+
if (version_compare(PHP_VERSION, '5.5.0', '>=')) {
|
326 |
+
$this->assertEquals('ÖWN; FBCR/OrangeEspaña; Versão/4.0; Färist', $message['@fields']['user_agent']);
|
327 |
+
} else {
|
328 |
+
// PHP <5.5 does not return false for an element encoding failure,
|
329 |
+
// instead it emits a warning (possibly) and nulls the value.
|
330 |
+
$this->assertEquals(null, $message['@fields']['user_agent']);
|
331 |
+
}
|
332 |
+
}
|
333 |
}
|
vendor/monolog/monolog/tests/Monolog/Formatter/MongoDBFormatterTest.php
CHANGED
@@ -1,5 +1,14 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
namespace Monolog\Formatter;
|
4 |
|
5 |
use Monolog\Logger;
|
@@ -128,9 +137,9 @@ class MongoDBFormatterTest extends \PHPUnit_Framework_TestCase
|
|
128 |
'property' => 'anything',
|
129 |
'nest3' => array(
|
130 |
'nest4' => 'value',
|
131 |
-
'property' => 'nothing'
|
132 |
-
)
|
133 |
-
)
|
134 |
),
|
135 |
'level' => Logger::WARNING,
|
136 |
'level_name' => Logger::getLevelName(Logger::WARNING),
|
@@ -147,7 +156,7 @@ class MongoDBFormatterTest extends \PHPUnit_Framework_TestCase
|
|
147 |
'nest2' => array(
|
148 |
'property' => 'anything',
|
149 |
'nest3' => '[...]',
|
150 |
-
)
|
151 |
),
|
152 |
$formattedResult['context']
|
153 |
);
|
@@ -165,8 +174,8 @@ class MongoDBFormatterTest extends \PHPUnit_Framework_TestCase
|
|
165 |
'nest4' => array(
|
166 |
'property' => 'nothing',
|
167 |
),
|
168 |
-
)
|
169 |
-
)
|
170 |
),
|
171 |
'level' => Logger::WARNING,
|
172 |
'level_name' => Logger::getLevelName(Logger::WARNING),
|
@@ -186,9 +195,9 @@ class MongoDBFormatterTest extends \PHPUnit_Framework_TestCase
|
|
186 |
'property' => 'anything',
|
187 |
'nest4' => array(
|
188 |
'property' => 'nothing',
|
189 |
-
)
|
190 |
),
|
191 |
-
)
|
192 |
),
|
193 |
$formattedResult['context']
|
194 |
);
|
@@ -205,7 +214,7 @@ class MongoDBFormatterTest extends \PHPUnit_Framework_TestCase
|
|
205 |
$record = array(
|
206 |
'message' => 'some log message',
|
207 |
'context' => array(
|
208 |
-
'nest2' => $someObject
|
209 |
),
|
210 |
'level' => Logger::WARNING,
|
211 |
'level_name' => Logger::getLevelName(Logger::WARNING),
|
1 |
<?php
|
2 |
|
3 |
+
/*
|
4 |
+
* This file is part of the Monolog package.
|
5 |
+
*
|
6 |
+
* (c) Jordi Boggiano <j.boggiano@seld.be>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
namespace Monolog\Formatter;
|
13 |
|
14 |
use Monolog\Logger;
|
137 |
'property' => 'anything',
|
138 |
'nest3' => array(
|
139 |
'nest4' => 'value',
|
140 |
+
'property' => 'nothing',
|
141 |
+
),
|
142 |
+
),
|
143 |
),
|
144 |
'level' => Logger::WARNING,
|
145 |
'level_name' => Logger::getLevelName(Logger::WARNING),
|
156 |
'nest2' => array(
|
157 |
'property' => 'anything',
|
158 |
'nest3' => '[...]',
|
159 |
+
),
|
160 |
),
|
161 |
$formattedResult['context']
|
162 |
);
|
174 |
'nest4' => array(
|
175 |
'property' => 'nothing',
|
176 |
),
|
177 |
+
),
|
178 |
+
),
|
179 |
),
|
180 |
'level' => Logger::WARNING,
|
181 |
'level_name' => Logger::getLevelName(Logger::WARNING),
|
195 |
'property' => 'anything',
|
196 |
'nest4' => array(
|
197 |
'property' => 'nothing',
|
198 |
+
),
|
199 |
),
|
200 |
+
),
|
201 |
),
|
202 |
$formattedResult['context']
|
203 |
);
|
214 |
$record = array(
|
215 |
'message' => 'some log message',
|
216 |
'context' => array(
|
217 |
+
'nest2' => $someObject,
|
218 |
),
|
219 |
'level' => Logger::WARNING,
|
220 |
'level_name' => Logger::getLevelName(Logger::WARNING),
|
vendor/monolog/monolog/tests/Monolog/Formatter/NormalizerFormatterTest.php
CHANGED
@@ -16,6 +16,13 @@ namespace Monolog\Formatter;
|
|
16 |
*/
|
17 |
class NormalizerFormatterTest extends \PHPUnit_Framework_TestCase
|
18 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
public function testFormat()
|
20 |
{
|
21 |
$formatter = new NormalizerFormatter('Y-m-d');
|
@@ -43,7 +50,7 @@ class NormalizerFormatterTest extends \PHPUnit_Framework_TestCase
|
|
43 |
'foo' => '[object] (Monolog\\Formatter\\TestFooNorm: {"foo":"foo"})',
|
44 |
'bar' => '[object] (Monolog\\Formatter\\TestBarNorm: bar)',
|
45 |
'baz' => array(),
|
46 |
-
'res' => '[resource]',
|
47 |
),
|
48 |
'context' => array(
|
49 |
'foo' => 'bar',
|
@@ -51,7 +58,7 @@ class NormalizerFormatterTest extends \PHPUnit_Framework_TestCase
|
|
51 |
'inf' => 'INF',
|
52 |
'-inf' => '-INF',
|
53 |
'nan' => 'NaN',
|
54 |
-
)
|
55 |
), $formatted);
|
56 |
}
|
57 |
|
@@ -74,10 +81,46 @@ class NormalizerFormatterTest extends \PHPUnit_Framework_TestCase
|
|
74 |
'message' => $e2->getMessage(),
|
75 |
'code' => $e2->getCode(),
|
76 |
'file' => $e2->getFile().':'.$e2->getLine(),
|
77 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
), $formatted);
|
79 |
}
|
80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
public function testBatchFormat()
|
82 |
{
|
83 |
$formatter = new NormalizerFormatter('Y-m-d');
|
@@ -174,22 +217,124 @@ class NormalizerFormatterTest extends \PHPUnit_Framework_TestCase
|
|
174 |
$this->assertEquals(@json_encode(array($resource)), $res);
|
175 |
}
|
176 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
/**
|
178 |
* @expectedException RuntimeException
|
179 |
*/
|
180 |
public function testThrowsOnInvalidEncoding()
|
181 |
{
|
|
|
|
|
|
|
|
|
182 |
$formatter = new NormalizerFormatter();
|
183 |
$reflMethod = new \ReflectionMethod($formatter, 'toJson');
|
184 |
$reflMethod->setAccessible(true);
|
185 |
|
186 |
-
// send an invalid unicode sequence
|
187 |
-
$
|
|
|
|
|
188 |
if (PHP_VERSION_ID < 50500 && $res === '{"message":null}') {
|
189 |
throw new \RuntimeException('PHP 5.3/5.4 throw a warning and null the value instead of returning false entirely');
|
190 |
}
|
191 |
}
|
192 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
public function testExceptionTraceWithArgs()
|
194 |
{
|
195 |
if (defined('HHVM_VERSION')) {
|
@@ -219,7 +364,7 @@ class NormalizerFormatterTest extends \PHPUnit_Framework_TestCase
|
|
219 |
$result = $formatter->format($record);
|
220 |
|
221 |
$this->assertRegExp(
|
222 |
-
'%"resource":"\[resource\]"%',
|
223 |
$result['context']['exception']['trace'][0]
|
224 |
);
|
225 |
|
@@ -268,3 +413,11 @@ class TestStreamFoo
|
|
268 |
return $this->foo . ' - ' . (string) stream_get_contents($this->resource);
|
269 |
}
|
270 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
*/
|
17 |
class NormalizerFormatterTest extends \PHPUnit_Framework_TestCase
|
18 |
{
|
19 |
+
public function tearDown()
|
20 |
+
{
|
21 |
+
\PHPUnit_Framework_Error_Warning::$enabled = true;
|
22 |
+
|
23 |
+
return parent::tearDown();
|
24 |
+
}
|
25 |
+
|
26 |
public function testFormat()
|
27 |
{
|
28 |
$formatter = new NormalizerFormatter('Y-m-d');
|
50 |
'foo' => '[object] (Monolog\\Formatter\\TestFooNorm: {"foo":"foo"})',
|
51 |
'bar' => '[object] (Monolog\\Formatter\\TestBarNorm: bar)',
|
52 |
'baz' => array(),
|
53 |
+
'res' => '[resource] (stream)',
|
54 |
),
|
55 |
'context' => array(
|
56 |
'foo' => 'bar',
|
58 |
'inf' => 'INF',
|
59 |
'-inf' => '-INF',
|
60 |
'nan' => 'NaN',
|
61 |
+
),
|
62 |
), $formatted);
|
63 |
}
|
64 |
|
81 |
'message' => $e2->getMessage(),
|
82 |
'code' => $e2->getCode(),
|
83 |
'file' => $e2->getFile().':'.$e2->getLine(),
|
84 |
+
),
|
85 |
+
), $formatted);
|
86 |
+
}
|
87 |
+
|
88 |
+
public function testFormatSoapFaultException()
|
89 |
+
{
|
90 |
+
if (!class_exists('SoapFault')) {
|
91 |
+
$this->markTestSkipped('Requires the soap extension');
|
92 |
+
}
|
93 |
+
|
94 |
+
$formatter = new NormalizerFormatter('Y-m-d');
|
95 |
+
$e = new \SoapFault('foo', 'bar', 'hello', 'world');
|
96 |
+
$formatted = $formatter->format(array(
|
97 |
+
'exception' => $e,
|
98 |
+
));
|
99 |
+
|
100 |
+
unset($formatted['exception']['trace']);
|
101 |
+
|
102 |
+
$this->assertEquals(array(
|
103 |
+
'exception' => array(
|
104 |
+
'class' => 'SoapFault',
|
105 |
+
'message' => 'bar',
|
106 |
+
'code' => 0,
|
107 |
+
'file' => $e->getFile().':'.$e->getLine(),
|
108 |
+
'faultcode' => 'foo',
|
109 |
+
'faultactor' => 'hello',
|
110 |
+
'detail' => 'world',
|
111 |
+
),
|
112 |
), $formatted);
|
113 |
}
|
114 |
|
115 |
+
public function testFormatToStringExceptionHandle()
|
116 |
+
{
|
117 |
+
$formatter = new NormalizerFormatter('Y-m-d');
|
118 |
+
$this->setExpectedException('RuntimeException', 'Could not convert to string');
|
119 |
+
$formatter->format(array(
|
120 |
+
'myObject' => new TestToStringError(),
|
121 |
+
));
|
122 |
+
}
|
123 |
+
|
124 |
public function testBatchFormat()
|
125 |
{
|
126 |
$formatter = new NormalizerFormatter('Y-m-d');
|
217 |
$this->assertEquals(@json_encode(array($resource)), $res);
|
218 |
}
|
219 |
|
220 |
+
public function testNormalizeHandleLargeArrays()
|
221 |
+
{
|
222 |
+
$formatter = new NormalizerFormatter();
|
223 |
+
$largeArray = range(1, 2000);
|
224 |
+
|
225 |
+
$res = $formatter->format(array(
|
226 |
+
'level_name' => 'CRITICAL',
|
227 |
+
'channel' => 'test',
|
228 |
+
'message' => 'bar',
|
229 |
+
'context' => array($largeArray),
|
230 |
+
'datetime' => new \DateTime,
|
231 |
+
'extra' => array(),
|
232 |
+
));
|
233 |
+
|
234 |
+
$this->assertCount(1000, $res['context'][0]);
|
235 |
+
$this->assertEquals('Over 1000 items (2000 total), aborting normalization', $res['context'][0]['...']);
|
236 |
+
}
|
237 |
+
|
238 |
/**
|
239 |
* @expectedException RuntimeException
|
240 |
*/
|
241 |
public function testThrowsOnInvalidEncoding()
|
242 |
{
|
243 |
+
if (version_compare(PHP_VERSION, '5.5.0', '<')) {
|
244 |
+
// Ignore the warning that will be emitted by PHP <5.5.0
|
245 |
+
\PHPUnit_Framework_Error_Warning::$enabled = false;
|
246 |
+
}
|
247 |
$formatter = new NormalizerFormatter();
|
248 |
$reflMethod = new \ReflectionMethod($formatter, 'toJson');
|
249 |
$reflMethod->setAccessible(true);
|
250 |
|
251 |
+
// send an invalid unicode sequence as a object that can't be cleaned
|
252 |
+
$record = new \stdClass;
|
253 |
+
$record->message = "\xB1\x31";
|
254 |
+
$res = $reflMethod->invoke($formatter, $record);
|
255 |
if (PHP_VERSION_ID < 50500 && $res === '{"message":null}') {
|
256 |
throw new \RuntimeException('PHP 5.3/5.4 throw a warning and null the value instead of returning false entirely');
|
257 |
}
|
258 |
}
|
259 |
|
260 |
+
public function testConvertsInvalidEncodingAsLatin9()
|
261 |
+
{
|
262 |
+
if (version_compare(PHP_VERSION, '5.5.0', '<')) {
|
263 |
+
// Ignore the warning that will be emitted by PHP <5.5.0
|
264 |
+
\PHPUnit_Framework_Error_Warning::$enabled = false;
|
265 |
+
}
|
266 |
+
$formatter = new NormalizerFormatter();
|
267 |
+
$reflMethod = new \ReflectionMethod($formatter, 'toJson');
|
268 |
+
$reflMethod->setAccessible(true);
|
269 |
+
|
270 |
+
$res = $reflMethod->invoke($formatter, array('message' => "\xA4\xA6\xA8\xB4\xB8\xBC\xBD\xBE"));
|
271 |
+
|
272 |
+
if (version_compare(PHP_VERSION, '5.5.0', '>=')) {
|
273 |
+
$this->assertSame('{"message":"€ŠšŽžŒœŸ"}', $res);
|
274 |
+
} else {
|
275 |
+
// PHP <5.5 does not return false for an element encoding failure,
|
276 |
+
// instead it emits a warning (possibly) and nulls the value.
|
277 |
+
$this->assertSame('{"message":null}', $res);
|
278 |
+
}
|
279 |
+
}
|
280 |
+
|
281 |
+
/**
|
282 |
+
* @param mixed $in Input
|
283 |
+
* @param mixed $expect Expected output
|
284 |
+
* @covers Monolog\Formatter\NormalizerFormatter::detectAndCleanUtf8
|
285 |
+
* @dataProvider providesDetectAndCleanUtf8
|
286 |
+
*/
|
287 |
+
public function testDetectAndCleanUtf8($in, $expect)
|
288 |
+
{
|
289 |
+
$formatter = new NormalizerFormatter();
|
290 |
+
$formatter->detectAndCleanUtf8($in);
|
291 |
+
$this->assertSame($expect, $in);
|
292 |
+
}
|
293 |
+
|
294 |
+
public function providesDetectAndCleanUtf8()
|
295 |
+
{
|
296 |
+
$obj = new \stdClass;
|
297 |
+
|
298 |
+
return array(
|
299 |
+
'null' => array(null, null),
|
300 |
+
'int' => array(123, 123),
|
301 |
+
'float' => array(123.45, 123.45),
|
302 |
+
'bool false' => array(false, false),
|
303 |
+
'bool true' => array(true, true),
|
304 |
+
'ascii string' => array('abcdef', 'abcdef'),
|
305 |
+
'latin9 string' => array("\xB1\x31\xA4\xA6\xA8\xB4\xB8\xBC\xBD\xBE\xFF", '±1€ŠšŽžŒœŸÿ'),
|
306 |
+
'unicode string' => array('¤¦¨´¸¼½¾€ŠšŽžŒœŸ', '¤¦¨´¸¼½¾€ŠšŽžŒœŸ'),
|
307 |
+
'empty array' => array(array(), array()),
|
308 |
+
'array' => array(array('abcdef'), array('abcdef')),
|
309 |
+
'object' => array($obj, $obj),
|
310 |
+
);
|
311 |
+
}
|
312 |
+
|
313 |
+
/**
|
314 |
+
* @param int $code
|
315 |
+
* @param string $msg
|
316 |
+
* @dataProvider providesHandleJsonErrorFailure
|
317 |
+
*/
|
318 |
+
public function testHandleJsonErrorFailure($code, $msg)
|
319 |
+
{
|
320 |
+
$formatter = new NormalizerFormatter();
|
321 |
+
$reflMethod = new \ReflectionMethod($formatter, 'handleJsonError');
|
322 |
+
$reflMethod->setAccessible(true);
|
323 |
+
|
324 |
+
$this->setExpectedException('RuntimeException', $msg);
|
325 |
+
$reflMethod->invoke($formatter, $code, 'faked');
|
326 |
+
}
|
327 |
+
|
328 |
+
public function providesHandleJsonErrorFailure()
|
329 |
+
{
|
330 |
+
return array(
|
331 |
+
'depth' => array(JSON_ERROR_DEPTH, 'Maximum stack depth exceeded'),
|
332 |
+
'state' => array(JSON_ERROR_STATE_MISMATCH, 'Underflow or the modes mismatch'),
|
333 |
+
'ctrl' => array(JSON_ERROR_CTRL_CHAR, 'Unexpected control character found'),
|
334 |
+
'default' => array(-1, 'Unknown error'),
|
335 |
+
);
|
336 |
+
}
|
337 |
+
|
338 |
public function testExceptionTraceWithArgs()
|
339 |
{
|
340 |
if (defined('HHVM_VERSION')) {
|
364 |
$result = $formatter->format($record);
|
365 |
|
366 |
$this->assertRegExp(
|
367 |
+
'%"resource":"\[resource\] \(stream\)"%',
|
368 |
$result['context']['exception']['trace'][0]
|
369 |
);
|
370 |
|
413 |
return $this->foo . ' - ' . (string) stream_get_contents($this->resource);
|
414 |
}
|
415 |
}
|
416 |
+
|
417 |
+
class TestToStringError
|
418 |
+
{
|
419 |
+
public function __toString()
|
420 |
+
{
|
421 |
+
throw new \RuntimeException('Could not convert to string');
|
422 |
+
}
|
423 |
+
}
|
vendor/monolog/monolog/tests/Monolog/Formatter/ScalarFormatterTest.php
CHANGED
@@ -1,8 +1,20 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
namespace Monolog\Formatter;
|
3 |
|
4 |
class ScalarFormatterTest extends \PHPUnit_Framework_TestCase
|
5 |
{
|
|
|
|
|
6 |
public function setUp()
|
7 |
{
|
8 |
$this->formatter = new ScalarFormatter();
|
@@ -42,7 +54,7 @@ class ScalarFormatterTest extends \PHPUnit_Framework_TestCase
|
|
42 |
'bam' => array(1, 2, 3),
|
43 |
'bat' => array('foo' => 'bar'),
|
44 |
'bap' => \DateTime::createFromFormat(\DateTime::ISO8601, '1970-01-01T00:00:00+0000'),
|
45 |
-
'ban' => $exception
|
46 |
));
|
47 |
|
48 |
$this->assertSame(array(
|
@@ -57,8 +69,8 @@ class ScalarFormatterTest extends \PHPUnit_Framework_TestCase
|
|
57 |
'message' => $exception->getMessage(),
|
58 |
'code' => $exception->getCode(),
|
59 |
'file' => $exception->getFile() . ':' . $exception->getLine(),
|
60 |
-
'trace' => $this->buildTrace($exception)
|
61 |
-
))
|
62 |
), $formatted);
|
63 |
}
|
64 |
|
@@ -66,11 +78,11 @@ class ScalarFormatterTest extends \PHPUnit_Framework_TestCase
|
|
66 |
{
|
67 |
$context = array('file' => 'foo', 'line' => 1);
|
68 |
$formatted = $this->formatter->format(array(
|
69 |
-
'context' => $context
|
70 |
));
|
71 |
|
72 |
$this->assertSame(array(
|
73 |
-
'context' => $this->encodeJson($context)
|
74 |
), $formatted);
|
75 |
}
|
76 |
|
@@ -79,8 +91,8 @@ class ScalarFormatterTest extends \PHPUnit_Framework_TestCase
|
|
79 |
$exception = new \Exception('foo');
|
80 |
$formatted = $this->formatter->format(array(
|
81 |
'context' => array(
|
82 |
-
'exception' => $exception
|
83 |
-
)
|
84 |
));
|
85 |
|
86 |
$this->assertSame(array(
|
@@ -90,9 +102,9 @@ class ScalarFormatterTest extends \PHPUnit_Framework_TestCase
|
|
90 |
'message' => $exception->getMessage(),
|
91 |
'code' => $exception->getCode(),
|
92 |
'file' => $exception->getFile() . ':' . $exception->getLine(),
|
93 |
-
'trace' => $this->buildTrace($exception)
|
94 |
-
)
|
95 |
-
))
|
96 |
), $formatted);
|
97 |
}
|
98 |
}
|
1 |
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Monolog package.
|
5 |
+
*
|
6 |
+
* (c) Jordi Boggiano <j.boggiano@seld.be>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
namespace Monolog\Formatter;
|
13 |
|
14 |
class ScalarFormatterTest extends \PHPUnit_Framework_TestCase
|
15 |
{
|
16 |
+
private $formatter;
|
17 |
+
|
18 |
public function setUp()
|
19 |
{
|
20 |
$this->formatter = new ScalarFormatter();
|
54 |
'bam' => array(1, 2, 3),
|
55 |
'bat' => array('foo' => 'bar'),
|
56 |
'bap' => \DateTime::createFromFormat(\DateTime::ISO8601, '1970-01-01T00:00:00+0000'),
|
57 |
+
'ban' => $exception,
|
58 |
));
|
59 |
|
60 |
$this->assertSame(array(
|
69 |
'message' => $exception->getMessage(),
|
70 |
'code' => $exception->getCode(),
|
71 |
'file' => $exception->getFile() . ':' . $exception->getLine(),
|
72 |
+
'trace' => $this->buildTrace($exception),
|
73 |
+
)),
|
74 |
), $formatted);
|
75 |
}
|
76 |
|
78 |
{
|
79 |
$context = array('file' => 'foo', 'line' => 1);
|
80 |
$formatted = $this->formatter->format(array(
|
81 |
+
'context' => $context,
|
82 |
));
|
83 |
|
84 |
$this->assertSame(array(
|
85 |
+
'context' => $this->encodeJson($context),
|
86 |
), $formatted);
|
87 |
}
|
88 |
|
91 |
$exception = new \Exception('foo');
|
92 |
$formatted = $this->formatter->format(array(
|
93 |
'context' => array(
|
94 |
+
'exception' => $exception,
|
95 |
+
),
|
96 |
));
|
97 |
|
98 |
$this->assertSame(array(
|
102 |
'message' => $exception->getMessage(),
|
103 |
'code' => $exception->getCode(),
|
104 |
'file' => $exception->getFile() . ':' . $exception->getLine(),
|
105 |
+
'trace' => $this->buildTrace($exception),
|
106 |
+
),
|
107 |
+
)),
|
108 |
), $formatted);
|
109 |
}
|
110 |
}
|
vendor/monolog/monolog/tests/Monolog/Handler/AmqpHandlerTest.php
CHANGED
@@ -65,8 +65,8 @@ class AmqpHandlerTest extends TestCase
|
|
65 |
0,
|
66 |
array(
|
67 |
'delivery_mode' => 2,
|
68 |
-
'
|
69 |
-
)
|
70 |
);
|
71 |
|
72 |
$handler->handle($record);
|
@@ -117,8 +117,8 @@ class AmqpHandlerTest extends TestCase
|
|
117 |
null,
|
118 |
array(
|
119 |
'delivery_mode' => 2,
|
120 |
-
'content_type' => 'application/json'
|
121 |
-
)
|
122 |
);
|
123 |
|
124 |
$handler->handle($record);
|
65 |
0,
|
66 |
array(
|
67 |
'delivery_mode' => 2,
|
68 |
+
'content_type' => 'application/json',
|
69 |
+
),
|
70 |
);
|
71 |
|
72 |
$handler->handle($record);
|
117 |
null,
|
118 |
array(
|
119 |
'delivery_mode' => 2,
|
120 |
+
'content_type' => 'application/json',
|
121 |
+
),
|
122 |
);
|
123 |
|
124 |
$handler->handle($record);
|
vendor/monolog/monolog/tests/Monolog/Handler/ChromePHPHandlerTest.php
CHANGED
@@ -25,8 +25,13 @@ class ChromePHPHandlerTest extends TestCase
|
|
25 |
$_SERVER['HTTP_USER_AGENT'] = 'Monolog Test; Chrome/1.0';
|
26 |
}
|
27 |
|
28 |
-
|
|
|
|
|
|
|
29 |
{
|
|
|
|
|
30 |
$handler = new TestChromePHPHandler();
|
31 |
$handler->setFormatter($this->getIdentityFormatter());
|
32 |
$handler->handle($this->getRecord(Logger::DEBUG));
|
@@ -41,12 +46,22 @@ class ChromePHPHandlerTest extends TestCase
|
|
41 |
'test',
|
42 |
),
|
43 |
'request_uri' => '',
|
44 |
-
))))
|
45 |
);
|
46 |
|
47 |
$this->assertEquals($expected, $handler->getHeaders());
|
48 |
}
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
public function testHeadersOverflow()
|
51 |
{
|
52 |
$handler = new TestChromePHPHandler();
|
@@ -81,7 +96,7 @@ class ChromePHPHandlerTest extends TestCase
|
|
81 |
),
|
82 |
),
|
83 |
'request_uri' => '',
|
84 |
-
))))
|
85 |
);
|
86 |
|
87 |
$this->assertEquals($expected, $handler->getHeaders());
|
@@ -110,7 +125,7 @@ class ChromePHPHandlerTest extends TestCase
|
|
110 |
'test',
|
111 |
),
|
112 |
'request_uri' => '',
|
113 |
-
))))
|
114 |
);
|
115 |
|
116 |
$this->assertEquals($expected, $handler2->getHeaders());
|
25 |
$_SERVER['HTTP_USER_AGENT'] = 'Monolog Test; Chrome/1.0';
|
26 |
}
|
27 |
|
28 |
+
/**
|
29 |
+
* @dataProvider agentsProvider
|
30 |
+
*/
|
31 |
+
public function testHeaders($agent)
|
32 |
{
|
33 |
+
$_SERVER['HTTP_USER_AGENT'] = $agent;
|
34 |
+
|
35 |
$handler = new TestChromePHPHandler();
|
36 |
$handler->setFormatter($this->getIdentityFormatter());
|
37 |
$handler->handle($this->getRecord(Logger::DEBUG));
|
46 |
'test',
|
47 |
),
|
48 |
'request_uri' => '',
|
49 |
+
)))),
|
50 |
);
|
51 |
|
52 |
$this->assertEquals($expected, $handler->getHeaders());
|
53 |
}
|
54 |
|
55 |
+
public static function agentsProvider()
|
56 |
+
{
|
57 |
+
return array(
|
58 |
+
array('Monolog Test; Chrome/1.0'),
|
59 |
+
array('Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0'),
|
60 |
+
array('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/56.0.2924.76 Chrome/56.0.2924.76 Safari/537.36'),
|
61 |
+
array('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome Safari/537.36'),
|
62 |
+
);
|
63 |
+
}
|
64 |
+
|
65 |
public function testHeadersOverflow()
|
66 |
{
|
67 |
$handler = new TestChromePHPHandler();
|
96 |
),
|
97 |
),
|
98 |
'request_uri' => '',
|
99 |
+
)))),
|
100 |
);
|
101 |
|
102 |
$this->assertEquals($expected, $handler->getHeaders());
|
125 |
'test',
|
126 |
),
|
127 |
'request_uri' => '',
|
128 |
+
)))),
|
129 |
);
|
130 |
|
131 |
$this->assertEquals($expected, $handler2->getHeaders());
|
vendor/monolog/monolog/tests/Monolog/Handler/DeduplicationHandlerTest.php
ADDED
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Monolog package.
|
5 |
+
*
|
6 |
+
* (c) Jordi Boggiano <j.boggiano@seld.be>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Monolog\Handler;
|
13 |
+
|
14 |
+
use Monolog\TestCase;
|
15 |
+
use Monolog\Logger;
|
16 |
+
|
17 |
+
class DeduplicationHandlerTest extends TestCase
|
18 |
+
{
|
19 |
+
/**
|
20 |
+
* @covers Monolog\Handler\DeduplicationHandler::flush
|
21 |
+
*/
|
22 |
+
public function testFlushPassthruIfAllRecordsUnderTrigger()
|
23 |
+
{
|
24 |
+
$test = new TestHandler();
|
25 |
+
@unlink(sys_get_temp_dir().'/monolog_dedup.log');
|
26 |
+
$handler = new DeduplicationHandler($test, sys_get_temp_dir().'/monolog_dedup.log', 0);
|
27 |
+
|
28 |
+
$handler->handle($this->getRecord(Logger::DEBUG));
|
29 |
+
$handler->handle($this->getRecord(Logger::INFO));
|
30 |
+
|
31 |
+
$handler->flush();
|
32 |
+
|
33 |
+
$this->assertTrue($test->hasInfoRecords());
|
34 |
+
$this->assertTrue($test->hasDebugRecords());
|
35 |
+
$this->assertFalse($test->hasWarningRecords());
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @covers Monolog\Handler\DeduplicationHandler::flush
|
40 |
+
* @covers Monolog\Handler\DeduplicationHandler::appendRecord
|
41 |
+
*/
|
42 |
+
public function testFlushPassthruIfEmptyLog()
|
43 |
+
{
|
44 |
+
$test = new TestHandler();
|
45 |
+
@unlink(sys_get_temp_dir().'/monolog_dedup.log');
|
46 |
+
$handler = new DeduplicationHandler($test, sys_get_temp_dir().'/monolog_dedup.log', 0);
|
47 |
+
|
48 |
+
$handler->handle($this->getRecord(Logger::ERROR, 'Foo:bar'));
|
49 |
+
$handler->handle($this->getRecord(Logger::CRITICAL, "Foo\nbar"));
|
50 |
+
|
51 |
+
$handler->flush();
|
52 |
+
|
53 |
+
$this->assertTrue($test->hasErrorRecords());
|
54 |
+
$this->assertTrue($test->hasCriticalRecords());
|
55 |
+
$this->assertFalse($test->hasWarningRecords());
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* @covers Monolog\Handler\DeduplicationHandler::flush
|
60 |
+
* @covers Monolog\Handler\DeduplicationHandler::appendRecord
|
61 |
+
* @covers Monolog\Handler\DeduplicationHandler::isDuplicate
|
62 |
+
* @depends testFlushPassthruIfEmptyLog
|
63 |
+
*/
|
64 |
+
public function testFlushSkipsIfLogExists()
|
65 |
+
{
|
66 |
+
$test = new TestHandler();
|
67 |
+
$handler = new DeduplicationHandler($test, sys_get_temp_dir().'/monolog_dedup.log', 0);
|
68 |
+
|
69 |
+
$handler->handle($this->getRecord(Logger::ERROR, 'Foo:bar'));
|
70 |
+
$handler->handle($this->getRecord(Logger::CRITICAL, "Foo\nbar"));
|
71 |
+
|
72 |
+
$handler->flush();
|
73 |
+
|
74 |
+
$this->assertFalse($test->hasErrorRecords());
|
75 |
+
$this->assertFalse($test->hasCriticalRecords());
|
76 |
+
$this->assertFalse($test->hasWarningRecords());
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* @covers Monolog\Handler\DeduplicationHandler::flush
|
81 |
+
* @covers Monolog\Handler\DeduplicationHandler::appendRecord
|
82 |
+
* @covers Monolog\Handler\DeduplicationHandler::isDuplicate
|
83 |
+
* @depends testFlushPassthruIfEmptyLog
|
84 |
+
*/
|
85 |
+
public function testFlushPassthruIfLogTooOld()
|
86 |
+
{
|
87 |
+
$test = new TestHandler();
|
88 |
+
$handler = new DeduplicationHandler($test, sys_get_temp_dir().'/monolog_dedup.log', 0);
|
89 |
+
|
90 |
+
$record = $this->getRecord(Logger::ERROR);
|
91 |
+
$record['datetime']->modify('+62seconds');
|
92 |
+
$handler->handle($record);
|
93 |
+
$record = $this->getRecord(Logger::CRITICAL);
|
94 |
+
$record['datetime']->modify('+62seconds');
|
95 |
+
$handler->handle($record);
|
96 |
+
|
97 |
+
$handler->flush();
|
98 |
+
|
99 |
+
$this->assertTrue($test->hasErrorRecords());
|
100 |
+
$this->assertTrue($test->hasCriticalRecords());
|
101 |
+
$this->assertFalse($test->hasWarningRecords());
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* @covers Monolog\Handler\DeduplicationHandler::flush
|
106 |
+
* @covers Monolog\Handler\DeduplicationHandler::appendRecord
|
107 |
+
* @covers Monolog\Handler\DeduplicationHandler::isDuplicate
|
108 |
+
* @covers Monolog\Handler\DeduplicationHandler::collectLogs
|
109 |
+
*/
|
110 |
+
public function testGcOldLogs()
|
111 |
+
{
|
112 |
+
$test = new TestHandler();
|
113 |
+
@unlink(sys_get_temp_dir().'/monolog_dedup.log');
|
114 |
+
$handler = new DeduplicationHandler($test, sys_get_temp_dir().'/monolog_dedup.log', 0);
|
115 |
+
|
116 |
+
// handle two records from yesterday, and one recent
|
117 |
+
$record = $this->getRecord(Logger::ERROR);
|
118 |
+
$record['datetime']->modify('-1day -10seconds');
|
119 |
+
$handler->handle($record);
|
120 |
+
$record2 = $this->getRecord(Logger::CRITICAL);
|
121 |
+
$record2['datetime']->modify('-1day -10seconds');
|
122 |
+
$handler->handle($record2);
|
123 |
+
$record3 = $this->getRecord(Logger::CRITICAL);
|
124 |
+
$record3['datetime']->modify('-30seconds');
|
125 |
+
$handler->handle($record3);
|
126 |
+
|
127 |
+
// log is written as none of them are duplicate
|
128 |
+
$handler->flush();
|
129 |
+
$this->assertSame(
|
130 |
+
$record['datetime']->getTimestamp() . ":ERROR:test\n" .
|
131 |
+
$record2['datetime']->getTimestamp() . ":CRITICAL:test\n" .
|
132 |
+
$record3['datetime']->getTimestamp() . ":CRITICAL:test\n",
|
133 |
+
file_get_contents(sys_get_temp_dir() . '/monolog_dedup.log')
|
134 |
+
);
|
135 |
+
$this->assertTrue($test->hasErrorRecords());
|
136 |
+
$this->assertTrue($test->hasCriticalRecords());
|
137 |
+
$this->assertFalse($test->hasWarningRecords());
|
138 |
+
|
139 |
+
// clear test handler
|
140 |
+
$test->clear();
|
141 |
+
$this->assertFalse($test->hasErrorRecords());
|
142 |
+
$this->assertFalse($test->hasCriticalRecords());
|
143 |
+
|
144 |
+
// log new records, duplicate log gets GC'd at the end of this flush call
|
145 |
+
$handler->handle($record = $this->getRecord(Logger::ERROR));
|
146 |
+
$handler->handle($record2 = $this->getRecord(Logger::CRITICAL));
|
147 |
+
$handler->flush();
|
148 |
+
|
149 |
+
// log should now contain the new errors and the previous one that was recent enough
|
150 |
+
$this->assertSame(
|
151 |
+
$record3['datetime']->getTimestamp() . ":CRITICAL:test\n" .
|
152 |
+
$record['datetime']->getTimestamp() . ":ERROR:test\n" .
|
153 |
+
$record2['datetime']->getTimestamp() . ":CRITICAL:test\n",
|
154 |
+
file_get_contents(sys_get_temp_dir() . '/monolog_dedup.log')
|
155 |
+
);
|
156 |
+
$this->assertTrue($test->hasErrorRecords());
|
157 |
+
$this->assertTrue($test->hasCriticalRecords());
|
158 |
+
$this->assertFalse($test->hasWarningRecords());
|
159 |
+
}
|
160 |
+
|
161 |
+
public static function tearDownAfterClass()
|
162 |
+
{
|
163 |
+
@unlink(sys_get_temp_dir().'/monolog_dedup.log');
|
164 |
+
}
|
165 |
+
}
|
vendor/monolog/monolog/tests/Monolog/Handler/DynamoDbHandlerTest.php
CHANGED
@@ -15,6 +15,8 @@ use Monolog\TestCase;
|
|
15 |
|
16 |
class DynamoDbHandlerTest extends TestCase
|
17 |
{
|
|
|
|
|
18 |
public function setUp()
|
19 |
{
|
20 |
if (!class_exists('Aws\DynamoDb\DynamoDbClient')) {
|
@@ -50,13 +52,20 @@ class DynamoDbHandlerTest extends TestCase
|
|
50 |
$handler = new DynamoDbHandler($this->client, 'foo');
|
51 |
$handler->setFormatter($formatter);
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
$formatter
|
54 |
->expects($this->once())
|
55 |
->method('format')
|
56 |
->with($record)
|
57 |
->will($this->returnValue($formatted));
|
58 |
$this->client
|
59 |
-
->expects($this->once())
|
60 |
->method('formatAttributes')
|
61 |
->with($this->isType('array'))
|
62 |
->will($this->returnValue($formatted));
|
@@ -65,7 +74,7 @@ class DynamoDbHandlerTest extends TestCase
|
|
65 |
->method('__call')
|
66 |
->with('putItem', array(array(
|
67 |
'TableName' => 'foo',
|
68 |
-
'Item' => $
|
69 |
)));
|
70 |
|
71 |
$handler->handle($record);
|
15 |
|
16 |
class DynamoDbHandlerTest extends TestCase
|
17 |
{
|
18 |
+
private $client;
|
19 |
+
|
20 |
public function setUp()
|
21 |
{
|
22 |
if (!class_exists('Aws\DynamoDb\DynamoDbClient')) {
|
52 |
$handler = new DynamoDbHandler($this->client, 'foo');
|
53 |
$handler->setFormatter($formatter);
|
54 |
|
55 |
+
$isV3 = defined('Aws\Sdk::VERSION') && version_compare(\Aws\Sdk::VERSION, '3.0', '>=');
|
56 |
+
if ($isV3) {
|
57 |
+
$expFormatted = array('foo' => array('N' => 1), 'bar' => array('N' => 2));
|
58 |
+
} else {
|
59 |
+
$expFormatted = $formatted;
|
60 |
+
}
|
61 |
+
|
62 |
$formatter
|
63 |
->expects($this->once())
|
64 |
->method('format')
|
65 |
->with($record)
|
66 |
->will($this->returnValue($formatted));
|
67 |
$this->client
|
68 |
+
->expects($isV3 ? $this->never() : $this->once())
|
69 |
->method('formatAttributes')
|
70 |
->with($this->isType('array'))
|
71 |
->will($this->returnValue($formatted));
|
74 |
->method('__call')
|
75 |
->with('putItem', array(array(
|
76 |
'TableName' => 'foo',
|
77 |
+
'Item' => $expFormatted,
|
78 |
)));
|
79 |
|
80 |
$handler->handle($record);
|
vendor/monolog/monolog/tests/Monolog/Handler/FingersCrossedHandlerTest.php
CHANGED
@@ -22,6 +22,7 @@ class FingersCrossedHandlerTest extends TestCase
|
|
22 |
/**
|
23 |
* @covers Monolog\Handler\FingersCrossedHandler::__construct
|
24 |
* @covers Monolog\Handler\FingersCrossedHandler::handle
|
|
|
25 |
*/
|
26 |
public function testHandleBuffers()
|
27 |
{
|
@@ -39,6 +40,7 @@ class FingersCrossedHandlerTest extends TestCase
|
|
39 |
|
40 |
/**
|
41 |
* @covers Monolog\Handler\FingersCrossedHandler::handle
|
|
|
42 |
*/
|
43 |
public function testHandleStopsBufferingAfterTrigger()
|
44 |
{
|
@@ -53,6 +55,7 @@ class FingersCrossedHandlerTest extends TestCase
|
|
53 |
|
54 |
/**
|
55 |
* @covers Monolog\Handler\FingersCrossedHandler::handle
|
|
|
56 |
* @covers Monolog\Handler\FingersCrossedHandler::reset
|
57 |
*/
|
58 |
public function testHandleRestartBufferingAfterReset()
|
@@ -71,6 +74,7 @@ class FingersCrossedHandlerTest extends TestCase
|
|
71 |
|
72 |
/**
|
73 |
* @covers Monolog\Handler\FingersCrossedHandler::handle
|
|
|
74 |
*/
|
75 |
public function testHandleRestartBufferingAfterBeingTriggeredWhenStopBufferingIsDisabled()
|
76 |
{
|
@@ -87,6 +91,7 @@ class FingersCrossedHandlerTest extends TestCase
|
|
87 |
|
88 |
/**
|
89 |
* @covers Monolog\Handler\FingersCrossedHandler::handle
|
|
|
90 |
*/
|
91 |
public function testHandleBufferLimit()
|
92 |
{
|
@@ -103,6 +108,7 @@ class FingersCrossedHandlerTest extends TestCase
|
|
103 |
|
104 |
/**
|
105 |
* @covers Monolog\Handler\FingersCrossedHandler::handle
|
|
|
106 |
*/
|
107 |
public function testHandleWithCallback()
|
108 |
{
|
@@ -121,6 +127,7 @@ class FingersCrossedHandlerTest extends TestCase
|
|
121 |
|
122 |
/**
|
123 |
* @covers Monolog\Handler\FingersCrossedHandler::handle
|
|
|
124 |
* @expectedException RuntimeException
|
125 |
*/
|
126 |
public function testHandleWithBadCallbackThrowsException()
|
@@ -173,6 +180,22 @@ class FingersCrossedHandlerTest extends TestCase
|
|
173 |
$this->assertTrue($test->hasWarningRecords());
|
174 |
}
|
175 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
/**
|
177 |
* @covers Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::__construct
|
178 |
* @covers Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::isHandlerActivated
|
@@ -209,6 +232,7 @@ class FingersCrossedHandlerTest extends TestCase
|
|
209 |
|
210 |
/**
|
211 |
* @covers Monolog\Handler\FingersCrossedHandler::handle
|
|
|
212 |
*/
|
213 |
public function testHandleUsesProcessors()
|
214 |
{
|
22 |
/**
|
23 |
* @covers Monolog\Handler\FingersCrossedHandler::__construct
|
24 |
* @covers Monolog\Handler\FingersCrossedHandler::handle
|
25 |
+
* @covers Monolog\Handler\FingersCrossedHandler::activate
|
26 |
*/
|
27 |
public function testHandleBuffers()
|
28 |
{
|
40 |
|
41 |
/**
|
42 |
* @covers Monolog\Handler\FingersCrossedHandler::handle
|
43 |
+
* @covers Monolog\Handler\FingersCrossedHandler::activate
|
44 |
*/
|
45 |
public function testHandleStopsBufferingAfterTrigger()
|
46 |
{
|
55 |
|
56 |
/**
|
57 |
* @covers Monolog\Handler\FingersCrossedHandler::handle
|
58 |
+
* @covers Monolog\Handler\FingersCrossedHandler::activate
|
59 |
* @covers Monolog\Handler\FingersCrossedHandler::reset
|
60 |
*/
|
61 |
public function testHandleRestartBufferingAfterReset()
|
74 |
|
75 |
/**
|
76 |
* @covers Monolog\Handler\FingersCrossedHandler::handle
|
77 |
+
* @covers Monolog\Handler\FingersCrossedHandler::activate
|
78 |
*/
|
79 |
public function testHandleRestartBufferingAfterBeingTriggeredWhenStopBufferingIsDisabled()
|
80 |
{
|
91 |
|
92 |
/**
|
93 |
* @covers Monolog\Handler\FingersCrossedHandler::handle
|
94 |
+
* @covers Monolog\Handler\FingersCrossedHandler::activate
|
95 |
*/
|
96 |
public function testHandleBufferLimit()
|
97 |
{
|
108 |
|
109 |
/**
|
110 |
* @covers Monolog\Handler\FingersCrossedHandler::handle
|
111 |
+
* @covers Monolog\Handler\FingersCrossedHandler::activate
|
112 |
*/
|
113 |
public function testHandleWithCallback()
|
114 |
{
|
127 |
|
128 |
/**
|
129 |
* @covers Monolog\Handler\FingersCrossedHandler::handle
|
130 |
+
* @covers Monolog\Handler\FingersCrossedHandler::activate
|
131 |
* @expectedException RuntimeException
|
132 |
*/
|
133 |
public function testHandleWithBadCallbackThrowsException()
|
180 |
$this->assertTrue($test->hasWarningRecords());
|
181 |
}
|
182 |
|
183 |
+
/**
|
184 |
+
* @covers Monolog\Handler\FingersCrossedHandler::__construct
|
185 |
+
* @covers Monolog\Handler\FingersCrossedHandler::activate
|
186 |
+
*/
|
187 |
+
public function testOverrideActivationStrategy()
|
188 |
+
{
|
189 |
+
$test = new TestHandler();
|
190 |
+
$handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy('warning'));
|
191 |
+
$handler->handle($this->getRecord(Logger::DEBUG));
|
192 |
+
$this->assertFalse($test->hasDebugRecords());
|
193 |
+
$handler->activate();
|
194 |
+
$this->assertTrue($test->hasDebugRecords());
|
195 |
+
$handler->handle($this->getRecord(Logger::INFO));
|
196 |
+
$this->assertTrue($test->hasInfoRecords());
|
197 |
+
}
|
198 |
+
|
199 |
/**
|
200 |
* @covers Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::__construct
|
201 |
* @covers Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::isHandlerActivated
|
232 |
|
233 |
/**
|
234 |
* @covers Monolog\Handler\FingersCrossedHandler::handle
|
235 |
+
* @covers Monolog\Handler\FingersCrossedHandler::activate
|
236 |
*/
|
237 |
public function testHandleUsesProcessors()
|
238 |
{
|
vendor/monolog/monolog/tests/Monolog/Handler/GroupHandlerTest.php
CHANGED
@@ -86,4 +86,27 @@ class GroupHandlerTest extends TestCase
|
|
86 |
$records = $test->getRecords();
|
87 |
$this->assertTrue($records[0]['extra']['foo']);
|
88 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
}
|
86 |
$records = $test->getRecords();
|
87 |
$this->assertTrue($records[0]['extra']['foo']);
|
88 |
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* @covers Monolog\Handler\GroupHandler::handle
|
92 |
+
*/
|
93 |
+
public function testHandleBatchUsesProcessors()
|
94 |
+
{
|
95 |
+
$testHandlers = array(new TestHandler(), new TestHandler());
|
96 |
+
$handler = new GroupHandler($testHandlers);
|
97 |
+
$handler->pushProcessor(function ($record) {
|
98 |
+
$record['extra']['foo'] = true;
|
99 |
+
|
100 |
+
return $record;
|
101 |
+
});
|
102 |
+
$handler->handleBatch(array($this->getRecord(Logger::DEBUG), $this->getRecord(Logger::INFO)));
|
103 |
+
foreach ($testHandlers as $test) {
|
104 |
+
$this->assertTrue($test->hasDebugRecords());
|
105 |
+
$this->assertTrue($test->hasInfoRecords());
|
106 |
+
$this->assertTrue(count($test->getRecords()) === 2);
|
107 |
+
$records = $test->getRecords();
|
108 |
+
$this->assertTrue($records[0]['extra']['foo']);
|
109 |
+
$this->assertTrue($records[1]['extra']['foo']);
|
110 |
+
}
|
111 |
+
}
|
112 |
}
|
vendor/monolog/monolog/tests/Monolog/Handler/HandlerWrapperTest.php
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Monolog package.
|
5 |
+
*
|
6 |
+
* (c) Jordi Boggiano <j.boggiano@seld.be>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Monolog\Handler;
|
13 |
+
|
14 |
+
use Monolog\TestCase;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @author Alexey Karapetov <alexey@karapetov.com>
|
18 |
+
*/
|
19 |
+
class HandlerWrapperTest extends TestCase
|
20 |
+
{
|
21 |
+
/**
|
22 |
+
* @var HandlerWrapper
|
23 |
+
*/
|
24 |
+
private $wrapper;
|
25 |
+
|
26 |
+
private $handler;
|
27 |
+
|
28 |
+
public function setUp()
|
29 |
+
{
|
30 |
+
parent::setUp();
|
31 |
+
$this->handler = $this->getMock('Monolog\\Handler\\HandlerInterface');
|
32 |
+
$this->wrapper = new HandlerWrapper($this->handler);
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* @return array
|
37 |
+
*/
|
38 |
+
public function trueFalseDataProvider()
|
39 |
+
{
|
40 |
+
return array(
|
41 |
+
array(true),
|
42 |
+
array(false),
|
43 |
+
);
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @param $result
|
48 |
+
* @dataProvider trueFalseDataProvider
|
49 |
+
*/
|
50 |
+
public function testIsHandling($result)
|
51 |
+
{
|
52 |
+
$record = $this->getRecord();
|
53 |
+
$this->handler->expects($this->once())
|
54 |
+
->method('isHandling')
|
55 |
+
->with($record)
|
56 |
+
->willReturn($result);
|
57 |
+
|
58 |
+
$this->assertEquals($result, $this->wrapper->isHandling($record));
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* @param $result
|
63 |
+
* @dataProvider trueFalseDataProvider
|
64 |
+
*/
|
65 |
+
public function testHandle($result)
|
66 |
+
{
|
67 |
+
$record = $this->getRecord();
|
68 |
+
$this->handler->expects($this->once())
|
69 |
+
->method('handle')
|
70 |
+
->with($record)
|
71 |
+
->willReturn($result);
|
72 |
+
|
73 |
+
$this->assertEquals($result, $this->wrapper->handle($record));
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* @param $result
|
78 |
+
* @dataProvider trueFalseDataProvider
|
79 |
+
*/
|
80 |
+
public function testHandleBatch($result)
|
81 |
+
{
|
82 |
+
$records = $this->getMultipleRecords();
|
83 |
+
$this->handler->expects($this->once())
|
84 |
+
->method('handleBatch')
|
85 |
+
->with($records)
|
86 |
+
->willReturn($result);
|
87 |
+
|
88 |
+
$this->assertEquals($result, $this->wrapper->handleBatch($records));
|
89 |
+
}
|
90 |
+
|
91 |
+
public function testPushProcessor()
|
92 |
+
{
|
93 |
+
$processor = function () {};
|
94 |
+
$this->handler->expects($this->once())
|
95 |
+
->method('pushProcessor')
|
96 |
+
->with($processor);
|
97 |
+
|
98 |
+
$this->assertEquals($this->wrapper, $this->wrapper->pushProcessor($processor));
|
99 |
+
}
|
100 |
+
|
101 |
+
public function testPopProcessor()
|
102 |
+
{
|
103 |
+
$processor = function () {};
|
104 |
+
$this->handler->expects($this->once())
|
105 |
+
->method('popProcessor')
|
106 |
+
->willReturn($processor);
|
107 |
+
|
108 |
+
$this->assertEquals($processor, $this->wrapper->popProcessor());
|
109 |
+
}
|
110 |
+
|
111 |
+
public function testSetFormatter()
|
112 |
+
{
|
113 |
+
$formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface');
|
114 |
+
$this->handler->expects($this->once())
|
115 |
+
->method('setFormatter')
|
116 |
+
->with($formatter);
|
117 |
+
|
118 |
+
$this->assertEquals($this->wrapper, $this->wrapper->setFormatter($formatter));
|
119 |
+
}
|
120 |
+
|
121 |
+
public function testGetFormatter()
|
122 |
+
{
|
123 |
+
$formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface');
|
124 |
+
$this->handler->expects($this->once())
|
125 |
+
->method('getFormatter')
|
126 |
+
->willReturn($formatter);
|
127 |
+
|
128 |
+
$this->assertEquals($formatter, $this->wrapper->getFormatter());
|
129 |
+
}
|
130 |
+
}
|
vendor/monolog/monolog/tests/Monolog/Handler/HipChatHandlerTest.php
CHANGED
@@ -21,6 +21,7 @@ use Monolog\Logger;
|
|
21 |
class HipChatHandlerTest extends TestCase
|
22 |
{
|
23 |
private $res;
|
|
|
24 |
private $handler;
|
25 |
|
26 |
public function testWriteHeader()
|
@@ -91,6 +92,18 @@ class HipChatHandlerTest extends TestCase
|
|
91 |
$this->assertRegexp('/notify=0&message=test1&message_format=text&color=red&room_id=room1&from=Monolog$/', $content);
|
92 |
}
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
/**
|
95 |
* @depends testWriteCustomHostHeader
|
96 |
*/
|
@@ -104,7 +117,7 @@ class HipChatHandlerTest extends TestCase
|
|
104 |
*/
|
105 |
public function testWriteContentV2($content)
|
106 |
{
|
107 |
-
$this->assertRegexp('/notify=false&message=test1&message_format=text&color=red$/', $content);
|
108 |
}
|
109 |
|
110 |
/**
|
@@ -112,7 +125,19 @@ class HipChatHandlerTest extends TestCase
|
|
112 |
*/
|
113 |
public function testWriteContentV2Notify($content)
|
114 |
{
|
115 |
-
$this->assertRegexp('/notify=true&message=test1&message_format=text&color=red$/', $content);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
}
|
117 |
|
118 |
public function testWriteWithComplexMessage()
|
@@ -125,6 +150,16 @@ class HipChatHandlerTest extends TestCase
|
|
125 |
$this->assertRegexp('/message=Backup\+of\+database\+%22example%22\+finished\+in\+16\+minutes\./', $content);
|
126 |
}
|
127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
/**
|
129 |
* @dataProvider provideLevelColors
|
130 |
*/
|
@@ -174,7 +209,7 @@ class HipChatHandlerTest extends TestCase
|
|
174 |
array(
|
175 |
array('level' => Logger::WARNING, 'message' => 'Oh bugger!', 'level_name' => 'warning', 'datetime' => new \DateTime()),
|
176 |
array('level' => Logger::NOTICE, 'message' => 'Something noticeable happened.', 'level_name' => 'notice', 'datetime' => new \DateTime()),
|
177 |
-
array('level' => Logger::CRITICAL, 'message' => 'Everything is broken!', 'level_name' => 'critical', 'datetime' => new \DateTime())
|
178 |
),
|
179 |
'red',
|
180 |
),
|
@@ -233,12 +268,12 @@ class HipChatHandlerTest extends TestCase
|
|
233 |
*/
|
234 |
public function testCreateWithTooLongName()
|
235 |
{
|
236 |
-
$hipChatHandler = new
|
237 |
}
|
238 |
|
239 |
public function testCreateWithTooLongNameV2()
|
240 |
{
|
241 |
// creating a handler with too long of a name but using the v2 api doesn't matter.
|
242 |
-
$hipChatHandler = new
|
243 |
}
|
244 |
}
|
21 |
class HipChatHandlerTest extends TestCase
|
22 |
{
|
23 |
private $res;
|
24 |
+
/** @var HipChatHandler */
|
25 |
private $handler;
|
26 |
|
27 |
public function testWriteHeader()
|
92 |
$this->assertRegexp('/notify=0&message=test1&message_format=text&color=red&room_id=room1&from=Monolog$/', $content);
|
93 |
}
|
94 |
|
95 |
+
public function testWriteContentV1WithoutName()
|
96 |
+
{
|
97 |
+
$this->createHandler('myToken', 'room1', null, false, 'hipchat.foo.bar', 'v1');
|
98 |
+
$this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
|
99 |
+
fseek($this->res, 0);
|
100 |
+
$content = fread($this->res, 1024);
|
101 |
+
|
102 |
+
$this->assertRegexp('/notify=0&message=test1&message_format=text&color=red&room_id=room1&from=$/', $content);
|
103 |
+
|
104 |
+
return $content;
|
105 |
+
}
|
106 |
+
|
107 |
/**
|
108 |
* @depends testWriteCustomHostHeader
|
109 |
*/
|
117 |
*/
|
118 |
public function testWriteContentV2($content)
|
119 |
{
|
120 |
+
$this->assertRegexp('/notify=false&message=test1&message_format=text&color=red&from=Monolog$/', $content);
|
121 |
}
|
122 |
|
123 |
/**
|
125 |
*/
|
126 |
public function testWriteContentV2Notify($content)
|
127 |
{
|
128 |
+
$this->assertRegexp('/notify=true&message=test1&message_format=text&color=red&from=Monolog$/', $content);
|
129 |
+
}
|
130 |
+
|
131 |
+
public function testWriteContentV2WithoutName()
|
132 |
+
{
|
133 |
+
$this->createHandler('myToken', 'room1', null, false, 'hipchat.foo.bar', 'v2');
|
134 |
+
$this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
|
135 |
+
fseek($this->res, 0);
|
136 |
+
$content = fread($this->res, 1024);
|
137 |
+
|
138 |
+
$this->assertRegexp('/notify=false&message=test1&message_format=text&color=red$/', $content);
|
139 |
+
|
140 |
+
return $content;
|
141 |
}
|
142 |
|
143 |
public function testWriteWithComplexMessage()
|
150 |
$this->assertRegexp('/message=Backup\+of\+database\+%22example%22\+finished\+in\+16\+minutes\./', $content);
|
151 |
}
|
152 |
|
153 |
+
public function testWriteTruncatesLongMessage()
|
154 |
+
{
|
155 |
+
$this->createHandler();
|
156 |
+
$this->handler->handle($this->getRecord(Logger::CRITICAL, str_repeat('abcde', 2000)));
|
157 |
+
fseek($this->res, 0);
|
158 |
+
$content = fread($this->res, 12000);
|
159 |
+
|
160 |
+
$this->assertRegexp('/message='.str_repeat('abcde', 1900).'\+%5Btruncated%5D/', $content);
|
161 |
+
}
|
162 |
+
|
163 |
/**
|
164 |
* @dataProvider provideLevelColors
|
165 |
*/
|
209 |
array(
|
210 |
array('level' => Logger::WARNING, 'message' => 'Oh bugger!', 'level_name' => 'warning', 'datetime' => new \DateTime()),
|
211 |
array('level' => Logger::NOTICE, 'message' => 'Something noticeable happened.', 'level_name' => 'notice', 'datetime' => new \DateTime()),
|
212 |
+
array('level' => Logger::CRITICAL, 'message' => 'Everything is broken!', 'level_name' => 'critical', 'datetime' => new \DateTime()),
|
213 |
),
|
214 |
'red',
|
215 |
),
|
268 |
*/
|
269 |
public function testCreateWithTooLongName()
|
270 |
{
|
271 |
+
$hipChatHandler = new HipChatHandler('token', 'room', 'SixteenCharsHere');
|
272 |
}
|
273 |
|
274 |
public function testCreateWithTooLongNameV2()
|
275 |
{
|
276 |
// creating a handler with too long of a name but using the v2 api doesn't matter.
|
277 |
+
$hipChatHandler = new HipChatHandler('token', 'room', 'SixteenCharsHere', false, Logger::CRITICAL, true, true, 'test', 'api.hipchat.com', 'v2');
|
278 |
}
|
279 |
}
|
vendor/monolog/monolog/tests/Monolog/Handler/LogEntriesHandlerTest.php
CHANGED
@@ -45,7 +45,7 @@ class LogEntriesHandlerTest extends TestCase
|
|
45 |
$records = array(
|
46 |
$this->getRecord(),
|
47 |
$this->getRecord(),
|
48 |
-
$this->getRecord()
|
49 |
);
|
50 |
$this->createHandler();
|
51 |
$this->handler->handleBatch($records);
|
45 |
$records = array(
|
46 |
$this->getRecord(),
|
47 |
$this->getRecord(),
|
48 |
+
$this->getRecord(),
|
49 |
);
|
50 |
$this->createHandler();
|
51 |
$this->handler->handleBatch($records);
|
vendor/monolog/monolog/tests/Monolog/Handler/NativeMailerHandlerTest.php
CHANGED
@@ -12,9 +12,21 @@
|
|
12 |
namespace Monolog\Handler;
|
13 |
|
14 |
use Monolog\TestCase;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
class NativeMailerHandlerTest extends TestCase
|
17 |
{
|
|
|
|
|
|
|
|
|
|
|
18 |
/**
|
19 |
* @expectedException InvalidArgumentException
|
20 |
*/
|
@@ -58,4 +70,42 @@ class NativeMailerHandlerTest extends TestCase
|
|
58 |
$mailer = new NativeMailerHandler('spammer@example.org', 'dear victim', 'receiver@example.org');
|
59 |
$mailer->setEncoding("utf-8\r\nFrom: faked@attacker.org");
|
60 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
}
|
12 |
namespace Monolog\Handler;
|
13 |
|
14 |
use Monolog\TestCase;
|
15 |
+
use Monolog\Logger;
|
16 |
+
use InvalidArgumentException;
|
17 |
+
|
18 |
+
function mail($to, $subject, $message, $additional_headers = null, $additional_parameters = null)
|
19 |
+
{
|
20 |
+
$GLOBALS['mail'][] = func_get_args();
|
21 |
+
}
|
22 |
|
23 |
class NativeMailerHandlerTest extends TestCase
|
24 |
{
|
25 |
+
protected function setUp()
|
26 |
+
{
|
27 |
+
$GLOBALS['mail'] = array();
|
28 |
+
}
|
29 |
+
|
30 |
/**
|
31 |
* @expectedException InvalidArgumentException
|
32 |
*/
|
70 |
$mailer = new NativeMailerHandler('spammer@example.org', 'dear victim', 'receiver@example.org');
|
71 |
$mailer->setEncoding("utf-8\r\nFrom: faked@attacker.org");
|
72 |
}
|
73 |
+
|
74 |
+
public function testSend()
|
75 |
+
{
|
76 |
+
$to = 'spammer@example.org';
|
77 |
+
$subject = 'dear victim';
|
78 |
+
$from = 'receiver@example.org';
|
79 |
+
|
80 |
+
$mailer = new NativeMailerHandler($to, $subject, $from);
|
81 |
+
$mailer->handleBatch(array());
|
82 |
+
|
83 |
+
// batch is empty, nothing sent
|
84 |
+
$this->assertEmpty($GLOBALS['mail']);
|
85 |
+
|
86 |
+
// non-empty batch
|
87 |
+
$mailer->handle($this->getRecord(Logger::ERROR, "Foo\nBar\r\n\r\nBaz"));
|
88 |
+
$this->assertNotEmpty($GLOBALS['mail']);
|
89 |
+
$this->assertInternalType('array', $GLOBALS['mail']);
|
90 |
+
$this->assertArrayHasKey('0', $GLOBALS['mail']);
|
91 |
+
$params = $GLOBALS['mail'][0];
|
92 |
+
$this->assertCount(5, $params);
|
93 |
+
$this->assertSame($to, $params[0]);
|
94 |
+
$this->assertSame($subject, $params[1]);
|
95 |
+
$this->assertStringEndsWith(" test.ERROR: Foo Bar Baz [] []\n", $params[2]);
|
96 |
+
$this->assertSame("From: $from\r\nContent-type: text/plain; charset=utf-8\r\n", $params[3]);
|
97 |
+
$this->assertSame('', $params[4]);
|
98 |
+
}
|
99 |
+
|
100 |
+
public function testMessageSubjectFormatting()
|
101 |
+
{
|
102 |
+
$mailer = new NativeMailerHandler('to@example.org', 'Alert: %level_name% %message%', 'from@example.org');
|
103 |
+
$mailer->handle($this->getRecord(Logger::ERROR, "Foo\nBar\r\n\r\nBaz"));
|
104 |
+
$this->assertNotEmpty($GLOBALS['mail']);
|
105 |
+
$this->assertInternalType('array', $GLOBALS['mail']);
|
106 |
+
$this->assertArrayHasKey('0', $GLOBALS['mail']);
|
107 |
+
$params = $GLOBALS['mail'][0];
|
108 |
+
$this->assertCount(5, $params);
|
109 |
+
$this->assertSame('Alert: ERROR Foo Bar Baz', $params[1]);
|
110 |
+
}
|
111 |
}
|
vendor/monolog/monolog/tests/Monolog/Handler/NewRelicHandlerTest.php
CHANGED
@@ -11,6 +11,7 @@
|
|
11 |
|
12 |
namespace Monolog\Handler;
|
13 |
|
|
|
14 |
use Monolog\TestCase;
|
15 |
use Monolog\Logger;
|
16 |
|
@@ -104,6 +105,13 @@ class NewRelicHandlerTest extends TestCase
|
|
104 |
$this->assertEquals($expected, self::$customParameters);
|
105 |
}
|
106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
public function testTheAppNameIsNullByDefault()
|
108 |
{
|
109 |
$handler = new StubNewRelicHandler();
|
11 |
|
12 |
namespace Monolog\Handler;
|
13 |
|
14 |
+
use Monolog\Formatter\LineFormatter;
|
15 |
use Monolog\TestCase;
|
16 |
use Monolog\Logger;
|
17 |
|
105 |
$this->assertEquals($expected, self::$customParameters);
|
106 |
}
|
107 |
|
108 |
+
public function testThehandlerCanHandleTheRecordsFormattedUsingTheLineFormatter()
|
109 |
+
{
|
110 |
+
$handler = new StubNewRelicHandler();
|
111 |
+
$handler->setFormatter(new LineFormatter());
|
112 |
+
$handler->handle($this->getRecord(Logger::ERROR));
|
113 |
+
}
|
114 |
+
|
115 |
public function testTheAppNameIsNullByDefault()
|
116 |
{
|
117 |
$handler = new StubNewRelicHandler();
|
vendor/monolog/monolog/tests/Monolog/Handler/PHPConsoleHandlerTest.php
CHANGED
@@ -27,7 +27,6 @@ use PHPUnit_Framework_MockObject_MockObject;
|
|
27 |
*/
|
28 |
class PHPConsoleHandlerTest extends TestCase
|
29 |
{
|
30 |
-
|
31 |
/** @var Connector|PHPUnit_Framework_MockObject_MockObject */
|
32 |
protected $connector;
|
33 |
/** @var DebugDispatcher|PHPUnit_Framework_MockObject_MockObject */
|
@@ -103,7 +102,7 @@ class PHPConsoleHandlerTest extends TestCase
|
|
103 |
protected function initLogger($handlerOptions = array(), $level = Logger::DEBUG)
|
104 |
{
|
105 |
return new Logger('test', array(
|
106 |
-
new PHPConsoleHandler($handlerOptions, $this->connector, $level)
|
107 |
));
|
108 |
}
|
109 |
|
27 |
*/
|
28 |
class PHPConsoleHandlerTest extends TestCase
|
29 |
{
|
|
|
30 |
/** @var Connector|PHPUnit_Framework_MockObject_MockObject */
|
31 |
protected $connector;
|
32 |
/** @var DebugDispatcher|PHPUnit_Framework_MockObject_MockObject */
|
102 |
protected function initLogger($handlerOptions = array(), $level = Logger::DEBUG)
|
103 |
{
|
104 |
return new Logger('test', array(
|
105 |
+
new PHPConsoleHandler($handlerOptions, $this->connector, $level),
|
106 |
));
|
107 |
}
|
108 |
|
vendor/monolog/monolog/tests/Monolog/Handler/PushoverHandlerTest.php
CHANGED
@@ -48,7 +48,7 @@ class PushoverHandlerTest extends TestCase
|
|
48 |
|
49 |
public function testWriteWithComplexTitle()
|
50 |
{
|
51 |
-
$this->createHandler('myToken', 'myUser', 'Backup finished - SQL1'
|
52 |
$this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
|
53 |
fseek($this->res, 0);
|
54 |
$content = fread($this->res, 1024);
|
48 |
|
49 |
public function testWriteWithComplexTitle()
|
50 |
{
|
51 |
+
$this->createHandler('myToken', 'myUser', 'Backup finished - SQL1');
|
52 |
$this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
|
53 |
fseek($this->res, 0);
|
54 |
$content = fread($this->res, 1024);
|
vendor/monolog/monolog/tests/Monolog/Handler/RavenHandlerTest.php
CHANGED
@@ -85,6 +85,34 @@ class RavenHandlerTest extends TestCase
|
|
85 |
$this->assertEquals($tags, $ravenClient->lastData['tags']);
|
86 |
}
|
87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
public function testUserContext()
|
89 |
{
|
90 |
$ravenClient = $this->getRavenClient();
|
@@ -95,7 +123,7 @@ class RavenHandlerTest extends TestCase
|
|
95 |
|
96 |
$user = array(
|
97 |
'id' => '123',
|
98 |
-
'email' => 'test@test.com'
|
99 |
);
|
100 |
|
101 |
$recordWithContext = $this->getRecord(Logger::INFO, 'test', array('user' => $user));
|
@@ -103,7 +131,7 @@ class RavenHandlerTest extends TestCase
|
|
103 |
$ravenClient->user_context(array('id' => 'test_user_id'));
|
104 |
// handle context
|
105 |
$handler->handle($recordWithContext);
|
106 |
-
$this->assertEquals($user, $ravenClient->lastData['
|
107 |
|
108 |
// check to see if its reset
|
109 |
$handler->handle($recordWithNoContext);
|
@@ -113,7 +141,7 @@ class RavenHandlerTest extends TestCase
|
|
113 |
// handle with null context
|
114 |
$ravenClient->user_context(null);
|
115 |
$handler->handle($recordWithContext);
|
116 |
-
$this->assertEquals($user, $ravenClient->lastData['
|
117 |
|
118 |
// check to see if its reset
|
119 |
$handler->handle($recordWithNoContext);
|
@@ -169,6 +197,32 @@ class RavenHandlerTest extends TestCase
|
|
169 |
$handler->handleBatch($records);
|
170 |
}
|
171 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
public function testGetSetBatchFormatter()
|
173 |
{
|
174 |
$ravenClient = $this->getRavenClient();
|
@@ -178,6 +232,22 @@ class RavenHandlerTest extends TestCase
|
|
178 |
$this->assertSame($formatter, $handler->getBatchFormatter());
|
179 |
}
|
180 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
private function methodThatThrowsAnException()
|
182 |
{
|
183 |
throw new \Exception('This is an exception');
|
85 |
$this->assertEquals($tags, $ravenClient->lastData['tags']);
|
86 |
}
|
87 |
|
88 |
+
public function testExtraParameters()
|
89 |
+
{
|
90 |
+
$ravenClient = $this->getRavenClient();
|
91 |
+
$handler = $this->getHandler($ravenClient);
|
92 |
+
|
93 |
+
$checksum = '098f6bcd4621d373cade4e832627b4f6';
|
94 |
+
$release = '05a671c66aefea124cc08b76ea6d30bb';
|
95 |
+
$eventId = '31423';
|
96 |
+
$record = $this->getRecord(Logger::INFO, 'test', array('checksum' => $checksum, 'release' => $release, 'event_id' => $eventId));
|
97 |
+
$handler->handle($record);
|
98 |
+
|
99 |
+
$this->assertEquals($checksum, $ravenClient->lastData['checksum']);
|
100 |
+
$this->assertEquals($release, $ravenClient->lastData['release']);
|
101 |
+
$this->assertEquals($eventId, $ravenClient->lastData['event_id']);
|
102 |
+
}
|
103 |
+
|
104 |
+
public function testFingerprint()
|
105 |
+
{
|
106 |
+
$ravenClient = $this->getRavenClient();
|
107 |
+
$handler = $this->getHandler($ravenClient);
|
108 |
+
|
109 |
+
$fingerprint = array('{{ default }}', 'other value');
|
110 |
+
$record = $this->getRecord(Logger::INFO, 'test', array('fingerprint' => $fingerprint));
|
111 |
+
$handler->handle($record);
|
112 |
+
|
113 |
+
$this->assertEquals($fingerprint, $ravenClient->lastData['fingerprint']);
|
114 |
+
}
|
115 |
+
|
116 |
public function testUserContext()
|
117 |
{
|
118 |
$ravenClient = $this->getRavenClient();
|
123 |
|
124 |
$user = array(
|
125 |
'id' => '123',
|
126 |
+
'email' => 'test@test.com',
|
127 |
);
|
128 |
|
129 |
$recordWithContext = $this->getRecord(Logger::INFO, 'test', array('user' => $user));
|
131 |
$ravenClient->user_context(array('id' => 'test_user_id'));
|
132 |
// handle context
|
133 |
$handler->handle($recordWithContext);
|
134 |
+
$this->assertEquals($user, $ravenClient->lastData['user']);
|
135 |
|
136 |
// check to see if its reset
|
137 |
$handler->handle($recordWithNoContext);
|
141 |
// handle with null context
|
142 |
$ravenClient->user_context(null);
|
143 |
$handler->handle($recordWithContext);
|
144 |
+
$this->assertEquals($user, $ravenClient->lastData['user']);
|
145 |
|
146 |
// check to see if its reset
|
147 |
$handler->handle($recordWithNoContext);
|
197 |
$handler->handleBatch($records);
|
198 |
}
|
199 |
|
200 |
+
public function testHandleBatchPicksProperMessage()
|
201 |
+
{
|
202 |
+
$records = array(
|
203 |
+
$this->getRecord(Logger::DEBUG, 'debug message 1'),
|
204 |
+
$this->getRecord(Logger::DEBUG, 'debug message 2'),
|
205 |
+
$this->getRecord(Logger::INFO, 'information 1'),
|
206 |
+
$this->getRecord(Logger::ERROR, 'error 1'),
|
207 |
+
$this->getRecord(Logger::WARNING, 'warning'),
|
208 |
+
$this->getRecord(Logger::ERROR, 'error 2'),
|
209 |
+
$this->getRecord(Logger::INFO, 'information 2'),
|
210 |
+
);
|
211 |
+
|
212 |
+
$logFormatter = $this->getMock('Monolog\\Formatter\\FormatterInterface');
|
213 |
+
$logFormatter->expects($this->once())->method('formatBatch');
|
214 |
+
|
215 |
+
$formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface');
|
216 |
+
$formatter->expects($this->once())->method('format')->with($this->callback(function ($record) use ($records) {
|
217 |
+
return $record['message'] == 'error 1';
|
218 |
+
}));
|
219 |
+
|
220 |
+
$handler = $this->getHandler($this->getRavenClient());
|
221 |
+
$handler->setBatchFormatter($logFormatter);
|
222 |
+
$handler->setFormatter($formatter);
|
223 |
+
$handler->handleBatch($records);
|
224 |
+
}
|
225 |
+
|
226 |
public function testGetSetBatchFormatter()
|
227 |
{
|
228 |
$ravenClient = $this->getRavenClient();
|
232 |
$this->assertSame($formatter, $handler->getBatchFormatter());
|
233 |
}
|
234 |
|
235 |
+
public function testRelease()
|
236 |
+
{
|
237 |
+
$ravenClient = $this->getRavenClient();
|
238 |
+
$handler = $this->getHandler($ravenClient);
|
239 |
+
$release = 'v42.42.42';
|
240 |
+
$handler->setRelease($release);
|
241 |
+
$record = $this->getRecord(Logger::INFO, 'test');
|
242 |
+
$handler->handle($record);
|
243 |
+
$this->assertEquals($release, $ravenClient->lastData['release']);
|
244 |
+
|
245 |
+
$localRelease = 'v41.41.41';
|
246 |
+
$record = $this->getRecord(Logger::INFO, 'test', array('release' => $localRelease));
|
247 |
+
$handler->handle($record);
|
248 |
+
$this->assertEquals($localRelease, $ravenClient->lastData['release']);
|
249 |
+
}
|
250 |
+
|
251 |
private function methodThatThrowsAnException()
|
252 |
{
|
253 |
throw new \Exception('This is an exception');
|
vendor/monolog/monolog/tests/Monolog/Handler/RedisHandlerTest.php
CHANGED
@@ -71,7 +71,7 @@ class RedisHandlerTest extends TestCase
|
|
71 |
|
72 |
public function testRedisHandleCapped()
|
73 |
{
|
74 |
-
$redis = $this->getMock('Redis', array('multi', 'rpush', 'ltrim', '
|
75 |
|
76 |
// Redis uses multi
|
77 |
$redis->expects($this->once())
|
@@ -87,7 +87,7 @@ class RedisHandlerTest extends TestCase
|
|
87 |
->will($this->returnSelf());
|
88 |
|
89 |
$redis->expects($this->once())
|
90 |
-
->method('
|
91 |
->will($this->returnSelf());
|
92 |
|
93 |
$record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34));
|
71 |
|
72 |
public function testRedisHandleCapped()
|
73 |
{
|
74 |
+
$redis = $this->getMock('Redis', array('multi', 'rpush', 'ltrim', 'exec'));
|
75 |
|
76 |
// Redis uses multi
|
77 |
$redis->expects($this->once())
|
87 |
->will($this->returnSelf());
|
88 |
|
89 |
$redis->expects($this->once())
|
90 |
+
->method('exec')
|
91 |
->will($this->returnSelf());
|
92 |
|
93 |
$record = $this->getRecord(Logger::WARNING, 'test', array('data' => new \stdClass, 'foo' => 34));
|
vendor/monolog/monolog/tests/Monolog/Handler/RollbarHandlerTest.php
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Monolog package.
|
5 |
+
*
|
6 |
+
* (c) Jordi Boggiano <j.boggiano@seld.be>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Monolog\Handler;
|
13 |
+
|
14 |
+
use Exception;
|
15 |
+
use Monolog\TestCase;
|
16 |
+
use Monolog\Logger;
|
17 |
+
use PHPUnit_Framework_MockObject_MockObject as MockObject;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @author Erik Johansson <erik.pm.johansson@gmail.com>
|
21 |
+
* @see https://rollbar.com/docs/notifier/rollbar-php/
|
22 |
+
*
|
23 |
+
* @coversDefaultClass Monolog\Handler\RollbarHandler
|
24 |
+
*/
|
25 |
+
class RollbarHandlerTest extends TestCase
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* @var MockObject
|
29 |
+
*/
|
30 |
+
private $rollbarNotifier;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @var array
|
34 |
+
*/
|
35 |
+
public $reportedExceptionArguments = null;
|
36 |
+
|
37 |
+
protected function setUp()
|
38 |
+
{
|
39 |
+
parent::setUp();
|
40 |
+
|
41 |
+
$this->setupRollbarNotifierMock();
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* When reporting exceptions to Rollbar the
|
46 |
+
* level has to be set in the payload data
|
47 |
+
*/
|
48 |
+
public function testExceptionLogLevel()
|
49 |
+
{
|
50 |
+
$handler = $this->createHandler();
|
51 |
+
|
52 |
+
$handler->handle($this->createExceptionRecord(Logger::DEBUG));
|
53 |
+
|
54 |
+
$this->assertEquals('debug', $this->reportedExceptionArguments['payload']['level']);
|
55 |
+
}
|
56 |
+
|
57 |
+
private function setupRollbarNotifierMock()
|
58 |
+
{
|
59 |
+
$this->rollbarNotifier = $this->getMockBuilder('RollbarNotifier')
|
60 |
+
->setMethods(array('report_message', 'report_exception', 'flush'))
|
61 |
+
->getMock();
|
62 |
+
|
63 |
+
$that = $this;
|
64 |
+
|
65 |
+
$this->rollbarNotifier
|
66 |
+
->expects($this->any())
|
67 |
+
->method('report_exception')
|
68 |
+
->willReturnCallback(function ($exception, $context, $payload) use ($that) {
|
69 |
+
$that->reportedExceptionArguments = compact('exception', 'context', 'payload');
|
70 |
+
});
|
71 |
+
}
|
72 |
+
|
73 |
+
private function createHandler()
|
74 |
+
{
|
75 |
+
return new RollbarHandler($this->rollbarNotifier, Logger::DEBUG);
|
76 |
+
}
|
77 |
+
|
78 |
+
private function createExceptionRecord($level = Logger::DEBUG, $message = 'test', $exception = null)
|
79 |
+
{
|
80 |
+
return $this->getRecord($level, $message, array(
|
81 |
+
'exception' => $exception ?: new Exception()
|
82 |
+
));
|
83 |
+
}
|
84 |
+
}
|
vendor/monolog/monolog/tests/Monolog/Handler/RotatingFileHandlerTest.php
CHANGED
@@ -12,19 +12,52 @@
|
|
12 |
namespace Monolog\Handler;
|
13 |
|
14 |
use Monolog\TestCase;
|
|
|
15 |
|
16 |
/**
|
17 |
* @covers Monolog\Handler\RotatingFileHandler
|
18 |
*/
|
19 |
class RotatingFileHandlerTest extends TestCase
|
20 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
public function setUp()
|
22 |
{
|
23 |
$dir = __DIR__.'/Fixtures';
|
24 |
chmod($dir, 0777);
|
25 |
if (!is_writable($dir)) {
|
26 |
-
$this->markTestSkipped($dir.' must be
|
27 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
}
|
29 |
|
30 |
public function testRotationCreatesNewFile()
|
@@ -43,14 +76,14 @@ class RotatingFileHandlerTest extends TestCase
|
|
43 |
/**
|
44 |
* @dataProvider rotationTests
|
45 |
*/
|
46 |
-
public function testRotation($createFile)
|
47 |
{
|
48 |
-
touch($old1 = __DIR__.'/Fixtures/foo-'.date(
|
49 |
-
touch($old2 = __DIR__.'/Fixtures/foo-'.date(
|
50 |
-
touch($old3 = __DIR__.'/Fixtures/foo-'.date(
|
51 |
-
touch($old4 = __DIR__.'/Fixtures/foo-'.date(
|
52 |
|
53 |
-
$log = __DIR__.'/Fixtures/foo-'.date(
|
54 |
|
55 |
if ($createFile) {
|
56 |
touch($log);
|
@@ -58,6 +91,7 @@ class RotatingFileHandlerTest extends TestCase
|
|
58 |
|
59 |
$handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot', 2);
|
60 |
$handler->setFormatter($this->getIdentityFormatter());
|
|
|
61 |
$handler->handle($this->getRecord());
|
62 |
|
63 |
$handler->close();
|
@@ -72,11 +106,88 @@ class RotatingFileHandlerTest extends TestCase
|
|
72 |
|
73 |
public function rotationTests()
|
74 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
return array(
|
76 |
'Rotation is triggered when the file of the current day is not present'
|
77 |
-
=> array(true),
|
78 |
-
'Rotation is not triggered when the file is already present'
|
79 |
-
=> array(false),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
);
|
81 |
}
|
82 |
|
@@ -95,5 +206,6 @@ class RotatingFileHandlerTest extends TestCase
|
|
95 |
foreach (glob(__DIR__.'/Fixtures/*.rot') as $file) {
|
96 |
unlink($file);
|
97 |
}
|
|
|
98 |
}
|
99 |
}
|
12 |
namespace Monolog\Handler;
|
13 |
|
14 |
use Monolog\TestCase;
|
15 |
+
use PHPUnit_Framework_Error_Deprecated;
|
16 |
|
17 |
/**
|
18 |
* @covers Monolog\Handler\RotatingFileHandler
|
19 |
*/
|
20 |
class RotatingFileHandlerTest extends TestCase
|
21 |
{
|
22 |
+
/**
|
23 |
+
* This var should be private but then the anonymous function
|
24 |
+
* in the `setUp` method won't be able to set it. `$this` cant't
|
25 |
+
* be used in the anonymous function in `setUp` because PHP 5.3
|
26 |
+
* does not support it.
|
27 |
+
*/
|
28 |
+
public $lastError;
|
29 |
+
|
30 |
public function setUp()
|
31 |
{
|
32 |
$dir = __DIR__.'/Fixtures';
|
33 |
chmod($dir, 0777);
|
34 |
if (!is_writable($dir)) {
|
35 |
+
$this->markTestSkipped($dir.' must be writable to test the RotatingFileHandler.');
|
36 |
}
|
37 |
+
$this->lastError = null;
|
38 |
+
$self = $this;
|
39 |
+
// workaround with &$self used for PHP 5.3
|
40 |
+
set_error_handler(function($code, $message) use (&$self) {
|
41 |
+
$self->lastError = array(
|
42 |
+
'code' => $code,
|
43 |
+
'message' => $message,
|
44 |
+
);
|
45 |
+
});
|
46 |
+
}
|
47 |
+
|
48 |
+
private function assertErrorWasTriggered($code, $message)
|
49 |
+
{
|
50 |
+
if (empty($this->lastError)) {
|
51 |
+
$this->fail(
|
52 |
+
sprintf(
|
53 |
+
'Failed asserting that error with code `%d` and message `%s` was triggered',
|
54 |
+
$code,
|
55 |
+
$message
|
56 |
+
)
|
57 |
+
);
|
58 |
+
}
|
59 |
+
$this->assertEquals($code, $this->lastError['code'], sprintf('Expected an error with code %d to be triggered, got `%s` instead', $code, $this->lastError['code']));
|
60 |
+
$this->assertEquals($message, $this->lastError['message'], sprintf('Expected an error with message `%d` to be triggered, got `%s` instead', $message, $this->lastError['message']));
|
61 |
}
|
62 |
|
63 |
public function testRotationCreatesNewFile()
|
76 |
/**
|
77 |
* @dataProvider rotationTests
|
78 |
*/
|
79 |
+
public function testRotation($createFile, $dateFormat, $timeCallback)
|
80 |
{
|
81 |
+
touch($old1 = __DIR__.'/Fixtures/foo-'.date($dateFormat, $timeCallback(-1)).'.rot');
|
82 |
+
touch($old2 = __DIR__.'/Fixtures/foo-'.date($dateFormat, $timeCallback(-2)).'.rot');
|
83 |
+
touch($old3 = __DIR__.'/Fixtures/foo-'.date($dateFormat, $timeCallback(-3)).'.rot');
|
84 |
+
touch($old4 = __DIR__.'/Fixtures/foo-'.date($dateFormat, $timeCallback(-4)).'.rot');
|
85 |
|
86 |
+
$log = __DIR__.'/Fixtures/foo-'.date($dateFormat).'.rot';
|
87 |
|
88 |
if ($createFile) {
|
89 |
touch($log);
|
91 |
|
92 |
$handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot', 2);
|
93 |
$handler->setFormatter($this->getIdentityFormatter());
|
94 |
+
$handler->setFilenameFormat('{filename}-{date}', $dateFormat);
|
95 |
$handler->handle($this->getRecord());
|
96 |
|
97 |
$handler->close();
|
106 |
|
107 |
public function rotationTests()
|
108 |
{
|
109 |
+
$now = time();
|
110 |
+
$dayCallback = function($ago) use ($now) {
|
111 |
+
return $now + 86400 * $ago;
|
112 |
+
};
|
113 |
+
$monthCallback = function($ago) {
|
114 |
+
return gmmktime(0, 0, 0, date('n') + $ago, 1, date('Y'));
|
115 |
+
};
|
116 |
+
$yearCallback = function($ago) {
|
117 |
+
return gmmktime(0, 0, 0, 1, 1, date('Y') + $ago);
|
118 |
+
};
|
119 |
+
|
120 |
return array(
|
121 |
'Rotation is triggered when the file of the current day is not present'
|
122 |
+
=> array(true, RotatingFileHandler::FILE_PER_DAY, $dayCallback),
|
123 |
+
'Rotation is not triggered when the file of the current day is already present'
|
124 |
+
=> array(false, RotatingFileHandler::FILE_PER_DAY, $dayCallback),
|
125 |
+
|
126 |
+
'Rotation is triggered when the file of the current month is not present'
|
127 |
+
=> array(true, RotatingFileHandler::FILE_PER_MONTH, $monthCallback),
|
128 |
+
'Rotation is not triggered when the file of the current month is already present'
|
129 |
+
=> array(false, RotatingFileHandler::FILE_PER_MONTH, $monthCallback),
|
130 |
+
|
131 |
+
'Rotation is triggered when the file of the current year is not present'
|
132 |
+
=> array(true, RotatingFileHandler::FILE_PER_YEAR, $yearCallback),
|
133 |
+
'Rotation is not triggered when the file of the current year is already present'
|
134 |
+
=> array(false, RotatingFileHandler::FILE_PER_YEAR, $yearCallback),
|
135 |
+
);
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* @dataProvider dateFormatProvider
|
140 |
+
*/
|
141 |
+
public function testAllowOnlyFixedDefinedDateFormats($dateFormat, $valid)
|
142 |
+
{
|
143 |
+
$handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot', 2);
|
144 |
+
$handler->setFilenameFormat('{filename}-{date}', $dateFormat);
|
145 |
+
if (!$valid) {
|
146 |
+
$this->assertErrorWasTriggered(
|
147 |
+
E_USER_DEPRECATED,
|
148 |
+
'Invalid date format - format must be one of RotatingFileHandler::FILE_PER_DAY ("Y-m-d"), '.
|
149 |
+
'RotatingFileHandler::FILE_PER_MONTH ("Y-m") or RotatingFileHandler::FILE_PER_YEAR ("Y"), '.
|
150 |
+
'or you can set one of the date formats using slashes, underscores and/or dots instead of dashes.'
|
151 |
+
);
|
152 |
+
}
|
153 |
+
}
|
154 |
+
|
155 |
+
public function dateFormatProvider()
|
156 |
+
{
|
157 |
+
return array(
|
158 |
+
array(RotatingFileHandler::FILE_PER_DAY, true),
|
159 |
+
array(RotatingFileHandler::FILE_PER_MONTH, true),
|
160 |
+
array(RotatingFileHandler::FILE_PER_YEAR, true),
|
161 |
+
array('m-d-Y', false),
|
162 |
+
array('Y-m-d-h-i', false)
|
163 |
+
);
|
164 |
+
}
|
165 |
+
|
166 |
+
/**
|
167 |
+
* @dataProvider filenameFormatProvider
|
168 |
+
*/
|
169 |
+
public function testDisallowFilenameFormatsWithoutDate($filenameFormat, $valid)
|
170 |
+
{
|
171 |
+
$handler = new RotatingFileHandler(__DIR__.'/Fixtures/foo.rot', 2);
|
172 |
+
$handler->setFilenameFormat($filenameFormat, RotatingFileHandler::FILE_PER_DAY);
|
173 |
+
if (!$valid) {
|
174 |
+
$this->assertErrorWasTriggered(
|
175 |
+
E_USER_DEPRECATED,
|
176 |
+
'Invalid filename format - format should contain at least `{date}`, because otherwise rotating is impossible.'
|
177 |
+
);
|
178 |
+
}
|
179 |
+
}
|
180 |
+
|
181 |
+
public function filenameFormatProvider()
|
182 |
+
{
|
183 |
+
return array(
|
184 |
+
array('{filename}', false),
|
185 |
+
array('{filename}-{date}', true),
|
186 |
+
array('{date}', true),
|
187 |
+
array('foobar-{date}', true),
|
188 |
+
array('foo-{date}-bar', true),
|
189 |
+
array('{date}-foobar', true),
|
190 |
+
array('foobar', false),
|
191 |
);
|
192 |
}
|
193 |
|
206 |
foreach (glob(__DIR__.'/Fixtures/*.rot') as $file) {
|
207 |
unlink($file);
|
208 |
}
|
209 |
+
restore_error_handler();
|
210 |
}
|
211 |
}
|
vendor/monolog/monolog/tests/Monolog/Handler/Slack/SlackRecordTest.php
ADDED
@@ -0,0 +1,387 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Monolog package.
|
5 |
+
*
|
6 |
+
* (c) Jordi Boggiano <j.boggiano@seld.be>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Monolog\Handler\Slack;
|
13 |
+
|
14 |
+
use Monolog\Logger;
|
15 |
+
use Monolog\TestCase;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @coversDefaultClass Monolog\Handler\Slack\SlackRecord
|
19 |
+
*/
|
20 |
+
class SlackRecordTest extends TestCase
|
21 |
+
{
|
22 |
+
private $jsonPrettyPrintFlag;
|
23 |
+
|
24 |
+
protected function setUp()
|
25 |
+
{
|
26 |
+
$this->jsonPrettyPrintFlag = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 128;
|
27 |
+
}
|
28 |
+
|
29 |
+
public function dataGetAttachmentColor()
|
30 |
+
{
|
31 |
+
return array(
|
32 |
+
array(Logger::DEBUG, SlackRecord::COLOR_DEFAULT),
|
33 |
+
array(Logger::INFO, SlackRecord::COLOR_GOOD),
|
34 |
+
array(Logger::NOTICE, SlackRecord::COLOR_GOOD),
|
35 |
+
array(Logger::WARNING, SlackRecord::COLOR_WARNING),
|
36 |
+
array(Logger::ERROR, SlackRecord::COLOR_DANGER),
|
37 |
+
array(Logger::CRITICAL, SlackRecord::COLOR_DANGER),
|
38 |
+
array(Logger::ALERT, SlackRecord::COLOR_DANGER),
|
39 |
+
array(Logger::EMERGENCY, SlackRecord::COLOR_DANGER),
|
40 |
+
);
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @dataProvider dataGetAttachmentColor
|
45 |
+
* @param int $logLevel
|
46 |
+
* @param string $expectedColour RGB hex color or name of Slack color
|
47 |
+
* @covers ::getAttachmentColor
|
48 |
+
*/
|
49 |
+
public function testGetAttachmentColor($logLevel, $expectedColour)
|
50 |
+
{
|
51 |
+
$slackRecord = new SlackRecord();
|
52 |
+
$this->assertSame(
|
53 |
+
$expectedColour,
|
54 |
+
$slackRecord->getAttachmentColor($logLevel)
|
55 |
+
);
|
56 |
+
}
|
57 |
+
|
58 |
+
public function testAddsChannel()
|
59 |
+
{
|
60 |
+
$channel = '#test';
|
61 |
+
$record = new SlackRecord($channel);
|
62 |
+
$data = $record->getSlackData($this->getRecord());
|
63 |
+
|
64 |
+
$this->assertArrayHasKey('channel', $data);
|
65 |
+
$this->assertSame($channel, $data['channel']);
|
66 |
+
}
|
67 |
+
|
68 |
+
public function testNoUsernameByDefault()
|
69 |
+
{
|
70 |
+
$record = new SlackRecord();
|
71 |
+
$data = $record->getSlackData($this->getRecord());
|
72 |
+
|
73 |
+
$this->assertArrayNotHasKey('username', $data);
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* @return array
|
78 |
+
*/
|
79 |
+
public function dataStringify()
|
80 |
+
{
|
81 |
+
$jsonPrettyPrintFlag = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 128;
|
82 |
+
|
83 |
+
$multipleDimensions = array(array(1, 2));
|
84 |
+
$numericKeys = array('library' => 'monolog');
|
85 |
+
$singleDimension = array(1, 'Hello', 'Jordi');
|
86 |
+
|
87 |
+
return array(
|
88 |
+
array(array(), '[]'),
|
89 |
+
array($multipleDimensions, json_encode($multipleDimensions, $jsonPrettyPrintFlag)),
|
90 |
+
array($numericKeys, json_encode($numericKeys, $jsonPrettyPrintFlag)),
|
91 |
+
array($singleDimension, json_encode($singleDimension))
|
92 |
+
);
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* @dataProvider dataStringify
|
97 |
+
*/
|
98 |
+
public function testStringify($fields, $expectedResult)
|
99 |
+
{
|
100 |
+
$slackRecord = new SlackRecord(
|
101 |
+
'#test',
|
102 |
+
'test',
|
103 |
+
true,
|
104 |
+
null,
|
105 |
+
true,
|
106 |
+
true
|
107 |
+
);
|
108 |
+
|
109 |
+
$this->assertSame($expectedResult, $slackRecord->stringify($fields));
|
110 |
+
}
|
111 |
+
|
112 |
+
public function testAddsCustomUsername()
|
113 |
+
{
|
114 |
+
$username = 'Monolog bot';
|
115 |
+
$record = new SlackRecord(null, $username);
|
116 |
+
$data = $record->getSlackData($this->getRecord());
|
117 |
+
|
118 |
+
$this->assertArrayHasKey('username', $data);
|
119 |
+
$this->assertSame($username, $data['username']);
|
120 |
+
}
|
121 |
+
|
122 |
+
public function testNoIcon()
|
123 |
+
{
|
124 |
+
$record = new SlackRecord();
|
125 |
+
$data = $record->getSlackData($this->getRecord());
|
126 |
+
|
127 |
+
$this->assertArrayNotHasKey('icon_emoji', $data);
|
128 |
+
}
|
129 |
+
|
130 |
+
public function testAddsIcon()
|
131 |
+
{
|
132 |
+
$record = $this->getRecord();
|
133 |
+
$slackRecord = new SlackRecord(null, null, false, 'ghost');
|
134 |
+
$data = $slackRecord->getSlackData($record);
|
135 |
+
|
136 |
+
$slackRecord2 = new SlackRecord(null, null, false, 'http://github.com/Seldaek/monolog');
|
137 |
+
$data2 = $slackRecord2->getSlackData($record);
|
138 |
+
|
139 |
+
$this->assertArrayHasKey('icon_emoji', $data);
|
140 |
+
$this->assertSame(':ghost:', $data['icon_emoji']);
|
141 |
+
$this->assertArrayHasKey('icon_url', $data2);
|
142 |
+
$this->assertSame('http://github.com/Seldaek/monolog', $data2['icon_url']);
|
143 |
+
}
|
144 |
+
|
145 |
+
public function testAttachmentsNotPresentIfNoAttachment()
|
146 |
+
{
|
147 |
+
$record = new SlackRecord(null, null, false);
|
148 |
+
$data = $record->getSlackData($this->getRecord());
|
149 |
+
|
150 |
+
$this->assertArrayNotHasKey('attachments', $data);
|
151 |
+
}
|
152 |
+
|
153 |
+
public function testAddsOneAttachment()
|
154 |
+
{
|
155 |
+
$record = new SlackRecord();
|
156 |
+
$data = $record->getSlackData($this->getRecord());
|
157 |
+
|
158 |
+
$this->assertArrayHasKey('attachments', $data);
|
159 |
+
$this->assertArrayHasKey(0, $data['attachments']);
|
160 |
+
$this->assertInternalType('array', $data['attachments'][0]);
|
161 |
+
}
|
162 |
+
|
163 |
+
public function testTextEqualsMessageIfNoAttachment()
|
164 |
+
{
|
165 |
+
$message = 'Test message';
|
166 |
+
$record = new SlackRecord(null, null, false);
|
167 |
+
$data = $record->getSlackData($this->getRecord(Logger::WARNING, $message));
|
168 |
+
|
169 |
+
$this->assertArrayHasKey('text', $data);
|
170 |
+
$this->assertSame($message, $data['text']);
|
171 |
+
}
|
172 |
+
|
173 |
+
public function testTextEqualsFormatterOutput()
|
174 |
+
{
|
175 |
+
$formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface');
|
176 |
+
$formatter
|
177 |
+
->expects($this->any())
|
178 |
+
->method('format')
|
179 |
+
->will($this->returnCallback(function ($record) { return $record['message'] . 'test'; }));
|
180 |
+
|
181 |
+
$formatter2 = $this->getMock('Monolog\\Formatter\\FormatterInterface');
|
182 |
+
$formatter2
|
183 |
+
->expects($this->any())
|
184 |
+
->method('format')
|
185 |
+
->will($this->returnCallback(function ($record) { return $record['message'] . 'test1'; }));
|
186 |
+
|
187 |
+
$message = 'Test message';
|
188 |
+
$record = new SlackRecord(null, null, false, null, false, false, array(), $formatter);
|
189 |
+
$data = $record->getSlackData($this->getRecord(Logger::WARNING, $message));
|
190 |
+
|
191 |
+
$this->assertArrayHasKey('text', $data);
|
192 |
+
$this->assertSame($message . 'test', $data['text']);
|
193 |
+
|
194 |
+
$record->setFormatter($formatter2);
|
195 |
+
$data = $record->getSlackData($this->getRecord(Logger::WARNING, $message));
|
196 |
+
|
197 |
+
$this->assertArrayHasKey('text', $data);
|
198 |
+
$this->assertSame($message . 'test1', $data['text']);
|
199 |
+
}
|
200 |
+
|
201 |
+
public function testAddsFallbackAndTextToAttachment()
|
202 |
+
{
|
203 |
+
$message = 'Test message';
|
204 |
+
$record = new SlackRecord(null);
|
205 |
+
$data = $record->getSlackData($this->getRecord(Logger::WARNING, $message));
|
206 |
+
|
207 |
+
$this->assertSame($message, $data['attachments'][0]['text']);
|
208 |
+
$this->assertSame($message, $data['attachments'][0]['fallback']);
|
209 |
+
}
|
210 |
+
|
211 |
+
public function testMapsLevelToColorAttachmentColor()
|
212 |
+
{
|
213 |
+
$record = new SlackRecord(null);
|
214 |
+
$errorLoggerRecord = $this->getRecord(Logger::ERROR);
|
215 |
+
$emergencyLoggerRecord = $this->getRecord(Logger::EMERGENCY);
|
216 |
+
$warningLoggerRecord = $this->getRecord(Logger::WARNING);
|
217 |
+
$infoLoggerRecord = $this->getRecord(Logger::INFO);
|
218 |
+
$debugLoggerRecord = $this->getRecord(Logger::DEBUG);
|
219 |
+
|
220 |
+
$data = $record->getSlackData($errorLoggerRecord);
|
221 |
+
$this->assertSame(SlackRecord::COLOR_DANGER, $data['attachments'][0]['color']);
|
222 |
+
|
223 |
+
$data = $record->getSlackData($emergencyLoggerRecord);
|
224 |
+
$this->assertSame(SlackRecord::COLOR_DANGER, $data['attachments'][0]['color']);
|
225 |
+
|
226 |
+
$data = $record->getSlackData($warningLoggerRecord);
|
227 |
+
$this->assertSame(SlackRecord::COLOR_WARNING, $data['attachments'][0]['color']);
|
228 |
+
|
229 |
+
$data = $record->getSlackData($infoLoggerRecord);
|
230 |
+
$this->assertSame(SlackRecord::COLOR_GOOD, $data['attachments'][0]['color']);
|
231 |
+
|
232 |
+
$data = $record->getSlackData($debugLoggerRecord);
|
233 |
+
$this->assertSame(SlackRecord::COLOR_DEFAULT, $data['attachments'][0]['color']);
|
234 |
+
}
|
235 |
+
|
236 |
+
public function testAddsShortAttachmentWithoutContextAndExtra()
|
237 |
+
{
|
238 |
+
$level = Logger::ERROR;
|
239 |
+
$levelName = Logger::getLevelName($level);
|
240 |
+
$record = new SlackRecord(null, null, true, null, true);
|
241 |
+
$data = $record->getSlackData($this->getRecord($level, 'test', array('test' => 1)));
|
242 |
+
|
243 |
+
$attachment = $data['attachments'][0];
|
244 |
+
$this->assertArrayHasKey('title', $attachment);
|
245 |
+
$this->assertArrayHasKey('fields', $attachment);
|
246 |
+
$this->assertSame($levelName, $attachment['title']);
|
247 |
+
$this->assertSame(array(), $attachment['fields']);
|
248 |
+
}
|
249 |
+
|
250 |
+
public function testAddsShortAttachmentWithContextAndExtra()
|
251 |
+
{
|
252 |
+
$level = Logger::ERROR;
|
253 |
+
$levelName = Logger::getLevelName($level);
|
254 |
+
$context = array('test' => 1);
|
255 |
+
$extra = array('tags' => array('web'));
|
256 |
+
$record = new SlackRecord(null, null, true, null, true, true);
|
257 |
+
$loggerRecord = $this->getRecord($level, 'test', $context);
|
258 |
+
$loggerRecord['extra'] = $extra;
|
259 |
+
$data = $record->getSlackData($loggerRecord);
|
260 |
+
|
261 |
+
$attachment = $data['attachments'][0];
|
262 |
+
$this->assertArrayHasKey('title', $attachment);
|
263 |
+
$this->assertArrayHasKey('fields', $attachment);
|
264 |
+
$this->assertCount(2, $attachment['fields']);
|
265 |
+
$this->assertSame($levelName, $attachment['title']);
|
266 |
+
$this->assertSame(
|
267 |
+
array(
|
268 |
+
array(
|
269 |
+
'title' => 'Extra',
|
270 |
+
'value' => sprintf('```%s```', json_encode($extra, $this->jsonPrettyPrintFlag)),
|
271 |
+
'short' => false
|
272 |
+
),
|
273 |
+
array(
|
274 |
+
'title' => 'Context',
|
275 |
+
'value' => sprintf('```%s```', json_encode($context, $this->jsonPrettyPrintFlag)),
|
276 |
+
'short' => false
|
277 |
+
)
|
278 |
+
),
|
279 |
+
$attachment['fields']
|
280 |
+
);
|
281 |
+
}
|
282 |
+
|
283 |
+
public function testAddsLongAttachmentWithoutContextAndExtra()
|
284 |
+
{
|
285 |
+
$level = Logger::ERROR;
|
286 |
+
$levelName = Logger::getLevelName($level);
|
287 |
+
$record = new SlackRecord(null, null, true, null);
|
288 |
+
$data = $record->getSlackData($this->getRecord($level, 'test', array('test' => 1)));
|
289 |
+
|
290 |
+
$attachment = $data['attachments'][0];
|
291 |
+
$this->assertArrayHasKey('title', $attachment);
|
292 |
+
$this->assertArrayHasKey('fields', $attachment);
|
293 |
+
$this->assertCount(1, $attachment['fields']);
|
294 |
+
$this->assertSame('Message', $attachment['title']);
|
295 |
+
$this->assertSame(
|
296 |
+
array(array(
|
297 |
+
'title' => 'Level',
|
298 |
+
'value' => $levelName,
|
299 |
+
'short' => false
|
300 |
+
)),
|
301 |
+
$attachment['fields']
|
302 |
+
);
|
303 |
+
}
|
304 |
+
|
305 |
+
public function testAddsLongAttachmentWithContextAndExtra()
|
306 |
+
{
|
307 |
+
$level = Logger::ERROR;
|
308 |
+
$levelName = Logger::getLevelName($level);
|
309 |
+
$context = array('test' => 1);
|
310 |
+
$extra = array('tags' => array('web'));
|
311 |
+
$record = new SlackRecord(null, null, true, null, false, true);
|
312 |
+
$loggerRecord = $this->getRecord($level, 'test', $context);
|
313 |
+
$loggerRecord['extra'] = $extra;
|
314 |
+
$data = $record->getSlackData($loggerRecord);
|
315 |
+
|
316 |
+
$expectedFields = array(
|
317 |
+
array(
|
318 |
+
'title' => 'Level',
|
319 |
+
'value' => $levelName,
|
320 |
+
'short' => false,
|
321 |
+
),
|
322 |
+
array(
|
323 |
+
'title' => 'tags',
|
324 |
+
'value' => sprintf('```%s```', json_encode($extra['tags'])),
|
325 |
+
'short' => false
|
326 |
+
),
|
327 |
+
array(
|
328 |
+
'title' => 'test',
|
329 |
+
'value' => $context['test'],
|
330 |
+
'short' => false
|
331 |
+
)
|
332 |
+
);
|
333 |
+
|
334 |
+
$attachment = $data['attachments'][0];
|
335 |
+
$this->assertArrayHasKey('title', $attachment);
|
336 |
+
$this->assertArrayHasKey('fields', $attachment);
|
337 |
+
$this->assertCount(3, $attachment['fields']);
|
338 |
+
$this->assertSame('Message', $attachment['title']);
|
339 |
+
$this->assertSame(
|
340 |
+
$expectedFields,
|
341 |
+
$attachment['fields']
|
342 |
+
);
|
343 |
+
}
|
344 |
+
|
345 |
+
public function testAddsTimestampToAttachment()
|
346 |
+
{
|
347 |
+
$record = $this->getRecord();
|
348 |
+
$slackRecord = new SlackRecord();
|
349 |
+
$data = $slackRecord->getSlackData($this->getRecord());
|
350 |
+
|
351 |
+
$attachment = $data['attachments'][0];
|
352 |
+
$this->assertArrayHasKey('ts', $attachment);
|
353 |
+
$this->assertSame($record['datetime']->getTimestamp(), $attachment['ts']);
|
354 |
+
}
|
355 |
+
|
356 |
+
public function testExcludeExtraAndContextFields()
|
357 |
+
{
|
358 |
+
$record = $this->getRecord(
|
359 |
+
Logger::WARNING,
|
360 |
+
'test',
|
361 |
+
array('info' => array('library' => 'monolog', 'author' => 'Jordi'))
|
362 |
+
);
|
363 |
+
$record['extra'] = array('tags' => array('web', 'cli'));
|
364 |
+
|
365 |
+
$slackRecord = new SlackRecord(null, null, true, null, false, true, array('context.info.library', 'extra.tags.1'));
|
366 |
+
$data = $slackRecord->getSlackData($record);
|
367 |
+
$attachment = $data['attachments'][0];
|
368 |
+
|
369 |
+
$expected = array(
|
370 |
+
array(
|
371 |
+
'title' => 'info',
|
372 |
+
'value' => sprintf('```%s```', json_encode(array('author' => 'Jordi'), $this->jsonPrettyPrintFlag)),
|
373 |
+
'short' => false
|
374 |
+
),
|
375 |
+
array(
|
376 |
+
'title' => 'tags',
|
377 |
+
'value' => sprintf('```%s```', json_encode(array('web'))),
|
378 |
+
'short' => false
|
379 |
+
),
|
380 |
+
);
|
381 |
+
|
382 |
+
foreach ($expected as $field) {
|
383 |
+
$this->assertNotFalse(array_search($field, $attachment['fields']));
|
384 |
+
break;
|
385 |
+
}
|
386 |
+
}
|
387 |
+
}
|
vendor/monolog/monolog/tests/Monolog/Handler/SlackHandlerTest.php
CHANGED
@@ -13,6 +13,8 @@ namespace Monolog\Handler;
|
|
13 |
|
14 |
use Monolog\TestCase;
|
15 |
use Monolog\Logger;
|
|
|
|
|
16 |
|
17 |
/**
|
18 |
* @author Greg Kedzierski <greg@gregkedzierski.com>
|
@@ -54,7 +56,27 @@ class SlackHandlerTest extends TestCase
|
|
54 |
fseek($this->res, 0);
|
55 |
$content = fread($this->res, 1024);
|
56 |
|
57 |
-
$this->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
}
|
59 |
|
60 |
public function testWriteContentWithEmoji()
|
@@ -64,7 +86,7 @@ class SlackHandlerTest extends TestCase
|
|
64 |
fseek($this->res, 0);
|
65 |
$content = fread($this->res, 1024);
|
66 |
|
67 |
-
$this->assertRegexp('/icon_emoji=%3Aalien%3A
|
68 |
}
|
69 |
|
70 |
/**
|
@@ -77,7 +99,7 @@ class SlackHandlerTest extends TestCase
|
|
77 |
fseek($this->res, 0);
|
78 |
$content = fread($this->res, 1024);
|
79 |
|
80 |
-
$this->assertRegexp('
|
81 |
}
|
82 |
|
83 |
public function testWriteContentWithPlainTextMessage()
|
@@ -93,14 +115,14 @@ class SlackHandlerTest extends TestCase
|
|
93 |
public function provideLevelColors()
|
94 |
{
|
95 |
return array(
|
96 |
-
array(Logger::DEBUG,
|
97 |
-
array(Logger::INFO,
|
98 |
-
array(Logger::NOTICE,
|
99 |
-
array(Logger::WARNING,
|
100 |
-
array(Logger::ERROR,
|
101 |
-
array(Logger::CRITICAL,
|
102 |
-
array(Logger::ALERT,
|
103 |
-
array(Logger::EMERGENCY,
|
104 |
);
|
105 |
}
|
106 |
|
13 |
|
14 |
use Monolog\TestCase;
|
15 |
use Monolog\Logger;
|
16 |
+
use Monolog\Formatter\LineFormatter;
|
17 |
+
use Monolog\Handler\Slack\SlackRecord;
|
18 |
|
19 |
/**
|
20 |
* @author Greg Kedzierski <greg@gregkedzierski.com>
|
56 |
fseek($this->res, 0);
|
57 |
$content = fread($this->res, 1024);
|
58 |
|
59 |
+
$this->assertRegExp('/username=Monolog/', $content);
|
60 |
+
$this->assertRegExp('/channel=channel1/', $content);
|
61 |
+
$this->assertRegExp('/token=myToken/', $content);
|
62 |
+
$this->assertRegExp('/attachments/', $content);
|
63 |
+
}
|
64 |
+
|
65 |
+
public function testWriteContentUsesFormatterIfProvided()
|
66 |
+
{
|
67 |
+
$this->createHandler('myToken', 'channel1', 'Monolog', false);
|
68 |
+
$this->handler->handle($this->getRecord(Logger::CRITICAL, 'test1'));
|
69 |
+
fseek($this->res, 0);
|
70 |
+
$content = fread($this->res, 1024);
|
71 |
+
|
72 |
+
$this->createHandler('myToken', 'channel1', 'Monolog', false);
|
73 |
+
$this->handler->setFormatter(new LineFormatter('foo--%message%'));
|
74 |
+
$this->handler->handle($this->getRecord(Logger::CRITICAL, 'test2'));
|
75 |
+
fseek($this->res, 0);
|
76 |
+
$content2 = fread($this->res, 1024);
|
77 |
+
|
78 |
+
$this->assertRegexp('/text=test1/', $content);
|
79 |
+
$this->assertRegexp('/text=foo--test2/', $content2);
|
80 |
}
|
81 |
|
82 |
public function testWriteContentWithEmoji()
|
86 |
fseek($this->res, 0);
|
87 |
$content = fread($this->res, 1024);
|
88 |
|
89 |
+
$this->assertRegexp('/icon_emoji=%3Aalien%3A/', $content);
|
90 |
}
|
91 |
|
92 |
/**
|
99 |
fseek($this->res, 0);
|
100 |
$content = fread($this->res, 1024);
|
101 |
|
102 |
+
$this->assertRegexp('/%22color%22%3A%22'.$expectedColor.'/', $content);
|
103 |
}
|
104 |
|
105 |
public function testWriteContentWithPlainTextMessage()
|
115 |
public function provideLevelColors()
|
116 |
{
|
117 |
return array(
|
118 |
+
array(Logger::DEBUG, urlencode(SlackRecord::COLOR_DEFAULT)),
|
119 |
+
array(Logger::INFO, SlackRecord::COLOR_GOOD),
|
120 |
+
array(Logger::NOTICE, SlackRecord::COLOR_GOOD),
|
121 |
+
array(Logger::WARNING, SlackRecord::COLOR_WARNING),
|
122 |
+
array(Logger::ERROR, SlackRecord::COLOR_DANGER),
|
123 |
+
array(Logger::CRITICAL, SlackRecord::COLOR_DANGER),
|
124 |
+
array(Logger::ALERT, SlackRecord::COLOR_DANGER),
|
125 |
+
array(Logger::EMERGENCY,SlackRecord::COLOR_DANGER),
|
126 |
);
|
127 |
}
|
128 |
|
vendor/monolog/monolog/tests/Monolog/Handler/SlackWebhookHandlerTest.php
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Monolog package.
|
5 |
+
*
|
6 |
+
* (c) Jordi Boggiano <j.boggiano@seld.be>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Monolog\Handler;
|
13 |
+
|
14 |
+
use Monolog\TestCase;
|
15 |
+
use Monolog\Logger;
|
16 |
+
use Monolog\Formatter\LineFormatter;
|
17 |
+
use Monolog\Handler\Slack\SlackRecord;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @author Haralan Dobrev <hkdobrev@gmail.com>
|
21 |
+
* @see https://api.slack.com/incoming-webhooks
|
22 |
+
* @coversDefaultClass Monolog\Handler\SlackWebhookHandler
|
23 |
+
*/
|
24 |
+
class SlackWebhookHandlerTest extends TestCase
|
25 |
+
{
|
26 |
+
const WEBHOOK_URL = 'https://hooks.slack.com/services/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E';
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @covers ::__construct
|
30 |
+
* @covers ::getSlackRecord
|
31 |
+
*/
|
32 |
+
public function testConstructorMinimal()
|
33 |
+
{
|
34 |
+
$handler = new SlackWebhookHandler(self::WEBHOOK_URL);
|
35 |
+
$record = $this->getRecord();
|
36 |
+
$slackRecord = $handler->getSlackRecord();
|
37 |
+
$this->assertInstanceOf('Monolog\Handler\Slack\SlackRecord', $slackRecord);
|
38 |
+
$this->assertEquals(array(
|
39 |
+
'attachments' => array(
|
40 |
+
array(
|
41 |
+
'fallback' => 'test',
|
42 |
+
'text' => 'test',
|
43 |
+
'color' => SlackRecord::COLOR_WARNING,
|
44 |
+
'fields' => array(
|
45 |
+
array(
|
46 |
+
'title' => 'Level',
|
47 |
+
'value' => 'WARNING',
|
48 |
+
'short' => false,
|
49 |
+
),
|
50 |
+
),
|
51 |
+
'title' => 'Message',
|
52 |
+
'mrkdwn_in' => array('fields'),
|
53 |
+
'ts' => $record['datetime']->getTimestamp(),
|
54 |
+
),
|
55 |
+
),
|
56 |
+
), $slackRecord->getSlackData($record));
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* @covers ::__construct
|
61 |
+
* @covers ::getSlackRecord
|
62 |
+
*/
|
63 |
+
public function testConstructorFull()
|
64 |
+
{
|
65 |
+
$handler = new SlackWebhookHandler(
|
66 |
+
self::WEBHOOK_URL,
|
67 |
+
'test-channel',
|
68 |
+
'test-username',
|
69 |
+
false,
|
70 |
+
':ghost:',
|
71 |
+
false,
|
72 |
+
false,
|
73 |
+
Logger::DEBUG,
|
74 |
+
false
|
75 |
+
);
|
76 |
+
|
77 |
+
$slackRecord = $handler->getSlackRecord();
|
78 |
+
$this->assertInstanceOf('Monolog\Handler\Slack\SlackRecord', $slackRecord);
|
79 |
+
$this->assertEquals(array(
|
80 |
+
'username' => 'test-username',
|
81 |
+
'text' => 'test',
|
82 |
+
'channel' => 'test-channel',
|
83 |
+
'icon_emoji' => ':ghost:',
|
84 |
+
), $slackRecord->getSlackData($this->getRecord()));
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* @covers ::getFormatter
|
89 |
+
*/
|
90 |
+
public function testGetFormatter()
|
91 |
+
{
|
92 |
+
$handler = new SlackWebhookHandler(self::WEBHOOK_URL);
|
93 |
+
$formatter = $handler->getFormatter();
|
94 |
+
$this->assertInstanceOf('Monolog\Formatter\FormatterInterface', $formatter);
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* @covers ::setFormatter
|
99 |
+
*/
|
100 |
+
public function testSetFormatter()
|
101 |
+
{
|
102 |
+
$handler = new SlackWebhookHandler(self::WEBHOOK_URL);
|
103 |
+
$formatter = new LineFormatter();
|
104 |
+
$handler->setFormatter($formatter);
|
105 |
+
$this->assertSame($formatter, $handler->getFormatter());
|
106 |
+
}
|
107 |
+
}
|
vendor/monolog/monolog/tests/Monolog/Handler/SlackbotHandlerTest.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Monolog package.
|
5 |
+
*
|
6 |
+
* (c) Jordi Boggiano <j.boggiano@seld.be>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Monolog\Handler;
|
13 |
+
|
14 |
+
use Monolog\TestCase;
|
15 |
+
use Monolog\Logger;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @author Haralan Dobrev <hkdobrev@gmail.com>
|
19 |
+
* @see https://slack.com/apps/A0F81R8ET-slackbot
|
20 |
+
* @coversDefaultClass Monolog\Handler\SlackbotHandler
|
21 |
+
*/
|
22 |
+
class SlackbotHandlerTest extends TestCase
|
23 |
+
{
|
24 |
+
/**
|
25 |
+
* @covers ::__construct
|
26 |
+
*/
|
27 |
+
public function testConstructorMinimal()
|
28 |
+
{
|
29 |
+
$handler = new SlackbotHandler('test-team', 'test-token', 'test-channel');
|
30 |
+
$this->assertInstanceOf('Monolog\Handler\AbstractProcessingHandler', $handler);
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @covers ::__construct
|
35 |
+
*/
|
36 |
+
public function testConstructorFull()
|
37 |
+
{
|
38 |
+
$handler = new SlackbotHandler(
|
39 |
+
'test-team',
|
40 |
+
'test-token',
|
41 |
+
'test-channel',
|
42 |
+
Logger::DEBUG,
|
43 |
+
false
|
44 |
+
);
|
45 |
+
$this->assertInstanceOf('Monolog\Handler\AbstractProcessingHandler', $handler);
|
46 |
+
}
|
47 |
+
}
|
vendor/monolog/monolog/tests/Monolog/Handler/SocketHandlerTest.php
CHANGED
@@ -70,6 +70,13 @@ class SocketHandlerTest extends TestCase
|
|
70 |
$this->assertEquals(10.25, $this->handler->getTimeout());
|
71 |
}
|
72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
public function testSetConnectionString()
|
74 |
{
|
75 |
$this->createHandler('tcp://localhost:9090');
|
@@ -235,6 +242,26 @@ class SocketHandlerTest extends TestCase
|
|
235 |
$this->assertTrue(is_resource($this->res));
|
236 |
}
|
237 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
238 |
private function createHandler($connectionString)
|
239 |
{
|
240 |
$this->handler = new SocketHandler($connectionString);
|
70 |
$this->assertEquals(10.25, $this->handler->getTimeout());
|
71 |
}
|
72 |
|
73 |
+
public function testSetWritingTimeout()
|
74 |
+
{
|
75 |
+
$this->createHandler('localhost:1234');
|
76 |
+
$this->handler->setWritingTimeout(10.25);
|
77 |
+
$this->assertEquals(10.25, $this->handler->getWritingTimeout());
|
78 |
+
}
|
79 |
+
|
80 |
public function testSetConnectionString()
|
81 |
{
|
82 |
$this->createHandler('tcp://localhost:9090');
|
242 |
$this->assertTrue(is_resource($this->res));
|
243 |
}
|
244 |
|
245 |
+
/**
|
246 |
+
* @expectedException \RuntimeException
|
247 |
+
*/
|
248 |
+
public function testAvoidInfiniteLoopWhenNoDataIsWrittenForAWritingTimeoutSeconds()
|
249 |
+
{
|
250 |
+
$this->setMockHandler(array('fwrite', 'streamGetMetadata'));
|
251 |
+
|
252 |
+
$this->handler->expects($this->any())
|
253 |
+
->method('fwrite')
|
254 |
+
->will($this->returnValue(0));
|
255 |
+
|
256 |
+
$this->handler->expects($this->any())
|
257 |
+
->method('streamGetMetadata')
|
258 |
+
->will($this->returnValue(array('timed_out' => false)));
|
259 |
+
|
260 |
+
$this->handler->setWritingTimeout(1);
|
261 |
+
|
262 |
+
$this->writeRecord('Hello world');
|
263 |
+
}
|
264 |
+
|
265 |
private function createHandler($connectionString)
|
266 |
{
|
267 |
$this->handler = new SocketHandler($connectionString);
|
vendor/monolog/monolog/tests/Monolog/Handler/StreamHandlerTest.php
CHANGED
@@ -35,10 +35,26 @@ class StreamHandlerTest extends TestCase
|
|
35 |
/**
|
36 |
* @covers Monolog\Handler\StreamHandler::close
|
37 |
*/
|
38 |
-
public function
|
39 |
{
|
40 |
$handle = fopen('php://memory', 'a+');
|
41 |
$handler = new StreamHandler($handle);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
$this->assertTrue(is_resource($handle));
|
43 |
$handler->close();
|
44 |
$this->assertFalse(is_resource($handle));
|
35 |
/**
|
36 |
* @covers Monolog\Handler\StreamHandler::close
|
37 |
*/
|
38 |
+
public function testCloseKeepsExternalHandlersOpen()
|
39 |
{
|
40 |
$handle = fopen('php://memory', 'a+');
|
41 |
$handler = new StreamHandler($handle);
|
42 |
+
$this->assertTrue(is_resource($handle));
|
43 |
+
$handler->close();
|
44 |
+
$this->assertTrue(is_resource($handle));
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* @covers Monolog\Handler\StreamHandler::close
|
49 |
+
*/
|
50 |
+
public function testClose()
|
51 |
+
{
|
52 |
+
$handler = new StreamHandler('php://memory');
|
53 |
+
$handler->handle($this->getRecord(Logger::WARNING, 'test'));
|
54 |
+
$streamProp = new \ReflectionProperty('Monolog\Handler\StreamHandler', 'stream');
|
55 |
+
$streamProp->setAccessible(true);
|
56 |
+
$handle = $streamProp->getValue($handler);
|
57 |
+
|
58 |
$this->assertTrue(is_resource($handle));
|
59 |
$handler->close();
|
60 |
$this->assertFalse(is_resource($handle));
|
vendor/monolog/monolog/tests/Monolog/Handler/SwiftMailerHandlerTest.php
CHANGED
@@ -1,5 +1,14 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
namespace Monolog\Handler;
|
4 |
|
5 |
use Monolog\Logger;
|
@@ -62,4 +71,43 @@ class SwiftMailerHandlerTest extends TestCase
|
|
62 |
);
|
63 |
$handler->handleBatch($records);
|
64 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
}
|
1 |
<?php
|
2 |
|
3 |
+
/*
|
4 |
+
* This file is part of the Monolog package.
|
5 |
+
*
|
6 |
+
* (c) Jordi Boggiano <j.boggiano@seld.be>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
namespace Monolog\Handler;
|
13 |
|
14 |
use Monolog\Logger;
|
71 |
);
|
72 |
$handler->handleBatch($records);
|
73 |
}
|
74 |
+
|
75 |
+
public function testMessageSubjectFormatting()
|
76 |
+
{
|
77 |
+
// Wire Mailer to expect a specific Swift_Message with a customized Subject
|
78 |
+
$messageTemplate = new \Swift_Message();
|
79 |
+
$messageTemplate->setSubject('Alert: %level_name% %message%');
|
80 |
+
$receivedMessage = null;
|
81 |
+
|
82 |
+
$this->mailer->expects($this->once())
|
83 |
+
->method('send')
|
84 |
+
->with($this->callback(function ($value) use (&$receivedMessage) {
|
85 |
+
$receivedMessage = $value;
|
86 |
+
return true;
|
87 |
+
}));
|
88 |
+
|
89 |
+
$handler = new SwiftMailerHandler($this->mailer, $messageTemplate);
|
90 |
+
|
91 |
+
$records = array(
|
92 |
+
$this->getRecord(Logger::EMERGENCY),
|
93 |
+
);
|
94 |
+
$handler->handleBatch($records);
|
95 |
+
|
96 |
+
$this->assertEquals('Alert: EMERGENCY test', $receivedMessage->getSubject());
|
97 |
+
}
|
98 |
+
|
99 |
+
public function testMessageHaveUniqueId()
|
100 |
+
{
|
101 |
+
$messageTemplate = new \Swift_Message();
|
102 |
+
$handler = new SwiftMailerHandler($this->mailer, $messageTemplate);
|
103 |
+
|
104 |
+
$method = new \ReflectionMethod('Monolog\Handler\SwiftMailerHandler', 'buildMessage');
|
105 |
+
$method->setAccessible(true);
|
106 |
+
$method->invokeArgs($handler, array($messageTemplate, array()));
|
107 |
+
|
108 |
+
$builtMessage1 = $method->invoke($handler, $messageTemplate, array());
|
109 |
+
$builtMessage2 = $method->invoke($handler, $messageTemplate, array());
|
110 |
+
|
111 |
+
$this->assertFalse($builtMessage1->getId() === $builtMessage2->getId(), 'Two different messages have the same id');
|
112 |
+
}
|
113 |
}
|
vendor/monolog/monolog/tests/Monolog/Handler/SyslogUdpHandlerTest.php
CHANGED
@@ -11,10 +11,12 @@
|
|
11 |
|
12 |
namespace Monolog\Handler;
|
13 |
|
|
|
|
|
14 |
/**
|
15 |
* @requires extension sockets
|
16 |
*/
|
17 |
-
class SyslogUdpHandlerTest extends
|
18 |
{
|
19 |
/**
|
20 |
* @expectedException UnexpectedValueException
|
@@ -26,22 +28,47 @@ class SyslogUdpHandlerTest extends \PHPUnit_Framework_TestCase
|
|
26 |
|
27 |
public function testWeSplitIntoLines()
|
28 |
{
|
29 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
$handler->setFormatter(new \Monolog\Formatter\ChromePHPFormatter());
|
31 |
|
32 |
$socket = $this->getMock('\Monolog\Handler\SyslogUdp\UdpSocket', array('write'), array('lol', 'lol'));
|
33 |
$socket->expects($this->at(0))
|
34 |
->method('write')
|
35 |
-
->with("lol", "<".(LOG_AUTHPRIV + LOG_WARNING).">1 ");
|
36 |
$socket->expects($this->at(1))
|
37 |
->method('write')
|
38 |
-
->with("hej", "<".(LOG_AUTHPRIV + LOG_WARNING).">1 ");
|
39 |
|
40 |
$handler->setSocket($socket);
|
41 |
|
42 |
$handler->handle($this->getRecordWithMessage("hej\nlol"));
|
43 |
}
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
protected function getRecordWithMessage($msg)
|
46 |
{
|
47 |
return array('message' => $msg, 'level' => \Monolog\Logger::WARNING, 'context' => null, 'extra' => array(), 'channel' => 'lol');
|
11 |
|
12 |
namespace Monolog\Handler;
|
13 |
|
14 |
+
use Monolog\TestCase;
|
15 |
+
|
16 |
/**
|
17 |
* @requires extension sockets
|
18 |
*/
|
19 |
+
class SyslogUdpHandlerTest extends TestCase
|
20 |
{
|
21 |
/**
|
22 |
* @expectedException UnexpectedValueException
|
28 |
|
29 |
public function testWeSplitIntoLines()
|
30 |
{
|
31 |
+
$time = '2014-01-07T12:34';
|
32 |
+
$pid = getmypid();
|
33 |
+
$host = gethostname();
|
34 |
+
|
35 |
+
$handler = $this->getMockBuilder('\Monolog\Handler\SyslogUdpHandler')
|
36 |
+
->setConstructorArgs(array("127.0.0.1", 514, "authpriv"))
|
37 |
+
->setMethods(array('getDateTime'))
|
38 |
+
->getMock();
|
39 |
+
|
40 |
+
$handler->method('getDateTime')
|
41 |
+
->willReturn($time);
|
42 |
+
|
43 |
$handler->setFormatter(new \Monolog\Formatter\ChromePHPFormatter());
|
44 |
|
45 |
$socket = $this->getMock('\Monolog\Handler\SyslogUdp\UdpSocket', array('write'), array('lol', 'lol'));
|
46 |
$socket->expects($this->at(0))
|
47 |
->method('write')
|
48 |
+
->with("lol", "<".(LOG_AUTHPRIV + LOG_WARNING).">1 $time $host php $pid - - ");
|
49 |
$socket->expects($this->at(1))
|
50 |
->method('write')
|
51 |
+
->with("hej", "<".(LOG_AUTHPRIV + LOG_WARNING).">1 $time $host php $pid - - ");
|
52 |
|
53 |
$handler->setSocket($socket);
|
54 |
|
55 |
$handler->handle($this->getRecordWithMessage("hej\nlol"));
|
56 |
}
|
57 |
|
58 |
+
public function testSplitWorksOnEmptyMsg()
|
59 |
+
{
|
60 |
+
$handler = new SyslogUdpHandler("127.0.0.1", 514, "authpriv");
|
61 |
+
$handler->setFormatter($this->getIdentityFormatter());
|
62 |
+
|
63 |
+
$socket = $this->getMock('\Monolog\Handler\SyslogUdp\UdpSocket', array('write'), array('lol', 'lol'));
|
64 |
+
$socket->expects($this->never())
|
65 |
+
->method('write');
|
66 |
+
|
67 |
+
$handler->setSocket($socket);
|
68 |
+
|
69 |
+
$handler->handle($this->getRecordWithMessage(null));
|
70 |
+
}
|
71 |
+
|
72 |
protected function getRecordWithMessage($msg)
|
73 |
{
|
74 |
return array('message' => $msg, 'level' => \Monolog\Logger::WARNING, 'context' => null, 'extra' => array(), 'channel' => 'lol');
|
vendor/monolog/monolog/tests/Monolog/Handler/TestHandlerTest.php
CHANGED
@@ -26,6 +26,8 @@ class TestHandlerTest extends TestCase
|
|
26 |
{
|
27 |
$handler = new TestHandler;
|
28 |
$record = $this->getRecord($level, 'test'.$method);
|
|
|
|
|
29 |
$this->assertFalse($handler->{'has'.$method}($record), 'has'.$method);
|
30 |
$this->assertFalse($handler->{'has'.$method.'ThatContains'}('test'), 'has'.$method.'ThatContains');
|
31 |
$this->assertFalse($handler->{'has'.$method.'ThatPasses'}(function ($rec) {
|
@@ -36,6 +38,8 @@ class TestHandlerTest extends TestCase
|
|
36 |
$handler->handle($record);
|
37 |
|
38 |
$this->assertFalse($handler->{'has'.$method}('bar'), 'has'.$method);
|
|
|
|
|
39 |
$this->assertTrue($handler->{'has'.$method}($record), 'has'.$method);
|
40 |
$this->assertTrue($handler->{'has'.$method}('test'.$method), 'has'.$method);
|
41 |
$this->assertTrue($handler->{'has'.$method.'ThatContains'}('test'), 'has'.$method.'ThatContains');
|
26 |
{
|
27 |
$handler = new TestHandler;
|
28 |
$record = $this->getRecord($level, 'test'.$method);
|
29 |
+
$this->assertFalse($handler->hasRecords($level));
|
30 |
+
$this->assertFalse($handler->hasRecord($record, $level));
|
31 |
$this->assertFalse($handler->{'has'.$method}($record), 'has'.$method);
|
32 |
$this->assertFalse($handler->{'has'.$method.'ThatContains'}('test'), 'has'.$method.'ThatContains');
|
33 |
$this->assertFalse($handler->{'has'.$method.'ThatPasses'}(function ($rec) {
|
38 |
$handler->handle($record);
|
39 |
|
40 |
$this->assertFalse($handler->{'has'.$method}('bar'), 'has'.$method);
|
41 |
+
$this->assertTrue($handler->hasRecords($level));
|
42 |
+
$this->assertTrue($handler->hasRecord($record, $level));
|
43 |
$this->assertTrue($handler->{'has'.$method}($record), 'has'.$method);
|
44 |
$this->assertTrue($handler->{'has'.$method}('test'.$method), 'has'.$method);
|
45 |
$this->assertTrue($handler->{'has'.$method.'ThatContains'}('test'), 'has'.$method.'ThatContains');
|
vendor/monolog/monolog/tests/Monolog/Handler/ZendMonitorHandlerTest.php
CHANGED
@@ -30,7 +30,7 @@ class ZendMonitorHandlerTest extends TestCase
|
|
30 |
{
|
31 |
$record = $this->getRecord();
|
32 |
$formatterResult = array(
|
33 |
-
'message' => $record['message']
|
34 |
);
|
35 |
|
36 |
$zendMonitor = $this->getMockBuilder('Monolog\Handler\ZendMonitorHandler')
|
30 |
{
|
31 |
$record = $this->getRecord();
|
32 |
$formatterResult = array(
|
33 |
+
'message' => $record['message'],
|
34 |
);
|
35 |
|
36 |
$zendMonitor = $this->getMockBuilder('Monolog\Handler\ZendMonitorHandler')
|
vendor/monolog/monolog/tests/Monolog/LoggerTest.php
CHANGED
@@ -33,6 +33,19 @@ class LoggerTest extends \PHPUnit_Framework_TestCase
|
|
33 |
$this->assertEquals('ERROR', Logger::getLevelName(Logger::ERROR));
|
34 |
}
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
/**
|
37 |
* @covers Monolog\Logger::toMonologLevel
|
38 |
*/
|
@@ -303,6 +316,45 @@ class LoggerTest extends \PHPUnit_Framework_TestCase
|
|
303 |
$logger->debug('test');
|
304 |
}
|
305 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
/**
|
307 |
* @covers Monolog\Logger::addRecord
|
308 |
*/
|
@@ -468,4 +520,29 @@ class LoggerTest extends \PHPUnit_Framework_TestCase
|
|
468 |
\DateTimeZone::listIdentifiers()
|
469 |
);
|
470 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
471 |
}
|
33 |
$this->assertEquals('ERROR', Logger::getLevelName(Logger::ERROR));
|
34 |
}
|
35 |
|
36 |
+
/**
|
37 |
+
* @covers Monolog\Logger::withName
|
38 |
+
*/
|
39 |
+
public function testWithName()
|
40 |
+
{
|
41 |
+
$first = new Logger('first', array($handler = new TestHandler()));
|
42 |
+
$second = $first->withName('second');
|
43 |
+
|
44 |
+
$this->assertSame('first', $first->getName());
|
45 |
+
$this->assertSame('second', $second->getName());
|
46 |
+
$this->assertSame($handler, $second->popHandler());
|
47 |
+
}
|
48 |
+
|
49 |
/**
|
50 |
* @covers Monolog\Logger::toMonologLevel
|
51 |
*/
|
316 |
$logger->debug('test');
|
317 |
}
|
318 |
|
319 |
+
/**
|
320 |
+
* @covers Monolog\Logger::addRecord
|
321 |
+
*/
|
322 |
+
public function testHandlersNotCalledBeforeFirstHandlingWithAssocArray()
|
323 |
+
{
|
324 |
+
$handler1 = $this->getMock('Monolog\Handler\HandlerInterface');
|
325 |
+
$handler1->expects($this->never())
|
326 |
+
->method('isHandling')
|
327 |
+
->will($this->returnValue(false))
|
328 |
+
;
|
329 |
+
$handler1->expects($this->once())
|
330 |
+
->method('handle')
|
331 |
+
->will($this->returnValue(false))
|
332 |
+
;
|
333 |
+
|
334 |
+
$handler2 = $this->getMock('Monolog\Handler\HandlerInterface');
|
335 |
+
$handler2->expects($this->once())
|
336 |
+
->method('isHandling')
|
337 |
+
->will($this->returnValue(true))
|
338 |
+
;
|
339 |
+
$handler2->expects($this->once())
|
340 |
+
->method('handle')
|
341 |
+
->will($this->returnValue(false))
|
342 |
+
;
|
343 |
+
|
344 |
+
$handler3 = $this->getMock('Monolog\Handler\HandlerInterface');
|
345 |
+
$handler3->expects($this->once())
|
346 |
+
->method('isHandling')
|
347 |
+
->will($this->returnValue(false))
|
348 |
+
;
|
349 |
+
$handler3->expects($this->never())
|
350 |
+
->method('handle')
|
351 |
+
;
|
352 |
+
|
353 |
+
$logger = new Logger(__METHOD__, array('last' => $handler3, 'second' => $handler2, 'first' => $handler1));
|
354 |
+
|
355 |
+
$logger->debug('test');
|
356 |
+
}
|
357 |
+
|
358 |
/**
|
359 |
* @covers Monolog\Logger::addRecord
|
360 |
*/
|
520 |
\DateTimeZone::listIdentifiers()
|
521 |
);
|
522 |
}
|
523 |
+
|
524 |
+
/**
|
525 |
+
* @dataProvider useMicrosecondTimestampsProvider
|
526 |
+
* @covers Monolog\Logger::useMicrosecondTimestamps
|
527 |
+
* @covers Monolog\Logger::addRecord
|
528 |
+
*/
|
529 |
+
public function testUseMicrosecondTimestamps($micro, $assert)
|
530 |
+
{
|
531 |
+
$logger = new Logger('foo');
|
532 |
+
$logger->useMicrosecondTimestamps($micro);
|
533 |
+
$handler = new TestHandler;
|
534 |
+
$logger->pushHandler($handler);
|
535 |
+
$logger->info('test');
|
536 |
+
list($record) = $handler->getRecords();
|
537 |
+
$this->{$assert}('000000', $record['datetime']->format('u'));
|
538 |
+
}
|
539 |
+
|
540 |
+
public function useMicrosecondTimestampsProvider()
|
541 |
+
{
|
542 |
+
return array(
|
543 |
+
// this has a very small chance of a false negative (1/10^6)
|
544 |
+
'with microseconds' => array(true, 'assertNotSame'),
|
545 |
+
'without microseconds' => array(false, PHP_VERSION_ID >= 70100 ? 'assertNotSame' : 'assertSame'),
|
546 |
+
);
|
547 |
+
}
|
548 |
}
|
vendor/monolog/monolog/tests/Monolog/Processor/MercurialProcessorTest.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of the Monolog package.
|
5 |
+
*
|
6 |
+
* (c) Jonathan A. Schweder <jonathanschweder@gmail.com>
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Monolog\Processor;
|
13 |
+
|
14 |
+
use Monolog\TestCase;
|
15 |
+
|
16 |
+
class MercurialProcessorTest extends TestCase
|
17 |
+
{
|
18 |
+
/**
|
19 |
+
* @covers Monolog\Processor\MercurialProcessor::__invoke
|
20 |
+
*/
|
21 |
+
public function testProcessor()
|
22 |
+
{
|
23 |
+
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
24 |
+
exec("where hg 2>NUL", $output, $result);
|
25 |
+
} else {
|
26 |
+
exec("which hg 2>/dev/null >/dev/null", $output, $result);
|
27 |
+
}
|
28 |
+
if ($result != 0) {
|
29 |
+
$this->markTestSkipped('hg is missing');
|
30 |
+
return;
|
31 |
+
}
|
32 |
+
|
33 |
+
`hg init`;
|
34 |
+
$processor = new MercurialProcessor();
|
35 |
+
$record = $processor($this->getRecord());
|
36 |
+
|
37 |
+
$this->assertArrayHasKey('hg', $record['extra']);
|
38 |
+
$this->assertTrue(!is_array($record['extra']['hg']['branch']));
|
39 |
+
$this->assertTrue(!is_array($record['extra']['hg']['revision']));
|
40 |
+
}
|
41 |
+
}
|
vendor/monolog/monolog/tests/Monolog/Processor/PsrLogMessageProcessorTest.php
CHANGED
@@ -22,7 +22,7 @@ class PsrLogMessageProcessorTest extends \PHPUnit_Framework_TestCase
|
|
22 |
|
23 |
$message = $proc(array(
|
24 |
'message' => '{foo}',
|
25 |
-
'context' => array('foo' => $val)
|
26 |
));
|
27 |
$this->assertEquals($expected, $message['message']);
|
28 |
}
|
22 |
|
23 |
$message = $proc(array(
|
24 |
'message' => '{foo}',
|
25 |
+
'context' => array('foo' => $val),
|
26 |
));
|
27 |
$this->assertEquals($expected, $message['message']);
|
28 |
}
|
vendor/monolog/monolog/tests/Monolog/Processor/UidProcessorTest.php
CHANGED
@@ -24,4 +24,10 @@ class UidProcessorTest extends TestCase
|
|
24 |
$record = $processor($this->getRecord());
|
25 |
$this->assertArrayHasKey('uid', $record['extra']);
|
26 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
}
|
24 |
$record = $processor($this->getRecord());
|
25 |
$this->assertArrayHasKey('uid', $record['extra']);
|
26 |
}
|
27 |
+
|
28 |
+
public function testGetUid()
|
29 |
+
{
|
30 |
+
$processor = new UidProcessor(10);
|
31 |
+
$this->assertEquals(10, strlen($processor->getUid()));
|
32 |
+
}
|
33 |
}
|
vendor/monolog/monolog/tests/Monolog/Processor/WebProcessorTest.php
CHANGED
@@ -88,6 +88,21 @@ class WebProcessorTest extends TestCase
|
|
88 |
$this->assertSame(array('url' => 'A', 'http_method' => 'C'), $record['extra']);
|
89 |
}
|
90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
/**
|
92 |
* @expectedException UnexpectedValueException
|
93 |
*/
|
88 |
$this->assertSame(array('url' => 'A', 'http_method' => 'C'), $record['extra']);
|
89 |
}
|
90 |
|
91 |
+
public function testProcessorConfiguringOfExtraFields()
|
92 |
+
{
|
93 |
+
$server = array(
|
94 |
+
'REQUEST_URI' => 'A',
|
95 |
+
'REMOTE_ADDR' => 'B',
|
96 |
+
'REQUEST_METHOD' => 'C',
|
97 |
+
'SERVER_NAME' => 'F',
|
98 |
+
);
|
99 |
+
|
100 |
+
$processor = new WebProcessor($server, array('url' => 'REMOTE_ADDR'));
|
101 |
+
$record = $processor($this->getRecord());
|
102 |
+
|
103 |
+
$this->assertSame(array('url' => 'B'), $record['extra']);
|
104 |
+
}
|
105 |
+
|
106 |
/**
|
107 |
* @expectedException UnexpectedValueException
|
108 |
*/
|
vendor/monolog/monolog/tests/Monolog/RegistryTest.php
CHANGED
@@ -130,7 +130,6 @@ class RegistryTest extends \PHPUnit_Framework_TestCase
|
|
130 |
$log1 = new Logger('test1');
|
131 |
$log2 = new Logger('test2');
|
132 |
|
133 |
-
|
134 |
Registry::addLogger($log1, 'log');
|
135 |
|
136 |
Registry::addLogger($log2, 'log', true);
|
130 |
$log1 = new Logger('test1');
|
131 |
$log2 = new Logger('test2');
|
132 |
|
|
|
133 |
Registry::addLogger($log1, 'log');
|
134 |
|
135 |
Registry::addLogger($log2, 'log', true);
|
vendor/monolog/monolog/tests/Monolog/TestCase.php
CHANGED
@@ -39,7 +39,7 @@ class TestCase extends \PHPUnit_Framework_TestCase
|
|
39 |
$this->getRecord(Logger::DEBUG, 'debug message 2'),
|
40 |
$this->getRecord(Logger::INFO, 'information'),
|
41 |
$this->getRecord(Logger::WARNING, 'warning'),
|
42 |
-
$this->getRecord(Logger::ERROR, 'error')
|
43 |
);
|
44 |
}
|
45 |
|
39 |
$this->getRecord(Logger::DEBUG, 'debug message 2'),
|
40 |
$this->getRecord(Logger::INFO, 'information'),
|
41 |
$this->getRecord(Logger::WARNING, 'warning'),
|
42 |
+
$this->getRecord(Logger::ERROR, 'error'),
|
43 |
);
|
44 |
}
|
45 |
|