Version Description
- Bug fix.
Download this release
Release Info
Developer | printfriendly |
Plugin | Print, PDF, Email by PrintFriendly |
Version | 3.8.4 |
Comparing to | |
See all releases |
Code changes from version 3.8.2 to 3.8.4
- pf.php +273 -213
- readme.txt +4 -1
- vendor/{Raven → PrintFriendly/Raven}/Autoloader.php +5 -5
- vendor/{Raven → PrintFriendly/Raven}/Breadcrumbs.php +1 -1
- vendor/{Raven → PrintFriendly/Raven}/Breadcrumbs/ErrorHandler.php +4 -4
- vendor/{Raven → PrintFriendly/Raven}/Breadcrumbs/MonologHandler.php +12 -12
- vendor/{Raven → PrintFriendly/Raven}/Client.php +85 -85
- vendor/{Raven → PrintFriendly/Raven}/Compat.php +1 -1
- vendor/{Raven → PrintFriendly/Raven}/Context.php +1 -1
- vendor/{Raven → PrintFriendly/Raven}/CurlHandler.php +1 -1
- vendor/{Raven → PrintFriendly/Raven}/ErrorHandler.php +7 -7
- vendor/PrintFriendly/Raven/Exception.php +4 -0
- vendor/{Raven → PrintFriendly/Raven}/Processor.php +4 -4
- vendor/{Raven → PrintFriendly/Raven}/Processor/RemoveCookiesProcessor.php +1 -1
- vendor/{Raven → PrintFriendly/Raven}/Processor/RemoveHttpBodyProcessor.php +1 -1
- vendor/{Raven → PrintFriendly/Raven}/Processor/SanitizeDataProcessor.php +2 -2
- vendor/{Raven → PrintFriendly/Raven}/Processor/SanitizeHttpHeadersProcessor.php +2 -2
- vendor/{Raven → PrintFriendly/Raven}/Processor/SanitizeStacktraceProcessor.php +1 -1
- vendor/{Raven → PrintFriendly/Raven}/ReprSerializer.php +1 -1
- vendor/PrintFriendly/Raven/SanitizeDataProcessor.php +19 -0
- vendor/{Raven → PrintFriendly/Raven}/Serializer.php +2 -2
- vendor/{Raven → PrintFriendly/Raven}/Stacktrace.php +8 -8
- vendor/{Raven → PrintFriendly/Raven}/TransactionStack.php +1 -1
- vendor/{Raven → PrintFriendly/Raven}/Util.php +1 -1
- vendor/{Raven → PrintFriendly/Raven}/data/cacert.pem +0 -0
- vendor/Raven/Exception.php +0 -4
- vendor/Raven/SanitizeDataProcessor.php +0 -19
pf.php
CHANGED
@@ -5,11 +5,12 @@ Plugin Name: Print, PDF & Email by PrintFriendly
|
|
5 |
Plugin URI: http://www.printfriendly.com
|
6 |
Description: PrintFriendly & PDF button for your website. Optimizes your pages and brand for print, pdf, and email.
|
7 |
Name and URL are included to ensure repeat visitors and new visitors when printed versions are shared.
|
8 |
-
Version: 3.8.
|
9 |
Author: Print, PDF, & Email by PrintFriendly
|
10 |
Author URI: http://www.PrintFriendly.com
|
11 |
|
12 |
Changelog :
|
|
|
13 |
3.8.1 - Improve automatic error reporting.
|
14 |
3.8.0 - Add automatic error reporting.
|
15 |
3.7.6 - WooCommerce support improvments: remove upsells from print preview.
|
@@ -106,7 +107,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
106 |
* Current plugin version.
|
107 |
* @var string
|
108 |
*/
|
109 |
-
var $plugin_version = '3.8.
|
110 |
|
111 |
/**
|
112 |
* The hook, used for text domain as well as hooks on pages and in get requests for admin.
|
@@ -130,7 +131,7 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
130 |
* Database version, used to allow for easy upgrades to / additions in plugin options between plugin versions.
|
131 |
* @var int
|
132 |
*/
|
133 |
-
var $db_version =
|
134 |
|
135 |
/**
|
136 |
* Settings page, used within the plugin to reliably load the plugins admin JS and CSS files only on the admin page.
|
@@ -150,21 +151,73 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
150 |
* @since 3.0
|
151 |
*/
|
152 |
function __construct() {
|
153 |
-
|
|
|
154 |
|
155 |
-
|
156 |
-
|
157 |
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
));
|
169 |
|
170 |
$this->raven_client->tags_context(array(
|
@@ -173,91 +226,67 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
173 |
));
|
174 |
|
175 |
$this->raven_client->setSendCallback(function($data) {
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
return
|
180 |
}
|
181 |
});
|
|
|
|
|
|
|
|
|
182 |
|
183 |
-
$this->
|
184 |
}
|
|
|
185 |
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
$
|
191 |
-
update_option( $this->option_name, $this->options );
|
192 |
}
|
|
|
193 |
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
}
|
204 |
-
|
205 |
-
add_action('the_content', array(&$this, 'add_pf_content_class_around_content_hook'));
|
206 |
-
|
207 |
-
// Admin hooks
|
208 |
-
if ( is_admin() ) {
|
209 |
-
// Hook into init for registration of the option and the language files
|
210 |
-
add_action( 'admin_init', array( &$this, 'init' ) );
|
211 |
-
|
212 |
-
// Register the settings page
|
213 |
-
add_action( 'admin_menu', array( &$this, 'add_config_page' ) );
|
214 |
-
|
215 |
-
// Register the contextual help
|
216 |
-
add_filter( 'contextual_help', array( &$this, 'contextual_help' ), 10, 2 );
|
217 |
-
|
218 |
-
// Enqueue the needed scripts and styles
|
219 |
-
add_action( 'admin_enqueue_scripts',array( &$this, 'admin_enqueue_scripts' ) );
|
220 |
-
|
221 |
-
// Register a link to the settings page on the plugins overview page
|
222 |
-
add_filter( 'plugin_action_links', array( &$this, 'filter_plugin_actions' ), 10, 2 );
|
223 |
}
|
224 |
-
}
|
225 |
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
return '<div class="pf-content">'.$content.'</div>';
|
236 |
-
} else {
|
237 |
-
return $content;
|
238 |
}
|
239 |
-
}
|
240 |
-
|
241 |
-
/**
|
242 |
-
* Override to check if print-only command is being used
|
243 |
-
*
|
244 |
-
* @since 3.3.0
|
245 |
-
**/
|
246 |
-
function print_only_override($content) {
|
247 |
-
$pattern = '/class=[\"]print-only|class=[\']print-only|print-only/';
|
248 |
-
$pf_pattern = '/class=[\"]pf-content|class=[\']pf-content|pf-content/';
|
249 |
-
return (preg_match($pattern, $content) || preg_match($pf_pattern, $content)) ;
|
250 |
-
}
|
251 |
-
|
252 |
-
/**
|
253 |
-
* Check if WP Algorithm is selected and content doesn't use print-only
|
254 |
-
*
|
255 |
-
* @since 3.5.4
|
256 |
-
**/
|
257 |
-
function is_wp_algo_on($content) {
|
258 |
-
return !class_exists('WooCommerce') && isset($this->options['pf_algo']) && $content && $this->options['pf_algo'] == 'wp' && !$this->print_only_override($content);
|
259 |
-
}
|
260 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
|
262 |
/**
|
263 |
* PHP 4 Compatible Constructor
|
@@ -273,12 +302,14 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
273 |
*
|
274 |
* @since 3.0
|
275 |
*/
|
276 |
-
function front_head() {
|
|
|
|
|
277 |
<style type="text/css" media="screen">
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
</style>
|
283 |
<?php
|
284 |
|
@@ -332,6 +363,9 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
332 |
}
|
333 |
</style>
|
334 |
<?php
|
|
|
|
|
|
|
335 |
}
|
336 |
|
337 |
/**
|
@@ -382,42 +416,44 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
382 |
* @return string $button or $content with the button added to the content when appropriate, just the content when button shouldn't be added or just button when called manually.
|
383 |
*/
|
384 |
function show_link( $content = false ) {
|
385 |
-
|
|
|
386 |
|
387 |
-
|
388 |
-
|
389 |
|
390 |
-
|
391 |
-
|
392 |
-
{
|
393 |
-
// Hook the script call now, so it only get's loaded when needed, and need is determined by the user calling pf_button
|
394 |
-
add_action( 'wp_footer', array( &$this, 'print_script_footer' ) );
|
395 |
-
return $button;
|
396 |
-
}
|
397 |
-
|
398 |
-
else
|
399 |
-
{
|
400 |
-
if ( (is_page() && ( isset($this->options['show_on_pages']) && 'on' === $this->options['show_on_pages'] ) )
|
401 |
-
|| (is_home() && ( ( isset($this->options['show_on_homepage']) && 'on' === $this->options['show_on_homepage'] ) && $this->category_included() ) )
|
402 |
-
|| (is_tax() && ( ( isset($this->options['show_on_taxonomies']) && 'on' === $this->options['show_on_taxonomies'] ) && $this->category_included() ) )
|
403 |
-
|| (is_category() && ( ( isset($this->options['show_on_categories']) && 'on' === $this->options['show_on_categories'] ) && $this->category_included() ) )
|
404 |
-
|| (is_single() && ( ( isset($this->options['show_on_posts']) && 'on' === $this->options['show_on_posts'] ) && $this->category_included() ) ) )
|
405 |
{
|
406 |
// Hook the script call now, so it only get's loaded when needed, and need is determined by the user calling pf_button
|
407 |
add_action( 'wp_footer', array( &$this, 'print_script_footer' ) );
|
408 |
-
|
409 |
-
if ( $this->options['content_placement'] == 'before' )
|
410 |
-
return $button.$content;
|
411 |
-
else
|
412 |
-
return $content.$button;
|
413 |
}
|
|
|
414 |
else
|
415 |
{
|
416 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
417 |
}
|
418 |
-
|
|
|
419 |
}
|
420 |
-
|
421 |
}
|
422 |
|
423 |
|
@@ -505,11 +541,15 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
505 |
* @since 3.0
|
506 |
*/
|
507 |
function init() {
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
|
|
|
|
|
|
|
|
513 |
}
|
514 |
|
515 |
/**
|
@@ -698,10 +738,14 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
698 |
* @since 3.0
|
699 |
*/
|
700 |
function add_config_page() {
|
701 |
-
|
|
|
702 |
|
703 |
-
|
704 |
-
|
|
|
|
|
|
|
705 |
}
|
706 |
|
707 |
/**
|
@@ -710,11 +754,15 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
710 |
* @since 3.0
|
711 |
*/
|
712 |
function contextual_help( $contextual_help, $screen_id ) {
|
713 |
-
|
714 |
-
|
715 |
-
|
|
|
|
|
|
|
|
|
|
|
716 |
}
|
717 |
-
return $contextual_help;
|
718 |
}
|
719 |
|
720 |
/**
|
@@ -724,16 +772,20 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
724 |
* @param string $hook_suffix hook to check against whether the current page is the PrintFriendly settings page.
|
725 |
*/
|
726 |
function admin_enqueue_scripts( $screen_id ) {
|
727 |
-
|
728 |
-
$
|
729 |
-
|
730 |
-
|
|
|
731 |
|
732 |
-
|
733 |
-
|
734 |
|
735 |
|
736 |
-
|
|
|
|
|
|
|
737 |
}
|
738 |
}
|
739 |
|
@@ -746,15 +798,20 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
746 |
* @return array $links the links with the settings link added to it if appropriate.
|
747 |
*/
|
748 |
function filter_plugin_actions( $links, $file ){
|
749 |
-
|
750 |
-
|
751 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
752 |
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
}
|
757 |
-
return $links;
|
758 |
}
|
759 |
|
760 |
/**
|
@@ -763,53 +820,57 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
763 |
* @since 3.0
|
764 |
*/
|
765 |
function set_defaults() {
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
|
|
|
|
806 |
}
|
807 |
-
}
|
808 |
|
809 |
-
|
810 |
-
|
811 |
|
812 |
-
|
|
|
|
|
|
|
813 |
}
|
814 |
|
815 |
/**
|
@@ -909,17 +970,6 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
909 |
// update options to version 6
|
910 |
// Replacement for db version 5 - should also be run for those already upgraded
|
911 |
if($this->options['db_version'] < 6) {
|
912 |
-
|
913 |
-
/* $additional_options = array(
|
914 |
-
'category_ids' => array(),
|
915 |
-
);
|
916 |
-
|
917 |
-
if( !isset( $this->options['category_ids'] ) || ( isset( $this->options['category_ids'] ) && 0 === count( $this->options['category_ids'] ) ) ) {
|
918 |
-
$additional_options['category_ids'][] = 'all';
|
919 |
-
}
|
920 |
-
|
921 |
-
$this->options = array_merge($this->options, $additional_options);
|
922 |
-
*/
|
923 |
unset($this->options['category_ids']);
|
924 |
}
|
925 |
|
@@ -937,13 +987,19 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
937 |
}
|
938 |
|
939 |
if($this->options['db_version'] < 9) {
|
940 |
-
|
941 |
}
|
942 |
|
943 |
if($this->options['db_version'] < 10) {
|
944 |
$this->options['enable_error_reporting'] = 'yes';
|
945 |
}
|
946 |
|
|
|
|
|
|
|
|
|
|
|
|
|
947 |
$this->options['db_version'] = $this->db_version;
|
948 |
|
949 |
update_option( $this->option_name, $this->options );
|
@@ -1097,12 +1153,16 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
1097 |
*
|
1098 |
*/
|
1099 |
function is_manual() {
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
isset($this->options['
|
|
|
|
|
|
|
|
|
1106 |
}
|
1107 |
|
1108 |
|
@@ -1176,6 +1236,12 @@ if ( ! class_exists( 'PrintFriendly_WordPress' ) ) {
|
|
1176 |
}
|
1177 |
}
|
1178 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1179 |
/**
|
1180 |
* Output the config page
|
1181 |
*
|
@@ -1486,9 +1552,3 @@ function pf_show_link() {
|
|
1486 |
global $printfriendly;
|
1487 |
return $printfriendly->getButton(true);
|
1488 |
}
|
1489 |
-
|
1490 |
-
function console_log( $data ) {
|
1491 |
-
echo '<script>';
|
1492 |
-
echo 'console.log(' . json_encode( $data ) . ')';
|
1493 |
-
echo '</script>';
|
1494 |
-
}
|
5 |
Plugin URI: http://www.printfriendly.com
|
6 |
Description: PrintFriendly & PDF button for your website. Optimizes your pages and brand for print, pdf, and email.
|
7 |
Name and URL are included to ensure repeat visitors and new visitors when printed versions are shared.
|
8 |
+
Version: 3.8.4
|
9 |
Author: Print, PDF, & Email by PrintFriendly
|
10 |
Author URI: http://www.PrintFriendly.com
|
11 |
|
12 |
Changelog :
|
13 |
+
3.8.4 - Bug fix.
|
14 |
3.8.1 - Improve automatic error reporting.
|
15 |
3.8.0 - Add automatic error reporting.
|
16 |
3.7.6 - WooCommerce support improvments: remove upsells from print preview.
|
107 |
* Current plugin version.
|
108 |
* @var string
|
109 |
*/
|
110 |
+
var $plugin_version = '3.8.4';
|
111 |
|
112 |
/**
|
113 |
* The hook, used for text domain as well as hooks on pages and in get requests for admin.
|
131 |
* Database version, used to allow for easy upgrades to / additions in plugin options between plugin versions.
|
132 |
* @var int
|
133 |
*/
|
134 |
+
var $db_version = 11;
|
135 |
|
136 |
/**
|
137 |
* Settings page, used within the plugin to reliably load the plugins admin JS and CSS files only on the admin page.
|
151 |
* @since 3.0
|
152 |
*/
|
153 |
function __construct() {
|
154 |
+
try {
|
155 |
+
// delete_option( $this->option_name );
|
156 |
|
157 |
+
// Retrieve the plugin options
|
158 |
+
$this->options = get_option( $this->option_name );
|
159 |
|
160 |
+
// If the options array is empty, set defaults
|
161 |
+
if ( ! is_array( $this->options ) )
|
162 |
+
$this->set_defaults();
|
163 |
|
164 |
+
// Sentry PHP SDK supports PHP 5.3 and higher.
|
165 |
+
if( isset( $this->options['enable_error_reporting'] ) && $this->options['enable_error_reporting'] == 'yes' && version_compare(PHP_VERSION, '5.3.0') >= 0) {
|
166 |
+
$this->init_error_reporting();
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Set page content selection option "Wordpress Standard/Strict" to "WP Template"
|
171 |
+
*/
|
172 |
+
if( isset( $this->options['pf_algo'] ) && $this->options['pf_algo'] == 'ws' ){
|
173 |
+
$this->options['pf_algo'] = 'wp';
|
174 |
+
update_option( $this->option_name, $this->options );
|
175 |
+
}
|
176 |
+
|
177 |
+
// If the version number doesn't match, upgrade
|
178 |
+
if ( $this->db_version > $this->options['db_version'] )
|
179 |
+
$this->upgrade();
|
180 |
+
|
181 |
+
add_action( 'wp_head', array( &$this, 'front_head' ) );
|
182 |
+
// automaticaly add the link
|
183 |
+
if( !$this->is_manual() ) {
|
184 |
+
add_filter( 'the_content', array( &$this, 'show_link' ) );
|
185 |
+
add_filter( 'the_excerpt', array( &$this, 'show_link' ) );
|
186 |
+
}
|
187 |
+
|
188 |
+
add_action('the_content', array(&$this, 'add_pf_content_class_around_content_hook'));
|
189 |
+
|
190 |
+
// Admin hooks
|
191 |
+
if ( is_admin() ) {
|
192 |
+
// Hook into init for registration of the option and the language files
|
193 |
+
add_action( 'admin_init', array( &$this, 'init' ) );
|
194 |
+
|
195 |
+
// Register the settings page
|
196 |
+
add_action( 'admin_menu', array( &$this, 'add_config_page' ) );
|
197 |
+
|
198 |
+
// Register the contextual help
|
199 |
+
add_filter( 'contextual_help', array( &$this, 'contextual_help' ), 10, 2 );
|
200 |
+
|
201 |
+
// Enqueue the needed scripts and styles
|
202 |
+
add_action( 'admin_enqueue_scripts',array( &$this, 'admin_enqueue_scripts' ) );
|
203 |
+
|
204 |
+
// Register a link to the settings page on the plugins overview page
|
205 |
+
add_filter( 'plugin_action_links', array( &$this, 'filter_plugin_actions' ), 10, 2 );
|
206 |
+
}
|
207 |
+
} catch(Exception $e) {
|
208 |
+
$this->raven_catch($e);
|
209 |
+
}
|
210 |
+
}
|
211 |
+
|
212 |
+
function init_error_reporting() {
|
213 |
+
try {
|
214 |
+
require_once 'vendor/PrintFriendly/Raven/Autoloader.php';
|
215 |
+
|
216 |
+
PrintFriendly_Raven_Autoloader::register();
|
217 |
+
|
218 |
+
$this->raven_client = new PrintFriendly_Raven_Client('https://46a55182ffbe477c8cf1cb0f1cee36c2:a32ee5b4fad940c4808845b618147f21@sentry.io/171161', array(
|
219 |
+
'release' => $this->plugin_version,
|
220 |
+
'timeout' => 4
|
221 |
));
|
222 |
|
223 |
$this->raven_client->tags_context(array(
|
226 |
));
|
227 |
|
228 |
$this->raven_client->setSendCallback(function($data) {
|
229 |
+
try {
|
230 |
+
return isset($data) && preg_match('/printfriendly/', json_encode($data));
|
231 |
+
} catch (Exception $e) {
|
232 |
+
return true;
|
233 |
}
|
234 |
});
|
235 |
+
} catch (Exception $e) {
|
236 |
+
if (!ini_get('display_errors')) {
|
237 |
+
error_log('PrintFriendly init_error_reporting Error: ' . $e);
|
238 |
+
}
|
239 |
|
240 |
+
$this->raven_catch($e);
|
241 |
}
|
242 |
+
}
|
243 |
|
244 |
+
function raven_catch($e) {
|
245 |
+
if (isset($this->raven_client)) {
|
246 |
+
try {
|
247 |
+
$this->raven_client->captureException($e);
|
248 |
+
} catch(Exception $e) {}
|
|
|
249 |
}
|
250 |
+
}
|
251 |
|
252 |
+
/**
|
253 |
+
* Adds wraps content in pf-content class to help Printfriendly algo determine the content
|
254 |
+
*
|
255 |
+
* @since 3.2.8
|
256 |
+
*
|
257 |
+
**/
|
258 |
+
function add_pf_content_class_around_content_hook($content = false) {
|
259 |
+
try {
|
260 |
+
if( $this->is_wp_algo_on($content) ) {
|
261 |
+
add_action( 'wp_footer', array( &$this, 'print_script_footer' ));
|
262 |
+
return '<div class="pf-content">'.$content.'</div>';
|
263 |
+
} else {
|
264 |
+
return $content;
|
265 |
+
}
|
266 |
+
} catch (Exception $e) {
|
267 |
+
$this->raven_catch($e);
|
268 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
269 |
}
|
|
|
270 |
|
271 |
+
/**
|
272 |
+
* Override to check if print-only command is being used
|
273 |
+
*
|
274 |
+
* @since 3.3.0
|
275 |
+
**/
|
276 |
+
function print_only_override($content) {
|
277 |
+
$pattern = '/class=[\"]print-only|class=[\']print-only|print-only/';
|
278 |
+
$pf_pattern = '/class=[\"]pf-content|class=[\']pf-content|pf-content/';
|
279 |
+
return (preg_match($pattern, $content) || preg_match($pf_pattern, $content)) ;
|
|
|
|
|
|
|
280 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
281 |
|
282 |
+
/**
|
283 |
+
* Check if WP Algorithm is selected and content doesn't use print-only
|
284 |
+
*
|
285 |
+
* @since 3.5.4
|
286 |
+
**/
|
287 |
+
function is_wp_algo_on($content) {
|
288 |
+
return !class_exists('WooCommerce') && isset($this->options['pf_algo']) && $content && $this->options['pf_algo'] == 'wp' && !$this->print_only_override($content);
|
289 |
+
}
|
290 |
|
291 |
/**
|
292 |
* PHP 4 Compatible Constructor
|
302 |
*
|
303 |
* @since 3.0
|
304 |
*/
|
305 |
+
function front_head() {
|
306 |
+
try {
|
307 |
+
?>
|
308 |
<style type="text/css" media="screen">
|
309 |
+
div.printfriendly a, div.printfriendly a:link, div.printfriendly a:hover, div.printfriendly a:visited {
|
310 |
+
text-decoration: none;
|
311 |
+
border: none;
|
312 |
+
}
|
313 |
</style>
|
314 |
<?php
|
315 |
|
363 |
}
|
364 |
</style>
|
365 |
<?php
|
366 |
+
} catch (Exception $e) {
|
367 |
+
$this->raven_catch($e);
|
368 |
+
}
|
369 |
}
|
370 |
|
371 |
/**
|
416 |
* @return string $button or $content with the button added to the content when appropriate, just the content when button shouldn't be added or just button when called manually.
|
417 |
*/
|
418 |
function show_link( $content = false ) {
|
419 |
+
try {
|
420 |
+
$is_manual = $this->is_manual();
|
421 |
|
422 |
+
if( !$content && !$is_manual )
|
423 |
+
return "";
|
424 |
|
425 |
+
$button = $this->getButton();
|
426 |
+
if ( $is_manual )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
427 |
{
|
428 |
// Hook the script call now, so it only get's loaded when needed, and need is determined by the user calling pf_button
|
429 |
add_action( 'wp_footer', array( &$this, 'print_script_footer' ) );
|
430 |
+
return $button;
|
|
|
|
|
|
|
|
|
431 |
}
|
432 |
+
|
433 |
else
|
434 |
{
|
435 |
+
if ( (is_page() && ( isset($this->options['show_on_pages']) && 'on' === $this->options['show_on_pages'] ) )
|
436 |
+
|| (is_home() && ( ( isset($this->options['show_on_homepage']) && 'on' === $this->options['show_on_homepage'] ) && $this->category_included() ) )
|
437 |
+
|| (is_tax() && ( ( isset($this->options['show_on_taxonomies']) && 'on' === $this->options['show_on_taxonomies'] ) && $this->category_included() ) )
|
438 |
+
|| (is_category() && ( ( isset($this->options['show_on_categories']) && 'on' === $this->options['show_on_categories'] ) && $this->category_included() ) )
|
439 |
+
|| (is_single() && ( ( isset($this->options['show_on_posts']) && 'on' === $this->options['show_on_posts'] ) && $this->category_included() ) ) )
|
440 |
+
{
|
441 |
+
// Hook the script call now, so it only get's loaded when needed, and need is determined by the user calling pf_button
|
442 |
+
add_action( 'wp_footer', array( &$this, 'print_script_footer' ) );
|
443 |
+
|
444 |
+
if ( $this->options['content_placement'] == 'before' )
|
445 |
+
return $button.$content;
|
446 |
+
else
|
447 |
+
return $content.$button;
|
448 |
+
}
|
449 |
+
else
|
450 |
+
{
|
451 |
+
return $content;
|
452 |
+
}
|
453 |
}
|
454 |
+
} catch (Exception $e) {
|
455 |
+
$this->raven_catch($e);
|
456 |
}
|
|
|
457 |
}
|
458 |
|
459 |
|
541 |
* @since 3.0
|
542 |
*/
|
543 |
function init() {
|
544 |
+
try {
|
545 |
+
// Allow for localization
|
546 |
+
load_plugin_textdomain( $this->hook, false, basename( dirname( __FILE__ ) ) . '/languages' );
|
547 |
+
|
548 |
+
// Register our option array
|
549 |
+
register_setting( $this->option_name, $this->option_name, array( &$this, 'options_validate' ) );
|
550 |
+
} catch (Exception $e) {
|
551 |
+
$this->raven_catch($e);
|
552 |
+
}
|
553 |
}
|
554 |
|
555 |
/**
|
738 |
* @since 3.0
|
739 |
*/
|
740 |
function add_config_page() {
|
741 |
+
try {
|
742 |
+
$this->settings_page = add_options_page( __( 'PrintFriendly Options', $this->hook ), __( 'Print Friendly & PDF', $this->hook ), 'manage_options', $this->hook, array( &$this, 'config_page' ) );
|
743 |
|
744 |
+
//register callback gets call prior your own page gets rendered
|
745 |
+
add_action('load-'.$this->settings_page, array(&$this, 'on_load_printfriendly'));
|
746 |
+
} catch (Exception $e) {
|
747 |
+
$this->raven_catch($e);
|
748 |
+
}
|
749 |
}
|
750 |
|
751 |
/**
|
754 |
* @since 3.0
|
755 |
*/
|
756 |
function contextual_help( $contextual_help, $screen_id ) {
|
757 |
+
try {
|
758 |
+
if ( $this->settings_page == $screen_id ) {
|
759 |
+
$contextual_help = '<strong>'.__( "Need Help?", $this->hook ).'</strong><br/>'
|
760 |
+
.sprintf( __( "Be sure to check out the %s!", $this->hook), '<a href="https://wordpress.org/extend/plugins/printfriendly/faq/">'.__( "Frequently Asked Questions", $this->hook ).'</a>' );
|
761 |
+
}
|
762 |
+
return $contextual_help;
|
763 |
+
} catch (Exception $e) {
|
764 |
+
$this->raven_catch($e);
|
765 |
}
|
|
|
766 |
}
|
767 |
|
768 |
/**
|
772 |
* @param string $hook_suffix hook to check against whether the current page is the PrintFriendly settings page.
|
773 |
*/
|
774 |
function admin_enqueue_scripts( $screen_id ) {
|
775 |
+
try {
|
776 |
+
if ( $this->settings_page == $screen_id ) {
|
777 |
+
$ver = '3.2.5';
|
778 |
+
wp_register_script( 'pf-color-picker', plugins_url( 'colorpicker.js', __FILE__ ), array( 'jquery', 'media-upload' ), $ver );
|
779 |
+
wp_register_script( 'pf-admin-js', plugins_url( 'admin.js', __FILE__ ), array( 'jquery', 'media-upload' ), $ver );
|
780 |
|
781 |
+
wp_enqueue_script( 'pf-color-picker' );
|
782 |
+
wp_enqueue_script( 'pf-admin-js' );
|
783 |
|
784 |
|
785 |
+
wp_enqueue_style( 'printfriendly-admin-css', plugins_url( 'admin.css', __FILE__ ), array(), $ver);
|
786 |
+
}
|
787 |
+
} catch (Exception $e) {
|
788 |
+
$this->raven_catch($e);
|
789 |
}
|
790 |
}
|
791 |
|
798 |
* @return array $links the links with the settings link added to it if appropriate.
|
799 |
*/
|
800 |
function filter_plugin_actions( $links, $file ){
|
801 |
+
try {
|
802 |
+
// Static so we don't call plugin_basename on every plugin row.
|
803 |
+
static $this_plugin;
|
804 |
+
if ( ! $this_plugin ) $this_plugin = plugin_basename( __FILE__ );
|
805 |
+
|
806 |
+
if ( $file == $this_plugin ){
|
807 |
+
$settings_link = '<a href="options-general.php?page='.$this->hook.'">' . __( 'Settings', $this->hook ) . '</a>';
|
808 |
+
array_unshift( $links, $settings_link ); // before other links
|
809 |
+
}
|
810 |
|
811 |
+
return $links;
|
812 |
+
} catch (Exception $e) {
|
813 |
+
$this->raven_catch($e);
|
814 |
}
|
|
|
815 |
}
|
816 |
|
817 |
/**
|
820 |
* @since 3.0
|
821 |
*/
|
822 |
function set_defaults() {
|
823 |
+
try {
|
824 |
+
// Set some defaults
|
825 |
+
$this->options = array(
|
826 |
+
'button_type' => 'pf-button.gif',
|
827 |
+
'content_position' => 'left',
|
828 |
+
'content_placement' => 'after',
|
829 |
+
'custom_image' => 'https://cdn.printfriendly.com/pf-icon.gif',
|
830 |
+
'custom_text' => 'Print Friendly',
|
831 |
+
'enable_css' => 'on',
|
832 |
+
'margin_top' => '12',
|
833 |
+
'margin_right' => '12',
|
834 |
+
'margin_bottom' => '12',
|
835 |
+
'margin_left' => '12',
|
836 |
+
'show_on_posts' => 'on',
|
837 |
+
'show_on_pages' => 'on',
|
838 |
+
'text_color' => '#6D9F00',
|
839 |
+
'text_size' => 14,
|
840 |
+
'logo' => 'favicon',
|
841 |
+
'image_url' => '',
|
842 |
+
'tagline' => '',
|
843 |
+
'click_to_delete' => '0', // 0 - allow, 1 - do not allow
|
844 |
+
'hide-images' => '0', // 0 - show images, 1 - hide images
|
845 |
+
'image-style' => 'right', // 'right', 'left', 'none', 'block'
|
846 |
+
'email' => '0', // 0 - allow, 1 - do not allow
|
847 |
+
'pdf' => '0', // 0 - allow, 1 - do not allow
|
848 |
+
'print' => '0', // 0 - allow, 1 - do not allow
|
849 |
+
'password_protected' => 'no',
|
850 |
+
'javascript' => 'yes',
|
851 |
+
'custom_css_url' => '',
|
852 |
+
'enable_google_analytics' => 'no',
|
853 |
+
'enable_error_reporting' => 'yes',
|
854 |
+
'pf_algo' => 'wp'
|
855 |
+
// 'category_ids' => array('all'),
|
856 |
+
);
|
857 |
+
|
858 |
+
// Check whether the old badly named singular options are there, if so, use the data and delete them.
|
859 |
+
foreach ( array_keys( $this->options ) as $opt ) {
|
860 |
+
$old_opt = get_option( 'pf_'.$opt );
|
861 |
+
if ( $old_opt !== false ) {
|
862 |
+
$this->options[$opt] = $old_opt;
|
863 |
+
delete_option( 'pf_'.$opt );
|
864 |
+
}
|
865 |
}
|
|
|
866 |
|
867 |
+
// This should always be set to the latest immediately when defaults are pushed in.
|
868 |
+
$this->options['db_version'] = $this->db_version;
|
869 |
|
870 |
+
update_option( $this->option_name, $this->options );
|
871 |
+
} catch (Exception $e) {
|
872 |
+
$this->raven_catch($e);
|
873 |
+
}
|
874 |
}
|
875 |
|
876 |
/**
|
970 |
// update options to version 6
|
971 |
// Replacement for db version 5 - should also be run for those already upgraded
|
972 |
if($this->options['db_version'] < 6) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
973 |
unset($this->options['category_ids']);
|
974 |
}
|
975 |
|
987 |
}
|
988 |
|
989 |
if($this->options['db_version'] < 9) {
|
990 |
+
$this->options['pf_algo'] = 'wp';
|
991 |
}
|
992 |
|
993 |
if($this->options['db_version'] < 10) {
|
994 |
$this->options['enable_error_reporting'] = 'yes';
|
995 |
}
|
996 |
|
997 |
+
if($this->options['db_version'] < 11) {
|
998 |
+
if (!isset($this->options['custom_css_url'])) {
|
999 |
+
$this->options['custom_css_url'] = '';
|
1000 |
+
}
|
1001 |
+
}
|
1002 |
+
|
1003 |
$this->options['db_version'] = $this->db_version;
|
1004 |
|
1005 |
update_option( $this->option_name, $this->options );
|
1153 |
*
|
1154 |
*/
|
1155 |
function is_manual() {
|
1156 |
+
try {
|
1157 |
+
return !(isset($this->options['show_on_posts']) ||
|
1158 |
+
isset($this->options['show_on_pages']) ||
|
1159 |
+
isset($this->options['show_on_homepage']) ||
|
1160 |
+
isset($this->options['show_on_categories']) ||
|
1161 |
+
// (isset($this->options['category_ids']) && count($this->options['category_ids']) > 0) ||
|
1162 |
+
isset($this->options['show_on_taxonomies']));
|
1163 |
+
} catch (Exception $e) {
|
1164 |
+
$this->raven_catch($e);
|
1165 |
+
}
|
1166 |
}
|
1167 |
|
1168 |
|
1236 |
}
|
1237 |
}
|
1238 |
|
1239 |
+
function console_log( $data ) {
|
1240 |
+
echo '<script>';
|
1241 |
+
echo 'console.log(' . json_encode( $data ) . ')';
|
1242 |
+
echo '</script>';
|
1243 |
+
}
|
1244 |
+
|
1245 |
/**
|
1246 |
* Output the config page
|
1247 |
*
|
1552 |
global $printfriendly;
|
1553 |
return $printfriendly->getButton(true);
|
1554 |
}
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: printfriendly,joostdevalk, jrf
|
|
3 |
Tags: print, pdf, email, print button, wp-print, print recipe, print post, print page, print widget, print plugin, printable, wp-pdf, pdf post, pdf page, pdf button, pdf widget, pdf plugin, woocommerce print, woocommerce pdf
|
4 |
Requires at least: 2.8
|
5 |
Tested up to: 4.7
|
6 |
-
Stable tag: 3.
|
7 |
|
8 |
|
9 |
The #1 Print, PDF, Email button. Stylish, full featured, customizable. Add custom header, footer, and more.
|
@@ -140,6 +140,9 @@ You can [hide the Print, PDF, and Email button](https://support.printfriendly.co
|
|
140 |
|
141 |
== Changelog ==
|
142 |
|
|
|
|
|
|
|
143 |
= 3.8.1 =
|
144 |
* Improve automatic error reporting.
|
145 |
|
3 |
Tags: print, pdf, email, print button, wp-print, print recipe, print post, print page, print widget, print plugin, printable, wp-pdf, pdf post, pdf page, pdf button, pdf widget, pdf plugin, woocommerce print, woocommerce pdf
|
4 |
Requires at least: 2.8
|
5 |
Tested up to: 4.7
|
6 |
+
Stable tag: 3.7.4
|
7 |
|
8 |
|
9 |
The #1 Print, PDF, Email button. Stylish, full featured, customizable. Add custom header, footer, and more.
|
140 |
|
141 |
== Changelog ==
|
142 |
|
143 |
+
= 3.8.4 =
|
144 |
+
* Bug fix.
|
145 |
+
|
146 |
= 3.8.1 =
|
147 |
* Improve automatic error reporting.
|
148 |
|
vendor/{Raven → PrintFriendly/Raven}/Autoloader.php
RENAMED
@@ -14,15 +14,15 @@
|
|
14 |
*
|
15 |
* @package raven
|
16 |
*/
|
17 |
-
class
|
18 |
{
|
19 |
/**
|
20 |
-
* Registers
|
21 |
*/
|
22 |
public static function register()
|
23 |
{
|
24 |
ini_set('unserialize_callback_func', 'spl_autoload_call');
|
25 |
-
spl_autoload_register(array('
|
26 |
}
|
27 |
|
28 |
/**
|
@@ -32,11 +32,11 @@ class Raven_Autoloader
|
|
32 |
*/
|
33 |
public static function autoload($class)
|
34 |
{
|
35 |
-
if (substr($class, 0,
|
36 |
return;
|
37 |
}
|
38 |
|
39 |
-
$file = dirname(__FILE__).'
|
40 |
if (is_file($file)) {
|
41 |
/** @noinspection PhpIncludeInspection */
|
42 |
require $file;
|
14 |
*
|
15 |
* @package raven
|
16 |
*/
|
17 |
+
class PrintFriendly_Raven_Autoloader
|
18 |
{
|
19 |
/**
|
20 |
+
* Registers PrintFriendly_Raven_Autoloader as an SPL autoloader.
|
21 |
*/
|
22 |
public static function register()
|
23 |
{
|
24 |
ini_set('unserialize_callback_func', 'spl_autoload_call');
|
25 |
+
spl_autoload_register(array('PrintFriendly_Raven_Autoloader', 'autoload'));
|
26 |
}
|
27 |
|
28 |
/**
|
32 |
*/
|
33 |
public static function autoload($class)
|
34 |
{
|
35 |
+
if (substr($class, 0, 20) !== 'PrintFriendly_Raven_') {
|
36 |
return;
|
37 |
}
|
38 |
|
39 |
+
$file = dirname(__FILE__).'/../../'.str_replace(array('_', "\0"), array('/', ''), $class).'.php';
|
40 |
if (is_file($file)) {
|
41 |
/** @noinspection PhpIncludeInspection */
|
42 |
require $file;
|
vendor/{Raven → PrintFriendly/Raven}/Breadcrumbs.php
RENAMED
@@ -14,7 +14,7 @@
|
|
14 |
* @package raven
|
15 |
*/
|
16 |
|
17 |
-
class
|
18 |
{
|
19 |
public $count;
|
20 |
public $pos;
|
14 |
* @package raven
|
15 |
*/
|
16 |
|
17 |
+
class PrintFriendly_Raven_Breadcrumbs
|
18 |
{
|
19 |
public $count;
|
20 |
public $pos;
|
vendor/{Raven → PrintFriendly/Raven}/Breadcrumbs/ErrorHandler.php
RENAMED
@@ -1,18 +1,18 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class
|
4 |
{
|
5 |
protected $existingHandler;
|
6 |
|
7 |
/**
|
8 |
-
* @var
|
9 |
*/
|
10 |
protected $ravenClient;
|
11 |
|
12 |
/**
|
13 |
-
* @param
|
14 |
*/
|
15 |
-
public function __construct(
|
16 |
{
|
17 |
$this->ravenClient = $ravenClient;
|
18 |
}
|
1 |
<?php
|
2 |
|
3 |
+
class PrintFriendly_Raven_Breadcrumbs_ErrorHandler
|
4 |
{
|
5 |
protected $existingHandler;
|
6 |
|
7 |
/**
|
8 |
+
* @var PrintFriendly_Raven_Client the client object that sends the message to the server
|
9 |
*/
|
10 |
protected $ravenClient;
|
11 |
|
12 |
/**
|
13 |
+
* @param PrintFriendly_Raven_Client $ravenClient
|
14 |
*/
|
15 |
+
public function __construct(PrintFriendly_Raven_Client $ravenClient)
|
16 |
{
|
17 |
$this->ravenClient = $ravenClient;
|
18 |
}
|
vendor/{Raven → PrintFriendly/Raven}/Breadcrumbs/MonologHandler.php
RENAMED
@@ -3,35 +3,35 @@
|
|
3 |
use Monolog\Logger;
|
4 |
use Monolog\Handler\AbstractProcessingHandler;
|
5 |
|
6 |
-
class
|
7 |
{
|
8 |
/**
|
9 |
* Translates Monolog log levels to Raven log levels.
|
10 |
*/
|
11 |
protected $logLevels = array(
|
12 |
-
Logger::DEBUG =>
|
13 |
-
Logger::INFO =>
|
14 |
-
Logger::NOTICE =>
|
15 |
-
Logger::WARNING =>
|
16 |
-
Logger::ERROR =>
|
17 |
-
Logger::CRITICAL =>
|
18 |
-
Logger::ALERT =>
|
19 |
-
Logger::EMERGENCY =>
|
20 |
);
|
21 |
|
22 |
protected $excMatch = '/^exception \'([^\']+)\' with message \'(.+)\' in .+$/s';
|
23 |
|
24 |
/**
|
25 |
-
* @var
|
26 |
*/
|
27 |
protected $ravenClient;
|
28 |
|
29 |
/**
|
30 |
-
* @param
|
31 |
* @param int $level The minimum logging level at which this handler will be triggered
|
32 |
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
33 |
*/
|
34 |
-
public function __construct(
|
35 |
{
|
36 |
parent::__construct($level, $bubble);
|
37 |
|
3 |
use Monolog\Logger;
|
4 |
use Monolog\Handler\AbstractProcessingHandler;
|
5 |
|
6 |
+
class PrintFriendly_Raven_Breadcrumbs_MonologHandler extends AbstractProcessingHandler
|
7 |
{
|
8 |
/**
|
9 |
* Translates Monolog log levels to Raven log levels.
|
10 |
*/
|
11 |
protected $logLevels = array(
|
12 |
+
Logger::DEBUG => PrintFriendly_Raven_Client::DEBUG,
|
13 |
+
Logger::INFO => PrintFriendly_Raven_Client::INFO,
|
14 |
+
Logger::NOTICE => PrintFriendly_Raven_Client::INFO,
|
15 |
+
Logger::WARNING => PrintFriendly_Raven_Client::WARNING,
|
16 |
+
Logger::ERROR => PrintFriendly_Raven_Client::ERROR,
|
17 |
+
Logger::CRITICAL => PrintFriendly_Raven_Client::FATAL,
|
18 |
+
Logger::ALERT => PrintFriendly_Raven_Client::FATAL,
|
19 |
+
Logger::EMERGENCY => PrintFriendly_Raven_Client::FATAL,
|
20 |
);
|
21 |
|
22 |
protected $excMatch = '/^exception \'([^\']+)\' with message \'(.+)\' in .+$/s';
|
23 |
|
24 |
/**
|
25 |
+
* @var PrintFriendly_Raven_Client the client object that sends the message to the server
|
26 |
*/
|
27 |
protected $ravenClient;
|
28 |
|
29 |
/**
|
30 |
+
* @param PrintFriendly_Raven_Client $ravenClient
|
31 |
* @param int $level The minimum logging level at which this handler will be triggered
|
32 |
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
33 |
*/
|
34 |
+
public function __construct(PrintFriendly_Raven_Client $ravenClient, $level = Logger::DEBUG, $bubble = true)
|
35 |
{
|
36 |
parent::__construct($level, $bubble);
|
37 |
|
vendor/{Raven → PrintFriendly/Raven}/Client.php
RENAMED
@@ -14,7 +14,7 @@
|
|
14 |
* @package raven
|
15 |
*/
|
16 |
|
17 |
-
class
|
18 |
{
|
19 |
const VERSION = '1.7.x-dev';
|
20 |
|
@@ -31,7 +31,7 @@ class Raven_Client
|
|
31 |
|
32 |
public $breadcrumbs;
|
33 |
/**
|
34 |
-
* @var
|
35 |
*/
|
36 |
public $context;
|
37 |
public $extra_data;
|
@@ -94,7 +94,7 @@ class Raven_Client
|
|
94 |
public $trust_x_forwarded_proto;
|
95 |
public $mb_detect_order;
|
96 |
/**
|
97 |
-
* @var
|
98 |
*/
|
99 |
public $processors;
|
100 |
/**
|
@@ -110,7 +110,7 @@ class Raven_Client
|
|
110 |
public $_pending_events;
|
111 |
public $sdk;
|
112 |
/**
|
113 |
-
* @var
|
114 |
*/
|
115 |
protected $_curl_handler;
|
116 |
/**
|
@@ -142,42 +142,42 @@ class Raven_Client
|
|
142 |
$options = array_merge($options, self::parseDSN($dsn));
|
143 |
}
|
144 |
|
145 |
-
$this->logger =
|
146 |
-
$this->server =
|
147 |
-
$this->secret_key =
|
148 |
-
$this->public_key =
|
149 |
-
$this->project =
|
150 |
-
$this->auto_log_stacks = (bool)
|
151 |
-
$this->name =
|
152 |
-
$this->site =
|
153 |
-
$this->tags =
|
154 |
-
$this->release =
|
155 |
-
$this->environment =
|
156 |
-
$this->sample_rate =
|
157 |
-
$this->trace = (bool)
|
158 |
-
$this->timeout =
|
159 |
-
$this->message_limit =
|
160 |
-
$this->exclude =
|
161 |
$this->severity_map = null;
|
162 |
-
$this->http_proxy =
|
163 |
-
$this->extra_data =
|
164 |
-
$this->send_callback =
|
165 |
-
$this->curl_method =
|
166 |
-
$this->curl_path =
|
167 |
-
$this->curl_ipv4 =
|
168 |
-
$this->ca_cert =
|
169 |
-
$this->verify_ssl =
|
170 |
-
$this->curl_ssl_version =
|
171 |
-
$this->trust_x_forwarded_proto =
|
172 |
-
$this->transport =
|
173 |
-
$this->mb_detect_order =
|
174 |
-
$this->error_types =
|
175 |
|
176 |
// app path is used to determine if code is part of your application
|
177 |
-
$this->setAppPath(
|
178 |
-
$this->setExcludedAppPaths(
|
179 |
// a list of prefixes used to coerce absolute paths into relative
|
180 |
-
$this->setPrefixes(
|
181 |
$this->processors = $this->setProcessorsFromOptions($options);
|
182 |
|
183 |
$this->_lasterror = null;
|
@@ -186,33 +186,33 @@ class Raven_Client
|
|
186 |
$this->_last_event_id = null;
|
187 |
$this->_user = null;
|
188 |
$this->_pending_events = array();
|
189 |
-
$this->context = new
|
190 |
-
$this->breadcrumbs = new
|
191 |
$this->_shutdown_function_has_been_set = false;
|
192 |
|
193 |
-
$this->sdk =
|
194 |
'name' => 'sentry-php',
|
195 |
'version' => self::VERSION,
|
196 |
));
|
197 |
-
$this->serializer = new
|
198 |
-
$this->reprSerializer = new
|
199 |
|
200 |
if ($this->curl_method == 'async') {
|
201 |
-
$this->_curl_handler = new
|
202 |
}
|
203 |
|
204 |
-
$this->transaction = new
|
205 |
if (static::is_http_request() && isset($_SERVER['PATH_INFO'])) {
|
206 |
// @codeCoverageIgnoreStart
|
207 |
$this->transaction->push($_SERVER['PATH_INFO']);
|
208 |
// @codeCoverageIgnoreEnd
|
209 |
}
|
210 |
|
211 |
-
if (
|
212 |
$this->registerDefaultBreadcrumbHandlers();
|
213 |
}
|
214 |
|
215 |
-
if (
|
216 |
$this->registerShutdownFunction();
|
217 |
}
|
218 |
}
|
@@ -239,9 +239,9 @@ class Raven_Client
|
|
239 |
public function install()
|
240 |
{
|
241 |
if ($this->error_handler) {
|
242 |
-
throw new
|
243 |
}
|
244 |
-
$this->error_handler = new
|
245 |
$this->error_handler->registerExceptionHandler();
|
246 |
$this->error_handler->registerErrorHandler();
|
247 |
$this->error_handler->registerShutdownFunction();
|
@@ -324,7 +324,7 @@ class Raven_Client
|
|
324 |
|
325 |
/**
|
326 |
* @param array $value
|
327 |
-
* @return
|
328 |
*/
|
329 |
public function setPrefixes($value)
|
330 |
{
|
@@ -366,7 +366,7 @@ class Raven_Client
|
|
366 |
* the data to the upstream Sentry server.
|
367 |
*
|
368 |
* @param Callable $value Function to be called
|
369 |
-
* @return
|
370 |
*/
|
371 |
public function setTransport($value)
|
372 |
{
|
@@ -375,29 +375,29 @@ class Raven_Client
|
|
375 |
}
|
376 |
|
377 |
/**
|
378 |
-
* @return string[]|
|
379 |
*/
|
380 |
public static function getDefaultProcessors()
|
381 |
{
|
382 |
return array(
|
383 |
-
'
|
384 |
);
|
385 |
}
|
386 |
|
387 |
/**
|
388 |
-
* Sets the
|
389 |
* sent to Sentry.
|
390 |
*
|
391 |
* @param $options
|
392 |
-
* @return
|
393 |
*/
|
394 |
public function setProcessorsFromOptions($options)
|
395 |
{
|
396 |
$processors = array();
|
397 |
-
foreach (
|
398 |
/**
|
399 |
-
* @var
|
400 |
-
* @var
|
401 |
*/
|
402 |
$new_processor = new $processor($this);
|
403 |
|
@@ -587,14 +587,14 @@ class Raven_Client
|
|
587 |
array_unshift($trace, $frame_where_exception_thrown);
|
588 |
|
589 |
// manually trigger autoloading, as it's not done in some edge cases due to PHP bugs (see #60149)
|
590 |
-
if (!class_exists('
|
591 |
// @codeCoverageIgnoreStart
|
592 |
-
spl_autoload_call('
|
593 |
// @codeCoverageIgnoreEnd
|
594 |
}
|
595 |
|
596 |
$exc_data['stacktrace'] = array(
|
597 |
-
'frames' =>
|
598 |
$trace, $this->trace, $vars, $this->message_limit, $this->prefixes,
|
599 |
$this->app_path, $this->excluded_app_paths, $this->serializer, $this->reprSerializer
|
600 |
),
|
@@ -673,7 +673,7 @@ class Raven_Client
|
|
673 |
|
674 |
protected function registerDefaultBreadcrumbHandlers()
|
675 |
{
|
676 |
-
$handler = new
|
677 |
$handler->install();
|
678 |
}
|
679 |
|
@@ -846,15 +846,15 @@ class Raven_Client
|
|
846 |
|
847 |
if (!empty($stack)) {
|
848 |
// manually trigger autoloading, as it's not done in some edge cases due to PHP bugs (see #60149)
|
849 |
-
if (!class_exists('
|
850 |
// @codeCoverageIgnoreStart
|
851 |
-
spl_autoload_call('
|
852 |
// @codeCoverageIgnoreEnd
|
853 |
}
|
854 |
|
855 |
if (!isset($data['stacktrace']) && !isset($data['exception'])) {
|
856 |
$data['stacktrace'] = array(
|
857 |
-
'frames' =>
|
858 |
$stack, $this->trace, $vars, $this->message_limit, $this->prefixes,
|
859 |
$this->app_path, $this->excluded_app_paths, $this->serializer, $this->reprSerializer
|
860 |
),
|
@@ -899,7 +899,7 @@ class Raven_Client
|
|
899 |
}
|
900 |
|
901 |
/**
|
902 |
-
* Process data through all defined
|
903 |
*
|
904 |
* @param array $data Associative array of data to log
|
905 |
*/
|
@@ -918,7 +918,7 @@ class Raven_Client
|
|
918 |
$this->_pending_events = array();
|
919 |
if ($this->store_errors_for_bulk_send) {
|
920 |
//in case an error occurs after this is called, on shutdown, send any new errors.
|
921 |
-
$this->store_errors_for_bulk_send = !defined('
|
922 |
}
|
923 |
}
|
924 |
|
@@ -928,7 +928,7 @@ class Raven_Client
|
|
928 |
*/
|
929 |
public function encode(&$data)
|
930 |
{
|
931 |
-
$message =
|
932 |
if ($message === false) {
|
933 |
if (function_exists('json_last_error_msg')) {
|
934 |
$this->_lasterror = json_last_error_msg();
|
@@ -1167,7 +1167,7 @@ class Raven_Client
|
|
1167 |
* Generate a Sentry authorization header string
|
1168 |
*
|
1169 |
* @param string $timestamp Timestamp when the event occurred
|
1170 |
-
* @param string $client HTTP client name (not
|
1171 |
* @param string $api_key Sentry API key
|
1172 |
* @param string $secret_key Sentry API key
|
1173 |
* @return string
|
@@ -1302,27 +1302,27 @@ class Raven_Client
|
|
1302 |
return $this->severity_map[$severity];
|
1303 |
}
|
1304 |
switch ($severity) {
|
1305 |
-
case E_ERROR: return
|
1306 |
-
case E_WARNING: return
|
1307 |
-
case E_PARSE: return
|
1308 |
-
case E_NOTICE: return
|
1309 |
-
case E_CORE_ERROR: return
|
1310 |
-
case E_CORE_WARNING: return
|
1311 |
-
case E_COMPILE_ERROR: return
|
1312 |
-
case E_COMPILE_WARNING: return
|
1313 |
-
case E_USER_ERROR: return
|
1314 |
-
case E_USER_WARNING: return
|
1315 |
-
case E_USER_NOTICE: return
|
1316 |
-
case E_STRICT: return
|
1317 |
-
case E_RECOVERABLE_ERROR: return
|
1318 |
}
|
1319 |
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
|
1320 |
switch ($severity) {
|
1321 |
-
case E_DEPRECATED: return
|
1322 |
-
case E_USER_DEPRECATED: return
|
1323 |
}
|
1324 |
}
|
1325 |
-
return
|
1326 |
}
|
1327 |
|
1328 |
/**
|
@@ -1356,8 +1356,8 @@ class Raven_Client
|
|
1356 |
|
1357 |
public function onShutdown()
|
1358 |
{
|
1359 |
-
if (!defined('
|
1360 |
-
define('
|
1361 |
}
|
1362 |
$this->sendUnsentErrors();
|
1363 |
if ($this->curl_method == 'async') {
|
14 |
* @package raven
|
15 |
*/
|
16 |
|
17 |
+
class PrintFriendly_Raven_Client
|
18 |
{
|
19 |
const VERSION = '1.7.x-dev';
|
20 |
|
31 |
|
32 |
public $breadcrumbs;
|
33 |
/**
|
34 |
+
* @var PrintFriendly_Raven_Context
|
35 |
*/
|
36 |
public $context;
|
37 |
public $extra_data;
|
94 |
public $trust_x_forwarded_proto;
|
95 |
public $mb_detect_order;
|
96 |
/**
|
97 |
+
* @var PrintFriendly_Raven_Processor[]
|
98 |
*/
|
99 |
public $processors;
|
100 |
/**
|
110 |
public $_pending_events;
|
111 |
public $sdk;
|
112 |
/**
|
113 |
+
* @var PrintFriendly_Raven_CurlHandler
|
114 |
*/
|
115 |
protected $_curl_handler;
|
116 |
/**
|
142 |
$options = array_merge($options, self::parseDSN($dsn));
|
143 |
}
|
144 |
|
145 |
+
$this->logger = PrintFriendly_Raven_Util::get($options, 'logger', 'php');
|
146 |
+
$this->server = PrintFriendly_Raven_Util::get($options, 'server');
|
147 |
+
$this->secret_key = PrintFriendly_Raven_Util::get($options, 'secret_key');
|
148 |
+
$this->public_key = PrintFriendly_Raven_Util::get($options, 'public_key');
|
149 |
+
$this->project = PrintFriendly_Raven_Util::get($options, 'project', 1);
|
150 |
+
$this->auto_log_stacks = (bool) PrintFriendly_Raven_Util::get($options, 'auto_log_stacks', false);
|
151 |
+
$this->name = PrintFriendly_Raven_Util::get($options, 'name', PrintFriendly_Raven_Compat::gethostname());
|
152 |
+
$this->site = PrintFriendly_Raven_Util::get($options, 'site', self::_server_variable('SERVER_NAME'));
|
153 |
+
$this->tags = PrintFriendly_Raven_Util::get($options, 'tags', array());
|
154 |
+
$this->release = PrintFriendly_Raven_Util::get($options, 'release', null);
|
155 |
+
$this->environment = PrintFriendly_Raven_Util::get($options, 'environment', null);
|
156 |
+
$this->sample_rate = PrintFriendly_Raven_Util::get($options, 'sample_rate', 1);
|
157 |
+
$this->trace = (bool) PrintFriendly_Raven_Util::get($options, 'trace', true);
|
158 |
+
$this->timeout = PrintFriendly_Raven_Util::get($options, 'timeout', 2);
|
159 |
+
$this->message_limit = PrintFriendly_Raven_Util::get($options, 'message_limit', self::MESSAGE_LIMIT);
|
160 |
+
$this->exclude = PrintFriendly_Raven_Util::get($options, 'exclude', array());
|
161 |
$this->severity_map = null;
|
162 |
+
$this->http_proxy = PrintFriendly_Raven_Util::get($options, 'http_proxy');
|
163 |
+
$this->extra_data = PrintFriendly_Raven_Util::get($options, 'extra', array());
|
164 |
+
$this->send_callback = PrintFriendly_Raven_Util::get($options, 'send_callback', null);
|
165 |
+
$this->curl_method = PrintFriendly_Raven_Util::get($options, 'curl_method', 'sync');
|
166 |
+
$this->curl_path = PrintFriendly_Raven_Util::get($options, 'curl_path', 'curl');
|
167 |
+
$this->curl_ipv4 = PrintFriendly_Raven_Util::get($options, 'curl_ipv4', true);
|
168 |
+
$this->ca_cert = PrintFriendly_Raven_Util::get($options, 'ca_cert', static::get_default_ca_cert());
|
169 |
+
$this->verify_ssl = PrintFriendly_Raven_Util::get($options, 'verify_ssl', true);
|
170 |
+
$this->curl_ssl_version = PrintFriendly_Raven_Util::get($options, 'curl_ssl_version');
|
171 |
+
$this->trust_x_forwarded_proto = PrintFriendly_Raven_Util::get($options, 'trust_x_forwarded_proto');
|
172 |
+
$this->transport = PrintFriendly_Raven_Util::get($options, 'transport', null);
|
173 |
+
$this->mb_detect_order = PrintFriendly_Raven_Util::get($options, 'mb_detect_order', null);
|
174 |
+
$this->error_types = PrintFriendly_Raven_Util::get($options, 'error_types', null);
|
175 |
|
176 |
// app path is used to determine if code is part of your application
|
177 |
+
$this->setAppPath(PrintFriendly_Raven_Util::get($options, 'app_path', null));
|
178 |
+
$this->setExcludedAppPaths(PrintFriendly_Raven_Util::get($options, 'excluded_app_paths', null));
|
179 |
// a list of prefixes used to coerce absolute paths into relative
|
180 |
+
$this->setPrefixes(PrintFriendly_Raven_Util::get($options, 'prefixes', static::getDefaultPrefixes()));
|
181 |
$this->processors = $this->setProcessorsFromOptions($options);
|
182 |
|
183 |
$this->_lasterror = null;
|
186 |
$this->_last_event_id = null;
|
187 |
$this->_user = null;
|
188 |
$this->_pending_events = array();
|
189 |
+
$this->context = new PrintFriendly_Raven_Context();
|
190 |
+
$this->breadcrumbs = new PrintFriendly_Raven_Breadcrumbs();
|
191 |
$this->_shutdown_function_has_been_set = false;
|
192 |
|
193 |
+
$this->sdk = PrintFriendly_Raven_Util::get($options, 'sdk', array(
|
194 |
'name' => 'sentry-php',
|
195 |
'version' => self::VERSION,
|
196 |
));
|
197 |
+
$this->serializer = new PrintFriendly_Raven_Serializer($this->mb_detect_order);
|
198 |
+
$this->reprSerializer = new PrintFriendly_Raven_ReprSerializer($this->mb_detect_order);
|
199 |
|
200 |
if ($this->curl_method == 'async') {
|
201 |
+
$this->_curl_handler = new PrintFriendly_Raven_CurlHandler($this->get_curl_options());
|
202 |
}
|
203 |
|
204 |
+
$this->transaction = new PrintFriendly_Raven_TransactionStack();
|
205 |
if (static::is_http_request() && isset($_SERVER['PATH_INFO'])) {
|
206 |
// @codeCoverageIgnoreStart
|
207 |
$this->transaction->push($_SERVER['PATH_INFO']);
|
208 |
// @codeCoverageIgnoreEnd
|
209 |
}
|
210 |
|
211 |
+
if (PrintFriendly_Raven_Util::get($options, 'install_default_breadcrumb_handlers', true)) {
|
212 |
$this->registerDefaultBreadcrumbHandlers();
|
213 |
}
|
214 |
|
215 |
+
if (PrintFriendly_Raven_Util::get($options, 'install_shutdown_handler', true)) {
|
216 |
$this->registerShutdownFunction();
|
217 |
}
|
218 |
}
|
239 |
public function install()
|
240 |
{
|
241 |
if ($this->error_handler) {
|
242 |
+
throw new PrintFriendly_Raven_Exception(sprintf('%s->install() must only be called once', get_class($this)));
|
243 |
}
|
244 |
+
$this->error_handler = new PrintFriendly_Raven_ErrorHandler($this, false, $this->error_types);
|
245 |
$this->error_handler->registerExceptionHandler();
|
246 |
$this->error_handler->registerErrorHandler();
|
247 |
$this->error_handler->registerShutdownFunction();
|
324 |
|
325 |
/**
|
326 |
* @param array $value
|
327 |
+
* @return PrintFriendly_Raven_Client
|
328 |
*/
|
329 |
public function setPrefixes($value)
|
330 |
{
|
366 |
* the data to the upstream Sentry server.
|
367 |
*
|
368 |
* @param Callable $value Function to be called
|
369 |
+
* @return PrintFriendly_Raven_Client
|
370 |
*/
|
371 |
public function setTransport($value)
|
372 |
{
|
375 |
}
|
376 |
|
377 |
/**
|
378 |
+
* @return string[]|PrintFriendly_Raven_Processor[]
|
379 |
*/
|
380 |
public static function getDefaultProcessors()
|
381 |
{
|
382 |
return array(
|
383 |
+
'PrintFriendly_Raven_Processor_SanitizeDataProcessor',
|
384 |
);
|
385 |
}
|
386 |
|
387 |
/**
|
388 |
+
* Sets the PrintFriendly_Raven_Processor sub-classes to be used when data is processed before being
|
389 |
* sent to Sentry.
|
390 |
*
|
391 |
* @param $options
|
392 |
+
* @return PrintFriendly_Raven_Processor[]
|
393 |
*/
|
394 |
public function setProcessorsFromOptions($options)
|
395 |
{
|
396 |
$processors = array();
|
397 |
+
foreach (PrintFriendly_Raven_util::get($options, 'processors', static::getDefaultProcessors()) as $processor) {
|
398 |
/**
|
399 |
+
* @var PrintFriendly_Raven_Processor $new_processor
|
400 |
+
* @var PrintFriendly_Raven_Processor|string $processor
|
401 |
*/
|
402 |
$new_processor = new $processor($this);
|
403 |
|
587 |
array_unshift($trace, $frame_where_exception_thrown);
|
588 |
|
589 |
// manually trigger autoloading, as it's not done in some edge cases due to PHP bugs (see #60149)
|
590 |
+
if (!class_exists('PrintFriendly_Raven_Stacktrace')) {
|
591 |
// @codeCoverageIgnoreStart
|
592 |
+
spl_autoload_call('PrintFriendly_Raven_Stacktrace');
|
593 |
// @codeCoverageIgnoreEnd
|
594 |
}
|
595 |
|
596 |
$exc_data['stacktrace'] = array(
|
597 |
+
'frames' => PrintFriendly_Raven_Stacktrace::get_stack_info(
|
598 |
$trace, $this->trace, $vars, $this->message_limit, $this->prefixes,
|
599 |
$this->app_path, $this->excluded_app_paths, $this->serializer, $this->reprSerializer
|
600 |
),
|
673 |
|
674 |
protected function registerDefaultBreadcrumbHandlers()
|
675 |
{
|
676 |
+
$handler = new PrintFriendly_Raven_Breadcrumbs_ErrorHandler($this);
|
677 |
$handler->install();
|
678 |
}
|
679 |
|
846 |
|
847 |
if (!empty($stack)) {
|
848 |
// manually trigger autoloading, as it's not done in some edge cases due to PHP bugs (see #60149)
|
849 |
+
if (!class_exists('PrintFriendly_Raven_Stacktrace')) {
|
850 |
// @codeCoverageIgnoreStart
|
851 |
+
spl_autoload_call('PrintFriendly_Raven_Stacktrace');
|
852 |
// @codeCoverageIgnoreEnd
|
853 |
}
|
854 |
|
855 |
if (!isset($data['stacktrace']) && !isset($data['exception'])) {
|
856 |
$data['stacktrace'] = array(
|
857 |
+
'frames' => PrintFriendly_Raven_Stacktrace::get_stack_info(
|
858 |
$stack, $this->trace, $vars, $this->message_limit, $this->prefixes,
|
859 |
$this->app_path, $this->excluded_app_paths, $this->serializer, $this->reprSerializer
|
860 |
),
|
899 |
}
|
900 |
|
901 |
/**
|
902 |
+
* Process data through all defined PrintFriendly_Raven_Processor sub-classes
|
903 |
*
|
904 |
* @param array $data Associative array of data to log
|
905 |
*/
|
918 |
$this->_pending_events = array();
|
919 |
if ($this->store_errors_for_bulk_send) {
|
920 |
//in case an error occurs after this is called, on shutdown, send any new errors.
|
921 |
+
$this->store_errors_for_bulk_send = !defined('PrintFriendly_Raven_CLIENT_END_REACHED');
|
922 |
}
|
923 |
}
|
924 |
|
928 |
*/
|
929 |
public function encode(&$data)
|
930 |
{
|
931 |
+
$message = PrintFriendly_Raven_Compat::json_encode($data);
|
932 |
if ($message === false) {
|
933 |
if (function_exists('json_last_error_msg')) {
|
934 |
$this->_lasterror = json_last_error_msg();
|
1167 |
* Generate a Sentry authorization header string
|
1168 |
*
|
1169 |
* @param string $timestamp Timestamp when the event occurred
|
1170 |
+
* @param string $client HTTP client name (not PrintFriendly_Raven_Client object)
|
1171 |
* @param string $api_key Sentry API key
|
1172 |
* @param string $secret_key Sentry API key
|
1173 |
* @return string
|
1302 |
return $this->severity_map[$severity];
|
1303 |
}
|
1304 |
switch ($severity) {
|
1305 |
+
case E_ERROR: return PrintFriendly_Raven_Client::ERROR;
|
1306 |
+
case E_WARNING: return PrintFriendly_Raven_Client::WARN;
|
1307 |
+
case E_PARSE: return PrintFriendly_Raven_Client::ERROR;
|
1308 |
+
case E_NOTICE: return PrintFriendly_Raven_Client::INFO;
|
1309 |
+
case E_CORE_ERROR: return PrintFriendly_Raven_Client::ERROR;
|
1310 |
+
case E_CORE_WARNING: return PrintFriendly_Raven_Client::WARN;
|
1311 |
+
case E_COMPILE_ERROR: return PrintFriendly_Raven_Client::ERROR;
|
1312 |
+
case E_COMPILE_WARNING: return PrintFriendly_Raven_Client::WARN;
|
1313 |
+
case E_USER_ERROR: return PrintFriendly_Raven_Client::ERROR;
|
1314 |
+
case E_USER_WARNING: return PrintFriendly_Raven_Client::WARN;
|
1315 |
+
case E_USER_NOTICE: return PrintFriendly_Raven_Client::INFO;
|
1316 |
+
case E_STRICT: return PrintFriendly_Raven_Client::INFO;
|
1317 |
+
case E_RECOVERABLE_ERROR: return PrintFriendly_Raven_Client::ERROR;
|
1318 |
}
|
1319 |
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
|
1320 |
switch ($severity) {
|
1321 |
+
case E_DEPRECATED: return PrintFriendly_Raven_Client::WARN;
|
1322 |
+
case E_USER_DEPRECATED: return PrintFriendly_Raven_Client::WARN;
|
1323 |
}
|
1324 |
}
|
1325 |
+
return PrintFriendly_Raven_Client::ERROR;
|
1326 |
}
|
1327 |
|
1328 |
/**
|
1356 |
|
1357 |
public function onShutdown()
|
1358 |
{
|
1359 |
+
if (!defined('PrintFriendly_Raven_CLIENT_END_REACHED')) {
|
1360 |
+
define('PrintFriendly_Raven_CLIENT_END_REACHED', true);
|
1361 |
}
|
1362 |
$this->sendUnsentErrors();
|
1363 |
if ($this->curl_method == 'async') {
|
vendor/{Raven → PrintFriendly/Raven}/Compat.php
RENAMED
@@ -9,7 +9,7 @@
|
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
-
class
|
13 |
{
|
14 |
public static function gethostname()
|
15 |
{
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
+
class PrintFriendly_Raven_Compat
|
13 |
{
|
14 |
public static function gethostname()
|
15 |
{
|
vendor/{Raven → PrintFriendly/Raven}/Context.php
RENAMED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @package raven
|
6 |
*/
|
7 |
-
class
|
8 |
{
|
9 |
/**
|
10 |
* @var array
|
4 |
*
|
5 |
* @package raven
|
6 |
*/
|
7 |
+
class PrintFriendly_Raven_Context
|
8 |
{
|
9 |
/**
|
10 |
* @var array
|
vendor/{Raven → PrintFriendly/Raven}/CurlHandler.php
RENAMED
@@ -15,7 +15,7 @@
|
|
15 |
*/
|
16 |
|
17 |
// TODO(dcramer): handle ca_cert
|
18 |
-
class
|
19 |
{
|
20 |
protected $join_timeout;
|
21 |
protected $multi_handle;
|
15 |
*/
|
16 |
|
17 |
// TODO(dcramer): handle ca_cert
|
18 |
+
class PrintFriendly_Raven_CurlHandler
|
19 |
{
|
20 |
protected $join_timeout;
|
21 |
protected $multi_handle;
|
vendor/{Raven → PrintFriendly/Raven}/ErrorHandler.php
RENAMED
@@ -12,8 +12,8 @@
|
|
12 |
/**
|
13 |
* Event handlers for exceptions and errors
|
14 |
*
|
15 |
-
* $client = new
|
16 |
-
* $error_handler = new
|
17 |
* $error_handler->registerExceptionHandler();
|
18 |
* $error_handler->registerErrorHandler();
|
19 |
* $error_handler->registerShutdownFunction();
|
@@ -24,14 +24,14 @@
|
|
24 |
// TODO(dcramer): deprecate default error types in favor of runtime configuration
|
25 |
// unless a reason can be determined that making them dynamic is better. They
|
26 |
// currently are not used outside of the fatal handler.
|
27 |
-
class
|
28 |
{
|
29 |
protected $old_exception_handler;
|
30 |
protected $call_existing_exception_handler = false;
|
31 |
protected $old_error_handler;
|
32 |
protected $call_existing_error_handler = false;
|
33 |
protected $reservedMemory;
|
34 |
-
/** @var
|
35 |
protected $client;
|
36 |
protected $send_errors_last = false;
|
37 |
protected $fatal_error_types = array(
|
@@ -149,7 +149,7 @@ class Raven_ErrorHandler
|
|
149 |
*
|
150 |
* @param bool $call_existing Call any existing exception handlers after processing
|
151 |
* this instance.
|
152 |
-
* @return
|
153 |
*/
|
154 |
public function registerExceptionHandler($call_existing = true)
|
155 |
{
|
@@ -165,7 +165,7 @@ class Raven_ErrorHandler
|
|
165 |
* @param bool $call_existing Call any existing errors handlers after processing
|
166 |
* this instance.
|
167 |
* @param array $error_types All error types that should be sent.
|
168 |
-
* @return
|
169 |
*/
|
170 |
public function registerErrorHandler($call_existing = true, $error_types = null)
|
171 |
{
|
@@ -183,7 +183,7 @@ class Raven_ErrorHandler
|
|
183 |
*
|
184 |
* @param int $reservedMemorySize Number of kilobytes memory space to reserve,
|
185 |
* which is utilized when handling fatal errors.
|
186 |
-
* @return
|
187 |
*/
|
188 |
public function registerShutdownFunction($reservedMemorySize = 10)
|
189 |
{
|
12 |
/**
|
13 |
* Event handlers for exceptions and errors
|
14 |
*
|
15 |
+
* $client = new PrintFriendly_Raven_Client('http://public:secret/example.com/1');
|
16 |
+
* $error_handler = new PrintFriendly_Raven_ErrorHandler($client);
|
17 |
* $error_handler->registerExceptionHandler();
|
18 |
* $error_handler->registerErrorHandler();
|
19 |
* $error_handler->registerShutdownFunction();
|
24 |
// TODO(dcramer): deprecate default error types in favor of runtime configuration
|
25 |
// unless a reason can be determined that making them dynamic is better. They
|
26 |
// currently are not used outside of the fatal handler.
|
27 |
+
class PrintFriendly_Raven_ErrorHandler
|
28 |
{
|
29 |
protected $old_exception_handler;
|
30 |
protected $call_existing_exception_handler = false;
|
31 |
protected $old_error_handler;
|
32 |
protected $call_existing_error_handler = false;
|
33 |
protected $reservedMemory;
|
34 |
+
/** @var PrintFriendly_Raven_Client */
|
35 |
protected $client;
|
36 |
protected $send_errors_last = false;
|
37 |
protected $fatal_error_types = array(
|
149 |
*
|
150 |
* @param bool $call_existing Call any existing exception handlers after processing
|
151 |
* this instance.
|
152 |
+
* @return PrintFriendly_Raven_ErrorHandler
|
153 |
*/
|
154 |
public function registerExceptionHandler($call_existing = true)
|
155 |
{
|
165 |
* @param bool $call_existing Call any existing errors handlers after processing
|
166 |
* this instance.
|
167 |
* @param array $error_types All error types that should be sent.
|
168 |
+
* @return PrintFriendly_Raven_ErrorHandler
|
169 |
*/
|
170 |
public function registerErrorHandler($call_existing = true, $error_types = null)
|
171 |
{
|
183 |
*
|
184 |
* @param int $reservedMemorySize Number of kilobytes memory space to reserve,
|
185 |
* which is utilized when handling fatal errors.
|
186 |
+
* @return PrintFriendly_Raven_ErrorHandler
|
187 |
*/
|
188 |
public function registerShutdownFunction($reservedMemorySize = 10)
|
189 |
{
|
vendor/PrintFriendly/Raven/Exception.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class PrintFriendly_Raven_Exception extends Exception
|
3 |
+
{
|
4 |
+
}
|
vendor/{Raven → PrintFriendly/Raven}/Processor.php
RENAMED
@@ -5,7 +5,7 @@
|
|
5 |
*
|
6 |
* @package raven
|
7 |
*/
|
8 |
-
abstract class
|
9 |
{
|
10 |
/**
|
11 |
* This constant defines the mask string used to strip sensitive information.
|
@@ -13,16 +13,16 @@ abstract class Raven_Processor
|
|
13 |
const STRING_MASK = '********';
|
14 |
|
15 |
/**
|
16 |
-
* @var
|
17 |
*/
|
18 |
protected $client;
|
19 |
|
20 |
/**
|
21 |
* Class constructor.
|
22 |
*
|
23 |
-
* @param
|
24 |
*/
|
25 |
-
public function __construct(
|
26 |
{
|
27 |
$this->client = $client;
|
28 |
}
|
5 |
*
|
6 |
* @package raven
|
7 |
*/
|
8 |
+
abstract class PrintFriendly_Raven_Processor
|
9 |
{
|
10 |
/**
|
11 |
* This constant defines the mask string used to strip sensitive information.
|
13 |
const STRING_MASK = '********';
|
14 |
|
15 |
/**
|
16 |
+
* @var PrintFriendly_Raven_Client The Raven client
|
17 |
*/
|
18 |
protected $client;
|
19 |
|
20 |
/**
|
21 |
* Class constructor.
|
22 |
*
|
23 |
+
* @param PrintFriendly_Raven_Client $client The Raven client
|
24 |
*/
|
25 |
+
public function __construct(PrintFriendly_Raven_Client $client)
|
26 |
{
|
27 |
$this->client = $client;
|
28 |
}
|
vendor/{Raven → PrintFriendly/Raven}/Processor/RemoveCookiesProcessor.php
RENAMED
@@ -15,7 +15,7 @@
|
|
15 |
*
|
16 |
* @author Stefano Arlandini <sarlandini@alice.it>
|
17 |
*/
|
18 |
-
final class
|
19 |
{
|
20 |
/**
|
21 |
* {@inheritdoc}
|
15 |
*
|
16 |
* @author Stefano Arlandini <sarlandini@alice.it>
|
17 |
*/
|
18 |
+
final class PrintFriendly_Raven_Processor_RemoveCookiesProcessor extends PrintFriendly_Raven_Processor
|
19 |
{
|
20 |
/**
|
21 |
* {@inheritdoc}
|
vendor/{Raven → PrintFriendly/Raven}/Processor/RemoveHttpBodyProcessor.php
RENAMED
@@ -16,7 +16,7 @@
|
|
16 |
*
|
17 |
* @author Stefano Arlandini <sarlandini@alice.it>
|
18 |
*/
|
19 |
-
final class
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
16 |
*
|
17 |
* @author Stefano Arlandini <sarlandini@alice.it>
|
18 |
*/
|
19 |
+
final class PrintFriendly_Raven_Processor_RemoveHttpBodyProcessor extends PrintFriendly_Raven_Processor
|
20 |
{
|
21 |
/**
|
22 |
* {@inheritdoc}
|
vendor/{Raven → PrintFriendly/Raven}/Processor/SanitizeDataProcessor.php
RENAMED
@@ -15,7 +15,7 @@
|
|
15 |
*
|
16 |
* @package raven
|
17 |
*/
|
18 |
-
class
|
19 |
{
|
20 |
const MASK = self::STRING_MASK;
|
21 |
const FIELDS_RE = '/(authorization|password|passwd|secret|password_confirmation|card_number|auth_pw)/i';
|
@@ -28,7 +28,7 @@ class Raven_Processor_SanitizeDataProcessor extends Raven_Processor
|
|
28 |
/**
|
29 |
* {@inheritdoc}
|
30 |
*/
|
31 |
-
public function __construct(
|
32 |
{
|
33 |
parent::__construct($client);
|
34 |
|
15 |
*
|
16 |
* @package raven
|
17 |
*/
|
18 |
+
class PrintFriendly_Raven_Processor_SanitizeDataProcessor extends PrintFriendly_Raven_Processor
|
19 |
{
|
20 |
const MASK = self::STRING_MASK;
|
21 |
const FIELDS_RE = '/(authorization|password|passwd|secret|password_confirmation|card_number|auth_pw)/i';
|
28 |
/**
|
29 |
* {@inheritdoc}
|
30 |
*/
|
31 |
+
public function __construct(PrintFriendly_Raven_Client $client)
|
32 |
{
|
33 |
parent::__construct($client);
|
34 |
|
vendor/{Raven → PrintFriendly/Raven}/Processor/SanitizeHttpHeadersProcessor.php
RENAMED
@@ -15,7 +15,7 @@
|
|
15 |
*
|
16 |
* @author Stefano Arlandini <sarlandini@alice.it>
|
17 |
*/
|
18 |
-
final class
|
19 |
{
|
20 |
/**
|
21 |
* @var string[] $httpHeadersToSanitize The list of HTTP headers to sanitize
|
@@ -25,7 +25,7 @@ final class Raven_Processor_SanitizeHttpHeadersProcessor extends Raven_Processor
|
|
25 |
/**
|
26 |
* {@inheritdoc}
|
27 |
*/
|
28 |
-
public function __construct(
|
29 |
{
|
30 |
parent::__construct($client);
|
31 |
}
|
15 |
*
|
16 |
* @author Stefano Arlandini <sarlandini@alice.it>
|
17 |
*/
|
18 |
+
final class PrintFriendly_Raven_Processor_SanitizeHttpHeadersProcessor extends PrintFriendly_Raven_Processor
|
19 |
{
|
20 |
/**
|
21 |
* @var string[] $httpHeadersToSanitize The list of HTTP headers to sanitize
|
25 |
/**
|
26 |
* {@inheritdoc}
|
27 |
*/
|
28 |
+
public function __construct(PrintFriendly_Raven_Client $client)
|
29 |
{
|
30 |
parent::__construct($client);
|
31 |
}
|
vendor/{Raven → PrintFriendly/Raven}/Processor/SanitizeStacktraceProcessor.php
RENAMED
@@ -15,7 +15,7 @@
|
|
15 |
*
|
16 |
* @author Stefano Arlandini <sarlandini@alice.it>
|
17 |
*/
|
18 |
-
class
|
19 |
{
|
20 |
/**
|
21 |
* {@inheritdoc}
|
15 |
*
|
16 |
* @author Stefano Arlandini <sarlandini@alice.it>
|
17 |
*/
|
18 |
+
class PrintFriendly_Raven_Processor_SanitizeStacktraceProcessor extends PrintFriendly_Raven_Processor
|
19 |
{
|
20 |
/**
|
21 |
* {@inheritdoc}
|
vendor/{Raven → PrintFriendly/Raven}/ReprSerializer.php
RENAMED
@@ -14,7 +14,7 @@
|
|
14 |
* both the type and value, and be serializable into JSON.
|
15 |
* @package raven
|
16 |
*/
|
17 |
-
class
|
18 |
{
|
19 |
protected function serializeValue($value)
|
20 |
{
|
14 |
* both the type and value, and be serializable into JSON.
|
15 |
* @package raven
|
16 |
*/
|
17 |
+
class PrintFriendly_Raven_ReprSerializer extends PrintFriendly_Raven_Serializer
|
18 |
{
|
19 |
protected function serializeValue($value)
|
20 |
{
|
vendor/PrintFriendly/Raven/SanitizeDataProcessor.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Raven.
|
5 |
+
*
|
6 |
+
* (c) Sentry Team
|
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 |
+
@trigger_error('The '.__NAMESPACE__.'\PrintFriendly_Raven_SanitizeDataProcessor class is deprecated since version 1.7 and will be removed in 2.0. Use the PrintFriendly_Raven_Processor_SanitizeDataProcessor class in the same namespace instead.', E_USER_DEPRECATED);
|
13 |
+
|
14 |
+
/**
|
15 |
+
* {@inheritdoc}
|
16 |
+
*/
|
17 |
+
class PrintFriendly_Raven_SanitizeDataProcessor extends PrintFriendly_Raven_Processor_SanitizeDataProcessor
|
18 |
+
{
|
19 |
+
}
|
vendor/{Raven → PrintFriendly/Raven}/Serializer.php
RENAMED
@@ -24,7 +24,7 @@
|
|
24 |
*
|
25 |
* @package raven
|
26 |
*/
|
27 |
-
class
|
28 |
{
|
29 |
/*
|
30 |
* The default mb detect order
|
@@ -132,7 +132,7 @@ class Raven_Serializer
|
|
132 |
/**
|
133 |
* @param string $mb_detect_order
|
134 |
*
|
135 |
-
* @return
|
136 |
* @codeCoverageIgnore
|
137 |
*/
|
138 |
public function setMbDetectOrder($mb_detect_order)
|
24 |
*
|
25 |
* @package raven
|
26 |
*/
|
27 |
+
class PrintFriendly_Raven_Serializer
|
28 |
{
|
29 |
/*
|
30 |
* The default mb detect order
|
132 |
/**
|
133 |
* @param string $mb_detect_order
|
134 |
*
|
135 |
+
* @return PrintFriendly_Raven_Serializer
|
136 |
* @codeCoverageIgnore
|
137 |
*/
|
138 |
public function setMbDetectOrder($mb_detect_order)
|
vendor/{Raven → PrintFriendly/Raven}/Stacktrace.php
RENAMED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @package raven
|
6 |
*/
|
7 |
-
class
|
8 |
{
|
9 |
public static $statements = array(
|
10 |
'include',
|
@@ -16,15 +16,15 @@ class Raven_Stacktrace
|
|
16 |
public static function get_stack_info($frames,
|
17 |
$trace = false,
|
18 |
$errcontext = null,
|
19 |
-
$frame_var_limit =
|
20 |
$strip_prefixes = null,
|
21 |
$app_path = null,
|
22 |
$excluded_app_paths = null,
|
23 |
-
|
24 |
-
|
25 |
{
|
26 |
-
$serializer = $serializer ?: new
|
27 |
-
$reprSerializer = $reprSerializer ?: new
|
28 |
|
29 |
/**
|
30 |
* PHP stores calls in the stacktrace, rather than executing context. Sentry
|
@@ -113,7 +113,7 @@ class Raven_Stacktrace
|
|
113 |
return array_reverse($result);
|
114 |
}
|
115 |
|
116 |
-
public static function get_default_context($frame, $frame_arg_limit =
|
117 |
{
|
118 |
if (!isset($frame['args'])) {
|
119 |
return array();
|
@@ -128,7 +128,7 @@ class Raven_Stacktrace
|
|
128 |
return $args;
|
129 |
}
|
130 |
|
131 |
-
public static function get_frame_context($frame, $frame_arg_limit =
|
132 |
{
|
133 |
if (!isset($frame['args'])) {
|
134 |
return array();
|
4 |
*
|
5 |
* @package raven
|
6 |
*/
|
7 |
+
class PrintFriendly_Raven_Stacktrace
|
8 |
{
|
9 |
public static $statements = array(
|
10 |
'include',
|
16 |
public static function get_stack_info($frames,
|
17 |
$trace = false,
|
18 |
$errcontext = null,
|
19 |
+
$frame_var_limit = PrintFriendly_Raven_Client::MESSAGE_LIMIT,
|
20 |
$strip_prefixes = null,
|
21 |
$app_path = null,
|
22 |
$excluded_app_paths = null,
|
23 |
+
PrintFriendly_Raven_Serializer $serializer = null,
|
24 |
+
PrintFriendly_Raven_ReprSerializer $reprSerializer = null)
|
25 |
{
|
26 |
+
$serializer = $serializer ?: new PrintFriendly_Raven_Serializer();
|
27 |
+
$reprSerializer = $reprSerializer ?: new PrintFriendly_Raven_ReprSerializer();
|
28 |
|
29 |
/**
|
30 |
* PHP stores calls in the stacktrace, rather than executing context. Sentry
|
113 |
return array_reverse($result);
|
114 |
}
|
115 |
|
116 |
+
public static function get_default_context($frame, $frame_arg_limit = PrintFriendly_Raven_Client::MESSAGE_LIMIT)
|
117 |
{
|
118 |
if (!isset($frame['args'])) {
|
119 |
return array();
|
128 |
return $args;
|
129 |
}
|
130 |
|
131 |
+
public static function get_frame_context($frame, $frame_arg_limit = PrintFriendly_Raven_Client::MESSAGE_LIMIT)
|
132 |
{
|
133 |
if (!isset($frame['args'])) {
|
134 |
return array();
|
vendor/{Raven → PrintFriendly/Raven}/TransactionStack.php
RENAMED
@@ -8,7 +8,7 @@
|
|
8 |
* file that was distributed with this source code.
|
9 |
*/
|
10 |
|
11 |
-
class
|
12 |
{
|
13 |
public function __construct()
|
14 |
{
|
8 |
* file that was distributed with this source code.
|
9 |
*/
|
10 |
|
11 |
+
class PrintFriendly_Raven_TransactionStack
|
12 |
{
|
13 |
public function __construct()
|
14 |
{
|
vendor/{Raven → PrintFriendly/Raven}/Util.php
RENAMED
@@ -15,7 +15,7 @@
|
|
15 |
* @package raven
|
16 |
*/
|
17 |
|
18 |
-
class
|
19 |
{
|
20 |
/**
|
21 |
* Because we love Python, this works much like dict.get() in Python.
|
15 |
* @package raven
|
16 |
*/
|
17 |
|
18 |
+
class PrintFriendly_Raven_Util
|
19 |
{
|
20 |
/**
|
21 |
* Because we love Python, this works much like dict.get() in Python.
|
vendor/{Raven → PrintFriendly/Raven}/data/cacert.pem
RENAMED
File without changes
|
vendor/Raven/Exception.php
DELETED
@@ -1,4 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Raven_Exception extends Exception
|
3 |
-
{
|
4 |
-
}
|
|
|
|
|
|
|
|
vendor/Raven/SanitizeDataProcessor.php
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of Raven.
|
5 |
-
*
|
6 |
-
* (c) Sentry Team
|
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 |
-
@trigger_error('The '.__NAMESPACE__.'\Raven_SanitizeDataProcessor class is deprecated since version 1.7 and will be removed in 2.0. Use the Raven_Processor_SanitizeDataProcessor class in the same namespace instead.', E_USER_DEPRECATED);
|
13 |
-
|
14 |
-
/**
|
15 |
-
* {@inheritdoc}
|
16 |
-
*/
|
17 |
-
class Raven_SanitizeDataProcessor extends Raven_Processor_SanitizeDataProcessor
|
18 |
-
{
|
19 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|