Skip to content

Instantly share code, notes, and snippets.

View bwonur's full-sized avatar
☂️
I may be slow to respond.

bwonur

☂️
I may be slow to respond.
View GitHub Profile
[rules] => Array (
[category/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?category_name=$matches[1]&feed=$matches[2]
[category/(.+?)/(feed|rdf|rss|rss2|atom)/?$] => index.php?category_name=$matches[1]&feed=$matches[2]
[category/(.+?)/page/?([0-9]{1,})/?$] => index.php?category_name=$matches[1]&paged=$matches[2]
[category/(.+?)/?$] => index.php?category_name=$matches[1]
[tag/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?tag=$matches[1]&feed=$matches[2]
[tag/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?tag=$matches[1]&feed=$matches[2]
[tag/([^/]+)/page/?([0-9]{1,})/?$] => index.php?tag=$matches[1]&paged=$matches[2]
[tag/([^/]+)/?$] => index.php?tag=$matches[1]
[type/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?post_format=$matches[1]&feed=$matches[2]
@bwonur
bwonur / wp-custom-table.md
Created November 20, 2019 06:02 — forked from ionurboz/wp-custom-table.md
WordPress ADD CUSTOM TABLE + INSERT DATA + GET DATA

Creating or Updating the Table

The next step is to actually create the database table. Rather than executing an SQL query directly, we'll use the dbDelta function in wp-admin/includes/upgrade.php (we'll have to load this file, as it is not loaded by default). The dbDelta function examines the current table structure, compares it to the desired table structure, and either adds or modifies the table as necessary, so it can be very handy for updates (see wp-admin/upgrade-schema.php for more examples of how to use dbDelta). Note that the dbDelta function is rather picky, however. For instance:

  • You must put each field on its own line in your SQL statement.
  • You must have two spaces between the words PRIMARY KEY and the definition of your primary key.
  • You must use the key word KEY rather than its synonym INDEX and you must include at least one KEY.
  • KEY must be followed by a SINGLE SPACE then the key name then a space then open parenthesis with the field name then a closed parenthesis.
  • You must not use a
@bwonur
bwonur / if_empty_server_ref.md
Last active November 11, 2019 14:00
if_empty_server_ref.php

It will/may be empty when the enduser

  • entered the site URL in browser address bar itself.
  • visited the site by a browser-maintained bookmark.
  • visited the site as first page in the window/tab.
  • clicked a link in an external application.
  • switched from a https URL to a http URL.
  • switched from a https URL to a different https URL.
  • has security software installed (antivirus/firewall/etc) which strips the referrer from all requests.
  • is behind a proxy which strips the referrer from all requests.
@bwonur
bwonur / truncate.php
Last active November 11, 2019 08:03
Truncate String ( Yazı kısıtlama )
<?php
function trunc($phrase, $max_words) {
$phrase_array = explode(' ',$phrase);
if(count($phrase_array) > $max_words && $max_words > 0)
$phrase = implode(' ',array_slice($phrase_array, 0, $max_words)).'...';
return $phrase;
}
?>
OR
@bwonur
bwonur / httporhttps.php
Created November 11, 2019 08:00
http or https
<?php if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'
|| $_SERVER['SERVER_PORT'] == 443) {
// HTTPS
} else {
// HTTP
}
@bwonur
bwonur / IP.php
Created November 11, 2019 07:44
Get Visitor IP Address
<?php
// PHP code to extract IP
function getVisIpAddr() {
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
return $_SERVER['HTTP_CLIENT_IP'];
}
else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
return $_SERVER['HTTP_X_FORWARDED_FOR'];
@bwonur
bwonur / Crawler-list.txt
Last active November 7, 2019 11:03
Crawler-list.txt
This file has been truncated, but you can view the full file.
"Mozilla/5.0 (Linux; Android 4.4; Nexus 7/JSS15R) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.114 Mobile Safari/537.36"
'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)'
0 Opera/9.80 (J2ME/MIDP; Opera Mini/6.5.27510/34.1624; U; en) Presto/2.8.119 Version/11.10
0 Opera/9.80 (J2ME/MIDP; Opera Mini/6.5.27510/34.2220; U; en) Presto/2.8.119 Version/11.10
0 Opera/9.80 (J2ME/MIDP; Opera Mini/6.5.28159/32.1382; U; en) Presto/2.8.119 Version/11.10
=Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16
Amazon CloudFront
amovision
Mozilla/5.0 (Linux; Android 7.0; M bot 60 Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/67.0.3396.87 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 6.0; IDbot553 Build/MRA58K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.125 Mobile Safari/537.36
@bwonur
bwonur / error_reporting.php
Created October 26, 2019 07:22
PHP Hata Raporlama
<?php
// Hata raporlamayı tamamen kapatalım
error_reporting(0);
// Basit hataları raporlayalım
error_reporting(E_ERROR | E_WARNING | E_PARSE);
// E_NOTICE de raporlansa iyi olur (ilklendirilmemiş değişkenleri
// veya yanlış yazılmış değişken isimlerini yakalamak için, vb)
@bwonur
bwonur / whois.php
Created October 25, 2019 07:42
PHP code to get WHOIS information of a domain
<?php
/*************************************************************************
php easy :: whois lookup script
==========================================================================
Author: php easy code, www.phpeasycode.com
Web Site: http://www.phpeasycode.com
Contact: [email protected]
*************************************************************************/
$domain = $_GET['domain'];
@bwonur
bwonur / change-text-with-a-CSS3-animation.link
Created October 22, 2019 06:08
Change text with a CSS3 animation