Settings'; array_unshift( $links, $settings_link ); return $links; } public function allingroups_custom_admin_menu() { add_options_page( 'Allingroups', 'Allingroups settings', 'read', 'allingroups-plugin', array( $this, 'allingroups_options_page') ); } public function allingroups_settings_api_init() { add_settings_section( 'allingroups_options', 'Allingroups options', array( $this, 'allingroups_options_callback'), 'allingroups-plugin'); register_setting('allingroups-plugin', array( $this, 'allingroups_options') ); } public function allingroups_options_callback() { echo ''; } public function allingroups_register_settings() { register_setting( 'allingroups_options', 'allingroups_email', 'sanitize_email' ); register_setting( 'allingroups_options', 'allingroups_wp_identifier', 'sanitize_key' ); register_setting( 'allingroups_options', 'allingroups_playlist', 'intval' ); register_setting( 'allingroups_options', 'allingroups_teaser', 'intval' ); register_setting( 'allingroups_options', 'allingroups_auto', 'intval' ); } public function allingroups_options_page() { if( !current_user_can( 'read' ) ) { wp_die( __('You do not have sufficient permissions to access this page.', 'allingroups') ); } require_once( 'views/admin_page.php' ); } public function allingroups_api_call(){ $body = array(); $valid_actions = array( 'wpconnect' , 'wpgetplaylist' , 'wpgetgroup' , 'wpcreateplaylist' , 'wpremove' ); // Build body if ( isset( $_POST['activity'] ) && in_array( $_POST['activity'], $valid_actions ) ) { $body['action'] = sanitize_text_field( $_POST['activity'] ); } if ( isset( $_POST['email'] ) && filter_var( $_POST['email'], FILTER_VALIDATE_EMAIL ) ) { $body['email'] = sanitize_email( $_POST['email'] ); } if ( isset( $_POST['password'] ) ) { $body['password'] = $_POST['password']; } if ( isset( $_POST['wp_uid'] ) ) { $body['wp_uid'] = sanitize_text_field( $_POST['wp_uid'] ); } if ( isset( $_POST['wp'] ) ) { $body['wp'] = sanitize_text_field( $_POST['wp'] ); } if ( isset( $_POST['wp_playlist'] ) ) { $body['wp_playlist'] = sanitize_text_field( $_POST['wp_playlist'] ); } if ( isset( $_POST['wp_teaser'] ) ) { $body['wp_teaser'] = sanitize_text_field( $_POST['wp_teaser'] ); } if ( isset( $_POST['wp_auto'] ) ) { $body['wp_auto'] = sanitize_text_field( $_POST['wp_auto'] ); } if ( isset( $_POST['playlist_name'] ) ) { $body['playlist_name'] = sanitize_text_field( $_POST['playlist_name'] ); } if ( isset( $_POST['groups'] ) ) { $body['groups'] = sanitize_text_field( $_POST['groups'] ); } if ( isset( $_POST['data'] ) ) { $body['data'] = sanitize_text_field( $_POST['data'] ); } global $wp_version; $args = array( 'timeout' => 10, 'redirection' => 1, 'httpversion' => '1.0', 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url(), 'blocking' => true, 'headers' => array(), 'cookies' => array(), 'body' => $body, 'compress' => false, 'decompress' => true, 'sslverify' => false, 'stream' => false, 'filename' => null ); $response = wp_remote_get( 'https://connect2.allingroups.com/internal_api.php?' . http_build_query($body), $args ); if ( ! is_wp_error( $response ) && 200 == $response['response']['code'] ) { wp_die( $response['body'] ); } wp_die( $response ); } public function allingroups_article_in() { global $post; $options = get_option( 'allingroups_auto' ); if( $options && '1' == $options ) { return; } if ( 'post' == get_post_type( $post ) ) { echo '