Changeset 3064537
- Timestamp:
- 04/04/2024 10:08:54 AM (4 months ago)
- Location:
- cibeles-ai
- Files:
-
- 105 added
- 6 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
cibeles-ai/trunk/cibeles-ai.php
r3058311 r3064537 10 10 * Author: Cibeles.net 11 11 * Author URI: https://www.cibeles.net/ 12 * Version: 1.9. 112 * Version: 1.9. 13 13 * License: GPLv2 14 14 * Released under the GNU General Public License (GPL) … … 18 18 19 19 if (!defined('ABSPATH')) exit; 20 if(!defined(' DS')) define('DS',DIRECTORY_SEPARATOR);20 if(!defined('DS',DIRECTORY_SEPARATOR); 21 21 22 22 23 23 $cibelesAiPlugin = [ 24 24 'namespace' => 'cibeles-ai', 25 'version' => '1.9. 1',26 'path' => dirname(__FILE__). DS,25 'version' => '1.9.', 26 'path' => dirname(__FILE__).DS, 27 27 'url' => plugin_dir_url( __FILE__ ), 28 28 'filename' => __FILE__, … … 40 40 }else{ 41 41 //Mejora la carga de la página en la vista de post haciendo una precarga de la imagen webp 42 add_action('wp_head', ' preload_post_thumbnail_in_webp_format_if_exists');42 add_action('wp_head', 'preload_post_thumbnail_in_webp_format_if_exists'); 43 43 44 function preload_post_thumbnail_in_webp_format_if_exists(){ 45 if (has_post_thumbnail() && is_single()) { 46 $attachment_id = get_post_thumbnail_id(); 47 $attachment_path = get_attached_file($attachment_id); 48 $attachment_path_webp = $attachment_path . '.webp'; 49 if (file_exists($attachment_path_webp)) { 50 $upload_dir = wp_upload_dir(); 51 $attachment_url_webp = str_replace($upload_dir['basedir'], $upload_dir['baseurl'], $attachment_path_webp); 52 echo '<link rel="preload" as="image" href="' . esc_url($attachment_url_webp) . '">'; 53 } 54 } 44 if (!function_exists('caip_preload_post_thumbnail_in_webp_format_if_exists')) { 45 function caip_preload_post_thumbnail_in_webp_format_if_exists(){ 46 if (has_post_thumbnail() && is_single()) { 47 $attachment_id = get_post_thumbnail_id(); 48 $attachment_path = get_attached_file($attachment_id); 49 $attachment_path_webp = $attachment_path . '.webp'; 50 if (file_exists($attachment_path_webp)) { 51 $upload_dir = wp_upload_dir(); 52 $attachment_url_webp = str_replace($upload_dir['basedir'], $upload_dir['baseurl'], $attachment_path_webp); 53 echo '<link rel="preload" as="image" href="' . esc_url($attachment_url_webp) . '">'; 54 } 55 } 56 } 55 57 } 58 56 59 57 60 } -
cibeles-ai/trunk/init.php
r3058311 r3064537 79 79 if ( ( 'post.php' == $pagenow || 'post-new.php' == $pagenow ) || ( 'options-general.php' == $pagenow ) ) { 80 80 wp_enqueue_style('fontawesome_css', plugin_dir_url( __FILE__ ) . 'libs/fontawesome/css/main.css', '', '', 'all'); 81 wp_enqueue_style('post_css', plugin_dir_url( __FILE__ ) . 'css/main.css', '', '1.9. 1', 'all');81 wp_enqueue_style('post_css', plugin_dir_url( __FILE__ ) . 'css/main.css', '', '1.9.', 'all'); 82 82 } 83 83 } … … 93 93 94 94 if ( ( 'post.php' == $pagenow || 'post-new.php' == $pagenow ) && 'post' == $post->post_type ) { 95 wp_enqueue_script( 'language_js', plugin_dir_url( __FILE__ ) . 'js/init_language.js', array( 'jquery' ), '1.9. 1', true );95 wp_enqueue_script( 'language_js', plugin_dir_url( __FILE__ ) . 'js/init_language.js', array( 'jquery' ), '1.9.', true ); 96 96 wp_set_script_translations( 'language_js', 'cibeles-ai', plugin_basename( __DIR__ ) . '/languages/'); 97 97 98 98 if (caip_is_classic_editor()) { 99 wp_enqueue_script( 'post_js', plugin_dir_url( __FILE__ ) . 'js/init_ai_fields.js', array( 'jquery' ), '1.9. 1', true );99 wp_enqueue_script( 'post_js', plugin_dir_url( __FILE__ ) . 'js/init_ai_fields.js', array( 'jquery' ), '1.9.', true ); 100 100 wp_set_script_translations( 'post_js', 'cibeles-ai', plugin_basename( __DIR__ ) . '/languages/'); 101 101 wp_localize_script( 'post_js', 'caip_settings', $cibelesAiPlugin['settings'] ); … … 105 105 wp_set_script_translations( 'caip_main', 'cibeles-ai', plugin_basename( __DIR__ ) . '/languages/'); 106 106 */ 107 wp_enqueue_script( 'caip_diff', plugin_dir_url( __FILE__ ) .'node_modules/diff-dom/browser/diffDOM.js',array( 'jquery' ), false, true );107 wp_enqueue_script( 'caip_diff', plugin_dir_url( __FILE__ ) .'node_modules/diff-dom/browser/diffDOM.js',array( 'jquery' ), false, true ); 108 108 wp_enqueue_script( 'caip_difftext', plugin_dir_url( __FILE__ ) .'libs/diff/diff.js', array( 'jquery' ), false, true ); 109 109 110 wp_enqueue_script( 'caip_functions', plugin_dir_url( __FILE__ ) .'js/classes/caip_Functions.js', array( 'jquery' ), '1.9. 1', true );111 wp_enqueue_script( 'caip_button', plugin_dir_url( __FILE__ ) .'js/classes/caip_Button.js', array( 'jquery' ), '1.9. 1', true );112 wp_enqueue_script( 'caip_action', plugin_dir_url( __FILE__ ) .'js/classes/caip_Action.js', array( 'jquery' ), '1.9. 1', true );113 wp_enqueue_script( 'caip_titulo', plugin_dir_url( __FILE__ ) .'js/classes/caip_Titulo.js', array( 'jquery' ), '1.9. 1', true );114 wp_enqueue_script( 'caip_tag', plugin_dir_url( __FILE__ ) .'js/classes/caip_Tag.js', array( 'jquery' ), '1.9. 1', true );115 wp_enqueue_script( 'caip_resumenp', plugin_dir_url( __FILE__ ) .'js/classes/caip_ResumenP.js', array( 'jquery' ), '1.9. 1', true );116 wp_enqueue_script( 'caip_multiaction', plugin_dir_url( __FILE__ ) .'js/classes/caip_Multiaction.js', array( 'jquery' ), '1.9. 1', true );117 118 wp_enqueue_script( 'caip_clickbait', plugin_dir_url( __FILE__ ) .'js/classes/clickbait.js', array( 'jquery' ), '1.9. 1', true );119 wp_enqueue_script( 'caip_titularcorto', plugin_dir_url( __FILE__ ) .'js/classes/titularcorto.js', array( 'jquery' ), '1.9. 1', true );120 wp_enqueue_script( 'caip_titular', plugin_dir_url( __FILE__ ) .'js/classes/titular.js', array( 'jquery' ), '1.9. 1', true );121 wp_enqueue_script( 'caip_tags', plugin_dir_url( __FILE__ ) .'js/classes/tags.js', array( 'jquery' ), '1.9. 1', true );122 wp_enqueue_script( 'caip_autotags', plugin_dir_url( __FILE__ ) .'js/classes/autotags.js', array( 'jquery' ), '1.9. 1', true );123 wp_enqueue_script( 'caip_resumen', plugin_dir_url( __FILE__ ) .'js/classes/resumen.js', array( 'jquery' ), '1.9. 1', true );124 wp_enqueue_script( 'caip_autoexcerpt', plugin_dir_url( __FILE__ ) .'js/classes/autoexcerpt.js', array( 'jquery' ), '1.9. 1', true );125 wp_enqueue_script( 'caip_refrito', plugin_dir_url( __FILE__ ) .'js/classes/refrito.js', array( 'jquery' ), '1.9. 1', true );126 wp_enqueue_script( 'caip_corrector', plugin_dir_url( __FILE__ ) .'js/classes/corrector.js', array( 'jquery' ), '1.9. 1', true );127 wp_enqueue_script( 'caip_introduccion', plugin_dir_url( __FILE__ ) .'js/classes/introduccion.js', array( 'jquery' ), '1.9. 1', true );128 wp_enqueue_script( 'caip_conclusion', plugin_dir_url( __FILE__ ) .'js/classes/conclusion.js', array( 'jquery' ), '1.9. 1', true );129 wp_enqueue_script( 'caip_youtube', plugin_dir_url( __FILE__ ) .'js/classes/youtube.js', array( 'jquery' ), '1.9. 1', true );130 wp_enqueue_script( 'caip_cifras', plugin_dir_url( __FILE__ ) .'js/classes/cifras.js', array( 'jquery' ), '1.9. 1', true );131 wp_enqueue_script( 'caip_cronologia', plugin_dir_url( __FILE__ ) .'js/classes/cronologia.js', array( 'jquery' ), '1.9. 1', true );132 wp_enqueue_script( 'caip_faq', plugin_dir_url( __FILE__ ) .'js/classes/faq.js', array( 'jquery' ), '1.9. 1', true );110 wp_enqueue_script( 'caip_functions', plugin_dir_url( __FILE__ ) .'js/classes/caip_Functions.js', array( 'jquery' ), '1.9.', true ); 111 wp_enqueue_script( 'caip_button', plugin_dir_url( __FILE__ ) .'js/classes/caip_Button.js', array( 'jquery' ), '1.9.', true ); 112 wp_enqueue_script( 'caip_action', plugin_dir_url( __FILE__ ) .'js/classes/caip_Action.js', array( 'jquery' ), '1.9.', true ); 113 wp_enqueue_script( 'caip_titulo', plugin_dir_url( __FILE__ ) .'js/classes/caip_Titulo.js', array( 'jquery' ), '1.9.', true ); 114 wp_enqueue_script( 'caip_tag', plugin_dir_url( __FILE__ ) .'js/classes/caip_Tag.js', array( 'jquery' ), '1.9.', true ); 115 wp_enqueue_script( 'caip_resumenp', plugin_dir_url( __FILE__ ) .'js/classes/caip_ResumenP.js', array( 'jquery' ), '1.9.', true ); 116 wp_enqueue_script( 'caip_multiaction', plugin_dir_url( __FILE__ ) .'js/classes/caip_Multiaction.js', array( 'jquery' ), '1.9.', true ); 117 118 wp_enqueue_script( 'caip_clickbait', plugin_dir_url( __FILE__ ) .'js/classes/clickbait.js', array( 'jquery' ), '1.9.', true ); 119 wp_enqueue_script( 'caip_titularcorto', plugin_dir_url( __FILE__ ) .'js/classes/titularcorto.js', array( 'jquery' ), '1.9.', true ); 120 wp_enqueue_script( 'caip_titular', plugin_dir_url( __FILE__ ) .'js/classes/titular.js', array( 'jquery' ), '1.9.', true ); 121 wp_enqueue_script( 'caip_tags', plugin_dir_url( __FILE__ ) .'js/classes/tags.js', array( 'jquery' ), '1.9.', true ); 122 wp_enqueue_script( 'caip_autotags', plugin_dir_url( __FILE__ ) .'js/classes/autotags.js', array( 'jquery' ), '1.9.', true ); 123 wp_enqueue_script( 'caip_resumen', plugin_dir_url( __FILE__ ) .'js/classes/resumen.js', array( 'jquery' ), '1.9.', true ); 124 wp_enqueue_script( 'caip_autoexcerpt', plugin_dir_url( __FILE__ ) .'js/classes/autoexcerpt.js', array( 'jquery' ), '1.9.', true ); 125 wp_enqueue_script( 'caip_refrito', plugin_dir_url( __FILE__ ) .'js/classes/refrito.js', array( 'jquery' ), '1.9.', true ); 126 wp_enqueue_script( 'caip_corrector', plugin_dir_url( __FILE__ ) .'js/classes/corrector.js', array( 'jquery' ), '1.9.', true ); 127 wp_enqueue_script( 'caip_introduccion', plugin_dir_url( __FILE__ ) .'js/classes/introduccion.js', array( 'jquery' ), '1.9.', true ); 128 wp_enqueue_script( 'caip_conclusion', plugin_dir_url( __FILE__ ) .'js/classes/conclusion.js', array( 'jquery' ), '1.9.', true ); 129 wp_enqueue_script( 'caip_youtube', plugin_dir_url( __FILE__ ) .'js/classes/youtube.js', array( 'jquery' ), '1.9.', true ); 130 wp_enqueue_script( 'caip_cifras', plugin_dir_url( __FILE__ ) .'js/classes/cifras.js', array( 'jquery' ), '1.9.', true ); 131 wp_enqueue_script( 'caip_cronologia', plugin_dir_url( __FILE__ ) .'js/classes/cronologia.js', array( 'jquery' ), '1.9.', true ); 132 wp_enqueue_script( 'caip_faq', plugin_dir_url( __FILE__ ) .'js/classes/faq.js', array( 'jquery' ), '1.9.', true ); 133 133 134 134 … … 166 166 167 167 }else{ 168 wp_enqueue_script( 'gutenberg_js', plugin_dir_url( __FILE__ ) . 'js/gutenberg.js', array( 'jquery' ), '1.9. 1', true );168 wp_enqueue_script( 'gutenberg_js', plugin_dir_url( __FILE__ ) . 'js/gutenberg.js', array( 'jquery' ), '1.9.', true ); 169 169 wp_set_script_translations( 'gutenberg_js', 'cibeles-ai', plugin_dir_path(__FILE__). '/languages/'); 170 170 } … … 185 185 186 186 if(caip_is_classic_editor()){ 187 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'buttons.php';188 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'thickbox' .DS . 'titular.php';189 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'thickbox' .DS . 'titularcorto.php';190 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'thickbox' .DS . 'clickbait.php';191 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'thickbox' .DS . 'tags.php';192 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'thickbox' .DS . 'autotags.php';193 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'thickbox' .DS . 'resumen.php';194 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'thickbox' .DS . 'autoexcerpt.php';195 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'thickbox' .DS . 'refrito.php';196 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'thickbox' .DS . 'corrector.php';197 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'thickbox' .DS . 'introduccion.php';198 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'thickbox' .DS . 'conclusion.php';199 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'thickbox' .DS . 'youtube.php';200 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'thickbox' .DS . 'cifras.php';201 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'thickbox' .DS . 'cronologia.php';202 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'thickbox' .DS . 'faq.php';187 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'buttons.php'; 188 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'titular.php'; 189 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'titularcorto.php'; 190 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'clickbait.php'; 191 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'tags.php'; 192 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'autotags.php'; 193 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'resumen.php'; 194 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'autoexcerpt.php'; 195 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'refrito.php'; 196 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'corrector.php'; 197 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'introduccion.php'; 198 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'conclusion.php'; 199 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'youtube.php'; 200 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'cifras.php'; 201 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'cronologia.php'; 202 require_once $cibelesAiPlugin['path'] . 'views' . DS . 'faq.php'; 203 203 } 204 204 } … … 249 249 function caip_tag_exists_check() { 250 250 251 $tags_que_ya_existen = []; 252 253 if ( isset( $_POST['tags'] ) && wp_verify_nonce( $_POST['check_nonce'], 'site_ajax_nonce' ) ) { 254 $tags = $_POST['tags']; 255 if(is_array($tags)){ 256 foreach($tags as $tag){ 257 $tag = trim($tag); 258 if (term_exists($tag, 'post_tag')) { 259 $tags_que_ya_existen[] = $tag; 251 $tags_que_ya_existen = array(); 252 253 if ( isset( $_POST['tags'] ) && isset( $_POST['check_nonce'] ) ) { 254 // Sanitize nonce first 255 $check_nonce = sanitize_text_field( wp_unslash( $_POST['check_nonce'] ) ); 256 257 // Verify the sanitized nonce 258 if ( wp_verify_nonce( $check_nonce, 'site_ajax_nonce' ) ) { 259 // Asegurarse de que 'tags' es un array 260 if(is_array($_POST['tags'])){ 261 $tags_sanitized = array_map(function($tag) { 262 // Sanitize individually 263 return sanitize_text_field( wp_unslash( $tag ) ); 264 }, $_POST['tags']); 265 266 foreach($tags_sanitized as $tag){ 267 $tag_trimmed = trim($tag); 268 if (term_exists($tag_trimmed, 'post_tag')) { 269 $tags_que_ya_existen[] = $tag_trimmed; 260 270 } 261 271 } 262 272 } 263 273 } 274 275 276 277 264 278 wp_send_json( $tags_que_ya_existen ); 265 279 } -
cibeles-ai/trunk/options.php
r3045536 r3064537 1 1 <?php 2 3 2 4 add_action( 'admin_menu', 'caip_add_admin_menu' ); 3 5 add_action( 'admin_init', 'caip_settings_init' ); … … 68 70 ?> 69 71 <label> 70 <input type="radio" name="caip_settings[caip_radio_idioma]" value="1" <?php if($options['caip_radio_idioma']=='1'){ e sc_html_e('checked'); }?>>71 <?php esc_html_e( __( 'Idioma del usuario en WP', 'cibeles-ai' )); ?>72 <input type="radio" name="caip_settings[caip_radio_idioma]" value="1" <?php if($options['caip_radio_idioma']=='1'){ e; }?>> 73 <?php esc_html_e(); ?> 72 74 <?php echo wp_kses_post(' ('.__( 'idioma detectado', 'cibeles-ai' ).': <strong>'.$WP_lang.'</strong>)'); ?> 73 75 </label> … … 75 77 <br> 76 78 <label> 77 <input type="radio" name="caip_settings[caip_radio_idioma]" value="2" <?php if($options['caip_radio_idioma']=='2'){ e sc_html_e('checked'); }?>>78 <?php esc_html_e( __( 'WPML automático', 'cibeles-ai' )); ?>79 <input type="radio" name="caip_settings[caip_radio_idioma]" value="2" <?php if($options['caip_radio_idioma']=='2'){ e; }?>> 80 <?php esc_html_e(); ?> 79 81 <?php echo wp_kses_post(' ('.__( 'idioma detectado', 'cibeles-ai' ).': <strong>'.$WPML_lang.'</strong>)'); ?> 80 82 </label> … … 83 85 <br> 84 86 <label> 85 <input type="radio" name="idioma" value="2" <?php if($options['caip_radio_idioma']=='3'){ e sc_html_e('checked'); }?>>86 <?php esc_html_e( __( 'Idioma fijo', 'cibeles-ai' )); ?>87 <input type="radio" name="idioma" value="2" <?php if($options['caip_radio_idioma']=='3'){ e; }?>> 88 <?php esc_html_e(); ?> 87 89 </label> 88 90 <br> … … 98 100 } 99 101 ?> 100 <input type='number' name='caip_settings[caip_numero_titulares]' min="1" max="15" value='<?php e sc_html_e($options['caip_numero_titulares']); ?>' style="max-width:80px;">102 <input type='number' name='caip_settings[caip_numero_titulares]' min="1" max="15" value='<?php e; ?>' style="max-width:80px;"> 101 103 <?php 102 104 } … … 109 111 } 110 112 ?> 111 <input type='number' name='caip_settings[caip_numero_tags]' min="1" max="20" value='<?php e sc_html_e($options['caip_numero_tags']); ?>' style="max-width:80px;">113 <input type='number' name='caip_settings[caip_numero_tags]' min="1" max="20" value='<?php e; ?>' style="max-width:80px;"> 112 114 <?php 113 115 } -
cibeles-ai/trunk/options_buttons_default.php
r3036333 r3064537 1 1 <?php 2 3 4 2 5 if(!isset($options['caip_enable_buttons']['titular']) || $options['caip_enable_buttons']['titular'] == '' ){ 3 6 $options['caip_enable_buttons']['titular'] = 'on'; -
cibeles-ai/trunk/readme.txt
r3058311 r3064537 3 3 Tags: artificial intelligence, journalists, autotags, autoexcerpt, rewriting 4 4 Requires at least: 4.9 5 Tested up to: 6. 4.35 Tested up to: 6. 6 6 Requires PHP: 7.2 7 Stable tag: 1.9. 17 Stable tag: 1.9. 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset
for help on using the changeset viewer.