Skip to content
This repository has been archived by the owner on Jan 26, 2021. It is now read-only.

Commit

Permalink
fix(general): fix small syntax problems with PHP 5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
luisherranz committed Feb 8, 2019
1 parent a2ac1b2 commit 243c483
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
7 changes: 4 additions & 3 deletions includes/class-frontity-images.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function add_image_ids($response, $post_type, $request)
$content = isset($response->data['content']['rendered'])
? $response->data['content']['rendered']
: "";
$image_ids = [];
$image_ids = array();

$dom->load($content);

Expand Down Expand Up @@ -167,9 +167,10 @@ function get_attachment_id($url)
if ($transient_miss) {
$attachment_id = 0;
$dir = wp_upload_dir();
$uploads_path = parse_url($dir['baseurl'])['path'];
$parsedUrl = parse_url($dir['baseurl']);
$uploads_path = $parsedUrl['path'];
$is_in_upload_directory = strpos($url, $uploads_path . '/') !== false;
$wp_host = parse_url($dir['baseurl'])['host'];
$wp_host = $parsedUrl['host'];
$is_not_external_domain = strpos($url, $wp_host . '/') !== false;

if ($is_in_upload_directory && $is_not_external_domain) {
Expand Down
3 changes: 2 additions & 1 deletion includes/class-frontity-injector.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ class Frontity_Injector

function __construct()
{
self::$injection_type = get_option('frontity_settings')['injection_type'];
$settings = get_option('frontity_settings');
self::$injection_type = $settings['injection_type'];
}

// Evaluate if the injector should be injected.
Expand Down
3 changes: 2 additions & 1 deletion includes/class-frontity-purifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ function __construct()
function check_if_should_purify()
{
$disable_html_purifier = isset($_GET['disableHtmlPurifier']);
$html_purifier_active = get_option('frontity_settings')['html_purifier_active'];
$settings = get_option('frontity_settings');
$html_purifier_active = $settings['html_purifier_active'];

$this->should_purify = !$disable_html_purifier && $html_purifier_active;
}
Expand Down
6 changes: 4 additions & 2 deletions includes/class-frontity-request.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class Frontity_Request

function evaluate_trinity()
{
$frontpage_forced = get_option('frontity_settings')['frontpage_forced'];
$settings = get_option('frontity_settings');
$frontpage_forced = $settings['frontpage_forced'];
$queried_object = get_queried_object();

if (($frontpage_forced && is_front_page()) || is_home()) {
Expand Down Expand Up @@ -103,7 +104,8 @@ function evaluate_settings()
: 'http')
. "://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
self::$per_page = get_option('posts_per_page');
$pretty_permalinks = !empty(get_option('permalink_structure'));
$permalink_structure = get_option('permalink_structure');
$pretty_permalinks = !empty($permalink_structure);
self::$initial_url = $pretty_permalinks
? strtok($url, '?')
: $url;
Expand Down
3 changes: 2 additions & 1 deletion includes/class-frontity-rest-api-routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,10 @@ private function get_latest_from_cpt($cpts, $request)
if (post_type_exists($cpt)) {
$cpt_object = get_post_type_object($cpt);
if ($cpt_object->show_in_rest) {
$settings = get_option('frontity_settings');
if ($cpt === 'post'
&& get_option('show_on_front') === 'page'
&& get_option('frontity_settings')['frontpage_forced']) {
&& $settings['frontpage_forced']) {
$link = get_option('home');
} else {
$link = get_post_type_archive_link($cpt);
Expand Down

0 comments on commit 243c483

Please sign in to comment.