Posts

Showing posts from May, 2017

send notification for multiple device using fcm

<?php    include_once('config.php');          define( 'AIzaSyCYpVYwK42m4k_WAE3Tc-EZwRLo9_A89vA', 'AAAA0r_x_cs:APA91bEMJ8IpI-n1rxE7VwRUbnAFzm9WULKFHfeYehnkhu2RtXc0Tl0YmupuL6mkp8p3mDytINr5fGzJCDKdePKAzmkn1A7bjHletWonepazDSDCU8K4UJFkq-NXbEUlzKB5lvH1AzxX' );               function send_notification ($tokens)         {                               $url = 'https://fcm.googleapis.com/fcm/send';                                      $msg = array( 'body' => 'Couppon notification', 'title' => 'Title Of Notification',               'icon' => 'myicon',/*Default Icon*/               'sound' => 'mySound'/*Default sound*/     ...

send notification to android single device using fcm.

<?php     define( 'AIzaSyCYpVYwK42m4k_WAE3Tc-EZwRLo9_A89vA', 'AAAA0r_x_cs:APA91bEMJ8IpI-n1rxE7VwRUbnAFzm9WULKFHfeYehnkhu2RtXc0Tl0YmupuL6mkp8p3mDytINr5fGzJCDKdePKAzmkn1A7bjHletWonepazDSDCU8K4UJFkq-NXbEUlzKB5lvH1AzxX' );    // $registrationIds = $_GET['id']; $registrationIds =  'evbtIS1d2cw:APA91bHo-Tqi7U6aqkFbsBHFBpi5ZOnmZobEDr2bh9E2KomK_LM7VhIoMm0xQhaPF9AhZ6N1bXD4_WI8AF0WywG417sT_PnFuZn5m8EmTG5ELpMwDQfkaUgNS-0SSQzXP8eR9puwW01c'; //$registrationIds = 'emUWiI8jZdw:APA91bEFMxsyYK62zghRl4UCzydU6LGxzyWQBr9wcrkaIRIkGMhp8gCEcaEzYNE22d8B29kv-saqBiTjkYBgDmsRml3QT-ZZM_55HdHv18TsvfdPmPQzKpVpaa1FDOgVf-9gKBUpgsXC';      $msg = array           ( 'body' => '{"uid":"1235","message":"this is etst"}', 'title' => 'Title Of Notification',               'icon' => 'myicon',/*Default Icon*/               'sound' => 'mySound'/*...

unique array print without php function php

 <?php $inputArray=array(2,3,4,5,6,2,8,10,4); $outputArray = array(); foreach($inputArray as $inputArrayItem) {     foreach($outputArray as $outputArrayItem) {         if($inputArrayItem == $outputArrayItem) {             continue 2;         }     }     $outputArray[] = $inputArrayItem; } print_r($outputArray); ?>

Get data from third party xml url in php

<?php function getRssFeed($rssFeedUrl) {  $rssFeed = array();  if(!empty($rssFeedUrl)) { foreach ($rssFeedUrl->channel->item as $feedItem) { $data['title'] = $feedItem->title; $data['pubDate'] = $feedItem->pubDate; $data['description'] = implode(' ', array_slice(explode(' ', $feedItem->description), 0, 50)); array_push($rssFeed, $data);  }   }   return $rssFeed; } $rssFeedUrl = simplexml_load_file(" http://www.moneycontrol.com/rss/marketreports.xml "); $rssResult = getRssFeed($rssFeedUrl); $i=0; foreach($rssResult as $rss) {     if($i<2){      $doc = new DOMDocument();    $doc->loadHTML($rss['description']);    $img = $doc->getElementsByTagName('img')->item(0);    $imgOfSRC = $img->getAttribute('src');    $imgOfAlt = $img->getAttribute('alt'); ?> <div class="col-xs-12 col-sm-2 col-md-2 col-lg-2 news_sectn_1"> <img src="<?php echo $imgOfSRC...

xml generated when form submitted by user with two attachment in mail in wordpress.

<?php /* Plugin Name: Job Invoice Description: Customer Job Invoice Generate in xml formate Author: Mahendra Pal */ function load_custom_wp_admin_style() {  wp_register_style( 'customer_invoice_form_css', plugin_dir_url( __FILE__ ) . 'css/invoice_form.css', false, '1.0.0' );  wp_register_style( 'custom_wp_admin_css', plugin_dir_url( __FILE__ ) . 'css/jquery-ui.css', false, '1.0.0' );  wp_register_script( 'custom_wp_admin_jquery', plugin_dir_url( __FILE__ ) . 'js/jquery-1.12.4.js', false, '1.0.0' );  wp_register_script( 'custom_wp_admin_jquery_ui', plugin_dir_url( __FILE__ ) . 'js/jquery-ui.js', false, '1.0.0' );  wp_register_script( 'custom', plugin_dir_url( __FILE__ ) . 'js/custom.js', false, '1.0.0' );           wp_enqueue_style( 'customer_invoice_form_css' );           wp_enqueue_style( 'custom_wp_admin_css' );           w...

How to Limited Char show for post title and post content

add_filter( 'the_title', 'wpse_75691_trim_words' ); function wpse_75691_trim_words( $title ) {      return mb_strimwidth($title, 0, 20, '...'); } add_filter( 'the_excerpt', 'content_trim_words' ); function content_trim_words( $content ) {    return mb_strimwidth($content, 0, 80, '...'); }