| 1 |
<?php |
| 2 |
|
| 3 |
namespace Codelight\GDPR\Components\DoNotSell; |
| 4 |
|
| 5 |
if ( ! defined( 'ABSPATH' ) ) exit; |
| 6 |
|
| 7 |
use Codelight\GDPR\Admin\AdminTab; |
| 8 |
|
| 9 |
class AdminTabDoNotSell extends AdminTab { |
| 10 |
|
| 11 |
/* @var string */ |
| 12 |
protected $slug = 'do-not-sell'; |
| 13 |
|
| 14 |
/* @var PolicyGenerator */ |
| 15 |
protected $policyGenerator; |
| 16 |
|
| 17 |
public function __construct() |
| 18 |
{ |
| 19 |
$this->title = _x( 'Do Not Sell My Data', '(Admin)', 'gdpr-framework' ); |
| 20 |
|
| 21 |
add_action( 'ccpa/admin/action/PrivacyManager/generate', array( $this, 'generateDoNotSell' ) ); |
| 22 |
} |
| 23 |
|
| 24 |
public function init() { |
| 25 |
/** |
| 26 |
* Do Not Sell My Data settings |
| 27 |
*/ |
| 28 |
$this->registerSettingSection( |
| 29 |
'ccpa_about_privacy_safe_section', |
| 30 |
_x( 'Do Not Sell My Data', '(Admin)', 'gdpr-framework' ), |
| 31 |
array( $this, 'renderAboutHeader' ) |
| 32 |
); |
| 33 |
|
| 34 |
$this->registerSettingField( |
| 35 |
'ccpa_privacy_safe_shortcode', |
| 36 |
_x( 'Shortcode', '(Admin)', 'gdpr-framework' ), |
| 37 |
array( $this, 'shortcode' ), |
| 38 |
'ccpa_about_privacy_safe_section' |
| 39 |
); |
| 40 |
$this->registerSettingField( |
| 41 |
'ccpa_privacy_safe_shortcodephp', |
| 42 |
_x( 'Shortcode for PHP', '(Admin)', 'gdpr-framework' ), |
| 43 |
array( $this, 'shortcodephp' ), |
| 44 |
'ccpa_about_privacy_safe_section' |
| 45 |
); |
| 46 |
$this->registerSettingField( |
| 47 |
'ccpa_privacy_safe_posts', |
| 48 |
_x( 'View Requests', '(Admin)', 'gdpr-framework' ), |
| 49 |
array( $this, 'postlink' ), |
| 50 |
'ccpa_about_privacy_safe_section' |
| 51 |
); |
| 52 |
|
| 53 |
} |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
public function renderAboutHeader() { |
| 58 |
echo '<p>Place this shortcode on the page you would like to accept requests from users to not sell their information. We recommend placing the shortcode under the privacy tools shortcode on the privacy tools page.</p>'; |
| 59 |
} |
| 60 |
|
| 61 |
public function renderSubmitButton() |
| 62 |
{ |
| 63 |
// FRAM-137 - remove unnecessary save button |
| 64 |
// this overrides the placement of a save button which is not needed |
| 65 |
} |
| 66 |
|
| 67 |
public function shortcode() { |
| 68 |
echo "<code>[gdpr_do_not_sell_form]</code>"; |
| 69 |
} |
| 70 |
public function shortcodephp() { |
| 71 |
echo "<code>echo do_shortcode('[gdpr_do_not_sell_form]');</code>"; |
| 72 |
} |
| 73 |
public function postlink() { |
| 74 |
echo "<a href='/wp-admin/edit.php?post_type=donotsellrequests'>View Requests</a>"; |
| 75 |
} |
| 76 |
} |
| 77 |
|