Author:
erics, December 10th, 2021
I use the httpful library from https://phphttpclient.com The website has not defined the Httpful\Response keys anyplace easy to find, so I have documented them here:
|
body raw_body headers raw_headers request code content_type parent_type charset meta_data is_mime_vendor_specific is_mime_personal |
Categories: How-To's, Technology Tags: Body, Code, httpful, Httpful Response, Httpful\Response, Object, php, Response
|
No comments
Author:
erics, October 13th, 2020
The first query gets all custom publication posts that have a value in field book_seq ordered by book_seq The second query gets all custom publication posts that have no meta value for book_seq or no meta record for key book_seq ordered by post_title.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
$querytop = get_posts(array( 'post_type' => 'publication', 'numberposts' => -1, 'orderby' => 'meta_value', 'meta_key' => 'book_seq', 'order' => 'ASC', 'meta_query' => array( // meta query takes an array of arrays, watch out for this! array( 'key' => 'book_seq', 'value' => array('', 'NULL'), 'compare' => 'NOT IN' ) ) )); $querybottom = get_posts(array( 'post_type' => 'publication', 'numberposts' => -1, 'orderby' => 'post_title', 'order' => 'ASC', 'meta_query' => array( // meta query takes an array of arrays, watch out for this! 'relation' => 'OR', array( 'key' => 'book_seq', 'compare' => 'NOT EXISTS' ), array( 'key' => 'book_seq', 'value' => array('', 'NULL'), 'compare' => 'IN' ) ) )); $store_query = array_merge($querytop, $querybottom); |
Great article here: https://rudrastyh.com/wordpress/meta_query.html
Categories: How-To's, Technology Tags: get_posts, meta_query, Or, php, Query, search, Store, WordPress
|
No comments
Author:
erics, June 11th, 2020
If you ever want to view your JSON as a human ;-} $pretty_json = json_encode($data, JSON_PRETTY_PRINT); https://www.php.net/manual/en/function.json-encode.php
Categories: How-To's, Technology Tags: howto, JSON, php, Pretty, Pretty Print, Print, tips
|
No comments
Author:
erics, June 11th, 2020
$merged_object = (object) array_merge((array) $object1, (array) $object2);
Categories: How-To's, Technology Tags: array, Join, Merge, php, Var, Variable
|
No comments
Author:
erics, August 22nd, 2019
As root:
|
PACKAGES=`yum list installed | grep php | awk -F. '{print $1}' | tr "\n\r" " "` echo $PACKAGES yum remove -y $PACKAGES |
~or~
|
yum remove php56 php56-cli php56-common php56-devel php56-gd php56-jsonc php56-jsonc-devel php56-mbstring php56-mcrypt php56-mysqlnd php56-pdo php56-pecl-imagick php56-process php56-xml |
THEN:
|
yum install php72 php72-bcmath php72-cli php72-common php72-devel php72-gd php72-imap php72-json php72-mysqlnd php72-pdo php72-pecl-apcu php72-pecl-imagick php72-pecl-imagick-devel php72-pecl-memcache php72-php-bcmath php72-php-common php72-php-json php72-process php72-runtime php72-xml php72-mbstring php72-pecl-mcrypt |
Be sure to restart your web server!!
Categories: How-To's, Technology Tags: Amazon, AWS, Install, Linux, php, php7, upgrade, Yum, yum install, yum list, yum remove, yum search
|
No comments
Author:
erics, February 21st, 2018
$text = str_replace(“\r”, “”, $text);
Categories: How-To's, Technology Tags: convert, dos, howto, Newline, newlines, php, Strip, tips
|
No comments
Author:
erics, February 13th, 2017
PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 277644940 bytes) in /volumes/data/customer/wordpress/wp-content/plugins/searchwp/vendor/pdfparser/vendor/smalot/pdfparser/src/Smalot/PdfParser/Parser.php on line 72, referer: http://dev.thecustomer.com/index.php?swpnonce=1387006674.5392169952592578125000 To increase the PHP memory limit to 256MB, edit wp-config.php and add the following just before the line that says “That’s all, stop editing! Happy blogging.”:
|
define( 'WP_MEMORY_LIMIT', '256M' ); |
Categories: How-To's, Technology Tags: Allowed memory size exhausted, Error, Exhausted, Fatal, howto, Memory, php, tips, WordPress
|
No comments
Author:
erics, August 24th, 2016
As PHP deprecates old functions, sometimes code maintenance changes become required for long-running sites. As of PHP 5.5, the MySQL functions are deprecated and are removed in PHP 7! I recently had to convert multiple sites to mysqli PHP functions because a new server was running PHP 5.6 and the old server was on PHP […]
Categories: How-To's, Technology Tags: convert, mysql, mysqli, php, PHP5.5, PHP5.6, PHP55, PHP56, WordPress
|
No comments
Author:
erics, August 15th, 2015
For a quick visual check to see what the human-readable date is based on a UNIX timestamp integer: php -r ‘print date(“r”,1483228799);’ php -r ‘print strtotime(“1 Jan 2015”) – 1;’
Categories: How-To's, Technology Tags: cli, Command, Command line, convert, Date, Epoch, Format, php, Stamp, strtotime, time, Timestamp
|
No comments
Author:
erics, October 23rd, 2013
The latest patch version of the SMF forum, 2.0.6, now prevents the site from opening up in an HTML frame. Simply comment out line 104 inside index.php: The Problem: $ grep -Rni X-Frame-Options * index.php:104: header(‘X-Frame-Options: SAMEORIGIN’); The Solution: //header(‘X-Frame-Options: SAMEORIGIN’);
Categories: How-To's, Technology Tags: forum, Frame, Header, howto, html, iFrame, index.php, php, SAMEORIGIN, smf, tips, X-Frame-Options
|
No comments