Posts

Showing posts with the label PHP

[PHP] Function Helper For file_get_contents()

Image
Description Of file_get_contents Source Description: PHP.NET (PHP 4 >= 4.3.0, PHP 5, PHP 7) file_get_contents — Reads entire file into a string Description ¶ string file_get_contents ( string $filename [, bool $use_include_path = FALSE [, resource $context [, int $offset = 0 [, int $maxlen ]]]] ) This function is similar to file() , except that file_get_contents() returns the file in a string , starting at the specified offset up to maxlen bytes. On failure,file_get_contents() will return FALSE . file_get_contents() is the preferred way to read the contents of a file into a string. It will use memory mapping techniques if supported by your OS to enhance performance. Note: If

[PHP] Function get_meta_tags() Helper

Image
Description Of get_meta_tags Source Description: PHP.NET (PHP 4, PHP 5, PHP 7) get_meta_tags — Extracts all meta tag content attributes from a file and returns an array Description ¶ array get_meta_tags ( string $filename [, bool $use_include_path = FALSE ] ) Opens filename and parses it line by line for <meta> tags in the file. The parsing stops at </head> . Parameters ¶ filename The path to the HTML file, as a string. This can be a local file or an URL . Example #1 What get_meta_tags()parses <meta name="author" content="

In Article Ads And Single Ads Shortcode Wordpress With WP AMP NINJA Plugin

Image
Adsense Shortcode Wordpress Compatible With WP AMP NINJA Plugin Call Adsense JavaScript (adsbygoogle.js) function saotn_loadAdsByGoogleJs() { wp_register_script( 'google-adsense', '//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js', '', '', true ); wp_enqueue_script( 'google-adsense' ); } add_action( 'wp_enqueue_scripts', 'saotn_loadAdsByGoogleJs' ); Create In Article Ads Shortcode Goto Adsense Dashboard -> My Ads -> Add New -> Choose In Article Ads -> Set with your defined settings -> Get Code from <ins until </script> dont copy script.js above </ins>. //In Article Ads function IAA($atts) { $urlamp = (isset($_SERVER['HTTPS']) ? "https" : "http") . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; if (strpos($urlamp,'wpamp') !== false) { //echo 'Car exists.'; return '<amp-ad layout="fixed-height&qu

Cara Membuat Google AdSense Shortcodes Untuk WordPress

Image
Membuat Google AdSense Shortcodes Untuk WordPress Banyak blog dan situs WordPress menghasilkan keuntungan secara online dengan mengintegrasikan iklan yang menggunakan program Google AdSense.   Iklan Adsense Google ditulis dalam naskah java dan dapat ditempatkan di lokasi manapun yang berbunyi HTML, seperti halaman WordPRess, posts, theme files, dan text capable widgets.   Skrip di bawah ini adalah contoh dari iklan seharga  200 x 200  Google AdSense. <script type="text/javascript"><!-- google_ad_client = "ca-pub-2336674635953969"; /* Advertisement Name */ google_ad_slot = "2720758527"; google_ad_width = 200; google_ad_height = 200; //--> </script> <script type="text/javascript" src="http://pageadd2.googlesyfndicgfion.com/pagead/showfdds.js"> </script> Membuat Iklan "adSense" Contoh Google AdSense Jika Anda tidak mengetahui skrip iklan Google AdSense Anda dengan memori, juga tidak me

Create Adsense shortcode for WordPress

