Skip to content

Commit

Permalink
refactor(intuitive-custom-post-order): reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
timohubois committed Nov 5, 2023
1 parent 3f845fb commit 7679414
Showing 1 changed file with 27 additions and 10 deletions.
37 changes: 27 additions & 10 deletions intuitive-custom-post-order.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ function hicpo_uninstall_db_blogs() {

class Hicpo {


/**
* Construct
*/
Expand Down Expand Up @@ -175,19 +174,36 @@ public function hicpo_activation() {
}

public function hicpo_load_plugin_textdomain() {
load_plugin_textdomain( 'intuitive-custom-post-order', false, basename( dirname( __FILE__ ) ) . '/languages/' );
load_plugin_textdomain(
'intuitive-custom-post-order',
false,
basename( dirname( __FILE__ ) ) . '/languages/'
);
}

public function hicpo_admin_menu() {
add_options_page( __( 'Intuitive CPO', 'intuitive-custom-post-order' ), __( 'Intuitive CPO', 'intuitive-custom-post-order' ), 'manage_options', 'hicpo-settings', [ $this, 'hicpo_admin_page' ] );
add_options_page(
__( 'Intuitive CPO', 'intuitive-custom-post-order' ),
__( 'Intuitive CPO', 'intuitive-custom-post-order' ),
'manage_options',
'hicpo-settings',
[ $this, 'hicpo_admin_page' ]
);
}

public function hicpo_admin_page() {
require HICPO_DIR . 'admin/settings.php';
}

public function hicpo_network_admin_menu() {
add_submenu_page( 'settings.php', __( 'Intuitive CPO', 'hicpo' ), __( 'Intuitive CPO', 'hicpo' ), 'manage_options', 'hicpo-network-settings', [ $this, 'hicpo_network_admin_page' ] );
add_submenu_page(
'settings.php',
__( 'Intuitive CPO', 'hicpo' ),
__( 'Intuitive CPO', 'hicpo' ),
'manage_options',
'hicpo-network-settings',
[ $this, 'hicpo_network_admin_page' ]
);
}

public function hicpo_network_admin_page() {
Expand Down Expand Up @@ -240,9 +256,10 @@ function_exists( 'is_multisite' )
}

// post
if ( ! isset( $_GET['post_type'] ) &&
strstr( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'wp-admin/edit.php' ) &&
in_array( 'post', $objects )
if (
! isset( $_GET['post_type'] ) &&
strstr( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'wp-admin/edit.php' ) &&
in_array( 'post', $objects )
) {
$active = true;
}
Expand Down Expand Up @@ -270,7 +287,7 @@ public function hicpo_load_script_css() {
}

public function hicpo_refresh() {
global $wpdb;
global $wpdb;
$objects = $this->hicpo_get_options_objects();
$tags = $this->hicpo_get_options_tags();

Expand Down Expand Up @@ -340,7 +357,7 @@ public function hicpo_refresh() {
}

public function hicpo_refresh_network() {
global $pagenow;
global $pagenow;
if ( 'sites.php' === $pagenow && ! isset( $_GET['orderby'] ) ) {
add_filter( 'query', [ $this, 'hicpo_refresh_network_2' ] );
}
Expand Down Expand Up @@ -1009,7 +1026,7 @@ public function hicpo_get_blogs_of_user( $blogs ) {

/* before wp v4.6.0 */
public function hicpo_refresh_front_network() {
global $wp_version;
global $wp_version;
if ( version_compare( $wp_version, '4.6.0' ) < 0 ) {
global $blog_id;
if ( 1 != $blog_id ) {
Expand Down

0 comments on commit 7679414

Please sign in to comment.