'.__('Connect Your ReadyGraph Account').'
'.__('
Almost done
- connect your account to start getting users.').'
'; } } add_action('admin_notices', 'add_al2fb_readygraph_plugin_warning'); if(get_option('readygraph_application_id') && strlen(get_option('readygraph_application_id')) > 0){ if ((get_option('readygraph_access_token') && strlen(get_option('readygraph_access_token')) > 0)){ add_action('wp_footer', 'al2fb_readygraph_client_script_head', 9); } } add_action('admin_init', 'on_plugin_activated_readygraph_al2fb_redirect'); add_option('readygraph_connect_notice','true'); function rg_al2fb_popup_options_enqueue_scripts() { if ( get_option('readygraph_popup_template') == 'default-template' ) { wp_enqueue_style( 'default-template', plugin_dir_url( __FILE__ ) .'extension/readygraph/assets/css/default-popup.css' ); } if ( get_option('readygraph_popup_template') == 'red-template' ) { wp_enqueue_style( 'red-template', plugin_dir_url( __FILE__ ) .'extension/readygraph/assets/css/red-popup.css' ); } if ( get_option('readygraph_popup_template') == 'blue-template' ) { wp_enqueue_style( 'blue-template', plugin_dir_url( __FILE__ ) .'extension/readygraph/assets/css/blue-popup.css' ); } if ( get_option('readygraph_popup_template') == 'black-template' ) { wp_enqueue_style( 'black-template', plugin_dir_url( __FILE__ ) .'extension/readygraph/assets/css/black-popup.css' ); } if ( get_option('readygraph_popup_template') == 'gray-template' ) { wp_enqueue_style( 'gray-template', plugin_dir_url( __FILE__ ) .'extension/readygraph/assets/css/gray-popup.css' ); } if ( get_option('readygraph_popup_template') == 'green-template' ) { wp_enqueue_style( 'green-template', plugin_dir_url( __FILE__ ) .'extension/readygraph/assets/css/green-popup.css' ); } if ( get_option('readygraph_popup_template') == 'yellow-template' ) { wp_enqueue_style( 'yellow-template', plugin_dir_url( __FILE__ ) .'extension/readygraph/assets/css/yellow-popup.css' ); } if ( get_option('readygraph_popup_template') == 'custom-template' ) { wp_enqueue_style( 'custom-template', plugin_dir_url( __FILE__ ) .'extension/readygraph/assets/css/custom-popup.css' ); } } add_action( 'admin_enqueue_scripts', 'rg_al2fb_popup_options_enqueue_scripts' ); add_action( 'wp_enqueue_scripts', 'rg_al2fb_popup_options_enqueue_scripts' ); function al2fb_post_updated_send_email( $post_id ) { // If this is just a revision, don't send the email. $post_type = get_post_type( $post_id ); if ('page' != $post_type && 'post' != $post_type) return; if ( wp_is_post_revision( $post_id ) ) return; if(get_option('readygraph_application_id') && strlen(get_option('readygraph_application_id')) > 0 && get_option('readygraph_send_blog_updates') == "true"){ $post_title = get_the_title( $post_id ); $post_url = get_permalink( $post_id ); $post_content = get_post($post_id); $post_excerpt = (isset($post_content->post_excerpt) && (!empty($post_content->post_excerpt))) ? $post_content->post_excerpt : wp_trim_words(strip_tags(strip_shortcodes($post_content->post_content)),500); $attachments = get_children(array('post_parent' => $post_id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID')); $images_list = array(); foreach($attachments as $att_id => $attachment) { $full_img_url = wp_get_attachment_url($attachment->ID); $images_list[] = $full_img_url; // Your Code here } $post_image = ""; if ($images_list) $post_image = reset($images_list); $url = 'http://readygraph.com/api/v1/post.json/'; $response = wp_remote_post($url, array( 'body' => array('is_wordpress'=>1, 'message' => $post_title, 'message_link' => $post_url, 'message_image_link' => $post_image, 'message_excerpt' => $post_excerpt,'client_key' => get_option('readygraph_application_id'), 'email' => get_option('readygraph_email')))); if ( is_wp_error( $response ) ) { $error_message = $response->get_error_message(); } else { } $app_id = get_option('readygraph_application_id'); wp_remote_get( "http://readygraph.com/api/v1/tracking?event=post_created&app_id=$app_id" ); } else { } } add_action('future_to_publish','al2fb_post_updated_send_email'); add_action('new_to_publish','al2fb_post_updated_send_email'); add_action('draft_to_publish','al2fb_post_updated_send_email'); ?>