Go to Bandung for IBX

Terakhir diperbaharui: Kamis, 25 Agustus 2016 pukul 15:12
Tautan: http://darto.id/1r

 

We thought that IBX will be the same as Singapore, which so much stand of broadcast hardware. And we all disappointed. So, we only couple minutes there and then we go back home. But, we step by at Gedebage.

JavaScript: Calculate Islamic Hijri Dates

Terakhir diperbaharui: Kamis, 25 Agustus 2016 pukul 15:12
Tautan: http://darto.id/1s

If you do not need fancy looking hijri calendar widget, or you want to style the calendar text by yourself, or you are a webmaster or a web developer that want to build your own hijri calendar web applications, then the following code may be of use.

The script (modified from Robert van Gent’s page) calculates approximate hijri dates from current computer’s date. It is based on arithmetical calculation to match the current moon phase. The calculation is based on 30-year lunar cycle where length of the lunar months is defined aternatingly as 29 or 30 days. Every two or three year an extra day is added at the end of the year to keep up with the phase of the moon. This formula is also similar to “Kuwaiti Algorithm” used by Microsoft to define Hijri Calendar dates.

function gmod(n,m){
	return ((n%m)+m)%m;
}

function kuwaiticalendar(adjust){
	var today = new Date();
	if(adjust) {
		adjustmili = 1000*60*60*24*adjust; 
		todaymili = today.getTime()+adjustmili;
		today = new Date(todaymili);
	}
	day = today.getDate();
	month = today.getMonth();
	year = today.getFullYear();
	m = month+1;
	y = year;
	if(m<3) {
		y -= 1;
		m += 12;
	}

	a = Math.floor(y/100.);
	b = 2-a+Math.floor(a/4.);
	if(y<1583) b = 0;
	if(y==1582) {
		if(m>10)  b = -10;
		if(m==10) {
			b = 0;
			if(day>4) b = -10;
		}
	}

	jd = Math.floor(365.25*(y+4716))+Math.floor(30.6001*(m+1))+day+b-1524;

	b = 0;
	if(jd>2299160){
		a = Math.floor((jd-1867216.25)/36524.25);
		b = 1+a-Math.floor(a/4.);
	}
	bb = jd+b+1524;
	cc = Math.floor((bb-122.1)/365.25);
	dd = Math.floor(365.25*cc);
	ee = Math.floor((bb-dd)/30.6001);
	day =(bb-dd)-Math.floor(30.6001*ee);
	month = ee-1;
	if(ee>13) {
		cc += 1;
		month = ee-13;
	}
	year = cc-4716;

	if(adjust) {
		wd = gmod(jd+1-adjust,7)+1;
	} else {
		wd = gmod(jd+1,7)+1;
	}

	iyear = 10631./30.;
	epochastro = 1948084;
	epochcivil = 1948085;

	shift1 = 8.01/60.;
	
	z = jd-epochastro;
	cyc = Math.floor(z/10631.);
	z = z-10631*cyc;
	j = Math.floor((z-shift1)/iyear);
	iy = 30*cyc+j;
	z = z-Math.floor(j*iyear+shift1);
	im = Math.floor((z+28.5001)/29.5);
	if(im==13) im = 12;
	id = z-Math.floor(29.5001*im-29);

	var myRes = new Array(8);

	myRes[0] = day; //calculated day (CE)
	myRes[1] = month-1; //calculated month (CE)
	myRes[2] = year; //calculated year (CE)
	myRes[3] = jd-1; //julian day number
	myRes[4] = wd-1; //weekday number
	myRes[5] = id; //islamic date
	myRes[6] = im-1; //islamic month
	myRes[7] = iy; //islamic year

	return myRes;
}
function writeIslamicDate(adjustment) {
	var wdNames = new Array("Ahad","Ithnin","Thulatha","Arbaa","Khams","Jumuah","Sabt");
	var iMonthNames = new Array("Muharram","Safar","Rabi'ul Awwal","Rabi'ul Akhir",
	"Jumadal Ula","Jumadal Akhira","Rajab","Sha'ban",
	"Ramadan","Shawwal","Dhul Qa'ada","Dhul Hijja");
	var iDate = kuwaiticalendar(adjustment);
	var outputIslamicDate = wdNames[iDate[4]] + ", " 
	+ iDate[5] + " " + iMonthNames[iDate[6]] + " " + iDate[7] + " AH";
	return outputIslamicDate;
}

To add script (the writeIslamicDate function) without date adjustment:

document.write(writeIslamicDate());

And how to with date adjustment of 1 (advanced one day):

document.write(writeIslamicDate(1));

 

source: Al Habib

WordPress: Media Upload for Your Plugin or Theme

Terakhir diperbaharui: Kamis, 25 Agustus 2016 pukul 15:12
Tautan: http://darto.id/1t

It’s fairly simple to implement, providing you already have a bit of experience with the WordPress API.

