Skip to content

Instantly share code, notes, and snippets.

View yasaryousuf's full-sized avatar

Yasar Yousuf yasaryousuf

  • Dhaka, Bangladesh.
View GitHub Profile
<?php
add_action( 'save_post', array($self, 'save_custom_fields'), 10, 3 );
function save_custom_fields( $post_id, $post, $update) {
if ( $post->post_type != 'pfm_registration' ) {
return false;
}
if ( empty( $_POST['data'] ) ) {
return false;
<?php
public function pfmEditProfile()
{
if (!isset($_POST['pfmEditProfile']) || !wp_verify_nonce($_POST['pfmEditProfile'], 'pfmEditProfile-nonce')) {
die("You are not allowed to submit data.");
}
if ( ! function_exists( 'wp_handle_upload' ) ) {
require_once( ABSPATH . 'wp-admin/includes/file.php' );
}
<?php
public function hasAnyRole($roles)
{
return null !== $this->roles()->whereIn('name', $roles)->first();
}
public function hasRole($role)
{
return null !== $this->roles()->where('name', $role)->first();
}
<?php
public function compiler($in, $out)
{
try {
$scss = new Compiler();
$scss->setImportPaths(OP_PATH.'assets/scss/');
echo $css = $scss->compile(file_get_contents($in), $in);
<?php
public function compiler($in, $out)
{
try {
$scss = new Compiler();
$scss->setImportPaths(OP_PATH.'assets/scss/');
echo $css = $scss->compile(file_get_contents($in), $in);
$(".img-close").click(function(){
var col12 = $(this).parents(".col-md-12");
var imgTagSrc = $(col12).find("img").attr("src");
var token = $('[name="_token"]').attr("value");
if ($(col12).find("img").attr("id") == 'uploaded-logo') {
var type = 'logo'
}
else {
var type = 'ad'
<?php
public function filter($merge_data)
{
$data = array();
foreach ($merge_data as $key => $value) {
$data["{" . $key . "}"] = stripslashes($value);
}
return $data;
}
$('.doc input').fileupload(
{
url: WP_Ajax.ajaxurl,
sequentialUploads: true,
formData: {action: 'upload_file'},
add: function (e, data) {
var uploadErrors = [];
var acceptFileTypes = /\/(pdf|JPEG|JPG|TIFF|GIF|png|BMP|DOC|DOCX|XLS|XLSX|ODT|ODS)$/i;
<?php
echo date("F j, Y g:i a");
$('.unlink-user').on('click', function(e){
var href = $(this).attr('href');
e.preventDefault(); // <--- prevent form from submitting
swal({
title: "Are you sure?",
text: "You will not be able to recover this imaginary file!",
icon: "warning",
buttons: [
'No, cancel it!',