Changeset 2549322
- Timestamp:
- 06/17/2021 12:55:07 AM (5 years ago)
- Location:
- iaf-social-share/trunk
- Files:
-
- 6 edited
-
iaf-social-share.php (modified) (2 diffs)
-
inc/activate.php (modified) (1 diff)
-
inc/add-buttons.php (modified) (1 diff)
-
inc/admin/save-options.php (modified) (2 diffs)
-
inc/admin/sidebar-box.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
iaf-social-share/trunk/iaf-social-share.php
r2308107 r2549322 15 15 // INCLUDES 16 16 include( 'inc/activate.php' ); 17 include( 'inc/deactivate.php' ); 17 18 include( 'inc/enqueue.php' ); 18 19 include( 'inc/admin/menu.php' ); … … 24 25 // HOOKS 25 26 register_activation_hook( __FILE__, 'iaf_activate_plugin' ); 27 register_deactivation_hook( __FILE__, 'iaf_deactivate_plugin' ); 26 28 add_action( 'wp_enqueue_scripts', 'iaf_enqueue' ); 27 29 add_action( 'admin_enqueue_scripts', 'iaf_admin_enqueue' ); -
iaf-social-share/trunk/inc/activate.php
r2308107 r2549322 13 13 */ 14 14 15 $iaf_opts = get_option( 'iaf_social_share_opts' );15 $iaf_opts = get_option( 'iaf_social_share_opts' ); 16 16 17 17 if( !$iaf_opts ){ 18 $opts = [19 'facebook' => 'show',20 'twitter' => 'show',21 'twitter_handle' => 'wordpressdotcom',22 'linkedin' => 'show',23 'whatsapp' => 'show',24 'telegram' => 'show',25 'before_content' => 'hide',26 'after_content' => 'show',27 'share_post' => 'show',28 'share_page' => 'hide',29 'share_archive' => 'hide',30 'display' => 'icon_and_text',31 'mobile' => 'hide_text',32 'theme' => 'default',33 'color' => '#000000'18 $opts = [ 19 'facebook' => 'show', 20 'twitter' => 'show', 21 'twitter_handle' => 'wordpressdotcom', 22 'linkedin' => 'show', 23 'whatsapp' => 'show', 24 'telegram' => 'show', 25 'before_content' => 'hide', 26 'after_content' => 'show', 27 'share_post' => 'show', 28 'share_page' => 'hide', 29 'share_archive' => 'hide', 30 'display' => 'icon_and_text', 31 'mobile' => 'hide_text', 32 'theme' => 'default', 33 'color' => '#000000' 34 34 ]; 35 36 $iaf_cpts = get_post_types( array( '_builtin' => false ), 'objects' ); 37 foreach( $iaf_cpts as $cpt ) { 38 $opts['share_'.$cpt->name] = 'show'; 39 } 35 40 36 41 add_option( 'iaf_social_share_opts', $opts ); -
iaf-social-share/trunk/inc/add-buttons.php
r2308107 r2549322 7 7 $share_pages = $iaf_opts['share_page'] == 'show' ? 'page' : ''; 8 8 9 if( !is_singular( [ $share_posts, $share_pages ] ) ){ 9 $share_post_types = [ $share_posts, $share_pages ]; 10 11 $iaf_cpts = get_post_types( array( '_builtin' => false ), 'objects' ); 12 foreach( $iaf_cpts as $cpt ) { 13 if( $iaf_opts['share_' . $cpt->name] == 'show' ) { 14 array_push( $share_post_types, $cpt->name ); 15 } 16 } 17 18 if( !is_singular( $share_post_types ) ){ 10 19 return $content; 11 20 } -
iaf-social-share/trunk/inc/admin/save-options.php
r2308107 r2549322 4 4 wp_die( __( 'You don\'t have enough privilege to see this page' ) ); 5 5 } 6 7 echo '<pre>'; 8 var_dump( $_POST ); 9 echo '</pre>'; 6 10 7 11 check_admin_referer( 'iaf_options_verify' ); … … 24 28 $iaf_opts['color'] = sanitize_hex_color( $_POST['iaf_custom_color'] ); 25 29 30 $iaf_cpts = get_post_types( array( '_builtin' => false ), 'objects' ); 31 foreach( $iaf_cpts as $cpt ) { 32 $iaf_opts['share_'.$cpt->name] = sanitize_text_field( $_POST['iaf_share_' . $cpt->name] ); 33 } 34 26 35 if( update_option( 'iaf_social_share_opts', $iaf_opts ) ) { 27 36 wp_redirect( admin_url( 'admin.php?page=iaf-social-share&status=1' ) ); 37 // echo 'OK'; 28 38 } else { 29 39 wp_redirect( admin_url( 'admin.php?page=iaf-social-share&status=2' ) ); 40 // echo 'KO'; 30 41 } 31 32 33 42 } -
iaf-social-share/trunk/inc/admin/sidebar-box.php
r2308107 r2549322 42 42 </div> 43 43 </div> 44 45 <?php 46 $iaf_cpts = get_post_types( array( '_builtin' => false ), 'objects' ); 47 48 foreach( $iaf_cpts as $cpt ) { 49 ?> 50 <div class="iaf-form-row"> 51 <div class="iaf-form-label"> 52 <?php esc_html_e( $cpt->label ); ?> 53 </div><div class="iaf-form-control"> 54 <div class="iaf-form-input"> 55 <input type="radio" id="iaf_share_<?php echo $cpt->name; ?>_1" name="iaf_share_<?php echo $cpt->name; ?>" 56 <?php echo $iaf_opts['share_' . $cpt->name] == 'show' ? 'CHECKED' : '' ?> value="show" /> 57 <label for="iaf_share_<?php echo $cpt->name; ?>_1"><?php _e( 'Show', 'iaf-social-share' ); ?></label> 58 </div> 59 <div class="iaf-form-input"> 60 <input type="radio" id="iaf_share_<?php echo $cpt->name; ?>_2" name="iaf_share_<?php echo $cpt->name; ?>" 61 <?php echo $iaf_opts['share_' . $cpt->name] == 'hide' ? 'CHECKED' : '' ?> value="hide" /> 62 <label for="iaf_share_<?php echo $cpt->name; ?>_2"><?php _e( 'Hide', 'iaf-social-share' ); ?></label> 63 </div> 64 </div> 65 </div> 66 <?php 67 } 68 ?> 44 69 45 70 </div> -
iaf-social-share/trunk/readme.txt
r2510307 r2549322 5 5 Requires PHP: 5.2.4 6 6 Tested up to: 5.7 7 Stable tag: 1. 07 Stable tag: 1.1 8 8 License: GPL2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 30 30 = 1.0 = 31 31 * Initial release 32 33 = 1.1 = 34 * Share buttons can be added to custom post types
Note: See TracChangeset
for help on using the changeset viewer.