Skip to content

Commit

Permalink
Fixes for phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
sc0ttkclark committed Sep 13, 2024
1 parent b4b5752 commit 9e46547
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 60 deletions.
51 changes: 2 additions & 49 deletions components/Migrate-Packages/ui/wizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@
$pods = $api->load_pods( array( 'fields' => false ) );
$pod_templates = $api->load_templates();
$pod_pages = $api->load_pages();
$pod_helpers = $api->load_helpers();

$export = true;

if ( empty( $pods ) && empty( $pod_templates ) && empty( $pod_pages ) && empty( $pod_helpers ) ) {
if ( empty( $pods ) && empty( $pod_templates ) && empty( $pod_pages ) ) {
$export = false;
}
?>
Expand Down Expand Up @@ -306,53 +305,7 @@ class="button button-secondary button-small hidden"
<?php
}//end if

if ( ! empty( $pod_helpers ) ) {
$data = $pod_helpers;
$data_name = 'helpers';
?>
<div class="stuffbox pods-package-import-group">
<h3>
<label for="link_name"><?php esc_html_e( 'Choose which Pod Helpers to export', 'pods' ); ?></label>
</h3>

<div class="inside pods-manage-field pods-dependency">
<div class="pods-field-option-group">
<div class="pods-pick-values pods-pick-checkbox pods-zebra">
<p>
<a href="#toggle" class="button pods-wizard-toggle-all" data-toggle="<?php echo esc_attr( $data_name ); ?>"><?php esc_html_e( 'Toggle all on / off', 'pods' ); ?></a>
</p>

<ul>
<?php
$zebra = false;

foreach ( $data as $item ) {
$checked = true;

$class = ( $zebra ? 'even' : 'odd' );

$zebra = ( ! $zebra );
?>
<li class="pods-zebra-<?php echo esc_attr( $class ); ?>">
<?php
echo PodsForm::field( $data_name . '[' . $item['id'] . ']', $checked, 'boolean', [
'boolean_yes_label' => $item['name'] . ( ! empty( $item['label'] ) ? ' (' . $item['label'] . ')' : '' ),
'disable_dfv' => true,
] );
?>
</li>
<?php
}
?>
</ul>
</div>
</div>
</div>
</div>
<?php
}//end if

do_action( 'pods_packages_export_options', $pods, $pod_templates, $pod_pages, $pod_helpers );
do_action( 'pods_packages_export_options', $pods, $pod_templates, $pod_pages, [] );
?>
</div>

Expand Down
24 changes: 22 additions & 2 deletions components/Pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -745,12 +745,23 @@ public function save_meta( $_null, $post_ID = null, $meta_key = null, $meta_valu

// objects will be automatically sanitized
if ( $revisions ) {
add_action( 'pre_post_update', 'wp_save_post_revision' );
add_action( 'pre_post_update', [ $this, 'save_post_revision_for_post' ] );
}

return true;
}

/**
* Save post revision for a post without a return.
*
* @since TBD
*
* @param int $post_id The post ID.
*/
public function save_post_revision_for_post( $post_id ) {
wp_save_post_revision( $post_id );
}

/**
* Flush Pod Page Rewrite cache
*
Expand Down Expand Up @@ -976,14 +987,23 @@ public function page_check() {
add_action( 'wp', array( $this, 'silence_404' ), 1 );

// Genesis theme integration.
add_action( 'genesis_loop', 'pods_content', 11 );
add_action( 'genesis_loop', [ $this, 'pods_page_content' ], 11 );
}
}

self::$checked = true;
}//end if
}

/**
* Output Pdos Page content without return.
*
* @since TBD
*/
public function pods_page_content() {
pods_content();
}

/**
* Output Pod Page Content
*
Expand Down
2 changes: 1 addition & 1 deletion components/Roles/Roles.php
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ public function get_capabilities() {
$capabilities = array_merge( $default_caps, $role_caps, $plugin_caps );

// Gravity Forms.
if ( is_callable( 'GFCommon::all_caps' ) ) {
if ( class_exists( 'GFCommon' ) && is_callable( 'GFCommon::all_caps' ) ) {
$capabilities = array_merge( $capabilities, GFCommon::all_caps() );
}

Expand Down
6 changes: 3 additions & 3 deletions components/Roles/ui/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
if ( isset( $_GET['do'] ) ) {
$action = __( 'saved', 'pods' );

if ( 'create' == pods_var( 'do', 'get', 'save' ) ) {
if ( 'create' == pods_v( 'do', 'get', 'save' ) ) {
$action = __( 'created', 'pods' );
}

Expand Down Expand Up @@ -89,7 +89,7 @@
foreach ( $capabilities as $capability ) {
$checked = false;

if ( true === (boolean) pods_var( $capability, $role_capabilities, false ) ) {
if ( true === (boolean) pods_v( $capability, $role_capabilities, false ) ) {
$checked = true;
}

Expand All @@ -99,7 +99,7 @@
?>
<li class="pods-zebra-<?php echo esc_attr( $class ); ?>" data-capability="<?php echo esc_attr( $capability ); ?>">
<?php
echo PodsForm::field( 'capabilities[' . $capability . ']', pods_var_raw( 'capabilities[' . $capability . ']', 'post', $checked ), 'boolean', [
echo PodsForm::field( 'capabilities[' . $capability . ']', pods_v( 'capabilities[' . $capability . ']', 'post', $checked ), 'boolean', [
'boolean_yes_label' => $capability,
'disable_dfv' => true,
] );
Expand Down
13 changes: 12 additions & 1 deletion components/Templates/Templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -510,12 +510,23 @@ public function save_meta( $_null, $post_ID = null, $meta_key = null, $meta_valu

// objects will be automatically sanitized
if ( $revisions ) {
add_action( 'pre_post_update', 'wp_save_post_revision' );
add_action( 'pre_post_update', [ $this, 'save_post_revision_for_post' ] );
}

return true;
}

/**
* Save post revision for a post without a return.
*
* @since TBD
*
* @param int $post_id The post ID.
*/
public function save_post_revision_for_post( $post_id ) {
wp_save_post_revision( $post_id );
}

/**
* Display the page template
*
Expand Down
8 changes: 4 additions & 4 deletions src/Pods/Config_Handler.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9e46547

Please sign in to comment.