array(), ); public function run( $arguments ) { $arguments = Ithemes_Sync_Functions::merge_defaults( $arguments, $this->default_arguments ); if ( ! is_callable( array( $GLOBALS['ithemes-sync-api'], 'run' ) ) ) { return new WP_Error( 'missing-method-api-run', 'The Ithemes_Sync_API::run function is not callable. Unable to generate status details.' ); } $status_elements = Ithemes_Sync_Functions::get_status_elements( $arguments ); if ( ! empty( $arguments['status_elements'] ) ) { if ( is_array( $arguments['status_elements'] ) ) { $show_status_elements = $arguments['status_elements']; } else { trigger_error( 'A non-array status_elements argument was supplied. The argument will be ignored.' ); } unset( $arguments['status_elements'] ); } if ( ! isset( $show_status_elements ) ) { $show_status_elements = Ithemes_Sync_Functions::get_default_status_elements(); } foreach ( $show_status_elements as $element ) { if ( isset( $status_elements[$element] ) ) { $var = $status_elements[$element]; $element_arguments = $arguments; if ( isset( $arguments[$var] ) ) { $element_arguments = $arguments[$var]; } $data = $GLOBALS['ithemes-sync-api']->run( $status_elements[$element], $element_arguments ); } else { $data = "This element is not recognized"; } $status[$element] = $data; } return $status; } }