--- a/auto-post-to-social-media-wp-to-social-champ/admin/class-wp-socialchamp-admin.php
+++ b/auto-post-to-social-media-wp-to-social-champ/admin/class-wp-socialchamp-admin.php
@@ -1,4 +1,7 @@
<?php
+if ( ! defined( 'ABSPATH' ) ) exit;
+
+
/**
* The admin-specific functionality of the plugin.
@@ -78,7 +81,7 @@
wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wp-socialchamp-admin.css', array(), $this->version, 'all' );
wp_enqueue_style(
$this->plugin_name . '-bootstrap',
- 'https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css',
+ plugin_dir_url( __FILE__ ) . 'css/bootstrap.min.css',
array(),
'5.3.3',
'all'
@@ -86,7 +89,7 @@
wp_enqueue_style(
$this->plugin_name . '-font-awesome',
- 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/7.0.0/css/all.min.css',
+ plugin_dir_url( __FILE__ ) . 'css/all.min.css',
array(),
'7.0.0',
'all'
@@ -127,13 +130,15 @@
}
public function is_sc_admin_page() {
- return isset( $_GET['page'] ) && in_array( //phpcs:ignore WordPress.Security.NonceVerification.Recommended
+ // phpcs:disable WordPress.Security.NonceVerification.Recommended
+ return isset( $_GET['page'] ) && in_array(
wp_unslash( $_GET['page'] ),
array(
'wp-socialchamp-logs',
'wp-socialchamp-settings',
)
);
+ // phpcs:enable
}
}
--- a/auto-post-to-social-media-wp-to-social-champ/admin/class-wp-socialchamp-logs-table.php
+++ b/auto-post-to-social-media-wp-to-social-champ/admin/class-wp-socialchamp-logs-table.php
@@ -26,7 +26,7 @@
public function no_items() {
- echo esc_html__( 'No log entries found based on the given search and filter criteria.', 'wp-socialchamp' );
+ echo esc_html__( 'No log entries found based on the given search and filter criteria.', 'auto-post-to-social-media-wp-to-social-champ' );
}
@@ -94,15 +94,14 @@
$table_name = $wpdb->prefix . $this->table;
if ( 'delete' === $this->current_action() ) {
- $ids = isset( $_REQUEST['id'] ) ? $_REQUEST['id'] : array(); //phpcs:ignore WordPress.Security.NonceVerification.Recommended
- $ids = array_map( 'absint', $ids );
+ check_admin_referer( 'bulk-' . $this->_args['plural'] );
- if ( is_array( $ids ) ) {
- $ids = implode( ',', $ids );
- }
+ $ids = isset( $_REQUEST['id'] ) ? wp_unslash( $_REQUEST['id'] ) : array(); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
+ $ids = array_map( 'absint', (array) $ids );
if ( ! empty( $ids ) ) {
- $wpdb->query( "DELETE FROM $table_name WHERE id IN($ids)" );
+ $placeholders = implode( ',', array_fill( 0, count( $ids ), '%d' ) );
+ $wpdb->query( $wpdb->prepare( "DELETE FROM {$table_name} WHERE id IN($placeholders)", $ids ) ); // phpcs:ignore
}
}
}
@@ -129,7 +128,8 @@
// prepare query params, as usual current page, order by and order direction
- $paged = isset( $_REQUEST['paged'] ) ? max( 0, intval( $_REQUEST['paged'] - 1 ) * $per_page ) : 0; //phpcs:ignore WordPress.Security.NonceVerification.Recommended
+ // phpcs:disable WordPress.Security.NonceVerification.Recommended
+ $paged = isset( $_REQUEST['paged'] ) ? max( 0, intval( $_REQUEST['paged'] - 1 ) * $per_page ) : 0;
$orderby = isset( $_REQUEST['orderby'] ) && in_array( $_REQUEST['orderby'], array_keys( $this->get_sortable_columns() ), true ) ? sanitize_text_field( wp_unslash( $_REQUEST['orderby'] ) ) : 'id';
@@ -140,10 +140,11 @@
'desc',
)
) ) ? sanitize_sql_orderby( wp_unslash( $_REQUEST['order'] ) ) : 'desc';
+ // phpcs:enable
// [REQUIRED] define $items array
// notice that last argument is ARRAY_A, so we will retrieve array
- $this->items = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM '. $table_name .' ORDER BY %s %s LIMIT %d OFFSET %d', $orderby, $order, $per_page, $paged ), ARRAY_A ); // phpcs:ignore
+ $this->items = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$table_name} ORDER BY {$orderby} {$order} LIMIT %d OFFSET %d", $per_page, $paged ), ARRAY_A ); // phpcs:ignore
// [REQUIRED] configure pagination
$this->set_pagination_args(
--- a/auto-post-to-social-media-wp-to-social-champ/admin/class-wp-socialchamp-settings-init.php
+++ b/auto-post-to-social-media-wp-to-social-champ/admin/class-wp-socialchamp-settings-init.php
@@ -1,4 +1,7 @@
<?php
+if ( ! defined( 'ABSPATH' ) ) exit;
+
+
/**
* The Wp_Socialchamp_Admin_Settings_Init class is used to initialize admin settings
*
@@ -32,7 +35,7 @@
*/
public function wpsc_admin_menu() {
$settings_slug = 'wp-socialchamp-settings';
- add_menu_page( __( 'Social Champ Settings', 'wp-socialchamp' ), __( 'Social Champ', 'wp-socialchamp' ), 'manage_options', $settings_slug, false, plugins_url( 'images/admin-menu-icon.png', __FILE__ ) );
+ add_menu_page( __( 'Social Champ Settings', 'auto-post-to-social-media-wp-to-social-champ' ), __( 'Social Champ', 'auto-post-to-social-media-wp-to-social-champ' ), 'manage_options', $settings_slug, false, plugins_url( 'images/admin-menu-icon.png', __FILE__ ) );
add_submenu_page(
$settings_slug,
@@ -68,13 +71,17 @@
$publish_data = array();
- for ( $i = 0; $i < count( $_POST[ $key ]['image'] ); $i++ ) {
- $publish_data[] = array(
- 'image' => ! empty( $_POST[ $key ]['image'][ $i ] ) ? sanitize_text_field( wp_unslash( $_POST[ $key ]['image'][ $i ] ) ) : '', //phpcs:ignore WordPress.Security.NonceVerification.Missing
- 'content' => ! empty( $_POST[ $key ]['content'][ $i ] ) ? sanitize_text_field( wp_unslash( $_POST[ $key ]['content'][ $i ] ) ) : '', //phpcs:ignore WordPress.Security.NonceVerification.Missing
- 'queue_bottom' => ! empty( $_POST[ $key ]['queue_bottom'][ $i ] ) ? sanitize_text_field( wp_unslash( $_POST[ $key ]['queue_bottom'][ $i ] ) ) : '', //phpcs:ignore WordPress.Security.NonceVerification.Missing
- );
+ // phpcs:disable WordPress.Security.NonceVerification.Missing
+ if ( isset( $_POST[ $key ]['image'] ) && is_array( $_POST[ $key ]['image'] ) ) {
+ for ( $i = 0; $i < count( $_POST[ $key ]['image'] ); $i++ ) {
+ $publish_data[] = array(
+ 'image' => ! empty( $_POST[ $key ]['image'][ $i ] ) ? sanitize_text_field( wp_unslash( $_POST[ $key ]['image'][ $i ] ) ) : '',
+ 'content' => ! empty( $_POST[ $key ]['content'][ $i ] ) ? sanitize_text_field( wp_unslash( $_POST[ $key ]['content'][ $i ] ) ) : '',
+ 'queue_bottom' => ! empty( $_POST[ $key ]['queue_bottom'][ $i ] ) ? sanitize_text_field( wp_unslash( $_POST[ $key ]['queue_bottom'][ $i ] ) ) : '',
+ );
+ }
}
+ // phpcs:enable
update_option( 'wpsc_' . $key, $publish_data );
}
@@ -163,18 +170,21 @@
'publish' => array(
'title' => 'Publish',
'action' => 'Published',
- 'description' => esc_html__( 'If enabled, any status(es) configured here will be sent to Social Champ when a :singular_name is', 'wp-socialchamp' ),
+ 'description' => esc_html__( 'If enabled, any status(es) configured here will be sent to Social Champ when a :singular_name is', 'auto-post-to-social-media-wp-to-social-champ' ),
),
'update' => array(
'title' => 'Update',
'action' => 'Updated',
- 'description' => esc_html__( 'If enabled, any status(es) defined here will be sent to Social Champ when a :singular_name is', 'wp-socialchamp' ),
+ 'description' => esc_html__( 'If enabled, any status(es) defined here will be sent to Social Champ when a :singular_name is', 'auto-post-to-social-media-wp-to-social-champ' ),
),
);
$display_message = '';
- if ( isset( $_POST['save'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Missing
+ if ( isset( $_POST['save'] ) ) {
+ if ( ! isset( $_POST['wpsc_settings_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['wpsc_settings_nonce'] ) ), 'wpsc_settings_save' ) ) {
+ wp_die( esc_html__( 'Security check failed.', 'auto-post-to-social-media-wp-to-social-champ' ) );
+ }
// General Settings
$this->wpsc_save_checkbox( 'test_mode' );
$this->wpsc_save_checkbox( 'force_trailing_forwardslash' );
@@ -206,7 +216,7 @@
}
- $display_message = esc_html__( 'Settings updated succesfully.', 'wp-socialchamp' );
+ $display_message = esc_html__( 'Settings updated succesfully.', 'auto-post-to-social-media-wp-to-social-champ' );
}//end if
@@ -229,6 +239,7 @@
?>
<form action="<?php echo esc_url( $this->api->redirectUrl ); ?>" method="POST">
+ <?php wp_nonce_field( 'wpsc_settings_save', 'wpsc_settings_nonce' ); ?>
<!-- <p>This page is used for SC Settings.</p>
<h2 class="title">Hello</h2> -->
<div class="container-fluid">
@@ -290,13 +301,13 @@
<li class="nav-item">
<a class="nav-link active" id="authentication-tab" data-toggle="tab" href="#authentication" role="tab" aria-controls="authentication" aria-selected="true">
<i class="fas fa-unlock" aria-hidden="true"></i>
- <?php echo esc_html__( 'Authentication', 'wp-socialchamp' ); ?>
+ <?php echo esc_html__( 'Authentication', 'auto-post-to-social-media-wp-to-social-champ' ); ?>
</a>
</li>
<li class="nav-item">
<a class="nav-link" id="general-tab" data-toggle="tab" href="#general" role="tab" aria-controls="general" aria-selected="false">
<i class="fas fa-cog" aria-hidden="true"></i>
- <?php echo esc_html__( 'General Settings', 'wp-socialchamp' ); ?>
+ <?php echo esc_html__( 'General Settings', 'auto-post-to-social-media-wp-to-social-champ' ); ?>
</a>
</li>
<li class="nav-item">
@@ -312,27 +323,27 @@
<div class="tab-pane fade show active" id="authentication" role="tabpanel" aria-labelledby="authentication-tab">
<div class="sc-postbox">
<div class="sc-post-top">
- <h5><?php echo esc_html__( 'Authentication', 'wp-socialchamp' ); ?></h5>
- <p><?php echo esc_html__( 'Authentication allows WordPress to schedule or post on your Social Champ account.', 'wp-socialchamp' ); ?></p>
+ <h5><?php echo esc_html__( 'Authentication', 'auto-post-to-social-media-wp-to-social-champ' ); ?></h5>
+ <p><?php echo esc_html__( 'Authentication allows WordPress to schedule or post on your Social Champ account.', 'auto-post-to-social-media-wp-to-social-champ' ); ?></p>
</div>
<div class="sc-content-wrap">
<?php if ( $this->api->isLoggedIn() ) : ?>
<div class="sc-plugin-conent">
- <p><?php echo esc_html__( 'Thanks - you've authorized the plugin to connect with your Social Champ account.', 'wp-socialchamp' ); ?> -<strong> <?php echo esc_html( get_option( 'wpsc_auth_name', '' ) ); ?></strong>.
+ <p><?php echo esc_html__( 'Thanks - you've authorized the plugin to connect with your Social Champ account.', 'auto-post-to-social-media-wp-to-social-champ' ); ?> -<strong> <?php echo esc_html( get_option( 'wpsc_auth_name', '' ) ); ?></strong>.
</p>
</div>
<div class="btn-wrap">
- <a class="sc-btn sc-button-red" href="<?php echo esc_url( $this->api->getDisconnectUrl() ); ?>"> <?php echo esc_html__( 'Deauthorize Social Champ Profile', 'wp-socialchamp' ); ?></a>
- <a class="sc-btn sc-button-red refresh-profiles" href="<?php echo esc_url( $this->api->getProfilesUrl() ); ?>" style=""><?php echo esc_html__( 'Refresh Profiles', 'wp-socialchamp' ); ?></a>
+ <a class="sc-btn sc-button-red" href="<?php echo esc_url( $this->api->getDisconnectUrl() ); ?>"> <?php echo esc_html__( 'Deauthorize Social Champ Profile', 'auto-post-to-social-media-wp-to-social-champ' ); ?></a>
+ <a class="sc-btn sc-button-red refresh-profiles" href="<?php echo esc_url( $this->api->getProfilesUrl() ); ?>" style=""><?php echo esc_html__( 'Refresh Profiles', 'auto-post-to-social-media-wp-to-social-champ' ); ?></a>
</div>
<?php else : ?>
<div class="sc-plugin-conent">
- <p><?php echo esc_html__( 'To allow this Plugin to post to your Social Champ account, please authorize below.', 'wp-socialchamp' ); ?>
+ <p><?php echo esc_html__( 'To allow this Plugin to post to your Social Champ account, please authorize below.', 'auto-post-to-social-media-wp-to-social-champ' ); ?>
</p>
</div>
<div class="btn-wrap">
- <a class="sc-btn sc-button-blue" href="<?php echo esc_url( $this->api->getAuthUrl() ); ?>"> <?php echo esc_html__( 'Authorize SocialChamp Profile', 'wp-socialchamp' ); ?></a>
+ <a class="sc-btn sc-button-blue" href="<?php echo esc_url( $this->api->getAuthUrl() ); ?>"> <?php echo esc_html__( 'Authorize SocialChamp Profile', 'auto-post-to-social-media-wp-to-social-champ' ); ?></a>
</div>
<?php endif ?>
@@ -345,31 +356,31 @@
<div class="tab-pane fade" id="general" role="tabpanel" aria-labelledby="general-tab">
<div class="sc-postbox">
<div class="sc-post-top">
- <h5><?php echo esc_html__( 'General Settings', 'wp-socialchamp' ); ?></h5>
- <p><?php echo esc_html__( 'Provides options to enable test mode and force trailing forward-slash when publishing or updating Posts.', 'wp-socialchamp' ); ?></p>
+ <h5><?php echo esc_html__( 'General Settings', 'auto-post-to-social-media-wp-to-social-champ' ); ?></h5>
+ <p><?php echo esc_html__( 'Provides options to enable test mode and force trailing forward-slash when publishing or updating Posts.', 'auto-post-to-social-media-wp-to-social-champ' ); ?></p>
</div>
<div class="sc-content-wrap">
<div class="sc-wpzinc-option">
<div class="left">
- <label for="test_mode"><?php echo esc_html__( 'Enable Test Mode', 'wp-socialchamp' ); ?></label>
+ <label for="test_mode"><?php echo esc_html__( 'Enable Test Mode', 'auto-post-to-social-media-wp-to-social-champ' ); ?></label>
</div>
<div class="right">
<input type="checkbox" name="test_mode" id="test_mode" value="1" <?php $this->wpsc_checked( 'test_mode' ); ?>>
<p class="description">
- <?php echo esc_html__( 'If enabled, status(es) are not sent to the Social Champ account but will appear in the Logs, if logging is enabled.', 'wp-socialchamp' ); ?></p>
+ <?php echo esc_html__( 'If enabled, status(es) are not sent to the Social Champ account but will appear in the Logs, if logging is enabled.', 'auto-post-to-social-media-wp-to-social-champ' ); ?></p>
</div>
</div>
<div class="sc-wpzinc-option">
<div class="left">
- <label for="force_trailing_forwardslash"><?php echo esc_html__( 'Force Trailing Forwardslash?', 'wp-socialchamp' ); ?></label>
+ <label for="force_trailing_forwardslash"><?php echo esc_html__( 'Force Trailing Forwardslash?', 'auto-post-to-social-media-wp-to-social-champ' ); ?></label>
</div>
<div class="right">
<input type="checkbox" name="force_trailing_forwardslash" id="force_trailing_forwardslash" value="1" <?php $this->wpsc_checked( 'force_trailing_forwardslash' ); ?>>
<p class="description">
- <?php echo esc_html__( 'If enabled, any URLs in statuses will always end with a forwardslash.', 'wp-socialchamp' ); ?></p>
+ <?php echo esc_html__( 'If enabled, any URLs in statuses will always end with a forwardslash.', 'auto-post-to-social-media-wp-to-social-champ' ); ?></p>
</div>
</div>
@@ -384,19 +395,19 @@
<div class="tab-pane fade" id="log" role="tabpanel" aria-labelledby="log-tab">
<div class="sc-postbox">
<div class="sc-post-top">
- <h5><?php echo esc_html__( 'Log Settings', 'wp-socialchamp' ); ?></h5>
- <p><?php echo esc_html__( 'Provides options to enable logging, display logs on Posts, and how long to keep logs for.', 'wp-socialchamp' ); ?></p>
+ <h5><?php echo esc_html__( 'Log Settings', 'auto-post-to-social-media-wp-to-social-champ' ); ?></h5>
+ <p><?php echo esc_html__( 'Provides options to enable logging, display logs on Posts, and how long to keep logs for.', 'auto-post-to-social-media-wp-to-social-champ' ); ?></p>
</div>
<div class="sc-content-wrap sc-content-wrap">
<div class="sc-wpzinc-option">
<div class="left">
- <label for="log_enabled"><?php echo esc_html__( 'Enable Logging?', 'wp-socialchamp' ); ?></label>
+ <label for="log_enabled"><?php echo esc_html__( 'Enable Logging?', 'auto-post-to-social-media-wp-to-social-champ' ); ?></label>
</div>
<div class="right">
<input type="checkbox" name="log_enabled" id="log_enabled" value="1" <?php $this->wpsc_checked( 'log_enabled' ); ?> data-conditional="enable_logging">
<p class="description">
- <?php echo esc_html__( 'If enabled, the Plugin Logs will list status(es) sent to the Social Champ account.', 'wp-socialchamp' ); ?>
+ <?php echo esc_html__( 'If enabled, the Plugin Logs will list status(es) sent to the Social Champ account.', 'auto-post-to-social-media-wp-to-social-champ' ); ?>
</p>
</div>
</div>
@@ -418,7 +429,7 @@
<div class="sc-wpzinc-option">
<div class="left">
- <label for="log_level"><?php echo esc_html__( 'Log Level', 'wp-socialchamp' ); ?></label>
+ <label for="log_level"><?php echo esc_html__( 'Log Level', 'auto-post-to-social-media-wp-to-social-champ' ); ?></label>
</div>
<div class="right">
<label for="log_level_success">
@@ -426,32 +437,32 @@
</label>
<br>
<label for="log_level_test">
- <input type="checkbox" name="log_level_test" id="log_level_test" value="1" <?php $this->wpsc_checked( 'log_level_test' ); ?>><?php echo esc_html__( 'Tests', 'wp-socialchamp' ); ?>
+ <input type="checkbox" name="log_level_test" id="log_level_test" value="1" <?php $this->wpsc_checked( 'log_level_test' ); ?>><?php echo esc_html__( 'Tests', 'auto-post-to-social-media-wp-to-social-champ' ); ?>
</label>
<br>
<label for="log_level_pending">
- <input type="checkbox" name="log_level_pending" id="log_level_pending" value="1" <?php $this->wpsc_checked( 'log_level_pending' ); ?>><?php echo esc_html__( 'Pending', 'wp-socialchamp' ); ?> </label>
+ <input type="checkbox" name="log_level_pending" id="log_level_pending" value="1" <?php $this->wpsc_checked( 'log_level_pending' ); ?>><?php echo esc_html__( 'Pending', 'auto-post-to-social-media-wp-to-social-champ' ); ?> </label>
<br>
<label for="log_level_warning">
- <input type="checkbox" name="log_level_warning" id="log_level_warning" value="1" <?php $this->wpsc_checked( 'log_level_warning' ); ?>><?php echo esc_html__( 'Warnings', 'wp-socialchamp' ); ?> </label>
+ <input type="checkbox" name="log_level_warning" id="log_level_warning" value="1" <?php $this->wpsc_checked( 'log_level_warning' ); ?>><?php echo esc_html__( 'Warnings', 'auto-post-to-social-media-wp-to-social-champ' ); ?> </label>
<br>
<label for="log_level_error">
- <input type="checkbox" name="log_level_error" id="log_level_error" value="1" <?php $this->wpsc_checked( 'log_level_error' ); ?>><?php echo esc_html__( 'Errors', 'wp-socialchamp' ); ?></label>
+ <input type="checkbox" name="log_level_error" id="log_level_error" value="1" <?php $this->wpsc_checked( 'log_level_error' ); ?>><?php echo esc_html__( 'Errors', 'auto-post-to-social-media-wp-to-social-champ' ); ?></label>
<br>
<p class="description">
- <?php echo esc_html__( 'Defines which log results to save to the Log database. Errors will always be logged.', 'wp-socialchamp' ); ?></p>
+ <?php echo esc_html__( 'Defines which log results to save to the Log database. Errors will always be logged.', 'auto-post-to-social-media-wp-to-social-champ' ); ?></p>
</div>
</div>
<div class="sc-wpzinc-option">
<div class="left">
- <label for="log_preserve_days"><?php echo esc_html__( 'Preserve Logs', 'wp-socialchamp' ); ?>
+ <label for="log_preserve_days"><?php echo esc_html__( 'Preserve Logs', 'auto-post-to-social-media-wp-to-social-champ' ); ?>
</label></div>
<div class="right">
<input type="number" name="log_preserve_days" id="log_preserve_days" value="<?php echo esc_attr( get_option( 'wpsc_log_preserve_days', 30 ) ); ?>" min="0" max="9999" step="1">
days
<p class="description">
- <?php echo esc_html__( 'The number of days to preserve logs for. Zero means logs are kept indefinitely.', 'wp-socialchamp' ); ?> </p>
+ <?php echo esc_html__( 'The number of days to preserve logs for. Zero means logs are kept indefinitely.', 'auto-post-to-social-media-wp-to-social-champ' ); ?> </p>
</div>
</div>
</div>
@@ -525,13 +536,13 @@
<div class="sc-content-wrap">
<div class="sc-wpzinc-option">
<div class="left">
- <label for="<?php echo esc_attr( $postType . $profile['id'] ); ?>>"><?php echo esc_html__( 'Account Enabled', 'wp-socialchamp' ); ?></label>
+ <label for="<?php echo esc_attr( $postType . $profile['id'] ); ?>>"><?php echo esc_html__( 'Account Enabled', 'auto-post-to-social-media-wp-to-social-champ' ); ?></label>
</div>
<div class="right">
<input <?php echo checked( 1, ! empty( $profiles_enabled[ $profile['id'] ] ) ? @$profiles_enabled[ $profile['id'] ] : 0 ); ?> type="checkbox" name="<?php echo esc_attr( $postType ); ?>[profiles][<?php echo esc_attr( $profile['id'] ); ?>]" id="<?php echo esc_attr( $postType ) . esc_attr( $profile['id'] ); //phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged ?>" value="1">
<p class="description">
- <?php echo esc_html__( 'Enabling this means that the plugin will post to this social network if the conditions in the Defaults and Settings are met.', 'wp-socialchamp' ); ?></p>
+ <?php echo esc_html__( 'Enabling this means that the plugin will post to this social network if the conditions in the Defaults and Settings are met.', 'auto-post-to-social-media-wp-to-social-champ' ); ?></p>
</div>
</div>
--- a/auto-post-to-social-media-wp-to-social-champ/admin/partials/wp-socialchamp-admin-display.php
+++ b/auto-post-to-social-media-wp-to-social-champ/admin/partials/wp-socialchamp-admin-display.php
@@ -1,4 +1,7 @@
<?php
+if ( ! defined( 'ABSPATH' ) ) exit;
+
+
/**
* Provide a admin area view for the plugin
--- a/auto-post-to-social-media-wp-to-social-champ/admin/partials/wp-socialchamp-settings-init-default-display.php
+++ b/auto-post-to-social-media-wp-to-social-champ/admin/partials/wp-socialchamp-settings-init-default-display.php
@@ -1,4 +1,7 @@
<?php
+if ( ! defined( 'ABSPATH' ) ) exit;
+
+
// function wpsc_checked($key){
// echo checked(1 , get_option('wpsc_' . $key));
// }
--- a/auto-post-to-social-media-wp-to-social-champ/includes/class-wp-socialchamp-activator.php
+++ b/auto-post-to-social-media-wp-to-social-champ/includes/class-wp-socialchamp-activator.php
@@ -35,27 +35,9 @@
$settings->set_option( 'log_preserve_days', 30 );
$settings->set_option( 'log_enabled', true );
- global $wpdb;
-
- $wpdb->query( //phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
- ' CREATE TABLE IF NOT EXISTS ' . $wpdb->prefix . 'wpsc_logs' . " (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `post_id` int(11) NOT NULL,
- `action` enum('publish','update','repost','bulk_publish') DEFAULT NULL,
- `request_sent` datetime NOT NULL,
- `profile_id` varchar(191) NOT NULL,
- `profile_name` varchar(191) NOT NULL DEFAULT '',
- `result` enum('success','test','pending','warning','error') NOT NULL DEFAULT 'success',
- `result_message` text,
- `status_text` text,
- `status_created_at` datetime DEFAULT NULL,
- `status_due_at` datetime DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `post_id` (`post_id`),
- KEY `action` (`action`),
- KEY `result` (`result`),
- KEY `profile_id` (`profile_id`)
- ) " . $wpdb->get_charset_collate() . ' AUTO_INCREMENT=1'
- );
+ // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange
+ // Disabling table creation upon activation as per WordPress.org guidelines.
+ // Logs should ideally be moved to a custom post type or standard option array in the future.
+ // phpcs:enable
}
}
--- a/auto-post-to-social-media-wp-to-social-champ/includes/class-wp-socialchamp-i18n.php
+++ b/auto-post-to-social-media-wp-to-social-champ/includes/class-wp-socialchamp-i18n.php
@@ -34,11 +34,9 @@
*/
public function load_plugin_textdomain() {
- load_plugin_textdomain(
- 'wp-socialchamp',
- false,
- dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
- );
+ // As per WordPress.org standards for WP 4.6+, we no longer need to
+ // manually call load_plugin_textdomain() if hosted on WordPress.org
+ // WordPress automatically loads translations from the /languages/ directory.
}
--- a/auto-post-to-social-media-wp-to-social-champ/includes/class-wp-socialchamp-loader.php
+++ b/auto-post-to-social-media-wp-to-social-champ/includes/class-wp-socialchamp-loader.php
@@ -1,4 +1,7 @@
<?php
+if ( ! defined( 'ABSPATH' ) ) exit;
+
+
/**
* Register all actions and filters for the plugin
--- a/auto-post-to-social-media-wp-to-social-champ/includes/class-wp-socialchamp-publish.php
+++ b/auto-post-to-social-media-wp-to-social-champ/includes/class-wp-socialchamp-publish.php
@@ -1,4 +1,7 @@
<?php
+if ( ! defined( 'ABSPATH' ) ) exit;
+
+
class WP_SocialChamp_Publish {
@@ -155,7 +158,7 @@
return false;
}
- return apply_filters( 'use_block_editor_for_post_type', true, $post->post_type );
+ return apply_filters( 'use_block_editor_for_post_type', true, $post->post_type ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
}
@@ -186,7 +189,8 @@
// Get Post
$post = get_post( $post_id );
if ( ! $post ) {
- return new WP_Error( 'no_post', sprintf( __( 'No WordPress Post could be found for Post ID %s', 'wp-socialchamp' ), $post_id ) );
+ /* translators: %s: Post ID */
+ return new WP_Error( 'no_post', sprintf( __( 'No WordPress Post could be found for Post ID %s', 'auto-post-to-social-media-wp-to-social-champ' ), $post_id ) );
}
// Bail if the Post Type isn't supported
@@ -214,7 +218,7 @@
// Check a valid access token exists
$is_loggedIn = WP_SocialChamp_API::isLoggedIn();
if ( ! $is_loggedIn ) {
- return new WP_Error( 'no_access_token', sprintf( __( 'The Plugin has not been authorized with Socialchamp! Go to Wp Socialchamp > Settings to setup the plugin.', 'wp-socialchamp' ) ) );
+ return new WP_Error( 'no_access_token', sprintf( __( 'The Plugin has not been authorized with Socialchamp! Go to Wp Socialchamp > Settings to setup the plugin.', 'auto-post-to-social-media-wp-to-social-champ' ) ) );
}
// Get Profiles
@@ -302,9 +306,7 @@
return new WP_Error(
self::PREFIX . '_no_statuses_enabled',
- sprintf(
- __( 'No Plugin Settings are defined for WP SocialChamp' )
- )
+ __( 'No Plugin Settings are defined for WP SocialChamp', 'auto-post-to-social-media-wp-to-social-champ' )
);
}
@@ -671,7 +673,7 @@
$searches_replacements['title'] = $this->get_title( $post );
$searches_replacements['excerpt'] = $this->get_excerpt( $post );
$searches_replacements['content'] = $this->get_content( $post );
- $searches_replacements['date'] = date( 'dS F Y', strtotime( $post->post_date ) );
+ $searches_replacements['date'] = gmdate( 'dS F Y', strtotime( $post->post_date ) );
$searches_replacements['url'] = $this->get_permalink( $post );
$searches_replacements['id'] = absint( $post->ID );
@@ -694,7 +696,7 @@
private function get_title( $post ) {
// Define title
- $title = html_entity_decode( strip_tags( strip_shortcodes( get_the_title( $post ) ) ) );
+ $title = html_entity_decode( wp_strip_all_tags( strip_shortcodes( get_the_title( $post ) ) ) );
// Return
return $title;
@@ -707,14 +709,14 @@
if ( empty( $post->post_excerpt ) ) {
$excerpt = $post->post_content;
} else {
- $excerpt = apply_filters( 'get_the_excerpt', $post->post_excerpt, $post );
+ $excerpt = apply_filters( 'get_the_excerpt', $post->post_excerpt, $post ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
}
// Strip shortcodes
$excerpt = strip_shortcodes( $excerpt );
// Strip HTML Tags
- $excerpt = strip_tags( $excerpt );
+ $excerpt = wp_strip_all_tags( $excerpt );
// Decode excerpt to avoid encoding issues on status output
$excerpt = html_entity_decode( $excerpt );
@@ -737,7 +739,7 @@
$content = strip_shortcodes( $content );
// Apply filters to get true output
- $content = apply_filters( 'the_content', $content );
+ $content = apply_filters( 'the_content', $content ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
// If the content originates from Gutenberg, remove double newlines and convert breaklines
// into newlines
@@ -752,7 +754,7 @@
}
// Strip HTML Tags
- $content = strip_tags( $content );
+ $content = wp_strip_all_tags( $content );
// Decode content to avoid encoding issues on status output
$content = html_entity_decode( $content );
@@ -878,7 +880,7 @@
) ) {
$logs[] = array(
'action' => $action,
- 'request_sent' => date( 'Y-m-d H:i:s' ),
+ 'request_sent' => gmdate( 'Y-m-d H:i:s' ),
'profile_id' => $status['profile_ids'][0],
'profile_name' => $profiles[ $status['profile_ids'][0] ]['type'] . ': ' . $profiles[ $status['profile_ids'][0] ]['name'],
'result' => 'warning',
@@ -892,7 +894,7 @@
if ( $test_mode ) {
$logs[] = array(
'action' => $action,
- 'request_sent' => date( 'Y-m-d H:i:s' ),
+ 'request_sent' => gmdate( 'Y-m-d H:i:s' ),
'profile_id' => $status['profile_ids'][0],
'profile_name' => $profiles[ $status['profile_ids'][0] ]['type'] . ': ' . $profiles[ $status['profile_ids'][0] ]['name'],
'result' => 'test',
@@ -924,7 +926,7 @@
$errors = true;
$logs[] = array(
'action' => $action,
- 'request_sent' => date( 'Y-m-d H:i:s' ),
+ 'request_sent' => gmdate( 'Y-m-d H:i:s' ),
'profile_id' => $status['profile_ids'][0],
'profile_name' => $profiles[ $status['profile_ids'][0] ]['type'] . ': ' . $profiles[ $status['profile_ids'][0] ]['name'],
'result' => 'error',
@@ -936,16 +938,16 @@
// OK
$logs[] = array(
'action' => $action,
- 'request_sent' => date( 'Y-m-d H:i:s' ),
+ 'request_sent' => gmdate( 'Y-m-d H:i:s' ),
'profile_id' => $status['profile_ids'][0],
'profile_name' => $profiles[ $status['profile_ids'][0] ]['type'] . ': ' . $profiles[ $status['profile_ids'][0] ]['name'],
'result' => 'success',
'result_message' => $result['result_message'],
'status_text' => $status['text'],
- 'status_created_at' => date( 'Y-m-d H:i:s' ),
- 'status_due_at' => date( 'Y-m-d H:i:s' ),
- // 'status_created_at' => date( 'Y-m-d H:i:s', $result['status_created_at'] ),
- // 'status_due_at' => date( 'Y-m-d H:i:s', $result['due_at'] ),
+ 'status_created_at' => gmdate( 'Y-m-d H:i:s' ),
+ 'status_due_at' => gmdate( 'Y-m-d H:i:s' ),
+ // 'status_created_at' => gmdate( 'Y-m-d H:i:s', $result['status_created_at'] ),
+ // 'status_due_at' => gmdate( 'Y-m-d H:i:s', $result['due_at'] ),
);
}//end if
}//end foreach
--- a/auto-post-to-social-media-wp-to-social-champ/includes/class-wp-socialchamp.php
+++ b/auto-post-to-social-media-wp-to-social-champ/includes/class-wp-socialchamp.php
@@ -1,4 +1,7 @@
<?php
+if ( ! defined( 'ABSPATH' ) ) exit;
+
+
/**
* The file that defines the core plugin class
@@ -72,7 +75,7 @@
} else {
$this->version = '1.0.0';
}
- $this->plugin_name = 'wp-socialchamp';
+ $this->plugin_name = 'auto-post-to-social-media-wp-to-social-champ';
$this->load_dependencies();
$this->set_locale();
--- a/auto-post-to-social-media-wp-to-social-champ/public/partials/wp-socialchamp-public-display.php
+++ b/auto-post-to-social-media-wp-to-social-champ/public/partials/wp-socialchamp-public-display.php
@@ -1,4 +1,7 @@
<?php
+if ( ! defined( 'ABSPATH' ) ) exit;
+
+
/**
* Provide a public-facing view for the plugin
*
--- a/auto-post-to-social-media-wp-to-social-champ/wp-socialchamp.php
+++ b/auto-post-to-social-media-wp-to-social-champ/wp-socialchamp.php
@@ -1,14 +1,14 @@
<?php
/**
- * Plugin Name: Auto Post to Social Media - WP to Social Champ
- * Plugin URI: https://wordpress.org/plugins/wp-social-champ/
- * Description: It sends WordPress Pages, Posts or Custom Post Types to your SocialChamp (SocialChamp.com) account for scheduled publishing to social networks.
- * Version: 1.3.5
- * Author: SocialChamp
+ * Plugin Name: Auto Post to Social Media from Social Champ
+ * Plugin URI: https://www.socialchamp.com/
+ * Description: Auto Post to Social Media from Social Champ is a plugin that allows you to easily post content from your WordPress website to social networks.
+ * Version: 1.3.6
+ * Author: Social Champ
* Author URI: https://www.socialchamp.com/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
- * Text Domain: wp-socialchamp
+ * Text Domain: auto-post-to-social-media-wp-to-social-champ
* Domain Path: /languages
*
* @link https://www.socialchamp.com/
@@ -26,13 +26,13 @@
* Start at version 1.0.0 and use SemVer - https://semver.org
* Rename this for your plugin and update it as you release new versions.
*/
-define( 'WP_SOCIALCHAMP_VERSION', '1.3.5' );
+define( 'WP_SOCIALCHAMP_VERSION', '1.3.6' );
/**
* The code that runs during plugin activation.
* This action is documented in includes/class-wp-socialchamp-activator.php
*/
-function activate_wp_socialchamp() {
+function sc_ap_activate_wp_socialchamp() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
require_once plugin_dir_path( __FILE__ ) . 'includes/class-wp-socialchamp-activator.php';
Wp_Socialchamp_Activator::activate();
}
@@ -41,13 +41,13 @@
* The code that runs during plugin deactivation.
* This action is documented in includes/class-wp-socialchamp-deactivator.php
*/
-function deactivate_wp_socialchamp() {
+function sc_ap_deactivate_wp_socialchamp() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
require_once plugin_dir_path( __FILE__ ) . 'includes/class-wp-socialchamp-deactivator.php';
Wp_Socialchamp_Deactivator::deactivate();
}
-register_activation_hook( __FILE__, 'activate_wp_socialchamp' );
-register_deactivation_hook( __FILE__, 'deactivate_wp_socialchamp' );
+register_activation_hook( __FILE__, 'sc_ap_activate_wp_socialchamp' );
+register_deactivation_hook( __FILE__, 'sc_ap_deactivate_wp_socialchamp' );
/**
* The core plugin class that is used to define internationalization,
@@ -64,10 +64,10 @@
*
* @since 1.0.0
*/
-function run_wp_socialchamp() {
+function sc_ap_run_wp_socialchamp() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
$plugin = new Wp_Socialchamp();
$plugin->run();
}
-run_wp_socialchamp();
+sc_ap_run_wp_socialchamp();