ignore ) ) { $this->ignore = '' === $this->ignore ? array() : array( $this->ignore ); $this->save(); } return in_array( $slug, $this->ignore, true ); } /** * Is the tweak in the Issue list?. * * @param string $slug Tweak slug. * * @return bool */ public function is_tweak_issue( string $slug ): bool { return in_array( $slug, $this->issues, true ); } /** * Mark a tweak as actioned. * * @param string $status Status. * @param string $slug Tweak slug. */ public function mark( $status, $slug ) { foreach ( array( 'issues', 'fixed', 'ignore' ) as $collection ) { $arr = $this->$collection; $index = array_search( $slug, $arr, true ); if ( false !== $index ) { unset( $arr[ $index ] ); } $this->$collection = $arr; } if ( \WP_Defender\Controller\Security_Tweaks::STATUS_RESTORE === $status ) { $status = \WP_Defender\Controller\Security_Tweaks::STATUS_ISSUES; } $collection = $this->{$status}; $collection[] = $slug; $this->{$status} = $collection; $this->save(); } /** * Define settings labels. * * @return array */ public function labels(): array { return array( 'data' => 'data', 'fixed' => esc_html__( 'Actioned', 'defender-security' ), 'issues' => esc_html__( 'Recommendations', 'defender-security' ), 'ignore' => esc_html__( 'Ignored', 'defender-security' ), 'automate' => 'automate', ); } /** * Todo: Find a less expensive way. * * @return array */ public function get_tweak_types(): array { return array( 'count_fixed' => count( $this->fixed ), 'count_ignored' => count( $this->ignore ), 'count_issues' => count( $this->issues ), ); } }