mirror of
https://github.com/mainwp/mainwp-child.git
synced 2025-08-30 02:32:07 +08:00
[CodeFactor] Apply fixes
[ci skip] [skip ci]
This commit is contained in:
parent
d30ffca5d4
commit
4b8f248fe0
3 changed files with 307 additions and 308 deletions
|
@ -1,4 +1,3 @@
|
|||
|
||||
<?php
|
||||
/**
|
||||
* MainWP Child BackWP UP
|
||||
|
|
|
@ -9,6 +9,7 @@ namespace MainWP\Child;
|
|||
|
||||
/**
|
||||
* Class MainWP_Child_Posts
|
||||
*
|
||||
* @package MainWP\Child
|
||||
*/
|
||||
class MainWP_Child_Posts {
|
||||
|
@ -74,7 +75,7 @@ class MainWP_Child_Posts {
|
|||
*
|
||||
* @return array $allPost Return array of recent posts.
|
||||
*/
|
||||
public function get_recent_posts($pAllowedStatuses, $pCount, $type = 'post', $extra = null ) {
|
||||
public function get_recent_posts( $pAllowedStatuses, $pCount, $type = 'post', $extra = null ) {
|
||||
$allPosts = array();
|
||||
if ( null !== $pAllowedStatuses ) {
|
||||
foreach ( $pAllowedStatuses as $status ) {
|
||||
|
@ -105,7 +106,7 @@ class MainWP_Child_Posts {
|
|||
*
|
||||
* @uses \MainWP\Child\MainWP_Child_Posts::get_out_post()
|
||||
*/
|
||||
public function get_recent_posts_int($status, $pCount, $type = 'post', &$allPosts, $extra = null ) {
|
||||
public function get_recent_posts_int( $status, $pCount, $type = 'post', &$allPosts, $extra = null ) {
|
||||
|
||||
$args = array(
|
||||
'post_status' => $status,
|
||||
|
@ -157,7 +158,6 @@ class MainWP_Child_Posts {
|
|||
*
|
||||
* The code is used for the MainWP WordPress SEO Extension
|
||||
* Extension URL: https://mainwp.com/extension/wordpress-seo/
|
||||
*
|
||||
*/
|
||||
$link_count = new \WPSEO_Link_Column_Count();
|
||||
$link_count->set( $post_ids );
|
||||
|
@ -185,7 +185,7 @@ class MainWP_Child_Posts {
|
|||
* @param array $tokens Post tokens.
|
||||
* @return array $outPost Return completed post.
|
||||
*/
|
||||
private function get_out_post($post, $extra, $tokens ) {
|
||||
private function get_out_post( $post, $extra, $tokens ) {
|
||||
$outPost = array();
|
||||
$outPost['id'] = $post->ID;
|
||||
$outPost['post_type'] = $post->post_type;
|
||||
|
@ -815,7 +815,7 @@ class MainWP_Child_Posts {
|
|||
* @uses \MainWP\Child\MainWP_Child_Posts::post_plus_update_author()
|
||||
* @uses \MainWP\Child\MainWP_Child_Posts::post_plus_update_categories()
|
||||
*/
|
||||
private function update_post_data($new_post_id, $post_custom, $post_category, $post_featured_image, $check_image_existed, $is_post_plus ) {
|
||||
private function update_post_data( $new_post_id, $post_custom, $post_category, $post_featured_image, $check_image_existed, $is_post_plus ) {
|
||||
|
||||
$seo_ext_activated = false;
|
||||
if ( class_exists( '\WPSEO_Meta' ) && class_exists( '\WPSEO_Admin' ) ) {
|
||||
|
@ -968,7 +968,7 @@ class MainWP_Child_Posts {
|
|||
$post_gallery_images = unserialize( base64_decode( $_POST['post_gallery_images'] ) ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for http encode compatible..
|
||||
if ( is_array( $post_gallery_images ) ) {
|
||||
foreach ( $post_gallery_images as $gallery ) {
|
||||
if\Exception ( isset( $gallery['src'] ) ) {
|
||||
if \ Exception ( isset( $gallery['src'] ) ) {
|
||||
try {
|
||||
$upload = MainWP_Utility::upload_image( $gallery['src'], $gallery ); // Upload image to WP.
|
||||
if ( null !== $upload ) {
|
||||
|
@ -1049,7 +1049,7 @@ class MainWP_Child_Posts {
|
|||
* @param string $new_post_id New post ID.
|
||||
* @param array $post_custom Post custom meta data.
|
||||
*/
|
||||
private function post_plus_update_author($new_post_id, $post_custom ) {
|
||||
private function post_plus_update_author( $new_post_id, $post_custom ) {
|
||||
$random_privelege = isset( $post_custom['_saved_draft_random_privelege'] ) ? $post_custom['_saved_draft_random_privelege'] : null;
|
||||
$random_privelege = is_array( $random_privelege ) ? current( $random_privelege ) : null;
|
||||
$random_privelege_base = base64_decode( $random_privelege ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for http encode compatible..
|
||||
|
@ -1082,7 +1082,7 @@ class MainWP_Child_Posts {
|
|||
* @param string $new_post_id New post ID.
|
||||
* @param array $post_custom Post custom meta data.
|
||||
*/
|
||||
private function post_plus_update_categories($new_post_id, $post_custom ) {
|
||||
private function post_plus_update_categories( $new_post_id, $post_custom ) {
|
||||
$random_category = isset( $post_custom['_saved_draft_random_category'] ) ? $post_custom['_saved_draft_random_category'] : false;
|
||||
$random_category = is_array( $random_category ) ? current( $random_category ) : null;
|
||||
if ( ! empty( $random_category ) ) {
|
||||
|
@ -1144,7 +1144,7 @@ class MainWP_Child_Posts {
|
|||
* @param bool $seo_ext_activated TRUE|FALSE, Whether or not Yoast SEO is activateed or not.
|
||||
* @param bool $post_to_only TRUE|FALSE, Whether or not to post only to this category.
|
||||
*/
|
||||
private function set_custom_post_fields($new_post_id, $post_custom, $seo_ext_activated, &$post_to_only ) {
|
||||
private function set_custom_post_fields( $new_post_id, $post_custom, $seo_ext_activated, &$post_to_only ) {
|
||||
|
||||
// Set custom fields.
|
||||
$not_allowed = array(
|
||||
|
@ -1252,7 +1252,7 @@ class MainWP_Child_Posts {
|
|||
* @uses \MainWP\Child\MainWP_Utility::upload_image()
|
||||
* @uses \Excepsion()
|
||||
*/
|
||||
private function create_featured_image($new_post_id, $post_featured_image, $check_image_existed ) {
|
||||
private function create_featured_image( $new_post_id, $post_featured_image, $check_image_existed ) {
|
||||
|
||||
$featured_image_exist = false;
|
||||
// If featured image exists - set it.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue