set_system_config_var('gapp_client_id',get_option('ease_gapp_client_id')); $ease_core->set_system_config_var('gapp_client_secret',get_option('ease_gapp_client_secret')); } if(isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'], 'Google App Engine')!==false) { }else{ $s3_public = get_option('ease_s3_bucket_public'); $s3_private = get_option('ease_s3_bucket_private'); $s3_access_key = get_option('ease_s3_access_key'); $s3_secret_access_key = get_option('ease_s3_secret_access_key'); if($s3_access_key && $s3_secret_access_key && (get_option('ease_s3_active') != "")){ $ease_core->set_system_config_var('s3_access_key_id',$s3_access_key); $ease_core->set_system_config_var('s3_secret_key',$s3_secret_access_key); if($s3_public){ $ease_core->set_system_config_var('s3_bucket_public',$s3_public); } if($s3_private){ $ease_core->set_system_config_var('s3_bucket_private',$s3_private); } }else{ if(get_option('ease_local_upload_active') != ""){ $public_folder = get_option('ease_public_folder_upload_directory'); $private_folder = get_option('ease_private_folder_upload_directory'); if($private_folder){ if(is_dir($private_folder)){ $ease_core->set_system_config_var('private_upload_dir',$private_folder); } } if($public_folder){ if(is_dir($public_folder)){ $ease_core->set_system_config_var('public_upload_dir',$public_folder); } } } } } return $ease_core; } /** * Loads the EASE Script Helper, that allows the user to insert pre-built scripts into their Wordpress pages * * @author Lucas Simmons * * @since 0.1 * * */ function ease_script_helper() { echo 'EASE Script Helper'; } /** * Loads the Drive importer script * * @author Lucas Simmons * * @since 0.1 * */ function adding_custom_ease_meta_box_pullfromdrive( $post_type, $post ) { $screens = array( 'post', 'page' ); foreach ( $screens as $screen ) { add_meta_box( 'my-meta-box-pullfromdrive', __( 'EASE - Pull Content from a Google Document' ), 'render_my_ease_meta_box_pullfromdrive', $screen, 'side', 'default' ); } } /** * Checks to see if query has a question mark in it already or not * * @author Lucas Simmons * * @since 0.1 * */ function check_for_params($url){ $path_query = parse_url($url); if(isset($path_query['query'])){ return "&"; }else{ return "?"; } } /** * Drive importer script * * @author Lucas Simmons * * @since 0.1 * * */ function render_my_ease_meta_box_pullfromdrive($post){ $ease_core = ease_load_core(); $client_id = get_option('ease_gapp_client_id'); if(!$client_id){ $client_id = $ease_core->load_system_config_var('gapp_client_id'); } echo ' Enter Google Doc ID:
'; } /** * Calls the function that creates the endpoint page that handles all EASE calls and displays a message * * @author Lucas Simmons * * @since 0.1 * */ function create_ease_endpoint_page(){ create_ease_endpoint(); echo "

Success

Your EASE endpoint page has been created. You will need to change your settings in your Google Project to match the updated urls"; } /** * Creates the endpoint page that handles all EASE calls * * @author Lucas Simmons * * @since 0.1 * */ function create_ease_endpoint(){ $_p['post_content'] = " "; $_p['post_status'] = 'publish'; $_p['post_type'] = 'page'; $_p['post_title'] = 'EASE Endpoint Handler'; $_p['comment_status'] = 'closed'; $_p['ping_status'] = 'closed'; $_p['post_category'] = array(1); // the default 'Uncatrgorised' $the_page_id = wp_insert_post( $_p ); update_option( 'ease_service_endpoint_page', $the_page_id); } /** * Adds new pages from the script helper * * @author Lucas Simmons * * @since 0.1 * */ function easeAddNewPage() { foreach($_POST['category_template'] as $category_item){ if($category_item['page_title']){ $page_title = $category_item['page_title']; }else{ $page_title = $category_item['display_name']; } create_ease_wp_page_from_script_helper($category_item['content'],$page_title,$category_item['template_name'],$_POST['post_status']); } } function create_ease_wp_page_from_script_helper($content,$title,$espx_file_name,$post_status = "publish"){ $espx_file_name = str_replace(".espx","",$espx_file_name); $_p['post_title'] = $title; $_p['post_content'] = $content; $_p['post_status'] = $post_status; $_p['post_type'] = 'page'; $_p['comment_status'] = 'closed'; $_p['ping_status'] = 'closed'; $_p['post_category'] = array(1); // the default 'Uncatrgorised' $the_page_id = wp_insert_post( $_p ); global $temp_url_array; $temp_url_array = get_option("ease_replace_urls"); $temp_url_array[$espx_file_name] = $the_page_id; delete_option("ease_replace_urls"); add_option( "ease_replace_urls", $temp_url_array); if(strpos($espx_file_name,"espx") !== false){ //global $no_show_urls; //$no_show_urls = get_option("ease_no_show_urls"); //$no_show_urls[$espx_file_name] = $the_page_id; //delete_option("ease_no_show_urls"); //add_option( "ease_no_show_urls", $no_show_urls); } } ?>