The first step is to prepare your HTML. Put it wherever the code for your admin page is. You want to have a text input for the image URL, and a button that will launch the uploader dialog.

<label for="upload_image">
    <input id="upload_image" type="text" size="36" name="ad_image" value="http://" />
    <input id="upload_image_button" class="button" type="button" value="Upload Image" />
    <br />Enter a URL or upload an image
</label>

Now we need to load up the necessary JavaScript files.

add_action('admin_enqueue_scripts', 'my_admin_scripts');
 
function my_admin_scripts() {
    if (isset($_GET['page']) && $_GET['page'] == 'my_plugin_page') {
        wp_enqueue_media();
        wp_register_script('my-admin-js', WP_PLUGIN_URL.'/my-plugin/my-admin.js', array('jquery'));
        wp_enqueue_script('my-admin-js');
    }
}

 

We bind the my_admin_scripts() function to the admin_enqueue_scripts hook, and enqueue both the media scripts and our own JavaScript file. Also, the scripts will only be loaded if the current page is equal to “my_plugin_page,” which you would of course replace with the slug your admin menu has.

Now for the complicated part: the script that hooks into the uploader. Continuing with the above example, it would be named my-admin.js.

jQuery(document).ready(function($){
 
 
    var custom_uploader;
 
 
    $('#upload_image_button').click(function(e) {
 
        e.preventDefault();
 
        //If the uploader object has already been created, reopen the dialog
        if (custom_uploader) {
            custom_uploader.open();
            return;
        }
 
        //Extend the wp.media object
        custom_uploader = wp.media.frames.file_frame = wp.media({
            title: 'Choose Image',
            button: {
                text: 'Choose Image'
            },
            multiple: false
        });
 
        //When a file is selected, grab the URL and set it as the text field's value
        custom_uploader.on('select', function() {
            attachment = custom_uploader.state().get('selection').first().toJSON();
            $('#upload_image').val(attachment.url);
        });
 
        //Open the uploader dialog
        custom_uploader.open();
 
    });
 
 
});

 

When the button is clicked, it creates a new instance of the wp.media object and configures it to only accept a single file, since the text field can only hold one file URL. Then it binds a function to the selection action, which gets the file attributes when an image is chosen and sets the #upload_image text field value to the file’s URL.

Providing everything went as expected, you should have a form field that will accept an arbitrary URL, or allow the user to upload one.

 

source: Webmaster Source

WordPress: Arabic Font Plugins

Terakhir diperbaharui: Kamis, 25 Agustus 2016 pukul 15:12
Tautan: http://darto.id/1u

Apakah anda mempunyai blog? WordPress? dan suatu ketika anda ingin mencantumkan teks Arab, baik itu hadits atau Al Qur’an atau bahkan perkataan ulama, dan ternyata anda harus memmodifikasi theme anda sehingga teks Arabnya tampil dengan sempurna di blog anda. Tetapi anda malas melakukan itu, tetapi anda tidak menguasai entah itu CSS atau JavaScript, tetapi anda tidak mau merubah theme anda. Plugins lah satu-satunya cara untuk bisa melakukan yang anda mau, WordPress Arabic Font Plugin.

Beberapa fitur WordPress Arabic Font Plugin yaitu:

  1. Mudah menggunakannya, semudah menulis artikel yang anda ketik karena anda cukup memblok teks Arabnya dan kemudian klik tombol Arabic Font Style.
  2. Lebih mudah karena WordPress Arabic Font Plugin disertai dengan panel sehingga anda tidak perlu banyak menghapal kustomisasi yang lainnya.
  3. Pilihan font Arabicnya banyak, sehingga anda bisa memilih yang sesuai dengan keinginan anda.
  4. Tidak sampai disitu, anda bisa menampilkan berbagai macam font yang sudah kami sediakan dalam satu halaman artikel anda. Indah bukan?
  5. Anda bisa memilih antara apakah teks Arab ini muncul sebagai paragraph baru atau bersejajar di teks yang lain. Lihat di panel mengenai cara penggunaannya.

Mudah bukan? dan menarik tentunya.

Anda bisa install WordPress Arabic Font Plugin melalui Dashboard anda di menu plugin dan kemudian search dengan “Arabic Font”. Semakin mudah bukan? 😀

Untuk melihat lebih lanjut silahkan lihat di KLoningSpoon atau mengunjungi langsung di WordPress Arabic Font Plugin, repository WordPress.org.

Simple Responsive jQuery Accordion Plugin – SMK Accordion

SMK Accordion is a jQuery plugin aims to provide a quick way to create a responsive and clean accordion interface. When clicking the header of a section, the section will be expanded and the others will be collapsed to present current section’s content in a limited amount of space.

We live in an age where cohesion between mobile and desktop operating systems is becoming increasingly common

Terakhir diperbaharui: Kamis, 25 Agustus 2016 pukul 15:12
Tautan: http://darto.id/1x

We live in an age where cohesion between mobile and desktop operating systems is becoming increasingly common.