Skip to content

Instantly share code, notes, and snippets.

@anik
anik / Visual Composer Shortcode
Last active August 2, 2016 11:20
Visual Composer Shortcode
*********************************************************************************
*********************************************************************************
// Checkbox
// Color Picker
// Number
// Dropdown
// Textfield
// Attach Image
// Textarea HTML
// Add Link
<?php
$countries = array();
$countries[] = array("iso_code"=>"AF","country_name"=>"Afghanistan","country_code"=>"93");
$countries[] = array("iso_code"=>"AL","country_name"=>"Albania","country_code"=>"355");
$countries[] = array("iso_code"=>"DZ","country_name"=>"Algeria","country_code"=>"213");
$countries[] = array("iso_code"=>"AS","country_name"=>"American Samoa","country_code"=>"1");
$countries[] = array("iso_code"=>"AD","country_name"=>"Andorra","country_code"=>"376");
$countries[] = array("iso_code"=>"AO","country_name"=>"Angola","country_code"=>"244");
$countries[] = array("iso_code"=>"AI","country_name"=>"Anguilla","country_code"=>"1");
$countries[] = array("iso_code"=>"AG","country_name"=>"Antigua","country_code"=>"1");
@anik
anik / Metabox
Last active August 29, 2015 14:22
Metabox.io Shorthand List
*********************************************************************************
**
**
*********************************************************************************
// TEXT
array(
// Field name - Will be used as label
'name' => __( 'Text', 'your-prefix' ),
// Field ID, i.e. the meta key
'id' => "{$prefix}text",
<?php
function add_custom_meta_box(){
add_meta_box("test-meta-box", "Custom Meta Box", "custom_meta_box_markup", "post", "side", "high", null);
}
add_action("add_meta_boxes", "add_custom_meta_box");
function custom_meta_box_markup($object){
wp_nonce_field(basename(__FILE__), "meta-box-nonce");
?>
class WPPB_Dokan_Shortcode {
public function get_name(){
return 'wppb_dokan_shortcode';
}
public function get_icon() {
return 'wppb-font-Page-grid';
}
public function get_category_name(){
return __( 'Dokan Shortcode', 'wp-page-builder-dokan' );
}
@anik
anik / Filter.php
Last active October 12, 2018 19:17
tests
# Addon Generate.
add_filter( 'wppb_available_addons', 'wppb_dokan_addons_function' );
if ( ! function_exists('wppb_dokan_addons_function')){
function wppb_dokan_addons_function($addons){
$addons[] = 'WPPB_Dokan_Shortcode';
return $addons;
}
}
@anik
anik / Calender.js
Created October 12, 2018 19:35
ReactJS Calender Component
import React, { Component } from 'react'
const _month = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sept','Oct','Nov','Dec']
const _days = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']
class Calendar extends Component {
state = { type: 'date', year: this._todaysDate('y'), month: this._todaysDate('m'), day: this._todaysDate('d') }
_daysInMonth(){
return new Date( this.state.year, this.state.month , 0 ).getDate()
@anik
anik / fontawesome5.js
Created January 10, 2019 05:47
fontawesome 5 free as an array
var fontAwesome = [
'fas fa-ad',
'fas fa-address-book',
'fas fa-address-card',
'fas fa-adjust',
'fas fa-air-freshener',
'fas fa-align-center',
'fas fa-align-justify',
'fas fa-align-left',
'fas fa-align-right',
<?php
echo 'PHP POST Request <br/>';
function curl_data($data) {
// make sure curl module is enable
// phpinfo();
try {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://localhost/xml_action/index.php'); // Response URL
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml") );
<?php
if(strcasecmp($_SERVER['REQUEST_METHOD'], 'POST') != 0){
header($_SERVER["SERVER_PROTOCOL"]." 405 Method Not Allowed", true, 405);
exit;
}
$postData = trim(file_get_contents('php://input'));
libxml_use_internal_errors(true);
$xml = simplexml_load_string($postData);