infos()->get( 'id' ) === (int) $id ? $importer : $result; }, false ); } /** * Get modules */ public static function get_modules() { return apply_filters( 'airwpsync/get_modules', array() ); } /** * Get module by slug */ public static function get_module_by_slug( $slug ) { return self::get_modules()[ $slug ] ?? null; } /** * Get importers */ public static function get_importers() { return apply_filters( 'airwpsync/get_importers', array() ); } /** * Get module from importer post object */ public static function get_importer_module( $importer_post_object ) { $config = json_decode( $importer_post_object->post_content, true ); return $config['module'] ?? 'post'; } /** * Get table from id. * * @param array $tables * @param string $table_id * * @return \stdClass|null */ public static function get_table_by_id($tables, $table_id) { $table = null; if ( $tables ) { foreach ( $tables as $t ) { if ( $t->id === $table_id ) { $table = $t; break; } } } return $table; } }