Description
Provide a download button for the zip attachment to this content or a selected theme ( theme="oik-fum" )For a premium theme the download should be of the form
- themes/download/?theme=oik-blogger-redirect&version=1.1.0802&id=51&action=download&apikey=herb
- themes/download/?theme=oik-fum&version=1.1.0802&id=51&action=download&apikey=
Usage
oikth_download( $atts );Parameters
- $atts
- ( array ) optional – array of shortcode parameters theme= default: oik class= default: download // @TODO ? return the theme slug from the currently selected $post if it is of type "oik-themes"
Returns
voidSource
File name: oik-themes/shortcodes/oik-themes.phpLines:
1 to 62 of 62
function oikth_download( $atts=null ) { $theme = bw_array_get( $atts, "theme", "oik" ); $class = bw_array_get( $atts, 'class', NULL ) . "download" ; oik_require( "feed/oik-themes-feed.php", "oik-themes" ); oik_require( "admin/oik-admin.php" ); if ( $theme == '.' ) { oik_require( "includes/bw_posts.php" ); $post_type = bw_global_post_type(); if ( $post_type == "oik-themes" ) { $post_id = bw_current_post_id(); $slug = get_post_meta( $post_id, "_oikth_slug", true ); //bw_trace2( $slug, "slug" ); // } elseif ( $post_type == "oik_themeversion" ) { // $plugin_version = bw_current_post_id(); // $plugin_id = get_post_meta( $plugin_version, "_oikpv_plugin", true ); // $slug = get_post_meta( $plugin_id, "_oikp_slug", true ); // // } elseif ( $post_type == "oik_themiumversion" ) { // $plugin_version = bw_current_post_id(); // $plugin_id = get_post_meta( $plugin_version, "_oikpv_plugin", true ); // $slug = get_post_meta( $plugin_id, "_oikp_slug", true ); } else { bw_trace2( "not an oik theme", null, true, BW_TRACE_WARNING ); } } else { $slug = bw_get_slug( $theme ); } //bw_trace2( $slug, "slug" ); $post = oikth_load_theme( $slug ); if ( $post ) { $version = oikth_load_themeversion( $post ); if ( $version ) { _oikth_download_version( $version, $post, $class, $slug ); } else { $theme_type = get_post_meta( $post->ID, "_oikth_type", true ); switch ( $theme_type ) { case '1': _oikth_download_wordpressversion( $post, $slug ); break; case '0': case '4': break; case '8': _oikth_download_wordpressversion( $post, $slug ); case '9': _oikth_download_fromgithub( $post, $slug ); break; default: p( "$slug: latest version not available for download" ); } } } else { p( "Unknown theme: $slug " ); } return( bw_ret()); }View on GitHub
Called by
Invoked by
Calls
1 to 6 of 6
- bw_ret() – Use bw_ret() to return the contents of $bwecho, leaving the global value as NULL
- oikth_load_theme() – Load the theme by $slug
- oikth_load_themeversion() –
- p() – Output a paragraph of translatable text
- _oikth_download_version() –
- _oikth_download_wordpressversion() – Create a link to download the WordPress theme Note: For the download to actually work this now requires the theme version, which we may not have.
Call hooks
API Letters:
