This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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; | |
| } |
NewerOlder