1
1
<?php
2
2
/**
3
- * WP Farcaster plugin frames handling.
3
+ * Farcaster WP plugin frames handling.
4
4
*
5
- * @package WP_Farcaster
5
+ * @package Farcaster_WP
6
6
*/
7
7
8
- namespace WP_Farcaster ;
8
+ namespace Farcaster_WP ;
9
9
10
10
/**
11
11
* Class to handle Farcaster frames integration.
@@ -25,8 +25,8 @@ public static function init() {
25
25
* Add image sizes.
26
26
*/
27
27
public static function action_add_image_size () {
28
- add_image_size ( 'wp- farcaster-splash-image ' , 200 , 200 , array ( 'center ' , 'center ' ) );
29
- add_image_size ( 'wp- farcaster-frame-image ' , 2400 , 1600 , array ( 'center ' , 'center ' ) );
28
+ add_image_size ( 'farcaster-wp -splash-image ' , 200 , 200 , array ( 'center ' , 'center ' ) );
29
+ add_image_size ( 'farcaster-wp -frame-image ' , 2400 , 1600 , array ( 'center ' , 'center ' ) );
30
30
}
31
31
32
32
/**
@@ -39,7 +39,7 @@ public static function get_splash_image_url( $options ) {
39
39
$ splash_image = $ options ['splash_image ' ] ?? '' ;
40
40
41
41
if ( ! empty ( $ splash_image ) && ! empty ( $ splash_image ['id ' ] ) ) {
42
- $ splash_image_src = wp_get_attachment_image_src ( $ splash_image ['id ' ], 'wp- farcaster-splash-image ' );
42
+ $ splash_image_src = wp_get_attachment_image_src ( $ splash_image ['id ' ], 'farcaster-wp -splash-image ' );
43
43
if ( ! empty ( $ splash_image_src ) ) {
44
44
return $ splash_image_src [0 ];
45
45
}
@@ -64,7 +64,7 @@ public static function get_splash_background_color( $options ) {
64
64
* @return array|null Frame data array or null if frames are disabled.
65
65
*/
66
66
public static function get_frame_data () {
67
- $ options = get_option ( 'wp_farcaster ' , array () );
67
+ $ options = get_option ( 'farcaster_wp ' , array () );
68
68
69
69
if ( empty ( $ options ['frames_enabled ' ] ) ) {
70
70
return null ;
@@ -74,19 +74,19 @@ public static function get_frame_data() {
74
74
75
75
$ use_title_as_button_text = $ options ['use_title_as_button_text ' ] ?? false ;
76
76
if ( empty ( $ use_title_as_button_text ) ) {
77
- $ button_text = $ options ['button_text ' ] ?? __ ( 'Read More ' , 'wp- farcaster ' );
77
+ $ button_text = $ options ['button_text ' ] ?? __ ( 'Read More ' , 'farcaster-wp ' );
78
78
} else {
79
79
$ button_text = mb_strimwidth ( wp_get_document_title (), 0 , 32 , '... ' );
80
80
}
81
81
82
82
$ splash_image_url = self ::get_splash_image_url ( $ options );
83
83
$ splash_background_color = self ::get_splash_background_color ( $ options );
84
84
85
- $ frame_image = get_the_post_thumbnail_url ( null , 'wp- farcaster-frame-image ' );
85
+ $ frame_image = get_the_post_thumbnail_url ( null , 'farcaster-wp -frame-image ' );
86
86
if ( empty ( $ frame_image ) ) {
87
87
$ fallback_image = $ options ['fallback_image ' ] ?? '' ;
88
88
if ( ! empty ( $ fallback_image ) && ! empty ( $ fallback_image ['id ' ] ) ) {
89
- $ frame_image_src = wp_get_attachment_image_src ( $ fallback_image ['id ' ], 'wp- farcaster-frame-image ' );
89
+ $ frame_image_src = wp_get_attachment_image_src ( $ fallback_image ['id ' ], 'farcaster-wp -frame-image ' );
90
90
if ( ! empty ( $ frame_image_src ) ) {
91
91
$ frame_image = $ frame_image_src [0 ];
92
92
}
@@ -129,15 +129,15 @@ public static function action_wp_head() {
129
129
* Enqueue scripts.
130
130
*/
131
131
public static function action_enqueue_scripts () {
132
- $ options = get_option ( 'wp_farcaster ' , array () );
132
+ $ options = get_option ( 'farcaster_wp ' , array () );
133
133
134
134
// Only enqueue if frames are enabled in settings.
135
135
if ( ! empty ( $ options ['frames_enabled ' ] ) ) {
136
136
wp_enqueue_script (
137
137
'farcaster-frame-sdk ' ,
138
138
plugins_url ( 'build/sdk.js ' , plugin_dir_path ( __FILE__ ) ),
139
139
array (),
140
- WP_FARCASTER_VERSION ,
140
+ FARCASTER_WP_VERSION ,
141
141
array (
142
142
'in_footer ' => true ,
143
143
'strategy ' => 'defer ' ,
0 commit comments