This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'mfrh_replace_rules', 'mfrh_replace_rules', 10, 1 ); | |
function replace_s_by_z( $rules ) { | |
$rules['s'] = 'z'; | |
return $rules; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( "wplr_add_media", 'myapp_update_media_meta', 10, 2 ); | |
add_action( "wplr_update_media", 'myapp_update_media_meta', 10, 2 ); | |
function myapp_update_media_meta( $mediaId, $galleryID ) { | |
global $wplr; | |
$image = wp_get_attachment_url( $mediaId ); | |
$size = getimagesize($image, $info); | |
if ( isset( $info['APP13'] ) ) { | |
$iptc = iptcparse( $info['APP13'] ); | |
if ( isset( $iptc["2#090"][0] ) ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { useState, useEffect, useRef } = require('react'); | |
function useImage({ src }) { | |
let [ image, setImage ] = useState({ src: null, status: 'loading' }); | |
let imageElement = useRef(); | |
let loadedUrls = useRef(new Set()); | |
useEffect(() => { | |
const onload = () => { | |
setImage(img => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'mwai_chatbot_reply', function ( $reply, $query, $params ) { | |
try { | |
global $mwai_core; | |
$newMessage = !empty( $params['newMessage'] ) ? $params['newMessage'] : ""; | |
// We need to identify the user or session | |
$id = $mwai_core->get_user_id(); | |
if ( empty( $id ) ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( "mwai_context_search", 'my_web_search', 10, 3 ); | |
function my_web_search( $context, $query, $options = [] ) { | |
// If the context is already provided, return it as is. | |
if ( ! empty( $context ) ) { | |
return $context; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Various links | |
// https://serverfault.com/questions/488767/how-do-i-enable-php-s-flush-with-nginxphp-fpm | |
// https://stackoverflow.com/questions/72394213/nginx-configuration-for-server-sent-event | |
// https://serverfault.com/questions/801628/for-server-sent-events-sse-what-nginx-proxy-configuration-is-appropriate | |
// https://qiita.com/okumurakengo/items/cbe6b3717b95944083a1 (in Japanese) | |
// If '?SSE' is set, send Server-Sent events, otherwise we'll display the page. | |
if ( isset( $_GET['SSE'] ) ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// The purpose of the mwai_stats_credits filter is to alter the number of credits (which can represent a certain number of queries or amount of dollars) allowed in total for a specific user. | |
// In this implementation below, we'll attribute the number of credits based on the role the user has. | |
add_filter( 'mwai_stats_credits', function ( $credits, $userId ) { | |
// Retrieve user data | |
$user = get_userdata( $userId ); | |
// Assign the initial credits provided as argument |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"additionalModelInfo": {"type": "string", "description": "Information about the ethnicity and other facets of models in a model-released image."}, | |
"aperture": {"type": "string", "description": "The aperture (for example, 'f/2.8')."}, | |
"artist": {"type": "string", "description": "The artist's name."}, | |
"artworksShown": {"type": "table", "description": "A set of metadata about artwork or an object in the image. Each element in the table is a structure named ArtworkOrObjectDetails, as defined in the IPTC Extension spec."}, | |
"brightnessValue": {"type": "string", "description": "The brightness value."}, | |
"cameraMake": {"type": "string", "description": "The camera manufacturer."}, | |
"cameraModel": {"type": "string", "description": "The camera model."}, | |
"cameraSerialNumber": {"type": "string", "description": "The camera serial number."}, | |
"caption": {"type": "string", "description": "The caption for photo."}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Adding action hooks for Media Cleaner plugin | |
add_action( 'wpmc_scan_once', 'wpmc_scan_once_PLUGIN_NAME', 10, 0 ); | |
add_action( 'wpmc_scan_post', 'wpmc_scan_html_PLUGIN_NAME', 10, 2 ); | |
add_action( 'wpmc_scan_postmeta', 'wpmc_scan_postmeta_PLUGIN_NAME', 10, 2 ); | |
/** | |
* Runs once at the beginning of the scan. | |
* Can be used to check images usage in general settings, in a theme, like a favicon, etc. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
#region Functions Definitions + Callable Functions | |
function define_userInfo() { | |
return Meow_MWAI_Query_Function::fromJson( [ | |
'id' => 'userInfo', // Anything you like! | |
'type' => 'manual', // You can set it to your add-on name (if null, it will be 'manual') | |
'name' => 'getCurrentUserInfo', // Important: What's the name of the function? | |
'desc' => 'Get the current user information.' // Important: What the function does? |