rebase from live enviornment
This commit is contained in:
@@ -80,9 +80,15 @@
|
||||
var data = [];
|
||||
|
||||
$( this ).closest( 'form' ).find( '[data-config-field]' ).each( function() {
|
||||
var val = $( this ).val();
|
||||
|
||||
if ( $( this ).is( '[type=checkbox]' ) ) {
|
||||
val = $( this ).is( ':checked' ) ? 1 : 0;
|
||||
}
|
||||
|
||||
data.push( {
|
||||
'name': $( this ).attr( 'name' ).replace( /^wpcf7-/, '' ).replace( /-/g, '_' ),
|
||||
'value': $( this ).val()
|
||||
'value': val
|
||||
} );
|
||||
} );
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ function wpcf7_enqueue_block_editor_assets() {
|
||||
'contact-form-7-block-editor',
|
||||
sprintf(
|
||||
'window.wpcf7 = {contactForms:%s};',
|
||||
json_encode( $contact_forms )
|
||||
wp_json_encode( $contact_forms )
|
||||
),
|
||||
'before'
|
||||
);
|
||||
|
||||
@@ -275,6 +275,17 @@ function wpcf7_sanitize_unit_tag( $tag ) {
|
||||
function wpcf7_antiscript_file_name( $filename ) {
|
||||
$filename = wp_basename( $filename );
|
||||
|
||||
// Apply part of protection logic from sanitize_file_name().
|
||||
$filename = str_replace(
|
||||
array(
|
||||
'?', '[', ']', '/', '\\', '=', '<', '>', ':', ';', ',', "'", '"',
|
||||
'&', '$', '#', '*', '(', ')', '|', '~', '`', '!', '{', '}',
|
||||
'%', '+', '’', '«', '»', '”', '“', chr( 0 )
|
||||
),
|
||||
'',
|
||||
$filename
|
||||
);
|
||||
|
||||
$filename = preg_replace( '/[\r\n\t -]+/', '-', $filename );
|
||||
$filename = preg_replace( '/[\pC\pZ]+/iu', '', $filename );
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ class WPCF7_SWV_FileRule extends WPCF7_SWV_Rule {
|
||||
$acceptable_filetypes = array();
|
||||
|
||||
foreach ( (array) $this->get_property( 'accept' ) as $accept ) {
|
||||
if ( false === strpos( $accept, '/' ) ) {
|
||||
if ( preg_match( '/^\.[a-z0-9]+$/i', $accept ) ) {
|
||||
$acceptable_filetypes[] = strtolower( $accept );
|
||||
} else {
|
||||
foreach ( wpcf7_convert_mime_to_ext( $accept ) as $ext ) {
|
||||
|
||||
@@ -247,7 +247,7 @@ class WPCF7_ConstantContact extends WPCF7_Service_OAuth2 {
|
||||
'Accept' => 'application/json',
|
||||
'Content-Type' => 'application/json; charset=utf-8',
|
||||
),
|
||||
'body' => json_encode( $properties ),
|
||||
'body' => wp_json_encode( $properties ),
|
||||
);
|
||||
|
||||
$response = $this->remote_request( $endpoint, $request );
|
||||
|
||||
@@ -336,7 +336,7 @@ trait WPCF7_Sendinblue_API {
|
||||
'Content-Type' => 'application/json; charset=utf-8',
|
||||
'API-Key' => $this->get_api_key(),
|
||||
),
|
||||
'body' => json_encode( $properties ),
|
||||
'body' => wp_json_encode( $properties ),
|
||||
);
|
||||
|
||||
$response = wp_remote_post( $endpoint, $request );
|
||||
@@ -364,7 +364,7 @@ trait WPCF7_Sendinblue_API {
|
||||
'Content-Type' => 'application/json; charset=utf-8',
|
||||
'API-Key' => $this->get_api_key(),
|
||||
),
|
||||
'body' => json_encode( $properties ),
|
||||
'body' => wp_json_encode( $properties ),
|
||||
);
|
||||
|
||||
$response = wp_remote_post( $endpoint, $request );
|
||||
|
||||
@@ -61,7 +61,7 @@ class WPCF7_Stripe_API {
|
||||
$headers = array(
|
||||
'Authorization' => sprintf( 'Bearer %s', $this->secret ),
|
||||
'Stripe-Version' => self::api_version,
|
||||
'X-Stripe-Client-User-Agent' => json_encode( $ua ),
|
||||
'X-Stripe-Client-User-Agent' => wp_json_encode( $ua ),
|
||||
'User-Agent' => sprintf(
|
||||
'%1$s/%2$s (%3$s)',
|
||||
self::app_name,
|
||||
|
||||
@@ -5,7 +5,7 @@ Tags: contact, form, contact form, feedback, email, ajax, captcha, akismet, mult
|
||||
Requires at least: 6.2
|
||||
Requires PHP: 7.4
|
||||
Tested up to: 6.4
|
||||
Stable tag: 5.8.3
|
||||
Stable tag: 5.8.5
|
||||
License: GPLv2 or later
|
||||
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
@@ -78,6 +78,14 @@ Do you have questions or issues with Contact Form 7? Use these support channels
|
||||
|
||||
For more information, see [Releases](https://contactform7.com/category/releases/).
|
||||
|
||||
= 5.8.5 =
|
||||
|
||||
[https://contactform7.com/contact-form-7-585/](https://contactform7.com/contact-form-7-585/)
|
||||
|
||||
= 5.8.4 =
|
||||
|
||||
[https://contactform7.com/contact-form-7-584/](https://contactform7.com/contact-form-7-584/)
|
||||
|
||||
= 5.8.3 =
|
||||
|
||||
[https://contactform7.com/contact-form-7-583/](https://contactform7.com/contact-form-7-583/)
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
* Author URI: https://ideasilo.wordpress.com/
|
||||
* License: GPL v2 or later
|
||||
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||
* Version: 5.8.3
|
||||
* Version: 5.8.5
|
||||
* Requires at least: 6.2
|
||||
* Requires PHP: 7.4
|
||||
*/
|
||||
|
||||
define( 'WPCF7_VERSION', '5.8.3' );
|
||||
define( 'WPCF7_VERSION', '5.8.5' );
|
||||
|
||||
define( 'WPCF7_REQUIRED_WP_VERSION', '6.2' );
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
.imagify-account,.imagify-account-link{padding-right:15px}.imagify-meteo-icon{display:inline-block;height:38px;vertical-align:middle;margin-right:10px}.imagify-user-plan{color:#40b1d0}.imagify-meteo-title.imagify-meteo-title{color:#fff;font-size:17px}.imagify-space-left>p{color:#fff}#wp-admin-bar-imagify-profile [class^=imagify-bar-]{position:relative;height:1.5em;width:100%;background:#60758d;color:#fff;font-size:10px}#wp-admin-bar-imagify-profile .imagify-progress{height:1.5em;font-size:1em}.imagify-progress{-webkit-transition:width .3s;-o-transition:width .3s;transition:width .3s}.imagify-bar-positive .imagify-progress{background:#8cc152}.imagify-bar-positive .imagify-barnb{color:#8cc152}.imagify-bar-negative .imagify-progress{background:#73818c}.imagify-bar-negative .imagify-barnb{color:#73818c}.imagify-bar-neutral .imagify-progress{background:#f5a623}.imagify-space-left .imagify-bar-negative .imagify-progress{background:#d0021b}#wpadminbar #wp-admin-bar-imagify-profile *{line-height:1.5;white-space:initial}#wpadminbar #wp-admin-bar-imagify .ab-submenu{padding-bottom:0}#wpadminbar #wp-admin-bar-imagify-profile .ab-item{height:auto;padding:0 13px}#wpadminbar #wp-admin-bar-imagify-profile{min-width:200px;padding:15px 0 10px;margin-top:.7em;background:#222}#wp-admin-bar-imagify .dashicons{font-family:dashicons;font-size:18px;vertical-align:middle;margin:0 5px 0 0}#wp-admin-bar-imagify .button-text{display:inline-block;vertical-align:middle}#wp-admin-bar-imagify .imagify-abq-row{display:table;width:100%}#wp-admin-bar-imagify .imagify-abq-row+.imagify-abq-row{margin-top:.75em}#wp-admin-bar-imagify .imagify-abq-row>*{display:table-cell}#wp-admin-bar-imagify-profile .imagify-meteo-icon{padding-right:7px}#wp-admin-bar-imagify-profile .imagify-meteo-icon img{width:37px}#wp-admin-bar-imagify-profile .imagify-meteo-title{font-size:17px}#wp-admin-bar-imagify-profile .imagify-meteo-subs{color:#72889f}#wpadminbar #wp-admin-bar-imagify-profile strong{font-weight:700}#wpadminbar #wp-admin-bar-imagify-profile .imagify-user-plan,#wpadminbar #wp-admin-bar-imagify-profile a{padding:0;color:#40b1d0}#wpadminbar #wp-admin-bar-imagify-profile .imagify-account-link{display:table}#wpadminbar #wp-admin-bar-imagify-profile .imagify-account-link>*{display:table-cell}#wpadminbar #wp-admin-bar-imagify-profile .imagify-space-left{max-width:210px;min-width:210px;width:210px}#wpadminbar #wp-admin-bar-imagify-profile .imagify-space-left p{font-size:12px}#wp-admin-bar-imagify-profile .imagify-error,#wp-admin-bar-imagify-profile .imagify-warning{padding:10px;margin:0 -13px -13px}#wp-admin-bar-imagify-profile .imagify-error p+p,#wp-admin-bar-imagify-profile .imagify-warning p+p{margin-top:.5em}#wp-admin-bar-imagify-profile .imagify-error p+p+p,#wp-admin-bar-imagify-profile .imagify-warning p+p+p{margin-top:1em}#wpadminbar #wp-admin-bar-imagify-profile .imagify-btn-ghost{display:inline-block;height:auto;padding:7px 10px;border:1px solid #fff;text-align:center;background:0 0;color:#fff;border-radius:3px;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}#wpadminbar #wp-admin-bar-imagify-profile .imagify-btn-ghost:focus,#wpadminbar #wp-admin-bar-imagify-profile .imagify-btn-ghost:hover{background:#fff;color:#888}#wpadminbar .imagify-warning *{background:#f5a623;color:#fff;text-shadow:0 0 2px rgba(0,0,0,.2)}
|
||||
.imagify-account,.imagify-account-link{padding-right:15px}.imagify-meteo-icon{display:inline-block;height:38px;vertical-align:middle;margin-right:10px}.imagify-user-plan{color:#40b1d0}.imagify-meteo-title.imagify-meteo-title{color:#fff;font-size:17px}.imagify-space-left>p{color:#fff}#wp-admin-bar-imagify-profile [class^=imagify-bar-]{position:relative;height:1.5em;width:100%;background:#60758d;color:#fff;font-size:10px}#wp-admin-bar-imagify-profile .imagify-progress{height:1.5em;font-size:1em}.imagify-progress{-webkit-transition:width .3s;-o-transition:width .3s;transition:width .3s}.imagify-bar-positive .imagify-progress{background:#8cc152}.imagify-bar-positive .imagify-barnb{color:#8cc152}.imagify-bar-negative .imagify-progress{background:#73818c}.imagify-bar-negative .imagify-barnb{color:#73818c}.imagify-bar-neutral .imagify-progress{background:#f5a623}.imagify-space-left .imagify-bar-negative .imagify-progress{background:#d0021b}#wpadminbar #wp-admin-bar-imagify-profile *{line-height:1.5;white-space:initial}#wpadminbar #wp-admin-bar-imagify .ab-submenu{padding-bottom:0}#wpadminbar #wp-admin-bar-imagify-profile .ab-item{height:auto;padding:0 13px}#wpadminbar #wp-admin-bar-imagify-profile{min-width:200px;padding:15px 0 10px;margin-top:.7em;background:#222}#wp-admin-bar-imagify .dashicons{font-family:dashicons;font-size:18px;vertical-align:middle;margin:0 5px 0 0}#wp-admin-bar-imagify .button-text{display:inline-block;vertical-align:middle}#wp-admin-bar-imagify .imagify-abq-row{display:table;width:100%}#wp-admin-bar-imagify .imagify-abq-row+.imagify-abq-row{margin-top:.75em}#wp-admin-bar-imagify .imagify-abq-row>*{display:table-cell}#wp-admin-bar-imagify-profile .imagify-meteo-icon{padding-right:7px}#wp-admin-bar-imagify-profile .imagify-meteo-icon img{width:37px}#wp-admin-bar-imagify-profile .imagify-meteo-title{font-size:17px}#wp-admin-bar-imagify-profile .imagify-meteo-subs{color:#72889f}#wpadminbar #wp-admin-bar-imagify-profile strong{font-weight:700}#wpadminbar #wp-admin-bar-imagify-profile .imagify-user-plan,#wpadminbar #wp-admin-bar-imagify-profile a{padding:0;color:#40b1d0}#wpadminbar #wp-admin-bar-imagify-profile .imagify-account-link{display:table}#wpadminbar #wp-admin-bar-imagify-profile .imagify-account-link>*{display:table-cell}#wpadminbar #wp-admin-bar-imagify-profile .imagify-space-left{max-width:210px;min-width:210px;width:210px}#wpadminbar #wp-admin-bar-imagify-profile .imagify-space-left p{font-size:12px}#wp-admin-bar-imagify-profile .imagify-error,#wp-admin-bar-imagify-profile .imagify-warning{padding:10px;margin:0 -13px -13px}#wp-admin-bar-imagify-profile .imagify-error p+p,#wp-admin-bar-imagify-profile .imagify-warning p+p{margin-top:.5em}#wp-admin-bar-imagify-profile .imagify-error p+p+p,#wp-admin-bar-imagify-profile .imagify-warning p+p+p{margin-top:1em}#wpadminbar #wp-admin-bar-imagify-profile .imagify-btn-ghost{display:inline-block;height:auto;padding:7px 10px;border:1px solid #fff;text-align:center;background:0 0;color:#fff;border-radius:3px;-webkit-transition:all .275s;-o-transition:all .275s;transition:all .275s}#wpadminbar #wp-admin-bar-imagify-profile .imagify-btn-ghost:focus,#wpadminbar #wp-admin-bar-imagify-profile .imagify-btn-ghost:hover{background:#fff;color:#888}#wpadminbar .imagify-warning *{background:#f5a623;color:#fff;text-shadow:0 0 2px rgba(0,0,0,.2)}#wp-admin-bar-imagify-profile .imagify-upsell-admin-bar{position:relative;background:#c51161;margin:10px -13px -10px -13px;padding:20px}#wp-admin-bar-imagify-profile .imagify-upsell-admin-bar p{color:#fff}#wp-admin-bar-imagify-profile a.imagify-upsell-admin-bar-button{display:block;height:auto!important;border:1px solid #fff;border-radius:5px;color:#fff!important;padding:5px 10px!important;text-align:center;text-decoration:none;margin-top:10px}#wpadminbar #wp-admin-bar-imagify-profile a.imagify-upsell-dismiss{display:inline!important;height:auto!important}#wpadminbar #wp-admin-bar-imagify-profile .imagify-upsell-dismiss::before{position:absolute;top:5px;right:10px;content:"\2715";color:#fff}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
!function(n){n(".imagify-notice-dismiss").on("click.imagify",function(i){var e=n(this),t=e.parents(".imagify-welcome, .imagify-notice, .imagify-rkt-notice"),e=e.attr("href");i.preventDefault(),t.fadeTo(100,0,function(){n(this).slideUp(100,function(){n(this).remove()})}),n.get(e.replace("admin-post.php","admin-ajax.php"))})}(jQuery,(document,window)),function(n,a){n("#imagify-signup").on("click.imagify",function(i){i.preventDefault(),swal({title:imagifyNotices.labels.signupTitle,html:imagifyNotices.labels.signupText,confirmButtonText:imagifyNotices.labels.signupConfirmButtonText,input:"email",padding:0,showLoaderOnConfirm:!0,customClass:"imagify-sweet-alert imagify-sweet-alert-signup",inputValidator:function(t){return new Promise(function(i,e){""!==n.trim(t)&&t?i():e(imagifyNotices.labels.signupErrorEmptyEmail)})},preConfirm:function(i){return new Promise(function(e,t){setTimeout(function(){n.get(ajaxurl+a.imagify.concat+"action=imagify_signup&email="+i+"&imagifysignupnonce="+n("#imagifysignupnonce").val()).done(function(i){i.success?e():t(i.data)})},2e3)})}}).then(function(){swal({title:imagifyNotices.labels.signupSuccessTitle,html:imagifyNotices.labels.signupSuccessText,type:"success",padding:0,customClass:"imagify-sweet-alert"})})}),n("#imagify-save-api-key").on("click.imagify",function(i){i.preventDefault(),swal({title:imagifyNotices.labels.saveApiKeyTitle,html:imagifyNotices.labels.saveApiKeyText,confirmButtonText:imagifyNotices.labels.saveApiKeyConfirmButtonText,input:"text",padding:0,showLoaderOnConfirm:!0,customClass:"imagify-sweet-alert imagify-sweet-alert-signup",inputValidator:function(t){return new Promise(function(i,e){""!==n.trim(t)&&t?i():e(imagifyNotices.labels.ApiKeyErrorEmpty)})},preConfirm:function(i){return new Promise(function(e,t){n.get(ajaxurl+a.imagify.concat+"action=imagify_check_api_key_validity&api_key="+i+"&imagifycheckapikeynonce="+n("#imagifycheckapikeynonce").val()).done(function(i){i.success?e():t(i.data)})})}}).then(function(){swal({title:imagifyNotices.labels.ApiKeyCheckSuccessTitle,html:imagifyNotices.labels.ApiKeyCheckSuccessText,type:"success",padding:0,customClass:"imagify-sweet-alert"})})})}(jQuery,(document,window));
|
||||
!function(n){n(".imagify-notice-dismiss").on("click.imagify",function(i){var e=n(this),t=e.parents(".imagify-welcome, .imagify-notice, .imagify-rkt-notice, .imagify-upsell, .imagify-upsell-admin-bar"),e=e.attr("href");i.preventDefault(),t.fadeTo(100,0,function(){n(this).slideUp(100,function(){n(this).remove()})}),n.get(e.replace("admin-post.php","admin-ajax.php"))})}(jQuery,(document,window)),function(n,a){n("#imagify-signup").on("click.imagify",function(i){i.preventDefault(),swal({title:imagifyNotices.labels.signupTitle,html:imagifyNotices.labels.signupText,confirmButtonText:imagifyNotices.labels.signupConfirmButtonText,input:"email",padding:0,showLoaderOnConfirm:!0,customClass:"imagify-sweet-alert imagify-sweet-alert-signup",inputValidator:function(t){return new Promise(function(i,e){""!==n.trim(t)&&t?i():e(imagifyNotices.labels.signupErrorEmptyEmail)})},preConfirm:function(i){return new Promise(function(e,t){setTimeout(function(){n.get(ajaxurl+a.imagify.concat+"action=imagify_signup&email="+i+"&imagifysignupnonce="+n("#imagifysignupnonce").val()).done(function(i){i.success?e():t(i.data)})},2e3)})}}).then(function(){swal({title:imagifyNotices.labels.signupSuccessTitle,html:imagifyNotices.labels.signupSuccessText,type:"success",padding:0,customClass:"imagify-sweet-alert"})})}),n("#imagify-save-api-key").on("click.imagify",function(i){i.preventDefault(),swal({title:imagifyNotices.labels.saveApiKeyTitle,html:imagifyNotices.labels.saveApiKeyText,confirmButtonText:imagifyNotices.labels.saveApiKeyConfirmButtonText,input:"text",padding:0,showLoaderOnConfirm:!0,customClass:"imagify-sweet-alert imagify-sweet-alert-signup",inputValidator:function(t){return new Promise(function(i,e){""!==n.trim(t)&&t?i():e(imagifyNotices.labels.ApiKeyErrorEmpty)})},preConfirm:function(i){return new Promise(function(e,t){n.get(ajaxurl+a.imagify.concat+"action=imagify_check_api_key_validity&api_key="+i+"&imagifycheckapikeynonce="+n("#imagifycheckapikeynonce").val()).done(function(i){i.success?e():t(i.data)})})}}).then(function(){swal({title:imagifyNotices.labels.ApiKeyCheckSuccessTitle,html:imagifyNotices.labels.ApiKeyCheckSuccessText,type:"success",padding:0,customClass:"imagify-sweet-alert"})})})}(jQuery,(document,window));
|
||||
@@ -3,7 +3,7 @@
|
||||
* Plugin Name: Imagify
|
||||
* Plugin URI: https://wordpress.org/plugins/imagify/
|
||||
* Description: Dramatically reduce image file sizes without losing quality, make your website load faster, boost your SEO and save money on your bandwidth using Imagify, the new most advanced image optimization tool.
|
||||
* Version: 2.1.3
|
||||
* Version: 2.1.3.1
|
||||
* Requires at least: 5.3
|
||||
* Requires PHP: 7.0
|
||||
* Author: Imagify – Optimize Images & Convert WebP
|
||||
@@ -19,7 +19,7 @@
|
||||
defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
|
||||
|
||||
// Imagify defines.
|
||||
define( 'IMAGIFY_VERSION', '2.1.3' );
|
||||
define( 'IMAGIFY_VERSION', '2.1.3.1' );
|
||||
define( 'IMAGIFY_SLUG', 'imagify' );
|
||||
define( 'IMAGIFY_FILE', __FILE__ );
|
||||
define( 'IMAGIFY_PATH', realpath( plugin_dir_path( IMAGIFY_FILE ) ) . '/' );
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
=== Imagify – Optimize Images & Convert WebP | Compress Images Easily ===
|
||||
Contributors: wp_rocket, imagify
|
||||
Tags: optimize images, convert webp, webp converter, image optimization, compress images, image compressor, resize images, reduce image size, performance, image optimizer, core web vitals, best image optimization plugin
|
||||
Tested up to: 6.3
|
||||
Stable tag: 2.1.3
|
||||
Tested up to: 6.4
|
||||
Stable tag: 2.1.3.1
|
||||
License: GPLv2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
@@ -258,6 +258,9 @@ You can report any security bugs found in the source code of the site-reviews pl
|
||||
4. Other Media Page
|
||||
|
||||
== Changelog ==
|
||||
= 2.1.3.1 =
|
||||
- Bugfix: missing styling on some banners when using minified versions of the CSS files (#765)
|
||||
|
||||
= 2.1.3 =
|
||||
- Enhancement: Update chart.js (#742)
|
||||
- Enhancement: Improve messaging around WebP images when they are larger than the original (#751)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php return array(
|
||||
'root' => array(
|
||||
'name' => 'wp-media/imagify-plugin',
|
||||
'pretty_version' => 'v2.1.3',
|
||||
'version' => '2.1.3.0',
|
||||
'reference' => '58a54d5f7381cc9884874f51021a0c791965fc05',
|
||||
'pretty_version' => 'v2.1.3.1',
|
||||
'version' => '2.1.3.1',
|
||||
'reference' => '82a34afe494abd2ba229285f871ab23239428a20',
|
||||
'type' => 'wordpress-plugin',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
@@ -29,9 +29,9 @@
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'wp-media/imagify-plugin' => array(
|
||||
'pretty_version' => 'v2.1.3',
|
||||
'version' => '2.1.3.0',
|
||||
'reference' => '58a54d5f7381cc9884874f51021a0c791965fc05',
|
||||
'pretty_version' => 'v2.1.3.1',
|
||||
'version' => '2.1.3.1',
|
||||
'reference' => '82a34afe494abd2ba229285f871ab23239428a20',
|
||||
'type' => 'wordpress-plugin',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: fabrizio pera
|
||||
* Date: 22/11/16
|
||||
* Time: 10:48
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die( '-1' );
|
||||
}
|
||||
@@ -24,13 +19,8 @@ if(!class_exists('IperCampaignController')){
|
||||
const kCOOKIE_ID_FIVE9 = "SESSfive9";
|
||||
const kCOOKIE_WEB_PROMOTION_TEXT = "SESSpromotion";
|
||||
const kCOOKIE_PHONE = "SESScampaignphone";
|
||||
const KCOOKIE_ControlPhone = "SESScontrolphone";
|
||||
const KCOOKIE_CanaryPhone = "SESScanaryphone";
|
||||
const kCOOKIE_EXPIRE = 15552000; // 6 months (3600 * 24 * 30 * 6)
|
||||
const KCOOKIE_WEB_TOP_BAR = "SESStopoffer";
|
||||
const KCOOKIE_Google_KW = "SESSgooglekw";
|
||||
const KCOOKIE_AB_Test = "SESSabtest";
|
||||
const KCOOKIE_ConfirmationPageText = "SESSconfirmationpagetext";
|
||||
|
||||
|
||||
protected static $instance;
|
||||
public $testVar;
|
||||
@@ -106,7 +96,6 @@ if(!class_exists('IperCampaignController')){
|
||||
return $phonenumber;
|
||||
}
|
||||
|
||||
|
||||
public static function getCampaignID(){
|
||||
if(!empty($_COOKIE) && !empty($_COOKIE[self::kCOOKIE_ID])){
|
||||
return $_COOKIE[self::kCOOKIE_ID];
|
||||
@@ -126,48 +115,8 @@ if(!class_exists('IperCampaignController')){
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static function getGoogle_KW(){
|
||||
if(!empty($_COOKIE) && !empty($_COOKIE[self::kCOOKIE_Google_KW])){
|
||||
return $_COOKIE[self::KCOOKIE_Google_KW];
|
||||
}
|
||||
if(!empty($_SESSION[self::KCOOKIE_Google_KW])){
|
||||
return $_SESSION[self::KCOOKIE_Google_KW];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function getAB_Test(){
|
||||
if(!empty($_COOKIE) && !empty($_COOKIE[self::KCOOKIE_AB_Test])){
|
||||
return $_COOKIE[self::KCOOKIE_AB_Test];
|
||||
}
|
||||
if(!empty($_SESSION[self::KCOOKIE_AB_Test])){
|
||||
return $_SESSION[self::KCOOKIE_AB_Test];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function getCanaryPhone(){
|
||||
if(!empty($_COOKIE) && !empty($_COOKIE[self::KCOOKIE_CanaryPhone])){
|
||||
return $_COOKIE[self::KCOOKIE_CanaryPhone];
|
||||
}
|
||||
if(!empty($_SESSION[self::KCOOKIE_CanaryPhone])){
|
||||
return $_SESSION[self::KCOOKIE_CanaryPhone];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function getControlPhone(){
|
||||
if(!empty($_COOKIE) && !empty($_COOKIE[self::KCOOKIE_ControlPhone])){
|
||||
return $_COOKIE[self::KCOOKIE_ControlPhone];
|
||||
}
|
||||
if(!empty($_SESSION[self::KCOOKIE_ControlPhone])){
|
||||
return $_SESSION[self::KCOOKIE_ControlPhone];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static function getWebPromotionText(){
|
||||
public static function getWebPromotionText(){
|
||||
if(!empty($_COOKIE) && !empty($_COOKIE[self::kCOOKIE_WEB_PROMOTION_TEXT])){
|
||||
return $_COOKIE[self::kCOOKIE_WEB_PROMOTION_TEXT];
|
||||
}
|
||||
@@ -176,25 +125,7 @@ if(!class_exists('IperCampaignController')){
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static function getConfirmationPageText(){
|
||||
if(!empty($_COOKIE) && !empty($_COOKIE[self::KCOOKIE_ConfirmationPageText])){
|
||||
return $_COOKIE[self::KCOOKIE_ConfirmationPageText];
|
||||
}
|
||||
if(!empty($_SESSION[self::KCOOKIE_ConfirmationPageText])){
|
||||
return $_SESSION[self::KCOOKIE_ConfirmationPageText];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function getCampaignSO(){
|
||||
if(!empty($_COOKIE) && !empty($_COOKIE[self::KCOOKIE_WEB_TOP_BAR])){
|
||||
return $_COOKIE[self::KCOOKIE_WEB_TOP_BAR];
|
||||
}
|
||||
if(!empty($_SESSION[self::KCOOKIE_WEB_TOP_BAR])){
|
||||
return $_SESSION[self::KCOOKIE_WEB_TOP_BAR];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public function get_phone_number(){
|
||||
|
||||
$phoneNumber = get_option('cta_tel',true);
|
||||
@@ -239,32 +170,20 @@ if(!class_exists('IperCampaignController')){
|
||||
return false;
|
||||
}
|
||||
|
||||
public function setCampaign($id="",$phone="",$id_five_9="",$WebPromotionText="",$WebTopBarSpecialOffer="",$Google_KW, $ABTest, $ConfirmationPageText="",$CanaryPhone="",$ControlPhone=""){
|
||||
public function setCampaign($id="",$phone="",$id_five_9="",$WebPromotionText=""){
|
||||
|
||||
setcookie(self::kCOOKIE_ID, $id, 0,'/');
|
||||
setcookie(self::kCOOKIE_PHONE, $phone, 0,'/');
|
||||
setcookie(self::KCOOKIE_CanaryPhone, $CanaryPhone , 0,'/');
|
||||
setcookie(self::KCOOKIE_ControlPhone, $ControlPhone , 0,'/');
|
||||
setcookie(self::kCOOKIE_ID_FIVE9, $id_five_9, 0,'/');
|
||||
setcookie(self::kCOOKIE_WEB_PROMOTION_TEXT, $WebPromotionText , 0,'/');
|
||||
setcookie(self::KCOOKIE_WEB_TOP_BAR, $WebTopBarSpecialOffer , 0,'/');
|
||||
setcookie(self::KCOOKIE_Google_KW, $Google_KW , 0,'/');
|
||||
setcookie(self::KCOOKIE_AB_Test, $ABTest , 0,'/');
|
||||
setcookie(self::KCOOKIE_ConfirmationPageText, $ConfirmationPageText , 0,'/');
|
||||
if(!session_id()){
|
||||
session_start();
|
||||
}
|
||||
|
||||
$_SESSION[self::kCOOKIE_ID]=$id;
|
||||
$_SESSION[self::kCOOKIE_PHONE]=$phone;
|
||||
$_SESSION[self::KCOOKIE_CanaryPhone]=$CanaryPhone;
|
||||
$_SESSION[self::KCOOKIE_ControlPhone]=$ControlPhone;
|
||||
$_SESSION[self::kCOOKIE_ID_FIVE9]=$id_five_9;
|
||||
$_SESSION[self::kCOOKIE_WEB_PROMOTION_TEXT]=$WebPromotionText;
|
||||
$_SESSION[self::KCOOKIE_WEB_TOP_BAR]=$WebTopBarSpecialOffer;
|
||||
$_SESSION[self::KCOOKIE_Google_KW]=$Google_KW;
|
||||
$_SESSION[self::KCOOKIE_AB_Test]=$ABTest;
|
||||
$_SESSION[self::KCOOKIE_ConfirmationPageText]=$ConfirmationPageText;
|
||||
}
|
||||
|
||||
public function activate(){
|
||||
@@ -300,19 +219,12 @@ if(!class_exists('IperCampaignController')){
|
||||
$CampaignID = $single->CampaignID;
|
||||
$StartDate = $single->StartDate;
|
||||
$PhoneNumber = $single->PhoneNumber;
|
||||
$CanaryPhone = $single->CanaryPhoneNumber;
|
||||
$ControlPhone = $single->ControlPhoneNumber;
|
||||
$LandingURL = $single->LandingURL;
|
||||
$FriendlyURL = $single->FriendlyURL;
|
||||
$EndDate = $single->EndDate;
|
||||
$CampaignName = $single->CampaignName;
|
||||
$Five9CallbackCampaign = $single->Five9CallbackCampaign;
|
||||
$WebPromotionText = $single->WebPromotionText;//fill campaign field
|
||||
$WebTopBarSpecialOffer = $single->WebTopBarSpecialOffer;
|
||||
$Google_KW = $single->GoogleKW;
|
||||
$ABTest = $single->ABTest;
|
||||
$ConfirmationPageText = $single->ConfirmationPageText;
|
||||
|
||||
|
||||
$postname = str_replace(get_bloginfo('wpurl'),"",$FriendlyURL);
|
||||
|
||||
@@ -343,19 +255,13 @@ if(!class_exists('IperCampaignController')){
|
||||
IperCptCampaign::kMETA_CAMPAIGN_ID => $CampaignID,
|
||||
IperCptCampaign::kMETA_CAMPAIGN_START_DATE => $StartDate,
|
||||
IperCptCampaign::kMETA_CAMPAIGN_PHONE => $PhoneNumber,
|
||||
IperCptCampaign::KMETA_CanaryPhone => $CanaryPhone,//pull text from sales force
|
||||
IperCptCampaign::KMETA_ControlPhone => $ControlPhone,//pull text from sales force
|
||||
IperCptCampaign::kMETA_CAMPAIGN_LANDING_URL => $LandingURL,
|
||||
IperCptCampaign::kMETA_CAMPAIGN_SHORT_URL => $FriendlyURL,
|
||||
IperCptCampaign::kMETA_CAMPAIGN_END_DATE => $EndDate,
|
||||
IperCptCampaign::kMETA_CAMPAIGN_NAME => $CampaignName,
|
||||
IperCptCampaign::kMETA_FIVE9 => $Five9CallbackCampaign,
|
||||
IperCptCampaign::kMETA_WEB_PROMOTION_TEXT => $WebPromotionText,//pull text from sales force
|
||||
IperCptCampaign::KMETA_WEB_TOP_BAR => $WebTopBarSpecialOffer,//pull text from sales force
|
||||
IperCptCampaign::KMETA_Google_KW => $Google_KW,//pull text from sales force
|
||||
IperCptCampaign::KMETA_AB_Test => $ABTest,//pull text from sales force
|
||||
IperCptCampaign::KMETA_ConfirmationPageText => $ConfirmationPageText
|
||||
)
|
||||
IperCptCampaign::kMETA_WEB_PROMOTION_TEXT => $WebPromotionText,
|
||||
)
|
||||
);
|
||||
|
||||
wp_update_post($my_post);
|
||||
@@ -375,17 +281,13 @@ if(!class_exists('IperCampaignController')){
|
||||
IperCptCampaign::kMETA_CAMPAIGN_ID => $CampaignID,
|
||||
IperCptCampaign::kMETA_CAMPAIGN_START_DATE => $StartDate,
|
||||
IperCptCampaign::kMETA_CAMPAIGN_PHONE => $PhoneNumber,
|
||||
IperCptCampaign::KMETA_CanaryPhone => $CanaryPhone,//pull text from sales force
|
||||
IperCptCampaign::KMETA_ControlPhone => $ControlPhone,//pull text from sales force
|
||||
IperCptCampaign::kMETA_CAMPAIGN_LANDING_URL => $LandingURL,
|
||||
IperCptCampaign::kMETA_CAMPAIGN_SHORT_URL => $FriendlyURL,
|
||||
IperCptCampaign::kMETA_CAMPAIGN_END_DATE => $EndDate,
|
||||
IperCptCampaign::kMETA_CAMPAIGN_NAME => $CampaignName,
|
||||
IperCptCampaign::kMETA_FIVE9 => $Five9CallbackCampaign,
|
||||
IperCptCampaign::kMETA_WEB_PROMOTION_TEXT => $WebPromotionText,//pull text from sales force
|
||||
IperCptCampaign::KMETA_AB_Test => $ABTest,//pull text from sales force
|
||||
IperCptCampaign::KMETA_WEB_TOP_BAR => $WebTopBarSpecialOffer,//pull text from sales force
|
||||
IperCptCampaign::KMETA_ConfirmationPageText => $ConfirmationPageText//pull text from sales force
|
||||
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: fabrizio pera
|
||||
* Date: 22/11/16
|
||||
* Time: 10:52
|
||||
*/
|
||||
|
||||
if(!class_exists('IperCptCampaign')) {
|
||||
|
||||
@@ -17,48 +11,36 @@ if(!class_exists('IperCptCampaign')) {
|
||||
const DESCRIPTION = "Post type for Campaign";
|
||||
const QUERY_VAR = "campaign";
|
||||
|
||||
//meta key
|
||||
|
||||
const kMETA_CAMPAIGN_ID = "campaign_id";
|
||||
const kMETA_CAMPAIGN_START_DATE = "campaign_start_date";
|
||||
const kMETA_CAMPAIGN_END_DATE = "campaign_end_date";
|
||||
const kMETA_CAMPAIGN_PHONE = "campaign_phone_number";
|
||||
const KMETA_ControlPhone = "ControlPhoneNumber";
|
||||
const KMETA_CanaryPhone = "CanaryPhoneNumber";
|
||||
const kMETA_CAMPAIGN_SHORT_URL = "campaign_short_url";
|
||||
const kMETA_CAMPAIGN_LANDING_URL = "campaign_landing_url";
|
||||
const kMETA_CAMPAIGN_NAME = "campaign_name";
|
||||
const kMETA_DELETE = "to_delete";
|
||||
const kMETA_FIVE9 = "Five9CallbackCampaign";
|
||||
const kMETA_WEB_PROMOTION_TEXT = "WebPromotionText";//Name text for campaign field
|
||||
const KMETA_WEB_TOP_BAR = "WebTopBarSpecialOffer";
|
||||
const KMETA_Google_KW = "GoogleKW";
|
||||
const KMETA_AB_Test = "ABTest";
|
||||
const KMETA_ConfirmationPageText = "ConfirmationPageText";
|
||||
|
||||
|
||||
|
||||
//meta array
|
||||
|
||||
private $_meta = array(
|
||||
array('name'=>self::kMETA_CAMPAIGN_ID,'type'=>'input-text','title'=>'Campaign ID'),
|
||||
array('name'=>self::kMETA_CAMPAIGN_NAME,'type'=>'input-text','title'=>'Campaign name'),
|
||||
array('name'=>self::kMETA_CAMPAIGN_START_DATE,'type'=>'input-date','title'=>'Start date'),
|
||||
array('name'=>self::kMETA_CAMPAIGN_END_DATE,'type'=>'input-date','title'=>'End date'),
|
||||
array('name'=>self::kMETA_CAMPAIGN_PHONE,'type'=>'input-text','title'=>'Phone number'),
|
||||
array('name'=>self::KMETA_ControlPhone,'type'=>'input-text','title'=>'Control Phone number'),
|
||||
array('name'=>self::KMETA_CanaryPhone,'type'=>'input-text','title'=>'Canary 800 Number'),
|
||||
array('name'=>self::kMETA_CAMPAIGN_SHORT_URL,'type'=>'input-text','title'=>'Friendly URL'),
|
||||
array('name'=>self::kMETA_CAMPAIGN_LANDING_URL,'type'=>'input-text','title'=>'Landing URL'),
|
||||
array('name'=>self::kMETA_FIVE9,'type'=>'input-text','title'=>'Five9 Callback Campaign'),
|
||||
array('name'=>self::kMETA_WEB_PROMOTION_TEXT,'type'=>'input-text','title'=>'Web Promotion Text'),//label name for campaign field
|
||||
array('name'=>self::KMETA_WEB_TOP_BAR,'type'=>'input-text','title'=>'Web Top Bar Special Offer'),
|
||||
array('name'=>self::KMETA_Google_KW,'type'=>'input-text','title'=>'Google KW'),
|
||||
array('name'=>self::KMETA_AB_Test,'type'=>'input-text','title'=>'A/B Test'),
|
||||
array('name'=>self::KMETA_ConfirmationPageText,'type'=>'input-text','title'=>'Confirmation Page Text')
|
||||
array('name'=>self::kMETA_WEB_PROMOTION_TEXT,'type'=>'input-text','title'=>'Web Promotion Text'),
|
||||
);
|
||||
|
||||
public function __construct(){
|
||||
add_action('init', array(&$this, 'init'));
|
||||
add_action('admin_init', array(&$this, 'admin_init'));
|
||||
//add_action('admin_print_scripts', array(&$this,'load_custom_wp_admin_script') );
|
||||
|
||||
add_filter('single_template',array(&$this,'single_template'));
|
||||
}
|
||||
|
||||
|
||||
@@ -6,17 +6,11 @@ $campaignTitle = get_the_title();
|
||||
|
||||
$campaignID = get_post_meta(get_the_ID(),IperCptCampaign::kMETA_CAMPAIGN_ID,true);
|
||||
$campaignPhone = get_post_meta(get_the_ID(),IperCptCampaign::kMETA_CAMPAIGN_PHONE,true);
|
||||
$controlPhone = get_post_meta(get_the_ID(),IperCptCampaign::KMETA_ControlPhone,true);
|
||||
$CanaryPhone = get_post_meta(get_the_ID(),IperCptCampaign::KMETA_CanaryPhone,true);
|
||||
$campaignStart = get_post_meta(get_the_ID(),IperCptCampaign::kMETA_CAMPAIGN_START_DATE,true);
|
||||
$campaignEnd = get_post_meta(get_the_ID(),IperCptCampaign::kMETA_CAMPAIGN_END_DATE,true);
|
||||
$campaignLink = get_post_meta(get_the_ID(),IperCptCampaign::kMETA_CAMPAIGN_LANDING_URL,true);
|
||||
$campaignFive9CallbackCampaign = get_post_meta(get_the_ID(),IperCptCampaign::kMETA_FIVE9,true);
|
||||
$WebPromotionText = get_post_meta(get_the_ID(),IperCptCampaign::kMETA_WEB_PROMOTION_TEXT,true);
|
||||
$WebTopBarSpecialOffer = get_post_meta(get_the_ID(),IperCptCampaign::KMETA_WEB_TOP_BAR,true);
|
||||
$Google_KW = get_post_meta(get_the_ID(),IperCptCampaign::KMETA_Google_KW,true);
|
||||
$ABTest = get_post_meta(get_the_ID(),IperCptCampaign::KMETA_AB_Test,true);
|
||||
$ConfirmationPageText = get_post_meta(get_the_ID(),IperCptCampaign::KMETA_ConfirmationPageText,true);
|
||||
|
||||
$campaignStart.=" 00:00:00";
|
||||
$campaignEnd.=" 23:59:59";
|
||||
@@ -25,10 +19,8 @@ $campaignStart = strtotime($campaignStart);
|
||||
$campaignEnd = strtotime($campaignEnd);
|
||||
|
||||
if($now>=$campaignStart && $now<=$campaignEnd){
|
||||
|
||||
//campaign active
|
||||
$controller = IperCampaignController::instance();
|
||||
$controller->setCampaign($campaignID,$campaignPhone,$campaignFive9CallbackCampaign,$WebPromotionText,$WebTopBarSpecialOffer,$Google_KW,$ABTest,$ConfirmationPageText,$CanaryPhone,$controlPhone);
|
||||
$controller->setCampaign($campaignID,$campaignPhone,$campaignFive9CallbackCampaign,$WebPromotionText);
|
||||
|
||||
}else{
|
||||
//campaign expired or not yet started
|
||||
@@ -43,12 +35,6 @@ $myurl = get_option('siteurl');
|
||||
$campaignurl = (empty($campaignLink)) ? get_home_url() : $campaignLink;
|
||||
|
||||
$utm_campaign = $_GET['dynamic_id'];
|
||||
/* For testing
|
||||
ob_flush();
|
||||
ob_start();
|
||||
var_dump($permalink);
|
||||
file_put_contents("dumps.txt", ob_get_flush());
|
||||
*/
|
||||
|
||||
switch ($utm_campaign) {
|
||||
case "landline" :
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('wp-components', 'wp-compose', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-polyfill'), 'version' => 'b81b50e9375d8f85569a43863b885812');
|
||||
832
wp/wp-content/plugins/relevanssi-premium/build/index.js
Normal file
832
wp/wp-content/plugins/relevanssi-premium/build/index.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1576
wp/wp-content/plugins/relevanssi-premium/changelog.txt
Normal file
1576
wp/wp-content/plugins/relevanssi-premium/changelog.txt
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
{"translation-revision-date":"2023-04-23 03:33:05+0000","generator":"GlotPress\/4.0.0-alpha.3","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;","lang":"cs_CZ"},"Insights":["P\u0159ehledy"]}},"comment":{"reference":"index.js"}}
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
{"translation-revision-date":"2023-04-23 03:33:04+0000","generator":"GlotPress\/4.0.0-alpha.3","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=2; plural=n != 1;","lang":"de"},"Ignore post content in the indexing.":["Beitragsinhalt in der Indexierung ignorieren."],"Low-ranking search terms used to find this post:":["Niedrig rankende Suchbegriffe, um diesen Beitrag zu finden:"],"The most common search terms used to find this post:":["Die h\u00e4ufigsten Suchbegriffe, um diesen Beitrag zu finden:"],"Excluded posts for this post:":["Ausgeschlossene Beitr\u00e4ge f\u00fcr diesen Beitrag:"],"Related posts for this post:":["Verwandte Beitr\u00e4ge f\u00fcr diesen Beitrag:"],"Related posts":["Verwandte Beitr\u00e4ge"],"Exclusion":["Ausschluss"],"Pinning":["Anheften"],"Reason this post is not indexed:":["Grund, warum dieser Beitrag nicht indexiert ist:"],"MySQL columns:":["MySQL-Spalten:"],"Links to this post:":["Link zu diesem Beitrag:"],"Excerpt:":["Textauszug:"],"Custom fields:":["Individuelle Felder:"],"Comments:":["Kommentare:"],"Other taxonomies:":["Andere Taxonomien:"],"Tags:":["Schlagw\u00f6rter:"],"Categories:":["Kategorien:"],"Author:":["Autor:"],"Content:":["Inhalt:"],"Title:":["Titel:"],"use this":["dieses benutzen"],"not this":["nicht dieses"],"Insights":["Einsichten"],"A comma-separated list of post IDs to use as related posts for this post":["Eine kommagetrennte Liste von Beitrags-IDs, die als verwandte Beitr\u00e4ge f\u00fcr diesen Beitrag verwendet werden sollen"],"Don't show this as a related post for any post.":["Dies nicht als verwandten Beitrag f\u00fcr einen Beitrag anzeigen."],"Don't append the related posts to this page.":["Die verwandten Beitr\u00e4ge nicht an diese Seite anh\u00e4ngen."],"Exclude this post or page from the index.":["Diesen Beitrag oder diese Seite aus dem Index ausschlie\u00dfen."],"Pin this post for all searches it appears in.":["Diesen Beitrag f\u00fcr alle Suchanfragen anheften, in denen er erscheint."],"How Relevanssi sees this post":["Wie Relevanssi diesen Beitrag sieht"]}},"comment":{"reference":"index.js"}}
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
{"translation-revision-date":"2023-04-23 03:33:05+0000","generator":"GlotPress\/4.0.0-alpha.3","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=2; plural=n != 1;","lang":"es"},"Ignore post content in the indexing.":["Ignora el contenido de la entrada en la indexaci\u00f3n."],"Low-ranking search terms used to find this post:":["T\u00e9rminos de b\u00fasqueda de bajo rango utilizados para encontrar esta entrada:"],"The most common search terms used to find this post:":["T\u00e9rminos de b\u00fasqueda m\u00e1s comunes utilizados para encontrar esta entrada:"],"Excluded posts for this post:":["Entradas excluidas para esta entrada:"],"Related posts for this post:":["Entradas relacionadas para esta entrada:"],"Related posts":["Entradas relacionadas"],"Exclusion":["Exclusi\u00f3n"],"Pinning":["Marcado"],"Reason this post is not indexed:":["Raz\u00f3n por la que esta entrada no est\u00e1 indexada:"],"MySQL columns:":["Columnas de MySQL"],"Links to this post:":["Enlaces a esta entrada:"],"Excerpt:":["Extracto:"],"Custom fields:":["Campos personalizados:"],"Comments:":["Comentarios:"],"Other taxonomies:":["Otras taxonom\u00edas:"],"Tags:":["Etiquetas:"],"Categories:":["Categor\u00edas:"],"Author:":["Autor:"],"Content:":["Contenido:"],"Title:":["T\u00edtulo:"],"use this":["usar este"],"not this":["no \u00e9ste"],"Insights":["Insights"],"A comma-separated list of post IDs to use as related posts for this post":["Lista separada por comas de ID de entradas para utilizarlas como entradas relacionadas de esta entrada"],"Don't show this as a related post for any post.":["No mostrar \u00e9ste como entrada relacionada de ninguna entradas."],"Don't append the related posts to this page.":["No a\u00f1adir entradas relacionadas a esta p\u00e1gina."],"Exclude this post or page from the index.":["Excluir esta entrada o p\u00e1gina del \u00edndex."],"Pin this post for all searches it appears in.":["Marca esta entrada para todas las b\u00fasquedas en las que aparezca."],"How Relevanssi sees this post":["C\u00f3mo ve Relevanssi esta entrada"]}},"comment":{"reference":"index.js"}}
|
||||
@@ -0,0 +1,120 @@
|
||||
{
|
||||
"translation-revision-date": "",
|
||||
"generator": "WP-CLI\/2.6.0",
|
||||
"source": "index.js",
|
||||
"domain": "messages",
|
||||
"locale_data": {
|
||||
"messages": {
|
||||
"": {
|
||||
"domain": "messages",
|
||||
"lang": "fi",
|
||||
"plural-forms": "nplurals=2; plural=(n != 1);"
|
||||
},
|
||||
"not this": [
|
||||
"ei t\u00e4t\u00e4"
|
||||
],
|
||||
"use this": [
|
||||
"k\u00e4yt\u00e4 t\u00e4t\u00e4"
|
||||
],
|
||||
"How Relevanssi sees this post": [
|
||||
"Kuinka Relevanssi n\u00e4kee artikkelin"
|
||||
],
|
||||
"Title:": [
|
||||
"Otsikko:"
|
||||
],
|
||||
"Content:": [
|
||||
"Sis\u00e4lt\u00f6:"
|
||||
],
|
||||
"Author:": [
|
||||
"Tekij\u00e4:"
|
||||
],
|
||||
"Categories:": [
|
||||
"Aiheet:"
|
||||
],
|
||||
"Tags:": [
|
||||
"Avainsanat:"
|
||||
],
|
||||
"Other taxonomies:": [
|
||||
"Muut taksonomiat:"
|
||||
],
|
||||
"Comments:": [
|
||||
"Kommentit:"
|
||||
],
|
||||
"Custom fields:": [
|
||||
"Avainkent\u00e4t:"
|
||||
],
|
||||
"Excerpt:": [
|
||||
"Ote:"
|
||||
],
|
||||
"Links to this post:": [
|
||||
"Sis\u00e4iset linkit:"
|
||||
],
|
||||
"MySQL columns:": [
|
||||
"MySQL-sarakkeet:"
|
||||
],
|
||||
"Reason this post is not indexed:": [
|
||||
"Miksi t\u00e4t\u00e4 artikkelia ei ole indeksoitu:"
|
||||
],
|
||||
"Pinning": [
|
||||
"Artikkelin kiinnitt\u00e4minen"
|
||||
],
|
||||
"Pin this post for all searches it appears in.": [
|
||||
"Kiinnit\u00e4 t\u00e4m\u00e4 artikkeli k\u00e4rkeen kaikissa hauissa, joissa se esiintyy."
|
||||
],
|
||||
"A comma-separated list of single word keywords or multi-word phrases.": [
|
||||
"Pilkuilla erotettu lista yksitt\u00e4isi\u00e4 hakusanoja tai monisanaisia hakulauseita."
|
||||
],
|
||||
"If any of these keywords are present in the search query, this post will be moved on top of the search results.": [
|
||||
"Jos joku n\u00e4ist\u00e4 hakusanoista esiintyy k\u00e4ytt\u00e4j\u00e4n haussa, t\u00e4m\u00e4 artikkeli kiinnitet\u00e4\u00e4n hakutulosten huipulle."
|
||||
],
|
||||
"You can add weights to pinned keywords like this: 'keyword (100)'. The post with the highest weight will be sorted first if there are multiple posts pinned to the same keyword.": [
|
||||
"Voit lis\u00e4t\u00e4 kiinnitetyille avainsanoille painoja n\u00e4in: \u2019avainsana (100)\u2019. Jos samalla avainsanalla on kiinnitetty useampi artikkeli, tuloslistan ensimm\u00e4iseksi nostetaan se, jonka paino on suurin."
|
||||
],
|
||||
"Exclusion": [
|
||||
"Artikkelien poissulkeminen"
|
||||
],
|
||||
"Exclude this post or page from the index.": [
|
||||
"Poista t\u00e4m\u00e4 artikkeli indeksist\u00e4."
|
||||
],
|
||||
"Ignore post content in the indexing.": [
|
||||
"\u00c4l\u00e4 huomioi artikkelin sis\u00e4lt\u00f6\u00e4 indeksoitaessa."
|
||||
],
|
||||
"If any of these keywords are present in the search query, this post will be removed from the search results.": [
|
||||
"Jos joku n\u00e4ist\u00e4 hakusanoista esiintyy k\u00e4ytt\u00e4j\u00e4n haussa, t\u00e4m\u00e4 artikkeli poistetaan hakutuloksista."
|
||||
],
|
||||
"Related posts": [
|
||||
"Aiheeseen liittyv\u00e4t artikkelit"
|
||||
],
|
||||
"Don't append the related posts to this page.": [
|
||||
"\u00c4l\u00e4 lis\u00e4\u00e4 samankaltaisia artikkeleita t\u00e4lle sivulle."
|
||||
],
|
||||
"Don't show this as a related post for any post.": [
|
||||
"\u00c4l\u00e4 n\u00e4yt\u00e4 t\u00e4t\u00e4 samankaltaisena artikkelina mill\u00e4\u00e4n sivulla."
|
||||
],
|
||||
"A comma-separated list of keywords to use for the Related Posts feature.": [
|
||||
"Pilkulla erotettu lista avainsanoja samankaltaisten artikkelien etsimiseen."
|
||||
],
|
||||
"Anything entered here will used when searching for related posts. Using phrases with quotes is allowed, but will restrict the related posts to posts including that phrase.": [
|
||||
"T\u00e4h\u00e4n merkittyj\u00e4 hakusanoja k\u00e4ytet\u00e4\u00e4n samankaltaisten artikkelien etsimiseen. Voit k\u00e4ytt\u00e4\u00e4 fraasihakua lainausmerkeill\u00e4, mutta se rajoittaa samankaltaiset artikkelit niihin, joissa fraasi esiintyy."
|
||||
],
|
||||
"A comma-separated list of post IDs to use as related posts for this post": [
|
||||
"Pilkuilla erotettu lista t\u00e4m\u00e4n artikkelin liittyvin\u00e4 artikkeleina k\u00e4ytett\u00e4vien artikkelien ID-numeroista"
|
||||
],
|
||||
"Related posts for this post:": [
|
||||
"Samankaltaiset artikkelit:"
|
||||
],
|
||||
"Excluded posts for this post:": [
|
||||
"\u00c4l\u00e4 k\u00e4yt\u00e4 samankaltaisina artikkeleina t\u00e4lle artikkelille:"
|
||||
],
|
||||
"Insights": [
|
||||
"Huomioita"
|
||||
],
|
||||
"The most common search terms used to find this post:": [
|
||||
"Yleisimm\u00e4t hakusanat, joilla t\u00e4m\u00e4 artikkeli l\u00f6ydet\u00e4\u00e4n:"
|
||||
],
|
||||
"Low-ranking search terms used to find this post:": [
|
||||
"Hakusanoja, joilla t\u00e4m\u00e4 artikkeli on l\u00f6ydetty matalilta sijoilta:"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
6886
wp/wp-content/plugins/relevanssi-premium/languages/relevanssi-fi.po
Normal file
6886
wp/wp-content/plugins/relevanssi-premium/languages/relevanssi-fi.po
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
{"translation-revision-date":"2023-04-23 03:33:04+0000","generator":"GlotPress\/4.0.0-alpha.3","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=2; plural=n > 1;","lang":"fr"},"Ignore post content in the indexing.":["Ignorer le contenu de la publication dans l\u2019indexation."],"use this":["utiliser ceci"],"not this":["pas cela"],"Insights":["Insights"],"A comma-separated list of post IDs to use as related posts for this post":["Une liste d\u2019ID de publications s\u00e9par\u00e9s par des virgules \u00e0 utiliser comme publications similaires pour cette publication"],"Don't show this as a related post for any post.":["N\u2019affichez ceci comme une publication similaire pour aucune publication."],"Don't append the related posts to this page.":["N\u2019ajoutez pas les publications similaires \u00e0 cette page."],"Exclude this post or page from the index.":["Exclure cette publication ou cette page de l\u2019index."],"Pin this post for all searches it appears in.":["\u00c9pinglez cette publication pour toutes les recherches dans lesquelles elle appara\u00eet."],"How Relevanssi sees this post":["Comment Relevanssi voit cette publication"]}},"comment":{"reference":"index.js"}}
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
{"translation-revision-date":"2023-04-23 03:33:04+0000","generator":"GlotPress\/4.0.0-alpha.3","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=2; plural=n != 1;","lang":"it"},"Insights":["Approfondimenti (Insights)"]}},"comment":{"reference":"index.js"}}
|
||||
Binary file not shown.
@@ -0,0 +1,321 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Relevanssi\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2009-08-14 14:06+0200\n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: Alessandro Fiorotto <alex@fiorotto.com>\n"
|
||||
"Language-Team: Fiorotto <alex@fiorotto.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Poedit-Language: Italian\n"
|
||||
"X-Poedit-Country: ITALY\n"
|
||||
"X-Poedit-SourceCharset: utf-8\n"
|
||||
|
||||
#: relevanssi.php:703
|
||||
msgid "There is no excerpt because this is a protected post."
|
||||
msgstr "Non c'è alcun estratto perché il post è protetto."
|
||||
|
||||
#: relevanssi.php:994
|
||||
msgid "Indexing complete!"
|
||||
msgstr "Indicizzazione completata!"
|
||||
|
||||
#: relevanssi.php:1183
|
||||
msgid "Relevanssi Search Options"
|
||||
msgstr "Opzioni per Relevanssi Search"
|
||||
|
||||
#: relevanssi.php:1294
|
||||
#, php-format
|
||||
msgid "<div id='message' class='update fade'><p>Term '%s' added to stopwords!</p></div>"
|
||||
msgstr "<div id='message' class='update fade'><p>Termine '%s' aggiunto alle parole inutili ai fini della ricerca!</p></div>"
|
||||
|
||||
#: relevanssi.php:1297
|
||||
#, php-format
|
||||
msgid "<div id='message' class='update fade'><p>Couldn't add term '%s' to stopwords!</p></div>"
|
||||
msgstr "<div id='message' class='update fade'><p>Non posso aggiungere il termine '%s' alle parole inutili ai fini della ricerca!</p></div>"
|
||||
|
||||
#: relevanssi.php:1306
|
||||
msgid "25 most common words in the index"
|
||||
msgstr "Le 25 parole più comuni nell'indice"
|
||||
|
||||
#: relevanssi.php:1308
|
||||
msgid "These words are excellent stopword material. A word that appears in most of the posts in the database is quite pointless when searching. This is also an easy way to create a completely new stopword list, if one isn't available in your language. Click the icon after the word to add the word to the stopword list. The word will also be removed from the index, so rebuilding the index is not necessary."
|
||||
msgstr "Queste parole possono dimostrarsi inutili ai fini della ricerca. Una parola che compare nella maggior parte dei posti nel database è piuttosto inutile ai fini di una buona ricerca. Questo è anche un modo semplice per creare un nuovo elenco di parole non significative, se non è disponibile nella tua lingua. Fare clic sull'icona dopo la parola per aggiungere la parola alla lista delle parole non significative. La parola sarà rimossa dall'indice e non sarà necessario ricostruire l'indice se si effettua una modifica."
|
||||
|
||||
#: relevanssi.php:1331
|
||||
msgid "Add to stopwords"
|
||||
msgstr "Aggiungi alle parole inutili ai fini della ricerca"
|
||||
|
||||
#: relevanssi.php:1344
|
||||
msgid "25 most popular queries"
|
||||
msgstr "25 ricerche più effettuate"
|
||||
|
||||
#: relevanssi.php:1356
|
||||
msgid "Recent queries that got 0 hits"
|
||||
msgstr "Recenti ricerche che non hanno dato risultati"
|
||||
|
||||
#: relevanssi.php:1491
|
||||
msgid "Title boost:"
|
||||
msgstr "Potenziamento dal titolo:"
|
||||
|
||||
#: relevanssi.php:1492
|
||||
#, php-format
|
||||
msgid "Default: %d. 0 means titles are ignored, 1 means no boost, more than 1 gives extra value."
|
||||
msgstr "Predefinito %d. 0 significa che i titoli sono ignorati, 1 significa non aumentare, mentre più di 1 da un valore in più."
|
||||
|
||||
#: relevanssi.php:1493
|
||||
msgid "Tag boost:"
|
||||
msgstr "Potenziamento da TAG"
|
||||
|
||||
#: relevanssi.php:1494
|
||||
#, php-format
|
||||
msgid "Default: %d. 0 means tags are ignored, 1 means no boost, more than 1 gives extra value."
|
||||
msgstr "Predefinito %d. 0 significa che i tag sono ignorati, 1 significa non aumentare, mentre più di 1 da un valore in più."
|
||||
|
||||
#: relevanssi.php:1495
|
||||
msgid "Comment boost:"
|
||||
msgstr "Potenziamento dai commenti:"
|
||||
|
||||
#: relevanssi.php:1496
|
||||
#, php-format
|
||||
msgid "Default: %d. 0 means comments are ignored, 1 means no boost, more than 1 gives extra value."
|
||||
msgstr "Predefinito %d. 0 significa che i commenti sono ignorati, 1 significa non aumentare, mentre più di 1 da un valore in più."
|
||||
|
||||
#: relevanssi.php:1497
|
||||
msgid "Use search for admin:"
|
||||
msgstr "Usa ricerca per admin:"
|
||||
|
||||
#: relevanssi.php:1498
|
||||
msgid "If checked, Relevanssi will be used for searches in the admin interface"
|
||||
msgstr "Se selezionato, Relevanssi sarà usato anche per le ricerche nell'interfaccia di amministrazione"
|
||||
|
||||
#: relevanssi.php:1499
|
||||
msgid "Restrict search to these categories and tags:"
|
||||
msgstr "Circoscrivi la ricerca a queste categorie e tag:"
|
||||
|
||||
#: relevanssi.php:1500
|
||||
msgid "Enter a comma-separated list of category and tag IDs to restrict search to those categories or tags. You can also use <code><input type='hidden' name='cat' value='list of cats and tags' /></code> in your search form. The input field will overrun this setting."
|
||||
msgstr "Inserire un elenco separato da virgola, con gli id degli articoli e/o delle pagine a cui sarà circoscritto l'ambito di ricerca. Si può anche usare il codice <code><input type='hidden' name='cat' value='list of cats and tags' /></code> nel modulo di ricerca e quello che si inserirà nel modulo sovrascriverà quanto impostato qui."
|
||||
|
||||
#: relevanssi.php:1501
|
||||
msgid "Exclude these categories and tags from search:"
|
||||
msgstr "Escludi queste categorie e tag dalla ricerca:"
|
||||
|
||||
#: relevanssi.php:1502
|
||||
msgid "Enter a comma-separated list of category and tag IDs that are excluded from search results. This only works here, you can't use the input field option (WordPress doesn't pass custom parameters there)."
|
||||
msgstr "Inserire un elenco separato da virgola, con gli id delle categorie e dei tag esclusi dai risultati della ricerca. Non è possibile sovrascrivere o cambiare questa impostazione inserendo dell'apposito codice nel modulo di ricerca."
|
||||
|
||||
#: relevanssi.php:1505
|
||||
msgid "Exclude these posts/pages from search:"
|
||||
msgstr "Escludi questi articoli/pagine dalla ricerca:"
|
||||
|
||||
#: relevanssi.php:1506
|
||||
msgid "Enter a comma-separated list of post/page IDs that are excluded from search results. This only works here, you can't use the input field option (WordPress doesn't pass custom parameters there)."
|
||||
msgstr "Inserire un elenco separato da virgola, con gli id degli articoli e/o delle pagine esclusi dai risultati della ricerca. Non è possibile sovrascrivere o cambiare questa impostazione inserendo dell'apposito codice nel modulo di ricerca."
|
||||
|
||||
#: relevanssi.php:1507
|
||||
msgid "Index and search your posts' tags:"
|
||||
msgstr "Indicizza e cerca i tag degli articoli:"
|
||||
|
||||
#: relevanssi.php:1508
|
||||
msgid "If checked, Relevanssi will also index and search the tags of your posts. Remember to rebuild the index if you change this option!"
|
||||
msgstr "Se selezionato, Relevanssi indicizzerà anche i tag degli articoli. Ricordati di ricostruire l'indice se cambi questa opzione!"
|
||||
|
||||
#: relevanssi.php:1509
|
||||
msgid "Index and search these comments:"
|
||||
msgstr "Indicizza e ricerca questi commenti:"
|
||||
|
||||
#: relevanssi.php:1510
|
||||
msgid "Relevanssi will index and search ALL (all comments including track- & pingbacks and custom comment types), NONE (no comments) or NORMAL (manually posted comments on your blog).<br />Remember to rebuild the index if you change this option!"
|
||||
msgstr "Relevanssi consente di indicizzare e di effettuare le ricerche su TUTTO (compresi tutti i commenti, track & pingbacks e i commenti personalizzati), NESSUNO (commenti esclusi) o NORMALE (solo i commenti inseriti manualmente nel tuo blog). <br /> Ricordati di ricostruire l'indice, se modifichi questa opzione!"
|
||||
|
||||
#: relevanssi.php:1511
|
||||
msgid "all"
|
||||
msgstr "tutto"
|
||||
|
||||
#: relevanssi.php:1512
|
||||
msgid "normal"
|
||||
msgstr "normale"
|
||||
|
||||
#: relevanssi.php:1513
|
||||
msgid "none"
|
||||
msgstr "nessuno"
|
||||
|
||||
#: relevanssi.php:1516
|
||||
msgid "Create custom search result snippets:"
|
||||
msgstr "Crea un frammento di ricerca personalizzato:"
|
||||
|
||||
#: relevanssi.php:1517
|
||||
msgid "If checked, Relevanssi will create excerpts that contain the search term hits. To make them work, make sure your search result template uses the_excerpt() to display post excerpts."
|
||||
msgstr "Se selezionato, Relevanssi creerà un estratto che conterrà la parola cercata. Affinché funzioni, assicurarsi che il template utilizzi la funzione the_excerpt() per visualizzare il risultato della ricerca."
|
||||
|
||||
#: relevanssi.php:1518
|
||||
msgid "Length of the snippet:"
|
||||
msgstr "Lunghezza del frammento:"
|
||||
|
||||
#: relevanssi.php:1519
|
||||
msgid "This must be an integer."
|
||||
msgstr "Deve essere un numero intero."
|
||||
|
||||
#: relevanssi.php:1520
|
||||
msgid "words"
|
||||
msgstr "parole"
|
||||
|
||||
#: relevanssi.php:1521
|
||||
msgid "characters"
|
||||
msgstr "caratteri"
|
||||
|
||||
#: relevanssi.php:1522
|
||||
msgid "Keep a log of user queries:"
|
||||
msgstr "Conserva un log delle ricerche:"
|
||||
|
||||
#: relevanssi.php:1523
|
||||
msgid "If checked, Relevanssi will log user queries."
|
||||
msgstr "Se selezionato, Relevanssi terrà traccia delle ricerche effettuate."
|
||||
|
||||
#: relevanssi.php:1524
|
||||
msgid "Highlight query terms in search results:"
|
||||
msgstr "Evidenzia i termini di ricerca nei risultati:"
|
||||
|
||||
#: relevanssi.php:1525
|
||||
msgid "Highlighting isn't available unless you use custom snippets"
|
||||
msgstr "L'evidenziazione non è disponibile se non si utilizzano degli snippet personalizzati"
|
||||
|
||||
#: relevanssi.php:1526
|
||||
msgid "Highlight query terms in result titles too:"
|
||||
msgstr "Evidenzia i termini di ricerca anche nei titoli dei risultati:"
|
||||
|
||||
#: relevanssi.php:1529
|
||||
msgid "Save"
|
||||
msgstr "Salva"
|
||||
|
||||
#: relevanssi.php:1530
|
||||
msgid "Building the index and indexing options"
|
||||
msgstr "Costruisci l'indice e salva le opzioni di indicizzazione"
|
||||
|
||||
#: relevanssi.php:1531
|
||||
msgid "After installing the plugin, you need to build the index. This generally needs to be done once, you don't have to re-index unless something goes wrong. Indexing is a heavy task and might take more time than your servers allow. If the indexing cannot be finished - for example you get a blank screen or something like that after indexing - you can continue indexing from where you left by clicking 'Continue indexing'. Clicking 'Build the index' will delete the old index, so you can't use that."
|
||||
msgstr "Dopo aver installato il plugin, è necessario costruire l'indice. Questo genere deve essere fatto una volta solo e non si deve reindicizzare fino a che qualcosa non funziona bene. L'indicizzazione è un compito pesante e potrebbe richiedere più tempo di quanto i server consentono. Se l'indicizzazione non viene completata e si ottine ad esempio una pagina bianca o qualcosa del genere, è possibile continuare l'indicizzazione dal punto in cui è stata interrotta semplicemente premendo il tasto 'Continua indicizzazione'. Cliccando invece su 'costruisci l'indice' si reinizierà da zero la creazione dell'indicie."
|
||||
|
||||
#: relevanssi.php:1532
|
||||
msgid "So, if you build the index and don't get the 'Indexing complete' in the end, keep on clicking the 'Continue indexing' button until you do. On my blogs, I was able to index ~400 pages on one go, but had to continue indexing twice to index ~950 pages."
|
||||
msgstr "Se si crea l'indice e alla fine non si ottiene il risultato di 'indicizzazione completa', cliccare nuovamente sul pulsante 'Continua indicizzazione' fino a quando non si otterrà tale risultato. Il mo blog ad esempio è stato in grado di indicizzare circa 400 pagine in una volta sola, ma ha dovuto continuare l'indicizzazione due volte per completare l'indice di circa 950 pagine."
|
||||
|
||||
#: relevanssi.php:1533
|
||||
msgid "Save indexing options and build the index"
|
||||
msgstr "Salva le opzioni di indicizzazione e costruisci l'indice"
|
||||
|
||||
#: relevanssi.php:1534
|
||||
msgid "Continue indexing"
|
||||
msgstr "Continua indicizzazione"
|
||||
|
||||
#: relevanssi.php:1535
|
||||
msgid "No highlighting"
|
||||
msgstr "No evidenziazione"
|
||||
|
||||
#: relevanssi.php:1536
|
||||
msgid "Text color"
|
||||
msgstr "Colore del testo"
|
||||
|
||||
#: relevanssi.php:1537
|
||||
msgid "Background color"
|
||||
msgstr "Colore di sfondo"
|
||||
|
||||
#: relevanssi.php:1538
|
||||
msgid "CSS Style"
|
||||
msgstr "Stile CSS"
|
||||
|
||||
#: relevanssi.php:1539
|
||||
msgid "CSS Class"
|
||||
msgstr "Classe CSS"
|
||||
|
||||
#: relevanssi.php:1541
|
||||
msgid "Text color for highlights:"
|
||||
msgstr "Colore del testo delle evidenziazioni:"
|
||||
|
||||
#: relevanssi.php:1542
|
||||
msgid "Background color for highlights:"
|
||||
msgstr "Colore di sfondo delle evidenziazioni:"
|
||||
|
||||
#: relevanssi.php:1543
|
||||
msgid "CSS style for highlights:"
|
||||
msgstr "Stile CSS per le evidenziazioni:"
|
||||
|
||||
#: relevanssi.php:1544
|
||||
msgid "CSS class for highlights:"
|
||||
msgstr "Classe CSS per le evidenziazioni:"
|
||||
|
||||
#: relevanssi.php:1546
|
||||
#: relevanssi.php:1547
|
||||
msgid "Use HTML color codes (#rgb or #rrggbb)"
|
||||
msgstr "Usare il codice colore HTML (#rgb o #rrggbb)"
|
||||
|
||||
#: relevanssi.php:1548
|
||||
msgid "You can use any CSS styling here, style will be inserted with a <span>"
|
||||
msgstr "È possibile usare qualsiasi stile CSS, lo stile sarà inserito con <span>"
|
||||
|
||||
#: relevanssi.php:1549
|
||||
msgid "Name a class here, search results will be wrapped in a <span> with the class"
|
||||
msgstr "Nome della classe qui. I risultati di ricerca saranno compresi in <span> con la classe"
|
||||
|
||||
#: relevanssi.php:1551
|
||||
msgid "What to include in the index"
|
||||
msgstr "Cosa includere nell'indice"
|
||||
|
||||
#: relevanssi.php:1552
|
||||
msgid "Everything"
|
||||
msgstr "Ogni cosa"
|
||||
|
||||
#: relevanssi.php:1553
|
||||
msgid "Just posts"
|
||||
msgstr "Solo articoli"
|
||||
|
||||
#: relevanssi.php:1554
|
||||
msgid "Just pages"
|
||||
msgstr "Solo pagine"
|
||||
|
||||
#: relevanssi.php:1556
|
||||
msgid "Custom fields to index:"
|
||||
msgstr "Campi personalizzati da indicizzare:"
|
||||
|
||||
#: relevanssi.php:1557
|
||||
msgid "A comma-separated list of custom field names to include in the index."
|
||||
msgstr "Una lista separata da virgola dei nomi personalizzati da includere nell'indice."
|
||||
|
||||
#: relevanssi.php:1559
|
||||
msgid "Show breakdown of search hits in excerpts:"
|
||||
msgstr "Viusalizza un separatore nei risultati di ricerca:"
|
||||
|
||||
#: relevanssi.php:1560
|
||||
msgid "Check this to show more information on where the search hits were made. Requires custom snippets to work."
|
||||
msgstr "Seleziona qui per mostrare più informazioni o per definire dove sarà effettuata la ricerca. Per attivarlo richiede uno snippet personalizzato."
|
||||
|
||||
#: relevanssi.php:1561
|
||||
msgid "The breakdown format:"
|
||||
msgstr "Formato dell'interruzione:"
|
||||
|
||||
#: relevanssi.php:1562
|
||||
msgid "Use %body%, %title%, %tags%, %comments% and %score% to display the number of hits and the document weight."
|
||||
msgstr "Usa %body%, %title%, %tags%, %comments% e %score% per visualizzare il numero di ricorrenze e il peso del documento."
|
||||
|
||||
#: relevanssi.php:1564
|
||||
msgid "When to use fuzzy matching?"
|
||||
msgstr "Quando usare la ricerca per parola simile?"
|
||||
|
||||
#: relevanssi.php:1565
|
||||
msgid "When straight search gets no hits"
|
||||
msgstr "Quando la ricerca regolare non produce risultati"
|
||||
|
||||
#: relevanssi.php:1566
|
||||
msgid "Always"
|
||||
msgstr "Sempre"
|
||||
|
||||
#: relevanssi.php:1567
|
||||
msgid "Don't use fuzzy search"
|
||||
msgstr "Non usare la ricerca per similitudini"
|
||||
|
||||
#: relevanssi.php:1568
|
||||
msgid "Straight search matches just the term. Fuzzy search matches everything that begins or ends with the search term."
|
||||
msgstr "La ricerca regolare cerca semplicemente un termine. La ricerca per similitudine trova anche tutti i termini che iniziano o finiscono come il termine di ricerca."
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{"translation-revision-date":"2023-01-25 12:26:59+0000","generator":"GlotPress\/4.0.0-alpha.3","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=1; plural=0;","lang":"ja_JP"},"Insights":["Insights"]}},"comment":{"reference":"index.js"}}
|
||||
@@ -0,0 +1 @@
|
||||
{"translation-revision-date":"2023-04-23 03:33:04+0000","generator":"GlotPress\/4.0.0-alpha.3","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=2; plural=n != 1;","lang":"nl"},"Insights":["Inzichten"]}},"comment":{"reference":"index.js"}}
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
{"translation-revision-date":"2023-02-21 15:40:15+0000","generator":"GlotPress\/4.0.0-alpha.3","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=2; plural=(n > 1);","lang":"pt_BR"},"Insights":["Insights"]}},"comment":{"reference":"index.js"}}
|
||||
Binary file not shown.
@@ -0,0 +1,578 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Relevanssi\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: \n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: Pedro Padron <ppadron@w3p.com.br>\n"
|
||||
"Language-Team: W3P Projetos Web <contato@w3p.com.br>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Poedit-Language: Portuguese\n"
|
||||
"X-Poedit-Country: BRAZIL\n"
|
||||
"X-Poedit-Basepath: /\n"
|
||||
"X-Poedit-SearchPath-0: /home/ppadron/Projects/wordpress-vanilla/wp-content/plugins/relevanssi\n"
|
||||
|
||||
#: relevanssi.php:1032
|
||||
msgid "There is no excerpt because this is a protected post."
|
||||
msgstr "Não há resumo porque esse é um post protegido."
|
||||
|
||||
#: relevanssi.php:1746
|
||||
msgid "Relevanssi Search Options"
|
||||
msgstr "Opções de Busca do Relevanssi"
|
||||
|
||||
#: relevanssi.php:1915
|
||||
msgid "25 most common words in the index"
|
||||
msgstr "25 palavras mais comuns no índice"
|
||||
|
||||
#: relevanssi.php:1917
|
||||
msgid "These words are excellent stopword material. A word that appears in most of the posts in the database is quite pointless when searching. This is also an easy way to create a completely new stopword list, if one isn't available in your language. Click the icon after the word to add the word to the stopword list. The word will also be removed from the index, so rebuilding the index is not necessary."
|
||||
msgstr "Estas palavras são excelentes para formar uma lista de stopwords. Uma palavra que aparece na maioria dos posts é um tanto quanto inútil em uma busca. Esta também é uma maneira fácil de criar uma nova lista de stopwords, caso uma não esteja disponível em seu idioma. Clique no ícone após a palavra para adicioná-la à lista de stopwords. A palavra também será removida do índice, então não é necessário reconstruí-lo."
|
||||
|
||||
#: relevanssi.php:1940
|
||||
msgid "Add to stopwords"
|
||||
msgstr "Adicionar à lista de stopwords"
|
||||
|
||||
#: relevanssi.php:1953
|
||||
msgid "25 most popular queries"
|
||||
msgstr "25 buscas mais populares"
|
||||
|
||||
#: relevanssi.php:1965
|
||||
msgid "Recent queries that got 0 hits"
|
||||
msgstr "Buscas recentes que não retornaram resultados"
|
||||
|
||||
#: relevanssi.php:2126
|
||||
msgid "Title boost:"
|
||||
msgstr "Prioridade do Título:"
|
||||
|
||||
#: relevanssi.php:2135
|
||||
msgid "Use search for admin:"
|
||||
msgstr "Usar a busca para o admin:"
|
||||
|
||||
#: relevanssi.php:2138
|
||||
msgid "Restrict search to these categories and tags:"
|
||||
msgstr "Restringir a busca para essas categorias e tags:"
|
||||
|
||||
#: relevanssi.php:2182
|
||||
msgid "Create custom search result snippets:"
|
||||
msgstr "Criar resumos de resultado de busca personalizados:"
|
||||
|
||||
#: relevanssi.php:2186
|
||||
msgid "Length of the snippet:"
|
||||
msgstr "Tamanho do resumo:"
|
||||
|
||||
#: relevanssi.php:2190
|
||||
msgid "Keep a log of user queries:"
|
||||
msgstr "Manter um histórico de buscas dos usuários:"
|
||||
|
||||
#: relevanssi.php:2191
|
||||
msgid "If checked, Relevanssi will log user queries."
|
||||
msgstr "Se ativada, Relevanssi irá armazenar as buscas feitas pelos usuários."
|
||||
|
||||
#: relevanssi.php:2195
|
||||
msgid "Highlight query terms in search results:"
|
||||
msgstr "Usar efeito marca-texto nos termos da busca nos resultados:"
|
||||
|
||||
#: relevanssi.php:2196
|
||||
msgid "Highlighting isn't available unless you use custom snippets"
|
||||
msgstr "Esta opção só está disponível se você utilizar resumos de resultados de busca personalizados"
|
||||
|
||||
#: relevanssi.php:2214
|
||||
msgid "Continue indexing"
|
||||
msgstr "Continuar Indexação"
|
||||
|
||||
#: relevanssi.php:2215
|
||||
msgid "No highlighting"
|
||||
msgstr "Sem efeito marca-texto"
|
||||
|
||||
#: relevanssi.php:2216
|
||||
msgid "Text color"
|
||||
msgstr "Cor do texto"
|
||||
|
||||
#: relevanssi.php:2217
|
||||
msgid "Background color"
|
||||
msgstr "Cor de fundo"
|
||||
|
||||
#: relevanssi.php:2218
|
||||
msgid "CSS Style"
|
||||
msgstr "CSS Style"
|
||||
|
||||
#: relevanssi.php:2219
|
||||
msgid "CSS Class"
|
||||
msgstr "Classe CSS"
|
||||
|
||||
#: relevanssi.php:2221
|
||||
msgid "Text color for highlights:"
|
||||
msgstr "Cor de texto para efeito marca-texto:"
|
||||
|
||||
#: relevanssi.php:2222
|
||||
msgid "Background color for highlights:"
|
||||
msgstr "Cor de fundo para efeito marca-texto:"
|
||||
|
||||
#: relevanssi.php:2223
|
||||
msgid "CSS style for highlights:"
|
||||
msgstr "Estilo CSS para efeito marca-texto:"
|
||||
|
||||
#: relevanssi.php:2224
|
||||
msgid "CSS class for highlights:"
|
||||
msgstr "Classe CSS para efeito marca-texto:"
|
||||
|
||||
#: relevanssi.php:2226
|
||||
#: relevanssi.php:2227
|
||||
msgid "Use HTML color codes (#rgb or #rrggbb)"
|
||||
msgstr "Use cores em hexadecimal (#rgb ou #rrggbb)"
|
||||
|
||||
# @ default
|
||||
#: relevanssi.php:94
|
||||
#, php-format
|
||||
msgid "Relevanssi needs attention: Remember to build the index (you can do it at <a href=\"%1$s\">the settings page</a>), otherwise searching won't work."
|
||||
msgstr "Relevanssi precisa de atenção: Lembre-se de construir o índice (você pode fazê-lo na <a href=\"%1$s\">página de opções</a>), caso contrário a busca não irá funcionar."
|
||||
|
||||
#: relevanssi.php:1430
|
||||
msgid "Indexing complete!"
|
||||
msgstr "Indexação concluída!"
|
||||
|
||||
#: relevanssi.php:1903
|
||||
#, php-format
|
||||
msgid "<div id='message' class='update fade'><p>Term '%s' added to stopwords!</p></div>"
|
||||
msgstr "<div id='message' class='update fade'><p>Termo '%s' adicionado à lista de stopwords!</p></div>"
|
||||
|
||||
#: relevanssi.php:1906
|
||||
#, php-format
|
||||
msgid "<div id='message' class='update fade'><p>Couldn't add term '%s' to stopwords!</p></div>"
|
||||
msgstr "<div id='message' class='update fade'><p>Não foi possível adicionar '%s' à lista de stopwords!</p></div>"
|
||||
|
||||
#: relevanssi.php:2129
|
||||
msgid "Tag boost:"
|
||||
msgstr "Prioridade da Tag:"
|
||||
|
||||
#: relevanssi.php:2132
|
||||
msgid "Comment boost:"
|
||||
msgstr "Prioridade dos Comentários:"
|
||||
|
||||
#: relevanssi.php:2143
|
||||
msgid "Exclude these categories and tags from search:"
|
||||
msgstr "Excluir da busca essas categorias e tags:"
|
||||
|
||||
# @ relevanssi
|
||||
#: relevanssi.php:2147
|
||||
msgid "Exclusions and restrictions"
|
||||
msgstr "Restrições"
|
||||
|
||||
#: relevanssi.php:2150
|
||||
msgid "Exclude these posts/pages from search:"
|
||||
msgstr "Excluir esses posts/páginas da busca:"
|
||||
|
||||
#: relevanssi.php:2154
|
||||
msgid "Index and search your posts' tags:"
|
||||
msgstr "Indexar e buscar as tags dos posts:"
|
||||
|
||||
#: relevanssi.php:2157
|
||||
msgid "Index and search these comments:"
|
||||
msgstr "Indexar e buscar nestes Comentários:"
|
||||
|
||||
#: relevanssi.php:2162
|
||||
msgid "all"
|
||||
msgstr "todos"
|
||||
|
||||
#: relevanssi.php:2163
|
||||
msgid "normal"
|
||||
msgstr "normal"
|
||||
|
||||
#: relevanssi.php:2164
|
||||
msgid "none"
|
||||
msgstr "nenhum"
|
||||
|
||||
#: relevanssi.php:2181
|
||||
msgid "Custom excerpts/snippets"
|
||||
msgstr "Resumos de resultado de busca personalizados"
|
||||
|
||||
#: relevanssi.php:2187
|
||||
msgid "This must be an integer."
|
||||
msgstr "O valor deve ser um número inteiro."
|
||||
|
||||
#: relevanssi.php:2188
|
||||
msgid "words"
|
||||
msgstr "palavras"
|
||||
|
||||
#: relevanssi.php:2189
|
||||
msgid "characters"
|
||||
msgstr "caracteres"
|
||||
|
||||
#: relevanssi.php:2192
|
||||
msgid "Search hit highlighting"
|
||||
msgstr "Efeito marca-texto"
|
||||
|
||||
# @ relevanssi
|
||||
#: relevanssi.php:2193
|
||||
msgid "First, choose the type of highlighting used:"
|
||||
msgstr "Primeiramente, escolha o tipo de efeito marca-texto a ser utilizado:"
|
||||
|
||||
# @ relevanssi
|
||||
#: relevanssi.php:2194
|
||||
msgid "Then adjust the settings for your chosen type:"
|
||||
msgstr "Ajuste as opções para o tipo escolhido:"
|
||||
|
||||
#: relevanssi.php:2198
|
||||
msgid "Highlight query terms in result titles too:"
|
||||
msgstr "Usar efeito marca-texto também nos títulos dos resultados:"
|
||||
|
||||
# @ relevanssi
|
||||
#: relevanssi.php:2201
|
||||
msgid "Save the options"
|
||||
msgstr "Gravar as opções"
|
||||
|
||||
#: relevanssi.php:2202
|
||||
msgid "Building the index and indexing options"
|
||||
msgstr "Construindo o índice e opções de indexação"
|
||||
|
||||
#: relevanssi.php:2213
|
||||
msgid "Save indexing options and build the index"
|
||||
msgstr "Gravar opções de indexação e construir o índice"
|
||||
|
||||
#: relevanssi.php:2233
|
||||
msgid "What to include in the index"
|
||||
msgstr "O que incluir no índice"
|
||||
|
||||
#: relevanssi.php:2234
|
||||
msgid "Everything"
|
||||
msgstr "Tudo"
|
||||
|
||||
#: relevanssi.php:2235
|
||||
msgid "Just posts"
|
||||
msgstr "Apenas posts"
|
||||
|
||||
#: relevanssi.php:2236
|
||||
msgid "Just pages"
|
||||
msgstr "Apenas páginas"
|
||||
|
||||
#: relevanssi.php:2251
|
||||
msgid "Custom fields to index:"
|
||||
msgstr "Campos personalizados a serem indexados:"
|
||||
|
||||
#: relevanssi.php:2259
|
||||
msgid "Show breakdown of search hits in excerpts:"
|
||||
msgstr "Exibir mais informações de hits no resumo:"
|
||||
|
||||
#: relevanssi.php:2262
|
||||
msgid "The breakdown format:"
|
||||
msgstr "Formato das informações:"
|
||||
|
||||
#: relevanssi.php:2267
|
||||
msgid "When to use fuzzy matching?"
|
||||
msgstr "Quando utilizar busca fuzzy"
|
||||
|
||||
#: relevanssi.php:2268
|
||||
msgid "When straight search gets no hits"
|
||||
msgstr "Quando a busca direta não encontra resultados"
|
||||
|
||||
#: relevanssi.php:2269
|
||||
msgid "Always"
|
||||
msgstr "Sempre"
|
||||
|
||||
#: relevanssi.php:2270
|
||||
msgid "Don't use fuzzy search"
|
||||
msgstr "Não utilizar busca fuzzy"
|
||||
|
||||
# @ relevanssi
|
||||
#: relevanssi.php:311
|
||||
msgid "Data wiped clean, you can now delete the plugin."
|
||||
msgstr "Dados removidos! Você pode remover o plugin agora."
|
||||
|
||||
# @ relevanssi
|
||||
#: relevanssi.php:2280
|
||||
msgid "Uninstall"
|
||||
msgstr "Desinstalar"
|
||||
|
||||
# @ relevanssi
|
||||
#: relevanssi.php:2284
|
||||
msgid "Remove plugin data"
|
||||
msgstr "Remover todos os dados do plugin"
|
||||
|
||||
# @ relevanssi
|
||||
#: relevanssi.php:2274
|
||||
msgid "Expand shortcodes in post content:"
|
||||
msgstr "Converter os shortcodes "
|
||||
|
||||
#: relevanssi.php:2167
|
||||
msgid "Index and search your posts' categories:"
|
||||
msgstr "Indexar e buscar as categorias dos posts:"
|
||||
|
||||
#: relevanssi.php:2243
|
||||
msgid "Custom post types to index"
|
||||
msgstr "Tipos de Posts (custom post types) a serem indexados"
|
||||
|
||||
#: relevanssi.php:2255
|
||||
msgid "Custom taxonomies to index:"
|
||||
msgstr "Taxonomias personalizadas a serem indexadas:"
|
||||
|
||||
#: relevanssi.php:2127
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Default: %d. 0 means titles are ignored, 1 means no boost, more\n"
|
||||
"\t\tthan 1 gives extra value."
|
||||
msgstr "Padrão: %d. 0 significa que os títulos são ignorados, 1 significa nenhuma prioridade, mais de 1 aumenta a prioridade."
|
||||
|
||||
#: relevanssi.php:2130
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Default: %d. 0 means tags are ignored, 1 means no boost, more\n"
|
||||
"\t\tthan 1 gives extra value."
|
||||
msgstr "Padrão: %d. 0 significa que as tags são ignoradas, 1 significa nenhuma prioridade, mais de 1 aumenta a prioridade."
|
||||
|
||||
#: relevanssi.php:2133
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Default: %d. 0 means comments are ignored, 1 means no boost,\n"
|
||||
"\t\tmore than 1 gives extra value."
|
||||
msgstr "Padrão: %d. 0 significa que os comentários são ignorados, 1 significa nenhuma prioridade, mais de 1 aumenta a prioridade."
|
||||
|
||||
#: relevanssi.php:2136
|
||||
msgid ""
|
||||
"If checked, Relevanssi will be used for searches in the admin\n"
|
||||
"\t\tinterface"
|
||||
msgstr "Se a opção estiver marcada, Relevanssi será usado nas buscas no painel do admin"
|
||||
|
||||
#: relevanssi.php:2139
|
||||
msgid ""
|
||||
"Enter a comma-separated list of category and tag IDs to restrict search to\n"
|
||||
"\t\tthose categories or tags. You can also use <code><input type='hidden' name='cat'\n"
|
||||
"\t\tvalue='list of cats and tags' /></code> in your search form. The input field will\n"
|
||||
"\t\toverrun this setting."
|
||||
msgstr "Insira uma lista separada por vírgulas de categorias e IDs de tags para restringir a busca apenas nelas. Você também pode usar <code><input type='hidden' name='cat' value='lista de categorias e tags' /></code> em seu formulário. O campo no formulário tem prioridade sobre esta opção no painel."
|
||||
|
||||
#: relevanssi.php:2144
|
||||
msgid ""
|
||||
"Enter a comma-separated list of category and tag IDs that are excluded from\n"
|
||||
"\t\tsearch results. This only works here, you can't use the input field option (WordPress\n"
|
||||
"\t\tdoesn't pass custom parameters there)."
|
||||
msgstr "Insira uma lista separada por vírgulas de categorias e IDs de tags que serão excluídos dos resultados da busca. Essa opção só pode ser definida aqui, você não pode usar um campo adicional no formulário (WordPress não passa parâmetros personalizados lá)."
|
||||
|
||||
#: relevanssi.php:2151
|
||||
msgid ""
|
||||
"Enter a comma-separated list of post/page IDs that are excluded from search\n"
|
||||
"\t\tresults. This only works here, you can't use the input field option (WordPress doesn't pass\n"
|
||||
"\t\tcustom parameters there)."
|
||||
msgstr "Insira uma lista separada por vírgulas de IDs de posts/páginas que serão excluídos dos resultados da busca. Essa opção só pode ser definida aqui, você não pode usar um campo adicional no formulário (WordPress não passa parâmetros personalizados lá)."
|
||||
|
||||
#: relevanssi.php:2155
|
||||
msgid ""
|
||||
"If checked, Relevanssi will also index and search the tags of your posts.\n"
|
||||
"\t\tRemember to rebuild the index if you change this option!"
|
||||
msgstr "Se esta opção estiver marcada, Relevanssi irá indexar e realizar buscas nas tags de seus posts. Lembre-se de reconstruir o índice se você mudar esta opção!"
|
||||
|
||||
#: relevanssi.php:2158
|
||||
msgid ""
|
||||
"Relevanssi will index and search ALL (all comments including track-\n"
|
||||
"\t\t& pingbacks and custom comment types), NONE (no comments) or NORMAL (manually posted\n"
|
||||
"\t\tcomments on your blog).<br />Remember to rebuild the index if you change this option!"
|
||||
msgstr "Relevanssi irá indexar e buscar em TODOS (comentários, trackbacks, pingbacks e tipos personalizados de comentários), NENHUM (nenhum comentário) ou NORMAL (comentários postados manualmente no blog).<br/> Lembre-se de reconstruir o índice se você mudar esta opção!"
|
||||
|
||||
#: relevanssi.php:2168
|
||||
msgid ""
|
||||
"If checked, Relevanssi will also index and search the categories of your\n"
|
||||
"\t\tposts. Category titles will pass through 'single_cat_title' filter. Remember to rebuild the\n"
|
||||
"\t\tindex if you change this option!"
|
||||
msgstr "Se esta opção estiver marcada, Relevanssi irá indexar e realizar buscas nas categorias de seus posts. Lembre-se de reconstruir o índice se você mudar esta opção!"
|
||||
|
||||
#: relevanssi.php:2183
|
||||
msgid ""
|
||||
"If checked, Relevanssi will create excerpts that contain the search term\n"
|
||||
"\t\thits. To make them work, make sure your search result template uses the_excerpt() to\n"
|
||||
"\t\tdisplay post excerpts."
|
||||
msgstr "Se esta opção estiver marcada, Relevanssi irá criar resumos que contém o(s) termo(s) buscado(s). Para que isso funcione, certifique-se de que seu template de resultado de busca utiliza <code>the_excerpt()</code> para exibir resumos de posts."
|
||||
|
||||
#: relevanssi.php:2203
|
||||
msgid ""
|
||||
"After installing the plugin, you need to build the index. This generally needs\n"
|
||||
"\t\tto be done once, you don't have to re-index unless something goes wrong. Indexing is a heavy\n"
|
||||
"\t\ttask and might take more time than your servers allow. If the indexing cannot be finished -\n"
|
||||
"\t\tfor example you get a blank screen or something like that after indexing - you can continue\n"
|
||||
"\t\tindexing from where you left by clicking 'Continue indexing'. Clicking 'Build the index'\n"
|
||||
"\t\twill delete the old index, so you can't use that."
|
||||
msgstr "Após a instalação do plugin, é preciso construir o índice. Isso normalmente precisa ser feito apenas uma vez. Não é necessário reconstruir o índice a não ser que algo de errado aconteça. A indexação é uma tarefa pesada e pode levar mais tempo do que seus servidores permitam. Se a indexação não puder ser concluída - por exemplo, você encontrar uma tela branca ou algo parecido após a indexação - você pode continuar o processo a partir de onde parou ao clicar em \"Continuar Indexação\". Ao clicar em \"Construir o Índice\" o índice atual será removido, portanto não clique nele para continuar uma indexação interrompida."
|
||||
|
||||
#: relevanssi.php:2209
|
||||
msgid ""
|
||||
"So, if you build the index and don't get the 'Indexing complete' in the end,\n"
|
||||
"\t\tkeep on clicking the 'Continue indexing' button until you do. On my blogs, I was able to\n"
|
||||
"\t\tindex ~400 pages on one go, but had to continue indexing twice to index ~950 pages."
|
||||
msgstr "Portanto, se você construir o índice e não receber a mensagem \"Indexação Concluída\" no final, continue clicando em \"Continuar Indexação\" até que isso aconteça. Em meus blogs consegui indexar cerca de 400 páginas de uma só vez, mas precisei continuar o processo mais duas vezes para chegar a cerca de 950 páginas."
|
||||
|
||||
#: relevanssi.php:2228
|
||||
msgid ""
|
||||
"You can use any CSS styling here, style will be inserted with a\n"
|
||||
"\t\t<span>"
|
||||
msgstr "Você pode usar qualquer estilo CSS aqui, ele será inserido com a tag <code><span></code>"
|
||||
|
||||
#: relevanssi.php:2230
|
||||
msgid ""
|
||||
"Name a class here, search results will be wrapped in a <span>\n"
|
||||
"\t\twith the class"
|
||||
msgstr "Insira aqui o nome da classe e os resultados da busca serão encapsulados por uma tag <code><span></code> com esta classe"
|
||||
|
||||
# @ relevanssi
|
||||
#: relevanssi.php:2237
|
||||
msgid "All public post types"
|
||||
msgstr "Todos os tipos de post públicos"
|
||||
|
||||
# @ relevanssi
|
||||
#: relevanssi.php:2238
|
||||
msgid ""
|
||||
"This determines which post types are included in the index. Choosing\n"
|
||||
"\t\t'everything' will include posts, pages and all custom post types. 'All public post types'\n"
|
||||
"\t\tincludes all registered post types that don't have the 'exclude_from_search' set to true.\n"
|
||||
"\t\tThis includes post, page, attachment, and possible custom types. 'All public types'\n"
|
||||
"\t\trequires at least WP 2.9, otherwise it's the same as 'everything'."
|
||||
msgstr "Isso determina quais tipos de posts serão indexados. Ao escolher \"Tudo\" serão incluídos todos os posts, páginas e posts personalizados. \"Todos os tipos de post públicos\" inclui todos os tipos de posts públicos que não possuam o atributo \"exclude_from_search\" definido como verdadeiro, o que inclui posts, páginas, anexos e possivelmente posts personalizados. A opção \"Todos os tipos de post públicos\" requer Wordpress 2.9 ou superior, caso contrário será o mesmo que \"Tudo\"."
|
||||
|
||||
# @ relevanssi
|
||||
#: relevanssi.php:2244
|
||||
msgid ""
|
||||
"If you don't want to index all custom post types, list here the custom\n"
|
||||
"\t\tpost types you want to see indexed. List comma-separated post type names (as used in the\n"
|
||||
"\t\tdatabase). You can also use a hidden field in the search form to restrict the search to a\n"
|
||||
"\t\tcertain post type: <code><input type='hidden' name='post_type' value='comma-separated\n"
|
||||
"\t\tlist of post types' /></code>. If you choose 'All public post types' or 'Everything'\n"
|
||||
"\t\tabove, this option has no effect."
|
||||
msgstr "Se você não quiser indexar todos os tipos de post personalizados, liste aqui quais são os tipos que você quer indexar. Insira os nomes dos tipos de posts em uma lista separada por vírgula. Você pode também usar um campo hidden no formário de busca para restringir a busca em um determinado tipo de post: <code><input type='hidden' name='post_type' value='lista de tipos de posts' /></code>. Se na opção anterior você escolheu \"Todos os tipos de posts públicos\" ou \"Tudo\", essa opção não terá efeito."
|
||||
|
||||
#: relevanssi.php:2252
|
||||
msgid ""
|
||||
"A comma-separated list of custom field names to include in the\n"
|
||||
"\t\tindex."
|
||||
msgstr "Uma lista separada por vírgula de nomes de campos personalizados a serem incluídos no índice."
|
||||
|
||||
#: relevanssi.php:2256
|
||||
msgid ""
|
||||
"A comma-separated list of custom taxonomies to include in the\n"
|
||||
"\t\tindex."
|
||||
msgstr "Uma lista separada por vírgula de nomes de taxonomias personalizadas a serem incluídos no índice."
|
||||
|
||||
#: relevanssi.php:2260
|
||||
msgid ""
|
||||
"Check this to show more information on where the search hits were\n"
|
||||
"\t\tmade. Requires custom snippets to work."
|
||||
msgstr "Marque esta opção para exibir mais informações sobre onde os termos buscados foram encontrados. Para essa opção funcionar, é preciso habilitar os resumos personalizados."
|
||||
|
||||
#: relevanssi.php:2271
|
||||
msgid ""
|
||||
"Straight search matches just the term. Fuzzy search matches everything\n"
|
||||
"\t\tthat begins or ends with the search term."
|
||||
msgstr "Busca direta encontra apenas o termo buscado. Busca fuzzy irá encontrar tudo que começa ou termina com o termo buscado."
|
||||
|
||||
# @ relevanssi
|
||||
#: relevanssi.php:2275
|
||||
msgid ""
|
||||
"If checked, Relevanssi will expand shortcodes in post content\n"
|
||||
"\t\tbefore indexing. Otherwise shortcodes will be stripped. If you use shortcodes to\n"
|
||||
"\t\tinclude dynamic content, Relevanssi will not keep the index updated, the index will\n"
|
||||
"\t\treflect the status of the shortcode content at the moment of indexing."
|
||||
msgstr "Se esta opção estiver marcada, Relevanssi irá converter os shortcodes no conteúdo do post antes de indexar. Caso contrário, os shortcodes serão removidos. Se você utiliza shortcodes para incluir conteúdo dinâmico, Relevanssi não manterá o índice atualizado. Ou seja, será utilizado o conteúdo gerado pelo shortcode no momento da indexação."
|
||||
|
||||
# @ relevanssi
|
||||
#: relevanssi.php:2281
|
||||
msgid ""
|
||||
"If you want to uninstall the plugin, start by clicking the button\n"
|
||||
"\t\tbelow to wipe clean the options and tables created by the plugin, then remove it from\n"
|
||||
"\t\tthe plugins list."
|
||||
msgstr "Se quiser desinstalar o plugin, comece clicando no botão abaixo para remover todas as opções e todas as tabelas criadas pelo plugin, e então remova-o da lista de plugins."
|
||||
|
||||
#: relevanssi.php:2172
|
||||
msgid "Index and search your posts' authors:"
|
||||
msgstr "Indexar e buscar os autores dos posts:"
|
||||
|
||||
#: relevanssi.php:2173
|
||||
msgid ""
|
||||
"If checked, Relevanssi will also index and search the authors of your\n"
|
||||
"\t\tposts. Author display name will be indexed. Remember to rebuild the index if you change\n"
|
||||
"\t\tthis option!"
|
||||
msgstr "Se esta opção estiver marcada, Relevanssi irá indexar e realizar buscas nos autores de seus posts. Lembre-se de reconstruir o índice se você mudar esta opção!"
|
||||
|
||||
# @ relevanssi
|
||||
#: relevanssi.php:2286
|
||||
msgid "State of the Index"
|
||||
msgstr "Estatísticas do Índice"
|
||||
|
||||
# @ relevanssi
|
||||
#: relevanssi.php:2287
|
||||
msgid "Highest post ID indexed"
|
||||
msgstr "Último ID indexado"
|
||||
|
||||
#: relevanssi.php:2288
|
||||
msgid "Documents in the index"
|
||||
msgstr "Registros no índice"
|
||||
|
||||
# @ relevanssi
|
||||
#: relevanssi.php:2289
|
||||
msgid "Basic options"
|
||||
msgstr "Opções Básicas"
|
||||
|
||||
# @ relevanssi
|
||||
#: relevanssi.php:2291
|
||||
msgid "Default operator for the search?"
|
||||
msgstr "Operador padrão para a busca?"
|
||||
|
||||
# @ relevanssi
|
||||
#: relevanssi.php:2292
|
||||
msgid "AND - require all terms"
|
||||
msgstr "E - necessita de todos os termos"
|
||||
|
||||
# @ relevanssi
|
||||
#: relevanssi.php:2293
|
||||
msgid "OR - any term present is enough"
|
||||
msgstr "OU - qualquer termo presente é o bastante"
|
||||
|
||||
# @ relevanssi
|
||||
#: relevanssi.php:2294
|
||||
msgid "If you choose AND and the search finds no matches, it will automatically do an OR search."
|
||||
msgstr "Se escolher E e a busca não encontrar resultados, uma nova busca do tipo OU será feita automaticamente."
|
||||
|
||||
# @ relevanssi
|
||||
#: relevanssi.php:2296
|
||||
msgid "Don't log queries from these users:"
|
||||
msgstr "Não armazenar registros de buscas destes usuários:"
|
||||
|
||||
#: relevanssi.php:2297
|
||||
msgid "Comma-separated list of user ids that will not be logged."
|
||||
msgstr "Uma lista separada por vírgula de usuários que não terão suas buscas registradas."
|
||||
|
||||
# @ relevanssi
|
||||
#: relevanssi.php:2299
|
||||
msgid "Synonyms"
|
||||
msgstr "Sinônimos"
|
||||
|
||||
# @ relevanssi
|
||||
#: relevanssi.php:2300
|
||||
msgid "Add synonyms here in 'key = value' format. When searching with the OR operator, any search of 'key' will be expanded to include 'value' as well. Using phrases is possible. The key-value pairs work in one direction only, but you can of course repeat the same pair reversed."
|
||||
msgstr "Adicione sinônimos no formato \"chave = valor\". Quando for feita uma busca do tipo OU, qualquer busca por <strong>\"chave\"</strong> será expandida para incluir <strong>\"valor\"</strong> também. É possível utilizar frases. Os pares chave-valor funcionam apenas em uma direção, mas claro que você pode repetir o mesmo par em ordem inversa."
|
||||
|
||||
#: relevanssi.php:2177
|
||||
msgid "Index and search post excerpts:"
|
||||
msgstr "Indexar e buscar os resumos dos posts:"
|
||||
|
||||
#: relevanssi.php:2178
|
||||
msgid ""
|
||||
"If checked, Relevanssi will also index and search the excerpts of your\n"
|
||||
"\t\tposts.Remember to rebuild the index if you change this option!"
|
||||
msgstr "Se esta opção estiver marcada, Relevanssi irá indexar e realizar buscas nos resumos de seus posts. Lembre-se de reconstruir o índice se você mudar esta opção!"
|
||||
|
||||
# @ relevanssi
|
||||
#: relevanssi.php:2263
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Use %body%, %title%, %tags% and %comments% to display the number of\n"
|
||||
"\t\thits (in different parts of the post), %total% for total hits, %score% to display the document weight and %terms% to\n"
|
||||
"\t\tshow how many hits each search term got. No double quotes (\") allowed!"
|
||||
msgstr "Utilize %body%, %title%, %tags% e %comments% para exibir o número de hits, %total% para o total de hits, %score% para exibir a relevância e %terms% para exibir quantas vezes cada termo buscado foi encontrado. Aspas duplas (\") não são permitidas aqui!"
|
||||
|
||||
#~ msgid "Save"
|
||||
#~ msgstr "Gravar"
|
||||
#~ msgid ""
|
||||
#~ "Use %body%, %title%, %tags%, %comments% and %score% to display the number "
|
||||
#~ "of hits and the document weight."
|
||||
#~ msgstr ""
|
||||
#~ "Use %body%, %title%, %tags%, %comments% e %score% para exibir o número de "
|
||||
#~ "hits e o peso do resultado."
|
||||
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -0,0 +1,148 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"POT-Creation-Date: \n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: Mikko Saari <mikko@mikkosaari.fi>\n"
|
||||
"Language-Team: \n"
|
||||
"Language: fi\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 2.3\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#: src/index.js:151
|
||||
msgid "not this"
|
||||
msgstr "ei tätä"
|
||||
|
||||
#: src/index.js:174
|
||||
msgid "use this"
|
||||
msgstr "käytä tätä"
|
||||
|
||||
#: src/index.js:199
|
||||
msgid "How Relevanssi sees this post"
|
||||
msgstr "Kuinka Relevanssi näkee artikkelin"
|
||||
|
||||
#: src/index.js:203
|
||||
msgid "Title:"
|
||||
msgstr "Otsikko:"
|
||||
|
||||
#: src/index.js:210
|
||||
msgid "Content:"
|
||||
msgstr "Sisältö:"
|
||||
|
||||
#: src/index.js:217
|
||||
msgid "Author:"
|
||||
msgstr "Tekijä:"
|
||||
|
||||
#: src/index.js:224
|
||||
msgid "Categories:"
|
||||
msgstr "Aiheet:"
|
||||
|
||||
#: src/index.js:231
|
||||
msgid "Tags:"
|
||||
msgstr "Avainsanat:"
|
||||
|
||||
#: src/index.js:238
|
||||
msgid "Other taxonomies:"
|
||||
msgstr "Muut taksonomiat:"
|
||||
|
||||
#: src/index.js:245
|
||||
msgid "Comments:"
|
||||
msgstr "Kommentit:"
|
||||
|
||||
#: src/index.js:252
|
||||
msgid "Custom fields:"
|
||||
msgstr "Avainkentät:"
|
||||
|
||||
#: src/index.js:259
|
||||
msgid "Excerpt:"
|
||||
msgstr "Ote:"
|
||||
|
||||
#: src/index.js:266
|
||||
msgid "Links to this post:"
|
||||
msgstr "Sisäiset linkit:"
|
||||
|
||||
#: src/index.js:273
|
||||
msgid "MySQL columns:"
|
||||
msgstr "MySQL-sarakkeet:"
|
||||
|
||||
#: src/index.js:281
|
||||
msgid "Reason this post is not indexed:"
|
||||
msgstr "Miksi tätä artikkelia ei ole indeksoitu:"
|
||||
|
||||
#: src/index.js:290
|
||||
msgid "Pinning"
|
||||
msgstr "Artikkelin kiinnittäminen"
|
||||
|
||||
#: src/index.js:294
|
||||
msgid "Pin this post for all searches it appears in."
|
||||
msgstr "Kiinnitä tämä artikkeli kärkeen kaikissa hauissa, joissa se esiintyy."
|
||||
|
||||
#: src/index.js:304
|
||||
msgid ""
|
||||
"A comma-separated list of single word keywords or multi-word phrases. If any "
|
||||
"of these keywords are present in the search query, this post will be moved "
|
||||
"on top of the search results."
|
||||
msgstr ""
|
||||
"Pilkuilla erotettu lista yksittäisiä hakusanoja tai monisanaisia "
|
||||
"hakulauseita. Jos joku näistä hakusanoista esiintyy käyttäjän haussa, tämä "
|
||||
"artikkeli kiinnitetään hakutulosten huipulle."
|
||||
|
||||
#: src/index.js:314
|
||||
msgid "Exclusion"
|
||||
msgstr "Artikkelien poissulkeminen"
|
||||
|
||||
#: src/index.js:319
|
||||
msgid "Exclude this post or page from the index."
|
||||
msgstr "Poista tämä artikkeli indeksistä."
|
||||
|
||||
#: src/index.js:329
|
||||
msgid ""
|
||||
"A comma-separated list of single word keywords or multi-word phrases. If any "
|
||||
"of these keywords are present in the search query, this post will be removed "
|
||||
"from the search results."
|
||||
msgstr ""
|
||||
"Pilkuilla erotettu lista yksittäisiä hakusanoja tai monisanaisia "
|
||||
"hakulauseita. Jos joku näistä hakusanoista esiintyy käyttäjän haussa, tämä "
|
||||
"artikkeli poistetaan hakutuloksista."
|
||||
|
||||
#: src/index.js:341
|
||||
msgid "Related posts"
|
||||
msgstr "Aiheeseen liittyvät artikkelit"
|
||||
|
||||
#: src/index.js:346
|
||||
msgid "Don't append the related posts to this page."
|
||||
msgstr "Älä lisää samankaltaisia artikkeleita tälle sivulle."
|
||||
|
||||
#: src/index.js:356
|
||||
msgid "Don't show this as a related post for any post."
|
||||
msgstr "Älä näytä tätä samankaltaisena artikkelina millään sivulla."
|
||||
|
||||
#: src/index.js:366
|
||||
msgid ""
|
||||
"A comma-separated list of keywords to use for the Related Posts feature. "
|
||||
"Anything entered here will used when searching for related posts. Using "
|
||||
"phrases with quotes is allowed, but will restrict the related posts to posts "
|
||||
"including that phrase."
|
||||
msgstr ""
|
||||
"Pilkulla erotettu lista avainsanoja samankaltaisten artikkelien etsimiseen. "
|
||||
"Tähän merkittyjä hakusanoja käytetään samankaltaisten artikkelien "
|
||||
"etsimiseen. Voit käyttää fraasihakua lainausmerkeillä, mutta se rajoittaa "
|
||||
"samankaltaiset artikkelit niihin, joissa fraasi esiintyy."
|
||||
|
||||
#: src/index.js:376
|
||||
msgid ""
|
||||
"A comma-separated list of post IDs to use as related posts for this post"
|
||||
msgstr ""
|
||||
"Pilkuilla erotettu lista tämän artikkelin liittyvinä artikkeleina "
|
||||
"käytettävien artikkelien ID-numeroista"
|
||||
|
||||
#: src/index.js:383
|
||||
msgid "Related posts for this post:"
|
||||
msgstr "Samankaltaiset artikkelit:"
|
||||
|
||||
#: src/index.js:386
|
||||
msgid "Excluded posts for this post:"
|
||||
msgstr "Älä käytä samankaltaisina artikkeleina tälle artikkelille:"
|
||||
@@ -0,0 +1,154 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"X-Generator: babel-plugin-makepot\n"
|
||||
|
||||
#: src/index.js:152
|
||||
msgid "not this"
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:175
|
||||
msgid "use this"
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:224
|
||||
msgid "How Relevanssi sees this post"
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:228
|
||||
msgid "Title:"
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:235
|
||||
msgid "Content:"
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:242
|
||||
msgid "Author:"
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:249
|
||||
msgid "Categories:"
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:256
|
||||
msgid "Tags:"
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:263
|
||||
msgid "Other taxonomies:"
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:270
|
||||
msgid "Comments:"
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:277
|
||||
msgid "Custom fields:"
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:284
|
||||
msgid "Excerpt:"
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:291
|
||||
msgid "Links to this post:"
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:298
|
||||
msgid "MySQL columns:"
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:306
|
||||
msgid "Reason this post is not indexed:"
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:315
|
||||
msgid "Pinning"
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:319
|
||||
msgid "Pin this post for all searches it appears in."
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:338
|
||||
msgid ""
|
||||
"If any of these keywords are present in the search query, this post will be "
|
||||
"moved on top of the search results."
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:343
|
||||
msgid ""
|
||||
"You can add weights to pinned keywords like this: 'keyword (100)'. The post "
|
||||
"with the highest weight will be sorted first if there are multiple posts "
|
||||
"pinned to the same keyword."
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:349
|
||||
msgid "Exclusion"
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:354
|
||||
msgid "Exclude this post or page from the index."
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:364
|
||||
msgid "Ignore post content in the indexing."
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:374
|
||||
msgid "A comma-separated list of single word keywords or multi-word phrases."
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:383
|
||||
msgid ""
|
||||
"If any of these keywords are present in the search query, this post will be "
|
||||
"removed from the search results."
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:391
|
||||
msgid "Related posts"
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:396
|
||||
msgid "Don't append the related posts to this page."
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:406
|
||||
msgid "Don't show this as a related post for any post."
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:416
|
||||
msgid "A comma-separated list of keywords to use for the Related Posts feature."
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:425
|
||||
msgid ""
|
||||
"Anything entered here will used when searching for related posts. Using "
|
||||
"phrases with quotes is allowed, but will restrict the related posts to "
|
||||
"posts including that phrase."
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:431
|
||||
msgid "A comma-separated list of post IDs to use as related posts for this post"
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:438
|
||||
msgid "Related posts for this post:"
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:441
|
||||
msgid "Excluded posts for this post:"
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:446
|
||||
msgid "Insights"
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:448
|
||||
msgid "The most common search terms used to find this post:"
|
||||
msgstr ""
|
||||
|
||||
#: src/index.js:455
|
||||
msgid "Low-ranking search terms used to find this post:"
|
||||
msgstr ""
|
||||
@@ -0,0 +1 @@
|
||||
{"translation-revision-date":"2023-04-23 03:33:04+0000","generator":"GlotPress\/4.0.0-alpha.3","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=2; plural=n != 1;","lang":"sv_SE"},"Insights":["Inblickar"]}},"comment":{"reference":"index.js"}}
|
||||
470
wp/wp-content/plugins/relevanssi-premium/lib/admin-ajax.php
Normal file
470
wp/wp-content/plugins/relevanssi-premium/lib/admin-ajax.php
Normal file
@@ -0,0 +1,470 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/admin-ajax.php
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_action( 'wp_ajax_relevanssi_truncate_index', 'relevanssi_truncate_index_ajax_wrapper' );
|
||||
add_action( 'wp_ajax_relevanssi_index_posts', 'relevanssi_index_posts_ajax_wrapper' );
|
||||
add_action( 'wp_ajax_relevanssi_count_posts', 'relevanssi_count_posts_ajax_wrapper' );
|
||||
add_action( 'wp_ajax_relevanssi_count_missing_posts', 'relevanssi_count_missing_posts_ajax_wrapper' );
|
||||
add_action( 'wp_ajax_relevanssi_list_categories', 'relevanssi_list_categories' );
|
||||
add_action( 'wp_ajax_relevanssi_admin_search', 'relevanssi_admin_search' );
|
||||
add_action( 'wp_ajax_relevanssi_update_counts', 'relevanssi_update_counts' );
|
||||
add_action( 'wp_ajax_nopriv_relevanssi_update_counts', 'relevanssi_update_counts' );
|
||||
add_action( 'wp_ajax_relevanssi_list_custom_fields', 'relevanssi_list_custom_fields' );
|
||||
|
||||
/**
|
||||
* Checks if current user can access Relevanssi options.
|
||||
*
|
||||
* If the current user doesn't have sufficient access to Relevanssi options,
|
||||
* the function will die. If the user has access, nothing happens.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function relevanssi_current_user_can_access_options() {
|
||||
/**
|
||||
* Filters the capability required to access Relevanssi options.
|
||||
*
|
||||
* @param string The capability required. Default 'manage_options'.
|
||||
*/
|
||||
if ( ! current_user_can( apply_filters( 'relevanssi_options_capability', 'manage_options' ) ) ) {
|
||||
wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'relevanssi' ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Truncates the Relevanssi index.
|
||||
*
|
||||
* Wipes the index clean using relevanssi_truncate_index().
|
||||
*/
|
||||
function relevanssi_truncate_index_ajax_wrapper() {
|
||||
check_ajax_referer( 'relevanssi_indexing_nonce', 'security' );
|
||||
relevanssi_current_user_can_access_options();
|
||||
|
||||
$response = relevanssi_truncate_index();
|
||||
echo wp_json_encode( $response );
|
||||
wp_die();
|
||||
}
|
||||
|
||||
/**
|
||||
* Indexes posts in AJAX context.
|
||||
*
|
||||
* AJAX wrapper for indexing posts. Parses the arguments, uses the
|
||||
* relevanssi_build_index() to do the hard work, then creates the AJAX response.
|
||||
*/
|
||||
function relevanssi_index_posts_ajax_wrapper() {
|
||||
check_ajax_referer( 'relevanssi_indexing_nonce', 'security' );
|
||||
relevanssi_current_user_can_access_options();
|
||||
|
||||
$completed = absint( $_POST['completed'] );
|
||||
$total = absint( $_POST['total'] );
|
||||
$offset = absint( $_POST['offset'] );
|
||||
$limit = absint( $_POST['limit'] );
|
||||
$extend = strval( $_POST['extend'] );
|
||||
|
||||
if ( 'true' === $extend ) {
|
||||
$extend = true;
|
||||
}
|
||||
|
||||
if ( $limit < 1 ) {
|
||||
$limit = 1;
|
||||
}
|
||||
|
||||
$response = array();
|
||||
|
||||
$is_ajax = true;
|
||||
$verbose = false;
|
||||
if ( $extend ) {
|
||||
$offset = true;
|
||||
}
|
||||
|
||||
$indexing_response = relevanssi_build_index( $offset, $verbose, $limit, $is_ajax );
|
||||
|
||||
if ( $indexing_response['indexing_complete'] ) {
|
||||
$response['completed'] = 'done';
|
||||
$response['percentage'] = 100;
|
||||
$completed += $indexing_response['indexed'];
|
||||
$response['total_posts'] = $completed;
|
||||
$processed = $total;
|
||||
} else {
|
||||
$completed += $indexing_response['indexed'];
|
||||
$response['completed'] = $completed;
|
||||
|
||||
if ( true === $offset ) {
|
||||
$processed = $completed;
|
||||
} else {
|
||||
$offset = $offset + $limit;
|
||||
$processed = $offset;
|
||||
}
|
||||
|
||||
if ( $total > 0 ) {
|
||||
$response['percentage'] = $processed / $total * 100;
|
||||
} else {
|
||||
$response['percentage'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$response['feedback'] = sprintf(
|
||||
// translators: Number of posts indexed on this go, total number of posts indexed so far, number of posts processed on this go, total number of posts to process.
|
||||
_n(
|
||||
'Indexed %1$d post (total %2$d), processed %3$d / %4$d.',
|
||||
'Indexed %1$d posts (total %2$d), processed %3$d / %4$d.',
|
||||
$indexing_response['indexed'],
|
||||
'relevanssi'
|
||||
),
|
||||
$indexing_response['indexed'],
|
||||
$completed,
|
||||
$processed,
|
||||
$total
|
||||
) . "\n";
|
||||
$response['offset'] = $offset;
|
||||
|
||||
echo wp_json_encode( $response );
|
||||
wp_die();
|
||||
}
|
||||
|
||||
/**
|
||||
* Counts the posts to index.
|
||||
*
|
||||
* AJAX wrapper for relevanssi_count_total_posts().
|
||||
*/
|
||||
function relevanssi_count_posts_ajax_wrapper() {
|
||||
relevanssi_current_user_can_access_options();
|
||||
|
||||
$count = relevanssi_count_total_posts();
|
||||
echo wp_json_encode( $count );
|
||||
wp_die();
|
||||
}
|
||||
|
||||
/**
|
||||
* Counts the posts missing from the index.
|
||||
*
|
||||
* AJAX wrapper for relevanssi_count_missing_posts().
|
||||
*/
|
||||
function relevanssi_count_missing_posts_ajax_wrapper() {
|
||||
relevanssi_current_user_can_access_options();
|
||||
|
||||
$count = relevanssi_count_missing_posts();
|
||||
echo wp_json_encode( $count );
|
||||
wp_die();
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists categories.
|
||||
*
|
||||
* AJAX wrapper for get_categories().
|
||||
*/
|
||||
function relevanssi_list_categories() {
|
||||
relevanssi_current_user_can_access_options();
|
||||
|
||||
$categories = get_categories(
|
||||
array(
|
||||
'taxonomy' => 'category',
|
||||
'hide_empty' => false,
|
||||
)
|
||||
);
|
||||
echo wp_json_encode( $categories );
|
||||
wp_die();
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an admin search.
|
||||
*
|
||||
* Performs an admin dashboard search.
|
||||
*
|
||||
* @since 2.2.0
|
||||
*/
|
||||
function relevanssi_admin_search() {
|
||||
check_ajax_referer( 'relevanssi_admin_search_nonce', 'security' );
|
||||
/**
|
||||
* Filters the capability required to access Relevanssi admin search page.
|
||||
*
|
||||
* @param string The capability required. Default 'edit_posts'.
|
||||
*/
|
||||
if ( ! current_user_can( apply_filters( 'relevanssi_admin_search_capability', 'edit_posts' ) ) ) {
|
||||
wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'relevanssi' ) );
|
||||
}
|
||||
|
||||
$args = array();
|
||||
if ( isset( $_POST['args'] ) ) {
|
||||
parse_str( $_POST['args'], $args );
|
||||
}
|
||||
if ( isset( $_POST['posts_per_page'] ) ) {
|
||||
$posts_per_page = intval( $_POST['posts_per_page'] );
|
||||
if ( $posts_per_page > 0 ) {
|
||||
$args['posts_per_page'] = $posts_per_page;
|
||||
}
|
||||
}
|
||||
if ( isset( $_POST['post_types'] ) ) {
|
||||
$post_type = $_POST['post_types'];
|
||||
$args['post_types'] = $post_type;
|
||||
}
|
||||
if ( isset( $_POST['offset'] ) ) {
|
||||
$offset = intval( $_POST['offset'] );
|
||||
if ( $offset > 0 ) {
|
||||
$args['offset'] = $offset;
|
||||
}
|
||||
}
|
||||
if ( isset( $_POST['s'] ) ) {
|
||||
$args['s'] = $_POST['s'];
|
||||
}
|
||||
|
||||
$query = new WP_Query();
|
||||
$query->parse_query( $args );
|
||||
$query->set( 'relevanssi_admin_search', true );
|
||||
$query = apply_filters( 'relevanssi_modify_wp_query', $query );
|
||||
relevanssi_do_query( $query );
|
||||
|
||||
$results = relevanssi_admin_search_debugging_info( $query );
|
||||
|
||||
// Take the posts array and create a string out of it.
|
||||
$offset = 0;
|
||||
if ( isset( $query->query_vars['offset'] ) ) {
|
||||
$offset = $query->query_vars['offset'];
|
||||
}
|
||||
$results .= relevanssi_admin_search_format_posts( $query->posts, $query->found_posts, $offset, $args['s'] );
|
||||
|
||||
echo wp_json_encode( $results );
|
||||
wp_die();
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the posts for admin search.
|
||||
*
|
||||
* Results are presented as an ordered list of posts. The format is very basic, and
|
||||
* can be modified with the 'relevanssi_admin_search_element' filter hook.
|
||||
*
|
||||
* @param array $posts The posts array.
|
||||
* @param int $total The number of posts found in total.
|
||||
* @param int $offset Offset value.
|
||||
* @param string $query The search query.
|
||||
*
|
||||
* @return string The formatted posts.
|
||||
*
|
||||
* @since 2.2.0
|
||||
*/
|
||||
function relevanssi_admin_search_format_posts( $posts, $total, $offset, $query ) {
|
||||
$result = '<h3>' . __( 'Results', 'relevanssi' ) . '</h3>';
|
||||
$start = $offset + 1;
|
||||
$end = $offset + count( $posts );
|
||||
// Translators: %1$d is the total number of posts found, %2$d is the current search result count, %3$d is the offset.
|
||||
$result .= '<p>' . sprintf( __( 'Found a total of %1$d posts, showing posts %2$d–%3$s.', 'relevanssi' ), $total, $start, '<span id="offset">' . $end . '</span>' ) . '</p>';
|
||||
if ( $offset > 0 ) {
|
||||
$result .= sprintf( '<button type="button" id="prev_page">%s</button>', __( 'Previous page', 'relevanssi' ) );
|
||||
}
|
||||
if ( count( $posts ) + $offset < $total ) {
|
||||
$result .= sprintf( '<button type="button" id="next_page">%s</button>', __( 'Next page', 'relevanssi' ) );
|
||||
}
|
||||
$result .= '<ol start="' . $start . '">';
|
||||
|
||||
$score_label = __( 'Score:', 'relevanssi' );
|
||||
|
||||
foreach ( $posts as $post ) {
|
||||
$blog_name = '';
|
||||
if ( isset( $post->blog_id ) && function_exists( 'switch_to_blog' ) ) {
|
||||
switch_to_blog( $post->blog_id );
|
||||
$blog_name = get_bloginfo( 'name' ) . ': ';
|
||||
}
|
||||
$permalink = get_permalink( $post->ID );
|
||||
$edit_url = get_edit_post_link( $post->ID );
|
||||
$post_type = $post->post_type;
|
||||
if ( isset( $post->relevanssi_link ) ) {
|
||||
$permalink = $post->relevanssi_link;
|
||||
}
|
||||
if ( 'user' === $post->post_type ) {
|
||||
$edit_url = get_edit_user_link( $post->ID );
|
||||
}
|
||||
if ( empty( $edit_url ) ) {
|
||||
if ( isset( $post->term_id ) ) {
|
||||
$edit_url = get_edit_term_link( $post->term_id, $post->post_type );
|
||||
}
|
||||
}
|
||||
$title = sprintf( '<a href="%1$s">%2$s %3$s</a>', $permalink, $post->post_title, $post_type );
|
||||
$edit_link = '';
|
||||
if ( current_user_can( 'edit_post', $post->ID ) ) {
|
||||
$edit_link = sprintf( '(<a href="%1$s">%2$s %3$s</a>)', $edit_url, __( 'Edit', 'relevanssi' ), $post_type );
|
||||
}
|
||||
|
||||
$pinning_buttons = '';
|
||||
$pinned = '';
|
||||
|
||||
if ( function_exists( 'relevanssi_admin_search_pinning' ) ) {
|
||||
// Relevanssi Premium adds pinning features to the admin search.
|
||||
list( $pinning_buttons, $pinned ) = relevanssi_admin_search_pinning( $post, $query );
|
||||
}
|
||||
|
||||
$post_element = <<<EOH
|
||||
<li>$blog_name <strong>$title</strong> $edit_link $pinning_buttons <br />
|
||||
$post->post_excerpt<br />
|
||||
$score_label $post->relevance_score $pinned</li>
|
||||
EOH;
|
||||
/**
|
||||
* Filters the admin search results element.
|
||||
*
|
||||
* The post element is a <li> element. Feel free to edit the element any
|
||||
* way you want to.
|
||||
*
|
||||
* @param string $post_element The post element.
|
||||
* @param object $post The post object.
|
||||
*/
|
||||
$result .= apply_filters( 'relevanssi_admin_search_element', $post_element, $post );
|
||||
if ( isset( $post->blog_id ) && function_exists( 'restore_current_blog' ) ) {
|
||||
restore_current_blog();
|
||||
}
|
||||
}
|
||||
$result .= '</ol>';
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows debugging information about the search.
|
||||
*
|
||||
* Formats the WP_Query parameters, looks at some filter hooks and presents the
|
||||
* information in an easy-to-read format.
|
||||
*
|
||||
* @param WP_Query $query The WP_Query object.
|
||||
*
|
||||
* @return string The formatted debugging information.
|
||||
*
|
||||
* @since 2.2.0
|
||||
*/
|
||||
function relevanssi_admin_search_debugging_info( $query ) {
|
||||
$result = '<div id="debugging">';
|
||||
$result .= '<h3>' . __( 'Query variables', 'relevanssi' ) . '</h3>';
|
||||
$result .= '<ul style="list-style: disc; margin-left: 1.5em">';
|
||||
foreach ( $query->query_vars as $key => $value ) {
|
||||
if ( 'tax_query' === $key ) {
|
||||
$result .= '<li>tax_query:<ul style="list-style: disc; margin-left: 1.5em">';
|
||||
$result .= implode(
|
||||
'',
|
||||
array_map(
|
||||
function ( $row ) {
|
||||
$result = '';
|
||||
if ( is_array( $row ) ) {
|
||||
foreach ( $row as $row_key => $row_value ) {
|
||||
$result .= "<li>$row_key: $row_value</li>";
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
},
|
||||
$value
|
||||
)
|
||||
);
|
||||
$result .= '</ul></li>';
|
||||
} else {
|
||||
if ( is_array( $value ) ) {
|
||||
$value = relevanssi_flatten_array( $value );
|
||||
}
|
||||
if ( empty( $value ) ) {
|
||||
continue;
|
||||
}
|
||||
$result .= "<li>$key: $value</li>";
|
||||
}
|
||||
}
|
||||
if ( ! empty( $query->tax_query ) ) {
|
||||
$result .= '<li>tax_query:<ul style="list-style: disc; margin-left: 1.5em">';
|
||||
foreach ( $query->tax_query as $tax_query ) {
|
||||
if ( ! is_array( $tax_query ) ) {
|
||||
continue;
|
||||
}
|
||||
foreach ( $tax_query as $key => $value ) {
|
||||
if ( is_array( $value ) ) {
|
||||
$value = relevanssi_flatten_array( $value );
|
||||
}
|
||||
$result .= "<li>$key: $value</li>";
|
||||
}
|
||||
}
|
||||
$result .= '</ul></li>';
|
||||
}
|
||||
$result .= '</ul>';
|
||||
|
||||
global $wp_filter;
|
||||
|
||||
$filters = array(
|
||||
'relevanssi_search_ok',
|
||||
'relevanssi_modify_wp_query',
|
||||
'relevanssi_search_filters',
|
||||
'relevanssi_where',
|
||||
'relevanssi_join',
|
||||
'relevanssi_fuzzy_query',
|
||||
'relevanssi_exact_match_bonus',
|
||||
'relevanssi_query_filter',
|
||||
'relevanssi_match',
|
||||
'relevanssi_post_ok',
|
||||
'relevanssi_search_again',
|
||||
'relevanssi_results',
|
||||
'relevanssi_orderby',
|
||||
'relevanssi_order',
|
||||
'relevanssi_default_tax_query_relation',
|
||||
'relevanssi_hits_filter',
|
||||
);
|
||||
|
||||
$result .= '<h3>' . __( 'Filters', 'relevanssi' ) . '</h3>';
|
||||
$result .= '<button type="button" id="show_filters">' . __( 'show', 'relevanssi' ) . '</button>';
|
||||
$result .= '<button type="button" id="hide_filters" style="display: none">' . __( 'hide', 'relevanssi' ) . '</button>';
|
||||
$result .= '<div id="relevanssi_filter_list">';
|
||||
foreach ( $filters as $filter ) {
|
||||
if ( isset( $wp_filter[ $filter ] ) ) {
|
||||
$result .= '<h4>' . $filter . '</h4>';
|
||||
$result .= '<ul style="list-style: disc; margin-left: 1.5em">';
|
||||
foreach ( $wp_filter[ $filter ] as $priority => $functions ) {
|
||||
foreach ( $functions as $function ) {
|
||||
if ( $function['function'] instanceof Closure ) {
|
||||
$function['function'] = 'Anonymous function';
|
||||
}
|
||||
$result .= "<li>$priority: " . $function['function'] . '</li>';
|
||||
}
|
||||
}
|
||||
$result .= '</ul>';
|
||||
}
|
||||
}
|
||||
$result .= '</div>';
|
||||
$result .= '</div>';
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates count options.
|
||||
*
|
||||
* Updates 'relevanssi_doc_count', 'relevanssi_terms_count' (and in Premium
|
||||
* 'relevanssi_user_count' and 'relevanssi_taxterm_count'). These are slightly
|
||||
* expensive queries, so they are updated when necessary as a non-blocking AJAX
|
||||
* action and stored in options for quick retrieval.
|
||||
*
|
||||
* @global object $wpdb The WordPress database interface.
|
||||
* @global array $relevanssi_variables The Relevanssi global variable, used for table names.
|
||||
*/
|
||||
function relevanssi_update_counts() {
|
||||
global $wpdb, $relevanssi_variables;
|
||||
|
||||
relevanssi_update_doc_count();
|
||||
|
||||
$terms_count = $wpdb->get_var( 'SELECT COUNT(*) FROM ' . $relevanssi_variables['relevanssi_table'] ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.PreparedSQL.NotPrepared
|
||||
update_option( 'relevanssi_terms_count', is_null( $terms_count ) ? 0 : $terms_count, false );
|
||||
|
||||
if ( RELEVANSSI_PREMIUM ) {
|
||||
$user_count = $wpdb->get_var( 'SELECT COUNT(DISTINCT item) FROM ' . $relevanssi_variables['relevanssi_table'] . " WHERE type = 'user'" ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.PreparedSQL.NotPrepared
|
||||
$taxterm_count = $wpdb->get_var( 'SELECT COUNT(DISTINCT item) FROM ' . $relevanssi_variables['relevanssi_table'] . " WHERE (type != 'post' AND type != 'attachment' AND type != 'user')" ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.PreparedSQL.NotPrepared
|
||||
|
||||
update_option( 'relevanssi_user_count', is_null( $user_count ) ? 0 : $user_count, false );
|
||||
update_option( 'relevanssi_taxterm_count', is_null( $taxterm_count ) ? 0 : $taxterm_count, false );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a comma-separated list of indexed custom field names.
|
||||
*
|
||||
* @uses relevanssi_list_all_indexed_custom_fields()
|
||||
*/
|
||||
function relevanssi_list_custom_fields() {
|
||||
$response = relevanssi_list_all_indexed_custom_fields();
|
||||
|
||||
echo wp_json_encode( $response );
|
||||
wp_die();
|
||||
}
|
||||
540
wp/wp-content/plugins/relevanssi-premium/lib/admin_scripts.js
Normal file
540
wp/wp-content/plugins/relevanssi-premium/lib/admin_scripts.js
Normal file
@@ -0,0 +1,540 @@
|
||||
/* Confirmation for copying options between blogs */
|
||||
|
||||
jQuery(document).ready(function ($) {
|
||||
$("#copy_config").on("submit", function () {
|
||||
var c = confirm(relevanssi.confirm)
|
||||
return c //you can just return c because it will be true or false
|
||||
})
|
||||
|
||||
$("#removeallstopwords").on("click", function () {
|
||||
var c = confirm(relevanssi.confirm_stopwords)
|
||||
return c
|
||||
})
|
||||
|
||||
$("#delete_query").on("click", function () {
|
||||
var c = confirm(relevanssi.confirm_delete_query)
|
||||
return c
|
||||
})
|
||||
|
||||
$("#list_custom_fields").on("click", function () {
|
||||
var results = $("#relevanssi_custom_field_list")
|
||||
var data = {
|
||||
action: "relevanssi_list_custom_fields",
|
||||
}
|
||||
jQuery.post(ajaxurl, data, function (response) {
|
||||
console.log(response)
|
||||
results.html('<p>' + JSON.parse(response) + '</p>')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
jQuery(document).ready(function ($) {
|
||||
$(".color-field").wpColorPicker()
|
||||
|
||||
var txtcol_control = $("#tr_relevanssi_txt_col")
|
||||
var bgcol_control = $("#tr_relevanssi_bg_col")
|
||||
var class_control = $("#tr_relevanssi_class")
|
||||
var css_control = $("#tr_relevanssi_css")
|
||||
|
||||
$("#relevanssi_highlight").on("change", function () {
|
||||
txtcol_control.addClass("screen-reader-text")
|
||||
bgcol_control.addClass("screen-reader-text")
|
||||
class_control.addClass("screen-reader-text")
|
||||
css_control.addClass("screen-reader-text")
|
||||
|
||||
if (this.value == "col") txtcol_control.toggleClass("screen-reader-text")
|
||||
if (this.value == "bgcol") bgcol_control.toggleClass("screen-reader-text")
|
||||
if (this.value == "class") class_control.toggleClass("screen-reader-text")
|
||||
if (this.value == "css") css_control.toggleClass("screen-reader-text")
|
||||
})
|
||||
|
||||
$("#relevanssi_hilite_title").on("click", function () {
|
||||
$("#title_description").toggleClass("screen-reader-text", !this.checked)
|
||||
})
|
||||
|
||||
var or_fallback = $("#orfallback")
|
||||
$("#relevanssi_implicit_operator").on("change", function () {
|
||||
or_fallback.toggleClass("screen-reader-text")
|
||||
})
|
||||
|
||||
var index_subscribers = $("#index_subscribers")
|
||||
var user_extra_fields = $("#user_extra_fields")
|
||||
$("#relevanssi_index_users").on("click", function () {
|
||||
$("#user_profile_notice").toggleClass("screen-reader-text", !this.checked)
|
||||
index_subscribers.toggleClass("screen-reader-text", !this.checked)
|
||||
user_extra_fields.toggleClass("screen-reader-text", !this.checked)
|
||||
})
|
||||
|
||||
var taxonomies = $("#taxonomies")
|
||||
$("#relevanssi_index_taxonomies").on("click", function () {
|
||||
taxonomies.toggleClass("screen-reader-text", !this.checked)
|
||||
})
|
||||
|
||||
var post_type_archives = $("#posttypearchives")
|
||||
$("#relevanssi_index_post_type_archives").on("click", function () {
|
||||
post_type_archives.toggleClass("screen-reader-text", !this.checked)
|
||||
})
|
||||
|
||||
var fields_content = $("#index_field_input")
|
||||
var fields_select = $("#relevanssi_index_fields_select")
|
||||
fields_select.on("change", function () {
|
||||
if (this.value == "some") fields_content.show()
|
||||
if (this.value != "some") fields_content.hide()
|
||||
})
|
||||
|
||||
var index_images = $("#row_index_image_files")
|
||||
var index_attachments = $("#relevanssi_index_type_attachment")
|
||||
index_attachments.on("click", function () {
|
||||
if (this.checked) index_images.show()
|
||||
if (!this.checked) index_images.hide()
|
||||
})
|
||||
|
||||
$("#show_advanced_indexing").on("click", function (e) {
|
||||
$("#advanced_indexing").toggleClass("screen-reader-text")
|
||||
$("#hide_advanced_indexing").show()
|
||||
$("#show_advanced_indexing").hide()
|
||||
})
|
||||
|
||||
$("#hide_advanced_indexing").on("click", function (e) {
|
||||
$("#advanced_indexing").toggleClass("screen-reader-text")
|
||||
$("#show_advanced_indexing").show()
|
||||
$("#hide_advanced_indexing").hide()
|
||||
})
|
||||
|
||||
$("#indexing_tab :input").on("change", function (e) {
|
||||
$("#build_index").attr("disabled", "disabled")
|
||||
var relevanssi_note = $("#relevanssi-note")
|
||||
relevanssi_note.show()
|
||||
relevanssi_note.html('<p class="description important">' + relevanssi.options_changed + '</p>')
|
||||
})
|
||||
|
||||
$("#relevanssi_default_orderby").on("change", function (e) {
|
||||
if (this.value == "post_date") {
|
||||
$("#relevanssi_throttle").prop("checked", false)
|
||||
}
|
||||
$("#throttle_disabled").toggleClass("screen-reader-text")
|
||||
$("#throttle_enabled").toggleClass("screen-reader-text")
|
||||
})
|
||||
|
||||
$("#relevanssi_show_pdf_errors").on("click", function (e) {
|
||||
var error_box = $("#relevanssi_pdf_errors")
|
||||
error_box.toggle()
|
||||
var data = {
|
||||
action: "relevanssi_get_pdf_errors",
|
||||
}
|
||||
jQuery.post(ajaxurl, data, function (response) {
|
||||
error_box.val(JSON.parse(response))
|
||||
})
|
||||
})
|
||||
|
||||
$("#relevanssi_excerpts").on("click", function () {
|
||||
$("#relevanssi_breakdown").toggleClass("relevanssi_disabled", !this.checked)
|
||||
$("#relevanssi_highlighting").toggleClass(
|
||||
"relevanssi_disabled",
|
||||
!this.checked
|
||||
)
|
||||
$("#tr_excerpt_custom_fields").toggleClass(
|
||||
"relevanssi_disabled",
|
||||
!this.checked
|
||||
)
|
||||
$("#tr_excerpt_allowable_tags").toggleClass(
|
||||
"relevanssi_disabled",
|
||||
!this.checked
|
||||
)
|
||||
$("#tr_excerpt_length").toggleClass("relevanssi_disabled", !this.checked)
|
||||
$("#tr_max_excerpts").toggleClass("relevanssi_disabled", !this.checked)
|
||||
$("#relevanssi_excerpt_length").attr("disabled", !this.checked)
|
||||
$("#relevanssi_excerpt_type").attr("disabled", !this.checked)
|
||||
$("#relevanssi_max_excerpts").attr("disabled", !this.checked)
|
||||
$("#relevanssi_excerpt_allowable_tags").attr("disabled", !this.checked)
|
||||
$("#relevanssi_excerpt_custom_fields").attr("disabled", !this.checked)
|
||||
$("#relevanssi_highlight").attr("disabled", !this.checked)
|
||||
$("#relevanssi_txt_col").attr("disabled", !this.checked)
|
||||
$("#relevanssi_bg_col").attr("disabled", !this.checked)
|
||||
$("#relevanssi_css").attr("disabled", !this.checked)
|
||||
$("#relevanssi_class").attr("disabled", !this.checked)
|
||||
$("#relevanssi_hilite_title").attr("disabled", !this.checked)
|
||||
$("#relevanssi_highlight_docs").attr("disabled", !this.checked)
|
||||
$("#relevanssi_highlight_comments").attr("disabled", !this.checked)
|
||||
$("#relevanssi_show_matches").attr("disabled", !this.checked)
|
||||
$("#relevanssi_show_matches_text").attr("disabled", !this.checked)
|
||||
$("#relevanssi_expand_highlights").attr("disabled", !this.checked)
|
||||
})
|
||||
|
||||
$("#relevanssi_excerpt_custom_fields").on("change", function () {
|
||||
$("#relevanssi_excerpt_specific_fields").attr("disabled", !this.checked)
|
||||
})
|
||||
|
||||
$("#relevanssi_searchblogs_all").on("click", function () {
|
||||
$("#relevanssi_searchblogs").attr("disabled", this.checked)
|
||||
})
|
||||
|
||||
var min_word_length = $("#relevanssi_min_word_length")
|
||||
min_word_length.on("change", function(e) {
|
||||
if ( min_word_length.val() < 1 ) {
|
||||
min_word_length.val(1)
|
||||
}
|
||||
if ( min_word_length.val() > 9 ) {
|
||||
min_word_length.val(9)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
var time = 0
|
||||
var intervalID = 0
|
||||
|
||||
function relevanssiUpdateClock() {
|
||||
time++
|
||||
var time_formatted = rlv_format_time(Math.round(time))
|
||||
document.getElementById("relevanssi_elapsed").innerHTML = time_formatted
|
||||
}
|
||||
|
||||
jQuery(document).ready(function ($) {
|
||||
$("#continue_indexing").on("click", function () {
|
||||
$("#relevanssi-progress").show()
|
||||
$("#results").show()
|
||||
$("#relevanssi-timer").show()
|
||||
$("#stateoftheindex").html(relevanssi.reload_state)
|
||||
$("#indexing_button_instructions").hide()
|
||||
var results = document.getElementById("results")
|
||||
results.value = ""
|
||||
|
||||
intervalID = window.setInterval(relevanssiUpdateClock, 1000)
|
||||
|
||||
var data = {
|
||||
action: "relevanssi_count_missing_posts",
|
||||
}
|
||||
console.log("Counting posts.")
|
||||
results.value += relevanssi.counting_posts + " "
|
||||
jQuery.post(ajaxurl, data, function (response) {
|
||||
count_response = JSON.parse(response)
|
||||
console.log("Counted " + count_response + " posts.")
|
||||
results.value += count_response + " " + relevanssi.posts_found + "\n"
|
||||
if (count_response > 0) {
|
||||
var args = {
|
||||
completed: 0,
|
||||
total: count_response,
|
||||
offset: 0,
|
||||
total_seconds: 0,
|
||||
limit: relevanssi_params.indexing_limit,
|
||||
adjust: relevanssi_params.indexing_adjust,
|
||||
extend: true,
|
||||
security: nonce.indexing_nonce,
|
||||
}
|
||||
process_indexing_step(args)
|
||||
} else {
|
||||
clearInterval(intervalID)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
function process_indexing_step(args) {
|
||||
// console.log(args.completed + " / " + args.total);
|
||||
var t0 = performance.now()
|
||||
jQuery.ajax({
|
||||
type: "POST",
|
||||
url: ajaxurl,
|
||||
data: {
|
||||
action: "relevanssi_index_posts",
|
||||
completed: args.completed,
|
||||
total: args.total,
|
||||
offset: args.offset,
|
||||
limit: args.limit,
|
||||
adjust: args.adjust,
|
||||
extend: args.extend,
|
||||
security: args.security,
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
console.log(response)
|
||||
if (response.completed == "done") {
|
||||
//console.log("response " + parseInt(response.total_posts));
|
||||
var results_textarea = document.getElementById("results")
|
||||
results_textarea.value += response.feedback
|
||||
|
||||
document.getElementById("relevanssi_estimated").innerHTML =
|
||||
relevanssi.notimeremaining
|
||||
|
||||
var hidden_posts = args.total - parseInt(response.total_posts)
|
||||
results_textarea.value +=
|
||||
relevanssi.indexing_complete +
|
||||
" " +
|
||||
hidden_posts +
|
||||
" " +
|
||||
relevanssi.excluded_posts
|
||||
results_textarea.scrollTop = results_textarea.scrollHeight
|
||||
jQuery(".rpi-progress div").animate(
|
||||
{
|
||||
width: response.percentage + "%",
|
||||
},
|
||||
50,
|
||||
function () {
|
||||
// Animation complete.
|
||||
}
|
||||
)
|
||||
|
||||
clearInterval(intervalID)
|
||||
} else {
|
||||
var t1 = performance.now()
|
||||
var time_seconds = (t1 - t0) / 1000
|
||||
time_seconds = Math.round(time_seconds * 100) / 100
|
||||
args.total_seconds += time_seconds
|
||||
|
||||
var estimated_time = rlv_format_approximate_time(
|
||||
Math.round(
|
||||
(args.total_seconds / response.percentage) * 100 -
|
||||
args.total_seconds
|
||||
)
|
||||
)
|
||||
|
||||
document.getElementById(
|
||||
"relevanssi_estimated"
|
||||
).innerHTML = estimated_time
|
||||
|
||||
if (args.adjust) {
|
||||
if (time_seconds < 2) {
|
||||
args.limit = args.limit * 2
|
||||
// current limit can be indexed in less than two seconds; double the limit
|
||||
} else if (time_seconds < 5) {
|
||||
args.limit += 5
|
||||
// current limit can be indexed in less than five seconds; up the limit
|
||||
} else if (time_seconds > 20) {
|
||||
args.limit = Math.round(args.limit / 2)
|
||||
if (args.limit < 1) args.limit = 1
|
||||
// current limit takes more than twenty seconds; halve the limit
|
||||
} else if (time_seconds > 10) {
|
||||
args.limit -= 5
|
||||
if (args.limit < 1) args.limit = 1
|
||||
// current limit takes more than ten seconds; reduce the limit
|
||||
}
|
||||
}
|
||||
|
||||
var results_textarea = document.getElementById("results")
|
||||
results_textarea.value += response.feedback
|
||||
results_textarea.scrollTop = results_textarea.scrollHeight
|
||||
var percentage_rounded = Math.round(response.percentage)
|
||||
|
||||
jQuery(".rpi-progress div").animate(
|
||||
{
|
||||
width: percentage_rounded + "%",
|
||||
},
|
||||
50,
|
||||
function () {
|
||||
// Animation complete.
|
||||
}
|
||||
)
|
||||
//console.log("Next step.");
|
||||
var new_args = {
|
||||
completed: parseInt(response.completed),
|
||||
total: args.total,
|
||||
offset: response.offset,
|
||||
total_seconds: args.total_seconds,
|
||||
limit: args.limit,
|
||||
adjust: args.adjust,
|
||||
extend: args.extend,
|
||||
security: args.security,
|
||||
}
|
||||
|
||||
process_indexing_step(new_args)
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
function rlv_format_time(total_seconds) {
|
||||
var hours = Math.floor(total_seconds / 3600)
|
||||
var minutes = Math.floor((total_seconds - hours * 3600) / 60)
|
||||
var seconds = total_seconds - hours * 3600 - minutes * 60
|
||||
|
||||
if (minutes < 10) minutes = "0" + minutes
|
||||
if (seconds < 10) seconds = "0" + seconds
|
||||
|
||||
return hours + ":" + minutes + ":" + seconds
|
||||
}
|
||||
|
||||
function rlv_format_approximate_time(total_seconds) {
|
||||
var hours = Math.floor(total_seconds / 3600)
|
||||
var minutes = Math.floor(total_seconds / 60)
|
||||
var seconds = total_seconds - hours * 3600 - minutes * 60
|
||||
|
||||
var time = ""
|
||||
if (minutes > 99) {
|
||||
hour_word = relevanssi.hours
|
||||
if (hours == 1) hour_word = relevanssi.hour
|
||||
time = relevanssi.about + " " + hours + " " + hour_word
|
||||
}
|
||||
if (minutes > 79 && minutes < 100) time = relevanssi.ninety_min
|
||||
if (minutes > 49 && minutes < 80) time = relevanssi.sixty_min
|
||||
if (minutes < 50) {
|
||||
if (seconds > 30) minutes += 1
|
||||
minute_word = relevanssi.minutes
|
||||
if (minutes == 1) minute_word = relevanssi.minute
|
||||
time = relevanssi.about + " " + minutes + " " + minute_word
|
||||
}
|
||||
if (minutes < 1) time = relevanssi.underminute
|
||||
|
||||
return time
|
||||
}
|
||||
|
||||
jQuery(document).ready(function ($) {
|
||||
$("#search").on("click", function (e) {
|
||||
var results = document.getElementById("results")
|
||||
results.innerHTML = "Searching..."
|
||||
e.preventDefault()
|
||||
jQuery.ajax({
|
||||
type: "POST",
|
||||
url: ajaxurl,
|
||||
data: {
|
||||
action: "relevanssi_admin_search",
|
||||
args: document.getElementById("args").value,
|
||||
posts_per_page: document.getElementById("posts_per_page").value,
|
||||
post_types: document.getElementById("post_types").value,
|
||||
s: document.getElementById("s").value,
|
||||
security: nonce.searching_nonce,
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
results.innerHTML = response
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
// Show the filters on the "Admin search" page.
|
||||
$(document).on("click", "#show_filters", function (e) {
|
||||
$("#relevanssi_filter_list").toggle()
|
||||
$("#show_filters").toggle()
|
||||
$("#hide_filters").toggle()
|
||||
})
|
||||
|
||||
// Hide the filters on the "Admin search" page.
|
||||
$(document).on("click", "#hide_filters", function (e) {
|
||||
$("#relevanssi_filter_list").toggle()
|
||||
$("#show_filters").toggle()
|
||||
$("#hide_filters").toggle()
|
||||
})
|
||||
|
||||
$(document).on("click", "#next_page", function (e) {
|
||||
e.preventDefault()
|
||||
var results = document.getElementById("results")
|
||||
var offset = parseInt(document.getElementById("offset").innerHTML)
|
||||
var posts = parseInt(document.getElementById("posts_per_page").value)
|
||||
results.innerHTML = "Searching..."
|
||||
jQuery.ajax({
|
||||
type: "POST",
|
||||
url: ajaxurl,
|
||||
data: {
|
||||
action: "relevanssi_admin_search",
|
||||
args: document.getElementById("args").value,
|
||||
posts_per_page: posts,
|
||||
s: document.getElementById("s").value,
|
||||
offset: offset,
|
||||
security: nonce.searching_nonce,
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
results.innerHTML = response
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
$(document).on("click", "#prev_page", function (e) {
|
||||
e.preventDefault()
|
||||
var results = document.getElementById("results")
|
||||
var offset = parseInt(document.getElementById("offset").innerHTML)
|
||||
var posts = parseInt(document.getElementById("posts_per_page").value)
|
||||
offset = offset - posts - posts
|
||||
if (offset < 0) offset = 0
|
||||
results.innerHTML = "Searching..."
|
||||
jQuery.ajax({
|
||||
type: "POST",
|
||||
url: ajaxurl,
|
||||
data: {
|
||||
action: "relevanssi_admin_search",
|
||||
args: document.getElementById("args").value,
|
||||
posts_per_page: document.getElementById("posts_per_page").value,
|
||||
s: document.getElementById("s").value,
|
||||
offset: offset,
|
||||
security: nonce.searching_nonce,
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
results.innerHTML = response
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
$(document).on("click", ".pin", function (e) {
|
||||
e.preventDefault()
|
||||
var keyword = e.target.dataset.keyword
|
||||
var post_id = e.target.dataset.postid
|
||||
jQuery.ajax({
|
||||
type: "POST",
|
||||
url: ajaxurl,
|
||||
data: {
|
||||
action: "relevanssi_pin_post",
|
||||
keyword,
|
||||
post_id,
|
||||
security: nonce.searching_nonce,
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
var results = document.getElementById("results")
|
||||
results.innerHTML = "Searching..."
|
||||
e.preventDefault()
|
||||
jQuery.ajax({
|
||||
type: "POST",
|
||||
url: ajaxurl,
|
||||
data: {
|
||||
action: "relevanssi_admin_search",
|
||||
args: document.getElementById("args").value,
|
||||
posts_per_page: document.getElementById("posts_per_page").value,
|
||||
s: document.getElementById("s").value,
|
||||
security: nonce.searching_nonce,
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
results.innerHTML = response
|
||||
},
|
||||
})
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
$(document).on("click", ".unpin", function (e) {
|
||||
e.preventDefault()
|
||||
var keyword = e.target.dataset.keyword
|
||||
var post_id = e.target.dataset.postid
|
||||
jQuery.ajax({
|
||||
type: "POST",
|
||||
url: ajaxurl,
|
||||
data: {
|
||||
action: "relevanssi_unpin_post",
|
||||
keyword,
|
||||
post_id,
|
||||
security: nonce.searching_nonce,
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
var results = document.getElementById("results")
|
||||
results.innerHTML = "Searching..."
|
||||
e.preventDefault()
|
||||
jQuery.ajax({
|
||||
type: "POST",
|
||||
url: ajaxurl,
|
||||
data: {
|
||||
action: "relevanssi_admin_search",
|
||||
args: document.getElementById("args").value,
|
||||
posts_per_page: document.getElementById("posts_per_page").value,
|
||||
s: document.getElementById("s").value,
|
||||
security: nonce.searching_nonce,
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
results.innerHTML = response
|
||||
},
|
||||
})
|
||||
},
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,53 @@
|
||||
jQuery(document).ready(function ($) {
|
||||
$("#build_index").click(function () {
|
||||
$("#relevanssi-progress").show()
|
||||
$("#results").show()
|
||||
$("#relevanssi-timer").show()
|
||||
$("#relevanssi-indexing-instructions").show()
|
||||
$("#stateoftheindex").html(relevanssi.reload_state)
|
||||
$("#indexing_button_instructions").hide()
|
||||
var results = document.getElementById("results")
|
||||
results.value = ""
|
||||
|
||||
var data = {
|
||||
action: "relevanssi_truncate_index",
|
||||
security: nonce.indexing_nonce,
|
||||
}
|
||||
|
||||
intervalID = window.setInterval(relevanssiUpdateClock, 1000)
|
||||
|
||||
console.log("Truncating index.")
|
||||
results.value += relevanssi.truncating_index + " "
|
||||
jQuery.post(ajaxurl, data, function (response) {
|
||||
truncate_response = JSON.parse(response)
|
||||
console.log("Truncate index: " + truncate_response)
|
||||
if (truncate_response == true) {
|
||||
results.value += relevanssi.done + "\n"
|
||||
}
|
||||
|
||||
var data = {
|
||||
action: "relevanssi_count_posts",
|
||||
}
|
||||
console.log("Counting posts.")
|
||||
results.value += relevanssi.counting_posts + " "
|
||||
jQuery.post(ajaxurl, data, function (response) {
|
||||
count_response = JSON.parse(response)
|
||||
console.log("Counted " + count_response + " posts.")
|
||||
var post_total = parseInt(count_response)
|
||||
results.value += count_response + " " + relevanssi.posts_found + "\n"
|
||||
|
||||
var args = {
|
||||
completed: 0,
|
||||
total: post_total,
|
||||
offset: 0,
|
||||
total_seconds: 0,
|
||||
limit: relevanssi_params.indexing_limit,
|
||||
adjust: relevanssi_params.indexing_adjust,
|
||||
extend: false,
|
||||
security: nonce.indexing_nonce,
|
||||
}
|
||||
process_indexing_step(args)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
118
wp/wp-content/plugins/relevanssi-premium/lib/admin_styles.css
Normal file
118
wp/wp-content/plugins/relevanssi-premium/lib/admin_styles.css
Normal file
@@ -0,0 +1,118 @@
|
||||
p.important {
|
||||
color: #992000;
|
||||
}
|
||||
|
||||
table.form-table table.widefat th {
|
||||
padding-left: 8px;
|
||||
}
|
||||
|
||||
#relevanssi_min_word_length {
|
||||
width: 3em;
|
||||
}
|
||||
|
||||
#relevanssi_trim_logs, #relevanssi_trim_click_logs {
|
||||
width: 4em;
|
||||
}
|
||||
|
||||
#index_field_input {
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
#indexing_tab #results {
|
||||
display: none;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#relevanssi-progress {
|
||||
display: none;
|
||||
margin-bottom: 2em;
|
||||
width: 100%;
|
||||
height: 20px;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.rpi-indicator {
|
||||
width: 0;
|
||||
height: 20px;
|
||||
background-color: #afe240;
|
||||
}
|
||||
|
||||
.relevanssi-weights-table {
|
||||
min-width: 400px;
|
||||
}
|
||||
|
||||
.relevanssi-weights-table td {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.relevanssi-weights-table td.col-2, .relevanssi-weights-table th.col-2 {
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
.rpi-progress {
|
||||
display: none;
|
||||
margin: 0.5em 0 2em 0;
|
||||
width: 100%;
|
||||
height: 20px;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.rpi-progress div {
|
||||
width: 0;
|
||||
height: 20px;
|
||||
background-color: #afe240;
|
||||
}
|
||||
|
||||
#relevanssi_results {
|
||||
display: none;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#relevanssi_show_pdf_errors {
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
color: #0073aa;
|
||||
}
|
||||
|
||||
#relevanssi_pdf_errors {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.visually_hidden {
|
||||
margin: -1px;
|
||||
padding: 0;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0 0 0 0);
|
||||
clip: rect(0,0,0,0);
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.relevanssi_disabled, .relevanssi_disabled td, .relevanssi_disabled th, .relevanssi_disabled p {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
#relevanssi-timer {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#category_inclusion_checklist ul.children, #category_exclusion_checklist ul.children {
|
||||
margin-left: 1.5em;
|
||||
}
|
||||
|
||||
#relevanssi_filter_list {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#redirect_table td {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
#relevanssi_sees_container, #relevanssi_db_view_container {
|
||||
width: 80%;
|
||||
background: white;
|
||||
padding: 5px 20px;
|
||||
border: thin solid black;
|
||||
overflow: scroll;
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/class-relevanssi-taxonomy-walker.php
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
/**
|
||||
* A taxonomy walker used in Relevanssi interface.
|
||||
*
|
||||
* This is needed for wp_terms_checklist() in the Relevanssi admin interface to
|
||||
* control the way the taxonomies are listed.
|
||||
*/
|
||||
class Relevanssi_Taxonomy_Walker extends Walker_Category_Checklist {
|
||||
/**
|
||||
* Name of the input element.
|
||||
*
|
||||
* @var string $name Name of the input element.
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* Creates a single element of the list.
|
||||
*
|
||||
* @see Walker::start_el()
|
||||
*
|
||||
* @param string $output Used to append additional content (passed by reference).
|
||||
* @param object $category Category data object.
|
||||
* @param int $depth Optional. Depth of category in reference to parents. Default 0.
|
||||
* @param array $args Optional. An array of arguments. See wp_list_categories(). Default empty array.
|
||||
* @param int $id Optional. ID of the current category. Default 0.
|
||||
*/
|
||||
public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) {
|
||||
if ( empty( $args['taxonomy'] ) ) {
|
||||
$taxonomy = 'category';
|
||||
} else {
|
||||
$taxonomy = $args['taxonomy'];
|
||||
}
|
||||
|
||||
$name = $this->name;
|
||||
|
||||
if ( ! isset( $args['popular_cats'] ) ) {
|
||||
$args['popular_cats'] = array();
|
||||
}
|
||||
|
||||
if ( ! isset( $args['selected_cats'] ) ) {
|
||||
$args['selected_cats'] = array();
|
||||
}
|
||||
|
||||
$class = '';
|
||||
$inner_class = '';
|
||||
|
||||
if ( ! empty( $args['list_only'] ) ) {
|
||||
$aria_checked = 'false';
|
||||
$inner_class = 'category';
|
||||
|
||||
$output .= "\n" . '<li' . $class . '>' .
|
||||
'<div class="' . $inner_class . '" data-term-id=' . $category->term_id .
|
||||
' tabindex="0" role="checkbox" aria-checked="' . $aria_checked . '">' .
|
||||
/** This filter is documented in wp-includes/category-template.php */
|
||||
esc_html( apply_filters( 'the_category', $category->name, '', '' ) ) . '</div>';
|
||||
} else {
|
||||
$output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" .
|
||||
'<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="' . $name . '[]" id="in-' . $taxonomy . '-' . $category->term_id . '"' .
|
||||
checked( in_array( intval( $category->term_id ), $args['selected_cats'], true ), true, false ) .
|
||||
disabled( empty( $args['disabled'] ), false, false ) . ' /> ' .
|
||||
/** This filter is documented in wp-includes/category-template.php */
|
||||
esc_html( apply_filters( 'the_category', $category->name, '', '' ) ) . '</label>';
|
||||
}
|
||||
}
|
||||
}
|
||||
1937
wp/wp-content/plugins/relevanssi-premium/lib/common.php
Normal file
1937
wp/wp-content/plugins/relevanssi-premium/lib/common.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,284 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/acf.php
|
||||
*
|
||||
* Advanced Custom Fields compatibility features.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_action( 'acf/render_field_settings', 'relevanssi_acf_exclude_setting' );
|
||||
add_filter( 'relevanssi_search_ok', 'relevanssi_acf_relationship_fields' );
|
||||
add_filter( 'relevanssi_index_custom_fields', 'relevanssi_acf_exclude_fields', 10, 2 );
|
||||
|
||||
/**
|
||||
* Disables Relevanssi in the ACF Relationship field post search.
|
||||
*
|
||||
* We don't want to use Relevanssi on the ACF Relationship field post searches, so
|
||||
* this function disables it (on the 'relevanssi_search_ok' hook).
|
||||
*
|
||||
* @param boolean $search_ok Block the search or not.
|
||||
*
|
||||
* @return boolean False, if this is an ACF Relationship field search, pass the
|
||||
* parameter unchanged otherwise.
|
||||
*/
|
||||
function relevanssi_acf_relationship_fields( $search_ok ) {
|
||||
// phpcs:disable WordPress.Security.NonceVerification
|
||||
if ( isset( $_REQUEST['action'] )
|
||||
&& is_string( $_REQUEST['action'] )
|
||||
&& 'acf' === substr( $_REQUEST['action'], 0, 3 ) ) {
|
||||
$search_ok = false;
|
||||
}
|
||||
return $search_ok;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indexes the human-readable value of "choice" options list from ACF.
|
||||
*
|
||||
* @author Droz Raphaël
|
||||
*
|
||||
* @param array $insert_data The insert data array.
|
||||
* @param int $post_id The post ID.
|
||||
* @param string $field_name Name of the field.
|
||||
* @param string $field_value The field value.
|
||||
*
|
||||
* @return int Number of tokens indexed.
|
||||
*/
|
||||
function relevanssi_index_acf( &$insert_data, $post_id, $field_name, $field_value ) {
|
||||
if ( ! is_admin() ) {
|
||||
include_once ABSPATH . 'wp-admin/includes/plugin.php'; // Otherwise is_plugin_active() will cause a fatal error.
|
||||
}
|
||||
if ( ! function_exists( 'is_plugin_active' ) ) {
|
||||
return 0;
|
||||
}
|
||||
if ( ! is_plugin_active( 'advanced-custom-fields/acf.php' ) && ! is_plugin_active( 'advanced-custom-fields-pro/acf.php' ) ) {
|
||||
return 0;
|
||||
}
|
||||
if ( ! function_exists( 'get_field_object' ) ) {
|
||||
return 0; // ACF is active, but not loaded.
|
||||
}
|
||||
|
||||
$field_object = get_field_object( $field_name, $post_id );
|
||||
if ( ! isset( $field_object['choices'] ) ) {
|
||||
return 0; // Not a "select" field.
|
||||
}
|
||||
if ( is_array( $field_value ) ) {
|
||||
return 0; // Not handled (currently).
|
||||
}
|
||||
if ( ! isset( $field_object['choices'][ $field_value ] ) ) {
|
||||
return 0; // Value does not exist.
|
||||
}
|
||||
|
||||
$n = 0;
|
||||
|
||||
/**
|
||||
* Filters the field value before it is used to save the insert data.
|
||||
*
|
||||
* The value is used as an array key, so it needs to be an integer or a
|
||||
* string. If your custom field values are arrays or objects, use this
|
||||
* filter hook to convert them into strings.
|
||||
*
|
||||
* @param mixed $field_content The ACF field value.
|
||||
* @param string $field_name The ACF field name.
|
||||
* @param int $post_id The post ID.
|
||||
*
|
||||
* @return string|int The field value.
|
||||
*/
|
||||
$value = apply_filters(
|
||||
'relevanssi_acf_field_value',
|
||||
$field_object['choices'][ $field_value ],
|
||||
$field_name,
|
||||
$post_id
|
||||
);
|
||||
|
||||
if ( $value && ( is_integer( $value ) || is_string( $value ) ) ) {
|
||||
$min_word_length = get_option( 'relevanssi_min_word_length', 3 );
|
||||
|
||||
/** This filter is documented in lib/indexing.php */
|
||||
$value_tokens = apply_filters( 'relevanssi_indexing_tokens', relevanssi_tokenize( $value, true, $min_word_length, 'indexing' ), 'custom_field' );
|
||||
foreach ( $value_tokens as $token => $count ) {
|
||||
++$n;
|
||||
if ( ! isset( $insert_data[ $token ]['customfield'] ) ) {
|
||||
$insert_data[ $token ]['customfield'] = 0;
|
||||
}
|
||||
$insert_data[ $token ]['customfield'] += $count;
|
||||
|
||||
// Premium indexes more detail about custom fields.
|
||||
if ( function_exists( 'relevanssi_customfield_detail' ) ) {
|
||||
$insert_data = relevanssi_customfield_detail( $insert_data, $token, $count, $field_name );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $n;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a Relevanssi exclude setting to ACF fields.
|
||||
*
|
||||
* @param array $field The field object array.
|
||||
*/
|
||||
function relevanssi_acf_exclude_setting( $field ) {
|
||||
if ( ! function_exists( 'acf_render_field_setting' ) ) {
|
||||
return;
|
||||
}
|
||||
if ( 'clone' === $field['type'] ) {
|
||||
return;
|
||||
}
|
||||
acf_render_field_setting(
|
||||
$field,
|
||||
array(
|
||||
'label' => __( 'Exclude from Relevanssi index', 'relevanssi' ),
|
||||
'instructions' => __( 'If this setting is enabled, Relevanssi will not index the value of this field for posts.', 'relevanssi' ),
|
||||
'name' => 'relevanssi_exclude',
|
||||
'type' => 'true_false',
|
||||
'ui' => 1,
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Excludes ACF fields based on the exclude setting.
|
||||
*
|
||||
* Hooks on to relevanssi_index_custom_fields.
|
||||
*
|
||||
* @param array $fields The list of custom fields to index.
|
||||
* @param int $post_id The post ID.
|
||||
*
|
||||
* @return array Filtered list of custom fields.
|
||||
*/
|
||||
function relevanssi_acf_exclude_fields( $fields, $post_id ) {
|
||||
$included_fields = array();
|
||||
$excluded_fields = array();
|
||||
|
||||
/**
|
||||
* Filters the types of ACF fields to exclude from indexing.
|
||||
*
|
||||
* By default, blocks 'repeater', 'flexible_content' and 'group' are
|
||||
* excluded from Relevanssi indexing. You can add other field types here.
|
||||
*
|
||||
* @param array $excluded_field_types The field types to exclude.
|
||||
*/
|
||||
$blocked_field_types = apply_filters(
|
||||
'relevanssi_blocked_field_types',
|
||||
array( 'repeater', 'flexible_content', 'group' )
|
||||
);
|
||||
|
||||
global $post;
|
||||
foreach ( $fields as $field ) {
|
||||
$global_post = $post; // ACF fields can change the global $post.
|
||||
$field_object = get_field_object( $field );
|
||||
$post = $global_post; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
||||
|
||||
if ( ! $field_object || ! is_array( $field_object ) ) {
|
||||
$field_id = relevanssi_acf_get_field_id( $field, $post_id );
|
||||
if ( ! $field_id ) {
|
||||
// No field ID -> not an ACF field. Include.
|
||||
$included_fields[] = $field;
|
||||
} else {
|
||||
/*
|
||||
* This field has a field ID, but get_field_object() does not
|
||||
* return a field object. This may be a clone field, in which
|
||||
* case we can try to get the field object from the field ID.
|
||||
* Clone fields have keys like field_xxx_field_yyy, where the
|
||||
* field_yyy is the part we need.
|
||||
*/
|
||||
$field_id = preg_replace( '/.*_(field_.*)/', '$1', $field_id );
|
||||
$field_object = get_field_object( $field_id );
|
||||
}
|
||||
}
|
||||
if ( $field_object ) {
|
||||
/**
|
||||
* Filters the ACF field object.
|
||||
*
|
||||
* If the filter returns a false value, Relevanssi will not index
|
||||
* the field.
|
||||
*
|
||||
* @param array $field_object The field object.
|
||||
* @param int $post_id The post ID.
|
||||
*
|
||||
* @return array The filtered field object.
|
||||
*/
|
||||
$field_object = apply_filters(
|
||||
'relevanssi_acf_field_object',
|
||||
$field_object,
|
||||
$post_id
|
||||
);
|
||||
|
||||
if ( ! $field_object ) {
|
||||
continue;
|
||||
}
|
||||
if ( isset( $field_object['relevanssi_exclude'] ) && 1 === $field_object['relevanssi_exclude'] ) {
|
||||
continue;
|
||||
}
|
||||
if ( relevanssi_acf_is_parent_excluded( $field_object ) ) {
|
||||
continue;
|
||||
}
|
||||
if ( isset( $field_object['type'] ) && in_array( $field_object['type'], $blocked_field_types, true ) ) {
|
||||
continue;
|
||||
}
|
||||
$included_fields[] = $field;
|
||||
}
|
||||
}
|
||||
return $included_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the field has an excluded parent field.
|
||||
*
|
||||
* If the field has a "parent" value set, this function gets the parent field
|
||||
* post based on the post ID in the "parent" value. This is done recursively
|
||||
* until we reach the top or find an excluded parent.
|
||||
*
|
||||
* @param array $field_object The field object.
|
||||
*
|
||||
* @return bool Returns true if the post has an excluded parent.
|
||||
*/
|
||||
function relevanssi_acf_is_parent_excluded( $field_object ) {
|
||||
if ( isset( $field_object['parent'] ) ) {
|
||||
$parent = $field_object['parent'];
|
||||
if ( $parent ) {
|
||||
$parent_field_post = get_post( $parent );
|
||||
if ( $parent_field_post ) {
|
||||
$parent_object = get_field_object( $parent_field_post->post_name );
|
||||
if ( $parent_object ) {
|
||||
if ( isset( $parent_object['relevanssi_exclude'] ) && 1 === $parent_object['relevanssi_exclude'] ) {
|
||||
return true;
|
||||
}
|
||||
return relevanssi_acf_is_parent_excluded( $parent_object );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the field ID from the field name.
|
||||
*
|
||||
* The field ID is stored in the postmeta table with the field name prefixed
|
||||
* with an underscore as the key.
|
||||
*
|
||||
* @param string $field_name The field name.
|
||||
* @param int $post_id The post ID.
|
||||
*
|
||||
* @return string The field ID.
|
||||
*/
|
||||
function relevanssi_acf_get_field_id( $field_name, $post_id ) {
|
||||
global $wpdb;
|
||||
|
||||
$field_id = $wpdb->get_var(
|
||||
$wpdb->prepare(
|
||||
"SELECT meta_value FROM $wpdb->postmeta
|
||||
WHERE post_id = %d
|
||||
AND meta_key = %s",
|
||||
$post_id,
|
||||
'_' . $field_name
|
||||
)
|
||||
);
|
||||
return $field_id;
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/aioseo.php
|
||||
*
|
||||
* All-in-One SEO noindex filtering function.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_filter( 'relevanssi_do_not_index', 'relevanssi_aioseo_noindex', 10, 2 );
|
||||
add_filter( 'relevanssi_indexing_restriction', 'relevanssi_aioseo_exclude' );
|
||||
add_action( 'relevanssi_indexing_tab_advanced', 'relevanssi_aioseo_form', 20 );
|
||||
add_action( 'relevanssi_indexing_options', 'relevanssi_aioseo_options' );
|
||||
|
||||
/**
|
||||
* Blocks indexing of posts marked "noindex" in the All-in-One SEO settings.
|
||||
*
|
||||
* Attaches to the 'relevanssi_do_not_index' filter hook.
|
||||
*
|
||||
* @param boolean $do_not_index True, if the post shouldn't be indexed.
|
||||
* @param integer $post_id The post ID number.
|
||||
*
|
||||
* @return string|boolean If the post shouldn't be indexed, this returns
|
||||
* 'aioseo_seo'. The value may also be a boolean.
|
||||
*/
|
||||
function relevanssi_aioseo_noindex( bool $do_not_index, int $post_id ) {
|
||||
if ( 'on' !== get_option( 'relevanssi_seo_noindex' ) ) {
|
||||
return $do_not_index;
|
||||
}
|
||||
$noindex_posts = relevanssi_aioseo_get_noindex_posts();
|
||||
if ( in_array( $post_id, $noindex_posts, true ) ) {
|
||||
$do_not_index = 'All-in-One SEO';
|
||||
}
|
||||
return $do_not_index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Excludes the "noindex" posts from Relevanssi indexing.
|
||||
*
|
||||
* Adds a MySQL query restriction that blocks posts that have the aioseo SEO
|
||||
* "noindex" setting set to "1" from indexing.
|
||||
*
|
||||
* @param array $restriction An array with two values: 'mysql' for the MySQL
|
||||
* query restriction to modify, 'reason' for the reason of restriction.
|
||||
*/
|
||||
function relevanssi_aioseo_exclude( array $restriction ) {
|
||||
if ( 'on' !== get_option( 'relevanssi_seo_noindex' ) ) {
|
||||
return $restriction;
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
|
||||
$restriction['mysql'] .= " AND post.ID NOT IN (SELECT post_id FROM
|
||||
{$wpdb->prefix}aioseo_posts WHERE robots_noindex = '1' ) ";
|
||||
$restriction['reason'] .= ' All-in-One SEO';
|
||||
|
||||
return $restriction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches the post IDs where robots_noindex is set to 1 in the aioseo_posts
|
||||
* table.
|
||||
*
|
||||
* @return array An array of post IDs.
|
||||
*/
|
||||
function relevanssi_aioseo_get_noindex_posts() {
|
||||
global $wpdb, $relevanssi_aioseo_noindex_cache;
|
||||
if ( ! empty( $relevanssi_aioseo_noindex_cache ) ) {
|
||||
return $relevanssi_aioseo_noindex_cache;
|
||||
}
|
||||
$relevanssi_aioseo_noindex_cache = $wpdb->get_col( "SELECT post_id FROM {$wpdb->prefix}aioseo_posts WHERE 'robots_noindex' = '1'" );
|
||||
return $relevanssi_aioseo_noindex_cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints out the form fields for disabling the feature.
|
||||
*/
|
||||
function relevanssi_aioseo_form() {
|
||||
$seo_noindex = get_option( 'relevanssi_seo_noindex' );
|
||||
$seo_noindex = relevanssi_check( $seo_noindex );
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for='relevanssi_seo_noindex'><?php esc_html_e( 'Use All-in-One SEO noindex', 'relevanssi' ); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<label for='relevanssi_seo_noindex'>
|
||||
<input type='checkbox' name='relevanssi_seo_noindex' id='relevanssi_seo_noindex' <?php echo esc_attr( $seo_noindex ); ?> />
|
||||
<?php esc_html_e( 'Use All-in-One SEO noindex.', 'relevanssi' ); ?>
|
||||
</label>
|
||||
<p class="description"><?php esc_html_e( 'If checked, Relevanssi will not index posts marked as "No index" in All-in-One SEO settings.', 'relevanssi' ); ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the SEO No index option.
|
||||
*
|
||||
* @param array $request An array of option values from the request.
|
||||
*/
|
||||
function relevanssi_aioseo_options( array $request ) {
|
||||
relevanssi_update_off_or_on( $request, 'relevanssi_seo_noindex', true );
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/avada.php
|
||||
*
|
||||
* Avada theme compatibility features.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_filter(
|
||||
'fusion_live_search_query_args',
|
||||
function ( $args ) {
|
||||
$args['relevanssi'] = true;
|
||||
return $args;
|
||||
}
|
||||
);
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/bricks.php
|
||||
*
|
||||
* Bricks theme compatibility features.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_filter( 'bricks/posts/query_vars', 'relevanssi_bricks_enable', 10 );
|
||||
add_filter( 'relevanssi_custom_field_value', 'relevanssi_bricks_values', 10, 2 );
|
||||
add_filter( 'relevanssi_index_custom_fields', 'relevanssi_add_bricks' );
|
||||
add_filter( 'option_relevanssi_index_fields', 'relevanssi_bricks_fix_none_setting' );
|
||||
add_action( 'save_post', 'relevanssi_insert_edit', 99, 1 );
|
||||
|
||||
/**
|
||||
* Enables Relevanssi in the query when the 's' query var is set.
|
||||
*
|
||||
* @param array $query_vars The query variables.
|
||||
*
|
||||
* @return array The query variables with the Relevanssi toggle enabled.
|
||||
*/
|
||||
function relevanssi_bricks_enable( $query_vars ) {
|
||||
if ( isset( $query_vars['s'] ) ) {
|
||||
$query_vars['relevanssi'] = true;
|
||||
}
|
||||
return $query_vars;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the `_bricks_page_content_2` to the list of indexed custom fields.
|
||||
*
|
||||
* @param array|boolean $fields An array of custom fields to index, or false.
|
||||
*
|
||||
* @return array An array of custom fields, including `_bricks_page_content_2`.
|
||||
*/
|
||||
function relevanssi_add_bricks( $fields ) {
|
||||
if ( ! is_array( $fields ) ) {
|
||||
$fields = array();
|
||||
}
|
||||
if ( ! in_array( '_bricks_page_content_2', $fields, true ) ) {
|
||||
$fields[] = '_bricks_page_content_2';
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Includes only text from _bricks_page_content_2 custom field.
|
||||
*
|
||||
* This function goes through the multilevel array of _bricks_page_content_2
|
||||
* and only picks up the "text" elements inside it, discarding everything else.
|
||||
*
|
||||
* @param array $value An array of custom field values.
|
||||
* @param string $field The name of the custom field.
|
||||
*
|
||||
* @return array An array containing a string with all the values concatenated
|
||||
* together.
|
||||
*/
|
||||
function relevanssi_bricks_values( $value, $field ) {
|
||||
if ( '_bricks_page_content_2' !== $field ) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
$content = '';
|
||||
array_walk_recursive(
|
||||
$value,
|
||||
function ( $text, $key ) use ( &$content ) {
|
||||
if ( 'text' === $key ) {
|
||||
$content .= ' ' . $text;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
return array( $content );
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes sure the Bricks builder shortcode is included in the index, even when
|
||||
* the custom field setting is set to 'none'.
|
||||
*
|
||||
* @param string $value The custom field indexing setting value. The parameter
|
||||
* is ignored, Relevanssi disables this filter and then checks the option to
|
||||
* see what the value is.
|
||||
*
|
||||
* @return string If value is undefined, it's set to '_bricks_page_content_2'.
|
||||
*/
|
||||
function relevanssi_bricks_fix_none_setting( $value ) {
|
||||
if ( ! $value ) {
|
||||
$value = '_bricks_page_content_2';
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/elementor.php
|
||||
*
|
||||
* Elementor page builder compatibility features.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_filter( 'relevanssi_search_ok', 'relevanssi_block_elementor_library', 10, 2 );
|
||||
|
||||
/**
|
||||
* Blocks Relevanssi from interfering with the Elementor Library searches.
|
||||
*
|
||||
* @param bool $ok Should Relevanssi be allowed to process the query.
|
||||
* @param WP_Query $query The WP_Query object.
|
||||
*
|
||||
* @return bool Returns false, if this is an Elementor library search.
|
||||
*/
|
||||
function relevanssi_block_elementor_library( bool $ok, WP_Query $query ): bool {
|
||||
if ( 'elementor_library' === $query->query_vars['post_type'] ) {
|
||||
$ok = false;
|
||||
}
|
||||
return $ok;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/fibosearch.php
|
||||
*
|
||||
* Fibo Search compatibility features.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_filter( 'dgwt/wcas/search_query/args', 'relevanssi_enable_relevanssi_in_fibo' );
|
||||
|
||||
/**
|
||||
* Adds the 'relevanssi' parameter to the Fibo Search.
|
||||
*
|
||||
* Uses the dgwt/wcas/search_query_args filter hook to modify the search query.
|
||||
*
|
||||
* @param array $args The search arguments.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function relevanssi_enable_relevanssi_in_fibo( $args ) {
|
||||
$args['relevanssi'] = true;
|
||||
return $args;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/groups.php
|
||||
*
|
||||
* Groups compatibility features.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_filter( 'relevanssi_post_ok', 'relevanssi_groups_compatibility', 10, 2 );
|
||||
|
||||
/**
|
||||
* Checks whether the user is allowed to see the post.
|
||||
*
|
||||
* Only applies to published posts.
|
||||
*
|
||||
* @param boolean $post_ok Can the post be shown to the user.
|
||||
* @param int $post_id The post ID.
|
||||
*
|
||||
* @return boolean $post_ok True if the user is allowed to see the post,
|
||||
* otherwise false.
|
||||
*/
|
||||
function relevanssi_groups_compatibility( $post_ok, $post_id ) {
|
||||
$status = relevanssi_get_post_status( $post_id );
|
||||
|
||||
if ( 'publish' === $status ) {
|
||||
// Only apply to published posts, don't apply to drafts.
|
||||
$current_user = wp_get_current_user();
|
||||
$post_ok = Groups_Post_Access::user_can_read_post( $post_id, $current_user->ID );
|
||||
}
|
||||
|
||||
return $post_ok;
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/gutenberg.php
|
||||
*
|
||||
* Gutenberg compatibility features.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_filter( 'relevanssi_post_content', 'relevanssi_gutenberg_block_rendering', 10, 2 );
|
||||
|
||||
/**
|
||||
* Registers rest_after_insert_{post_type} actions for all indexed post types.
|
||||
*
|
||||
* Runs on `admin_init` action hook and registers the function
|
||||
* `relevanssi_save_gutenberg_postdata` for all indexed post types.
|
||||
*
|
||||
* @see relevanssi_save_gutenberg_postdata
|
||||
*/
|
||||
function relevanssi_register_gutenberg_actions() {
|
||||
if ( ! RELEVANSSI_PREMIUM ) {
|
||||
return;
|
||||
}
|
||||
$index_post_types = get_option( 'relevanssi_index_post_types', array() );
|
||||
array_walk(
|
||||
$index_post_types,
|
||||
function ( $post_type ) {
|
||||
if ( 'bogus' !== $post_type ) {
|
||||
add_action(
|
||||
'rest_after_insert_' . $post_type,
|
||||
'relevanssi_save_gutenberg_postdata'
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders Gutenberg blocks.
|
||||
*
|
||||
* Renders all sorts of Gutenberg blocks, including reusable blocks and ACF
|
||||
* blocks. Also enables basic Gutenberg deindexing: you can add an extra CSS
|
||||
* class 'relevanssi_noindex' to a block to stop it from being indexed by
|
||||
* Relevanssi. This function is essentially the same as core do_blocks().
|
||||
*
|
||||
* @see do_blocks()
|
||||
*
|
||||
* @param string $content The post content.
|
||||
* @param object $post_object The post object.
|
||||
*
|
||||
* @return string The post content with the rendered content added.
|
||||
*/
|
||||
function relevanssi_gutenberg_block_rendering( $content, $post_object ) {
|
||||
/**
|
||||
* Filters whether the blocks are rendered or not.
|
||||
*
|
||||
* If this filter returns false, the blocks in this post are not rendered,
|
||||
* and the post content is returned as such.
|
||||
*
|
||||
* @param boolean If true, render the blocks. Default true.
|
||||
* @param object The post object.
|
||||
*/
|
||||
if ( ! apply_filters( 'relevanssi_render_blocks', true, $post_object ) ) {
|
||||
return $content;
|
||||
}
|
||||
$blocks = parse_blocks( $content );
|
||||
$output = '';
|
||||
|
||||
foreach ( $blocks as $block ) {
|
||||
/**
|
||||
* Filters the Gutenberg block before it is rendered.
|
||||
*
|
||||
* If the block is non-empty after the filter and it's className
|
||||
* parameter is not 'relevanssi_noindex', it will be passed on to the
|
||||
* render_block() function for rendering.
|
||||
*
|
||||
* @see render_block
|
||||
*
|
||||
* @param array $block The Gutenberg block element.
|
||||
*/
|
||||
$block = apply_filters( 'relevanssi_block_to_render', $block );
|
||||
|
||||
if ( ! $block ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (
|
||||
isset( $block['attrs']['className'] )
|
||||
&& false !== strstr( $block['attrs']['className'], 'relevanssi_noindex' )
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$block = relevanssi_process_inner_blocks( $block );
|
||||
|
||||
/**
|
||||
* Filters the Gutenberg block after it is rendered.
|
||||
*
|
||||
* The value is the output from render_block( $block ). Feel free to
|
||||
* modify it as you wish.
|
||||
*
|
||||
* @see render_block
|
||||
*
|
||||
* @param string The rendered block content.
|
||||
* @param array $block The Gutenberg block being rendered.
|
||||
*
|
||||
* @return string The filtered block content.
|
||||
*/
|
||||
$output .= apply_filters( 'relevanssi_rendered_block', render_block( $block ), $block );
|
||||
|
||||
}
|
||||
|
||||
// If there are blocks in this content, we shouldn't run wpautop() on it later.
|
||||
$priority = has_filter( 'the_content', 'wpautop' );
|
||||
if ( false !== $priority && doing_filter( 'the_content' ) && has_blocks( $content ) ) {
|
||||
remove_filter( 'the_content', 'wpautop', $priority );
|
||||
add_filter( 'the_content', '_restore_wpautop_hook', $priority + 1 );
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs recursively through inner blocks to filter them.
|
||||
*
|
||||
* Runs relevanssi_block_to_render and the relevanssi_noindex CSS class check
|
||||
* on all inner blocks. If inner blocks are filtered out, they will be removed
|
||||
* with empty blocks of the type "core/fake". Removing the inner blocks causes
|
||||
* problems; that's why they are replaced. The blocks are rendered here;
|
||||
* everything will be rendered once at the top level.
|
||||
*
|
||||
* @param array $block A Gutenberg block.
|
||||
*
|
||||
* @return array The filtered block.
|
||||
*/
|
||||
function relevanssi_process_inner_blocks( $block ) {
|
||||
$innerblocks_to_keep = array();
|
||||
|
||||
$empty_block = array(
|
||||
'blockName' => 'core/fake',
|
||||
'attrs' => array(),
|
||||
'innerHTML' => '',
|
||||
'innerBlocks' => array(),
|
||||
);
|
||||
|
||||
foreach ( $block['innerBlocks'] as $inner_block ) {
|
||||
/* Filter documented in /lib/compatibility/gutenberg.php. */
|
||||
$inner_block = apply_filters( 'relevanssi_block_to_render', $inner_block );
|
||||
|
||||
if ( ! $inner_block ) {
|
||||
$innerblocks_to_keep[] = $empty_block;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (
|
||||
isset( $inner_block['attrs']['className'] )
|
||||
&& false !== strstr( $inner_block['attrs']['className'], 'relevanssi_noindex' )
|
||||
) {
|
||||
$innerblocks_to_keep[] = $empty_block;
|
||||
continue;
|
||||
}
|
||||
|
||||
$inner_block = relevanssi_process_inner_blocks( $inner_block );
|
||||
|
||||
$innerblocks_to_keep[] = $inner_block;
|
||||
}
|
||||
|
||||
$block['innerBlocks'] = $innerblocks_to_keep;
|
||||
return $block;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/jetsmartfilters.php
|
||||
*
|
||||
* JetSmartFilters compatibility features.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_action( 'pre_get_posts', 'relevanssi_jetsmartfilters', 9999 );
|
||||
|
||||
/**
|
||||
* Makes JetSmartFilters use posts from Relevanssi.
|
||||
*
|
||||
* @param WP_Query $wp_query The wp_query object.
|
||||
*/
|
||||
function relevanssi_jetsmartfilters( $wp_query ) {
|
||||
if (
|
||||
! isset( $wp_query->query['jet_smart_filters'] )
|
||||
|| empty( $wp_query->query['s'] )
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
$args = array(
|
||||
's' => $wp_query->query['s'],
|
||||
'fields' => 'ids',
|
||||
'posts_per_page' => -1,
|
||||
'relevanssi' => true,
|
||||
);
|
||||
|
||||
$relevanssi_query = new WP_Query( $args );
|
||||
|
||||
$results = ! empty( $relevanssi_query->posts )
|
||||
? $relevanssi_query->posts
|
||||
: array( 0 );
|
||||
|
||||
$wp_query->set( 'post__in', $results );
|
||||
$wp_query->set( 'post_type', 'any' );
|
||||
$wp_query->set( 'post_status', 'any' );
|
||||
$wp_query->set( 'orderby', 'post__in' );
|
||||
$wp_query->set( 'order', 'DESC' );
|
||||
$wp_query->set( 's', false );
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/memberpress.php
|
||||
*
|
||||
* Memberpress compatibility features.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_filter( 'relevanssi_post_ok', 'relevanssi_memberpress_compatibility', 10, 2 );
|
||||
|
||||
/**
|
||||
* Checks whether the user is allowed to see the post.
|
||||
*
|
||||
* @param boolean $post_ok Can the post be shown to the user.
|
||||
* @param int $post_id The post ID.
|
||||
*
|
||||
* @return boolean $post_ok True if the user is allowed to see the post,
|
||||
* otherwise false.
|
||||
*/
|
||||
function relevanssi_memberpress_compatibility( $post_ok, $post_id ) {
|
||||
$post = get_post( $post_id );
|
||||
if ( MeprRule::is_locked( $post ) ) {
|
||||
$post_ok = false;
|
||||
}
|
||||
|
||||
return $post_ok;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/members.php
|
||||
*
|
||||
* Members compatibility features.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_filter( 'relevanssi_post_ok', 'relevanssi_members_compatibility', 10, 2 );
|
||||
|
||||
/**
|
||||
* Checks whether the user is allowed to see the post.
|
||||
*
|
||||
* Only applies to private posts and only if the "content permissions" feature
|
||||
* is enabled.
|
||||
*
|
||||
* @param boolean $post_ok Can the post be shown to the user.
|
||||
* @param int $post_id The post ID.
|
||||
*
|
||||
* @return boolean $post_ok True if the user is allowed to see the post,
|
||||
* otherwise false.
|
||||
*/
|
||||
function relevanssi_members_compatibility( $post_ok, $post_id ) {
|
||||
$status = relevanssi_get_post_status( $post_id );
|
||||
|
||||
if ( 'private' === $status ) {
|
||||
if ( members_content_permissions_enabled() ) {
|
||||
$post_ok = members_can_current_user_view_post( $post_id );
|
||||
}
|
||||
}
|
||||
|
||||
return $post_ok;
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/ninjatables.php
|
||||
*
|
||||
* Ninja Tables compatibility features.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_filter( 'relevanssi_post_content', 'relevanssi_index_ninja_tables' );
|
||||
|
||||
/**
|
||||
* Indexes Ninja Tables table contents.
|
||||
*
|
||||
* Uses regular expression matching to find all the Ninja Tables shortcodes in
|
||||
* the post content and then uses relevanssi_index_ninja_table() to convert the
|
||||
* tables into strings.
|
||||
*
|
||||
* @uses $wpdb WordPress database abstraction.
|
||||
* @see relevanssi_index_ninja_table()
|
||||
*
|
||||
* @param string $content The post content.
|
||||
*
|
||||
* @return string Post content with the Ninja Tables data.
|
||||
*/
|
||||
function relevanssi_index_ninja_tables( $content ) {
|
||||
$m = preg_match_all(
|
||||
'/.*\[ninja_tables.*?id=["\'](\d+)["\'].*?\]/im',
|
||||
$content,
|
||||
$matches,
|
||||
PREG_PATTERN_ORDER
|
||||
);
|
||||
if ( ! $m ) {
|
||||
return $content;
|
||||
}
|
||||
foreach ( $matches[1] as $table_id ) {
|
||||
$content .= ' ' . relevanssi_index_ninja_table( $table_id );
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a string containing a Ninja Table table contents.
|
||||
*
|
||||
* The string contains the caption and the values from each row. The table
|
||||
* title and description are also included, if they are set visible on the
|
||||
* frontend.
|
||||
*
|
||||
* @uses $wpdb WordPress database abstraction.
|
||||
*
|
||||
* @param int $table_id The table ID.
|
||||
*
|
||||
* @return string The table content as a string.
|
||||
*/
|
||||
function relevanssi_index_ninja_table( $table_id ) {
|
||||
global $wpdb;
|
||||
$table_post = get_post( $table_id );
|
||||
$table_settings = get_post_meta( $table_id, '_ninja_table_settings', true );
|
||||
$table_contents = '';
|
||||
|
||||
if ( isset( $table_settings['show_description'] ) && '1' === $table_settings['show_description'] ) {
|
||||
$table_contents .= ' ' . $table_post->post_content;
|
||||
}
|
||||
if ( isset( $table_settings['show_title'] ) && '1' === $table_settings['show_title'] ) {
|
||||
$table_contents .= ' ' . $table_post->post_title;
|
||||
}
|
||||
$table_contents .= ' ' . get_post_meta( $table_id, '_ninja_table_caption', true );
|
||||
|
||||
$rows = $wpdb->get_results(
|
||||
$wpdb->prepare(
|
||||
"SELECT value FROM {$wpdb->prefix}ninja_table_items WHERE table_id=%d",
|
||||
$table_id
|
||||
)
|
||||
);
|
||||
foreach ( $rows as $row ) {
|
||||
$array_values = array_map(
|
||||
function ( $value ) {
|
||||
if ( is_object( $value ) ) {
|
||||
return '';
|
||||
}
|
||||
return strval( $value );
|
||||
},
|
||||
array_values( get_object_vars( json_decode( $row->value ) ) )
|
||||
);
|
||||
|
||||
$table_contents .= ' ' . implode( ' ', $array_values );
|
||||
}
|
||||
|
||||
return $table_contents;
|
||||
}
|
||||
@@ -0,0 +1,259 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/oxygen.php
|
||||
*
|
||||
* Oxygen Builder compatibility features.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_filter( 'relevanssi_custom_field_value', 'relevanssi_oxygen_compatibility', 10, 3 );
|
||||
add_filter( 'relevanssi_index_custom_fields', 'relevanssi_add_oxygen' );
|
||||
add_filter( 'option_relevanssi_index_fields', 'relevanssi_oxygen_fix_none_setting' );
|
||||
add_filter( 'relevanssi_oxygen_section_content', 'relevanssi_oxygen_code_block' );
|
||||
add_filter( 'relevanssi_oxygen_section_content', 'relevanssi_oxygen_rich_text' );
|
||||
add_action( 'save_post', 'relevanssi_insert_edit', 99, 1 );
|
||||
|
||||
/**
|
||||
* Cleans up the Oxygen Builder custom field for Relevanssi consumption.
|
||||
*
|
||||
* Splits up the big custom field content from ct_builder_shortcodes into
|
||||
* sections ([ct_section] tags). Each section can be processed with filters
|
||||
* defined with `relevanssi_oxygen_section_filters`, for example to remove
|
||||
* sections based on their "nicename" or "ct_category" values. After that the
|
||||
* section is passed through the `relevanssi_oxygen_section_content` filter.
|
||||
* Finally all shortcode tags are removed, leaving just the content.
|
||||
*
|
||||
* @param array $value An array of custom field values.
|
||||
* @param string $field The name of the custom field. This function only looks
|
||||
* at `ct_builder_shortcodes` fields.
|
||||
* @param int $post_id The post ID.
|
||||
*
|
||||
* @return array|null An array of custom field values, null if no value exists.
|
||||
*/
|
||||
function relevanssi_oxygen_compatibility( $value, $field, $post_id ) {
|
||||
if ( 'ct_builder_json' === $field ) {
|
||||
$json = array();
|
||||
foreach ( $value as $row ) {
|
||||
$json[] = json_decode( $row );
|
||||
}
|
||||
|
||||
$content = '';
|
||||
if ( isset( $json[0]->children ) ) {
|
||||
foreach ( $json[0]->children as $child ) {
|
||||
$content .= relevanssi_process_oxygen_child( $child );
|
||||
}
|
||||
}
|
||||
|
||||
$value[0] = $content;
|
||||
return $value;
|
||||
}
|
||||
|
||||
if ( 'ct_builder_shortcodes_revisions_dates' === $field ) {
|
||||
return '';
|
||||
}
|
||||
if ( 'ct_builder_shortcodes_revisions' === $field ) {
|
||||
return '';
|
||||
}
|
||||
if ( 'ct_builder_shortcodes' === $field ) {
|
||||
if ( version_compare( CT_VERSION, '4.0', '>=' ) ) {
|
||||
return null;
|
||||
}
|
||||
if ( empty( $value ) ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$content_tags = explode( '[ct_section', $value[0] );
|
||||
$page_content = '';
|
||||
|
||||
foreach ( $content_tags as $content ) {
|
||||
if ( empty( $content ) ) {
|
||||
continue;
|
||||
}
|
||||
if ( '[' !== substr( $content, 0, 1 ) ) {
|
||||
$content = '[ct_section' . $content;
|
||||
}
|
||||
/**
|
||||
* Allows defining filters to remove Oxygen Builder sections.
|
||||
*
|
||||
* The filters are arrays, with the array key defining the key and
|
||||
* the value defining the value. If the filter array is
|
||||
* array( 'nicename' => 'Hero BG' ), Relevanssi will look for
|
||||
* sections that have "nicename":"Hero BG" in their settings and
|
||||
* will remove those.
|
||||
*
|
||||
* @param array An array of filtering rules, defaults empty.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
$filters = apply_filters(
|
||||
'relevanssi_oxygen_section_filters',
|
||||
array()
|
||||
);
|
||||
array_walk(
|
||||
$filters,
|
||||
function ( $filter ) use ( &$content ) {
|
||||
foreach ( $filter as $key => $value ) {
|
||||
if ( stristr( $content, '"' . $key . '":"' . $value . '"' ) !== false ) {
|
||||
$content = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
$content = preg_replace(
|
||||
array(
|
||||
'/\[oxygen.*?\]/',
|
||||
'/\[\/?ct_.*?\]/',
|
||||
'/\[\/?oxy_.*?\]/',
|
||||
),
|
||||
' ',
|
||||
/**
|
||||
* Filters the Oxygen Builder section content before the
|
||||
* Oxygen Builder shortcode tags are removed.
|
||||
*
|
||||
* @param string $content The single section content.
|
||||
* @param int $post_id The post ID.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
apply_filters(
|
||||
'relevanssi_oxygen_section_content',
|
||||
$content,
|
||||
$post_id
|
||||
)
|
||||
);
|
||||
|
||||
$page_content .= $content;
|
||||
}
|
||||
|
||||
$page_content = relevanssi_do_shortcode( $page_content );
|
||||
|
||||
$value[0] = $page_content;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively processes the Oxygen JSON data.
|
||||
*
|
||||
* This function extracts all the ct_content data from the JSON. All elements
|
||||
* are run through the relevanssi_oxygen_element filter hook. You can use that
|
||||
* filter hook to modify or to eliminate elements from the JSON.
|
||||
*
|
||||
* @param array $child The child element array.
|
||||
*
|
||||
* @return string The content from the child and the grandchildren.
|
||||
*/
|
||||
function relevanssi_process_oxygen_child( $child ): string {
|
||||
/**
|
||||
* Filters the Oxygen JSON child element.
|
||||
*
|
||||
* If the filter returns an empty value, the child element and all its
|
||||
* children will be ignored.
|
||||
*
|
||||
* @param array $child The JSON child element.
|
||||
*/
|
||||
$child = apply_filters( 'relevanssi_oxygen_element', $child );
|
||||
if ( empty( $child ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$child_content = ' ';
|
||||
if ( isset( $child->options->ct_content ) ) {
|
||||
$child_content .= $child->options->ct_content;
|
||||
}
|
||||
|
||||
if ( isset( $child->options->original->{'code-php'} ) ) {
|
||||
// For code and HTML blocks, strip all tags.
|
||||
$child_content .= wp_strip_all_tags( $child->options->original->{'code-php'} );
|
||||
}
|
||||
|
||||
if ( isset( $child->children ) ) {
|
||||
foreach ( $child->children as $grandchild ) {
|
||||
$child_content .= relevanssi_process_oxygen_child( $grandchild );
|
||||
}
|
||||
}
|
||||
|
||||
return $child_content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the Oxygen custom field to the list of indexed custom fields.
|
||||
*
|
||||
* @param array|boolean $fields An array of custom fields to index, or false.
|
||||
*
|
||||
* @return array An array of custom fields, including `ct_builder_json` or
|
||||
* `ct_builder_shortcodes`.
|
||||
*/
|
||||
function relevanssi_add_oxygen( $fields ) {
|
||||
$oxygen_field = version_compare( CT_VERSION, '4.0', '>=' )
|
||||
? 'ct_builder_json'
|
||||
: 'ct_builder_shortcodes';
|
||||
if ( ! is_array( $fields ) ) {
|
||||
$fields = array();
|
||||
}
|
||||
if ( ! in_array( $oxygen_field, $fields, true ) ) {
|
||||
$fields[] = $oxygen_field;
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes sure the Oxygen builder shortcode is included in the index, even when
|
||||
* the custom field setting is set to 'none'.
|
||||
*
|
||||
* @param string $value The custom field indexing setting value. The parameter
|
||||
* is ignored, Relevanssi disables this filter and then checks the option to
|
||||
* see what the value is.
|
||||
*
|
||||
* @return string If value is undefined, it's set to 'ct_builder_json' or
|
||||
* 'ct_builder_shortcodes'.
|
||||
*/
|
||||
function relevanssi_oxygen_fix_none_setting( $value ) {
|
||||
if ( ! $value ) {
|
||||
$value = version_compare( CT_VERSION, '4.0', '>=' )
|
||||
? 'ct_builder_json'
|
||||
: 'ct_builder_shortcodes';
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indexes the Base64 encoded PHP & HTML code block contents.
|
||||
*
|
||||
* @param string $content The section content from the
|
||||
* relevanssi_oxygen_section_content filter hook.
|
||||
*
|
||||
* @return string $content The content with the decoded code block content
|
||||
* added to the end.
|
||||
*/
|
||||
function relevanssi_oxygen_code_block( $content ) {
|
||||
if ( preg_match_all( '/\[ct_code_block.*?ct_code_block\]/', $content, $matches ) ) {
|
||||
foreach ( $matches[0] as $match ) {
|
||||
if ( preg_match_all( '/"code-php":"(.*?)"/', $match, $block_matches ) ) {
|
||||
foreach ( $block_matches[1] as $encoded_text ) {
|
||||
$content .= ' ' . base64_decode( $encoded_text ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the Oxygen rich text shortcode.
|
||||
*
|
||||
* @param string $content The content of the Oxygen section.
|
||||
*
|
||||
* @return string The content with the oxy_rich_text shortcodes removed.
|
||||
*/
|
||||
function relevanssi_oxygen_rich_text( $content ) {
|
||||
$content = preg_replace( '/\[\/?oxy_rich_text.*?\]/im', '', $content );
|
||||
return $content;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/paidmembershippro.php
|
||||
*
|
||||
* Paid Membership Pro compatibility features.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_filter( 'relevanssi_post_ok', 'relevanssi_paidmembershippro_compatibility', 10, 2 );
|
||||
|
||||
/**
|
||||
* Checks whether the user is allowed to see the post.
|
||||
*
|
||||
* @param boolean $post_ok Can the post be shown to the user.
|
||||
* @param int $post_id The post ID.
|
||||
*
|
||||
* @return boolean $post_ok True if the user is allowed to see the post,
|
||||
* otherwise false.
|
||||
*/
|
||||
function relevanssi_paidmembershippro_compatibility( $post_ok, $post_id ) {
|
||||
$pmpro_active = get_option( 'pmpro_filterqueries', 0 );
|
||||
|
||||
if ( $pmpro_active ) {
|
||||
$status = relevanssi_get_post_status( $post_id );
|
||||
|
||||
if ( 'publish' === $status ) {
|
||||
// Only apply to published posts, don't apply to drafts.
|
||||
$current_user = wp_get_current_user();
|
||||
$post_ok = pmpro_has_membership_access( $post_id, $current_user->ID );
|
||||
}
|
||||
}
|
||||
|
||||
return $post_ok;
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/polylang.php
|
||||
*
|
||||
* Polylang compatibility features.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_filter( 'relevanssi_modify_wp_query', 'relevanssi_polylang_filter' );
|
||||
add_filter( 'relevanssi_where', 'relevanssi_polylang_where_include_terms' );
|
||||
add_filter( 'relevanssi_hits_filter', 'relevanssi_polylang_term_filter' );
|
||||
|
||||
/**
|
||||
* Removes the Polylang language filters.
|
||||
*
|
||||
* If the Polylang allow all option ('relevanssi_polylang_all_languages') is
|
||||
* enabled this removes the Polylang language filter. By default Polylang
|
||||
* filters the languages using a taxonomy query.
|
||||
*
|
||||
* @param object $query WP_Query object we need to clean up.
|
||||
*/
|
||||
function relevanssi_polylang_filter( $query ) {
|
||||
$polylang_allow_all = get_option( 'relevanssi_polylang_all_languages' );
|
||||
if ( 'on' === $polylang_allow_all ) {
|
||||
$ok_queries = array();
|
||||
|
||||
if ( ! isset( $query->tax_query ) ) {
|
||||
// No tax query set, backing off.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! isset( $query->tax_query->queries ) || ! is_array( $query->tax_query->queries ) ) {
|
||||
// No tax query set, backing off.
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ( $query->tax_query->queries as $tax_query ) {
|
||||
if ( isset( $tax_query['taxonomy'] ) && 'language' !== $tax_query['taxonomy'] ) {
|
||||
// Not a language tax query.
|
||||
$ok_queries[] = $tax_query;
|
||||
}
|
||||
}
|
||||
$query->tax_query->queries = $ok_queries;
|
||||
|
||||
if ( isset( $query->query_vars['tax_query'] ) ) {
|
||||
// Tax queries can be here as well, so let's sweep this one too.
|
||||
$ok_queries = array();
|
||||
foreach ( $query->query_vars['tax_query'] as $tax_query ) {
|
||||
if ( isset( $tax_query['taxonomy'] ) ) {
|
||||
if ( 'language' !== $tax_query['taxonomy'] ) {
|
||||
$ok_queries[] = $tax_query;
|
||||
}
|
||||
} else {
|
||||
// Relation parameter most likely.
|
||||
$ok_queries[] = $tax_query;
|
||||
}
|
||||
}
|
||||
$query->query_vars['tax_query'] = $ok_queries;
|
||||
}
|
||||
|
||||
if ( isset( $query->query_vars['taxonomy'] ) && 'language' === $query->query_vars['taxonomy'] ) {
|
||||
// Another way to set the taxonomy.
|
||||
unset( $query->query_vars['taxonomy'] );
|
||||
unset( $query->query_vars['term'] );
|
||||
}
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows taxonomy terms in language-restricted searches.
|
||||
*
|
||||
* This is a bit of a hack, where the language taxonomy WHERE clause is modified
|
||||
* on the go to allow all posts with the post ID -1 (which means taxonomy terms
|
||||
* and users). This may break suddenly in updates, but I haven't come up with a
|
||||
* better way so far.
|
||||
*
|
||||
* @param string $where The WHERE clause to modify.
|
||||
*
|
||||
* @return string The WHERE clause with additional filtering included.
|
||||
*
|
||||
* @since 2.1.6
|
||||
*/
|
||||
function relevanssi_polylang_where_include_terms( $where ) {
|
||||
global $wpdb;
|
||||
|
||||
$current_language = substr( get_locale(), 0, 2 );
|
||||
if ( function_exists( 'pll_current_language' ) ) {
|
||||
$current_language = pll_current_language();
|
||||
}
|
||||
$languages = get_terms( array( 'taxonomy' => 'language' ) );
|
||||
$language_id = 0;
|
||||
foreach ( $languages as $language ) {
|
||||
if (
|
||||
! is_wp_error( $language ) &&
|
||||
$language instanceof WP_Term &&
|
||||
$language->slug === $current_language
|
||||
) {
|
||||
$language_id = intval( $language->term_id );
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Language ID should now have current language ID.
|
||||
if ( 0 !== $language_id ) {
|
||||
// Do a simple search-and-replace to modify the query.
|
||||
$where = preg_replace( '/\s+/', ' ', $where );
|
||||
$where = preg_replace( '/\(\s/', '(', $where );
|
||||
$where = str_replace(
|
||||
"AND relevanssi.doc IN (SELECT DISTINCT(tr.object_id) FROM {$wpdb->prefix}term_relationships AS tr WHERE tr.term_taxonomy_id IN ($language_id))",
|
||||
"AND (relevanssi.doc IN ( SELECT DISTINCT(tr.object_id) FROM {$wpdb->prefix}term_relationships AS tr WHERE tr.term_taxonomy_id IN ($language_id)) OR (relevanssi.doc = -1))",
|
||||
$where
|
||||
);
|
||||
}
|
||||
return $where;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters out taxonomy terms in the wrong language.
|
||||
*
|
||||
* If all languages are not allowed, this filter goes through the results and
|
||||
* removes the taxonomy terms in the wrong language. This can't be done in the
|
||||
* original query because the term language information is slightly hard to
|
||||
* find.
|
||||
*
|
||||
* @param array $hits The found posts are in $hits[0].
|
||||
*
|
||||
* @return array The $hits array with the unwanted posts removed.
|
||||
*
|
||||
* @since 2.1.6
|
||||
*/
|
||||
function relevanssi_polylang_term_filter( $hits ) {
|
||||
$polylang_allow_all = get_option( 'relevanssi_polylang_all_languages' );
|
||||
if ( 'on' !== $polylang_allow_all ) {
|
||||
$current_language = substr( get_locale(), 0, 2 );
|
||||
if ( function_exists( 'pll_current_language' ) ) {
|
||||
$current_language = pll_current_language();
|
||||
}
|
||||
$accepted_hits = array();
|
||||
foreach ( $hits[0] as $hit ) {
|
||||
$original_hit = $hit;
|
||||
if ( is_numeric( $hit ) ) {
|
||||
// In case "fields" is set to "ids", fetch the post object we need.
|
||||
$original_hit = $hit;
|
||||
$hit = get_post( $hit );
|
||||
}
|
||||
if ( ! isset( $hit->post_content ) && isset( $hit->ID ) ) {
|
||||
// The "fields" is set to "id=>parent".
|
||||
$original_hit = $hit;
|
||||
$hit = get_post( $hit->ID );
|
||||
}
|
||||
|
||||
if ( isset( $hit->ID ) && -1 === $hit->ID && isset( $hit->term_id ) ) {
|
||||
$term_id = intval( $hit->term_id );
|
||||
$translations = pll_get_term_translations( $term_id );
|
||||
if (
|
||||
isset( $translations[ $current_language ] ) &&
|
||||
$translations[ $current_language ] === $term_id
|
||||
) {
|
||||
$accepted_hits[] = $original_hit;
|
||||
}
|
||||
} else {
|
||||
$accepted_hits[] = $original_hit;
|
||||
}
|
||||
}
|
||||
$hits[0] = $accepted_hits;
|
||||
}
|
||||
return $hits;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the term_taxonomy_id matching the Polylang language based on locale.
|
||||
*
|
||||
* @param string $locale The locale string for the language.
|
||||
*
|
||||
* @return int The term_taxonomy_id for the language; 0 if nothing is found.
|
||||
*/
|
||||
function relevanssi_get_language_term_taxonomy_id( $locale ) {
|
||||
global $wpdb, $relevanssi_language_term_ids;
|
||||
|
||||
if ( isset( $relevanssi_language_term_ids[ $locale ] ) ) {
|
||||
return $relevanssi_language_term_ids[ $locale ];
|
||||
}
|
||||
|
||||
$languages = $wpdb->get_results(
|
||||
"SELECT term_taxonomy_id, description FROM $wpdb->term_taxonomy " .
|
||||
"WHERE taxonomy = 'language'"
|
||||
);
|
||||
$term_id = 0;
|
||||
foreach ( $languages as $row ) {
|
||||
$description = unserialize( $row->description ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions
|
||||
if ( $description['locale'] === $locale ) {
|
||||
$term_id = $row->term_taxonomy_id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$relevanssi_language_term_ids[ $locale ] = $term_id;
|
||||
|
||||
return $term_id;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/pretty-links.php
|
||||
*
|
||||
* Pretty Links compatibility features.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_filter( 'relevanssi_admin_search_ok', 'relevanssi_pretty_links_ok', 10, 2 );
|
||||
add_filter( 'relevanssi_prevent_default_request', 'relevanssi_pretty_links_ok', 10, 2 );
|
||||
add_filter( 'relevanssi_search_ok', 'relevanssi_pretty_links_ok', 10, 2 );
|
||||
|
||||
/**
|
||||
* Returns false if the query post type is set to 'pretty-link'.
|
||||
*
|
||||
* @param boolean $ok Whether to allow the query.
|
||||
* @param WP_Query $query The WP_Query object.
|
||||
*
|
||||
* @return boolean False if this is a Pretty Links query.
|
||||
*/
|
||||
function relevanssi_pretty_links_ok( $ok, $query ) {
|
||||
if ( isset( $query->query['post_type'] ) && 'pretty-link' === $query->query['post_type'] ) {
|
||||
$ok = false;
|
||||
}
|
||||
return $ok;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/product-gtin-ean-upc-isbn-for-woocommerce.php.php
|
||||
*
|
||||
* Adds Product GTIN (EAN, UPC, ISBN) for WooCommerce support for Relevanssi.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_action( 'pre_option_wpm_pgw_search_by_code', 'relevanssi_disable_gtin_code' );
|
||||
add_filter( 'relevanssi_index_custom_fields', 'relevanssi_add_wpm_gtin_code' );
|
||||
add_filter( 'option_relevanssi_index_fields', 'relevanssi_wpm_pgw_fix_none_setting' );
|
||||
|
||||
/**
|
||||
* Disables the 'wpm_pgw_search_by_code' option.
|
||||
*
|
||||
* If this option is enabled, it will break Relevanssi search when there's a
|
||||
* match for the code.
|
||||
*
|
||||
* @return string 'no'.
|
||||
*/
|
||||
function relevanssi_disable_gtin_code() {
|
||||
return 'no';
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the `_wpm_gtin_code` to the list of indexed custom fields.
|
||||
*
|
||||
* @param array|boolean $fields An array of custom fields to index, or false.
|
||||
*
|
||||
* @return array An array of custom fields, including `_wpm_gtin_code`.
|
||||
*/
|
||||
function relevanssi_add_wpm_gtin_code( $fields ) {
|
||||
if ( ! is_array( $fields ) ) {
|
||||
$fields = array();
|
||||
}
|
||||
if ( ! in_array( '_wpm_gtin_code', $fields, true ) ) {
|
||||
$fields[] = '_wpm_gtin_code';
|
||||
}
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes sure the GTIN code is included in the index, even when the custom field
|
||||
* setting is set to 'none'.
|
||||
*
|
||||
* @param string $value The custom field indexing setting value. The parameter
|
||||
* is ignored, Relevanssi disables this filter and then checks the option to
|
||||
* see what the value is.
|
||||
*
|
||||
* @return string If value is undefined, it's set to '_wpm_gtin_code'.
|
||||
*/
|
||||
function relevanssi_wpm_pgw_fix_none_setting( $value ) {
|
||||
if ( ! $value ) {
|
||||
$value = '_wpm_gtin_code';
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/rankmath.php
|
||||
*
|
||||
* Rank Math noindex filtering function.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_filter( 'relevanssi_do_not_index', 'relevanssi_rankmath_noindex', 10, 2 );
|
||||
add_filter( 'relevanssi_indexing_restriction', 'relevanssi_rankmath_exclude' );
|
||||
add_action( 'relevanssi_indexing_tab_advanced', 'relevanssi_rankmath_form', 20 );
|
||||
add_action( 'relevanssi_indexing_options', 'relevanssi_rankmath_options' );
|
||||
|
||||
/**
|
||||
* Blocks indexing of posts marked "noindex" in the Rank Math settings.
|
||||
*
|
||||
* Attaches to the 'relevanssi_do_not_index' filter hook.
|
||||
*
|
||||
* @param boolean $do_not_index True, if the post shouldn't be indexed.
|
||||
* @param integer $post_id The post ID number.
|
||||
*
|
||||
* @return string|boolean If the post shouldn't be indexed, this returns
|
||||
* 'RankMath'. The value may also be a boolean.
|
||||
*/
|
||||
function relevanssi_rankmath_noindex( $do_not_index, $post_id ) {
|
||||
if ( 'on' !== get_option( 'relevanssi_seo_noindex' ) ) {
|
||||
return $do_not_index;
|
||||
}
|
||||
$noindex = get_post_meta( $post_id, 'rank_math_robots', true );
|
||||
if ( is_array( $noindex ) && in_array( 'noindex', $noindex, true ) ) {
|
||||
$do_not_index = 'RankMath';
|
||||
}
|
||||
return $do_not_index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Excludes the "noindex" posts from Relevanssi indexing.
|
||||
*
|
||||
* Adds a MySQL query restriction that blocks posts that have the Rank Math
|
||||
* "rank_math_robots" setting set to something that includes "noindex".
|
||||
*
|
||||
* @param array $restriction An array with two values: 'mysql' for the MySQL
|
||||
* query restriction to modify, 'reason' for the reason of restriction.
|
||||
*/
|
||||
function relevanssi_rankmath_exclude( $restriction ) {
|
||||
if ( 'on' !== get_option( 'relevanssi_seo_noindex' ) ) {
|
||||
return $restriction;
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
|
||||
// Backwards compatibility code for 2.8.0, remove at some point.
|
||||
if ( is_string( $restriction ) ) {
|
||||
$restriction = array(
|
||||
'mysql' => $restriction,
|
||||
'reason' => '',
|
||||
);
|
||||
}
|
||||
|
||||
$restriction['mysql'] .= " AND post.ID NOT IN (SELECT post_id FROM
|
||||
$wpdb->postmeta WHERE meta_key = 'rank_math_robots'
|
||||
AND meta_value LIKE '%noindex%' ) ";
|
||||
$restriction['reason'] .= ' Rank Math';
|
||||
return $restriction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints out the form fields for disabling the feature.
|
||||
*/
|
||||
function relevanssi_rankmath_form() {
|
||||
$seo_noindex = get_option( 'relevanssi_seo_noindex' );
|
||||
$seo_noindex = relevanssi_check( $seo_noindex );
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for='relevanssi_seo_noindex'><?php esc_html_e( 'Use Rank Math SEO noindex', 'relevanssi' ); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<label for='relevanssi_seo_noindex'>
|
||||
<input type='checkbox' name='relevanssi_seo_noindex' id='relevanssi_seo_noindex' <?php echo esc_attr( $seo_noindex ); ?> />
|
||||
<?php esc_html_e( 'Use Rank Math SEO noindex.', 'relevanssi' ); ?>
|
||||
</label>
|
||||
<p class="description"><?php esc_html_e( 'If checked, Relevanssi will not index posts marked as "No index" in Rank Math SEO settings.', 'relevanssi' ); ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the SEO No index option.
|
||||
*
|
||||
* @param array $request An array of option values from the request.
|
||||
*/
|
||||
function relevanssi_rankmath_options( array $request ) {
|
||||
relevanssi_update_off_or_on( $request, 'relevanssi_seo_noindex', true );
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/restrictcontentpro.php
|
||||
*
|
||||
* Restrict Content Pro compatibility features.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_filter( 'relevanssi_post_ok', 'relevanssi_restrictcontentpro_compatibility', 10, 2 );
|
||||
|
||||
/**
|
||||
* Checks whether the user is allowed to see the post.
|
||||
*
|
||||
* @param boolean $post_ok Can the post be shown to the user.
|
||||
* @param int $post_id The post ID.
|
||||
*
|
||||
* @return boolean $post_ok True if the user is allowed to see the post,
|
||||
* otherwise false.
|
||||
*/
|
||||
function relevanssi_restrictcontentpro_compatibility( $post_ok, $post_id ) {
|
||||
if ( ! $post_ok ) {
|
||||
return $post_ok;
|
||||
}
|
||||
|
||||
$post_ok = rcp_user_can_access( get_current_user_id(), $post_id );
|
||||
|
||||
return $post_ok;
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/seoframework.php
|
||||
*
|
||||
* The SEO Framework noindex filtering function.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_filter( 'relevanssi_do_not_index', 'relevanssi_seoframework_noindex', 10, 2 );
|
||||
add_filter( 'relevanssi_indexing_restriction', 'relevanssi_seoframework_exclude' );
|
||||
add_action( 'relevanssi_indexing_tab_advanced', 'relevanssi_seoframework_form', 20 );
|
||||
add_action( 'relevanssi_indexing_options', 'relevanssi_seoframework_options' );
|
||||
|
||||
/**
|
||||
* Blocks indexing of posts marked "Exclude this page from all search queries
|
||||
* on this site." in the SEO Framework settings.
|
||||
*
|
||||
* Attaches to the 'relevanssi_do_not_index' filter hook.
|
||||
*
|
||||
* @param boolean $do_not_index True, if the post shouldn't be indexed.
|
||||
* @param integer $post_id The post ID number.
|
||||
*
|
||||
* @return string|boolean If the post shouldn't be indexed, this returns
|
||||
* 'SEO Framework'. The value may also be a boolean.
|
||||
*/
|
||||
function relevanssi_seoframework_noindex( $do_not_index, $post_id ) {
|
||||
if ( 'on' !== get_option( 'relevanssi_seo_noindex' ) ) {
|
||||
return $do_not_index;
|
||||
}
|
||||
|
||||
$noindex = get_post_meta( $post_id, 'exclude_local_search', true );
|
||||
if ( '1' === $noindex ) {
|
||||
$do_not_index = 'SEO Framework';
|
||||
}
|
||||
return $do_not_index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Excludes the "noindex" posts from Relevanssi indexing.
|
||||
*
|
||||
* Adds a MySQL query restriction that blocks posts that have the SEO Framework
|
||||
* "Exclude this page from all search queries on this site" setting set to "1"
|
||||
* from indexing.
|
||||
*
|
||||
* @param array $restriction An array with two values: 'mysql' for the MySQL
|
||||
* query restriction to modify, 'reason' for the reason of restriction.
|
||||
*/
|
||||
function relevanssi_seoframework_exclude( $restriction ) {
|
||||
if ( 'on' !== get_option( 'relevanssi_seo_noindex' ) ) {
|
||||
return $restriction;
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
|
||||
$restriction['mysql'] .= " AND post.ID NOT IN (SELECT post_id FROM
|
||||
$wpdb->postmeta WHERE meta_key = 'exclude_local_search'
|
||||
AND meta_value = '1' ) ";
|
||||
$restriction['reason'] .= ' SEO Framework';
|
||||
return $restriction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints out the form fields for disabling the feature.
|
||||
*/
|
||||
function relevanssi_seoframework_form() {
|
||||
$seo_noindex = get_option( 'relevanssi_seo_noindex' );
|
||||
$seo_noindex = relevanssi_check( $seo_noindex );
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for='relevanssi_seo_noindex'><?php esc_html_e( 'Use SEO Framework noindex', 'relevanssi' ); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<label for='relevanssi_seo_noindex'>
|
||||
<input type='checkbox' name='relevanssi_seo_noindex' id='relevanssi_seo_noindex' <?php echo esc_attr( $seo_noindex ); ?> />
|
||||
<?php esc_html_e( 'Use SEO Framework noindex.', 'relevanssi' ); ?>
|
||||
</label>
|
||||
<p class="description"><?php esc_html_e( 'If checked, Relevanssi will not index posts marked as "No index" in SEO Framework settings.', 'relevanssi' ); ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the SEO No index option.
|
||||
*
|
||||
* @param array $request An array of option values from the request.
|
||||
*/
|
||||
function relevanssi_seoframework_options( array $request ) {
|
||||
relevanssi_update_off_or_on( $request, 'relevanssi_seo_noindex', true );
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/seopress.php
|
||||
*
|
||||
* SEOPress noindex filtering function.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Benjamin Denis
|
||||
* @source ./yoast-seo.php (Mikko Saari)
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_filter( 'relevanssi_do_not_index', 'relevanssi_seopress_noindex', 10, 2 );
|
||||
add_filter( 'relevanssi_indexing_restriction', 'relevanssi_seopress_exclude' );
|
||||
add_action( 'relevanssi_indexing_tab_advanced', 'relevanssi_seopress_form', 20 );
|
||||
add_action( 'relevanssi_indexing_options', 'relevanssi_seopress_options' );
|
||||
|
||||
/**
|
||||
* Blocks indexing of posts marked "noindex" in the SEOPress settings.
|
||||
*
|
||||
* Attaches to the 'relevanssi_do_not_index' filter hook.
|
||||
*
|
||||
* @param boolean $do_not_index True, if the post shouldn't be indexed.
|
||||
* @param integer $post_id The post ID number.
|
||||
*
|
||||
* @return string|boolean If the post shouldn't be indexed, this returns
|
||||
* 'seopress'. The value may also be a boolean.
|
||||
*/
|
||||
function relevanssi_seopress_noindex( $do_not_index, $post_id ) {
|
||||
if ( 'on' !== get_option( 'relevanssi_seo_noindex' ) ) {
|
||||
return $do_not_index;
|
||||
}
|
||||
|
||||
$noindex = get_post_meta( $post_id, '_seopress_robots_index', true );
|
||||
if ( 'yes' === $noindex ) {
|
||||
$do_not_index = 'SEOPress';
|
||||
}
|
||||
return $do_not_index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Excludes the "noindex" posts from Relevanssi indexing.
|
||||
*
|
||||
* Adds a MySQL query restriction that blocks posts that have the SEOPress
|
||||
* "noindex" setting set to "1" from indexing.
|
||||
*
|
||||
* @param array $restriction An array with two values: 'mysql' for the MySQL
|
||||
* query restriction to modify, 'reason' for the reason of restriction.
|
||||
*/
|
||||
function relevanssi_seopress_exclude( $restriction ) {
|
||||
if ( 'on' !== get_option( 'relevanssi_seo_noindex' ) ) {
|
||||
return $restriction;
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
// Backwards compatibility code for 2.8.0, remove at some point.
|
||||
if ( is_string( $restriction ) ) {
|
||||
$restriction = array(
|
||||
'mysql' => $restriction,
|
||||
'reason' => '',
|
||||
);
|
||||
}
|
||||
|
||||
$restriction['mysql'] .= " AND post.ID NOT IN (SELECT post_id FROM
|
||||
$wpdb->postmeta WHERE meta_key = '_seopress_robots_index'
|
||||
AND meta_value = 'yes' ) ";
|
||||
$restriction['reason'] .= 'SEOPress';
|
||||
return $restriction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints out the form fields for disabling the feature.
|
||||
*/
|
||||
function relevanssi_seopress_form() {
|
||||
$seo_noindex = get_option( 'relevanssi_seo_noindex' );
|
||||
$seo_noindex = relevanssi_check( $seo_noindex );
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for='relevanssi_seo_noindex'><?php esc_html_e( 'Use SEOPress noindex', 'relevanssi' ); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<label for='relevanssi_seo_noindex'>
|
||||
<input type='checkbox' name='relevanssi_seo_noindex' id='relevanssi_seo_noindex' <?php echo esc_attr( $seo_noindex ); ?> />
|
||||
<?php esc_html_e( 'Use SEOPress noindex.', 'relevanssi' ); ?>
|
||||
</label>
|
||||
<p class="description"><?php esc_html_e( 'If checked, Relevanssi will not index posts marked as "No index" in SEOPress settings.', 'relevanssi' ); ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the SEO No index option.
|
||||
*
|
||||
* @param array $request An array of option values from the request.
|
||||
*/
|
||||
function relevanssi_seopress_options( array $request ) {
|
||||
relevanssi_update_off_or_on( $request, 'relevanssi_seo_noindex', true );
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/simplemembership.php
|
||||
*
|
||||
* Simple Membership compatibility features.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_filter( 'relevanssi_post_ok', 'relevanssi_simplemembership_compatibility', 10, 2 );
|
||||
|
||||
/**
|
||||
* Checks whether the user is allowed to see the post.
|
||||
*
|
||||
* @param boolean $post_ok Can the post be shown to the user.
|
||||
* @param int $post_id The post ID.
|
||||
*
|
||||
* @return boolean $post_ok True if the user is allowed to see the post,
|
||||
* otherwise false.
|
||||
*/
|
||||
function relevanssi_simplemembership_compatibility( $post_ok, $post_id ) {
|
||||
$access_ctrl = SwpmAccessControl::get_instance();
|
||||
$post = get_post( $post_id );
|
||||
$post_ok = $access_ctrl->can_i_read_post( $post );
|
||||
|
||||
return $post_ok;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/tablepress.php
|
||||
*
|
||||
* TablePress compatibility features.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Enables TablePress shortcodes for Relevanssi indexing.
|
||||
*
|
||||
* @return null|object The TablePress controller.
|
||||
*/
|
||||
function relevanssi_enable_tablepress_shortcodes() {
|
||||
$my_tablepress_controller = null;
|
||||
if ( defined( 'TABLEPRESS_ABSPATH' ) ) {
|
||||
if ( ! isset( TablePress::$model_options ) ) {
|
||||
include_once TABLEPRESS_ABSPATH . 'classes/class-model.php';
|
||||
include_once TABLEPRESS_ABSPATH . 'models/model-options.php';
|
||||
TablePress::$model_options = new TablePress_Options_Model();
|
||||
}
|
||||
$my_tablepress_controller = TablePress::load_controller( 'frontend' );
|
||||
$my_tablepress_controller->init_shortcodes();
|
||||
}
|
||||
return $my_tablepress_controller;
|
||||
}
|
||||
|
||||
add_filter( 'relevanssi_post_content', 'relevanssi_table_filter' );
|
||||
|
||||
/**
|
||||
* Replaces the [table_filter] shortcodes with [table].
|
||||
*
|
||||
* The shortcode filter extension adds a [table_filter] shortcode which is not
|
||||
* compatible with Relevanssi. This function switches those to the normal
|
||||
* [table] shortcode which works better.
|
||||
*
|
||||
* @param string $content The post content.
|
||||
*
|
||||
* @return string The fixed post content.
|
||||
*/
|
||||
function relevanssi_table_filter( $content ) {
|
||||
$content = str_replace( '[table_filter', '[table', $content );
|
||||
return $content;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/useraccessmanager.php
|
||||
*
|
||||
* User Access Manager compatibility features.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_filter( 'relevanssi_post_ok', 'relevanssi_useraccessmanager_compatibility', 10, 2 );
|
||||
|
||||
/**
|
||||
* Checks whether the user is allowed to see the post.
|
||||
*
|
||||
* @param boolean $post_ok Can the post be shown to the user.
|
||||
* @param int $post_id The post ID.
|
||||
*
|
||||
* @return boolean $post_ok True if the user is allowed to see the post,
|
||||
* otherwise false.
|
||||
*/
|
||||
function relevanssi_useraccessmanager_compatibility( $post_ok, $post_id ) {
|
||||
$status = relevanssi_get_post_status( $post_id );
|
||||
|
||||
if ( 'publish' === $status ) {
|
||||
// Only apply to published posts, don't apply to drafts.
|
||||
|
||||
// phpcs:disable WordPress.NamingConventions.ValidVariableName
|
||||
global $userAccessManager;
|
||||
$type = relevanssi_get_post_type( $post_id );
|
||||
$post_ok = $userAccessManager->getAccessHandler()->checkObjectAccess( $type, $post_id );
|
||||
// phpcs:enable WordPress.NamingConventions.ValidVariableName
|
||||
}
|
||||
|
||||
return $post_ok;
|
||||
}
|
||||
@@ -0,0 +1,282 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/woocommerce.php
|
||||
*
|
||||
* WooCommerce compatibility features.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_filter( 'relevanssi_indexing_restriction', 'relevanssi_woocommerce_restriction' );
|
||||
add_filter( 'relevanssi_admin_search_blocked_post_types', 'relevanssi_woocommerce_admin_search_blocked_post_types' );
|
||||
add_filter( 'relevanssi_modify_wp_query', 'relevanssi_woocommerce_filters' );
|
||||
|
||||
/**
|
||||
* This action solves the problems introduced by adjust_posts_count() in
|
||||
* WooCommerce version 4.4.0.
|
||||
*/
|
||||
add_action( 'woocommerce_before_shop_loop', 'relevanssi_wc_reset_loop' );
|
||||
|
||||
RELEVANSSI_PREMIUM && add_filter( 'relevanssi_match', 'relevanssi_sku_boost' );
|
||||
|
||||
/**
|
||||
* Resets the WC post loop in search queries.
|
||||
*
|
||||
* Hooks on to woocommerce_before_shop_loop.
|
||||
*/
|
||||
function relevanssi_wc_reset_loop() {
|
||||
global $wp_query;
|
||||
if ( $wp_query->is_search ) {
|
||||
wc_reset_loop();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Applies the WooCommerce product visibility filter.
|
||||
*
|
||||
* @param array $restriction An array with two values: 'mysql' for the MySQL
|
||||
* query restriction to modify, 'reason' for the reason of restriction.
|
||||
*/
|
||||
function relevanssi_woocommerce_restriction( $restriction ) {
|
||||
// Backwards compatibility code for 2.8.0, remove at some point.
|
||||
if ( is_string( $restriction ) ) {
|
||||
$restriction = array(
|
||||
'mysql' => $restriction,
|
||||
'reason' => '',
|
||||
);
|
||||
}
|
||||
|
||||
$restriction['mysql'] .= relevanssi_woocommerce_indexing_filter();
|
||||
$restriction['reason'] .= 'WooCommerce';
|
||||
return $restriction;
|
||||
}
|
||||
|
||||
/**
|
||||
* WooCommerce product visibility filtering for indexing.
|
||||
*
|
||||
* This filter is applied before the posts are selected for indexing, so this will
|
||||
* skip all the excluded posts right away.
|
||||
*
|
||||
* @since 4.0.9 (2.1.5)
|
||||
* @global $wpdb The WordPress database interface.
|
||||
*
|
||||
* @return string $restriction The query restriction for the WooCommerce filtering.
|
||||
*/
|
||||
function relevanssi_woocommerce_indexing_filter() {
|
||||
global $wpdb;
|
||||
|
||||
$restriction = '';
|
||||
$woocommerce_blocks = array(
|
||||
'outofstock' => false,
|
||||
'exclude-from-catalog' => false,
|
||||
'exclude-from-search' => true,
|
||||
);
|
||||
/**
|
||||
* Controls the WooCommerce product visibility filtering.
|
||||
*
|
||||
* @param array $woocommerce_blocks Has three keys: 'outofstock',
|
||||
* 'exclude-from-catalog' and 'exclude-from-search', matching three different
|
||||
* product visibility settings. If the filter sets some of these to 'true',
|
||||
* those posts will be filtered in the indexing.
|
||||
*/
|
||||
$woocommerce_blocks = apply_filters( 'relevanssi_woocommerce_indexing', $woocommerce_blocks );
|
||||
$term_taxonomy_id_array = array();
|
||||
if ( $woocommerce_blocks['outofstock'] ) {
|
||||
$out_of_stock = get_term_by( 'slug', 'outofstock', 'product_visibility', OBJECT );
|
||||
if ( $out_of_stock && isset( $out_of_stock->term_taxonomy_id ) ) {
|
||||
$term_taxonomy_id_array[] = $out_of_stock->term_taxonomy_id;
|
||||
}
|
||||
}
|
||||
if ( $woocommerce_blocks['exclude-from-catalog'] ) {
|
||||
$exclude_from_catalog = get_term_by( 'slug', 'exclude-from-catalog', 'product_visibility', OBJECT );
|
||||
if ( $exclude_from_catalog && isset( $exclude_from_catalog->term_taxonomy_id ) ) {
|
||||
$term_taxonomy_id_array[] = $exclude_from_catalog->term_taxonomy_id;
|
||||
}
|
||||
}
|
||||
if ( $woocommerce_blocks['exclude-from-search'] ) {
|
||||
$exclude_from_search = get_term_by( 'slug', 'exclude-from-search', 'product_visibility', OBJECT );
|
||||
if ( $exclude_from_search && isset( $exclude_from_search->term_taxonomy_id ) ) {
|
||||
$term_taxonomy_id_array[] = $exclude_from_search->term_taxonomy_id;
|
||||
}
|
||||
}
|
||||
if ( ! empty( $term_taxonomy_id_array ) ) {
|
||||
$term_taxonomy_id_string = implode( ',', $term_taxonomy_id_array );
|
||||
$restriction .= " AND post.ID NOT IN (SELECT object_id FROM $wpdb->term_relationships WHERE object_id = post.ID AND term_taxonomy_id IN ($term_taxonomy_id_string)) ";
|
||||
}
|
||||
return $restriction;
|
||||
}
|
||||
|
||||
/**
|
||||
* SKU weight boost.
|
||||
*
|
||||
* Increases the weight for matches in the _sku custom field. The amount of
|
||||
* boost can be adjusted with the `relevanssi_sku_boost` filter hook. The
|
||||
* default is 2.
|
||||
*
|
||||
* @param object $match_object The match object.
|
||||
*
|
||||
* @return object The match object.
|
||||
*/
|
||||
function relevanssi_sku_boost( $match_object ) {
|
||||
$custom_field_detail = json_decode( $match_object->customfield_detail );
|
||||
if ( null !== $custom_field_detail && isset( $custom_field_detail->_sku ) ) {
|
||||
/**
|
||||
* Filters the SKU boost value.
|
||||
*
|
||||
* @param float The boost multiplier, default 2.
|
||||
*/
|
||||
$match_object->weight *= apply_filters( 'relevanssi_sku_boost', 2 );
|
||||
}
|
||||
return $match_object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds blocked WooCommerce post types to the list of blocked post types.
|
||||
*
|
||||
* Stops Relevanssi from taking over the admin search for the WooCommerce
|
||||
* blocked post types using the relevanssi_admin_search_blocked_post_types
|
||||
* filter hook.
|
||||
*
|
||||
* @param array $post_types The list of blocked post types.
|
||||
* @return array
|
||||
*/
|
||||
function relevanssi_woocommerce_admin_search_blocked_post_types( array $post_types ): array {
|
||||
$woo_post_types = array(
|
||||
'shop_coupon',
|
||||
'shop_order',
|
||||
'shop_order_refund',
|
||||
'wc_order_status',
|
||||
'wc_order_email',
|
||||
'shop_webhook',
|
||||
);
|
||||
return array_merge( $post_types, $woo_post_types );
|
||||
}
|
||||
|
||||
/**
|
||||
* Relevanssi support for WooCommerce filtering.
|
||||
*
|
||||
* @param WP_Query $query The WP_Query object.
|
||||
* @return WP_Query The WP_Query object.
|
||||
*/
|
||||
function relevanssi_woocommerce_filters( $query ) {
|
||||
// phpcs:disable WordPress.Security.NonceVerification.Recommended
|
||||
|
||||
$min_price = isset( $_REQUEST['min_price'] ) ? intval( $_REQUEST['min_price'] ) : false;
|
||||
$max_price = isset( $_REQUEST['max_price'] ) ? intval( $_REQUEST['max_price'] ) : false;
|
||||
|
||||
$meta_query = $query->get( 'meta_query' );
|
||||
if ( $min_price ) {
|
||||
$meta_query[] = array(
|
||||
'key' => '_price',
|
||||
'value' => $min_price,
|
||||
'compare' => '>=',
|
||||
'type' => 'NUMERIC',
|
||||
);
|
||||
}
|
||||
if ( $max_price ) {
|
||||
$meta_query[] = array(
|
||||
'key' => '_price',
|
||||
'value' => $max_price,
|
||||
'compare' => '<=',
|
||||
'type' => 'NUMERIC',
|
||||
);
|
||||
}
|
||||
if ( $meta_query ) {
|
||||
$query->set( 'meta_query', $meta_query );
|
||||
}
|
||||
|
||||
foreach ( array( 'product_tag', 'product_cat', 'product_brand' ) as $taxonomy ) {
|
||||
$value = isset( $_REQUEST[ $taxonomy ] ) ? intval( $_REQUEST[ $taxonomy ] ) : false;
|
||||
if ( $value ) {
|
||||
$tax_query = $query->get( 'tax_query' );
|
||||
if ( ! is_array( $tax_query ) ) {
|
||||
$tax_query = array();
|
||||
}
|
||||
$tax_query[] = array(
|
||||
'taxonomy' => $taxonomy,
|
||||
'field' => 'term_id',
|
||||
'terms' => $value,
|
||||
);
|
||||
$query->set( 'tax_query', $tax_query );
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'no' === get_option( 'woocommerce_attribute_lookup_enabled' ) ) {
|
||||
return $query;
|
||||
}
|
||||
|
||||
$chosen_attributes = array();
|
||||
|
||||
if ( ! empty( $_GET ) ) {
|
||||
foreach ( $_GET as $key => $value ) {
|
||||
if ( 0 === strpos( $key, 'filter_' ) ) {
|
||||
$attribute = wc_sanitize_taxonomy_name( str_replace( 'filter_', '', $key ) );
|
||||
$taxonomy = wc_attribute_taxonomy_name( $attribute );
|
||||
$filter_terms = ! empty( $value ) ? explode( ',', wc_clean( wp_unslash( $value ) ) ) : array();
|
||||
|
||||
if ( empty( $filter_terms ) || ! taxonomy_exists( $taxonomy ) || ! wc_attribute_taxonomy_id_by_name( $attribute ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$query_type = ! empty( $_GET[ 'query_type_' . $attribute ] ) && in_array( $_GET[ 'query_type_' . $attribute ], array( 'and', 'or' ), true )
|
||||
? wc_clean( wp_unslash( $_GET[ 'query_type_' . $attribute ] ) )
|
||||
: '';
|
||||
|
||||
$chosen_attributes[ $taxonomy ]['terms'] = array_map( 'sanitize_title', $filter_terms );
|
||||
$chosen_attributes[ $taxonomy ]['query_type'] = $query_type ? $query_type : apply_filters( 'woocommerce_layered_nav_default_query_type', 'and' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$tax_query = $query->get( 'tax_query' );
|
||||
if ( ! is_array( $tax_query ) ) {
|
||||
$tax_query = array();
|
||||
}
|
||||
foreach ( $chosen_attributes as $taxonomy => $data ) {
|
||||
$tax_query[] = array(
|
||||
'taxonomy' => $taxonomy,
|
||||
'field' => 'slug',
|
||||
'terms' => $data['terms'],
|
||||
'operator' => 'and' === $data['query_type'] ? 'AND' : 'IN',
|
||||
'include_children' => false,
|
||||
);
|
||||
}
|
||||
$query->set( 'tax_query', $tax_query );
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides layered navigation term counts based on Relevanssi searches.
|
||||
*
|
||||
* Hooks onto woocommerce_get_filtered_term_product_counts_query to provide
|
||||
* accurate term counts.
|
||||
*
|
||||
* @param array $query The MySQL query parts.
|
||||
*
|
||||
* @return array The modified query.
|
||||
*/
|
||||
function relevanssi_filtered_term_product_counts_query( $query ) {
|
||||
if ( defined( 'BeRocket_AJAX_filters_version' ) ) {
|
||||
return $query;
|
||||
}
|
||||
|
||||
global $relevanssi_variables, $wpdb;
|
||||
|
||||
if ( false !== stripos( $query['select'], 'product_or_parent_id' ) ) {
|
||||
$query['from'] = str_replace( 'FROM ', "FROM {$relevanssi_variables['relevanssi_table']} AS relevanssi, ", $query['from'] );
|
||||
$query['where'] = str_replace( 'WHERE ', " WHERE relevanssi.doc = $wpdb->posts.ID AND ", $query['where'] );
|
||||
$query['where'] = preg_replace( '/\(\w+posts.post_title LIKE(.*?)\)\)/', 'relevanssi.term LIKE\1)', $query['where'] );
|
||||
$query['where'] = preg_replace( array( '/OR \(\w+posts.post_excerpt LIKE .*?\)/', '/OR \(\w+posts.post_content LIKE .*?\)/' ), '', $query['where'] );
|
||||
} else {
|
||||
$query['select'] = 'SELECT COUNT( DISTINCT( relevanssi.doc ) ) AS term_count, terms.term_id AS term_count_id';
|
||||
$query['from'] = "FROM {$relevanssi_variables['relevanssi_table']} AS relevanssi, $wpdb->posts";
|
||||
$query['where'] = str_replace( 'WHERE ', " WHERE relevanssi.doc = $wpdb->posts.ID AND ", $query['where'] );
|
||||
$query['where'] = preg_replace( '/\(\w+posts.post_title LIKE(.*?)\)\)/', 'relevanssi.term LIKE\1)', $query['where'] );
|
||||
$query['where'] = preg_replace( array( '/OR \(\w+posts.post_excerpt LIKE .*?\)/', '/OR \(\w+posts.post_content LIKE .*?\)/' ), '', $query['where'] );
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/wp-file-download.php
|
||||
*
|
||||
* WP File Download compatibility features. Compatibility with WPFD checked for
|
||||
* version 4.5.4.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_filter( 'relevanssi_content_to_index', 'relevanssi_wpfd_content', 10, 2 );
|
||||
add_action( 'wpfd_file_indexed', 'relevanssi_wpfd_index' );
|
||||
|
||||
/**
|
||||
* Adds the WPFD indexed content to wpfd_file posts.
|
||||
*
|
||||
* Fetches the words from wpfd_words. wpfd_index.tid is the post ID, wpfd_index.id is
|
||||
* then used to get the wpfd_docs.id, that is used to get the wpfd_vectors.did which
|
||||
* can then be used to fetch the correct words from wpfd_words. This function is
|
||||
* hooked onto relevanssi_content_to_index filter hook.
|
||||
*
|
||||
* @param string $content The post content as a string.
|
||||
* @param object $post The post object.
|
||||
*
|
||||
* @return string The post content with the words added to the end.
|
||||
*/
|
||||
function relevanssi_wpfd_content( $content, $post ) {
|
||||
$wpfd_search_config = get_option( '_wpfd_global_search_config', null );
|
||||
if ( 'wpfd_file' === $post->post_type ) {
|
||||
if ( $wpfd_search_config && isset( $wpfd_search_config['plain_text_search'] ) && $wpfd_search_config['plain_text_search'] ) {
|
||||
global $wpdb;
|
||||
$words = $wpdb->get_col(
|
||||
"SELECT word
|
||||
FROM {$wpdb->prefix}wpfd_words, {$wpdb->prefix}wpfd_docs, {$wpdb->prefix}wpfd_index, {$wpdb->prefix}wpfd_vectors " .
|
||||
"WHERE {$wpdb->prefix}wpfd_index.tid = {$post->ID} " . // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.PreparedSQL.NotPrepared
|
||||
" AND {$wpdb->prefix}wpfd_docs.index_id = {$wpdb->prefix}wpfd_index.id
|
||||
AND {$wpdb->prefix}wpfd_docs.id = {$wpdb->prefix}wpfd_vectors.did
|
||||
AND {$wpdb->prefix}wpfd_vectors.wid = {$wpdb->prefix}wpfd_words.id"
|
||||
);
|
||||
$content .= implode( ' ', $words );
|
||||
}
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs Relevanssi indexing after WPFD indexing is done.
|
||||
*
|
||||
* @param int $wpfd_id The WPFD post index.
|
||||
*/
|
||||
function relevanssi_wpfd_index( $wpfd_id ) {
|
||||
global $wpdb;
|
||||
$post_id = $wpdb->get_var( $wpdb->prepare( "SELECT tid FROM {$wpdb->prefix}wpfd_index WHERE id=%d", $wpfd_id ) );
|
||||
relevanssi_insert_edit( $post_id );
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/wp-members.php
|
||||
*
|
||||
* WP-Members compatibility features.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_filter( 'relevanssi_post_ok', 'relevanssi_wpmembers_compatibility', 10, 2 );
|
||||
|
||||
/**
|
||||
* Checks whether the post type is blocked.
|
||||
*
|
||||
* Allows all logged-in users to see posts. For non-logged-in users, checks if
|
||||
* the post is blocked by the _wpmem_block custom field, or if the post type is
|
||||
* blocked in the $wpmem global.
|
||||
*
|
||||
* @param bool $post_ok Whether the user is allowed to see the post.
|
||||
* @param int|string $post_id The post ID.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function relevanssi_wpmembers_compatibility( bool $post_ok, $post_id ): bool {
|
||||
global $wpmem;
|
||||
|
||||
if ( is_user_logged_in() ) {
|
||||
return $post_ok;
|
||||
}
|
||||
|
||||
$post_meta = get_post_meta( $post_id, '_wpmem_block', true );
|
||||
$post_type = isset( $wpmem->block[ relevanssi_get_post_type( $post_id ) ] )
|
||||
? $wpmem->block[ relevanssi_get_post_type( $post_id ) ]
|
||||
: 0;
|
||||
|
||||
if ( '1' === $post_meta ) {
|
||||
$post_ok = false;
|
||||
} elseif ( '1' === $post_type && '0' !== $post_meta ) {
|
||||
$post_ok = false;
|
||||
}
|
||||
|
||||
return $post_ok;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/wp-search-suggest.php
|
||||
*
|
||||
* WP Search Suggest compatibility features.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_filter( 'wpss_search_results', 'relevanssi_wpss_support', 10, 2 );
|
||||
/**
|
||||
* Adds Relevanssi results to WP Search Suggest dropdown.
|
||||
*
|
||||
* @param array $title_list List of post titles.
|
||||
* @param object $query The WP_Query object.
|
||||
*
|
||||
* @return array List of post titles.
|
||||
*/
|
||||
function relevanssi_wpss_support( $title_list, $query ) {
|
||||
$query = relevanssi_do_query( $query );
|
||||
return wp_list_pluck( $query->posts, 'post_title' );
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/wpjvpostreadinggroups.php
|
||||
*
|
||||
* WP JV Post Reading Groups compatibility features.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_filter( 'relevanssi_post_ok', 'relevanssi_wpjvpostreadinggroups_compatibility', 10, 2 );
|
||||
|
||||
/**
|
||||
* Checks whether the user is allowed to see the post.
|
||||
*
|
||||
* @param boolean $post_ok Can the post be shown to the user.
|
||||
* @param int $post_id The post ID.
|
||||
*
|
||||
* @return boolean $post_ok True if the user is allowed to see the post,
|
||||
* otherwise false.
|
||||
*/
|
||||
function relevanssi_wpjvpostreadinggroups_compatibility( $post_ok, $post_id ) {
|
||||
$post_ok = wp_jv_prg_user_can_see_a_post( get_current_user_id(), $post_id );
|
||||
|
||||
return $post_ok;
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/wpml.php
|
||||
*
|
||||
* WPML filtering function.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_filter( 'relevanssi_hits_filter', 'relevanssi_wpml_filter', 9 );
|
||||
add_filter( 'relevanssi_tag_before_tokenize', 'relevanssi_wpml_term_fix', 10, 4 );
|
||||
add_action( 'relevanssi_pre_index_taxonomies', 'relevanssi_disable_wpml_terms' );
|
||||
add_action( 'relevanssi_post_index_taxonomies', 'relevanssi_enable_wpml_terms' );
|
||||
|
||||
/**
|
||||
* Filters posts based on WPML language.
|
||||
*
|
||||
* Attaches to 'relevanssi_hits_filter' to restrict WPML searches to the current
|
||||
* language. Whether this filter is used or not depends on the option
|
||||
* 'relevanssi_wpml_only_current'. Thanks to rvencu for the initial code.
|
||||
*
|
||||
* @global object $sitepress The WPML global object.
|
||||
*
|
||||
* @param array $data Index 0 has the array of results, index 1 has the search query.
|
||||
*
|
||||
* @return array $data The whole parameter array, with the filtered posts in the index 0.
|
||||
*/
|
||||
function relevanssi_wpml_filter( $data ) {
|
||||
$filter_enabled = get_option( 'relevanssi_wpml_only_current' );
|
||||
if ( 'on' === $filter_enabled ) {
|
||||
$wpml_post_type_setting = apply_filters( 'wpml_setting', false, 'custom_posts_sync_option' );
|
||||
$wpml_taxonomy_setting = apply_filters( 'wpml_setting', false, 'taxonomies_sync_option' );
|
||||
|
||||
$current_blog_language = get_bloginfo( 'language' );
|
||||
$filtered_hits = array();
|
||||
foreach ( $data[0] as $hit ) {
|
||||
$original_hit = $hit;
|
||||
|
||||
$object_array = relevanssi_get_an_object( $hit );
|
||||
$hit = $object_array['object'];
|
||||
|
||||
if ( isset( $hit->blog_id ) && function_exists( 'switch_to_blog' ) ) {
|
||||
// This is a multisite search.
|
||||
switch_to_blog( $hit->blog_id );
|
||||
if ( function_exists( 'icl_object_id' ) ) {
|
||||
// Reset the WPML cache when blog is switched, otherwise WPML
|
||||
// will be confused.
|
||||
global $wpml_post_translations;
|
||||
$wpml_post_translations->reload();
|
||||
}
|
||||
}
|
||||
|
||||
global $sitepress;
|
||||
|
||||
// Check if WPML is used.
|
||||
if ( function_exists( 'icl_object_id' ) && ! function_exists( 'pll_is_translated_post_type' ) ) {
|
||||
if ( $sitepress->is_translated_post_type( $hit->post_type ) ) {
|
||||
$fallback_to_default = false;
|
||||
if ( isset( $wpml_post_type_setting[ $hit->post_type ] ) && '2' === $wpml_post_type_setting[ $hit->post_type ] ) {
|
||||
$fallback_to_default = true;
|
||||
}
|
||||
$id = apply_filters( 'wpml_object_id', $hit->ID, $hit->post_type, $fallback_to_default );
|
||||
// This is a post in a translated post type.
|
||||
if ( intval( $hit->ID ) === intval( $id ) ) {
|
||||
// The post exists in the current language, and can be included.
|
||||
$filtered_hits[] = $original_hit;
|
||||
}
|
||||
} elseif ( isset( $hit->term_id ) ) {
|
||||
$fallback_to_default = false;
|
||||
if ( isset( $wpml_taxonomy_setting[ $hit->post_type ] ) && '2' === $wpml_taxonomy_setting[ $hit->post_type ] ) {
|
||||
$fallback_to_default = true;
|
||||
}
|
||||
if ( ! isset( $hit->post_type ) ) {
|
||||
// This is a term object, not a Relevanssi-generated post object.
|
||||
$hit->post_type = $hit->taxonomy;
|
||||
}
|
||||
$id = apply_filters( 'wpml_object_id', $hit->term_id, $hit->post_type, $fallback_to_default );
|
||||
if ( intval( $hit->term_id ) === intval( $id ) ) {
|
||||
// The post exists in the current language, and can be included.
|
||||
$filtered_hits[] = $original_hit;
|
||||
}
|
||||
} else {
|
||||
// This is not a translated post type, so include all posts.
|
||||
$filtered_hits[] = $original_hit;
|
||||
}
|
||||
} elseif ( get_bloginfo( 'language' ) === $current_blog_language ) {
|
||||
// If there is no WPML but the target blog has identical language with current blog,
|
||||
// we use the hits. Note en-US is not identical to en-GB!
|
||||
$filtered_hits[] = $original_hit;
|
||||
}
|
||||
|
||||
if ( isset( $hit->blog_id ) && function_exists( 'restore_current_blog' ) ) {
|
||||
restore_current_blog();
|
||||
}
|
||||
}
|
||||
|
||||
// A bit of foolproofing, avoid a warning if someone passes this filter bad data.
|
||||
$query = '';
|
||||
if ( isset( $data[1] ) ) {
|
||||
$query = $data[1];
|
||||
}
|
||||
return array( $filtered_hits, $query );
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fixes translated term indexing for WPML.
|
||||
*
|
||||
* WPML indexed translated terms based on current admin language, not the post
|
||||
* language. This filter changes the term indexing to match the post language.
|
||||
*
|
||||
* @param string $term_content All terms in the taxonomy as a string.
|
||||
* @param array $terms All the term objects in the current taxonomy.
|
||||
* @param string $taxonomy The taxonomy name.
|
||||
* @param int $post_id The post ID.
|
||||
*
|
||||
* @return string The term names as a string.
|
||||
*/
|
||||
function relevanssi_wpml_term_fix( string $term_content, array $terms, string $taxonomy, int $post_id ) {
|
||||
$post_language = apply_filters( 'wpml_post_language_details', null, $post_id );
|
||||
if ( ! is_wp_error( $post_language ) ) {
|
||||
$term_content = '';
|
||||
|
||||
global $sitepress;
|
||||
remove_filter( 'get_term', array( $sitepress, 'get_term_adjust_id' ), 1, 1 );
|
||||
|
||||
foreach ( $terms as $term ) {
|
||||
$term = get_term(
|
||||
apply_filters(
|
||||
'wpml_object_id',
|
||||
$term->term_id,
|
||||
$taxonomy,
|
||||
true,
|
||||
$post_language['language_code']
|
||||
),
|
||||
$taxonomy
|
||||
);
|
||||
|
||||
$term_content .= ' ' . $term->name;
|
||||
}
|
||||
|
||||
add_filter( 'get_term', array( $sitepress, 'get_term_adjust_id' ), 1, 1 );
|
||||
}
|
||||
|
||||
return $term_content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables WPML term filtering.
|
||||
*
|
||||
* This function disables the WPML term filtering, so that Relevanssi can index
|
||||
* the terms in the correct language.
|
||||
*/
|
||||
function relevanssi_disable_wpml_terms() {
|
||||
global $sitepress;
|
||||
remove_filter( 'get_term', array( $sitepress, 'get_term_adjust_id' ), 1 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables WPML term filtering.
|
||||
*
|
||||
* This function enables the WPML term filtering.
|
||||
*/
|
||||
function relevanssi_enable_wpml_terms() {
|
||||
global $sitepress;
|
||||
add_filter( 'get_term', array( $sitepress, 'get_term_adjust_id' ), 1, 1 );
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/compatibility/yoast-seo.php
|
||||
*
|
||||
* Yoast SEO noindex filtering function.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_filter( 'relevanssi_do_not_index', 'relevanssi_yoast_noindex', 10, 2 );
|
||||
add_filter( 'relevanssi_indexing_restriction', 'relevanssi_yoast_exclude' );
|
||||
add_action( 'relevanssi_indexing_tab_advanced', 'relevanssi_yoast_form', 20 );
|
||||
add_action( 'relevanssi_indexing_options', 'relevanssi_yoast_options' );
|
||||
|
||||
/**
|
||||
* Blocks indexing of posts marked "noindex" in the Yoast SEO settings.
|
||||
*
|
||||
* Attaches to the 'relevanssi_do_not_index' filter hook.
|
||||
*
|
||||
* @param boolean $do_not_index True, if the post shouldn't be indexed.
|
||||
* @param integer $post_id The post ID number.
|
||||
*
|
||||
* @return string|boolean If the post shouldn't be indexed, this returns
|
||||
* 'yoast_seo'. The value may also be a boolean.
|
||||
*/
|
||||
function relevanssi_yoast_noindex( $do_not_index, $post_id ) {
|
||||
if ( 'on' !== get_option( 'relevanssi_seo_noindex' ) ) {
|
||||
return $do_not_index;
|
||||
}
|
||||
|
||||
$noindex = get_post_meta( $post_id, '_yoast_wpseo_meta-robots-noindex', true );
|
||||
if ( '1' === $noindex ) {
|
||||
$do_not_index = 'Yoast SEO';
|
||||
}
|
||||
return $do_not_index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Excludes the "noindex" posts from Relevanssi indexing.
|
||||
*
|
||||
* Adds a MySQL query restriction that blocks posts that have the Yoast SEO
|
||||
* "noindex" setting set to "1" from indexing.
|
||||
*
|
||||
* @param array $restriction An array with two values: 'mysql' for the MySQL
|
||||
* query restriction to modify, 'reason' for the reason of restriction.
|
||||
*/
|
||||
function relevanssi_yoast_exclude( $restriction ) {
|
||||
if ( 'on' !== get_option( 'relevanssi_seo_noindex' ) ) {
|
||||
return $restriction;
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
|
||||
// Backwards compatibility code for 2.8.0, remove at some point.
|
||||
if ( is_string( $restriction ) ) {
|
||||
$restriction = array(
|
||||
'mysql' => $restriction,
|
||||
'reason' => '',
|
||||
);
|
||||
}
|
||||
|
||||
$restriction['mysql'] .= " AND post.ID NOT IN (SELECT post_id FROM
|
||||
$wpdb->postmeta WHERE meta_key = '_yoast_wpseo_meta-robots-noindex'
|
||||
AND meta_value = '1' ) ";
|
||||
$restriction['reason'] .= ' Yoast SEO';
|
||||
return $restriction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints out the form fields for disabling the feature.
|
||||
*/
|
||||
function relevanssi_yoast_form() {
|
||||
$seo_noindex = get_option( 'relevanssi_seo_noindex' );
|
||||
$seo_noindex = relevanssi_check( $seo_noindex );
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for='relevanssi_seo_noindex'><?php esc_html_e( 'Use Yoast SEO noindex', 'relevanssi' ); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<label for='relevanssi_seo_noindex'>
|
||||
<input type='checkbox' name='relevanssi_seo_noindex' id='relevanssi_seo_noindex' <?php echo esc_attr( $seo_noindex ); ?> />
|
||||
<?php esc_html_e( 'Use Yoast SEO noindex.', 'relevanssi' ); ?>
|
||||
</label>
|
||||
<p class="description"><?php esc_html_e( 'If checked, Relevanssi will not index posts marked as "No index" in Yoast SEO settings.', 'relevanssi' ); ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the SEO No index option.
|
||||
*
|
||||
* @param array $request An array of option values from the request.
|
||||
*/
|
||||
function relevanssi_yoast_options( array $request ) {
|
||||
relevanssi_update_off_or_on( $request, 'relevanssi_seo_noindex', true );
|
||||
}
|
||||
224
wp/wp-content/plugins/relevanssi-premium/lib/contextual-help.php
Normal file
224
wp/wp-content/plugins/relevanssi-premium/lib/contextual-help.php
Normal file
@@ -0,0 +1,224 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/contextual-help.php
|
||||
*
|
||||
* Adds the contextual help menus.
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Displays the contextual help menu.
|
||||
*
|
||||
* @global object $wpdb The WP database interface.
|
||||
*/
|
||||
function relevanssi_admin_help() {
|
||||
global $wpdb;
|
||||
|
||||
$screen = get_current_screen();
|
||||
|
||||
// Translators: %1$s is 'orderby', %2$s is the Codex page URL.
|
||||
$orderby_parameters = sprintf( __( "To adjust the post order, you can use the %1\$s query parameter. With %1\$s, you can use multiple layers of different sorting methods. See <a href='%2\$s'>WordPress Codex</a> for more details on using arrays for orderby.", 'relevanssi' ), '<code>orderby</code>', 'https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters' );
|
||||
// Translators: %s is 'relevanssi_throttle_limit'.
|
||||
$throttle_limit = sprintf( __( 'In order to adjust the throttle limit, you can use the %s filter hook.', 'relevanssi' ), '<code>pre_option_relevanssi_throttle_limit</code>' );
|
||||
|
||||
$screen->add_help_tab(
|
||||
array(
|
||||
'id' => 'relevanssi-searching',
|
||||
'title' => __( 'Searching', 'relevanssi' ),
|
||||
'content' => '<ul>' .
|
||||
"<li>$orderby_parameters</li>" .
|
||||
'<li>' . __( "Inside-word matching is disabled by default, because it increases garbage results that don't really match the search term. If you want to enable it, add the following function to your theme functions.php:", 'relevanssi' ) .
|
||||
'<pre>add_filter( \'relevanssi_fuzzy_query\', \'rlv_partial_inside_words\' );
|
||||
function rlv_partial_inside_words( $query ) {
|
||||
return "(relevanssi.term LIKE \'%#term#%\')";
|
||||
}</pre></li>' .
|
||||
"<li>$throttle_limit" .
|
||||
'<pre>add_filter( \'pre_option_relevanssi_throttle_limit\', function( $limit ) { return 200; } );</pre></li>' .
|
||||
'<li>' . __( "It's not usually necessary to adjust the limit from 500, but in some cases performance gains can be achieved by setting a lower limit. We don't suggest going under 200, as low values will make the results worse.", 'relevanssi' ) . '</li>' .
|
||||
'</ul>',
|
||||
)
|
||||
);
|
||||
|
||||
// Translators: %s is the link to the Codex page.
|
||||
$codex_documentation = sprintf( __( 'For all the possible options, see the Codex documentation for %s.', 'relevanssi' ), '<a href="https://codex.wordpress.org/Class_Reference/WP_Query">WP_Query</a>' );
|
||||
|
||||
$screen->add_help_tab(
|
||||
array(
|
||||
'id' => 'relevanssi-search-restrictions',
|
||||
'title' => __( 'Restrictions', 'relevanssi' ),
|
||||
'content' => '<ul>' .
|
||||
'<li>' . __( 'If you want the general search to target all posts, but have a single search form target only certain posts, you can add a hidden input variable to the search form.', 'relevanssi' ) . '</li>' .
|
||||
'<li>' . __( 'For example in order to restrict the search to categories 10, 14 and 17, you could add this to the search form:', 'relevanssi' ) .
|
||||
'<pre><input type="hidden" name="cats" value="10,14,17" /></pre></li>' .
|
||||
'<li>' . __( 'To restrict the search to posts tagged with alfa AND beta, you could add this to the search form:', 'relevanssi' ) .
|
||||
'<pre><input type="hidden" name="tag" value="alfa+beta" /></pre></li>' .
|
||||
"<li>$codex_documentation</li>" .
|
||||
'</ul>',
|
||||
)
|
||||
);
|
||||
// Translators: %s is the link to the Codex page.
|
||||
$exclusion_options = sprintf( __( 'For more exclusion options, see the Codex documentation for %s. For example, to exclude tag ID 10, use', 'relevanssi' ), '<a href="https://codex.wordpress.org/Class_Reference/WP_Query">WP_Query</a>' );
|
||||
// Translators: %s is 'relevanssi_do_not_index'.
|
||||
$exclusion_instructions = sprintf( __( 'To exclude posts from the index and not just from the search, you can use the %s filter hook. This would not index posts that have a certain taxonomy term:', 'relevanssi' ), '<code>relevanssi_do_not_index</code>' );
|
||||
// Translators: %s is a link to the Relevanssi knowledge base.
|
||||
$more_examples = sprintf( __( "For more examples, see <a href='%s'>the related knowledge base posts</a>.", 'relevanssi' ), 'https://www.relevanssi.com/tag/relevanssi_do_not_index/' );
|
||||
|
||||
$screen->add_help_tab(
|
||||
array(
|
||||
'id' => 'relevanssi-search-exclusions',
|
||||
'title' => __( 'Exclusions', 'relevanssi' ),
|
||||
'content' => '<ul>' .
|
||||
"<li>$exclusion_options" .
|
||||
'<pre><input type="hidden" name="tag__not_in" value="10" /></pre></li>' .
|
||||
"<li>$exclusion_instructions" .
|
||||
'<pre>add_filter( \'relevanssi_do_not_index\', \'rlv_index_filter\', 10, 2 );
|
||||
function rlv_index_filter( $block, $post_id ) {
|
||||
if ( has_term( \'jazz\', \'genre\', $post_id ) ) {
|
||||
$block = true;
|
||||
}
|
||||
return $block;
|
||||
}
|
||||
</pre></li>' .
|
||||
"<li>$more_examples</li>" .
|
||||
'</ul>',
|
||||
)
|
||||
);
|
||||
|
||||
// Translators: %s is 'relevanssi_user_searches_limit'.
|
||||
$user_searches_limit = sprintf( __( 'By default, the User searches page shows 20 most common keywords. In order to see more, you can adjust the value with the %s filter hook, like this:', 'relevanssi' ), '<code>relevanssi_user_searches_limit</code>' );
|
||||
// Translators: %s is the name of the database table.
|
||||
$log_database = sprintf( __( 'The complete logs are stored in the %s database table, where you can access them if you need more information than what the User searches page provides.', 'relevanssi' ), '<code>' . $wpdb->prefix . 'relevanssi_log</code>' );
|
||||
|
||||
$screen->add_help_tab(
|
||||
array(
|
||||
'id' => 'relevanssi-logging',
|
||||
'title' => __( 'Logs', 'relevanssi' ),
|
||||
'content' => '<ul>' .
|
||||
"<li>$user_searches_limit" .
|
||||
"<pre>add_filter( 'relevanssi_user_searches_limit', function() { return 50; } );</pre></li>" .
|
||||
"<li>$log_database</li>" .
|
||||
'</ul>',
|
||||
)
|
||||
);
|
||||
|
||||
// Translators: %s is 'the_excerpt()'.
|
||||
$custom_snippets = sprintf( __( 'Custom snippets require that the search results template uses %s to print out the excerpts.', 'relevanssi' ), '<code>the_excerpt()</code>' );
|
||||
// Translators: %1$s is 'relevanssi_pre_excerpt_content', %2$s is 'relevanssi_excerpt_content'.
|
||||
$pre_excerpt_content = sprintf( __( 'If you want more control over what content Relevanssi uses to create the excerpts, you can use the %1$s and %2$s filter hooks to adjust the content.', 'relevanssi' ), '<code>relevanssi_pre_excerpt_content</code>', '<code>relevanssi_excerpt_content</code>' );
|
||||
// Translators: %s is 'relevanssi_disable_shortcodes_excerpt'.
|
||||
$disable_shortcodes = sprintf( __( 'Some shortcode do not work well with Relevanssi excerpt-generation. Relevanssi disables some shortcodes automatically to prevent problems. This can be adjusted with the %s filter hook.', 'relevanssi' ), '<code>relevanssi_disable_shortcodes_excerpt</code>' );
|
||||
// Translators: %s is 'relevanssi_optimize_excerpts'.
|
||||
$optimize_excerpts = sprintf( __( "If you want Relevanssi to build excerpts faster and don't mind that they may be less than perfect in quality, add a filter that returns true on hook %s.", 'relevanssi' ), '<code>relevanssi_optimize_excerpts</code>' );
|
||||
|
||||
$screen->add_help_tab(
|
||||
array(
|
||||
'id' => 'relevanssi-excerpts',
|
||||
'title' => __( 'Excerpts', 'relevanssi' ),
|
||||
'content' => '<ul>' .
|
||||
'<li>' . __( 'Building custom excerpts can be slow. If you are not actually using the excerpts, make sure you disable the option.', 'relevanssi' ) . '</li>' .
|
||||
"<li>$custom_snippets</li>" .
|
||||
'<li>' . __( 'Generally, Relevanssi generates the excerpts from post content. If you want to include custom field content in the excerpt-building, this can be done with a simple setting from the excerpt settings.', 'relevanssi' ) . '</li>' .
|
||||
"<li>$pre_excerpt_content</li>" .
|
||||
"<li>$disable_shortcodes</li>" .
|
||||
"<li>$optimize_excerpts" .
|
||||
"<pre>add_filter( 'relevanssi_optimize_excerpts', '__return_true' );</pre></li>" .
|
||||
'</ul>',
|
||||
)
|
||||
);
|
||||
|
||||
// Translators: %1$s is 'the_title()', %2$s is 'relevanssi_the_title()'.
|
||||
$the_title = sprintf( __( 'In order to see title highlights from Relevanssi, replace %1$s in the search results template with %2$s. It does the same thing, but supports Relevanssi title highlights.', 'relevanssi' ), '<code>the_title()</code>', '<code>relevanssi_the_title()</code>' );
|
||||
|
||||
$screen->add_help_tab(
|
||||
array(
|
||||
'id' => 'relevanssi-highlights',
|
||||
'title' => __( 'Highlights', 'relevanssi' ),
|
||||
'content' => '<ul>' .
|
||||
'<li>' . __( "Title highlights don't appear automatically, because that led to problems with highlights appearing in wrong places and messing up navigation menus, for example.", 'relevanssi' ) . '</li>' .
|
||||
"<li>$the_title</li>" .
|
||||
'</ul>',
|
||||
)
|
||||
);
|
||||
|
||||
// Translators: %1$s is 'relevanssi_punctuation_filter', %2$s is 'relevanssi_remove_punctuation'.
|
||||
$remove_punctuation = sprintf( __( 'For more fine-tuned changes, you can use %1$s filter hook to adjust what is replaced with what, and %2$s filter hook to completely override the default punctuation control.', 'relevanssi' ), '<code>relevanssi_punctuation_filter</code>', '<code>relevanssi_remove_punctuation</code>' );
|
||||
// Translators: %s is the URL to the Knowledge Base entry.
|
||||
$remove_punct_guide = sprintf( __( "For more examples, see <a href='%s'>the related knowledge base posts</a>.", 'relevanssi' ), 'https://www.relevanssi.com/tag/relevanssi_remove_punct/' );
|
||||
|
||||
$screen->add_help_tab(
|
||||
array(
|
||||
'id' => 'relevanssi-punctuation',
|
||||
'title' => __( 'Punctuation', 'relevanssi' ),
|
||||
'content' => '<ul>' .
|
||||
'<li>' . __( 'Relevanssi removes punctuation. Some punctuation is removed, some replaced with spaces. Advanced indexing settings include some of the more common settings people want to change.', 'relevanssi' ) . '</li>' .
|
||||
"<li>$remove_punctuation</li>" .
|
||||
"<li>$remove_punct_guide</li>" .
|
||||
'</ul>',
|
||||
)
|
||||
);
|
||||
|
||||
// Translators: %s is '[noindex]'.
|
||||
$noindex = sprintf( __( "If you have content that you don't want indexed, you can wrap that content in a %s shortcode.", 'relevanssi' ), '<code>[noindex]</code>' );
|
||||
// Translators: %s is '[searchform]'.
|
||||
$searchform = sprintf( __( 'If you need a search form on some page on your site, you can use the %s shortcode to print out a basic search form.', 'relevanssi' ), '<code>[searchform]</code>' );
|
||||
// Translators: %1$s is '[searchform post_types="page"]', %2$s is '[searchform cats="10,14,17"]'.
|
||||
$searchform_cats = sprintf( __( 'If you need to add query variables to the search form, the shortcode takes parameters, which are then printed out as hidden input fields. To get a search form with a post type restriction, you can use %1$s. To restrict the search to categories 10, 14 and 17, you can use %2$s and so on.', 'relevanssi' ), '<code>[searchform post_types="page"]</code>', '<code>[searchform cats="10,14,17"]</code>' );
|
||||
// Translators: %1$s is 'dropdown', %2$s is '[searchform dropdown="category"]'.
|
||||
$searchform_dropdown = sprintf( __( 'You can use the %1$s parameter to add a taxonomy dropdown to the search form. Just use the name of the taxonomy, like %2$s. This works best with hierarchical taxonomies like categories with relatively few options available.', 'relevanssi' ), '<code>dropdown</code>', '<code>[searchform dropdown="category"]</code>' );
|
||||
|
||||
$screen->add_help_tab(
|
||||
array(
|
||||
'id' => 'relevanssi-helpful-shortcodes',
|
||||
'title' => __( 'Helpful shortcodes', 'relevanssi' ),
|
||||
'content' => "<ul>
|
||||
<li>$noindex</li>
|
||||
<li>$searchform</li>
|
||||
<li>$searchform_cats</li>
|
||||
<li>$searchform_dropdown</li>
|
||||
</ul>",
|
||||
)
|
||||
);
|
||||
|
||||
// Translators: %s is the Knowledge Base URL.
|
||||
$woocommerce = sprintf( __( "For more details how to fix that issue, see <a href='%s'>WooCommerce tips in Relevanssi user manual</a>.", 'relevanssi' ), 'https://www.relevanssi.com/user-manual/woocommerce/' );
|
||||
|
||||
$screen->add_help_tab(
|
||||
array(
|
||||
'id' => 'relevanssi-title-woocommerce',
|
||||
'title' => __( 'WooCommerce', 'relevanssi' ),
|
||||
'content' => '<ul>' .
|
||||
'<li>' . __( "If your SKUs include hyphens or other punctuation, do note that Relevanssi replaces most punctuation with spaces. That's going to cause issues with SKU searches.", 'relevanssi' ) . '</li>' .
|
||||
"<li>$woocommerce</li>" .
|
||||
'<li>' . __( "If you don't want to index products that are out of stock, excluded from the catalog or excluded from the search, there's a product visibility filtering method that is described in the user manual (see link above).", 'relevanssi' ) . '</li>' .
|
||||
'</ul>',
|
||||
)
|
||||
);
|
||||
|
||||
// Translators: %s is the name of the filter hook.
|
||||
$exact_match_bonus = sprintf( __( 'To adjust the amount of the exact match bonus, you can use the %s filter hook. It works like this:', 'relevanssi' ), '<code>relevanssi_exact_match_bonus</code>' );
|
||||
// Translators: %1$s is the title weight and %2$s is the content weight.
|
||||
$weights = sprintf( esc_html__( 'The default values are %1$s for titles and %2$s for content.', 'relevanssi' ), '<code>5</code>', '<code>2</code>' );
|
||||
|
||||
$screen->add_help_tab(
|
||||
array(
|
||||
'id' => 'relevanssi-exact-match',
|
||||
'title' => __( 'Exact match bonus', 'relevanssi' ),
|
||||
'content' => '<ul>' .
|
||||
"<li>$exact_match_bonus" .
|
||||
"<pre>add_filter( 'relevanssi_exact_match_bonus', 'rlv_adjust_bonus' );
|
||||
function rlv_adjust_bonus( \$bonus ) {
|
||||
return array( 'title' => 10, 'content' => 5 );
|
||||
}</li>" .
|
||||
"<li>$weights</ul>",
|
||||
)
|
||||
);
|
||||
$screen->set_help_sidebar(
|
||||
'<p><strong>' . __( 'For more information:', 'relevanssi' ) . '</strong></p>' .
|
||||
'<p><a href="https://www.relevanssi.com/knowledge-base/" target="_blank">' . __( 'Plugin knowledge base', 'relevanssi' ) . '</a></p>' .
|
||||
'<p><a href="https://wordpress.org/tags/relevanssi?forum_id=10" target="_blank">' . __( 'WordPress.org forum', 'relevanssi' ) . '</a></p>'
|
||||
);
|
||||
}
|
||||
172
wp/wp-content/plugins/relevanssi-premium/lib/debug.php
Normal file
172
wp/wp-content/plugins/relevanssi-premium/lib/debug.php
Normal file
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/debug.php
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
add_action( 'wp', 'relevanssi_debug_post' );
|
||||
|
||||
/**
|
||||
* Checks if Relevanssi debug mode is enabled.
|
||||
*
|
||||
* Debug mode is enabled by setting RELEVANSSI_DEBUG to true or with the
|
||||
* 'relevanssi_debug' query parameter if the debug mode is allowed from the
|
||||
* settings.
|
||||
*
|
||||
* @return boolean True if debug mode is enabled, false if not.
|
||||
*/
|
||||
function relevanssi_is_debug(): bool {
|
||||
$debug = false;
|
||||
if ( defined( 'RELEVANSSI_DEBUG' ) && RELEVANSSI_DEBUG ) {
|
||||
$debug = true;
|
||||
}
|
||||
if ( isset( $_REQUEST['relevanssi_debug'] ) && 'on' === get_option( 'relevanssi_debugging_mode' ) ) { // phpcs:ignore WordPress.Security.NonceVerification
|
||||
$debug = true;
|
||||
}
|
||||
return $debug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the debug information to the search results.
|
||||
*
|
||||
* Displays the found posts.
|
||||
*
|
||||
* @param array $posts The search results.
|
||||
*/
|
||||
function relevanssi_debug_posts( $posts ) {
|
||||
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
echo '<h2>Posts</h2>';
|
||||
foreach ( $posts as $post ) {
|
||||
if ( ! is_object( $post ) ) {
|
||||
echo "$post\n";
|
||||
} else {
|
||||
echo "<p>$post->ID: $post->post_title<br />";
|
||||
echo "$post->post_type – $post->post_status – $post->relevance_score<br />";
|
||||
property_exists( $post, 'relevanssi_link' ) && print( "relevanssi_link: $post->relevanssi_link<br />" );
|
||||
echo 'the_permalink(): ';
|
||||
the_permalink( $post->ID );
|
||||
echo '<br />get_permalink(): ' . get_permalink( $post );
|
||||
echo '</p>';
|
||||
}
|
||||
}
|
||||
// phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints out an array in a preformatted block.
|
||||
*
|
||||
* @param array $array_value The array to print.
|
||||
* @param string $title The title for the array.
|
||||
*/
|
||||
function relevanssi_debug_array( $array_value, $title ) {
|
||||
echo '<h2>' . esc_html( $title ) . '</h2>';
|
||||
echo '<pre>';
|
||||
print_r( $array_value ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
|
||||
echo '</pre>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints out a string in a preformatted block.
|
||||
*
|
||||
* @param string $str The string to print.
|
||||
* @param string $title The title for the string.
|
||||
*/
|
||||
function relevanssi_debug_string( $str, $title ) {
|
||||
echo '<h2>' . esc_html( $title ) . '</h2>';
|
||||
echo '<pre>' . esc_html( $str ) . '</pre>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints out the Relevanssi debug information for a post.
|
||||
*
|
||||
* This function is called by the 'wp' action, so it's executed on every page
|
||||
* load.
|
||||
*/
|
||||
function relevanssi_debug_post() {
|
||||
if ( ! is_singular() || ! relevanssi_is_debug() ) {
|
||||
return;
|
||||
}
|
||||
global $post;
|
||||
echo '<h1>' . esc_html( $post->post_title ) . ' (' . intval( $post->ID ) . ')</h1>';
|
||||
|
||||
echo '<h2>Index</h2>';
|
||||
echo relevanssi_generate_how_relevanssi_sees( $post->ID, true, 'post' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
|
||||
echo '<h2>Database</h2>';
|
||||
echo '<pre>' . relevanssi_generate_db_post_view( $post->ID ) . '</pre>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
|
||||
relevanssi_debug_array( get_post_meta( $post->ID ), 'Post meta' );
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the debugging view for a post.
|
||||
*
|
||||
* @param int $post_id ID of the post.
|
||||
*
|
||||
* @return string The debugging view in a div container.
|
||||
*/
|
||||
function relevanssi_generate_db_post_view( int $post_id ) {
|
||||
global $wpdb;
|
||||
|
||||
$element = '<div id="relevanssi_db_view_container">';
|
||||
|
||||
$post_object = get_post( $post_id );
|
||||
|
||||
if ( ! $post_object ) {
|
||||
$element .= '<p>' . esc_html__( 'Post not found', 'relevanssi' ) . '</p>';
|
||||
$element .= '</div>';
|
||||
return $element;
|
||||
}
|
||||
|
||||
$element .= '<p>' . esc_html( $post_object->post_content ) . '</p>';
|
||||
|
||||
$element .= '</div>';
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints out the Relevanssi debug information for search settings.
|
||||
*/
|
||||
function relevanssi_debug_search_settings() {
|
||||
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
echo '<h2>Relevanssi searching settings</h2>';
|
||||
echo '<p>';
|
||||
|
||||
$value = get_option( 'relevanssi_fuzzy' );
|
||||
echo "relevanssi_fuzzy: $value<br />";
|
||||
|
||||
$value = get_option( 'relevanssi_implicit_operator' );
|
||||
echo "relevanssi_implicit_operator: $value<br />";
|
||||
|
||||
$value = get_option( 'relevanssi_disable_or_fallback' );
|
||||
echo "relevanssi_disable_or_fallback: $value<br />";
|
||||
|
||||
$value = get_option( 'relevanssi_throttle' );
|
||||
echo "relevanssi_throttle: $value<br />";
|
||||
|
||||
$value = get_option( 'relevanssi_throttle_limit' );
|
||||
echo "relevanssi_throttle_limit: $value<br />";
|
||||
|
||||
$value = get_option( 'relevanssi_default_orderby' );
|
||||
echo "relevanssi_default_orderby: $value<br />";
|
||||
|
||||
echo '</p>';
|
||||
// phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if RELEVANSSI_DEBUG, WP_DEBUG and WP_DEBUG_DISPLAY are true.
|
||||
*
|
||||
* @return bool True if debug mode is on.
|
||||
*/
|
||||
function relevanssi_log_debug(): bool {
|
||||
return defined( 'RELEVANSSI_DEBUG' ) && RELEVANSSI_DEBUG
|
||||
&& defined( 'WP_DEBUG' ) && WP_DEBUG
|
||||
&& defined( 'WP_DEBUG_DISPLAY' ) && WP_DEBUG_DISPLAY;
|
||||
}
|
||||
219
wp/wp-content/plugins/relevanssi-premium/lib/didyoumean.php
Normal file
219
wp/wp-content/plugins/relevanssi-premium/lib/didyoumean.php
Normal file
@@ -0,0 +1,219 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/didyoumean.php
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Generates the Did you mean suggestions.
|
||||
*
|
||||
* A wrapper function that prints out the Did you mean suggestions. If Premium
|
||||
* is available, will use relevanssi_premium_didyoumean(), otherwise the
|
||||
* relevanssi_simple_didyoumean() is used.
|
||||
*
|
||||
* @param string $query The query.
|
||||
* @param string $pre Printed out before the suggestion.
|
||||
* @param string $post Printed out after the suggestion.
|
||||
* @param int $n Maximum number of search results found for the
|
||||
* suggestions to show up. Default 5.
|
||||
* @param boolean $echoed If true, echo out. Default true.
|
||||
*
|
||||
* @return string|null The suggestion HTML element.
|
||||
*/
|
||||
function relevanssi_didyoumean( $query, $pre, $post, $n = 5, $echoed = true ) {
|
||||
if ( function_exists( 'relevanssi_premium_didyoumean' ) ) {
|
||||
$result = relevanssi_premium_didyoumean( $query, $pre, $post, $n );
|
||||
} else {
|
||||
$result = relevanssi_simple_didyoumean( $query, $pre, $post, $n );
|
||||
}
|
||||
|
||||
if ( $echoed ) {
|
||||
echo $result; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the Did you mean suggestions HTML code.
|
||||
*
|
||||
* Uses relevanssi_simple_generate_suggestion() to come up with a suggestion,
|
||||
* then wraps that up with HTML code.
|
||||
*
|
||||
* @global object $wpdb The WordPress database interface.
|
||||
* @global array $relevanssi_variables The Relevanssi global variables.
|
||||
* @global object $wp_query The WP_Query object.
|
||||
*
|
||||
* @param string $query The query.
|
||||
* @param string $pre Printed out before the suggestion.
|
||||
* @param string $post Printed out after the suggestion.
|
||||
* @param int $n Maximum number of search results found for the
|
||||
* suggestions to show up. Default 5.
|
||||
*
|
||||
* @return string|null The suggestion HTML code, null if nothing found.
|
||||
*/
|
||||
function relevanssi_simple_didyoumean( $query, $pre, $post, $n = 5 ) {
|
||||
global $wp_query;
|
||||
|
||||
$total_results = $wp_query->found_posts;
|
||||
|
||||
if ( $total_results > $n ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$suggestion = relevanssi_simple_generate_suggestion( $query );
|
||||
|
||||
$result = null;
|
||||
if ( $suggestion ) {
|
||||
$url = trailingslashit( get_bloginfo( 'url' ) );
|
||||
$url = esc_attr(
|
||||
add_query_arg(
|
||||
array( 's' => rawurlencode( $suggestion ) ),
|
||||
$url
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Filters the 'Did you mean' suggestion URL.
|
||||
*
|
||||
* @param string $url The URL for the suggested search query.
|
||||
* @param string $query The search query.
|
||||
* @param string $suggestion The suggestion.
|
||||
*/
|
||||
$url = apply_filters(
|
||||
'relevanssi_didyoumean_url',
|
||||
$url,
|
||||
$query,
|
||||
$suggestion
|
||||
);
|
||||
|
||||
// Escape the suggestion to avoid XSS attacks.
|
||||
$suggestion = htmlspecialchars( $suggestion );
|
||||
|
||||
/**
|
||||
* Filters the complete 'Did you mean' suggestion.
|
||||
*
|
||||
* @param string The suggestion HTML code.
|
||||
*/
|
||||
$result = apply_filters(
|
||||
'relevanssi_didyoumean_suggestion',
|
||||
"$pre<a href='$url'>$suggestion</a>$post"
|
||||
);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the 'Did you mean' suggestions. Can be used to correct any queries.
|
||||
*
|
||||
* Uses the Relevanssi search logs as source material for corrections. If there
|
||||
* are no logged search queries, can't do anything.
|
||||
*
|
||||
* @global object $wpdb The WordPress database interface.
|
||||
* @global array $relevanssi_variables The Relevanssi global variables, used
|
||||
* for table names.
|
||||
*
|
||||
* @param string $query The query to correct.
|
||||
*
|
||||
* @return string Corrected query, empty if nothing found.
|
||||
*/
|
||||
function relevanssi_simple_generate_suggestion( $query ) {
|
||||
global $wpdb, $relevanssi_variables;
|
||||
|
||||
/**
|
||||
* The minimum limit of occurrances to include a word.
|
||||
*
|
||||
* To save resources, only words with more than this many occurrances are
|
||||
* fed for the spelling corrector. If there are problems with the spelling
|
||||
* corrector, increasing this value may fix those problems.
|
||||
*
|
||||
* @param int $number The number of occurrances must be more than this
|
||||
* value, default 2.
|
||||
*/
|
||||
$count = apply_filters( 'relevanssi_get_words_having', 2 );
|
||||
if ( ! is_numeric( $count ) ) {
|
||||
$count = 2;
|
||||
}
|
||||
$q = 'SELECT query, count(query) as c, AVG(hits) as a FROM '
|
||||
. $relevanssi_variables['log_table'] . ' WHERE hits > ' . $count
|
||||
. ' GROUP BY query ORDER BY count(query) DESC';
|
||||
/**
|
||||
* Filters the MySQL query used to fetch potential suggestions from the log.
|
||||
*
|
||||
* @param string $q MySQL query for fetching the suggestions.
|
||||
*/
|
||||
$q = apply_filters( 'relevanssi_didyoumean_query', $q );
|
||||
|
||||
$data = get_transient( 'relevanssi_didyoumean_query' );
|
||||
if ( empty( $data ) ) {
|
||||
$data = $wpdb->get_results( $q ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
||||
set_transient( 'relevanssi_didyoumean_query', $data, MONTH_IN_SECONDS );
|
||||
}
|
||||
|
||||
$query = htmlspecialchars_decode( $query, ENT_QUOTES );
|
||||
$tokens = relevanssi_tokenize( $query, true, -1, 'search_query' );
|
||||
$suggestions_made = false;
|
||||
$suggestion = '';
|
||||
|
||||
foreach ( $tokens as $token => $count ) {
|
||||
/**
|
||||
* Filters the tokens for Did you mean suggestions.
|
||||
*
|
||||
* You can use this filter hook to modify the tokens before Relevanssi
|
||||
* tries to come up with Did you mean suggestions for them. If you
|
||||
* return an empty string, the token will be skipped and no suggestion
|
||||
* will be made for the token.
|
||||
*
|
||||
* @param string $token An individual word from the search query.
|
||||
*
|
||||
* @return string The token.
|
||||
*/
|
||||
$token = apply_filters( 'relevanssi_didyoumean_token', trim( $token ) );
|
||||
if ( ! $token ) {
|
||||
continue;
|
||||
}
|
||||
$closest = '';
|
||||
$distance = -1;
|
||||
foreach ( $data as $row ) {
|
||||
if ( $row->c < 2 ) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ( $token === $row->query ) {
|
||||
$closest = '';
|
||||
break;
|
||||
} elseif ( strlen( $token ) < 255 && strlen( $row->query ) < 255 ) {
|
||||
// The levenshtein() function has a max length of 255
|
||||
// characters. The function uses strlen(), so we must use
|
||||
// too, instead of relevanssi_strlen().
|
||||
$lev = levenshtein( $token, $row->query );
|
||||
if ( $lev < 3 && ( $lev < $distance || $distance < 0 ) ) {
|
||||
if ( $row->a > 0 ) {
|
||||
$distance = $lev;
|
||||
$closest = $row->query;
|
||||
if ( $lev < 2 ) {
|
||||
break; // get the first with distance of 1 and go.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( ! empty( $closest ) ) {
|
||||
$query = str_ireplace( $token, $closest, $query, $replacement_count );
|
||||
if ( $replacement_count > 0 ) {
|
||||
$suggestions_made = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $suggestions_made ) {
|
||||
$suggestion = $query;
|
||||
}
|
||||
|
||||
return $suggestion;
|
||||
}
|
||||
1694
wp/wp-content/plugins/relevanssi-premium/lib/excerpts-highlights.php
Normal file
1694
wp/wp-content/plugins/relevanssi-premium/lib/excerpts-highlights.php
Normal file
File diff suppressed because it is too large
Load Diff
1763
wp/wp-content/plugins/relevanssi-premium/lib/indexing.php
Normal file
1763
wp/wp-content/plugins/relevanssi-premium/lib/indexing.php
Normal file
File diff suppressed because it is too large
Load Diff
537
wp/wp-content/plugins/relevanssi-premium/lib/init.php
Normal file
537
wp/wp-content/plugins/relevanssi-premium/lib/init.php
Normal file
@@ -0,0 +1,537 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/init.php
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
// Setup.
|
||||
add_action( 'init', 'relevanssi_init', 1 );
|
||||
add_filter( 'query_vars', 'relevanssi_query_vars' );
|
||||
add_filter( 'rest_api_init', 'relevanssi_rest_api_disable' );
|
||||
add_action( 'switch_blog', 'relevanssi_switch_blog', 1, 2 );
|
||||
add_action( 'admin_init', 'relevanssi_admin_init' );
|
||||
add_action( 'admin_menu', 'relevanssi_menu' );
|
||||
|
||||
// Taking over the search.
|
||||
add_filter( 'posts_pre_query', 'relevanssi_query', 99, 2 );
|
||||
add_filter( 'posts_request', 'relevanssi_prevent_default_request', 10, 2 );
|
||||
add_filter( 'relevanssi_search_ok', 'relevanssi_block_on_admin_searches', 10, 2 );
|
||||
add_filter( 'relevanssi_admin_search_ok', 'relevanssi_block_on_admin_searches', 10, 2 );
|
||||
add_filter( 'relevanssi_prevent_default_request', 'relevanssi_block_on_admin_searches', 10, 2 );
|
||||
add_filter( 'relevanssi_search_ok', 'relevanssi_control_media_queries', 11, 2 );
|
||||
|
||||
// Post indexing.
|
||||
global $wp_version;
|
||||
if ( version_compare( $wp_version, '5.6', '>=' ) ) {
|
||||
add_action( 'wp_after_insert_post', 'relevanssi_insert_edit', 99, 1 );
|
||||
} else {
|
||||
add_action( 'wp_insert_post', 'relevanssi_insert_edit', 99, 1 );
|
||||
}
|
||||
add_action( 'delete_post', 'relevanssi_remove_doc' );
|
||||
|
||||
// Comment indexing.
|
||||
add_action( 'comment_post', 'relevanssi_index_comment' );
|
||||
add_action( 'edit_comment', 'relevanssi_index_comment' );
|
||||
add_action( 'trashed_comment', 'relevanssi_index_comment' );
|
||||
add_action( 'deleted_comment', 'relevanssi_index_comment' );
|
||||
|
||||
// Attachment indexing.
|
||||
add_action( 'delete_attachment', 'relevanssi_remove_doc' );
|
||||
add_action( 'add_attachment', 'relevanssi_insert_edit', 12 );
|
||||
add_action( 'edit_attachment', 'relevanssi_insert_edit' );
|
||||
|
||||
// When a post status changes, check child posts that inherit their status from parent.
|
||||
add_action( 'transition_post_status', 'relevanssi_update_child_posts', 99, 3 );
|
||||
|
||||
// Relevanssi features.
|
||||
add_filter( 'relevanssi_remove_punctuation', 'remove_accents', 9 );
|
||||
add_filter( 'relevanssi_remove_punctuation', 'relevanssi_remove_punct' );
|
||||
add_filter( 'relevanssi_post_ok', 'relevanssi_default_post_ok', 9, 2 );
|
||||
add_filter( 'relevanssi_query_filter', 'relevanssi_limit_filter' );
|
||||
add_action( 'relevanssi_trim_logs', 'relevanssi_trim_logs' );
|
||||
add_action( 'relevanssi_update_counts', 'relevanssi_update_counts' );
|
||||
add_action( 'relevanssi_custom_field_value', 'relevanssi_filter_custom_fields', 10, 2 );
|
||||
add_filter( 'relevanssi_index_custom_fields', 'relevanssi_remove_metadata_fields' );
|
||||
add_filter( 'relevanssi_join', 'relevanssi_post_date_throttle_join', 1 );
|
||||
add_filter( 'relevanssi_where', 'relevanssi_post_date_throttle_where', 1 );
|
||||
|
||||
// Excerpts and highlights.
|
||||
add_action( 'relevanssi_pre_the_content', 'relevanssi_kill_autoembed' );
|
||||
add_action( 'relevanssi_pre_the_content', 'relevanssi_excerpt_pre_the_content' );
|
||||
add_action( 'relevanssi_post_the_content', 'relevanssi_excerpt_post_the_content' );
|
||||
|
||||
// Page builder shortcodes.
|
||||
add_filter( 'relevanssi_pre_excerpt_content', 'relevanssi_remove_page_builder_shortcodes', 9 );
|
||||
add_filter( 'relevanssi_post_content', 'relevanssi_remove_page_builder_shortcodes', 9 );
|
||||
|
||||
// Permalink handling.
|
||||
add_filter( 'post_link', 'relevanssi_permalink', 10, 2 );
|
||||
add_filter( 'post_type_link', 'relevanssi_permalink', 10, 2 );
|
||||
add_filter( 'attachment_link', 'relevanssi_permalink', 10, 2 );
|
||||
add_filter( 'page_link', 'relevanssi_permalink', 10, 2 );
|
||||
add_filter( 'relevanssi_permalink', 'relevanssi_permalink' );
|
||||
|
||||
// Log exports.
|
||||
add_action( 'plugins_loaded', 'relevanssi_export_log_check' );
|
||||
|
||||
global $relevanssi_variables;
|
||||
register_activation_hook( $relevanssi_variables['file'], 'relevanssi_install' );
|
||||
|
||||
/**
|
||||
* Initiates Relevanssi.
|
||||
*
|
||||
* @global string $pagenow Current admin page.
|
||||
* @global array $relevanssi_variables The global Relevanssi variables array.
|
||||
*/
|
||||
function relevanssi_init() {
|
||||
global $pagenow, $relevanssi_variables;
|
||||
|
||||
$plugin_dir = dirname( plugin_basename( $relevanssi_variables['file'] ) );
|
||||
load_plugin_textdomain( 'relevanssi', false, $plugin_dir . '/languages' );
|
||||
$on_relevanssi_page = false;
|
||||
if ( isset( $_GET['page'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
|
||||
$page = sanitize_file_name( wp_unslash( $_GET['page'] ) ); // phpcs:ignore WordPress.Security.NonceVerification
|
||||
$base = sanitize_file_name( wp_unslash( plugin_basename( $relevanssi_variables['file'] ) ) );
|
||||
if ( $base === $page ) {
|
||||
$on_relevanssi_page = true;
|
||||
}
|
||||
}
|
||||
|
||||
$restriction_notice = relevanssi_check_indexing_restriction();
|
||||
if ( $restriction_notice ) {
|
||||
if ( 'options-general.php' === $pagenow && $on_relevanssi_page ) {
|
||||
if ( 'indexing' === $_GET['tab'] ) { // phpcs:ignore WordPress.Security.NonceVerification
|
||||
add_action(
|
||||
'admin_notices',
|
||||
function () use ( $restriction_notice ) {
|
||||
echo $restriction_notice; // phpcs:ignore WordPress.Security.EscapeOutput
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'done' !== get_option( 'relevanssi_indexed' ) ) {
|
||||
if ( 'options-general.php' === $pagenow && $on_relevanssi_page ) {
|
||||
add_action(
|
||||
'admin_notices',
|
||||
function () {
|
||||
printf(
|
||||
"<div id='relevanssi-warning' class='update-nag'><p><strong>%s</strong></p></div>",
|
||||
esc_html__( 'You do not have an index! Remember to build the index (click the "Build the index" button), otherwise searching won\'t work.', 'relevanssi' )
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'mb_internal_encoding' ) ) {
|
||||
/**
|
||||
* Prints out the "Multibyte string functions are not available" warning.
|
||||
*/
|
||||
function relevanssi_mb_warning() {
|
||||
printf( "<div id='relevanssi-warning' class='error'><p><strong>%s</strong></p></div>", esc_html__( 'Multibyte string functions are not available. Relevanssi may not work well without them. Please install (or ask your host to install) the mbstring extension.', 'relevanssi' ) );
|
||||
}
|
||||
if ( 'options-general.php' === $pagenow && $on_relevanssi_page ) {
|
||||
add_action( 'admin_notices', 'relevanssi_mb_warning' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'off' !== get_option( 'relevanssi_highlight_docs', 'off' ) ) {
|
||||
add_filter( 'the_content', 'relevanssi_highlight_in_docs', 11 );
|
||||
}
|
||||
if ( 'off' !== get_option( 'relevanssi_highlight_comments', 'off' ) ) {
|
||||
add_filter( 'comment_text', 'relevanssi_highlight_in_docs', 11 );
|
||||
}
|
||||
|
||||
if ( get_option( 'relevanssi_trim_logs' ) > 0 ) {
|
||||
if ( ! wp_next_scheduled( 'relevanssi_trim_logs' ) ) {
|
||||
wp_schedule_event( time(), 'daily', 'relevanssi_trim_logs' );
|
||||
}
|
||||
} elseif ( wp_next_scheduled( 'relevanssi_trim_logs' ) ) {
|
||||
wp_clear_scheduled_hook( 'relevanssi_trim_logs' );
|
||||
}
|
||||
|
||||
if ( ! wp_next_scheduled( 'relevanssi_update_counts' ) ) {
|
||||
wp_schedule_event( time(), 'weekly', 'relevanssi_update_counts' );
|
||||
}
|
||||
|
||||
relevanssi_load_compatibility_code();
|
||||
|
||||
if ( ! is_array( get_option( 'relevanssi_stopwords' ) ) ) {
|
||||
// Version 2.12 / 4.10 changes stopwords option from a string to an
|
||||
// array to support multilingual stopwords. This function converts old
|
||||
// style to new style. Remove eventually.
|
||||
relevanssi_update_stopwords_setting();
|
||||
}
|
||||
|
||||
if ( ! is_array( get_option( 'relevanssi_synonyms' ) ) ) {
|
||||
// Version 2.12 / 4.10 changes synonyms option from a string to an
|
||||
// array to support multilingual synonyms. This function converts old
|
||||
// style to new style. Remove eventually.
|
||||
relevanssi_update_synonyms_setting();
|
||||
}
|
||||
|
||||
do_action( 'relevanssi_init' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Iniatiates Relevanssi for admin.
|
||||
*
|
||||
* @global array $relevanssi_variables Global Relevanssi variables array.
|
||||
*/
|
||||
function relevanssi_admin_init() {
|
||||
global $relevanssi_variables;
|
||||
|
||||
add_action( 'admin_enqueue_scripts', 'relevanssi_add_admin_scripts' );
|
||||
add_filter( 'plugin_action_links_' . $relevanssi_variables['plugin_basename'], 'relevanssi_action_links' );
|
||||
|
||||
relevanssi_create_database_tables( $relevanssi_variables['database_version'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the Relevanssi menu items.
|
||||
*
|
||||
* @global array $relevanssi_variables The global Relevanssi variables array.
|
||||
*/
|
||||
function relevanssi_menu() {
|
||||
global $relevanssi_variables;
|
||||
$name = 'Relevanssi';
|
||||
if ( RELEVANSSI_PREMIUM ) {
|
||||
$name = 'Relevanssi Premium';
|
||||
}
|
||||
$plugin_page = add_options_page(
|
||||
$name,
|
||||
$name,
|
||||
/**
|
||||
* Filters the capability required to access Relevanssi options.
|
||||
*
|
||||
* @param string The capability required. Default 'manage_options'.
|
||||
*/
|
||||
apply_filters( 'relevanssi_options_capability', 'manage_options' ),
|
||||
$relevanssi_variables['file'],
|
||||
'relevanssi_options'
|
||||
);
|
||||
add_dashboard_page(
|
||||
__( 'User searches', 'relevanssi' ),
|
||||
__( 'User searches', 'relevanssi' ),
|
||||
/**
|
||||
* Filters the capability required to access Relevanssi user searches page.
|
||||
*
|
||||
* @param string The capability required. Default 'edit_pages'.
|
||||
*/
|
||||
apply_filters( 'relevanssi_user_searches_capability', 'edit_pages' ),
|
||||
$relevanssi_variables['file'],
|
||||
'relevanssi_search_stats'
|
||||
);
|
||||
add_dashboard_page(
|
||||
__( 'Admin search', 'relevanssi' ),
|
||||
__( 'Admin search', 'relevanssi' ),
|
||||
/**
|
||||
* Filters the capability required to access Relevanssi admin search page.
|
||||
*
|
||||
* @param string The capability required. Default 'edit_posts'.
|
||||
*/
|
||||
apply_filters( 'relevanssi_admin_search_capability', 'edit_posts' ),
|
||||
'relevanssi_admin_search',
|
||||
'relevanssi_admin_search_page'
|
||||
);
|
||||
require_once 'contextual-help.php';
|
||||
add_action( 'load-' . $plugin_page, 'relevanssi_admin_help' );
|
||||
if ( function_exists( 'relevanssi_premium_plugin_page_actions' ) ) {
|
||||
// Loads contextual help and JS for Premium version.
|
||||
relevanssi_premium_plugin_page_actions( $plugin_page );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Introduces the Relevanssi query variables.
|
||||
*
|
||||
* Adds the Relevanssi query variables (cats, tags, post_types, by_date, and
|
||||
* highlight) to the WordPress whitelist of accepted query variables.
|
||||
*
|
||||
* @param array $qv The query variable list.
|
||||
*
|
||||
* @return array The query variables.
|
||||
*/
|
||||
function relevanssi_query_vars( $qv ) {
|
||||
$qv[] = 'cats';
|
||||
$qv[] = 'tags';
|
||||
$qv[] = 'post_types';
|
||||
$qv[] = 'by_date';
|
||||
$qv[] = 'highlight';
|
||||
$qv[] = 'posts_per_page';
|
||||
$qv[] = 'post_parent';
|
||||
|
||||
return $qv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the Relevanssi database tables.
|
||||
*
|
||||
* @global object $wpdb The WordPress database interface.
|
||||
*
|
||||
* @param int $relevanssi_db_version The Relevanssi database version number.
|
||||
*/
|
||||
function relevanssi_create_database_tables( $relevanssi_db_version ) {
|
||||
global $wpdb;
|
||||
|
||||
$current_db_version = intval( get_option( 'relevanssi_db_version' ) );
|
||||
|
||||
if ( $current_db_version === $relevanssi_db_version ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$charset_collate_bin_column = '';
|
||||
$charset_collate = '';
|
||||
|
||||
if ( ! empty( $wpdb->charset ) ) {
|
||||
$charset_collate_bin_column = "CHARACTER SET $wpdb->charset";
|
||||
$charset_collate = "DEFAULT $charset_collate_bin_column";
|
||||
}
|
||||
if ( strpos( $wpdb->collate, '_' ) > 0 ) {
|
||||
$charset_collate_bin_column .= ' COLLATE ' . substr( $wpdb->collate, 0, strpos( $wpdb->collate, '_' ) ) . '_bin';
|
||||
$charset_collate .= " COLLATE $wpdb->collate";
|
||||
} elseif ( '' === $wpdb->collate && 'utf8' === $wpdb->charset ) {
|
||||
$charset_collate_bin_column .= ' COLLATE utf8_bin';
|
||||
}
|
||||
|
||||
$relevanssi_table = $wpdb->prefix . 'relevanssi';
|
||||
$relevanssi_stopword_table = $wpdb->prefix . 'relevanssi_stopwords';
|
||||
$relevanssi_log_table = $wpdb->prefix . 'relevanssi_log';
|
||||
|
||||
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
|
||||
|
||||
$sql = 'CREATE TABLE ' . $relevanssi_table . " (doc bigint(20) NOT NULL DEFAULT '0',
|
||||
term varchar(50) NOT NULL DEFAULT '0',
|
||||
term_reverse varchar(50) NOT NULL DEFAULT '0',
|
||||
content mediumint(9) NOT NULL DEFAULT '0',
|
||||
title mediumint(9) NOT NULL DEFAULT '0',
|
||||
comment mediumint(9) NOT NULL DEFAULT '0',
|
||||
tag mediumint(9) NOT NULL DEFAULT '0',
|
||||
link mediumint(9) NOT NULL DEFAULT '0',
|
||||
author mediumint(9) NOT NULL DEFAULT '0',
|
||||
category mediumint(9) NOT NULL DEFAULT '0',
|
||||
excerpt mediumint(9) NOT NULL DEFAULT '0',
|
||||
taxonomy mediumint(9) NOT NULL DEFAULT '0',
|
||||
customfield mediumint(9) NOT NULL DEFAULT '0',
|
||||
mysqlcolumn mediumint(9) NOT NULL DEFAULT '0',
|
||||
taxonomy_detail longtext NOT NULL,
|
||||
customfield_detail longtext NOT NULL DEFAULT '',
|
||||
mysqlcolumn_detail longtext NOT NULL DEFAULT '',
|
||||
type varchar(210) NOT NULL DEFAULT 'post',
|
||||
item bigint(20) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY doctermitem (doc, term, item)) $charset_collate";
|
||||
|
||||
dbDelta( $sql );
|
||||
|
||||
$sql = "SHOW INDEX FROM $relevanssi_table";
|
||||
$indices = $wpdb->get_results( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery
|
||||
|
||||
$terms_exists = false;
|
||||
$relevanssi_term_reverse_idx_exists = false;
|
||||
$docs_exists = false;
|
||||
$typeitem_exists = false;
|
||||
$doctermitem_exists = false;
|
||||
foreach ( $indices as $index ) {
|
||||
if ( 'terms' === $index->Key_name ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName
|
||||
$terms_exists = true;
|
||||
}
|
||||
if ( 'relevanssi_term_reverse_idx' === $index->Key_name ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName
|
||||
$relevanssi_term_reverse_idx_exists = true;
|
||||
}
|
||||
if ( 'docs' === $index->Key_name ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName
|
||||
$docs_exists = true;
|
||||
}
|
||||
if ( 'typeitem' === $index->Key_name ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName
|
||||
$typeitem_exists = true;
|
||||
}
|
||||
if ( 'doctermitem' === $index->Key_name ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName
|
||||
$doctermitem_exists = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $terms_exists ) {
|
||||
$sql = "CREATE INDEX terms ON $relevanssi_table (term(20))";
|
||||
$wpdb->query( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery
|
||||
}
|
||||
|
||||
if ( ! $relevanssi_term_reverse_idx_exists ) {
|
||||
$sql = "CREATE INDEX relevanssi_term_reverse_idx ON $relevanssi_table (term_reverse(10))";
|
||||
$wpdb->query( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery
|
||||
}
|
||||
|
||||
if ( ! $typeitem_exists ) {
|
||||
$sql = "CREATE INDEX typeitem ON $relevanssi_table (type(190), item)";
|
||||
$wpdb->query( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery
|
||||
}
|
||||
|
||||
if ( $doctermitem_exists ) {
|
||||
$sql = "DROP INDEX doctermitem ON $relevanssi_table";
|
||||
$wpdb->query( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery
|
||||
}
|
||||
|
||||
if ( $docs_exists ) { // This index was removed in 4.9.2 / 2.11.2.
|
||||
$sql = "DROP INDEX docs ON $relevanssi_table";
|
||||
$wpdb->query( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery
|
||||
}
|
||||
|
||||
$sql = 'CREATE TABLE ' . $relevanssi_stopword_table . " (stopword varchar(50) $charset_collate_bin_column NOT NULL,
|
||||
PRIMARY KEY stopword (stopword)) $charset_collate;";
|
||||
|
||||
dbDelta( $sql );
|
||||
|
||||
$sql = 'CREATE TABLE ' . $relevanssi_log_table . " (id bigint(9) NOT NULL AUTO_INCREMENT,
|
||||
query varchar(200) NOT NULL,
|
||||
hits mediumint(9) NOT NULL DEFAULT '0',
|
||||
time timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
user_id bigint(20) NOT NULL DEFAULT '0',
|
||||
ip varchar(40) NOT NULL DEFAULT '',
|
||||
session_id varchar(32) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY id (id)) $charset_collate;";
|
||||
|
||||
dbDelta( $sql );
|
||||
|
||||
$sql = "SHOW INDEX FROM $relevanssi_log_table";
|
||||
$indices = $wpdb->get_results( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.NoCaching
|
||||
|
||||
$query_exists = false;
|
||||
$id_exists = false;
|
||||
foreach ( $indices as $index ) {
|
||||
if ( 'query' === $index->Key_name ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName
|
||||
$query_exists = true;
|
||||
}
|
||||
if ( 'id' === $index->Key_name ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName
|
||||
$id_exists = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $query_exists ) {
|
||||
$sql = "CREATE INDEX query ON $relevanssi_log_table (query(190))";
|
||||
$wpdb->query( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.NoCaching
|
||||
}
|
||||
|
||||
if ( $id_exists ) {
|
||||
$sql = "DROP INDEX id ON $relevanssi_log_table";
|
||||
$wpdb->query( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.NoCaching
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows adding database tables.
|
||||
*
|
||||
* An action hook that runs in the create tables process if the database
|
||||
* version in the options doesn't match the database version in the
|
||||
* code.
|
||||
*
|
||||
* @param string $charset_collate The collation.
|
||||
*/
|
||||
do_action( 'relevanssi_create_tables', $charset_collate );
|
||||
|
||||
update_option( 'relevanssi_db_version', $relevanssi_db_version );
|
||||
|
||||
$stopwords = relevanssi_fetch_stopwords();
|
||||
if ( empty( $stopwords ) ) {
|
||||
relevanssi_populate_stopwords( false, $relevanssi_stopword_table );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints out the action links on the Plugins page.
|
||||
*
|
||||
* Hooked on to the 'plugin_action_links_' filter hook.
|
||||
*
|
||||
* @param array $links Action links for Relevanssi.
|
||||
*
|
||||
* @return array Updated action links.
|
||||
*/
|
||||
function relevanssi_action_links( $links ) {
|
||||
$root = 'relevanssi';
|
||||
if ( RELEVANSSI_PREMIUM ) {
|
||||
$root = 'relevanssi-premium';
|
||||
}
|
||||
$relevanssi_links = array(
|
||||
'<a href="' . admin_url( 'options-general.php?page=' . $root . '/relevanssi.php' ) . '">' . __( 'Settings', 'relevanssi' ) . '</a>',
|
||||
);
|
||||
if ( ! RELEVANSSI_PREMIUM ) {
|
||||
$relevanssi_links[] = '<a href="https://www.relevanssi.com/buy-premium/">' . __( 'Go Premium!', 'relevanssi' ) . '</a>';
|
||||
}
|
||||
return array_merge( $relevanssi_links, $links );
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables Relevanssi in REST API searches.
|
||||
*
|
||||
* Relevanssi doesn't work in the REST API context, so disable and allow the
|
||||
* default search to work.
|
||||
*/
|
||||
function relevanssi_rest_api_disable() {
|
||||
remove_filter( 'posts_request', 'relevanssi_prevent_default_request' );
|
||||
remove_filter( 'the_posts', 'relevanssi_query', 99 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a log export is requested.
|
||||
*
|
||||
* If the 'relevanssi_export' query variable is set, a log export has been
|
||||
* requested and one will be provided by relevanssi_export_log(). The click
|
||||
* tracking log export checks 'relevanssi_export_clicks' and uses the function
|
||||
* relevanssi_export_click_log().
|
||||
*
|
||||
* @see relevanssi_export_log
|
||||
* @see relevanssi_export_click_log
|
||||
*/
|
||||
function relevanssi_export_log_check() {
|
||||
if ( isset( $_REQUEST['relevanssi_export'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification, just checking the parameter exists.
|
||||
relevanssi_export_log();
|
||||
}
|
||||
if ( isset( $_REQUEST['relevanssi_export_clicks'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification, just checking the parameter exists.
|
||||
function_exists( 'relevanssi_export_click_log' ) && relevanssi_export_click_log();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads in the Relevanssi plugin compatibility code.
|
||||
*/
|
||||
function relevanssi_load_compatibility_code() {
|
||||
class_exists( 'acf', false ) && require_once 'compatibility/acf.php';
|
||||
class_exists( 'DGWT_WC_Ajax_Search', false ) && require_once 'compatibility/fibosearch.php';
|
||||
class_exists( 'Jet_Smart_Filters', false ) && require_once 'compatibility/jetsmartfilters.php';
|
||||
class_exists( 'MeprUpdateCtrl', false ) && MeprUpdateCtrl::is_activated() && require_once 'compatibility/memberpress.php';
|
||||
class_exists( 'Obenland_Wp_Search_Suggest', false ) && require_once 'compatibility/wp-search-suggest.php';
|
||||
class_exists( 'Polylang', false ) && require_once 'compatibility/polylang.php';
|
||||
class_exists( 'RankMath', false ) && require_once 'compatibility/rankmath.php';
|
||||
class_exists( 'WooCommerce', false ) && require_once 'compatibility/woocommerce.php';
|
||||
defined( 'AIOSEO_DIR' ) && require_once 'compatibility/aioseo.php';
|
||||
defined( 'AVADA_VERSION' ) && require_once 'compatibility/avada.php';
|
||||
defined( 'BRICKS_VERSION' ) && require_once 'compatibility/bricks.php';
|
||||
defined( 'CT_VERSION' ) && require_once 'compatibility/oxygen.php';
|
||||
defined( 'ELEMENTOR_VERSION' ) && require_once 'compatibility/elementor.php';
|
||||
defined( 'GROUPS_CORE_VERSION' ) && require_once 'compatibility/groups.php';
|
||||
defined( 'NINJA_TABLES_VERSION' ) && require_once 'compatibility/ninjatables.php';
|
||||
defined( 'PRLI_PLUGIN_NAME' ) && require_once 'compatibility/pretty-links.php';
|
||||
defined( 'WPM_PRODUCT_GTIN_WC_VERSION' ) && require_once 'compatibility/product-gtin-ean-upc-isbn-for-woocommerce.php';
|
||||
defined( 'SIMPLE_WP_MEMBERSHIP_VER' ) && require_once 'compatibility/simplemembership.php';
|
||||
defined( 'THE_SEO_FRAMEWORK_VERSION' ) && require_once 'compatibility/seoframework.php';
|
||||
defined( 'WPFD_VERSION' ) && require_once 'compatibility/wp-file-download.php';
|
||||
defined( 'WPMEM_VERSION' ) && require_once 'compatibility/wp-members.php';
|
||||
defined( 'WPSEO_FILE' ) && require_once 'compatibility/yoast-seo.php';
|
||||
function_exists( 'do_blocks' ) && require_once 'compatibility/gutenberg.php';
|
||||
function_exists( 'icl_object_id' ) && ! function_exists( 'pll_is_translated_post_type' ) && require_once 'compatibility/wpml.php';
|
||||
function_exists( 'members_content_permissions_enabled' ) && require_once 'compatibility/members.php';
|
||||
function_exists( 'pmpro_has_membership_access' ) && require_once 'compatibility/paidmembershippro.php';
|
||||
function_exists( 'rcp_user_can_access' ) && require_once 'compatibility/restrictcontentpro.php';
|
||||
function_exists( 'seopress_get_toggle_titles_option' ) && '1' === seopress_get_toggle_titles_option() && require_once 'compatibility/seopress.php';
|
||||
function_exists( 'wp_jv_prg_user_can_see_a_post' ) && require_once 'compatibility/wpjvpostreadinggroups.php';
|
||||
|
||||
// phpcs:disable WordPress.NamingConventions.ValidVariableName
|
||||
global $userAccessManager;
|
||||
isset( $userAccessManager ) && require_once 'compatibility/useraccessmanager.php';
|
||||
// phpcs:enable WordPress.NamingConventions.ValidVariableName
|
||||
|
||||
// Always required, the functions check if TablePress is active.
|
||||
require_once 'compatibility/tablepress.php';
|
||||
}
|
||||
149
wp/wp-content/plugins/relevanssi-premium/lib/install.php
Normal file
149
wp/wp-content/plugins/relevanssi-premium/lib/install.php
Normal file
@@ -0,0 +1,149 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/install.php
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Installs Relevanssi on a new plugin if Relevanssi is network active.
|
||||
*
|
||||
* Hooks on to 'wpmu_new_blog' and 'wp_initialize_site' action hooks and runs
|
||||
* '_relevanssi_install' on the new blog.
|
||||
*
|
||||
* @param int|object $blog Either the blog ID (if 'wpmu_new_blog') or new site
|
||||
* object (if 'wp_initialize_site').
|
||||
*/
|
||||
function relevanssi_new_blog( $blog ) {
|
||||
if ( is_int( $blog ) ) {
|
||||
$blog_id = $blog;
|
||||
} else {
|
||||
$blog_id = $blog->id;
|
||||
}
|
||||
|
||||
if ( is_plugin_active_for_network( 'relevanssi-premium/relevanssi.php' ) || is_plugin_active_for_network( 'relevanssi/relevanssi.php' ) ) {
|
||||
switch_to_blog( $blog_id );
|
||||
_relevanssi_install();
|
||||
restore_current_blog();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs _relevanssi_install() on one blog or for the whole network.
|
||||
*
|
||||
* If Relevanssi is network active, this installs Relevanssi on all blogs in the
|
||||
* network, running the _relevanssi_install() function.
|
||||
*
|
||||
* @param boolean $network_wide If true, install on all sites. Default false.
|
||||
*/
|
||||
function relevanssi_install( $network_wide = false ) {
|
||||
if ( $network_wide ) {
|
||||
$args = array(
|
||||
'spam' => 0,
|
||||
'deleted' => 0,
|
||||
'archived' => 0,
|
||||
'fields' => 'ids',
|
||||
);
|
||||
$blog_ids = get_sites( $args );
|
||||
|
||||
foreach ( $blog_ids as $blog_id ) {
|
||||
switch_to_blog( $blog_id );
|
||||
_relevanssi_install();
|
||||
restore_current_blog();
|
||||
}
|
||||
} else {
|
||||
_relevanssi_install();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs Relevanssi on the blog.
|
||||
*
|
||||
* Adds Relevanssi options and sets their default values and generates the
|
||||
* database tables.
|
||||
*
|
||||
* @global array $relevanssi_variables The global Relevanssi variables array.
|
||||
*/
|
||||
function _relevanssi_install() {
|
||||
global $relevanssi_variables;
|
||||
|
||||
add_option( 'relevanssi_admin_search', 'off' );
|
||||
add_option( 'relevanssi_bg_col', '#ffaf75' );
|
||||
add_option( 'relevanssi_cat', '0' );
|
||||
add_option( 'relevanssi_class', 'relevanssi-query-term' );
|
||||
add_option( 'relevanssi_comment_boost', $relevanssi_variables['comment_boost_default'] );
|
||||
add_option( 'relevanssi_content_boost', $relevanssi_variables['content_boost_default'] );
|
||||
add_option( 'relevanssi_css', 'text-decoration: underline; color: #ff0000' );
|
||||
add_option( 'relevanssi_db_version', '0' );
|
||||
add_option( 'relevanssi_debugging_mode', 'off' );
|
||||
add_option( 'relevanssi_default_orderby', 'relevance' );
|
||||
add_option( 'relevanssi_disable_or_fallback', 'off' );
|
||||
add_option( 'relevanssi_exact_match_bonus', 'on' );
|
||||
add_option( 'relevanssi_excat', '0' );
|
||||
add_option( 'relevanssi_excerpt_allowable_tags', '' );
|
||||
add_option( 'relevanssi_excerpt_custom_fields', 'off' );
|
||||
add_option( 'relevanssi_excerpt_length', '30' );
|
||||
add_option( 'relevanssi_excerpt_specific_fields', 'off' );
|
||||
add_option( 'relevanssi_excerpt_type', 'words' );
|
||||
add_option( 'relevanssi_excerpts', 'on' );
|
||||
add_option( 'relevanssi_exclude_posts', '' );
|
||||
add_option( 'relevanssi_expand_highlights', 'off' );
|
||||
add_option( 'relevanssi_expand_shortcodes', 'on' );
|
||||
add_option( 'relevanssi_extag', '0' );
|
||||
add_option( 'relevanssi_fuzzy', 'always' );
|
||||
add_option( 'relevanssi_highlight', 'strong' );
|
||||
add_option( 'relevanssi_highlight_comments', 'off' );
|
||||
add_option( 'relevanssi_highlight_docs', 'off' );
|
||||
add_option( 'relevanssi_hilite_title', '' );
|
||||
add_option( 'relevanssi_implicit_operator', 'OR' );
|
||||
add_option( 'relevanssi_index_author', '' );
|
||||
add_option( 'relevanssi_index_comments', 'none' );
|
||||
add_option( 'relevanssi_index_excerpt', 'off' );
|
||||
add_option( 'relevanssi_index_fields', '' );
|
||||
add_option( 'relevanssi_index_image_files', 'on' );
|
||||
add_option( 'relevanssi_index_post_types', array( 'post', 'page' ) );
|
||||
add_option( 'relevanssi_index_taxonomies_list', array() );
|
||||
add_option( 'relevanssi_indexed', '' );
|
||||
add_option( 'relevanssi_log_queries', 'off' );
|
||||
add_option( 'relevanssi_log_queries_with_ip', 'off' );
|
||||
add_option( 'relevanssi_min_word_length', '3' );
|
||||
add_option( 'relevanssi_omit_from_logs', '' );
|
||||
add_option( 'relevanssi_polylang_all_languages', 'off' );
|
||||
add_option(
|
||||
'relevanssi_punctuation',
|
||||
array(
|
||||
'quotes' => 'replace',
|
||||
'hyphens' => 'replace',
|
||||
'ampersands' => 'replace',
|
||||
)
|
||||
);
|
||||
add_option( 'relevanssi_respect_exclude', 'on' );
|
||||
add_option( 'relevanssi_seo_noindex', 'on' );
|
||||
add_option( 'relevanssi_show_matches', '' );
|
||||
add_option( 'relevanssi_show_matches_text', '(Search hits: %body% in body, %title% in title, %categories% in categories, %tags% in tags, %taxonomies% in other taxonomies, %comments% in comments. Score: %score%)' );
|
||||
add_option( 'relevanssi_stopwords', array() );
|
||||
add_option( 'relevanssi_synonyms', array() );
|
||||
add_option( 'relevanssi_throttle', 'on' );
|
||||
add_option( 'relevanssi_throttle_limit', '500' );
|
||||
add_option( 'relevanssi_title_boost', $relevanssi_variables['title_boost_default'] );
|
||||
add_option( 'relevanssi_txt_col', '#ff0000' );
|
||||
add_option( 'relevanssi_wpml_only_current', 'on' );
|
||||
|
||||
if ( function_exists( 'relevanssi_premium_install' ) ) {
|
||||
// Do some Relevanssi Premium additions.
|
||||
relevanssi_premium_install();
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs after Relevanssi options are added in the installation process.
|
||||
*
|
||||
* This action hook can be used to adjust the options to set your own default
|
||||
* settings, for example.
|
||||
*/
|
||||
do_action( 'relevanssi_update_options' );
|
||||
|
||||
relevanssi_create_database_tables( $relevanssi_variables['database_version'] );
|
||||
}
|
||||
525
wp/wp-content/plugins/relevanssi-premium/lib/interface.php
Normal file
525
wp/wp-content/plugins/relevanssi-premium/lib/interface.php
Normal file
@@ -0,0 +1,525 @@
|
||||
<?php
|
||||
/**
|
||||
* /lib/interface.php
|
||||
*
|
||||
* @package Relevanssi
|
||||
* @author Mikko Saari
|
||||
* @license https://wordpress.org/about/gpl/ GNU General Public License
|
||||
* @see https://www.relevanssi.com/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Controls the Relevanssi settings page.
|
||||
*
|
||||
* @global array $relevanssi_variables The global Relevanssi variables array.
|
||||
*/
|
||||
function relevanssi_options() {
|
||||
global $relevanssi_variables;
|
||||
$options_txt = __( 'Relevanssi Search Options', 'relevanssi' );
|
||||
if ( RELEVANSSI_PREMIUM ) {
|
||||
$options_txt = __( 'Relevanssi Premium Search Options', 'relevanssi' );
|
||||
}
|
||||
|
||||
printf( "<div class='wrap'><h2>%s</h2>", esc_html( $options_txt ) );
|
||||
if ( ! empty( $_REQUEST ) ) {
|
||||
if ( isset( $_REQUEST['submit'] ) ) {
|
||||
check_admin_referer( plugin_basename( $relevanssi_variables['file'] ), 'relevanssi_options' );
|
||||
update_relevanssi_options( $_REQUEST );
|
||||
}
|
||||
|
||||
if ( isset( $_REQUEST['import_options'] ) ) {
|
||||
if ( function_exists( 'relevanssi_import_options' ) ) {
|
||||
check_admin_referer( plugin_basename( $relevanssi_variables['file'] ), 'relevanssi_options' );
|
||||
$options = $_REQUEST['relevanssi_settings'];
|
||||
relevanssi_import_options( $options );
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $_REQUEST['search'] ) ) {
|
||||
relevanssi_search( $_REQUEST['q'] );
|
||||
}
|
||||
|
||||
if ( isset( $_REQUEST['dowhat'] ) ) {
|
||||
if ( 'add_stopword' === $_REQUEST['dowhat'] ) {
|
||||
if ( isset( $_REQUEST['term'] ) ) {
|
||||
check_admin_referer( plugin_basename( $relevanssi_variables['file'] ), 'relevanssi_options' );
|
||||
relevanssi_add_stopword( $_REQUEST['term'] );
|
||||
}
|
||||
if ( isset( $_REQUEST['body_term'] ) ) {
|
||||
check_admin_referer( plugin_basename( $relevanssi_variables['file'] ), 'relevanssi_options' );
|
||||
relevanssi_add_body_stopword( $_REQUEST['body_term'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $_REQUEST['addstopword'] ) ) {
|
||||
check_admin_referer( plugin_basename( $relevanssi_variables['file'] ), 'relevanssi_options' );
|
||||
relevanssi_add_stopword( $_REQUEST['addstopword'] );
|
||||
}
|
||||
|
||||
if ( isset( $_REQUEST['removestopword'] ) ) {
|
||||
check_admin_referer( plugin_basename( $relevanssi_variables['file'] ), 'relevanssi_options' );
|
||||
relevanssi_remove_stopword( $_REQUEST['removestopword'] );
|
||||
}
|
||||
|
||||
if ( isset( $_REQUEST['removeallstopwords'] ) ) {
|
||||
check_admin_referer( plugin_basename( $relevanssi_variables['file'] ), 'relevanssi_options' );
|
||||
relevanssi_remove_all_stopwords();
|
||||
}
|
||||
|
||||
if ( isset( $_REQUEST['repopulatestopwords'] ) ) {
|
||||
check_admin_referer( plugin_basename( $relevanssi_variables['file'] ), 'relevanssi_options' );
|
||||
$verbose = true;
|
||||
relevanssi_populate_stopwords( $verbose );
|
||||
}
|
||||
|
||||
if ( isset( $_REQUEST['addbodystopword'] ) ) {
|
||||
check_admin_referer( plugin_basename( $relevanssi_variables['file'] ), 'relevanssi_options' );
|
||||
relevanssi_add_body_stopword( $_REQUEST['addbodystopword'] );
|
||||
}
|
||||
|
||||
if ( isset( $_REQUEST['removebodystopword'] ) ) {
|
||||
check_admin_referer( plugin_basename( $relevanssi_variables['file'] ), 'relevanssi_options' );
|
||||
relevanssi_remove_body_stopword( $_REQUEST['removebodystopword'] );
|
||||
}
|
||||
|
||||
if ( isset( $_REQUEST['removeallbodystopwords'] ) ) {
|
||||
check_admin_referer( plugin_basename( $relevanssi_variables['file'] ), 'relevanssi_options' );
|
||||
relevanssi_remove_all_body_stopwords();
|
||||
}
|
||||
|
||||
if ( isset( $_REQUEST['update_counts'] ) ) {
|
||||
check_admin_referer( 'update_counts' );
|
||||
relevanssi_update_counts();
|
||||
}
|
||||
}
|
||||
|
||||
relevanssi_options_form();
|
||||
|
||||
echo "<div style='clear:both'></div></div>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints out the 'Admin search' page.
|
||||
*/
|
||||
function relevanssi_admin_search_page() {
|
||||
global $relevanssi_variables;
|
||||
|
||||
$options_txt = __( 'Admin Search', 'relevanssi' );
|
||||
|
||||
printf( "<div class='wrap'><h2>%s</h2>", esc_html( $options_txt ) );
|
||||
|
||||
require_once dirname( $relevanssi_variables['file'] ) . '/lib/tabs/search-page.php';
|
||||
relevanssi_search_tab();
|
||||
}
|
||||
|
||||
/**
|
||||
* Truncates the Relevanssi logs.
|
||||
*
|
||||
* @global object $wpdb The WP database interface.
|
||||
* @global array $relevanssi_variables The global Relevanssi variables array.
|
||||
*
|
||||
* @param boolean $verbose If true, prints out a notice. Default true.
|
||||
*
|
||||
* @return boolean True if success, false if failure.
|
||||
*/
|
||||
function relevanssi_truncate_logs( $verbose = true ) {
|
||||
global $wpdb, $relevanssi_variables;
|
||||
|
||||
$result = $wpdb->query( 'TRUNCATE ' . $relevanssi_variables['log_table'] ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
||||
if ( isset( $relevanssi_variables['tracking_table'] ) ) {
|
||||
$tracking_result = $wpdb->query( 'TRUNCATE ' . $relevanssi_variables['tracking_table'] ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
||||
$results = $result && $tracking_result;
|
||||
}
|
||||
|
||||
if ( $verbose ) {
|
||||
if ( false !== $result ) {
|
||||
printf( "<div id='relevanssi-warning' class='updated fade'>%s</div>", esc_html__( 'Logs clear!', 'relevanssi' ) );
|
||||
} else {
|
||||
printf( "<div id='relevanssi-warning' class='updated fade'>%s</div>", esc_html__( 'Clearing the logs failed.', 'relevanssi' ) );
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints out the Relevanssi options form.
|
||||
*
|
||||
* @global array $relevanssi_variables The global Relevanssi variables array.
|
||||
*/
|
||||
function relevanssi_options_form() {
|
||||
global $relevanssi_variables;
|
||||
|
||||
echo "<div class='postbox-container'>";
|
||||
echo "<form method='post'>";
|
||||
|
||||
wp_nonce_field( plugin_basename( $relevanssi_variables['file'] ), 'relevanssi_options' );
|
||||
|
||||
$display_save_button = true;
|
||||
|
||||
$active_tab = 'overview';
|
||||
if ( isset( $_REQUEST['tab'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
|
||||
$active_tab = $_REQUEST['tab']; // phpcs:ignore WordPress.Security.NonceVerification
|
||||
}
|
||||
|
||||
if ( 'stopwords' === $active_tab ) {
|
||||
$display_save_button = false;
|
||||
}
|
||||
|
||||
printf( "<input type='hidden' name='tab' value='%s' />", esc_attr( $active_tab ) );
|
||||
|
||||
$this_page = '?page=' . plugin_basename( $relevanssi_variables['file'] );
|
||||
|
||||
$tabs = array(
|
||||
array(
|
||||
'slug' => 'overview',
|
||||
'name' => __( 'Overview', 'relevanssi' ),
|
||||
'require' => 'tabs/overview-tab.php',
|
||||
'callback' => 'relevanssi_overview_tab',
|
||||
'save' => 'premium',
|
||||
),
|
||||
array(
|
||||
'slug' => 'indexing',
|
||||
'name' => __( 'Indexing', 'relevanssi' ),
|
||||
'require' => 'tabs/indexing-tab.php',
|
||||
'callback' => 'relevanssi_indexing_tab',
|
||||
'save' => true,
|
||||
),
|
||||
array(
|
||||
'slug' => 'attachments',
|
||||
'name' => __( 'Attachments', 'relevanssi' ),
|
||||
'require' => 'tabs/attachments-tab.php',
|
||||
'callback' => 'relevanssi_attachments_tab',
|
||||
'save' => false,
|
||||
),
|
||||
array(
|
||||
'slug' => 'searching',
|
||||
'name' => __( 'Searching', 'relevanssi' ),
|
||||
'require' => 'tabs/searching-tab.php',
|
||||
'callback' => 'relevanssi_searching_tab',
|
||||
'save' => true,
|
||||
),
|
||||
array(
|
||||
'slug' => 'logging',
|
||||
'name' => __( 'Logging', 'relevanssi' ),
|
||||
'require' => 'tabs/logging-tab.php',
|
||||
'callback' => 'relevanssi_logging_tab',
|
||||
'save' => true,
|
||||
),
|
||||
array(
|
||||
'slug' => 'excerpts',
|
||||
'name' => __( 'Excerpts and highlights', 'relevanssi' ),
|
||||
'require' => 'tabs/excerpts-tab.php',
|
||||
'callback' => 'relevanssi_excerpts_tab',
|
||||
'save' => true,
|
||||
),
|
||||
array(
|
||||
'slug' => 'synonyms',
|
||||
'name' => __( 'Synonyms', 'relevanssi' ),
|
||||
'require' => 'tabs/synonyms-tab.php',
|
||||
'callback' => 'relevanssi_synonyms_tab',
|
||||
'save' => true,
|
||||
),
|
||||
array(
|
||||
'slug' => 'stopwords',
|
||||
'name' => __( 'Stopwords', 'relevanssi' ),
|
||||
'require' => 'tabs/stopwords-tab.php',
|
||||
'callback' => 'relevanssi_stopwords_tab',
|
||||
'save' => true,
|
||||
),
|
||||
array(
|
||||
'slug' => 'redirects',
|
||||
'name' => __( 'Redirects', 'relevanssi' ),
|
||||
'require' => 'tabs/redirects-tab.php',
|
||||
'callback' => 'relevanssi_redirects_tab',
|
||||
'save' => false,
|
||||
),
|
||||
array(
|
||||
'slug' => 'debugging',
|
||||
'name' => __( 'Debugging', 'relevanssi' ),
|
||||
'require' => 'tabs/debugging-tab.php',
|
||||
'callback' => 'relevanssi_debugging_tab',
|
||||
'save' => true,
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Allows adding new tabs to the Relevanssi menu.
|
||||
*
|
||||
* @param array $tabs An array of arrays defining the tabs.
|
||||
*
|
||||
* @return array Filtered tab array.
|
||||
*/
|
||||
$tabs = apply_filters( 'relevanssi_tabs', $tabs );
|
||||
?>
|
||||
<h2 class="nav-tab-wrapper">
|
||||
<?php
|
||||
array_walk(
|
||||
$tabs,
|
||||
function ( $tab ) use ( $this_page, $active_tab ) {
|
||||
?>
|
||||
<a href="<?php echo esc_attr( $this_page ); ?>&tab=<?php echo esc_attr( $tab['slug'] ); ?>"
|
||||
class="nav-tab <?php echo esc_attr( $tab['slug'] === $active_tab ? 'nav-tab-active' : '' ); ?>">
|
||||
<?php echo esc_html( $tab['name'] ); ?></a>
|
||||
<?php
|
||||
}
|
||||
);
|
||||
?>
|
||||
</h2>
|
||||
|
||||
<?php
|
||||
$current_tab = $tabs[ array_search( $active_tab, wp_list_pluck( $tabs, 'slug' ), true ) ];
|
||||
if ( ! $current_tab['save'] || ( ! RELEVANSSI_PREMIUM && 'premium' === $current_tab['save'] ) ) {
|
||||
$display_save_button = false;
|
||||
}
|
||||
if ( $current_tab['require'] ) {
|
||||
require_once $current_tab['require'];
|
||||
}
|
||||
call_user_func( $current_tab['callback'] );
|
||||
|
||||
if ( $display_save_button ) :
|
||||
?>
|
||||
|
||||
<input type='submit' name='submit' value='<?php esc_attr_e( 'Save the options', 'relevanssi' ); ?>' class='button button-primary' />
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds admin scripts to Relevanssi pages.
|
||||
*
|
||||
* Hooks to the 'admin_enqueue_scripts' action hook.
|
||||
*
|
||||
* @global array $relevanssi_variables The global Relevanssi variables array.
|
||||
*
|
||||
* @param string $hook The hook suffix for the current admin page.
|
||||
*/
|
||||
function relevanssi_add_admin_scripts( $hook ) {
|
||||
global $relevanssi_variables;
|
||||
|
||||
$plugin_dir_url = plugin_dir_url( $relevanssi_variables['file'] );
|
||||
|
||||
// Only enqueue on Relevanssi pages.
|
||||
$acceptable_hooks = array(
|
||||
'toplevel_page_relevanssi-premium/relevanssi',
|
||||
'settings_page_relevanssi-premium/relevanssi',
|
||||
'dashboard_page_relevanssi-premium/relevanssi',
|
||||
'toplevel_page_relevanssi/relevanssi',
|
||||
'settings_page_relevanssi/relevanssi',
|
||||
'dashboard_page_relevanssi/relevanssi',
|
||||
'dashboard_page_relevanssi_admin_search',
|
||||
);
|
||||
/**
|
||||
* Filters the hooks where Relevanssi scripts are enqueued.
|
||||
*
|
||||
* By default Relevanssi only enqueues the Relevanssi admin javascript on
|
||||
* specific admin page hooks to avoid polluting the admin. If you want to
|
||||
* move things around, this means the javascript bits won't work. You can
|
||||
* introduce new hooks with this filter hook.
|
||||
*
|
||||
* @param array An array of page hook strings where Relevanssi scripts are
|
||||
* added.
|
||||
*/
|
||||
if ( ! in_array( $hook, apply_filters( 'relevanssi_acceptable_hooks', $acceptable_hooks ), true ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
wp_enqueue_style( 'wp-color-picker' );
|
||||
wp_enqueue_script( 'relevanssi_admin_js', $plugin_dir_url . 'lib/admin_scripts.js', array( 'wp-color-picker' ), $relevanssi_variables['plugin_version'], true );
|
||||
if ( ! RELEVANSSI_PREMIUM ) {
|
||||
wp_enqueue_script( 'relevanssi_admin_js_free', $plugin_dir_url . 'lib/admin_scripts_free.js', array( 'relevanssi_admin_js' ), $relevanssi_variables['plugin_version'], true );
|
||||
}
|
||||
if ( RELEVANSSI_PREMIUM ) {
|
||||
wp_enqueue_script( 'relevanssi_admin_js_premium', $plugin_dir_url . 'premium/admin_scripts_premium.js', array( 'relevanssi_admin_js' ), $relevanssi_variables['plugin_version'], true );
|
||||
}
|
||||
wp_enqueue_style( 'relevanssi_admin_css', $plugin_dir_url . 'lib/admin_styles.css', array(), $relevanssi_variables['plugin_version'] );
|
||||
|
||||
if ( 'dashboard_page_relevanssi' === substr( $hook, 0, strlen( 'dashboard_page_relevanssi' ) ) ) {
|
||||
wp_enqueue_script( 'chartjs', 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.3.2/chart.min.js', array(), '3.3.2', false );
|
||||
}
|
||||
|
||||
$localizations = array(
|
||||
'confirm' => __( 'Click OK to copy Relevanssi options to all subsites', 'relevanssi' ),
|
||||
'confirm_stopwords' => __( 'Are you sure you want to remove all stopwords?', 'relevanssi' ),
|
||||
'confirm_delete_query' => __( 'Are you sure you want to delete the query?', 'relevanssi' ),
|
||||
'truncating_index' => __( 'Wiping out the index...', 'relevanssi' ),
|
||||
'done' => __( 'Done.', 'relevanssi' ),
|
||||
'indexing_users' => __( 'Indexing users...', 'relevanssi' ),
|
||||
'indexing_taxonomies' => __( 'Indexing the following taxonomies:', 'relevanssi' ),
|
||||
'indexing_attachments' => __( 'Indexing attachments...', 'relevanssi' ),
|
||||
'counting_posts' => __( 'Counting posts...', 'relevanssi' ),
|
||||
'counting_terms' => __( 'Counting taxonomy terms...', 'relevanssi' ),
|
||||
'counting_users' => __( 'Counting users...', 'relevanssi' ),
|
||||
'counting_attachments' => __( 'Counting attachments...', 'relevanssi' ),
|
||||
'posts_found' => __( 'posts found.', 'relevanssi' ),
|
||||
'terms_found' => __( 'taxonomy terms found.', 'relevanssi' ),
|
||||
'users_found' => __( 'users found.', 'relevanssi' ),
|
||||
'attachments_found' => __( 'attachments found.', 'relevanssi' ),
|
||||
'taxonomy_disabled' => __( 'Taxonomy term indexing is disabled.', 'relevanssi' ),
|
||||
'user_disabled' => __( 'User indexing is disabled.', 'relevanssi' ),
|
||||
'indexing_complete' => __( 'Indexing complete.', 'relevanssi' ),
|
||||
'excluded_posts' => __( 'posts excluded.', 'relevanssi' ),
|
||||
'options_changed' => __( 'Settings have changed, please save the options before indexing.', 'relevanssi' ),
|
||||
'reload_state' => __( 'Reload the page to refresh the state of the index.', 'relevanssi' ),
|
||||
'pdf_reset_confirm' => __( 'Are you sure you want to delete all attachment content from the index?', 'relevanssi' ),
|
||||
'pdf_reset_done' => __( 'Relevanssi attachment data wiped clean.', 'relevanssi' ),
|
||||
'pdf_reset_problems' => __( 'There were problems wiping the Relevanssi attachment data clean.', 'relevanssi' ),
|
||||
'error_reset_done' => __( 'Relevanssi attachment server errors wiped.', 'relevanssi' ),
|
||||
'error_reset_problems' => __( 'There were problems wiping the Relevanssi attachment server errors.', 'relevanssi' ),
|
||||
'hour' => __( 'hour', 'relevanssi' ),
|
||||
'hours' => __( 'hours', 'relevanssi' ),
|
||||
'about' => __( 'about', 'relevanssi' ),
|
||||
'sixty_min' => __( 'about an hour', 'relevanssi' ),
|
||||
'ninety_min' => __( 'about an hour and a half', 'relevanssi' ),
|
||||
'minute' => __( 'minute', 'relevanssi' ),
|
||||
'minutes' => __( 'minutes', 'relevanssi' ),
|
||||
'underminute' => __( 'less than a minute', 'relevanssi' ),
|
||||
'notimeremaining' => __( "we're done!", 'relevanssi' ),
|
||||
);
|
||||
|
||||
wp_localize_script( 'relevanssi_admin_js', 'relevanssi', $localizations );
|
||||
|
||||
$nonce = array(
|
||||
'indexing_nonce' => wp_create_nonce( 'relevanssi_indexing_nonce' ),
|
||||
'searching_nonce' => wp_create_nonce( 'relevanssi_admin_search_nonce' ),
|
||||
);
|
||||
|
||||
if ( ! RELEVANSSI_PREMIUM ) {
|
||||
wp_localize_script( 'relevanssi_admin_js', 'nonce', $nonce );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the indexing limit, ie. how many posts are indexed at once.
|
||||
*
|
||||
* Relevanssi starts by indexing this many posts at once. If the process
|
||||
* goes fast enough, Relevanssi will then increase the limit and if the
|
||||
* process is slow, the limit will be decreased. If necessary, you can
|
||||
* use the relevanssi_indexing_adjust filter hook to disable that
|
||||
* adjustment.
|
||||
*
|
||||
* @param int The indexing limit, default 10.
|
||||
*/
|
||||
$indexing_limit = apply_filters( 'relevanssi_indexing_limit', 10 );
|
||||
|
||||
/**
|
||||
* Sets the indexing adjustment.
|
||||
*
|
||||
* Relevanssi will adjust the number of posts indexed at once to speed
|
||||
* up the process if it goes fast and to slow down, if the posts are
|
||||
* slow to index. You can use this filter to stop that behaviour, making
|
||||
* Relevanssi index posts at constant pace. That's generally slower, but
|
||||
* more reliable.
|
||||
*
|
||||
* @param boolean Should the limit be adjusted, default true.
|
||||
*/
|
||||
$indexing_adjust = apply_filters( 'relevanssi_indexing_adjust', true );
|
||||
|
||||
wp_localize_script(
|
||||
'relevanssi_admin_js',
|
||||
'relevanssi_params',
|
||||
array(
|
||||
'indexing_limit' => $indexing_limit,
|
||||
'indexing_adjust' => $indexing_adjust,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints out the form fields for tag and category weights.
|
||||
*/
|
||||
function relevanssi_form_tag_weight() {
|
||||
$taxonomy_weights = get_option( 'relevanssi_post_type_weights' );
|
||||
|
||||
$tag_value = 1;
|
||||
if ( isset( $taxonomy_weights['post_tag'] ) ) {
|
||||
$tag_value = $taxonomy_weights['post_tag'];
|
||||
}
|
||||
$category_value = 1;
|
||||
if ( isset( $taxonomy_weights['category'] ) ) {
|
||||
$category_value = $taxonomy_weights['category'];
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<?php esc_html_e( 'Tag weight', 'relevanssi' ); ?>
|
||||
</td>
|
||||
<td class="col-2">
|
||||
<input type='text' id='relevanssi_weight_post_tag' name='relevanssi_weight_post_tag' size='4' value='<?php echo esc_attr( $tag_value ); ?>' />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?php esc_html_e( 'Category weight', 'relevanssi' ); ?>
|
||||
</td>
|
||||
<td class="col-2">
|
||||
<input type='text' id='relevanssi_weight_category' name='relevanssi_weight_category' size='4' value='<?php echo esc_attr( $category_value ); ?>' />
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a line chart.
|
||||
*
|
||||
* @param array $labels An array of labels for the line chart. These will be
|
||||
* wrapped in apostrophes.
|
||||
* @param array $datasets An array of (label, dataset) pairs.
|
||||
*/
|
||||
function relevanssi_create_line_chart( array $labels, array $datasets ) {
|
||||
$labels = implode( ', ', array_map( 'relevanssi_add_apostrophes', $labels ) );
|
||||
$datasets_array = array();
|
||||
$bg_colors = array(
|
||||
"'rgba(255, 99, 132, 0.2)'",
|
||||
"'rgba(0, 175, 255, 0.2)'",
|
||||
);
|
||||
$border_colors = array(
|
||||
"'rgba(255, 99, 132, 1)'",
|
||||
"'rgba(0, 175, 255, 1)'",
|
||||
);
|
||||
foreach ( $datasets as $label => $values ) {
|
||||
$values = implode( ', ', $values );
|
||||
$bg_color = array_shift( $bg_colors );
|
||||
$border_color = array_shift( $border_colors );
|
||||
$datasets_array[] = <<< EOJSON
|
||||
{
|
||||
label: "$label",
|
||||
data: [ $values ],
|
||||
backgroundColor: [ $bg_color ],
|
||||
borderColor: [ $border_color ],
|
||||
borderWidth: 2,
|
||||
fill: {
|
||||
target: 'origin',
|
||||
below: $border_color,
|
||||
},
|
||||
pointRadius: 1,
|
||||
cubicInterpolationMode: 'monotone'
|
||||
}
|
||||
EOJSON;
|
||||
}
|
||||
?>
|
||||
<canvas id="search_chart" height="100"></canvas>
|
||||
<script>
|
||||
var ctx = document.getElementById('search_chart').getContext('2d');
|
||||
var myChart = new Chart(ctx, {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: [<?php echo $labels; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>],
|
||||
datasets: [<?php echo implode( ",\n", $datasets_array ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>],
|
||||
},
|
||||
options: {
|
||||
scales: {
|
||||
y: {
|
||||
beginAtZero: true
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user