Skip to content

Instantly share code, notes, and snippets.

@tommcfarlin

tommcfarlin/00-main-plugin.php Secret

Created May 29, 2017
Embed
What would you like to do?
[WordPress] On Immutable Values in WordPress Plugins
<?php
class Main_Plugin {
const ACME_API_KEY = '123456789';
public function init() {
$helper = new Helper_Class();
$helper->render_acme_data( self::ACME_API_KEY );
}
}
<?php
class Helper_Class {
public function render_acme_data( string $api_key ) {
$canvas_url = 'https://url-for-canvas.com?api_key=' . $api_key;
$canvas = new Canvas( $canvas_url );
$canvas->draw();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.