Skip to content

Instantly share code, notes, and snippets.

Avatar

79mplus Admin 79mplus-admin

View GitHub Profile
View class-tm-extra-product-options.php
<?php
// Direct access security
if ( !defined( 'TM_EPO_PLUGIN_SECURITY' ) ) {
die();
}
/**
* Main plugin class responsible for displaying the Extra Product Options on the frontend
*/
final class TM_Extra_Product_Options {
View avery-04.php
require_once( dirname( MPLUS_CE ) . '/vendor/PHPWord/Template.php' );
class Mplus_PHPWord_Template extends PHPWord_Template
{
private $page_xml;
public function __construct( $strFilename ){
parent::__construct( $strFilename );
$this->page_xml = file_get_contents(dirname( MPLUS_CE ) . '/assets/page.txt');
}
View avery-03.php
for ( $i = 0; $i < $no_of_pages; $i++) {
// Adds a page to put the data in.
$document->add_page();
// Goes through each label (for each item).
for ( $j = 0; $j < $labels_per_page; $j++ ) {
/*
* Some variables to be used later.
* The values will be put later.
*/
$index2 = $j + 1;
View avery-02.php
$labels_per_page = 14;
$no_of_pages = ceil( count( $expiring_members ) / $labels_per_page );
$index = 0;
$template_file = dirname( MPLUS_CE ) . '/assets/template.docx';
$upload_dir = wp_get_upload_dir();
$save_path = $upload_dir[ 'basedir' ] . '/expiring_memberships.docx';
$save_url = $upload_dir[ 'baseurl' ] . '/expiring_memberships.docx';
$document = new Mplus_PHPWord_Template( $template_file );
$countries = WC()->countries->get_countries();
View avery-01.php
// Checks if there is any expiring members this month
if ( count( $expiring_members ) == 0 ) {
echo "No member is expiring in this month!";
return;
}