This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Checks if there is any expiring members this month | |
if ( count( $expiring_members ) == 0 ) { | |
echo "No member is expiring in this month!"; | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 { |