├── README.md ├── access-monitor ├── am-change-notification-email.php └── am-editor-access-to-settings.php ├── my-calendar ├── mc-change-grid-date.php ├── mc-change-primary-sort.php ├── mc-close-button.php ├── mc-conflict-filter.php ├── mc-custom-date-format.php ├── mc-custom-image-size.php ├── mc-custom-import.php ├── mc-custom-list-title.php ├── mc-custom-list-titles.php ├── mc-custom-location-fields.php ├── mc-custom-navigation-elements.php ├── mc-custom-template-tag.php ├── mc-custom-template.php ├── mc-disable-datepicker.php ├── mc-event-accessibility.php ├── mc-facebook.php ├── mc-filter-location-access.php ├── mc-hide-subsequent-days.php ├── mc-ical-alarms.php ├── mc-insert-class-in-nav.php ├── mc-limit-after-event-end.php ├── mc-limit-categories.php ├── mc-multiple-sites.php ├── mc-notify.php ├── mc-post-submission-redirect.php ├── mc-propagate-events.php ├── mc-redirect-single-event-view.php ├── mc-remove-adminbar.php ├── mc-rsvp │ ├── css │ │ └── rsvp.css │ ├── js │ │ └── rsvp.js │ └── mc-rsvp.php ├── mc-time-format.php ├── mc-twitter.php ├── mc-user-filter.php ├── mcs-refresh-after-submit.php ├── my-calendar-custom-fields.php ├── my-calendar-event-open.php └── my-week │ ├── css │ └── style.css │ └── my-calendar-week.php ├── my-tickets ├── my-ticket-custom-cart-fields.php ├── my-tickets-add-currency.php ├── my-tickets-add-to-cart-and-checkout.php ├── my-tickets-closure-recipient.php ├── my-tickets-custom-fields.php ├── my-tickets-default-tickets.php ├── my-tickets-filter-text-noargs.php ├── my-tickets-filter-text.php ├── my-tickets-gettext.php ├── my-tickets-limit-purchases.php ├── my-tickets-nimble-builder-compatibility.php ├── my-tickets-report-list.php ├── my-tickets-select-list.php ├── my-tickets-ticket-used-notification.php └── my-tickets-ultimate-member.php ├── tester.php ├── wp-accessibility ├── custom-fontsize-css.php ├── relocate-toolbar.php └── remove-toolbar.php └── wp-to-twitter ├── alternate-tweet-schedule.php ├── always-large-images.php ├── always-upload.php ├── bypass-authors-array.php ├── change-tweet-repeat-limit.php ├── change-utm-medium.php ├── custom-autopost-schedule.php ├── custom-autopost-selection.php ├── custom-field-content.php ├── custom-hashtag-source.php ├── custom-image-directory.php ├── custom-post-filter.php ├── custom-tag-filter.php ├── custom-taxonomy-terms.php ├── customize-post-title.php ├── disable-url-storage.php ├── edited-or-new.php ├── editor-power.php ├── filter-by-author-and-category.php ├── filter-to-author-by-category.php ├── hashtags-in-titles.php ├── multipostthumbnails.php ├── only-tweet-today.php ├── owly-custom-url-shortener.php ├── qtranslate-one-title.php ├── randomized-delay.php ├── readability-custom-url-shortener.php ├── remove-author-by-category.php ├── replace-space-character-in-tags.php ├── restrict-tweets-by-category.php ├── send-random-post-image-to-twitter.php ├── shorten-custom-url.php ├── tags-as-cashtags.php ├── tweet-disqus-comments.php ├── tweet-facebook-comments.php ├── video-importer-bridge.php ├── wpt-remove-metabox.php └── wpt-tweet-events.php /README.md: -------------------------------------------------------------------------------- 1 | # Joe Dolson: Plug-in Extensions 2 | 3 | How to use these references: 4 | 5 | Every file in this repository can be installed as a plug-in. When installed, it'll perform some action that modifies or extends the behavior of one of my other plug-ins. The files are grouped into folders that should make it clear which plug-in they pertain to. 6 | 7 | To install: 8 | 9 | * Cut and paste the code into a new file. 10 | * Save that file with whatever name works for you, making whatever changes you need. 11 | * Upload the file into /wp-content/plug-ins/ 12 | * Go to WordPress > Plugins and activate it. 13 | 14 | With plug-ins that have premium extensions, such as WP Tweets PRO for WP to Twitter, some extensions only work when the premium add-on is also installed. 15 | 16 | # What makes it a plugin? 17 | 18 | The header block is a section of comments that describe the plugin, and are used to identify that this is a plugin. A header block will look something like this: 19 | 20 | ``` 21 | Plugin Name: Name of my Custom Plugin 22 | Plugin URI: http://www.joedolson.com 23 | Description: Describe what this plug-in does 24 | Author: Joe Dolson 25 | Version: 1.0.0 26 | Author URI: http://www.joedolson.com/ 27 | ``` 28 | 29 | Any PHP file in the `/wp-content/` directory that has this comment will be recognized as a plug-in. 30 | 31 | The plug-ins in this repository are simple examples. They don't have options or settings, they are examples for manipulating the filters and actions in my plugins to customize their functionality. In most cases, you'll need to edit the code to change how they operate. 32 | 33 | Thanks! 34 | -------------------------------------------------------------------------------- /access-monitor/am-change-notification-email.php: -------------------------------------------------------------------------------- 1 | Close'; 20 | /** 21 | * Example using custom image 22 | */ 23 | $return = 'Close'; 24 | 25 | return $return; 26 | } -------------------------------------------------------------------------------- /my-calendar/mc-conflict-filter.php: -------------------------------------------------------------------------------- 1 | <\s\p\a\n \c\l\a\s\s="\m\o\b\i\l\e-\o\n\l\y">l<\s\t\r\o\n\g>j<\s\p\a\n>M Y'; 27 | /** 28 | * Renders as: 29 | 30 | Monday 31 | 9 32 | Nov 2020 33 | 34 | */ 35 | } 36 | 37 | return $format; 38 | } -------------------------------------------------------------------------------- /my-calendar/mc-custom-image-size.php: -------------------------------------------------------------------------------- 1 | occur_begin ) ); 25 | $title = "$event_time: $title"; 26 | 27 | return $title; 28 | } -------------------------------------------------------------------------------- /my-calendar/mc-custom-list-titles.php: -------------------------------------------------------------------------------- 1 | ' . $title . ''; 22 | } 23 | } 24 | 25 | return ( $output ) ? '' : $output; 26 | } -------------------------------------------------------------------------------- /my-calendar/mc-custom-location-fields.php: -------------------------------------------------------------------------------- 1 | 'Venue Email', // Label value for input field. 53 | 'sanitize_callback' => 'sanitize_email', // How this value should be sanitized. 54 | 'display_callback' => 'esc_html', // How this value should be escaped. 55 | 'input_type' => 'email', // Type of input. 56 | ); 57 | $fields['location_type'] = array( 58 | 'title' => 'Location Type', 59 | 'sanitize_callback' => 'sanitize_text_field', 60 | 'display_callback' => 'esc_html', 61 | 'input_type' => 'select', 62 | 'input_values' => array( 'Virtual', 'Private Home', 'Concert Hall', 'Outdoor Venue' ), 63 | ); 64 | 65 | return $fields; 66 | } 67 | add_filter( 'mc_location_fields', 'my_add_custom_field', 10, 1 ); 68 | 69 | /** 70 | * This display callback is used to format the saved data. 71 | * 72 | * @param mixed $data Value of saved data. 73 | * @param array $field Array of data about this field (as created in create_custom_fields()). 74 | * 75 | * @return data passed. 76 | */ 77 | function my_custom_display_callback( $data, $field ) { 78 | $value = ( $data ) ? $data : ''; 79 | // If the field currently being displayed is titled 'Job Title', make bold. 80 | if ( 'Job Title' === $field['title'] ) { 81 | $value = ( '' !== $value ) ? '' . $value . '' : ''; 82 | } 83 | 84 | return $value; 85 | } 86 | 87 | /** 88 | * This sanitize callback is used to sanitize the data before it's saved to the DB 89 | * 90 | * @param mixed $data Data supplied by user. 91 | * 92 | * @return sanitized value 93 | */ 94 | function my_custom_sanitize_callback( $data ) { 95 | return ( $data ) ? sanitize_text_field( $data ) : ''; 96 | } 97 | -------------------------------------------------------------------------------- /my-calendar/mc-custom-navigation-elements.php: -------------------------------------------------------------------------------- 1 | ' . print_r( $params, 1 ) . ''; 55 | } 56 | 57 | /** 58 | * Return a custom navigation item in the header. (Can do same thing with filter `mc_footer_navigation`). 59 | * 60 | * @param array $in Array of currently selected navigation parameters. 61 | * @param array $used Array of all navigation parameters currently in use for this calendar view. 62 | * @param array $params Parameters specifying this view. 63 | * 64 | * @return array 65 | */ 66 | function mc_add_custom_nav( $in, $used, $params ) { 67 | $in[] = 'my_custom_nav_item'; 68 | 69 | return $in; 70 | } 71 | add_filter( 'mc_header_navigation', 'mc_add_custom_nav', 10, 3 ); -------------------------------------------------------------------------------- /my-calendar/mc-custom-template-tag.php: -------------------------------------------------------------------------------- 1 | ID."; 25 | 26 | return $e; 27 | } -------------------------------------------------------------------------------- /my-calendar/mc-custom-template.php: -------------------------------------------------------------------------------- 1 | 44 |
45 | %1$s 46 |
47 |
48 | '.$header.' 49 | %4$s 50 | 51 |
52 |
53 |
54 |

