[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

oiksc_function_loader::extract_to_tmp() – Extract the source of a function or method to a temporary file

You appear to be a bot. Output may be restricted

Description

Extract the source of a function or method to a temporary file

If the function is an abstract method then it will contain no code This is detectable by the end line being null. Rather than load the first line we just create an empty function. Notes: We may use namespace oikscloa in the future.

Usage

oiksc_function_loader::extract_to_tmp();

Parameters

Returns

void

Source

File name: oik-shortcodes/classes/class-oiksc-function-loader.php
Lines:
1 to 43 of 43
  function extract_to_tmp() { 
  
    // We need to specify the file name and component type here
    $contents_arr = oiksc_load_file( null, $this->component_type, $this->plugin ); 
    $this->tempnam = tempnam( sys_get_temp_dir(), "oikscloa");
    $start = $this->function_obj->getStartLine();
    $start--;
    $end = $this->function_obj->getEndLine();
    $line = "<?php //" . $this->function_obj->methodname . "\n" ;
    
    $this->write( $line );
    for ( $i = $start ; $i< $end; $i++ ) {
      //$line = strip_for_fun( $contents[$i] );
      $line = $contents_arr[$i];
      
/**
       * Since we're loading this as a function we need to eliminate keywords that are applicable to methods but not functions.
       * Handling abstract is belt and braces - since there shouldn't be any code.
       * 
       * @TODO - this is still messy. For JetPack it converted func and caused a fatal error.
       * This current version alters variable names as well
       * Would it not be better to tokenize the line, find the first literal and replace that?
       * Answer: Yes. As demonstrated by [bw_api] public static protected function func( $func [/bw_api]
       * being handled correctly.
       * 
       */
      if ( $i == $start ) {
        $line = $this->create_dummy_function_line( $line );
        //$line = str_replace( "::", "__",  $line );
        $line = str_replace( "self", "Telf", $line );

      } else { 
        $line = str_replace( "parent::", "Quarent::", $line );
        $line = str_replace( "self", "Telf", $line );
              $line = str_replace( "new static", "new Ttatic", $line );
              $line = str_replace( "static::", "Ttatic::", $line );
      //$line = str_replace( "Telf::", 'self__', $line );
      }
      $this->write( $line );
    }
    if ( !$end ) {
      $this->write( "function " . $this->dummy_function_name . "(){}" );
    }    
  }
 
 View on GitHub

Published: March 11, 2017 | Last updated: March 11, 2017

Information

Function name: oiksc_function_loader::extract_to_tmp
Class ref: oiksc_function_loader
Plugin ref: oik block shortcode and API server
Version: 1.41.1
Sourcefile: classes/class-oiksc-function-loader.php
File ref: classes/class-oiksc-function-loader.php
Deprecated?: No
API Letters: E,F,L,O,T

Recent plugin updates

UK-tides v3.1.1 UK-tides v3.1.1 is built with the latest wp-scripts. It's been tested with WordPress 6.2 and Gutenberg 15.7.0 ...
oik-weight-zone-shipping v0.2.6 oik-weight-zone-shipping v0.2.6 has been tested with WooCommerce 7.4.0. ...
sb-chart-block v1.2.3 SB Chart Block v1.2.3 contains a fix for an Uncaught Error: Call to undefined function bw_trace2()  ...
SB Chart Block v1.2.1 Update to SB Chart Block v1.2.0 for custom colors, font size options and multiple y-axis charts.  ...
oik-css v2.1.0 Update to oik-css v2.1.0 for the ability to style CSS and GeSHi output in documentation. ...

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-2023. All rights reserved.


Website designed and developed by Herb Miller of Bobbing Wide
Proudly powered by WordPress and oik-plugins
WordPress 6.2.2. PHP: 7.4.33. Memory limit: 768M