$theme ) { $list[] = array( 'slug' => (string) $stylesheet, 'version' => (string) $theme->get( 'Version' ), 'name' => (string) $theme->get( 'Name' ), 'dir' => $theme->get_stylesheet_directory(), 'single' => false, ); } $ctx->progress = array( 'done' => 0, 'total' => count( $list ), 'label' => __( 'Themes', 'safetybis-security' ), ); return array( 'list' => $list, 'p' => 0, 'pkg' => null, ); } /** * Step. * * @param array $state State. * @param Context $ctx Context. * @return bool */ public function step( array &$state, Context $ctx ) { $total = count( $state['list'] ); while ( $state['p'] < $total ) { $theme = $state['list'][ $state['p'] ]; $ctx->progress = array( 'done' => $state['p'], 'total' => $total, 'label' => $theme['name'], ); if ( null === $state['pkg'] ) { $state['pkg'] = $theme + array( 'phase' => 'verify', 'i' => 0, 'changed' => 0, ); } $ref = Reference::theme( $theme['slug'], $theme['version'] ); if ( null !== $ref ) { $ref = Reference::with_bundled( $ref, 'themes', $theme['slug'] ); } if ( null === $ref ) { $ctx->add( 'unverifiable', 'low', $theme['slug'], '', $theme['version'], array( 'kind' => 'theme', 'name' => $theme['name'], 'version' => $theme['version'] ) ); $ctx->count( 'unverifiable' ); $done = true; } else { $pkg = $state['pkg']; $done = PackageCheck::run( $pkg, $ref, $ctx, 'theme' ); $state['pkg'] = $pkg; } if ( ! $done ) { return false; } $ctx->count( 'checked' ); $state['p']++; $state['pkg'] = null; if ( $ctx->out_of_time() ) { return $state['p'] >= $total; } } return true; } }