HTTPS Issue With Mixed Content - ARForms Plugin - wordpress

I have a site wordpress in HTTPS, but also i have an Mixed Content because of ARForms Plugin. PHP 5.6
fonts.googleapis.com and some images in this plugin unsecure, and that files i cant find in database anf template files, please help me by PHP.
Thank you.
This is what i found in configuration and this functional not work:
$arfsiteurl = home_url();
if (is_ssl() and ( !preg_match('/^https:\/\/.*\..*$/', $arfsiteurl) or ! preg_match('/^https:\/\/.*\..*$/', WP_PLUGIN_URL))) {
$arfsiteurl = str_replace('http://', 'https://', $arfsiteurl);
define('ARFURL', str_replace('http://', 'https://', WP_PLUGIN_URL . '/arforms'));
} else {
define('ARFURL', WP_PLUGIN_URL . '/arforms');
}

You should try to download these scripts locally and enqueue them with your HTTPS secure server.
As for the plugin scripts, you could also try to install this plugin and click the flush rewrite rules for it to automatically add code into your .htaccess file.

Related

Get WordPress plugin directory URI

I want to include a WooCommerce file while running a plugin. Here is the code I am using,
include_once(include( content_url() .'/plugins/woocommerce/includes/wc-core-functions.php'));
This gives me below error,
include(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /nas/content/staging/squatwolf/wp-content/plugins/wpfront-notification-bar/classes/class-wpfront-notification-bar.php on line 58
I understand its being caused because the content_url function is giving complete url instead of relative url. I also tried,
plugin_dir_url(__FILE__)
but it gives the url of the plugin I am in, not the wordpress plugin directory url.
you want like this : /home/user/var/www/wordpress/wp-content/plugins/?
try $dir = plugin_dir_path( __DIR__ );

Unable to access analytics.txt once uploaded, returns 404

I've been asked to add an analytics.txt file to a wordpress website so I've created the file and uploaded it to the server document root but when I go to it via the url www.examples.com/analytics.txt all I get is a 404 error.
I've checked the file permissions and I've cleared the wordpress cache but neither have helped.
Any ideas?
The folder structure is as follows:
wp-admin
wp-content
wp-includes
analytics.txt <-- added this file, but cannot seem to access it via a web browser
index.php
etc...
This is NOT the solution but it is a work-around while I carry on trying to figure out why wordpress won't allow me to access my file.
So if you're desperate and HAVE to get it sorted right now, here is what you could do, but I warn you, it's ugly! Open your index.php file and you should see something like this:
<?php
define('WP_USE_THEMES', true);
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
?>
Make a backup copy first and then add the wrapping if statement:
<?php
if ($_SERVER[REQUEST_URI] == '/analytics.txt') {
die('Put the text that you were instructed to put into your analytics.txt file in here');
} else {
define('WP_USE_THEMES', true);
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
}
?>
Like I said, this is a dirty solution but when needs must and the client is getting impatient, this could help in the mean time.
Hoping that someone will have a better solution though!
I was able to get this to work with the following for the Sage theme:
Upload the analytics.txt through the theme administration panel
Copy the url of the upload and remove the hostname. For me it looked like this: app/uploads/2018/09/analytics.txt
Open the functions.php file and add the following:
function analytics_txt_rewrite(){
add_rewrite_rule('^analytics\.txt$','<route to your analytics.txt file>','top');
}
add_action('init','analytics_txt_rewrite');
Flush and regenerate the rewrite rules database: From WordPress Administration Screens, Select Settings -> Permalinks and just click Save Changes without any changes.

Wordpress plugin, do not prepend host in wp_register_script

I am pretty new to WP and have a little question about the wp_register_script function,.
I have a dev environment where the url is test.example.com .. right know when i make a plugin and use wordpress wp_register_script to insert the .js and .css files wordpress prepend the host in front of the url ..
Is there a good way to handle this?? without creating a test DB and change the "siteurl" ?
I found a workaround for my issue ..
I could set WP_SITEURL in the we-config.php file (not the best solution)
if(isset($_SERVER['HTTP_HOST']) && $_SERVER['HTTP_HOST'] == "test.example.com") {
define('WP_SITEURL','http://test.example.com'); // use this if we are testing on test.skala.fm (not localhost)
define('ENVIRONMENT', 'local'); // using localdb
//define('ENVIRONMENT', 'production'); // use this if we are testing on test.example.com (not localhost)
} else {
define('ENVIRONMENT', 'production');
}

How to run codeigniter(HMVC) inside wordpress folder

Anybody have install codeigniter(HMVC) within wordpress.
I am trying to install codeigniter(HMVC) inside wordpress folder.
my codeigniter is work on Virtual host can it possible to run codeigniter within wordpress setup with codeigniter is work on virtual host.
Any suggestion.
It is very easy. Here is step by step process.
First see the structure.
You can see it is inside wordpress directory. Next Add this in index.php of codeigniter
require_once('../wp-load.php');
And finally to avoid conflict between Wordpress and Codeigntier's site_url function add this file in codeigniter/application/core as MY_url_helper.php
if (!defined('BASEPATH')) exit('No direct script access allowed');
if (!function_exists('ci_site_url')) {
function ci_site_url($uri = '')
{
$CI =& get_instance();
return $CI->config->site_url($uri);
}
}
if (!function_exists('ci_base_url')) {
function ci_base_url($uri = '')
{
$CI =& get_instance();
return $CI->config->base_url($uri);
}
}
Now when you use site_url() it will refer to wordpress site_url() and
ci_site_url() it will refer to codeigniter's site_url.
And now when you need to access codeigniter try this.
`http://localhost/wordpress/codeigniter/index.php/mycontroller/mymethod`
Hope it is easy to set up and helps.
Codeignetor can run OK in every directory if server allows to install on that directory.
If its not working please confirm the security settings from server.

Force https on Wordpress multisite

I've got a Wordpress multisite and I'm trying to force https programmatically (better than via .htaccess as htaccess has many rules, set from cache plugin and the multisite itself).
The code I'm using is this one:
if ( FORCE_HTTPS && (!isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) != 'on' ))
{
//echo("Location: " . "https://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]);
header("Location: " . "https://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]);
exit();
}
It's working properly in main site but not in subdmoains, but curiously is I type https://subsite.domain.com it works properly, but if I go with this redirection I see a blank page.
The certificate is working properly and as I sayed, if I type the full adress I see everything ok
What's going wrong or how can I force https?
Thank you
validate your server ssl for errors:
http://www.digicert.com/help/
use this wp plugin:
http://wordpress.org/plugins/force-ssl-everywhere/
ssl on logged in

Resources