0 ) powerpress_save_settings($NewSettings); } function powerpress_strip_redirect_urls($url) { $Settings = powerpress_get_settings('powerpress_general'); for( $x = 1; $x <= 3; $x++ ) { $field = sprintf('redirect%d', $x); if( !empty($Settings[$field]) ) { $redirect_no_http = str_replace('http://', '', $Settings[$field]); if( substr($redirect_no_http, -1, 1) != '/' ) $redirect_no_http .= '/'; $url = str_replace($redirect_no_http, '', $url); } } return $url; } function powerpress_admin_jquery_init() { $Settings = false; // Important, never remove this $Settings = get_option('powerpress_general'); $Error = false; $Programs = false; $Step = 1; $action = (isset($_GET['action'])?$_GET['action']: (isset($_POST['action'])?$_POST['action']:false) ); if( !$action ) return; $DeleteFile = false; switch($action) { case 'powerpress-jquery-stats': { // Make sure users have permission to access this if( !empty($Settings['use_caps']) && !current_user_can('view_podcast_stats') ) { powerpress_admin_jquery_header( __('Blubrry Media Statistics', 'powerpress') ); ?>

 

0 && (empty($userLastPodcast) || $userLastPodcast == '!nodefault') && $Settings['network_mode'] == '1') { $blubrryProgramKeyword = '!selectPodcast'; } if(!empty($userLastPodcast) && $userLastPodcast != '!nodefault' && $Settings['network_mode'] == '1') { $blubrryProgramKeyword = $userLastPodcast; } if(!empty($_GET['blubrryProgramKeyword'])) { $blubrryProgramKeyword = $_GET['blubrryProgramKeyword']; } if( !empty($_GET['blubrryProgramKeyword']) && !empty($_GET['remSel']) && $_GET['remSel'] == 'true' ) { update_user_meta(get_current_user_id(), 'pp_default_podcast', $blubrryProgramKeyword); $userLastPodcast = $blubrryProgramKeyword; } if( isset($_GET['remSel']) && $_GET['remSel'] == 'false') { update_user_meta(get_current_user_id(), 'pp_default_podcast', '!nodefault'); $userLastPodcast = '!nodefault'; } if( $DeleteFile ) { $json_data = false; $api_url_array = powerpress_get_api_array(); foreach( $api_url_array as $index => $api_url ) { $req_url = sprintf('%s/media/%s/%s?format=json', rtrim($api_url, '/'), $Settings['blubrry_program_keyword'], $DeleteFile ); $req_url = sprintf('%s/media/%s/%s?format=json', rtrim($api_url, '/'), $blubrryProgramKeyword , $DeleteFile ); $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:''); $json_data = powerpress_remote_fopen($req_url, $Settings['blubrry_auth'], array(), 10, 'DELETE'); if( !$json_data && $api_url == 'https://api.blubrry.com/' ) { // Lets force cURL and see if that helps... $json_data = powerpress_remote_fopen($req_url, $Settings['blubrry_auth'], array(), 10, 'DELETE', true); // Only give this 2 seconds to return results } if( $json_data != false ) break; } $results = powerpress_json_decode($json_data); if( isset($results['text']) ) $Msg = $results['text']; else if( isset($results['error']) ) $Msg = $results['error']; else $Msg = __('An unknown error occurred deleting media file.', 'powerpress'); } $json_data = false; $json_data_programs = false; $api_url_array = powerpress_get_api_array(); foreach( $api_url_array as $index => $api_url ) { $req_url = sprintf('%s/media/%s/index.json?quota=true&published=true', rtrim($api_url, '/'), $blubrryProgramKeyword ); $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:''); $req_url_programs = sprintf('%s/service/index.json', rtrim($api_url, '/') ); $req_url_programs .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'?'. POWERPRESS_BLUBRRY_API_QSA:''); $json_data = powerpress_remote_fopen($req_url, $Settings['blubrry_auth']); $json_data_programs = powerpress_remote_fopen($req_url_programs, $Settings['blubrry_auth']); if( !$json_data && $api_url == 'https://api.blubrry.com/' ) { // Lets force cURL and see if that helps... $json_data = powerpress_remote_fopen($req_url, $Settings['blubrry_auth'], array(), 15, false, true); } else if(!$json_data_programs && $api_url == 'https://api.blubrry.com/') { $json_data_programs = powerpress_remote_fopen($req_url, $Settings['blubrry_auth'], array(), 15, false, true); } if( $json_data != false ) break; } $results = powerpress_json_decode($json_data); $results_programs = powerpress_json_decode($json_data_programs); if( isset($results_programs['error']) ) { $Error = $results_programs['error']; if( strstr($Error, __('currently not available', 'powerpress') ) ) { $Error = __('Unable to find podcasts for this account.', 'powerpress'); $Error .= '
'; $Error .= 'Verify that the email address you enter here matches the email address you used when you listed your podcast on blubrry.com.'; } else if( preg_match('/No programs found.*media hosting/i', $results_programs['error']) ) { $Error .= '
'; $Error .= 'Service may take a few minutes to activate.'; } } else if( !is_array($results_programs) ) { $Error = $json_data_programs; } else { // Get all the programs for this user... foreach ($results_programs as $null => $row) { $Programs[$row['program_keyword']] = $row['program_title']; } } if( $Error ) { powerpress_page_message_add_notice($Error, 'inline', false); } $FeedSlug = sanitize_title($_GET['podcast-feed']); powerpress_admin_jquery_header( __('Select Media', 'powerpress'), true ); ?>
1 && $Settings['network_mode'] == '1') { ?>

> >

'. sprintf( __('Media hosting service expired on %s.', 'powerpress'), esc_attr($results['quota']['expires']['readable_date'])) . '

'; } else { $message = '

'. sprintf( __('Media hosting service will expire on %s.', 'powerpress'), esc_attr($results['quota']['expires']['readable_date'])) . '

'; } $message .= '

'. __('Renew Media Hosting Service', 'powerpress') . '

'; powerpress_page_message_add_notice( $message, 'inline', false ); powerpress_page_message_print(); } else if($blubrryProgramKeyword == '!selectPodcast') { $message = '

Please Select A Program

'; powerpress_page_message_add_notice( $message, 'inline', false ); powerpress_page_message_print(); } else if( empty($results) ) { // Handle the error here. $message = '

'.__('Error', 'powerpress') . '

'; global $g_powerpress_remote_error, $g_powerpress_remote_errorno; if( !empty($g_powerpress_remote_errorno) && $g_powerpress_remote_errorno == 401 ) $message .= '

'. __('Incorrect sign-in email address or password.', 'powerpress').'

'.__('Verify your account entered under Services and Statistics settings then try again.', 'powerpress') .'

'; else if( !empty($g_powerpress_remote_error) ) $message .= '

'.$g_powerpress_remote_error.'

'; else $message .= '

'.__('Unable to connect to service.','powerpress').'

'; // Print an erro here powerpress_page_message_add_notice( $message, 'inline', false ); powerpress_page_message_print(); } if( $Msg ) echo '

'. $Msg . '

'; if($blubrryProgramKeyword != '!selectPodcast') { ?>

:

' . $results['error'] . '

'; echo '

' . __('Manage your blubrry.com Account', 'powerpress') . '

'; } else if (is_array($results)) { $PublishedList = false; foreach ($results as $index => $data) { if ($index === 'quota') { $QuotaData = $data; continue; } if ($PublishedList == false && !empty($data['published'])) { ?>
:
$api_url ) { $req_url = sprintf('%s/service/index.json', rtrim($api_url, '/') ); $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'?'. POWERPRESS_BLUBRRY_API_QSA:''); $json_data = powerpress_remote_fopen($req_url, $auth); if( !$json_data && $api_url == 'https://api.blubrry.com/' ) { // Lets force cURL and see if that helps... $json_data = powerpress_remote_fopen($req_url, $auth, array(), 15, false, true); } if( $json_data != false ) break; } if( $json_data ) { $results = powerpress_json_decode($json_data); if( isset($results['error']) ) { $Error = $results['error']; if( strstr($Error, __('currently not available', 'powerpress') ) ) { $Error = __('Unable to find podcasts for this account.', 'powerpress'); $Error .= '
'; $Error .= 'Verify that the email address you enter here matches the email address you used when you listed your podcast on blubrry.com.'; } else if( preg_match('/No programs found.*media hosting/i', $results['error']) ) { $Error .= '
'; $Error .= 'Service may take a few minutes to activate.'; } } else if( !is_array($results) ) { $Error = $json_data; } else { // Get all the programs for this user... foreach( $results as $null => $row ) { $Programs[ $row['program_keyword'] ] = $row['program_title']; if( $row['hosting'] === true || $row['hosting'] == 'true' ) $ProgramHosting[ $row['program_keyword'] ] = true; else $ProgramHosting[ $row['program_keyword'] ] = false; } if( count($Programs) > 0 ) { $SaveSettings['blubrry_auth'] = $auth; if( !empty($SaveSettings['blubrry_program_keyword']) ) { powerpress_add_blubrry_redirect($SaveSettings['blubrry_program_keyword']); if ($SaveSettings['blubrry_program_keyword'] != 'no_default') { $SaveSettings['blubrry_hosting'] = $ProgramHosting[$SaveSettings['blubrry_program_keyword']]; if (!is_bool($SaveSettings['blubrry_hosting'])) { if ($SaveSettings['blubrry_hosting'] === 'false' || empty($SaveSettings['blubrry_hosting'])) $SaveSettings['blubrry_hosting'] = false; } } $Save = true; $Close = true; } else if( isset($SaveSettings['blubrry_program_keyword']) ) // Present but empty { $Error = __('You must select a program to continue.', 'powerpress'); } else if( count($Programs) == 1 ) { foreach( $Programs as $keyword => $title ) { break; } $SaveSettings['blubrry_program_keyword'] = $keyword; $SaveSettings['blubrry_hosting'] = $ProgramHosting[ $keyword ]; if( !is_bool($SaveSettings['blubrry_hosting']) ) { if( $SaveSettings['blubrry_hosting'] === 'false' || empty($SaveSettings['blubrry_hosting']) ) $SaveSettings['blubrry_hosting'] = false; } powerpress_add_blubrry_redirect($keyword); $Close = true; $Save = true; } else { $Error = __('Please select your podcast program to continue.', 'powerpress'); $Step = 2; $Settings['blubrry_username'] = $SaveSettings['blubrry_username']; } } else { $Error = __('No podcasts for this account are listed on blubrry.com.', 'powerpress'); } } } else { global $g_powerpress_remote_error, $g_powerpress_remote_errorno; //$Error = '

'. __('Error', 'powerpress') .'

'; if( !empty($g_powerpress_remote_errorno) && $g_powerpress_remote_errorno == 401 ) $Error .= '

'. __('Incorrect sign-in email address or password.', 'powerpress') .'

'. __('Verify your account settings then try again.', 'powerpress') .'

'; else if( !empty($g_powerpress_remote_error) ) $Error .= '

'.$g_powerpress_remote_error .'

'; else $Error .= '

'.__('Authentication failed.', 'powerpress') .'

'; } if( $Error ) { $Error .= '

'. __('Click Here For Help','powerpress') .'

'; } } if( $Save ) $SaveSettings['network_mode'] = (isset($SaveSettings['network_mode'])) ? 1 : 0; powerpress_save_settings($SaveSettings); // Clear cached statistics delete_option('powerpress_stats'); if( $Error ) powerpress_page_message_add_notice( $Error, 'inline', false ); if( $Close ) { powerpress_admin_jquery_header( __('Blubrry Services', 'powerpress') ); powerpress_page_message_print(); ?>

<?php echo __('Close', 'powerpress'); ?>

" onclick="self.parent.tb_remove(); return false;" target="_top">

/>

"; echo ""; $style = (!empty($_GET['style']) && $_GET['style'] == 'modern') ? 'modern' : 'classic'; $shape = (!empty($_GET['shape']) && $_GET['shape'] == 'squared') ? '-sq' : ''; $css = plugins_url('css/subscribe.css', __FILE__); echo ""; echo '
'. esc_attr( __('Apple Podcasts', 'powerpress') ) .'
'; echo ""; echo ""; exit; }; break; case 'powerpress-jquery-upload': { if( !current_user_can('edit_posts') ) { powerpress_admin_jquery_header( __('Uploader', 'powerpress') ); powerpress_page_message_add_notice( __('You do not have sufficient permission to upload media.','powerpress') ); powerpress_page_message_print(); powerpress_admin_jquery_footer(); exit; } check_admin_referer('powerpress-jquery-upload'); $RedirectURL = false; $Error = false; if( !$Settings ) $Settings = get_option('powerpress_general'); if( empty($Settings['blubrry_hosting']) || $Settings['blubrry_hosting'] === 'false' ) $Settings['blubrry_hosting'] = false; if( empty($Settings['blubrry_program_keyword']) ) $Settings['blubrry_program_keyword'] = ''; if( empty($Settings['blubrry_auth']) ) $Settings['blubrry_auth'] = ''; if( empty($Settings['blubrry_hosting']) ) { $Error = __('This feature is available to Blubrry Hosting users only.','powerpress'); } $blubrryProgramKeyword = $Settings['blubrry_program_keyword']; if( !empty($_GET['blubrryProgramKeyword']) ) { $blubrryProgramKeyword = $_GET['blubrryProgramKeyword']; } if( $Error == false ) { $json_data = false; $api_url_array = powerpress_get_api_array(); foreach( $api_url_array as $index => $api_url ) { $req_url = sprintf('%s/media/%s/upload_session.json', rtrim($api_url, '/'), $blubrryProgramKeyword ); $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'?'. POWERPRESS_BLUBRRY_API_QSA:''); $json_data = powerpress_remote_fopen($req_url, $Settings['blubrry_auth']); if( !$json_data && $api_url == 'https://api.blubrry.com/' ) { // Lets force cURL and see if that helps... $json_data = powerpress_remote_fopen($req_url, $Settings['blubrry_auth'], array(), 15, false, true); } if( $json_data != false ) break; } $results = powerpress_json_decode($json_data); // We need to obtain an upload session for this user... if( isset($results['error']) && strlen($results['error']) > 1 ) { $Error = $results['error']; if( strstr($Error, 'currently not available') ) $Error = __('Unable to find podcasts for this account.','powerpress'); } else if( $results === $json_data ) { $Error = $json_data; } else if( !is_array($results) || $results == false ) { $Error = $json_data; } else { if( isset($results['url']) && !empty($results['url']) ) $RedirectURL = $results['url']; } } if( $Error == false && $RedirectURL ) { $RedirectURL .= '&ReturnURL='; $RedirectURL .= urlencode( admin_url("admin.php?action=powerpress-jquery-upload-complete") ); header("Location: $RedirectURL"); exit; } else if( $Error == false ) { global $g_powerpress_remote_error, $g_powerpress_remote_errorno; if( !empty($g_powerpress_remote_errorno) && $g_powerpress_remote_errorno == 401 ) $Error = '

'. __('Incorrect sign-in email address or password.', 'powerpress').'

'.__('Verify your account entered under Services and Statistics settings then try again.', 'powerpress') .'

'; else if( !empty($g_powerpress_remote_error) ) $Error = '

'.$g_powerpress_remote_error .'

'; else $Error = '

'.__('Unable to obtain upload session.','powerpress') .'

'; } powerpress_admin_jquery_header( __('Uploader','powerpress') ); echo '

'. __('Uploader','powerpress') .'

'; echo '

'; echo $Error; echo '

'; ?>

'. __('Uploader', 'powerpress') .''; echo '

'; if( $File ) { echo __('File', 'powerpress') .': '; echo $File; echo ' - '; } echo $Message; echo '

'; ?>

is_block_editor() ) { return; } } nocache_headers(); $other = false; if( $jquery ) add_thickbox(); // we use the thckbox for some settings ?> > <?php bloginfo('name') ?> › <?php echo $title; ?> — <?php echo __('WordPress', 'powerpress'); ?> '; if (defined('WP_DEBUG')) { if (WP_DEBUG) {?>