' . __( 'Facebook Insights and Admins', 'wordpress-seo' ) . '
'; $fbconnect .= sprintf( __( 'To be able to access your Facebook Insights for your site, you need to specify a Facebook Admin. This can be a user, but if you have an app for your site, you could use that. For most people a user will be "good enough" though.', 'wordpress-seo' ), 'https://www.facebook.com/insights' ) . '

'; $error = false; $clearall = false; if ( isset( $_GET[ 'delfbadmin' ] ) ) { if ( wp_verify_nonce( $_GET[ 'nonce' ], 'delfbadmin' ) != 1 ) die( "I don't think that's really nice of you!." ); $id = $_GET[ 'delfbadmin' ]; if ( isset( $options[ 'fb_admins' ][ $id ] ) ) { $fbadmin = $options[ 'fb_admins' ][ $id ][ 'name' ]; unset( $options[ 'fb_admins' ][ $id ] ); update_option( 'wpseo_social', $options ); add_settings_error( 'yoast_wpseo_social_options', 'success', sprintf( __( 'Successfully removed admin %s', 'wordpress-seo' ), $fbadmin ), 'updated' ); $error = true; } } if ( isset( $_GET[ 'fbclearall' ] ) ) { if ( wp_verify_nonce( $_GET[ 'nonce' ], 'fbclearall' ) != 1 ) die( "I don't think that's really nice of you!." ); unset( $options[ 'fb_admins' ], $options[ 'fbapps' ], $options[ 'fbadminapp' ], $options[ 'fbadminpage' ] ); update_option( 'wpseo_social', $options ); add_settings_error( 'yoast_wpseo_social_options', 'success', __( 'Successfully cleared all Facebook Data', 'wordpress-seo' ), 'updated' ); } if ( !isset( $options[ 'fbconnectkey' ] ) || empty( $options[ 'fbconnectkey' ] ) ) { $options[ 'fbconnectkey' ] = md5( get_bloginfo( 'url' ) . rand() ); update_option( 'wpseo_social', $options ); } if ( isset( $_GET[ 'key' ] ) && $_GET[ 'key' ] == $options[ 'fbconnectkey' ] ) { if ( isset( $_GET[ 'userid' ] ) ) { if ( !is_array( $options[ 'fb_admins' ] ) ) $options[ 'fb_admins' ] = array(); $id = $_GET[ 'userid' ]; $options[ 'fb_admins' ][ $id ][ 'name' ] = urldecode( $_GET[ 'userrealname' ] ); $options[ 'fb_admins' ][ $id ][ 'link' ] = urldecode( $_GET[ 'link' ] ); update_option( 'wpseo_social', $options ); add_settings_error( 'yoast_wpseo_social_options', 'success', sprintf( __( 'Successfully added %s as a Facebook Admin!', 'wordpress-seo' ), '' . $options[ 'fb_admins' ][ $id ][ 'name' ] . '' ), 'updated' ); } else if ( isset( $_GET[ 'apps' ] ) ) { $apps = json_decode( stripslashes( $_GET[ 'apps' ] ) ); $options[ 'fbapps' ] = array( '0' => __( 'Do not use a Facebook App as Admin', 'wordpress-seo' ) ); foreach ( $apps as $app ) { $options[ 'fbapps' ][ $app->app_id ] = $app->display_name; } update_option( 'wpseo_social', $options ); add_settings_error( 'yoast_wpseo_social_options', 'success', __( 'Successfully retrieved your apps from Facebook, now select an app to use as admin.', 'wordpress-seo' ), 'updated' ); } $error = true; } $options = get_option( 'wpseo_social' ); if ( isset( $options[ 'fb_admins' ] ) && is_array( $options[ 'fb_admins' ] ) ) { foreach ( $options[ 'fb_admins' ] as $id => $admin ) { $fbconnect .= ''; } $clearall = true; } if ( isset( $options[ 'fbapps' ] ) && is_array( $options[ 'fbapps' ] ) ) { foreach ( $options[ 'fbapps' ] as $id => $page ) { $fbconnect .= ''; } $clearall = true; } $app_button_text = __( 'Use a Facebook App as Admin', 'wordpress-seo' ); if ( isset( $options[ 'fbapps' ] ) && is_array( $options[ 'fbapps' ] ) ) { $fbconnect .= '

' . __( 'Select an app to use as Facebook admin:', 'wordpress-seo' ) . '

'; $fbconnect .= '

'; $app_button_text = __( 'Update Facebook Apps', 'wordpress-seo' ); } if ( !isset( $options[ 'fbadminapp' ] ) || $options[ 'fbadminapp' ] == 0 ) { $button_text = __( 'Add Facebook Admin', 'wordpress-seo' ); $primary = true; if ( isset( $options[ 'fb_admins' ] ) && is_array( $options[ 'fb_admins' ] ) && count( $options[ 'fb_admins' ] ) > 0 ) { $fbconnect .= '

' . __( 'Currently connected Facebook admins:', 'wordpress-seo' ) . '

'; $fbconnect .= ''; $button_text = __( 'Add Another Facebook Admin', 'wordpress-seo' ); $primary = false; } $but_primary = ''; if ( $primary ) $but_primary = '-primary'; $fbconnect .= '

' . $button_text . '

'; } $fbconnect .= '' . $app_button_text . ' '; if ( $clearall ) { $fbconnect .= '' . __( 'Clear all Facebook Data', 'wordpress-seo' ) . ' '; } $fbconnect .= '

'; $wpseo_admin_pages->admin_header( __( 'Social', 'wordpress-seo' ), true, 'yoast_wpseo_social_options', 'wpseo_social' ); if ( $error ) settings_errors(); echo '

' . __( 'Facebook OpenGraph', 'wordpress-seo' ) . '

'; echo $wpseo_admin_pages->checkbox( 'opengraph', '' ); echo'

' . __( 'Add OpenGraph meta data to your site\'s <head> section. You can specify some of the ID\'s that are sometimes needed below:', 'wordpress-seo' ) . '

'; echo $fbconnect; echo '

' . __( 'Frontpage settings', 'wordpress-seo' ) . '

'; echo $wpseo_admin_pages->textinput( 'og_frontpage_image', __( 'Image URL', 'wordpress-seo' ) ); echo $wpseo_admin_pages->textinput( 'og_frontpage_desc', __( 'Description', 'wordpress-seo' ) ); echo '

' . __( 'These are the image and description used in the OpenGraph meta tags on the frontpage of your site.', 'wordpress-seo' ) . '

'; echo '

' . __( 'Default settings', 'wordpress-seo' ) . '

'; echo $wpseo_admin_pages->textinput( 'og_default_image', __( 'Image URL', 'wordpress-seo' ) ); echo '

' . __( 'This image is used if the post/page being shared does not contain any images.', 'wordpress-seo' ) . '

'; echo '

' . __( 'Twitter', 'wordpress-seo' ) . '

'; echo $wpseo_admin_pages->checkbox( 'twitter', '' ); echo'

' . __( 'Add Twitter card meta data to your site\'s <head> section.', 'wordpress-seo' ) . '

'; echo $wpseo_admin_pages->textinput( 'twitter_site', __( 'Site Twitter Username', 'wordpress-seo' ) ); $wpseo_admin_pages->admin_footer();