Location

55 | %5$s 56 | '.$phone2.' 57 | %6$s 58 |
59 |
60 | 61 |

More Information about %3$s

62 | 63 |
64 |
65 | ', $details ); 66 | return $body; 67 | } 68 | 69 | return $body; 70 | } -------------------------------------------------------------------------------- /my-calendar/mc-disable-datepicker.php: -------------------------------------------------------------------------------- 1 | __( 'Audio Description', 'my-calendar' ), 24 | '2' => __( 'ASL Interpretation', 'my-calendar' ), 25 | '3' => __( 'ASL Interpretation with voicing', 'my-calendar' ), 26 | '4' => __( 'Deaf-Blind ASL', 'my-calendar' ), 27 | '5' => __( 'Real-time Captioning', 'my-calendar' ), 28 | '6' => __( 'Scripted Captioning', 'my-calendar' ), 29 | '7' => __( 'Assisted Listening Devices', 'my-calendar' ), 30 | '8' => __( 'Tactile/Touch Tour', 'my-calendar' ), 31 | '9' => __( 'Braille Playbill', 'my-calendar' ), 32 | '10' => __( 'Large Print Playbill', 'my-calendar' ), 33 | '11' => __( 'Sensory Friendly', 'my-calendar' ), 34 | '12' => __( 'Other', 'my-calendar' ), 35 | ) ); 36 | */ 37 | 38 | // Change the language for 'playbill'. 39 | $choices[9] = 'Braille Program'; 40 | $choices[10] = 'Large Print Program'; 41 | // Add another option. 42 | $choices[13] = 'An additional option'; 43 | 44 | return $choices; 45 | } 46 | -------------------------------------------------------------------------------- /my-calendar/mc-facebook.php: -------------------------------------------------------------------------------- 1 | Share on Facebook"; 24 | return $e; 25 | } 26 | -------------------------------------------------------------------------------- /my-calendar/mc-filter-location-access.php: -------------------------------------------------------------------------------- 1 | event_hide_end == 1 ) { 23 | $return = true; 24 | } 25 | 26 | return $hide; 27 | } -------------------------------------------------------------------------------- /my-calendar/mc-ical-alarms.php: -------------------------------------------------------------------------------- 1 | '-PT30M', 42 | * 'REPEAT' => '0', 43 | * 'DURATION' => '', 44 | * 'ACTION' => 'DISPLAY', 45 | * 'DESCRIPTION' => '{title}' 46 | * ); 47 | * 48 | */ 49 | add_action( 'mc_event_has_alarm', 'my_event_alarm', 10, 3 ); 50 | function my_event_alarm( $alarm, $event_id, $event_post ) { 51 | // set a trigger to 60 minutes before the start of the event. 52 | // Use $event_id to pass specific values for different events. 53 | // Note: Google Calendar does not import alerts correctly. This is a Google Calendar issue. 54 | $alarm = array( 55 | 'TRIGGER' => '-PT60M' 56 | ); 57 | 58 | return $alarm; 59 | } -------------------------------------------------------------------------------- /my-calendar/mc-insert-class-in-nav.php: -------------------------------------------------------------------------------- 1 | occur_end, date( 'Y-m-d', current_time( 'timestamp' ) ) ) ) { 26 | $data = mc_create_tags( $event ); 27 | // this is just a sample template; you'd want to customize it. 28 | $details = jd_draw_template( $data, '

{title}

{image}' ); 29 | } 30 | 31 | return $details; 32 | } 33 | 34 | 35 | /** 36 | * Save custom fields into post meta. 37 | * 38 | * @param int $post_id ID of the post where event meta is saved. 39 | * @param array $post $_POST array 40 | * @param array $data Checked array of My Calendar data after processing. 41 | * @param integer event_id ID of event in my_calendar custom table. 42 | * 43 | **/ 44 | add_action( 'mc_update_event_post', 'my_event_email_save', 10, 4 ); 45 | function my_event_email_save( $post_id, $post, $data, $event_id ) { 46 | if ( is_email( $post['event_email'] ) ) { 47 | $email = $post['event_email']; 48 | update_post_meta( $post_id, '_mc_event_email', $email ); 49 | } 50 | } 51 | 52 | /** 53 | * Add custom field into template tags array. 54 | * 55 | * @param array $details Array of template tags as $tag => $value 56 | * @param object $event Event object as fetched from database. 57 | * 58 | * @return array $details 59 | **/ 60 | add_filter( 'mc_filter_shortcodes', 'my_event_email_tag', 10, 2 ); 61 | function my_event_email_tag( $details, $event ) { 62 | $post_id = $event->event_post; 63 | /* This content will be accessible as {contact_email} in templates. */ 64 | $details['contact_email'] = get_post_meta( $post_id, '_mc_event_email', true ); 65 | 66 | return $details; 67 | } 68 | 69 | -------------------------------------------------------------------------------- /my-calendar/mc-limit-categories.php: -------------------------------------------------------------------------------- 1 | 1, 'category_name' => 'General' ); 47 | foreach ( $cats as $key => $cat ) { 48 | // if $cat meets your criteria, include 49 | if ( we_want_to_use( $cat->category_id ) ) { 50 | $output[] = $cat; 51 | } 52 | } 53 | 54 | return $output; 55 | } 56 | 57 | return $cats; 58 | } 59 | 60 | /** 61 | * This is totally arbitrary; you'd have to determine your own rules for inclusion. 62 | */ 63 | function we_want_to_use( $cat_id ) { 64 | return true; 65 | } 66 | -------------------------------------------------------------------------------- /my-calendar/mc-multiple-sites.php: -------------------------------------------------------------------------------- 1 | post_title; 50 | // get the event data saved with the post 51 | $data = get_post_meta( $post_id, '_mc_event_data', true ); 52 | $start = $data['event_begin']; 53 | wp_mail( get_option( 'admin_email' ), "Event deleted: $start", "$title has been deleted." ); 54 | } 55 | -------------------------------------------------------------------------------- /my-calendar/mc-post-submission-redirect.php: -------------------------------------------------------------------------------- 1 | ", "

", $return ); 69 | } 70 | 71 | return $return; 72 | } 73 | -------------------------------------------------------------------------------- /my-calendar/mc-redirect-single-event-view.php: -------------------------------------------------------------------------------- 1 | ' + response.guests + ' guests' ).addClass( 'updated' ); 55 | total = total - parseInt( guests ); 56 | var newtotal = total + parseInt( response.guests ) + add; 57 | } 58 | } else { 59 | $( '.guestlist ul' ).append( '
  • ' + response.name + ' + ' + response.guests + ' guests
  • ' ); 60 | var newtotal = total + parseInt( response.guests ) + 1; 61 | } 62 | 63 | $( '.total-count' ).text( newtotal ).addClass( 'updated' ); 64 | $('.rsvp-notice').html( response.response ).show( 300 ); 65 | } 66 | }, 'json' ); 67 | }); 68 | 69 | }); 70 | 71 | }(jQuery)); -------------------------------------------------------------------------------- /my-calendar/mc-rsvp/mc-rsvp.php: -------------------------------------------------------------------------------- 1 | event_post; 22 | $guests = get_post_meta( $post_ID, '_event_rsvp' ); 23 | $guest_list = ''; 24 | $num_guests = 0; 25 | $total = 0; 26 | $current_user = ''; 27 | 28 | if ( is_user_logged_in() ) { 29 | foreach ( $guests as $guest ) { 30 | if ( ! $guest ) { continue; } 31 | $attendee = get_user_by( 'ID', $guest ); 32 | $count = intval( get_post_meta( $post_ID, "_event_guests_$guest", true ) ); 33 | if ( $guest == $user->ID ) { 34 | $num_guests = $count; 35 | $current_user = ' class="current-user"'; 36 | } else { 37 | $current_user = ''; 38 | } 39 | $total = $total + ( $count + 1 ); 40 | $name = ( '' == $attendee->display_name ) ? $attendee->username : $attendee->display_name; 41 | $guest_list .= "" . sprintf( _n( '%1$s + %2$s guest', '%1$s + %2$s guests', $count, 'my-calendar-submissions' ), $name, "$count" ) . ''; 42 | } 43 | 44 | if ( '' != $guest_list ) { 45 | $guest_list = "

    Attendees

    " . sprintf( _n( '%s guest attending', '%s guests attending', $total, 'my-calendar-submissions' ), "$total" ) . '

    '; 46 | } 47 | 48 | if ( in_array( $user->ID, $guests ) ) { 49 | $checked = 'checked="checked"'; 50 | $text = 'Update RSVP'; 51 | } else { 52 | $checked = ''; 53 | $text = 'Save RSVP'; 54 | } 55 | 56 | if ( current_time( 'timestamp' ) < strtotime( $e['dtstart'] ) ) { 57 | $update = "
    " . mc_update_rsvp( $post_ID, $_POST ) . '
    '; 58 | $wpnonce = wp_nonce_field( 'mc-save-rsvp', '_wpnonce', true, false ); 59 | $form = "
    60 | $update 61 |
    62 |
    $wpnonce
    63 |

    64 |

    65 |

    66 |
    67 |
    "; 68 | } else { 69 | $form = "

    RSVP's are closed for this event.

    "; 70 | } 71 | 72 | $e['rsvp'] = " 73 | $guest_list 74 | $form"; 75 | 76 | } else { 77 | $e['rsvp'] = "Log in to view the attendee list and to RSVP!"; 78 | } 79 | 80 | return $e; 81 | } 82 | add_filter( 'mc_filter_shortcodes', 'mc_rsvp', 10, 2 ); 83 | 84 | /** 85 | * Update RSVP. 86 | * 87 | * @param int $post_ID Post ID for event. 88 | * @param object $post Post object. 89 | * 90 | * @return string 91 | */ 92 | function mc_update_rsvp( $post_ID, $post ) { 93 | if ( isset( $post['save_rsvp'] ) && $post_ID == $post['event_post'] ) { 94 | if ( ! wp_verify_nonce( $post['_wpnonce'], 'mc-save-rsvp' ) ) { 95 | return; 96 | } 97 | $user = wp_get_current_user(); 98 | $meta = get_post_meta( $post_ID, '_event_rsvp' ); 99 | if ( ( isset( $post['mc_rsvp'] ) && $post['mc_rsvp'] != 'false' ) && !in_array( $user->ID, $meta ) ) { 100 | // add User ID to meta data 101 | add_post_meta( $post_ID, '_event_rsvp', $user->ID ); 102 | add_post_meta( $post_ID, "_event_guests_$user->ID", intval( $post['mc_guests'] ) ); 103 | $return = 'RSVP added'; 104 | 105 | } elseif ( ( ! isset( $post['mc_rsvp'] ) || 'false' === $post['mc_rsvp'] ) && in_array( $user->ID, $meta ) ) { 106 | // remove User ID from meta data 107 | delete_post_meta( $post_ID, '_event_rsvp', $user->ID ); 108 | delete_post_meta( $post_ID, "_event_guests_$user->ID" ); 109 | $return = 'RSVP removed'; 110 | 111 | } elseif ( ( isset( $post['mc_rsvp'] ) && $post['mc_rsvp'] != 'false' ) && in_array( $user->ID, $meta ) ) { 112 | update_post_meta( $post_ID, "_event_guests_$user->ID", intval( $post['mc_guests'] ) ); 113 | $return = 'RSVP updated'; 114 | 115 | } else { 116 | $return = 'No change to RSVP'; 117 | } 118 | 119 | return "

    $return

    "; 120 | } 121 | } 122 | 123 | /** 124 | * Enqueue RSVP scripts. 125 | */ 126 | function mc_rsvp_scripts() { 127 | if ( ! is_admin() ) { 128 | wp_enqueue_style( 'rsvp.styles', plugins_url( 'css/rsvp.css', __FILE__ ) ); 129 | wp_enqueue_script( 'rsvp.update', plugins_url( 'js/rsvp.js', __FILE__ ), array( 'jquery' ), '1.0.0', true ); 130 | wp_localize_script( 131 | 'rsvp.update', 132 | 'mcrsvp', 133 | array( 134 | 'ajaxurl' => admin_url( 'admin-ajax.php' ), 135 | 'security' => wp_create_nonce( 'mc-save-rsvp' ), 136 | 'action' => 'mc_rsvp_ajax' 137 | ) 138 | ); 139 | } 140 | } 141 | add_action( 'wp_enqueue_scripts', 'mc_rsvp_scripts' ); 142 | 143 | /** 144 | * Handle RSVP. 145 | */ 146 | function mc_rsvp_ajax() { 147 | if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'mc_rsvp_ajax' ) { 148 | $data = $_REQUEST['data']; 149 | $post_id = $data['post_id']; 150 | $rsvp = $data['rsvp']; 151 | if ( 'false' === $rsvp ) { 152 | $guests = 0; 153 | } else { 154 | $guests = $data['guests']; 155 | } 156 | $security = $_REQUEST['security']; 157 | $name = wp_get_current_user()->display_name; 158 | 159 | $response = mc_update_rsvp( 160 | $post_id, 161 | array( 162 | 'mc_rsvp' => $rsvp, 163 | 'mc_guests' => $guests, 164 | 'event_post' => $post_id, 165 | '_wpnonce' => $security, 166 | 'save_rsvp' => 'true', 167 | ) 168 | ); 169 | wp_send_json( 170 | array( 171 | 'success' => 1, 172 | 'rsvp' => $rsvp, 173 | 'guests' => $guests, 174 | 'name' => $name, 175 | 'response'=> $response, 176 | ) 177 | ); 178 | } 179 | } 180 | add_action( 'wp_ajax_mc_rsvp_ajax', 'mc_rsvp_ajax' ); 181 | add_action( 'wp_ajax_nopriv_mc_rsvp_ajax', 'mc_rsvp_ajax' ); -------------------------------------------------------------------------------- /my-calendar/mc-time-format.php: -------------------------------------------------------------------------------- 1 | event_title . ' ' . mc_event_link( $event ) ) . "'>Tweet this event"; 14 | return $e; 15 | } -------------------------------------------------------------------------------- /my-calendar/mc-user-filter.php: -------------------------------------------------------------------------------- 1 | var current = window.location.href; setTimeout('window.location = current', 4000);"; 41 | } else { 42 | $reload = ''; 43 | } 44 | 45 | return $return . $reload; 46 | } -------------------------------------------------------------------------------- /my-calendar/my-calendar-custom-fields.php: -------------------------------------------------------------------------------- 1 | event_post; 28 | /* Any custom fields are saved as custom post meta */ 29 | $email = esc_attr( get_post_meta( $post_id, '_mc_event_email', true ) ); 30 | } else { 31 | $email = ''; 32 | } 33 | $form .= "

    "; 34 | } 35 | 36 | return $form; 37 | } 38 | 39 | /** 40 | * Add fields that are sortable in My Calendar Pro. 41 | * 42 | * @param array $fields Array of fields available in Pro. 43 | * @param boolean $has_data If true, this is an event being edited or corrected. 44 | * @param object $event The event object saved. 45 | * @param string $context 'public' or 'admin', depending on whether this is being rendered in the Pro submissions form or WP Admin. 46 | * 47 | * @since My Calendar Pro 2.0.0 48 | * 49 | * @return array of fields 50 | */ 51 | function mcs_event_email( $fields, $has_data, $event, $context ) { 52 | if ( $has_data ) { 53 | $post_id = $event->event_post; 54 | /* Any custom fields are saved as custom post meta */ 55 | $email = esc_attr( get_post_meta( $post_id, '_mc_event_email', true ) ); 56 | } else { 57 | $email = ''; 58 | } 59 | $form = "

    "; 60 | $fields['event_email'] = $form; 61 | 62 | return $fields; 63 | } 64 | add_filter( 'mc_custom_fields', 'mcs_event_email', 10, 5 ); 65 | 66 | 67 | /** 68 | * Save custom fields into post meta. 69 | * 70 | * @param int $post_id ID of the post where event meta is saved. 71 | * @param array $post $_POST array 72 | * @param array $data Checked array of My Calendar data after processing. 73 | * @param integer event_id ID of event in my_calendar custom table. 74 | * 75 | **/ 76 | add_action( 'mc_update_event_post', 'my_event_email_save', 10, 4 ); 77 | function my_event_email_save( $post_id, $post, $data, $event_id ) { 78 | if ( is_email( $post['event_email'] ) ) { 79 | $email = $post['event_email']; 80 | update_post_meta( $post_id, '_mc_event_email', $email ); 81 | } 82 | } 83 | 84 | /** 85 | * Add custom field into template tags array. 86 | * 87 | * @param array $details Array of template tags as $tag => $value 88 | * @param object $event Event object as fetched from database. 89 | * 90 | * @return array $details 91 | **/ 92 | add_filter( 'mc_filter_shortcodes', 'my_event_email_tag', 10, 2 ); 93 | function my_event_email_tag( $details, $event ) { 94 | $post_id = $event->event_post; 95 | /* This content will be accessible as {contact_email} in templates. */ 96 | $details['contact_email'] = get_post_meta( $post_id, '_mc_event_email', true ); 97 | 98 | return $details; 99 | } 100 | -------------------------------------------------------------------------------- /my-calendar/my-calendar-event-open.php: -------------------------------------------------------------------------------- 1 | event_post; 26 | /* Any custom fields are saved as custom post meta */ 27 | $checked = ( get_post_meta( $post_id, '_mc_event_open', true ) == 'true' ) ? 'checked="checked"' : ''; 28 | } else { 29 | $checked = ''; 30 | } 31 | $form .= "

    "; 32 | 33 | return $form; 34 | } 35 | 36 | 37 | /** 38 | * Save custom fields into post meta. 39 | * 40 | * @param int $post_id ID of the post where event meta is saved. 41 | * @param array $post $_POST array 42 | * @param array $data Checked array of My Calendar data after processing. 43 | * @param integer event_id ID of event in my_calendar custom table. 44 | * 45 | **/ 46 | add_action( 'mc_update_event_post', 'my_event_email_save', 10, 4 ); 47 | function my_event_email_save( $post_id, $post, $data, $event_id ) { 48 | if ( isset( $post['event_open'] ) ) { 49 | $open = $post['event_open']; 50 | update_post_meta( $post_id, '_mc_event_open', 'true' ); 51 | } else { 52 | delete_post_meta( $post_id, '_mc_event_open' ); 53 | } 54 | } 55 | 56 | /** 57 | * Add custom field into template tags array. 58 | * 59 | * @param array $details Array of template tags as $tag => $value 60 | * @param object $event Event object as fetched from database. 61 | * 62 | * @return array $details 63 | **/ 64 | add_filter( 'mc_filter_shortcodes', 'my_event_email_tag', 10, 2 ); 65 | function my_event_email_tag( $details, $event ) { 66 | $post_id = $event->event_post; 67 | /* This content will be accessible as {contact_email} in templates. */ 68 | $details['event_open'] = ( get_post_meta( $post_id, '_mc_event_open', true ) == 'true' ) ? 'This event is open for registration.' : 'This event is closed for registration.'; 69 | 70 | return $details; 71 | } 72 | 73 | -------------------------------------------------------------------------------- /my-calendar/my-week/css/style.css: -------------------------------------------------------------------------------- 1 | .mc-week { 2 | display: table; 3 | width: 100%; 4 | background-color: #2C3242; 5 | } 6 | 7 | .mc-week .mc-week-list { 8 | display: table-row; 9 | } 10 | 11 | .mc-week .mc-week-list li { 12 | display: table-cell; 13 | text-align: center; 14 | } 15 | 16 | .mc-week .mc-week-list a { 17 | display: block; 18 | padding: .5em; 19 | color: #fff !important; 20 | } 21 | 22 | .mc-week .mc-week-list a:hover, 23 | .mc-week .mc-week-list a:focus { 24 | background: #485169 !important; 25 | } 26 | 27 | 28 | .mc-week .mc-week-list .current-day { 29 | background-color: #485169; 30 | } 31 | 32 | @media (max-width: 768px) { 33 | .mc-week { display: block; } 34 | .mc-week .mc-week-list { display: block; } 35 | .mc-week .mc-week-list li { display: block; } 36 | } -------------------------------------------------------------------------------- /my-calendar/my-week/my-calendar-week.php: -------------------------------------------------------------------------------- 1 | $date[0], 23 | 'month' => $date[1], 24 | 'dy' => $date[2], 25 | 'time' => 'day' 26 | ), $url ); 27 | 28 | for ( $i = 1; $i<8; $i++ ) { 29 | $day = date( 'Y-m-d', strtotime( $today . " + $i day" ) ); 30 | $date = explode( '-', $day ); 31 | $name = date( 'l', strtotime( $day ) ); 32 | $links[$name] = add_query_arg( array( 33 | 'yr'=>$date[0], 34 | 'month' => $date[1], 35 | 'dy' => $date[2], 36 | 'time' => 'day' 37 | ), $url ); 38 | } 39 | 40 | foreach( $links as $day => $link ) { 41 | if ( isset( $_GET['yr'] ) ) { 42 | $current = date( 'l', strtotime( $_GET['month'] . '-' . $_GET['dy'] . '-' . $_GET['yr'] ) ); 43 | } else { 44 | $current = date( 'l', current_time( 'timestamp' ) ); 45 | } 46 | $class = sanitize_title( $day ); 47 | $link = esc_url( $link ); 48 | if ( $day == $current ) { 49 | $class .= ' current-day'; 50 | } 51 | $list .= "
  • $day
  • "; 52 | } 53 | 54 | return "
    "; 55 | } 56 | 57 | // add shortcode 58 | 59 | add_shortcode( 'my_week', 'mc_show_week_list' ); 60 | function mc_show_week_list() { 61 | return mc_create_week_list(); 62 | } 63 | 64 | // add styles 65 | add_action( 'wp_enqueue_scripts', 'my_enqueued_styles' ); 66 | function my_enqueued_styles() { 67 | wp_enqueue_style( 'my.weeklist', plugins_url( 'css/style.css', __FILE__ ) ); 68 | } 69 | 70 | add_filter( 'mc_heading', 'my_custom_week_heading', 10, 3 ); 71 | function my_custom_week_heading( $content, $format, $time ) { 72 | echo "$content, $format, $time"; 73 | if ( $time == 'day' ) { 74 | return "Events for " . $content; 75 | } 76 | 77 | return $content; 78 | } -------------------------------------------------------------------------------- /my-tickets/my-ticket-custom-cart-fields.php: -------------------------------------------------------------------------------- 1 |

    '; 27 | 28 | return $custom_fields; 29 | } 30 | 31 | /* 32 | * Save checked value into payment record. 33 | * 34 | * @param $payment integer post ID for payment 35 | * @param $post $_POST 36 | * 37 | * @return null 38 | */ 39 | add_filter( 'mt_handle_custom_cart_data', 'my_save_custom_field', 10, 2 ); 40 | function my_save_custom_field( $payment, $post ) { 41 | if ( isset( $_POST['code_of_conduct'] ) ) { 42 | update_post_meta( $payment, '_coc', 'Agreed to code of conduct' ); 43 | } else { 44 | update_post_meta( $payment, '_coc', 'Did not agree to code of conduct' ); 45 | } 46 | } 47 | 48 | /* 49 | * Display information on payments page. 50 | * 51 | * @param $output string. Any other custom output. 52 | * @param $post_ID Payment ID 53 | * 54 | * @return string Output string plus new output. 55 | */ 56 | add_filter( 'mt_show_in_payment_fields', 'my_show_custom_field', 10, 2 ); 57 | function my_show_custom_field( $output, $post_ID ) { 58 | $coc = get_post_meta( $post_ID, '_coc', true ); 59 | return $output . $coc; 60 | } 61 | 62 | 63 | /* 64 | * Add confirmation value to notifications output. 65 | */ 66 | add_filter( 'mt_notifications_data', 'my_custom_notification', 10, 2 ); 67 | function my_custom_notification( $data, $details ) { 68 | $coc = get_post_meta( $details['id'], '_coc', true ); 69 | if ( $coc ) { 70 | $data['coc'] = $coc; 71 | } else { 72 | $data['coc'] = __( 'No code of conduct information available.', 'yourtextdomain' ); 73 | } 74 | 75 | return $data; 76 | } -------------------------------------------------------------------------------- /my-tickets/my-tickets-add-currency.php: -------------------------------------------------------------------------------- 1 | '₹', 19 | 'description' => 'Indian Rupees (₹)', 20 | // 'zerodecimal' => true // If your currency does not use decimals, include this parameter as true 21 | ); 22 | 23 | $currencies['INR'] = $new; 24 | 25 | return $currencies; 26 | } -------------------------------------------------------------------------------- /my-tickets/my-tickets-add-to-cart-and-checkout.php: -------------------------------------------------------------------------------- 1 | 'Job Title', 38 | 'sanitize_callback' => 'custom_sanitize_callback', 39 | 'display_callback' => 'custom_display_callback', 40 | 'input_type' => 'select', 41 | 'input_values' => array( 42 | 'Web Developer', 43 | 'Consultant', 44 | 'Marketer' 45 | ), 46 | 'context' => 'custom', // Can be an event ID to restrict to that event. 47 | 'required' => 'true', 48 | ); 49 | /** 50 | * Add a second custom field by adding more values to the array 51 | */ 52 | $array['choose_seats'] = array( 53 | 'title' => 'Seat(s) Selection:', 54 | 'sanitize_callback' => 'custom_sanitize_callback', 55 | 'display_callback' => 'custom_display_callback', 56 | 'input_type' => 'text', 57 | 'context' => 'global' 58 | ); 59 | 60 | return $array; 61 | } 62 | 63 | /** 64 | * This display callback is used to format the saved data. 65 | * 66 | * @param mixed $data Value of saved data. 67 | * @param string $context Where data is being displayed: either 'payment' or 'cart'. 68 | * @param array $field Array of data about this field (as created in create_custom_fields()). 69 | * 70 | * @return data passed. 71 | */ 72 | function custom_display_callback( $data, $context='payment', $field ) { 73 | $value = ( $data ) ? urldecode( $data ) : ''; 74 | // If the field currently being displayed is titled 'Job Title', make bold. 75 | if ( 'Job Title' == $field['title'] ) { 76 | $value = '' . $value . ''; 77 | } 78 | 79 | return $value; 80 | } 81 | 82 | /** 83 | * This sanitize callback is used to sanitize the data before it's saved to the DB 84 | * 85 | * @param mixed $data Data supplied by user. 86 | * 87 | * @return sanitized value 88 | */ 89 | function custom_sanitize_callback( $data ) { 90 | return ( $data ) ? esc_html( $data ) : ''; 91 | } 92 | 93 | add_filter( 'mt_apply_custom_field_rules', 'my_custom_field_rules', 10, 3 ); 94 | /** 95 | * Use a custom rule set to determine when a field should be displayed. 96 | * 97 | * @param bool $return Should this field display. 98 | * @param array $field Field characteristics. 99 | * @param int $event_id Event being displayed. 100 | * 101 | * @return boolean 102 | */ 103 | function my_custom_field_rules( $return, $field, $event_id ) { 104 | if ( 'custom' == $field['context'] ) { 105 | // Display this field based on your custom rules. 106 | // Example: restrict by post type. 107 | if ( is_page( $event_id ) ) { 108 | return true; 109 | } 110 | } 111 | 112 | return $return; 113 | } -------------------------------------------------------------------------------- /my-tickets/my-tickets-default-tickets.php: -------------------------------------------------------------------------------- 1 | element, you'll need to define what options are available. 23 | */ 24 | add_filter( 'mt_add_to_cart_input', 'my_add_to_cart_input', 10, 8 ); 25 | function my_add_to_cart_input( $default, $input_type, $type, $value, $attributes, $disable, $max, $available ) { 26 | $return = ""; 31 | 32 | return $return; 33 | } -------------------------------------------------------------------------------- /my-tickets/my-tickets-ticket-used-notification.php: -------------------------------------------------------------------------------- 1 | account->get_tab_output('mytab'); 36 | if ( $output ) { 37 | echo $output; 38 | } 39 | } 40 | add_action( 'um_account_tab__mytab', 'um_account_tab__mytab' ); 41 | 42 | /** 43 | * Finally we add some content in the tab. 44 | * 45 | * @param string $output Default tab output. 46 | * 47 | * @return string 48 | */ 49 | function um_account_content_hook_mytab( $output ){ 50 | ob_start(); 51 | ?> 52 |
    53 | 54 | 55 |
    56 | false adds the Main account into the array. 17 | */ 18 | function include_main_account( $authors, $post_info ) { 19 | if ( wtt_oauth_test( $post_info['authId'], 'verify' ) ) { 20 | // $authors = array( 14, 'main'=>false ); // if you want a specific Author ID 21 | $authors = array( $post_info['authId'], 'main'=>false ); // if you want the author of the post being published 22 | } else { 23 | $authors = array( 'main'=>false ); 24 | } 25 | return $authors; 26 | } -------------------------------------------------------------------------------- /wp-to-twitter/change-tweet-repeat-limit.php: -------------------------------------------------------------------------------- 1 | 3600, 20 | 'display' => __( 'Every hour', 'my-textdomain' ) 21 | ); 22 | 23 | return $schedules; 24 | } -------------------------------------------------------------------------------- /wp-to-twitter/custom-autopost-selection.php: -------------------------------------------------------------------------------- 1 | $post_types, 23 | 'date_query' => array( 24 | 'after' => $after, 25 | 'before' => $before, 26 | 'inclusive' => true, 27 | ), 28 | 'fields' => 'ids', 29 | 'post_status' => 'publish', 30 | 'posts_per_page' => '-1', 31 | ); 32 | */ 33 | // Add a custom taxonomy query to the array. 34 | $args['tax_query'] = array( 35 | array( 36 | 'taxonomy' => 'category', 37 | 'field' => 'slug', 38 | 'terms' => 'your-category-slug', 39 | ); 40 | ); 41 | 42 | 43 | return $args; 44 | } -------------------------------------------------------------------------------- /wp-to-twitter/custom-field-content.php: -------------------------------------------------------------------------------- 1 | post_author; 26 | $value = get_the_author_meta( 'first_name', $author ); 27 | } 28 | 29 | return $value; 30 | } -------------------------------------------------------------------------------- /wp-to-twitter/custom-hashtag-source.php: -------------------------------------------------------------------------------- 1 | name; 27 | } 28 | $value = implode( ' ', $names ); 29 | } 30 | 31 | return $value; 32 | } -------------------------------------------------------------------------------- /wp-to-twitter/customize-post-title.php: -------------------------------------------------------------------------------- 1 | '#ipad', 28 | 'ipod'=>'#ipod', 29 | 'apple'=>'#apple', 30 | 'android'=>'#android', 31 | 'follow friday'=>'#ff' 32 | ); 33 | foreach ( $replacements as $key=>$value ) { 34 | $title = str_ireplace( $key, $value, $title ); 35 | } 36 | } 37 | return $title; 38 | } -------------------------------------------------------------------------------- /wp-to-twitter/multipostthumbnails.php: -------------------------------------------------------------------------------- 1 | 'Twitter', 46 | 'id' => 'twitter-image', 47 | 'post_type' => 'post' 48 | ) 49 | ); 50 | */ -------------------------------------------------------------------------------- /wp-to-twitter/only-tweet-today.php: -------------------------------------------------------------------------------- 1 | post_date ) ); 48 | $today = date( 'Y-m-d', current_time( 'timestamp' ) ); 49 | if ( $date == $today ) { 50 | $do_tweet = true; 51 | } 52 | } 53 | 54 | return $do_tweet; 55 | } 56 | -------------------------------------------------------------------------------- /wp-to-twitter/owly-custom-url-shortener.php: -------------------------------------------------------------------------------- 1 | Ow.ly'; 19 | 20 | return $output; 21 | } 22 | 23 | add_filter( 'wpt_shortener_settings', 'my_shortener_settings', 10, 4 ); 24 | function my_shortener_settings( $output, $selected ) { 25 | if ( $selected == 'owly' ) { 26 | $output .= '

    27 | 28 | 29 |

    '; 30 | } 31 | 32 | return $output; 33 | } 34 | 35 | add_filter( 'wpt_save_shortener_settings', 'my_save_shortener_settings' ); 36 | function my_save_shortener_settings( $message ) { 37 | if ( isset( $_POST['owly_api_key'] ) ) { 38 | $api_key = sanitize_text_field( $_POST['owly_api_key'] ); 39 | update_option( 'owly_api_key', $api_key ); 40 | $message .= __( 'Your Ow.ly API key has been updated.', 'textdomain' ); 41 | } 42 | 43 | return $message; 44 | } 45 | 46 | add_filter( 'wpt_do_shortening', 'my_do_shortening', 10, 6 ); 47 | function my_do_shortening( $shrink, $shortener, $url, $post_title, $post_ID, $testmode ) { 48 | // ensure that $shrink is always defined as a valid URL 49 | $shrink = $url; 50 | if ( $shortener == 'owly' ) { 51 | // URL is not encoded when passed to this filter 52 | $url = urlencode( $url ); 53 | // jd_remote_json returns an array decoded from the JSON response 54 | $apiKey = get_option( 'owly_api_key' ); 55 | $response = wpt_remote_json( add_query_arg( array( 'apiKey' => $apiKey, 'longUrl'=>$url ), 'http://ow.ly/api/1.1/url/shorten' ) ); 56 | // if the response is a string, then this was an error. 57 | // Ignore error and continue with default plug-in shortening. 58 | if ( !is_string( $response ) ) { 59 | $shrink = $response['results']['shortUrl']; 60 | } 61 | } 62 | 63 | return $shrink; 64 | } -------------------------------------------------------------------------------- /wp-to-twitter/qtranslate-one-title.php: -------------------------------------------------------------------------------- 1 | Readability'; 19 | 20 | return $output; 21 | } 22 | 23 | add_filter( 'wpt_shortener_settings', 'my_shortener_settings', 10, 4 ); 24 | function my_shortener_settings( $output, $selected ) { 25 | if ( $selected == 'readability' ) { 26 | $output .= 'No settings are required for your chosen URL shortener.'; 27 | } 28 | 29 | return $output; 30 | } 31 | 32 | // This is an example of how you would do this if it were required. 33 | /* 34 | add_filter( 'wpt_save_shortener_settings', 'my_save_shortener_settings' ); 35 | function my_save_shortener_settings( $message ) { 36 | if ( isset( $_POST['readability_api_key'] ) ) { 37 | $api_key = sanitize_text_field( $_POST['readability_api_key'] ); 38 | update_option( 'readability_api_key', $api_key ); 39 | $message .= __( 'Your Readability API key has been updated.', 'textdomain' ); 40 | } 41 | 42 | return $message; 43 | } 44 | */ 45 | 46 | add_filter( 'wpt_do_shortening', 'my_do_shortening', 10, 6 ); 47 | function my_do_shortening( $shrink, $shortener, $url, $post_title, $post_ID, $testmode ) { 48 | // ensure that the return value is always defined as a valid URL. 49 | $shrink = $url; 50 | if ( $shortener == 'readability' ) { 51 | // if you needed an API key, you'd fetch it now. 52 | //$apiKey = get_option( 'readability_api_key' ); 53 | $response = wp_remote_post( add_query_arg( 'url', $url, 'http://readability.com/api/shortener/v1/urls' ), array( 'body' => array( 'url' => $url ) ) ); 54 | 55 | if ( !is_wp_error( $response ) ) { 56 | $json = json_decode( $response['body'] ); 57 | $meta = $json->meta; 58 | // Ignore error and continue with default plug-in shortening. 59 | if ( ! empty( $meta ) ) { 60 | $shrink = $meta->rdd_url; 61 | } else { 62 | // this was an error 63 | } 64 | } 65 | } 66 | 67 | return $shrink; 68 | } -------------------------------------------------------------------------------- /wp-to-twitter/remove-author-by-category.php: -------------------------------------------------------------------------------- 1 | 'attachment', 25 | 'numberposts' => 1, 26 | 'orderby' => 'rand', 27 | 'post_parent' => $post_ID, 28 | 'post_status' => 'any', 29 | 'post_mime_type' => 'image', 30 | ); 31 | $posts = get_posts( $args ); 32 | $attachment_ID = $posts[0]->post_ID; 33 | 34 | return $attachment_ID; 35 | } -------------------------------------------------------------------------------- /wp-to-twitter/shorten-custom-url.php: -------------------------------------------------------------------------------- 1 | comment_approved; 18 | $agent = $comment->comment_agent; 19 | if ( $approved == 1 && strpos( $agent, 'Disqus' ) !== false ) { 20 | wpt_set_comment_tweet( $id, 1 ); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /wp-to-twitter/tweet-facebook-comments.php: -------------------------------------------------------------------------------- 1 | comment_approved; 18 | $url = $comment->comment_author_url; 19 | if ( $approved == 1 && strpos( $url, '//www.facebook.com' ) !== false ) { 20 | wpt_set_comment_tweet( $id, 1 ); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /wp-to-twitter/video-importer-bridge.php: -------------------------------------------------------------------------------- 1 | $value ) { 20 | if ( '1' === $value['post-published-update'] || '1' === $value['post-edited-update'] ) { 21 | remove_meta_box( 'wp2t', $key, 'side' ); 22 | } 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /wp-to-twitter/wpt-tweet-events.php: -------------------------------------------------------------------------------- 1 |