Add public keyword to methods

[MAILPOET-2413]
This commit is contained in:
Amine Ben hammou
2019-12-26 12:56:49 +01:00
committed by wxa
parent ec409042d5
commit 43df66d162
823 changed files with 4440 additions and 4440 deletions

View File

@@ -20,7 +20,7 @@ class AssetsController {
const RECAPTCHA_API_URL = 'https://www.google.com/recaptcha/api.js?onload=reCaptchaCallback&render=explicit';
function __construct(WPFunctions $wp, BasicRenderer $renderer, SettingsController $settings) {
public function __construct(WPFunctions $wp, BasicRenderer $renderer, SettingsController $settings) {
$this->wp = $wp;
$this->renderer = $renderer;
$this->settings = $settings;
@@ -30,7 +30,7 @@ class AssetsController {
* Returns assets scripts tags as string
* @return string
*/
function printScripts() {
public function printScripts() {
ob_start();
$this->wp->wpPrintScripts('jquery');
$this->wp->wpPrintScripts('mailpoet_vendor');
@@ -41,7 +41,7 @@ class AssetsController {
return $scripts;
}
function setupFrontEndDependencies() {
public function setupFrontEndDependencies() {
$this->wp->wpEnqueueStyle(
'mailpoet_public',
Env::$assets_url . '/dist/css/' . $this->renderer->getCssAsset('public.css')
@@ -96,7 +96,7 @@ EOL;
);
}
function setupAdminWidgetPageDependencies() {
public function setupAdminWidgetPageDependencies() {
$this->wp->wpEnqueueScript(
'mailpoet_vendor',
Env::$assets_url . '/dist/js/' . $this->renderer->getJsAsset('vendor.js'),

View File

@@ -4,7 +4,7 @@ namespace MailPoet\Form\Block;
class Checkbox extends Base {
static function render($block) {
public static function render($block) {
$html = '';
$field_name = 'data[' . static::getFieldName($block) . ']';

View File

@@ -7,7 +7,7 @@ use MailPoetVendor\Carbon\Carbon;
class Date extends Base {
static function render($block) {
public static function render($block) {
$html = '';
$html .= '<p class="mailpoet_paragraph">';
$html .= static::renderLabel($block);
@@ -103,7 +103,7 @@ class Date extends Base {
return $html;
}
static function getDateTypes() {
public static function getDateTypes() {
return [
'year_month_day' => WPFunctions::get()->__('Year, month, day', 'mailpoet'),
'year_month' => WPFunctions::get()->__('Year, month', 'mailpoet'),
@@ -112,7 +112,7 @@ class Date extends Base {
];
}
static function getDateFormats() {
public static function getDateFormats() {
return [
'year_month_day' => ['MM/DD/YYYY', 'DD/MM/YYYY', 'YYYY/MM/DD'],
'year_month' => ['MM/YYYY', 'YYYY/MM'],
@@ -120,14 +120,14 @@ class Date extends Base {
'month' => ['MM'],
];
}
static function getMonthNames() {
public static function getMonthNames() {
return [__('January', 'mailpoet'), WPFunctions::get()->__('February', 'mailpoet'), WPFunctions::get()->__('March', 'mailpoet'), WPFunctions::get()->__('April', 'mailpoet'),
WPFunctions::get()->__('May', 'mailpoet'), WPFunctions::get()->__('June', 'mailpoet'), WPFunctions::get()->__('July', 'mailpoet'), WPFunctions::get()->__('August', 'mailpoet'), WPFunctions::get()->__('September', 'mailpoet'),
WPFunctions::get()->__('October', 'mailpoet'), WPFunctions::get()->__('November', 'mailpoet'), WPFunctions::get()->__('December', 'mailpoet'),
];
}
static function getMonths($block = []) {
public static function getMonths($block = []) {
$defaults = [
'selected' => null,
];
@@ -152,7 +152,7 @@ class Date extends Base {
return $html;
}
static function getYears($block = []) {
public static function getYears($block = []) {
$defaults = [
'selected' => null,
'from' => (int)strftime('%Y') - 100,
@@ -181,7 +181,7 @@ class Date extends Base {
return $html;
}
static function getDays($block = []) {
public static function getDays($block = []) {
$defaults = [
'selected' => null,
];
@@ -207,7 +207,7 @@ class Date extends Base {
return $html;
}
static function convertDateToDatetime($date, $date_format) {
public static function convertDateToDatetime($date, $date_format) {
$datetime = false;
if ($date_format === 'datetime') {
$datetime = $date;

View File

@@ -4,7 +4,7 @@ namespace MailPoet\Form\Block;
class Divider {
static function render() {
public static function render() {
return '<hr class="mailpoet_divider" />';
}
}

View File

@@ -4,7 +4,7 @@ namespace MailPoet\Form\Block;
class Html {
static function render($block) {
public static function render($block) {
$html = '';
$text = '';

View File

@@ -4,7 +4,7 @@ namespace MailPoet\Form\Block;
class Radio extends Base {
static function render($block) {
public static function render($block) {
$html = '';
$field_name = 'data[' . static::getFieldName($block) . ']';

View File

@@ -4,7 +4,7 @@ namespace MailPoet\Form\Block;
class Segment extends Base {
static function render($block) {
public static function render($block) {
$html = '';
$field_name = 'data[' . static::getFieldName($block) . ']';

View File

@@ -6,7 +6,7 @@ use MailPoet\WP\Functions as WPFunctions;
class Select extends Base {
static function render($block) {
public static function render($block) {
$html = '';
$field_name = 'data[' . static::getFieldName($block) . ']';

View File

@@ -4,7 +4,7 @@ namespace MailPoet\Form\Block;
class Submit extends Base {
static function render($block) {
public static function render($block) {
$html = '';
$html .= '<p class="mailpoet_paragraph"><input type="submit" class="mailpoet_submit" ';

View File

@@ -4,7 +4,7 @@ namespace MailPoet\Form\Block;
class Text extends Base {
static function render($block) {
public static function render($block) {
$type = 'text';
$automation_id = ' ';
if ($block['id'] === 'email') {

View File

@@ -3,7 +3,7 @@
namespace MailPoet\Form\Block;
class Textarea extends Base {
static function render($block) {
public static function render($block) {
$html = '';
$html .= '<p class="mailpoet_paragraph">';

View File

@@ -8,13 +8,13 @@ use MailPoet\WP\Functions as WPFunctions;
class Renderer {
// public: rendering method
static function render($form = []) {
public static function render($form = []) {
$html = static::renderStyles($form);
$html .= static::renderHTML($form);
return $html;
}
static function renderStyles($form = [], $prefix = null) {
public static function renderStyles($form = [], $prefix = null) {
$styles = new Util\Styles();
$html = '<style type="text/css">';
@@ -25,14 +25,14 @@ class Renderer {
return $html;
}
static function renderHTML($form = []) {
public static function renderHTML($form = []) {
if (isset($form['body']) && !empty($form['body'])) {
return static::renderBlocks($form['body']);
}
return '';
}
static function getStyles($form = []) {
public static function getStyles($form = []) {
if (isset($form['styles'])
&& strlen(trim($form['styles'])) > 0) {
return strip_tags($form['styles']);
@@ -42,7 +42,7 @@ class Renderer {
}
}
static function renderBlocks($blocks = [], $honeypot_enabled = true) {
public static function renderBlocks($blocks = [], $honeypot_enabled = true) {
$settings = SettingsController::getInstance();
// add honeypot for spambots
$html = ($honeypot_enabled) ?
@@ -76,7 +76,7 @@ class Renderer {
return $html;
}
static function renderBlock($block = []) {
public static function renderBlock($block = []) {
$html = '';
switch ($block['type']) {
case 'html':

View File

@@ -7,7 +7,7 @@ use MailPoet\Form\Widget;
use MailPoet\WP\Functions as WPFunctions;
class Export {
static function getAll($form = null) {
public static function getAll($form = null) {
return [
'html' => static::get('html', $form),
'php' => static::get('php', $form),
@@ -16,7 +16,7 @@ class Export {
];
}
static function get($type = 'html', $form = null) {
public static function get($type = 'html', $form = null) {
switch ($type) {
case 'iframe':
// generate url to load iframe's content

View File

@@ -87,7 +87,7 @@ EOL;
/**
* @param FeaturesController $features_controller
*/
function __construct(
public function __construct(
FeaturesController $features_controller = null
) {
if ($features_controller === null) {
@@ -96,7 +96,7 @@ EOL;
$this->features_controller = $features_controller;
}
function getDefaultStyles() {
public function getDefaultStyles() {
if ($this->features_controller->isSupported(FeaturesController::NEW_FORM_EDITOR)) {
$text_input_width = 'width: 100%;';
} else {
@@ -105,7 +105,7 @@ EOL;
return str_replace('[TEXT_INPUTS_WIDTH_RULE]', $text_input_width, $this->default_styles);
}
function render($stylesheet, $prefix = '') {
public function render($stylesheet, $prefix = '') {
if (!$stylesheet) return;
$styles = new CSSParser($stylesheet);
$styles = $styles->parse();

View File

@@ -17,7 +17,7 @@ class Widget extends \WP_Widget {
/** @var AssetsController */
private $assets_controller;
function __construct() {
public function __construct() {
parent::__construct(
'mailpoet_form',
WPFunctions::get()->__('MailPoet 3 Form', 'mailpoet'),
@@ -36,7 +36,7 @@ class Widget extends \WP_Widget {
}
}
function setupIframe() {
public function setupIframe() {
$form_id = (isset($_GET['mailpoet_form_iframe']) ? (int)$_GET['mailpoet_form_iframe'] : 0);
if (!$form_id || !Form::findOne($form_id)) return;
@@ -140,7 +140,7 @@ class Widget extends \WP_Widget {
<a href="javascript:;" onClick="createSubscriptionForm()" class="mailpoet_form_new"><?php WPFunctions::get()->_e('Create a new form', 'mailpoet'); ?></a>
</p>
<script type="text/javascript">
function createSubscriptionForm() {
public function createSubscriptionForm() {
MailPoet.Ajax.post({
endpoint: 'forms',
action: 'create',
@@ -167,7 +167,7 @@ class Widget extends \WP_Widget {
/**
* Output the widget itself.
*/
function widget($args, $instance = null) {
public function widget($args, $instance = null) {
$this->assets_controller->setupFrontEndDependencies();
// turn $args into variables