[oik] plugins.com

WordPress plugins and themes

  • Home
  • About
    • lazy shortcodes
    • smart shortcodes
    • oik base plugin
      • oik – donate
      • oik PayPal buttons
      • oik installation
      • oik Button Shortcode button
      • oik changelog
      • oik FAQ
      • oik plugins on SVN
      • oik plugins on GitHub
  • Plugins
    • oik base plugin
    • FREE oik plugins
    • WordPress plugins
    • Premium oik plugins
    • Bespoke oik plugins
  • Shortcodes
    • Shortcode examples
  • Blocks
    • Block examples
  • APIs
    • ALL action and filter hooks
  • Blog

oikth_handle_upload() – Implement ‘wp_handle_upload’ filter

Description

Implement 'wp_handle_upload' filter

In [bw_plug name="easy-digital-downloads"] the files are uploaded to an 'edd' directory in the uploads folder if the post type of the current post is "download" and the current page ( $pagenow ) is 'async-upload.php' or 'media-upload.php' Here we check for a zip file ( with theme name and version number) being uploaded for post_type "oik_themiumversion" If so the file is renamed ( moved ) to a secret target directory if not then we don't do anything In either case the attachment is recorded as if the file has been stored in the uploads

C:\apache\htdocs\wordpress\wp-includes\theme.php(142:0) 2012-07-23T21:46:22+00:00 8485 cf! apply_filters(14338) 3 Array 
( 
[0] => wp_handle_upload 
[1] => Array 
( 
[file] => C:\apache\htdocs\wordpress/wp-content/uploads/2012/07/blogger-301-redirect.1.9.51.zip 
[url] => http://qw/wordpress/wp-content/uploads/2012/07/blogger-301-redirect.1.9.51.zip 
[type] => application/zip 
) 

[2] => upload 
) 

Usage

oikth_handle_upload( $file, $action );

Parameters

$file
( array ) required – array containing file, url and type
$action
( mixed ) required –

Returns

void

Source

File name: oik-themes/oik-themes.php
Lines:
1 to 15 of 15
function oikth_handle_upload( $file, $action ) {
  bw_trace2();
  $type = bw_array_get( $file, "type", null );
  if ( $type == "application/zip" ) {
     $rename = oikth_check_post_type( "oik_themiumversion" );
     if ( $rename ) {  
       $old_file = bw_array_get( $file, 'file', null );
       $new_file = oikth_create_new_file_name( $old_file );
       if ( $new_file ) {
         $renamed = rename( $old_file, $new_file );
       }
     }    
  }     
  return( $file );
}
 
 View on GitHub

Called by

    Invoked by

    1 to 1 of 1
    • wp_handle_upload – filter

    Calls

    1 to 3 of 3
    • bw_trace2() – Trace $value to the trace log file if tracing is active
    • oikth_check_post_type() –
    • oikth_create_new_file_name() – Can we alter the filter in wp_handle_upload to control where the file gets stored and the download URL for it?

    Call hooks

    Function name: oikth_handle_upload
    Plugin ref: oik-themes – WordPress themes server
    Version: 1.4.6
    Sourcefile: oik-themes.php
    File ref: oik-themes.php
    API type: filter
    Deprecated?: No
    API Letters:

    Published: December 3, 2013 | Last updated: October 24, 2014

    Information

    Function name: oikth_handle_upload
    Plugin ref: oik-themes – WordPress themes server
    Version: 1.4.6
    Sourcefile: oik-themes.php
    File ref: oik-themes.php
    API type: filter
    Deprecated?: No
    API Letters:

    Recent plugin updates

    oik-weight-zone-shipping v0.2.13 oik-weight-zone-shipping v0.2.13 has been tested with WooCommerce 10.1.2 and WordPress 6.8.2 ...
    SB Children Block v1.3.0 Upgrade to SB Children Block v1.3.0 for support for PHP 8.3 and PHP 8.4  ...
    oik v4.15.3 Update to oik v4.15.3 for a couple of security fixes. Tested with WordPress 6.8.2 ...
    oik-privacy-policy v1.4.9 Update to oik-privacy-policy v1.4.9 for a security fix. Tested with WordPress 6.8.2 and PHP 8.3 and PHP 8.4 ...
    oik-nivo-slider v1.17.0 oik-nivo-slider v1.17.0 introduces the Nivo slider block - oik-nivo-slider/nivo. ...

    Plugins

    • All Plugins
    • oik base plugin
    • FREE oik plugins
    • WordPress plugins
    • Premium oik plugins

    Themes

    • FREE themes
    • Bespoke themes
    • Premium themes

    Blocks

    • All Blocks
    • Block examples
    • About Blocks

    Shortcodes

    • All Shortcodes
    • Shortcode examples
    • About Shortcodes

    Reference

    • About APIs
    • All APIs
    • All Classes
    • All Files
    • All Hooks

    Support

    • Contact
    • Cookies policy
    • Get API key
    • Privacy
    • Request support
    • Sitemap
    • Stay informed
    • Terms and Conditions
    oik-plugins
    Email: herb@bobbingwide.com

    Weight shipping plugins

    Find out which cart weight shipping plugin you need for your WooCommerce site.
    Which cart weight based plugin do I need?

    Site:  www.oik-plugins.com
    © Copyright oik-plugins 2011-2025. All rights reserved.


    Website designed and developed by Herb Miller of Bobbing Wide
    Proudly powered by WordPress and oik-plugins

    WordPress version: 6.8.3

    Gutenberg version: 21.7.0

    PHP version: 8.2.29