Image
Go to Your Dashboard WordPress Click menu -> Appearance Click editor -> choose functions.php Add below code inside <?php /* * enqueue adsbygoogle.js in the footer & * create a WordPress shortcode with your Google AdSense code * follow me on Twitter: @DimasSkynetCybe */ function loadAdsenseJS() { wp_register_script( 'google-adsense', '//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js', '', '', true ); wp_enqueue_script( 'google-adsense' ); } add_action( 'wp_enqueue_scripts', 'loadAdsenseJS' ); function AdSense() { $output = '<ins class="adsbygoogle" style="background-color: transparent; text-decoration: none; display:inline-block; width:336px; height:280px" data-ad-client="ca-pub-xxYourUniqueIdxx" data-ad-slot="xxUniqueIdSlotxx"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({

Access XAMPP (Apache + MySQL) via Android Smartphone

Image
XAMPP is a complete package containing apache web service, php, and MySQl dbms Assalamu'alaikum bloggers! On this occasion, I will share my experience in configuring XAMPP (Apache + MySQL) so that your Android Smartphone can access your WiFi network. Before you can do that, need to prepare the required software, namely: Apache XAMPP, can be downloaded at: Apache XAMPP WiFi network, or if not connectify-me.The connectify-me function is to turn your laptop into an AP ( Access Point ) if you do not have a WiFi network. If you have a WiFi network (modem telkomsel speedy, for example), then just connect your laptop to the network. For connectify-me you can search on google because this software is paid. If both these alternatives can not be obtained, can also be used facilities of theterter Wi-Fi on Android. The way is quite easy, just turn

Get first post WORDPRESS tutorial

Edit your functions.php of your themes. This also work on amp plugin (wp AMP ninja) -> Edit on functions.php too. Codes 1: <?php /* These functions are great for WordPress sites with posts and media that have been imported. Some images are featured images, some in the content itself, and of the content images, some are internal, others external. These images are grabbed to use at the correct size for archive/homepage thumbnails*/ 1) Look for featured image, show if present 2) Otherwise look for the first image in the content (whether internal or external) 3) Check for an attachment ID, if present, show image at correct dimensions 4) Otherwise show image at normal URL $size = post thumbnail / custom image sizes $url = return a URL or full image tag */ /*Find the image id from a URL*/ function url_get_image_id($image_url) { global $wpdb; $attachment = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid='%s';

Cara Menggunakan Termux Untuk Menjalankan PHP Web Server atau CLI dengan Aplikasi PHP Termux untuk Mengontrol Ponsel atau Tablet Android

Image
Menjalankan PHP di Android Menggunakan Termux Aplikasi Termux memungkinkan menjalankan banyak aplikasi Linux yang terkenal di ponsel Android, tablet, atau jenis perangkat lainnya. Hal ini memungkinkan menjalankan PHP baik dari shell Termux sebagai script konsol atau sebagai server Web. Baca artikel ini untuk mempelajari cara menjalankan skrip PHP dari dalam perangkat Android dan membuka beberapa fungsi Android dengan menggunakan aplikasi Termux. Apa itu Android Termux !!! Aplikasi Termux Adalah aplikasi Android yang berguna yang memungkinkan kita menggunakan semacam konsol Linux di dalam perangkat Android kita, seperti ponsel, tablet, dan sebagainya. Ini membutuhkan Termux:API Aplikasi Add-on untuk dipasang, sehingga bisa menggunakan program command line yang mengekspos fungsi Android ke sistem Termux. Di dalam Termux kita bisa mengakses networking (wi-fi dan mobile internet). Apa itu PHP Termux API ? Tutorial Termux tentang Cara Mengguna

Parsing HTML untuk menemukan Links

Dari blogging sampai log analysis dan search engine optimization (SEO) orang mencari script yang bisa mengurai halaman web dan RSS feed dari situs-situs lain - untuk melihat kemana lalu lintasnya berasal dari antara lain. Parsing HTML Anda sendiri seharusnya tidak masalah - dengan asumsi Anda menggunakan format yang konsisten - tapi begitu Anda menetapkan pandangan Anda untuk mengurai HTML orang lain, frustrasi benar-benar terjadi. Halaman ini menyajikan beberapa ekspresi reguler dan sebuah komentar yang diharapkan akan mengarahkan Anda ke sisi yang benar. arah. 1. Kasus yang paling sederhana Mari kita mulai dengan kasus yang paling sederhana - link yang diformat dengan baik tanpa atribut tambahan: /<a href=\"([^\"]*)\">(.*)<\/a>/iU Ini, percaya atau tidak, adalah ekspresi reguler yang sangat sederhana (atau "regexp" singkatnya). Hal ini dapat dipecah sebagai berikut: Dimulai dengan: <a href=" Serangkaian karakt

Alternatif untuk file_get_contents yang disabled on server by allow_url_fopen=0

cURL alternatif untuk file_get_contents melalui HTTP Dalam versi PHP yang lebih baru, Anda akan sering mendapati bahwa mengambil file jarak jauh menggunakan fopen atau file_get_contents telah dinonaktifkan. Disini kita hadirkan sebuah fungsi http_get_contents menggunakan cURL yang bisa berfungsi sebagai solusi. 1. Fungsi http_get_contents Ini saat ini sedang dalam proses dengan beberapa penyempurnaan dalam pipa. function http_get_contents($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_TIMEOUT, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); if(FALSE === ($retval = curl_exec($ch))) { error_log(curl_error($ch)); } else { return $retval; } } Jika perpustakaan cURL belum diaktifkan di PHP anda akan mendapatkan fungsi error yang tidak ditemukan mencoba memanggil curl_ini t. Versi masa depan akan mencakup penanganan kesalahan dan penguraian header respons HTTP ya

Cara membuat html sitemap wordpress tanpa plugin

