Issues (130)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

includes/admin/contextual-help.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 21 and the first side effect is on line 11.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
/**
3
 * Contextual Help
4
 *
5
 * @package     PrintCenter\Help
6
 * @since       1.0.0
7
 */
8
9
// Exit if accessed directly
10
if( ! defined( 'ABSPATH' ) ) {
11
	exit;
12
}
13
14
15
/**
16
 * Adds the Contextual Help for the SSI Products page
17
 *
18
 * @since       1.0.0
19
 * @return      void
20
 */
21
function printcenter_contextual_help() {
22
	$screen  = get_current_screen();
23
	$screens = apply_filters( 'printcenter_contextual_help_screens', array(
24
		'ssi_product',
25
		'edit-ssi_product',
26
		'shop_commission',
27
		'edit-shop_commission',
28
		'toplevel_page_printcenter-settings',
29
		'product',
30
		'edit-product'
31
	) );
32
33
	if( is_object( $screen ) && ! in_array( $screen->id, $screens ) ) {
34
		return;
35
	}
36
37
	$screen->remove_help_tabs();
38
39
	$screen->set_help_sidebar(
40
		'<p><strong>' . __( 'For more information:', 'printcenter' ) . '</strong></p>' .
41
		'<p>' . sprintf( __( '<a href="%s" target="_blank">Github Project</a>', 'printcenter' ), esc_url( 'https://github.com/section214/printcenter' ) ) . '</p>' .
42
		'<p>' . sprintf( __( '<a href="%s" target="_blank">Developer Docs</a>', 'printcenter' ), PRINTCENTER_URL . '/codex' ) . '</p>' .
43
		'<p>' . sprintf( __( '<a href="%s" target="_blank">Contact Support</a>', 'printcenter' ), esc_url( 'mailto:[email protected]' ) ) . '</p>' .
44
		'<hr />' .
45
		'<p><a href="https://github.com/section214/printcenter" target="_blank"><img src="https://img.shields.io/github/release/section214/printcenter.svg" /></a></p>' .
46
		'<p><a href="https://github.com/section214/printcenter/issues?state=open" target="_blank"><img src="https://img.shields.io/github/issues/section214/printcenter.svg" /></a></p>'
47
	);
48
49
	if( $screen->id == 'product' || $screen->id == 'edit-product' ) {
50
		$screen->add_help_tab( array(
51
			'id'      => 'printcenter-product-intro',
52
			'title'   => __( 'Add/Edit Products', 'printcenter' ),
53
			'content' =>
54
				'<p><strong>' . __( 'Introduction', 'printcenter' ) . '</strong></p>' .
55
				'<p>' . __( 'Since PrintCenter is based on WooCommerce, users who have past experience with WooCommerce will find much of the process familiar. However, for those without past experience, we will be providing a brief outline of the options available on the Add/Edit Product pages.', 'printcenter' ) . '</p>' .
56
				'<p><strong>' . __( 'Naming Your Product', 'printcenter' ) . '</strong></p>' .
57
				'<p>' . __( 'At the top of the Add/Edit Product page, you will see a section similar to the below image. Whatever you enter in the box with the placeholder text "Product name" (or "Test Product" in the below example) will be used in the storefront as the name of the product. Below that box is the <em>permalink</em> for this product. It is automatically generated the first time you save the product, but can be edited by clicking the "Edit" button.', 'printcenter' ) . '</p>' .
58
				'<img src="' . PRINTCENTER_URL . 'assets/img/help/product-help-1.png" style="max-width: 100%" />' .
59
				'<p class="description">' . __( '<strong>Protip:</strong> Permalink is a portmanteau of permanent link and is a URL that points to a specific page, post, or other entry on a website.', 'printcenter' ) . '</p>' .
60
				'<p><strong>' . __( 'Product Description', 'printcenter' ) . '</strong></p>' .
61
				'<p>' . __( 'The main content area (ie, the big text editor below the title), is what will be displayed in your store as the product description. It can be as long as you want, and accepts HTML.', 'printcenter' ) . '</p>'
62
		) );
63
64
		$screen->add_help_tab( array(
65
			'id'      => 'printcenter-product-general',
66
			'title'   => __( 'Product Data', 'printcenter' ),
67
			'content' =>
68
				'<img src="' . PRINTCENTER_URL . 'assets/img/help/product-help-2.png" style="max-width: 100%" />' .
69
				'<p>' . __( 'Before you start configuring settings here, <em>make sure</em> that this is set to a "Variable Product"!', 'printcenter' ) . '</p>' .
70
				'<p><strong>' . __( 'SKU', 'printcenter' ) . '</strong></p>' .
71
				'<p>' . __( 'The SKU field is <em>your</em> internal ID for a specific product. This can be pretty much anything, and is not publicly viewable anywhere. However, it is recommended that this be an alphanumeric string without spaces.', 'printcenter' ) . '</p>' .
72
				'<p><strong>' . __( 'Shirt', 'printcenter' ) . '</strong></p>' .
73
				'<p>' . __( 'The Shirt field defines what SSI SKU to send to SSI during the printing phase of a purchase. You can add or remove shirts from this list <a href="' . admin_url( 'edit.php?post_type=ssi_product' ) . '" target="_blank">here</a>.', 'printcenter' ) . '</p>' .
74
				'<p><strong>' . __( 'Design Location', 'printcenter' ) . '</strong></p>' .
75
				'<p>' . __( 'The Design Location field specifies the location at which SSI should print the design on the shirt. There are three available options: Full Front, Full Back, or Left Chest.', 'printcenter' ) . '</p>' .
76
				'<p><strong>' . __( 'Design Size', 'printcenter' ) . '</strong></p>' .
77
				'<p>' . __( 'The Design Size field specifies the relative size of the design as it should be printed. Generally, a good guideline to determining size is as follows:', 'printcenter' ) . '</p>' .
78
				'<ul>' .
79
				'<li>' . __( '<strong>Small:</strong> Roughly the size of a shirt pocket logo', 'printcenter' ) . '</li>' .
80
				'<li>' . __( '<strong>Regular:</strong> Larger than a pocket logo, but not the full width of the front or back of the shirt', 'printcenter' ) . '</li>' .
81
				'<li>' . __( '<strong>Large:</strong> An image that stretches the entire width of the front or back of a shirt', 'printcenter' ) . '</li>' .
82
				'</ul>' .
83
				'<p><strong>' . __( 'Design Art', 'printcenter' ) . '</strong></p>' .
84
				'<p>' . __( 'The Design Art field specifies the direct URL to the <em>printable</em> image that should be sent to SSI. Remember, this must be uploaded through the <a href="' . admin_url( 'media-new.php' ) . '" target="_blank">Media Library</a>. Once an image has been uploaded, open it (if it isn\'t already open) and you can find this URL in the top right corner of the dialog.', 'printcenter' ) . '</p>' .
85
				'<p><strong>' . __( 'Vendor Commission', 'printcenter' ) . '</strong></p>' .
86
				'<p>' . __( 'The Vendor Commission field is an optional field which allows you to override the commission rate for a given product.', 'printcenter' ) . '</p>'
87
		) );
88
89
		$screen->add_help_tab( array(
90
			'id'      => 'printcenter-product-attributes',
91
			'title'   => __( 'Product Attributes', 'printcenter' ),
92
			'content' =>
93
				'<img src="' . PRINTCENTER_URL . 'assets/img/help/product-help-3.png" style="max-width: 100%" />' .
94
				'<p>' . __( 'In this section, you will define the <em>Attributes</em> for this product. Attributes are things like the available colors and sizes for a specific product. If you have setup attribute groups, you can select the relevant group from the dropdown at the bottom right, and click load. You can also add attributes from the "Custom product attribute" dropdown at the top left and select individual attributes manually.', 'printcenter' ) . '</p>' .
95
				'<p>' . __( 'For each attribute, there are values options you need to configure:', 'printcenter' ) . '</p>' .
96
				'<p><strong>' . __( 'Values', 'printcenter' ) . '</strong></p>' .
97
				'<p>' . __( 'The right half of the box is a text area in which you can set the specific details for each attribute (ie, a product may only be available in small and medium (but not large), so the size attribute would only include small and medium for this product).', 'printcenter' ) . '</p>' .
98
				'<p><strong>' . __( 'Important!', 'printcenter' ) . '</strong></p>' .
99
				'<p>' . __( 'Both the "Visible on the product page" and "Used for variations" checkboxes <em>MUST</em> be checked!', 'printcenter' ) . '</p>'
100
		) );
101
102
		$screen->add_help_tab( array(
103
			'id'      => 'printcenter-product-variations',
104
			'title'   => __( 'Product Variations', 'printcenter' ),
105
			'content' =>
106
				'<img src="' . PRINTCENTER_URL . 'assets/img/help/product-help-4.png" style="max-width: 100%" />' .
107
				'<p>' . __( 'In this section, you will define the <em>Variations</em> for this product. Variations are the total possible combinations of attributes for a given product. To add variations based on the attributes you selected in the "Attributes" section, simply click the "Add variation" dropdown and select "Create variations from all attributes".', 'printcenter' ) . '</p>' .
108
				'<img src="' . PRINTCENTER_URL . 'assets/img/help/product-help-5.png" style="max-width: 100%" />' .
109
				'<p>' . __( 'For each variation, there are a number of configuration options, but you are generally only concerned with a few of them:', 'printcenter' ) . '</p>' .
110
				'<p><strong>' . __( 'Custom Thumbnail', 'printcenter' ) . '</strong></p>' .
111
				'<p>' . __( 'Clicking on the icon in the upper left of the row will allow you to specify a custom thumbnail for each variation. If no custom thumbnail is specified, the product thumbnail will be displayed.', 'printcenter' ) . '</p>' .
112
				'<p><strong>' . __( 'Important!', 'printcenter' ) . '</strong></p>' .
113
				'<p>' . __( 'The "Enabled" checkbox <em>MUST</em> be checked, and the "Stock Status" dropdown must be set to "In stock" for a product to be purchasable!', 'printcenter' ) . '</p>' .
114
				'<p><strong>' . __( 'Regular and Sale Price', 'printcenter' ) . '</strong></p>' .
115
				'<p>' . __( 'The Regular Price field must be filled in with the price point you want for a given product. <em>If this is not filled in, customers will not be able to buy it!</em> On the other hand, the Sale Price field is optional, and will override the Regular Price if set.', 'printcenter' ) . '</p>' .
116
				'<p>' . __( 'For our purposes, all other fields can be ignored.', 'printcenter' ) . '</p>'
117
		) );
118
119
		$screen->add_help_tab( array(
120
			'id'      => 'printcenter-product-sidebar',
121
			'title'   => __( 'Other Options', 'printcenter' ),
122
			'content' =>
123
				'<p>' . __( 'There are also a few settings areas on the Add/Edit Product pages that we haven\'t previously discussed. However, the only other ones we need to concern ourselves with are those present in the right sidebar.', 'printcenter' ) . '</p>' .
124
				'<p><strong>' . __( 'Product Categories/Tags', 'printcenter' ) . '</strong></p>' .
125
				'<p>' . __( 'While the Product Categories and Product Tags meta boxes are not used by SSI or anywhere else in the PrintCenter platform itself, they are relevant to the SEO of your site and are used by many WooCommerce themes to provide the ability to sort or filter available products. It is up to you if you want to use them, but they should probably only be used on standalone sites.', 'printcenter' ) . '</p>' .
126
				'<p><strong>' . __( 'Product Image', 'printcenter' ) . '</strong></p>' .
127
				'<p>' . __( 'The Product Image meta box defines the default thumbnail/gallery image for a specific product. This will be shown in product lists, on the actual product pages, and as the fallback image for any variation which doesn\'t have a custom thumbnail image set.', 'printcenter' ) . '</p>'
128
		) );
129
	}
130
131
	if( $screen->id == 'shop_commission' || $screen->id == 'edit-shop_commission' ) {
132
		$screen->add_help_tab( array(
133
			'id'      => 'printcenter-commission-intro',
134
			'title'   => __( 'Add/Edit Commission', 'printcenter' ),
135
			'content' =>
136
				'<p><strong>' . __( 'Introduction', 'printcenter' ) . '</strong></p>' .
137
				'<p>' . __( 'The Add/Edit Commission pages are where you can... add and edit commmissions. What this means is you <em>probably</em> don\'t belong here. However... if you <em>do</em> want to be here, read on!', 'printcenter' ) . '</p>' .
138
				'<p><strong>' . __( 'Commission Details', 'printcenter' ) . '</strong></p>' .
139
				'<img src="' . PRINTCENTER_URL . 'assets/img/help/commission-help-1.png" style="max-width: 100%" />' .
140
				'<p><strong>' . __( 'Product', 'printcenter' ) . '</strong></p>' .
141
				'<p>' . __( 'The product field allows you to select the product which a given commission should be applied to.', 'printcenter' ) . '</p>' .
142
				'<p><strong>' . __( 'Vendor', 'printcenter' ) . '</strong></p>' .
143
				'<p>' . __( 'The vendor field allows you to select the vendor who should receive a given commission.', 'printcenter' ) . '</p>' .
144
				'<p><strong>' . __( 'Amount', 'printcenter' ) . '</strong></p>' .
145
				'<p>' . __( 'The amount field allows you to specify the value of a given commission.', 'printcenter' ) . '</p>' .
146
				'<p class="description">' . sprintf( __( '<strong>NOTE:</strong> Remember that commissions are automatically generated at the time of purchase, so you probably shouldn\'t be messing around with them. Additionally, each site should only have a single vendor. Vendors can be defined <a href="%s" target="_blank">here</a>.'), admin_url( 'edit-tags.php?taxonomy=shop_vendor&post_type=product' ) ) . '</p>'
147
		) );
148
	}
149
150
	if( $screen->id == 'ssi_product' || $screen->id == 'edit-ssi_product' ) {
151
		$screen->add_help_tab( array(
152
			'id'      => 'printcenter-ssi-product-intro',
153
			'title'   => __( 'Add/Edit SSI Product', 'printcenter' ),
154
			'content' =>
155
				'<p><strong>' . __( 'Introduction', 'printcenter' ) . '</strong></p>' .
156
				'<p>' . __( 'The Add/Edit SSI Product pages are where you define the SSI product details for each shirt type you want to support.', 'printcenter' ) . '</p>' .
157
				'<p><strong>' . __( 'Product Name', 'printcenter' ) . '</strong></p>' .
158
				'<p>' . __( 'The product name field is for your reference only. It is the value displayed on the Add/Edit Product pages in the Shirt field.', 'printcenter' ) . '</p>' .
159
				'<p><strong>' . __( 'SSI SKU', 'printcenter' ) . '</strong></p>' .
160
				'<p>' . __( 'The SSI SKU field holds the actual SSI SKU for a given shirt. The <em>MUST</em> match their provided data exactly. If the SKU is all caps, it must be entered in all caps. It is sent to SSI during the processing phase and will result in an error if improperly entered.', 'printcenter' ) . '</p>'
161
		) );
162
	}
163
164
	if( $screen->id == 'toplevel_page_printcenter-settings' ) {
165
		$screen->add_help_tab( array(
166
			'id'      => 'printcenter-general-settings',
167
			'title'   => __( 'General Settings', 'printcenter' ),
168
			'content' =>
169
				'<p><strong>' . __( 'Introduction', 'printcenter' ) . '</strong></p>' .
170
				'<p>' . __( 'The General settings tab holds settings that don\'t belong anywhere else... Right now there isn\'t much here.', 'printcenter' ) . '</p>' .
171
				'<p><strong>' . __( 'Site Type', 'printcenter' ) . '</strong></p>' .
172
				'<p>' . __( 'Site Type specifies whether this is installed on a PrintCenter-powered storefront, or is acting as the Shipping Stats tracking site. There should only be one Stats site for the company.', 'printcenter' ) . '</p>'
173
		) );
174
175
		$screen->add_help_tab( array(
176
			'id'      => 'printcenter-ssi-settings',
177
			'title'   => __( 'SSI Settings', 'printcenter' ),
178
			'content' =>
179
				'<p><strong>' . __( 'Introduction', 'printcenter' ) . '</strong></p>' .
180
				'<p>' . __( 'The SSI settings tab holds settings that are relevant to integration with the SSI print API.', 'printcenter' ) . '</p>' .
181
				'<p><strong>' . __( 'Processing Mode', 'printcenter' ) . '</strong></p>' .
182
				'<p>' . __( 'The Processing Mode field defines how we will process purchases in regards to the print API. There are three possible modes:', 'printcenter' ) . '</p>' .
183
				'<ul>' .
184
				'<li>' . __( '<strong>Live:</strong> Live Processing will send <em>ALL</em> completed purchases to SSI', 'printcenter' ) . '</li>' .
185
				'<li>' . __( '<strong>Test:</strong> Test Processing will create a purchase record on the SSI test API and return a dump of the results', 'printcenter' ) . '</li>' .
186
				'<li>' . __( '<strong>Capture:</strong> Capture Processing will create a purchase record on the SSI test API that is stored for debugging purposes by the SSI staff', 'printcenter' ) . '</li>' .
187
				'</ul>' .
188
				'<p><strong>' . __( 'Live Customer ID', 'printcenter' ) . '</strong></p>' .
189
				'<p>' . __( 'The Live Customer ID field specifies the unique customer ID assigned to you by SSI', 'printcenter' ) . '</p>' .
190
				'<p><strong>' . __( 'Live Customer Zip Code', 'printcenter' ) . '</strong></p>' .
191
				'<p>' . __( 'The Live Customer Zip Code field specifies the zip code you provided to SSI for billing purposes', 'printcenter' ) . '</p>' .
192
				'<p><strong>' . __( 'Test Customer ID/Zip Code', 'printcenter' ) . '</strong></p>' .
193
				'<p>' . __( 'The test details are provided by SSI for you during testing of an integration. They are prepopulated, but may be changed at your convenience (or as SSI directs you to).', 'printcenter' ) . '</p>'
194
		) );
195
	}
196
197
	// Allow extensions to modify contextual help
198
	do_action( 'printcenter_contextual_help', $screen );
199
}
200
add_action( 'current_screen', 'printcenter_contextual_help', 51 );
201