66
77use Elementor \Plugin ;
88
9- <<<<<<< HEAD
10- <<<<<<< HEAD
11- if ( function_exists ( 'wcf_set_postview ' ) ) {
12- add_action ( 'wp_head ' , 'wcf_set_postview ' );
13- }
14-
15- function aaeaddonlight_hk_allow_svg_uploads( $ mimes ) {
16- // Allow SVG files
17- $ mimes ['svg ' ] = 'image/svg+xml ' ;
18- $ mimes ['svgz ' ] = 'image/svg+xml ' ; // Compressed SVG
19- return $ mimes ;
20- =======
21- =======
22- >>>>>>> f9817d0874edf7712899710f99a4485851af5a59
239if (function_exists ('wcf_set_postview ' )) {
2410 add_action ('wp_head ' , 'wcf_set_postview ' );
2511}
@@ -30,63 +16,10 @@ function aaeaddonlight_hk_allow_svg_uploads($mimes)
3016 $ mimes ['svg ' ] = 'image/svg+xml ' ;
3117 $ mimes ['svgz ' ] = 'image/svg+xml ' ; // Compressed SVG
3218 return $ mimes ;
33- <<<<<<< HEAD
34- >>>>>>> cbe273f5e8d98e77474f37520e56e4629e40dc13
35- }
36-
37- add_filter ( 'upload_mimes ' , 'aaeaddonlight_hk_allow_svg_uploads ' );
38-
39- <<<<<<< HEAD
40- function aae_handle_aae_post_shares_count () {
41- if ( ! isset ( $ _POST ['nonce ' ] ) ) {
42- exit ( 'No naughty business please . Provide Security Code ' );
43- }
44- $ nonce = sanitize_text_field ( wp_unslash ( $ _POST ['nonce ' ] ) );
45- if ( ! wp_verify_nonce ( $ nonce , 'wcf-addons-frontend ' ) ) {
46- exit ( 'No naughty business please ' );
47- }
48-
49- if ( isset ( $ _POST ['post_id ' ] ) && isset ( $ _POST ['social ' ] ) ) {
50- $ post_id = intval ( sanitize_text_field ( wp_unslash ( $ _POST ['post_id ' ] ) ) );
51- $ social = sanitize_text_field ( wp_unslash ( $ _POST ['social ' ] ) );
52-
53- // Retrieve current share count, increment it, or set it if it doesn't exist
54- $ current_shares = get_post_meta ( $ post_id , 'aae_post_shares ' , true );
55- if ( ! is_array ( $ current_shares ) ) {
56- $ current_shares = array ();
57- }
58- if ( isset ( $ current_shares [ $ social ] ) ) {
59- ++$ current_shares [ $ social ];
60- } else {
61- $ current_shares [ $ social ] = 1 ;
62- }
63-
64- $ shares_count = array_sum ( array_values ( $ current_shares ) );
65-
66- foreach ( $ current_shares as $ k => $ single ) {
67- update_post_meta ( $ post_id , 'aae_post_shares_ ' . $ k , $ single );
68- }
69-
70- update_post_meta ( $ post_id , 'aae_post_shares_count ' , $ shares_count );
71- update_post_meta ( $ post_id , 'aae_post_shares ' , $ current_shares );
72-
73- // Return updated share count as a response
74- wp_send_json_success (
75- array (
76- 'share_count ' => $ shares_count ,
77- 'post_shares ' => $ current_shares ,
78- )
79- );
80- } else {
81- wp_send_json_error ( 'Invalid post ID ' );
82- }
83- =======
84- =======
8519}
8620
8721add_filter ('upload_mimes ' , 'aaeaddonlight_hk_allow_svg_uploads ' );
8822
89- >>>>>>> f9817d0874edf7712899710f99a4485851af5a59
9023function aae_handle_aae_post_shares_count ()
9124{
9225 if (!isset ($ _POST ['nonce ' ])) {
@@ -129,35 +62,10 @@ function aae_handle_aae_post_shares_count()
12962 } else {
13063 wp_send_json_error ('Invalid post ID ' );
13164 }
132- <<<<<<< HEAD
133- >>>>>>> cbe273f5e8d98e77474f37520e56e4629e40dc13
134- =======
135- >>>>>>> f9817d0874edf7712899710f99a4485851af5a59
13665}
13766add_action ('wp_ajax_aae_post_shares ' , 'aae_handle_aae_post_shares_count ' ); // For logged-in users
13867add_action ('wp_ajax_nopriv_aae_post_shares ' , 'aae_handle_aae_post_shares_count ' ); // For non-logged-in users
13968
140- <<<<<<< HEAD
141- <<<<<<< HEAD
142- function aaeaddon_disable_comments_for_custom_post_type () {
143- remove_post_type_support ( 'wcf-addons-template ' , 'comments ' );
144- }
145- add_action ( 'init ' , 'aaeaddon_disable_comments_for_custom_post_type ' , 100 );
146-
147- function aaeaddon_custom_hide_admin_notices_for_specific_page () {
148- $ screen = get_current_screen ();
149- // ist of admin pages where you want to disable notices
150- $ pages_to_hide_notices = array (
151- 'wcf-custom-fonts ' ,
152- 'wcf-custom-icons ' ,
153- 'animation-addon_page_wcf-cpt-builder ' ,
154- 'edit-wcf-addons-template ' ,
155- 'animation-addon_page_wcf_addons_settings ' ,
156- 'animation-addon_page_wcf_addons_setup_page ' ,
157- );
158- =======
159- =======
160- >>>>>>> f9817d0874edf7712899710f99a4485851af5a59
16169function aaeaddon_disable_comments_for_custom_post_type ()
16270{
16371 remove_post_type_support ('wcf-addons-template ' , 'comments ' );
@@ -176,20 +84,6 @@ function aaeaddon_custom_hide_admin_notices_for_specific_page()
17684 'animation-addon_page_wcf_addons_settings ' ,
17785 'animation-addon_page_wcf_addons_setup_page '
17886 );
179- <<<<<<< HEAD
180- >>>>>>> cbe273f5e8d98e77474f37520e56e4629e40dc13
181-
182- // Check if current screen ID matches any in the list
183- if ( in_array ( $ screen ->id , $ pages_to_hide_notices ) ) {
184- // Remove core and plugin notices
185- remove_all_actions ( 'admin_notices ' );
186- remove_all_actions ( 'all_admin_notices ' );
187- }
188- }
189- <<<<<<< HEAD
190- add_action ( 'admin_head ' , 'aaeaddon_custom_hide_admin_notices_for_specific_page ' );
191- =======
192- =======
19387
19488 // Check if current screen ID matches any in the list
19589 if (in_array ($ screen ->id , $ pages_to_hide_notices )) {
@@ -198,7 +92,6 @@ function aaeaddon_custom_hide_admin_notices_for_specific_page()
19892 remove_all_actions ('all_admin_notices ' );
19993 }
20094}
201- >>>>>>> f9817d0874edf7712899710f99a4485851af5a59
20295add_action ('admin_head ' , 'aaeaddon_custom_hide_admin_notices_for_specific_page ' );
20396// post reaction ajax handeler
20497
@@ -246,8 +139,4 @@ function aaeaddon_post_lite_reaction_ajax()
246139 }
247140 add_action ('wp_ajax_nopriv_aaeaddon_post_reaction ' , 'aaeaddon_post_lite_reaction_ajax ' );
248141 add_action ('wp_ajax_aaeaddon_post_reaction ' , 'aaeaddon_post_lite_reaction_ajax ' );
249- }
250- <<<<<<< HEAD
251- >>>>>>> cbe273f5e8d98e77474f37520e56e4629e40dc13
252- =======
253- >>>>>>> f9817d0874edf7712899710f99a4485851af5a59
142+ }
0 commit comments