Файловый менеджер - Редактировать - /home/bean7936/perfect-community.com/442aa3/flamingo.zip
Назад
PK ���\�4�c] ] includes/akismet.phpnu �[��� <?php function flamingo_akismet_submit_spam( $comment ) { return flamingo_akismet_submit( $comment, 'spam' ); } function flamingo_akismet_submit_ham( $comment ) { return flamingo_akismet_submit( $comment, 'ham' ); } function flamingo_akismet_submit( $comment, $spam_or_ham = 'spam' ) { if ( ! flamingo_akismet_is_active() ) { return false; } if ( ! in_array( $spam_or_ham, array( 'spam', 'ham' ) ) ) { return false; } $query_string = ''; foreach ( (array) $comment as $key => $data ) { $query_string .= $key . '=' . urlencode( wp_unslash( (string) $data ) ) . '&'; } $response = Akismet::http_post( $query_string, 'submit-' . $spam_or_ham ); return (bool) $response[1]; } function flamingo_akismet_is_active() { if ( is_callable( array( 'Akismet', 'get_api_key' ) ) ) { return (bool) Akismet::get_api_key(); } return false; } PK ���\��$� � includes/functions.phpnu �[��� <?php /** * Retrieves a URL of a file under the Flamingo plugin directory. */ function flamingo_plugin_url( $path = '' ) { $url = plugins_url( $path, FLAMINGO_PLUGIN ); if ( is_ssl() and 'http:' === substr( $url, 0, 5 ) ) { $url = 'https:' . substr( $url, 5 ); } return $url; } /** * Converts a multidimensional array to a flat array. */ function flamingo_array_flatten( $input ) { if ( ! is_array( $input ) ) { return array( $input ); } $output = array(); foreach ( $input as $value ) { $output = array_merge( $output, flamingo_array_flatten( $value ) ); } return $output; } /** * Moves a spam to the Trash. * * @since 2.1 */ function flamingo_schedule_move_trash() { // abort if FLAMINGO_MOVE_TRASH_DAYS is set to zero or in minus if ( (int) FLAMINGO_MOVE_TRASH_DAYS <= 0 ) { return true; } $posts_to_move = Flamingo_Inbound_Message::find( array( 'posts_per_page' => 20, 'meta_key' => '_spam_meta_time', 'meta_value' => time() - ( DAY_IN_SECONDS * FLAMINGO_MOVE_TRASH_DAYS ), 'meta_compare' => '<', 'orderby' => 'meta_value_num', 'order' => 'ASC', 'post_status' => Flamingo_Inbound_Message::spam_status, ) ); foreach ( $posts_to_move as $post ) { $post->trash(); } } PK ���\�= = includes/comment.phpnu �[��� <?php /** * Module for WordPress comments handling */ add_action( 'wp_insert_comment', 'flamingo_insert_comment', 10, 1 ); /** * Creates a Flamingo_Contact record for the given comment. */ function flamingo_insert_comment( $comment_id ) { $comment = get_comment( $comment_id ); if ( 1 !== (int) $comment->comment_approved ) { return; } Flamingo_Contact::add( array( 'email' => $comment->comment_author_email, 'name' => $comment->comment_author, 'channel' => 'comment', ) ); } add_action( 'transition_comment_status', 'flamingo_transition_comment_status', 10, 3 ); /** * Creates a Flamingo_Contact record when the comment status changes. */ function flamingo_transition_comment_status( $new_status, $old_status, $comment ) { if ( 'approved' !== $new_status ) { return; } $email = $comment->comment_author_email; $name = $comment->comment_author; Flamingo_Contact::add( array( 'email' => $email, 'name' => $name, 'channel' => 'comment', ) ); } add_action( 'activate_' . FLAMINGO_PLUGIN_BASENAME, 'flamingo_collect_contacts_from_comments', 10, 0 ); /** * Creates Flamingo_Contact records for existing comments. */ function flamingo_collect_contacts_from_comments() { $comments = get_comments( array( 'status' => 'approve', 'type' => 'comment', 'number' => 20, ) ); foreach ( $comments as $comment ) { $email = $comment->comment_author_email; $name = $comment->comment_author; if ( empty( $email ) ) { continue; } Flamingo_Contact::add( array( 'email' => $email, 'name' => $name, 'channel' => 'comment', ) ); } } PK ���\;�i[ [ includes/user.phpnu �[��� <?php /** * Module for WordPress users handling */ add_action( 'profile_update', 'flamingo_user_profile_update', 10, 1 ); add_action( 'user_register', 'flamingo_user_profile_update', 10, 1 ); /** * Creates a Flamingo_Contact record for the given user. */ function flamingo_user_profile_update( $user_id ) { $user = new WP_User( $user_id ); $email = $user->user_email; $name = $user->display_name; $props = array( 'first_name' => $user->first_name, 'last_name' => $user->last_name, ); if ( ! empty( $email ) ) { Flamingo_Contact::add( array( 'email' => $email, 'name' => $name, 'props' => $props, 'channel' => 'user', ) ); } } add_action( 'activate_' . FLAMINGO_PLUGIN_BASENAME, 'flamingo_collect_contacts_from_users', 10, 0 ); /** * Creates Flamingo_Contact records for existing users. */ function flamingo_collect_contacts_from_users() { $users = get_users( array( 'number' => 20, ) ); foreach ( $users as $user ) { $email = $user->user_email; $name = $user->display_name; if ( empty( $email ) ) { continue; } $props = array( 'first_name' => empty( $user->first_name ) ? '' : $user->first_name, 'last_name' => empty( $user->last_name ) ? '' : $user->last_name, ); Flamingo_Contact::add( array( 'email' => $email, 'name' => $name, 'props' => $props, 'channel' => 'user', ) ); } } PK ���\��4 4 includes/csv.phpnu �[��� <?php abstract class Flamingo_CSV { public function get_file_name() { return 'flamingo.csv'; } public function send_http_headers() { $filename = $this->get_file_name(); $charset = get_option( 'blog_charset' ); header( "Content-Description: File Transfer" ); header( "Content-Disposition: attachment; filename=$filename" ); header( "Content-Type: text/csv; charset=$charset" ); } public function print_data() { echo ''; } } class Flamingo_Contact_CSV extends Flamingo_CSV { public function get_file_name() { return sprintf( '%1$s-flamingo-contact-%2$s.csv', sanitize_key( get_bloginfo( 'name' ) ), wp_date( 'Y-m-d' ) ); } public function print_data() { $labels = array( __( 'Email', 'flamingo' ), __( 'Full name', 'flamingo' ), __( 'First name', 'flamingo' ), __( 'Last name', 'flamingo' ), ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo flamingo_csv_row( $labels ); $args = array( 'posts_per_page' => -1, 'orderby' => 'meta_value', 'order' => 'ASC', 'meta_key' => '_email', ); if ( ! empty( $_GET['s'] ) ) { $args['s'] = $_GET['s']; } if ( ! empty( $_GET['orderby'] ) ) { if ( 'email' === $_GET['orderby'] ) { $args['meta_key'] = '_email'; } elseif ( 'name' === $_GET['orderby'] ) { $args['meta_key'] = '_name'; } } if ( ! empty( $_GET['order'] ) and 'asc' === strtolower( $_GET['order'] ) ) { $args['order'] = 'ASC'; } if ( ! empty( $_GET['contact_tag_id'] ) ) { $args['contact_tag_id'] = explode( ',', $_GET['contact_tag_id'] ); } $items = Flamingo_Contact::find( $args ); foreach ( $items as $item ) { echo "\r\n"; $row = array( $item->email, $item->get_prop( 'name' ), $item->get_prop( 'first_name' ), $item->get_prop( 'last_name' ), ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo flamingo_csv_row( $row ); } } } class Flamingo_Inbound_CSV extends Flamingo_CSV { public function get_file_name() { return sprintf( '%1$s-flamingo-inbound-%2$s.csv', sanitize_key( get_bloginfo( 'name' ) ), wp_date( 'Y-m-d' ) ); } public function print_data() { $args = array( 'posts_per_page' => -1, 'orderby' => 'date', 'order' => 'DESC', ); if ( ! empty( $_REQUEST['s'] ) ) { $args['s'] = $_REQUEST['s']; } if ( ! empty( $_REQUEST['orderby'] ) ) { if ( 'subject' === $_REQUEST['orderby'] ) { $args['meta_key'] = '_subject'; $args['orderby'] = 'meta_value'; } elseif ( 'from' === $_REQUEST['orderby'] ) { $args['meta_key'] = '_from'; $args['orderby'] = 'meta_value'; } } if ( ! empty( $_REQUEST['order'] ) and 'asc' === strtolower( $_REQUEST['order'] ) ) { $args['order'] = 'ASC'; } if ( ! empty( $_REQUEST['m'] ) ) { $args['m'] = $_REQUEST['m']; } if ( ! empty( $_REQUEST['channel_id'] ) ) { $args['channel_id'] = $_REQUEST['channel_id']; } if ( ! empty( $_REQUEST['channel'] ) ) { $args['channel'] = $_REQUEST['channel']; } $items = Flamingo_Inbound_Message::find( $args ); if ( empty( $items ) ) { return; } $labels = array_keys( $items[0]->fields ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo flamingo_csv_row( array_merge( $labels, array( __( 'Date', 'flamingo' ) ) ) ); foreach ( $items as $item ) { echo "\r\n"; $row = array(); foreach ( $labels as $label ) { $col = isset( $item->fields[$label] ) ? $item->fields[$label] : ''; if ( is_array( $col ) ) { $col = flamingo_array_flatten( $col ); $col = array_filter( array_map( 'trim', $col ) ); $col = implode( ', ', $col ); } $row[] = $col; } $row[] = get_post_time( 'c', false, $item->id() ); // Date // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo flamingo_csv_row( $row ); } } } /** * Retrieves text that represents a CSV row. */ function flamingo_csv_row( $inputs = array() ) { $row = array(); foreach ( $inputs as $input ) { $row[] = apply_filters( 'flamingo_csv_quotation', $input ); } $separator = apply_filters( 'flamingo_csv_value_separator', ',' ); return implode( $separator, $row ); } add_filter( 'flamingo_csv_quotation', 'flamingo_csv_quote', 10, 1 ); /** * Retrieves text that represents a CSV cell with quotation. */ function flamingo_csv_quote( $input ) { $prefix = apply_filters( 'flamingo_csv_field_prefix', '', $input ); $input = trim( sprintf( '%1$s %2$s', $prefix, $input ) ); return sprintf( '"%s"', str_replace( '"', '""', $input ) ); } add_filter( 'flamingo_csv_field_prefix', 'flamingo_csv_field_prefix_text', 10, 2 ); /** * Adds a security alert at the head of a cell. * * @see https://contactform7.com/2020/01/15/heads-up-about-spreadsheet-vulnerabilities/ */ function flamingo_csv_field_prefix_text( $prefix, $input ) { $formula_triggers = array( '=', '+', '-', '@' ); if ( in_array( substr( $input, 0, 1 ), $formula_triggers, true ) ) { /* translators: %s: URL */ $prefix = __( '(Security Alert: Suspicious content is detected. See %s for details.)', 'flamingo' ); if ( in_array( substr( $prefix, 0, 1 ), $formula_triggers, true ) ) { $prefix = '\'' . $prefix; } $prefix = sprintf( $prefix, esc_url( __( 'https://contactform7.com/heads-up-about-spreadsheet-vulnerabilities', 'flamingo' ) ) ); } return $prefix; } PK ���\����c c includes/formatting.phpnu �[��� <?php function flamingo_htmlize( $val ) { $result = ''; if ( is_array( $val ) ) { foreach ( $val as $v ) { $result .= sprintf( '<li>%s</li>', flamingo_htmlize( $v ) ); } $result = sprintf( '<ul>%s</ul>', $result ); } else { $result = wpautop( esc_html( (string) $val ) ); } return apply_filters( 'flamingo_htmlize', $result, $val ); } PK ���\J=�4 4 includes/capabilities.phpnu �[��� <?php add_filter( 'map_meta_cap', 'flamingo_map_meta_cap', 10, 4 ); function flamingo_map_meta_cap( $caps, $cap, $user_id, $args ) { $meta_caps = array( 'flamingo_edit_contact' => 'edit_users', 'flamingo_edit_contacts' => 'edit_users', 'flamingo_delete_contact' => 'edit_users', 'flamingo_edit_inbound_message' => 'edit_users', 'flamingo_edit_inbound_messages' => 'edit_users', 'flamingo_delete_inbound_message' => 'edit_users', 'flamingo_delete_inbound_messages' => 'edit_users', 'flamingo_spam_inbound_message' => 'edit_users', 'flamingo_unspam_inbound_message' => 'edit_users', ); $meta_caps = apply_filters( 'flamingo_map_meta_cap', $meta_caps ); $caps = array_diff( $caps, array_keys( $meta_caps ) ); if ( isset( $meta_caps[$cap] ) ) { $caps[] = $meta_caps[$cap]; } return $caps; } PK ���\�h�ɕ � includes/cron.phpnu �[��� <?php /** * Cron job functionality * * @since 2.1 */ add_action( 'admin_init', 'flamingo_schedule_activation', 10, 0 ); /** * Creates a scheduled event, if it does not exist. * * @since 2.1 */ function flamingo_schedule_activation() { if ( ! wp_next_scheduled( 'flamingo_hourly_cron_job' ) ) { wp_schedule_event( time(), 'hourly', 'flamingo_hourly_cron_job' ); } } add_action( 'flamingo_hourly_cron_job', 'flamingo_schedule_function', 10, 0 ); /** * The cron job. * * @since 2.1 */ function flamingo_schedule_function() { flamingo_schedule_move_trash(); } // Unscheduling cron jobs on plugin deactivation. register_deactivation_hook( FLAMINGO_PLUGIN, 'flamingo_schedule_deactivate' ); /** * Unschedules cron jobs. * * @since 2.1 */ function flamingo_schedule_deactivate() { wp_clear_scheduled_hook( 'flamingo_hourly_cron_job' ); wp_clear_scheduled_hook( 'flamingo_daily_cron_job' ); } PK ���\��h5) 5) "