Menjadi pengguna WordPress bertahun-tahun saya telah menemukan tidak banyak yang bisa salah dengan CMS open source tapi bila Anda memiliki terlalu banyak plug-in, akan sulit untuk memperbaruinya.   Bila memungkinkan, saya selalu mencoba membangun situs yang tidak akan bergantung pada mereka alasan utama untuk ini. Keamanan yang lebih baik sebagai plug-in adalah sumber utama hacks website Tidak ada jaminan plug-in akan dipertahankan atau diperbarui saat versi baru WordPress keluar Mereka menyumbat admin Mereka tidak selalu bekerja persis seperti yang Anda inginkan Berikut adalah sedikit kode yang saya gunakan untuk membuat Peta Situs HTML biasa.   Anda bahkan bisa memodifikasinya untuk menghasilkan sitemap XML juga dengan sedikit kerja. Yang harus Anda lakukan adalah menyalin kode berikut ke file functions.php dan akan menambahkan kode singkat HTML Sitemap ke situs Anda.   Hanya menempatkan [  htmlSitemap  ] pada halaman yang Anda inginkan untuk muncul. /*** *Taruh kode dib

Cara mengeksekusi kode PHP di Text Widget tanpa menggunakan Plugin

Image
Terkadang kita perlu mengeksekusi skrip PHP di widget teks namun secara default WordPress tidak hadir dengan fitur ini karena masalah keamanan. Anda bisa menggunakan beberapa plugin seperti PHP Text Widget dan PHP Code widget tapi mengapa ada orang yang menggunakannya saat kita bisa melakukannya dalam sepersekian detik. Anda tahu apa, Butuh waktu jauh lebih sedikit daripada memasang plugin. Edit file functions.php dari tema Anda saat ini dan tambahkan kode berikut di bagian akhir file. //Run php on text widget function php_execute($html){ if(strpos($html,"<"."?php")!==false){ ob_start(); eval("?".">".$html); $html=ob_get_contents(); ob_end_clean(); } return $html; } add_filter('widget_text','php_execute',100); Sekarang hapus cache jika Anda menggunakan Plugin Cache seperti cache WPSuper Cache atau W3 Total. Untuk mengecek kerja, Tempel kode PHP berikut di widget teks <? Php echo 'Halo Dunia !!!' ?> S

Cara ping mesin pencari dengan curl

Image
Ketika Anda menambahkan cerita baru atau memperbarui yang sudah ada, mungkin perlu beberapa minggu bagi bot mesin pencari untuk mengindeks ulang situs Anda, namun saya mengetahui bahwa beberapa situs mendapatkan indeks ulang sangat lama setelah menambahkan atau memperbarui konten di situs web mereka, Yang membuatku berpikir bagaimana mereka melakukannya? Jawabannya mereka ping search engine kapanpun ada perubahan yang menginformasikan bot search engine ada perubahan dan membaca sitemap situs lagi proses ini biasanya dilakukan dalam beberapa menit setelah mengirimkan ping. Saya menulis naskah kecil dengan membuat proses otomatis tutorial ini akan menunjukkan caranya. Pertama buat fungsi yang akan memiliki dua parameter yang pertama ($ sitemap) adalah path sitemap dan ($ service) yang merupakan mesin pencari untuk melakukan ping. function pingSE($sitemap,$service){ Pemindaian berikutnya melalui variabel $ service jika ada kecocokan maka buat variabel lain dengan jalur ping mesin p

PHP Amazon S3 File Upload Code AWS Signature Version 4

Amazon offers a PHP SDK for taking care of AWS and S3 asks for, yet it tips the scales at more than 500 documents and almost 5MB. In the event that you simply need to transfer a record to a S3 basin utilizing PHP, you can make the HTTP POST ask for yourself utilizing just around 50 lines of code. This is likewise helpful on the off chance that you need to see how the demand and approval prepare function. AWS Signature Version 4 This code uses Amazon AWS Signature Version 4. To view the old Version 2 code, see  this post . Sample Code This is test PHP code to help you comprehend and test transferring to Amazon S3. Requires PHP variant 5.4 or fresher because of exhibit language structure. On the off chance that you need to utilize this in your venture, you ought to most likely alter this and place it into a capacity or strategy. I have it designed like this particularly to help demonstrate how the procedure functions. Perused the inline code remarks for a clarification of each se

How To Resize and Crop Image to fit Container div using CodeIgniter and jQuery

Image
Resize and Crop Image to fit Container div using CodeIgniter and jQuery When we have a tendency to visit the gallery page of an internet site we primarily see there area unit 2 varieties of image for a selected show image of the gallery. One is that the thumbnail image that we will see on the page once it loaded on browser and therefore the alternative one is that the original image that we will see when clicking on thumbnail. So here the user goes to transfer a picture for the gallery and our system is doing jobs because the following: Creating a replica to make the thumbnail of the first image. Resize the copy image which inserts closely into the fastened height and breadth of the instrumentation div of the thumbnail on gallery page, that additionally maintains the first image resolution quantitative relation. Crop the image to make an ideal thumbnail for the image. To achieve this good thumbnail we tend to ar attending to use CodeIgniter  file uploading  ,