You appear to be a bot. Output may be restricted
Description
View on TracIf the plugin or theme is in WordPress TRAC then we should be able to view it on TRAC
General format for WordPres core is:
https://core.trac.wordpress.org/browser/tags/4.5/src/wp-includes/post.php#L1828
For plugins we can just try the trunk version
https://plugins.trac.wordpress.org/allow-reinstalls/trunk
But for themes, trunk doesn't appear to exist so we need the version
https://themes.trac.wordpress.org/browser/$theme/$version/
Determine root URL based on the plugin or theme type or name
Usage
oikai_link_to_trac( $sourcefile, $plugin_slug, $post_id, $plugin_id, $refFunc );
Parameters
- $sourcefile
- ( string ) required –
- $plugin_slug
- ( string ) required – plugin or theme slug
- $post_id
- ( ID ) required – post ID
- $plugin_id
- ( ID ) required – plugin/theme ID
- $refFunc
- ( object ) required –
Returns
voidSource
File name: oik-shortcodes/shortcodes/oik-api-importer.phpLines:
1 to 51 of 51
function oikai_link_to_trac( $sourcefile, $plugin_slug, $post_id, $plugin_id, $refFunc ) { $url = null; $plugin_type = get_post_meta( $plugin_id, "_oikp_type", true ); $theme_type = null; if ( '' !== $plugin_type ) { switch ( $plugin_type ) { case '0': global $wp_version; $url = "https://core.trac.wordpress.org/browser/tags/$wp_version/src/"; break; case '1': case '6': $url = "https://plugins.trac.wordpress.org/browser/$plugin_slug/trunk/"; break; case '2': case '3': case '4': case '5': break; default: bw_trace2( $plugin_type, "plugin_type", true ); } } else { $theme_type = get_post_meta( $plugin_id, "_oikth_type", true ); switch ( $theme_type ) { case '1': case '6': oik_require( "shortcodes/oik-component-version.php", "oik-shortcodes" ); $version = oik_query_component_version( $post_id ); $url = "https://themes.trac.wordpress.org/browser/$plugin_slug/$version/"; break; } } if ( $url ) { if ( $refFunc ) { $startline = $refFunc->getStartLine(); } else { $startline = 1; } $url .= "$sourcefile#L$startline"; e( " " ); alink( "svn", $url, "View on Trac" ); } else { bw_trace2( $plugin_type, "Plugin type", true ); bw_trace2( $theme_type, "Theme type", false ); } }View on GitHub