Skip to content

Instantly share code, notes, and snippets.

View manchumahara's full-sized avatar

Sabuj Kundu manchumahara

View GitHub Profile
if ( defined('CBXPHPSPREADSHEET_PLUGIN_NAME') && cbxphpspreadsheet_loadable() ) {
//Include PHPExcel
require_once( CBXPHPSPREADSHEET_ROOT_PATH . 'lib/vendor/autoload.php' ); //or use 'cbxphpspreadsheet_load();'
//now take instance
$objPHPExcel = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
//do whatever you need to do
}
<?php
class CBXChangelogOptionAsArray {
private $optionName;
private $primaryKey;
private $data = [];
private $nextIndex = 1;
private $usedKeys = [];
public function __construct($optionName = 'custom_optionname', $primaryKey = 'id') {
$this->primaryKey = $primaryKey;
<?php
class CBXChangelogMetaAsArray {
private $postId; // The post ID to which meta data will be saved
private $primaryKey;
private $metakey; // Meta key for saving and loading data
private $data = [];
private $nextIndex = 1;
private $usedKeys = []; // Track all used keys
@manchumahara
manchumahara / TableDateFieldAsArray.php
Created January 9, 2025 10:56
Use a table field as array - php + wordpress
<?php
class TableDateFieldAsArray {
private $postId; // The post ID for context
private $primaryKey; // Primary key for rows
private $tableName; // Custom table name
private $fieldName; // Field in the table to store serialized data
private $data = []; // The actual data
private $nextIndex = 1;
private $usedKeys = []; // Track all used keys
@manchumahara
manchumahara / gist:dc88a6b9b157ada5f02cb8408653b80f
Created September 21, 2022 04:53
Google My Business Categories (Json formatted)
[
"Abbey",
"Aboriginal and Torres Strait Islander organization",
"Aboriginal art gallery",
"Abortion clinic",
"Abrasives supplier",
"Abundant Life church",
"Accountant",
"Accounting firm",
"Accounting school",
@manchumahara
manchumahara / gist:12f25c6a3daae0c4aab46e57a6ddb0f0
Last active April 3, 2023 13:43
Supported currency list and code in CBX Currency Converter
'ALL' => 'Albania Lek',
'AFN' => 'Afghanistan Afghani',
'ARS' => 'Argentina Peso',
'AWG' => 'Aruba Guilder',
'AUD' => 'Australia Dollar',
'AZN' => 'Azerbaijan New Manat',
'BSD' => 'Bahamas Dollar',
'BBD' => 'Barbados Dollar',
'BDT' => 'Bangladeshi Taka',
'BYR' => 'Belarus Ruble',
@manchumahara
manchumahara / gist:ec55864a4a61b08636958364d3ea8ec7
Created November 26, 2016 09:50
skip loading woocommerce css for small screen woocommerce-smallscreen
//fix: w3 total cache minify missing css of woocommerce core
add_filter( 'woocommerce_enqueue_styles', 'codeboxr_woocommerce_enqueue_styles' );
if(!function_exists('codeboxr_woocommerce_enqueue_styles')){
function codeboxr_woocommerce_enqueue_styles($arr){
unset($arr['woocommerce-smallscreen']);
return $arr;
}
}
@manchumahara
manchumahara / purejs_domready.js
Created November 11, 2022 05:53
Pure js dom ready
(function(funcName, baseObj) {
// The public function name defaults to window.docReady
// but you can pass in your own object and own function name and those will be used
// if you want to put them in a different namespace
funcName = funcName || "docReady";
baseObj = baseObj || window;
var readyList = [];
var readyFired = false;
var readyEventHandlersInstalled = false;
@manchumahara
manchumahara / fix.js
Created October 31, 2022 05:36
iChaaangeee map js changes to fix the classic style loading
//Contact form map start
var map_id = $('#map_canvas');
if (map_id.length > 0) {
var $lat = map_id.data('lat'),
$lng = map_id.data('lng'),
$zoom = map_id.data('zoom'),
$maptitle = map_id.data('maptitle'),
$mapaddress = map_id.data('mapaddress'),
mymap = L.map('map_canvas').setView([$lat, $lng], $zoom);
function countries_code()
{
$countries = array(
array('id' => '1', 'name' => 'Afghanistan', 'iso_code' => 'AF', 'phonecode' => '+93'),
/*array('id' => '2', 'name' => 'Aland Islands', 'iso_code' => 'AX', 'phonecode' => '+358-18'),*/
array('id' => '3', 'name' => 'Albania', 'iso_code' => 'AL', 'phonecode' => '+355'),
array('id' => '4', 'name' => 'Algeria', 'iso_code' => 'DZ', 'phonecode' => '+213'),
/*array('id' => '5', 'name' => 'American Samoa', 'iso_code' => 'AS', 'phonecode' => '+1-684'),*/
array('id' => '6', 'name' => 'Andorra', 'iso_code' => 'AD', 'phonecode' => '+376'),
array('id' => '7', 'name' => 'Angola', 'iso_code' => 'AO', 'phonecode' => '+244'),