String 3 Nokta

function add3dots($string, $repl, $limit){ if(strlen($string) > $limit){ return substr($string, 0, $limit) . $repl; }else{ return $string; } }

Read More

Plaka RegEx

var valid_plate; valid_plate = function(plate) { var regex, v; v = plate.replace(/\s+/g, ”).toUpperCase(); regex = /^(0[1-9]|[1-7][0-9]|8[01])(([A-Z])(\d{4,5})|([A-Z]{2})(\d{3,4})|([A-Z]{3})(\d{2}))$/; return v.match(regex) != null; };

Read More

IP Adres Bilgisi Almak

$sorgumuz = @unserialize(file_get_contents(‘http://ip-api.com/php/’ . $ipadresi)); echo “<pre>”; print_r($sorgumuz); echo “</pre>”;

Read More

SEO Uyumlu Link Yapmak

function fix_link($str){ $preg = array(‘Ç’, ‘Ş’, ‘Ğ’, ‘Ü’, ‘İ’, ‘Ö’, ‘ç’, ‘ş’, ‘ğ’, ‘ü’, ‘ö’, ‘ı’, ‘+’, ‘#’, ‘.’); $match = array(‘c’, ‘s’, ‘g’, ‘u’, ‘i’, ‘o’, ‘c’, ‘s’, ‘g’, ‘u’, ‘o’, ‘i’, ‘plus’, ‘sharp’, ”); $perma = strtolower(str_replace($preg, $match, $str)); $perma = preg_replace(“@[^A-Za-z0-9\-_\.\+]@i”, ‘ ‘, $perma); $perma = trim(preg_replace(‘/\s+/’, ‘ ‘, $perma)); $perma = […]

Read More

Alexa Sıralaması Çekme

$url = strip_tags(trim($site_url)); $alexa = simplexml_load_file(‘http://data.alexa.com/data?cli=10&url=’ . $url); $globalRank = number_format((int)$alexa->SD->POPULARITY['TEXT']); $countryCode = $alexa->SD->COUNTRY['CODE']; $countryName = $alexa->SD->COUNTRY['NAME']; $countryRank = number_format((int)$alexa->SD->COUNTRY['RANK']); echo “Global Rank: ” . $globalRank; echo ‘<hr />’; echo “Country Rank: ” . $countryName . ‘ ‘ . $countryRank;

Read More

Add Css Function

function addCss(url) { if (window.XMLHttpRequest) { xhr = new XMLHttpRequest(); } else { xhr = new ActiveXObject(“Microsoft.XMLHTTP”); } xhr.open(“GET”, url, false); xhr.send(); var lazyStyle = document.createElement(‘style’); lazyStyle.innerHTML = xhr.responseText; document.head.appendChild(lazyStyle); } addCss(‘https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700&subset=latin,latin-ext’); addCss(‘css/bootstrap.min.css’);

Read More

Sadace Integer Karakterlere İzin Verme

$(“input[name=number]“).keydown(function (e) { // Allow: backspace, delete, tab, escape, enter and . if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 || // Allow: Ctrl+A, Command+A (e.keyCode == 65 && ( e.ctrlKey === true || e.metaKey === true ) ) || // Allow: home, end, left, right, down, up (e.keyCode >= 35 && […]

Read More

Bu Haftanın Başlangıç-Bitiş Tarihi

date_default_timezone_set(‘Europe/Istanbul’); $first_day_of_the_week = ‘Monday’; $start_of_the_week = strtotime(“Last $first_day_of_the_week”); if (strtolower(date(‘l’)) === strtolower($first_day_of_the_week)){ $start_of_the_week = strtotime(‘today’); } $end_of_the_week = $start_of_the_week + (60 * 60 * 24 * 7) – 1; $date_format = ‘d-M-Y l H:i:s’; echo date($date_format, $start_of_the_week); echo “<br>”; echo date($date_format, $end_of_the_week);

Read More

_gaq.push() is not a function

if (typeof _gaq === ‘undefined’ || typeof _gaq !== ‘object’) { var _gaq = {}; _gaq.push = function(array){ if(array[0] === ‘_trackPageview’){ dataLayer.push({ ‘event’: ‘pageview’, ‘pagePath’: array[1] }); }else if(array[0] === ‘_trackEvent’){ dataLayer.push({ ‘event’: ‘event’, ‘category’: array[1], ‘action’: array[2], ‘label’: array[3], ‘value’: array[4] }); } } }

Read More