/*
Code from Wordpress: http://wordpress.org
435077
public static function removeAccents($string)
    {
        if (!preg_match('/[\x80-\xff]/', $string) ) {
            return $string;
        }

        if (static::seemsUtf8($string)) {
            $chars = array(
            // Decompositions for Latin-1 Supplement
            chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
            chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',
            chr(195).chr(132) => 'A', chr(195).chr(133) => 'A',
            chr(195).chr(134) => 'AE',chr(195).chr(135) => 'C',
            chr(195).chr(136) => 'E', chr(195).chr(137) => 'E',
            chr(195).chr(138) => 'E', chr(195).chr(139) => 'E',
            chr(195).chr(140) => 'I', chr(195).chr(141) => 'I',
            chr(195).chr(142) => 'I', chr(195).chr(143) => 'I',
            chr(195).chr(144) => 'D', chr(195).chr(145) => 'N',
            chr(195).chr(146) => 'O', chr(195).chr(147) => 'O',
            chr(195).chr(148) => 'O', chr(195).chr(149) => 'O',
            chr(195).chr(150) => 'O', chr(195).chr(153) => 'U',
            chr(195).chr(154) => 'U', chr(195).chr(155) => 'U',
            chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y',
            chr(195).chr(158) => 'TH',chr(195).chr(159) => 's',
            chr(195).chr(160) => 'a', chr(195).chr(161) => 'a',
            chr(195).chr(162) => 'a', chr(195).chr(163) => 'a',
            chr(195).chr(164) => 'a', chr(195).chr(165) => 'a',
            chr(195).chr(166) => 'ae',chr(195).chr(167) => 'c',
            chr(195).chr(168) => 'e', chr(195).chr(169) => 'e',
            chr(195).chr(170) => 'e', chr(195).chr(171) => 'e',
            chr(195).chr(172) => 'i', chr(195).chr(173) => 'i',
            chr(195).chr(174) => 'i', chr(195).chr(175) => 'i',
            chr(195).chr(176) => 'd', chr(195).chr(177) => 'n',
            chr(195).chr(178) => 'o', chr(195).chr(179) => 'o',
            chr(195).chr(180) => 'o', chr(195).chr(181) => 'o',
            chr(195).chr(182) => 'o', chr(195).chr(182) => 'o',
            chr(195).chr(185) => 'u', chr(195).chr(186) => 'u',
            chr(195).chr(187) => 'u', chr(195).chr(188) => 'u',
            chr(195).chr(189) => 'y', chr(195).chr(190) => 'th',
            chr(195).chr(191) => 'y',
            // Decompositions for Latin Extended-A
            chr(196).chr(128) => 'A', chr(196).chr(129) => 'a',
            chr(196).chr(130) => 'A', chr(196).chr(131) => 'a',
            chr(196).chr(132) => 'A', chr(196).chr(133) => 'a',
            chr(196).chr(134) => 'C', chr(196).chr(135) => 'c',
            chr(196).chr(136) => 'C', chr(196).chr(137) => 'c',
            chr(196).chr(138) => 'C', chr(196).chr(139) => 'c',
            chr(196).chr(140) => 'C', chr(196).chr(141) => 'c',
            chr(196).chr(142) => 'D', chr(196).chr(143) => 'd',
            chr(196).chr(144) => 'D', chr(196).chr(145) => 'd',
            chr(196).chr(146) => 'E', chr(196).chr(147) => 'e',
            chr(196).chr(148) => 'E', chr(196).chr(149) => 'e',
            chr(196).chr(150) => 'E', chr(196).chr(151) => 'e',
            chr(196).chr(152) => 'E', chr(196).chr(153) => 'e',
            chr(196).chr(154) => 'E', chr(196).chr(155) => 'e',
            chr(196).chr(156) => 'G', chr(196).chr(157) => 'g',
            chr(196).chr(158) => 'G', chr(196).chr(159) => 'g',
            chr(196).chr(160) => 'G', chr(196).chr(161) => 'g',
            chr(196).chr(162) => 'G', chr(196).chr(163) => 'g',
            chr(196).chr(164) => 'H', chr(196).chr(165) => 'h',
            chr(196).chr(166) => 'H', chr(196).chr(167) => 'h',
            chr(196).chr(168) => 'I', chr(196).chr(169) => 'i',
            chr(196).chr(170) => 'I', chr(196).chr(171) => 'i',
            chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
            chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
            chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
            chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
            chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
            chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
            chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
            chr(196).chr(186) => 'l', chr(196).chr(187) => 'L',
            chr(196).chr(188) => 'l', chr(196).chr(189) => 'L',
            chr(196).chr(190) => 'l', chr(196).chr(191) => 'L',
            chr(197).chr(128) => 'l', chr(197).chr(129) => 'L',
            chr(197).chr(130) => 'l', chr(197).chr(131) => 'N',
            chr(197).chr(132) => 'n', chr(197).chr(133) => 'N',
            chr(197).chr(134) => 'n', chr(197).chr(135) => 'N',
            chr(197).chr(136) => 'n', chr(197).chr(137) => 'N',
            chr(197).chr(138) => 'n', chr(197).chr(139) => 'N',
            chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
            chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
            chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
            chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
            chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
            chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
            chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
            chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
            chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
            chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
            chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
            chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
            chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
            chr(197).chr(166) => 'T', chr(197).chr(167) => 't',
            chr(197).chr(168) => 'U', chr(197).chr(169) => 'u',
            chr(197).chr(170) => 'U', chr(197).chr(171) => 'u',
            chr(197).chr(172) => 'U', chr(197).chr(173) => 'u',
            chr(197).chr(174) => 'U', chr(197).chr(175) => 'u',
            chr(197).chr(176) => 'U', chr(197).chr(177) => 'u',
            chr(197).chr(178) => 'U', chr(197).chr(179) => 'u',
            chr(197).chr(180) => 'W', chr(197).chr(181) => 'w',
            chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y',
            chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z',
            chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z',
            chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z',
            chr(197).chr(190) => 'z', chr(197).chr(191) => 's',
            // Decompositions for Latin Extended-B
            chr(200).chr(152) => 'S', chr(200).chr(153) => 's',
            chr(200).chr(154) => 'T', chr(200).chr(155) => 't',
            // Euro Sign
            chr(226).chr(130).chr(172) => 'E',
            // GBP (Pound) Sign
            chr(194).chr(163) => '',
            //Apostrophe
            chr(226) => ''
            );

            $string = strtr($string, $chars);
        } else {
            // Assume ISO-8859-1 if not UTF-8
            $chars['in'] = chr(128).chr(131).chr(138).chr(142).chr(154).chr(158)
                .chr(159).chr(162).chr(165).chr(181).chr(192).chr(193).chr(194)
                .chr(195).chr(196).chr(197).chr(199).chr(200).chr(201).chr(202)
                .chr(203).chr(204).chr(205).chr(206).chr(207).chr(209).chr(210)
                .chr(211).chr(212).chr(213).chr(214).chr(216).chr(217).chr(218)
                .chr(219).chr(220).chr(221).chr(224).chr(225).chr(226).chr(227)
                .chr(228).chr(229).chr(231).chr(232).chr(233).chr(234).chr(235)
                .chr(236).chr(237).chr(238).chr(239).chr(241).chr(242).chr(243)
                .chr(244).chr(245).chr(246).chr(248).chr(249).chr(250).chr(251)
                .chr(252).chr(253).chr(255);

            $chars['out'] = "EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy";

            $string = strtr($string, $chars['in'], $chars['out']);
            $double_chars['in'] = array(chr(140), chr(156), chr(198), chr(208), chr(222), chr(223), chr(230), chr(240), chr(254));
            $double_chars['out'] = array('OE', 'oe', 'AE', 'DH', 'TH', 'ss', 'ae', 'dh', 'th');
            $string = str_replace($double_chars['in'], $double_chars['out'], $string);
        }

        return $string;
    }
1037785
function highlight_html ( $code )
		{
			$code  =  htmlentities($code);
			$code  =  preg_replace('/([a-zA-Z_]+)=/',  '<font color="#FF0000">$1=</font>',  $code);
			$code  =  preg_replace('/(&lt;[\/a-zA-Z0-9&;]+)/',  '<font color="#0000FF">$1</font>',  $code);
			$code  =  str_replace('&lt;!--',  '<font color="#008080">&lt;!--',  $code);
			$code  =  str_replace('--&gt;',  '--&gt;</font>',  $code);
			$code  =  preg_replace('/[\r\n]+/',  "\n",  $code);
			return $code;
		}
493679
public function bootstrap()
    {
        $version = '';

        preg_match('#^WP-CLI (.*)$#', $this->wpcli('cli', 'version')['stdout'], $match);
        if (! empty($match)) {
            $version = array_pop($match);
        }

        if (! version_compare($version, '1.5.0', '>=')) {
            throw new RuntimeException('[W100] Your WP-CLI is too old; version 1.5.0 or newer is required.');
        }

        $status = $this->wpcli('core', 'is-installed')['exit_code'];
        if ($status !== 0) {
            throw new RuntimeException('[W101] WordPress does not seem to be installed. Check "path" and/or "alias" settings in behat.yml.');
        }

        putenv('WP_CLI_STRICT_ARGS_MODE=1');

        $this->is_bootstrapped = true;
    }
320922
function parseUrl(wpUrl) { //from node-wordpress
  var urlParts, secure;

  // allow URLs without a protocol
  if ( !(/\w+:\/\//.test( wpUrl ) ) ) {
    wpUrl = "http://" + wpUrl;
  }
  urlParts = url.parse( wpUrl );
  secure = urlParts.protocol === "https:";

  return {
    host: urlParts.hostname,
    port: urlParts.port || (secure ? 443 : 80),
    path: urlParts.path.replace( /\/+$/, "" ) + "/xmlrpc.php",
    secure: secure
  };
}
223471
function code_header() {
    $lines = array(
      "@file",
      $this->fileDocblockSummary(),
    );
    $code = $this->docBlock($lines);
    // Blank line after the file docblock.
    $code[] = '';
    return $code;
  }
470641
static function highlight ($code)
  {
    $o = highlight_string ("<?php;$code ?>", true);
    $o = str_extract ($o, '%php</span>.*?</span>(.*)<span[^>]*>\?&gt;%s');
    return $o !== '' ? $o : $code;
  }
725558
function parseHTML(html) {
	var temp = [];

	function push(code, type, padding) {
		code = code.replace(/\n/g, '');
		if (padding) {
			temp.push({code: code, type: type, padding: padding});
		} else {
			temp.push({code: code, type: type});
		}
	}

	function dig(nodes) {
		for (var i = 0; i < nodes.length; i ++) {
			var node = nodes[i];
			switch (node.type) {
				case 'comment':
				break;

				case 'text':
				var words = trim(node.raw).split(' ');
				for (var j = 0, jj = words.length; j < jj; j++) {
					push(words[j] + (j + 1 == jj ? '' : ' '), 'text');
				}
				break;

				case 'directive':
				push('<' + node.raw + '>', 'tag');
				break;

				default:
				var tag = node.name;
				var attribs = node.attribs || {};

				push('<' + tag, 'tag', paddingHTML);
				for (var key in attribs) {
					push(' ' + key + '="' + attribs[key] + '"', 'tag', paddingHTML);
				}
				push('>', 'tag');

				switch (tag) {
					case 'br':
					case 'input':
					case 'hr':
					case 'link':
					case 'meta':
					case 'img':
					case 'embed':
					case 'param':
					case 'area':
					case 'base':
					case 'col':
					case 'keygen':
					case 'source':
					continue;

					case 'script':
					if ((!attribs.type || attribs.type == 'text/javascript') && node.children && node.children[0]) {
						temp = temp.concat(parseJS(node.children[0].raw));
					}
					break;

					case 'style':
					if ((!attribs.type || attribs.type == 'text/css') && node.children && node.children[0]) {
						temp = temp.concat(parseCSS(node.children[0].raw));
					}
					break;

					default:
					if (node.children) dig(node.children);
				}

				push('</' + tag + '>', 'tag')
			}
		}
	}

	var handler = new htmlparser.DefaultHandler(function (error, dom) {});
	new htmlparser.Parser(handler).parseComplete(html);
	dig(handler.dom);

	var nodes = [];
	for (var i = 0, j = 0, ii = temp.length, lastType; i < ii; i++) {
		var tmp = temp[i];
		if (i && (lastType == tmp.type || !tmp.type)) {
			nodes[++j] = tmp;
		} else {
			if (!nodes[j]) {
				nodes[j] = tmp;
			} else {
				nodes[j].code += tmp.code;
				nodes[j].padding = tmp.padding;
			}
		}
		lastType = tmp.type;
	}
	return nodes;
}
968297
public String groupHtml(CmsWorkplace wp) {

        List<CmsTool> subTools = OpenCms.getWorkplaceManager().getToolManager().getToolsForPath(
            wp,
            getHandler().getPath(),
            false);
        Iterator<CmsTool> itSubTools = subTools.iterator();
        m_container.clear();
        while (itSubTools.hasNext()) {
            CmsTool subTool = itSubTools.next();
            // locate group
            CmsToolGroup group = null;
            String groupName = CmsToolMacroResolver.resolveMacros(subTool.getHandler().getGroup(), wp);

            // in the parent tool
            group = getToolGroup(groupName);
            if (group == null) {
                // if does not exist, create it
                String gid = "group" + getToolGroups().size();
                group = new CmsToolGroup(gid, groupName);
                addToolGroup(group, subTool.getHandler().getPosition());
            }

            // add to group
            group.addAdminTool(subTool, subTool.getHandler().getPosition());

        }

        StringBuffer html = new StringBuffer(512);
        Iterator<CmsToolGroup> itHtml = getToolGroups().iterator();
        while (itHtml.hasNext()) {
            CmsToolGroup group = itHtml.next();
            html.append(group.groupHtml(wp));
        }
        return CmsToolMacroResolver.resolveMacros(html.toString(), wp);
    }
459375
function admin_footer()
	{
		// vars
		$version = apply_filters('acf/get_info', 'version');
		$dir = apply_filters('acf/get_info', 'dir');
		$path = apply_filters('acf/get_info', 'path');
		$show_tab = isset($_GET['info']);
		$tab = isset($_GET['info']) ? $_GET['info'] : 'changelog';
		
		?>
<script type="text/html" id="tmpl-acf-column-2">
<div class="acf-column-2">
	<div class="wp-box">
		<div class="inner">
			<h2><?php _e("Advanced Custom Fields",'acf'); ?> <?php echo $version; ?></h2>

			<h3><?php _e("Changelog",'acf'); ?></h3>
			<p><?php printf(__('See what\'s new in %1$sversion %2$s%3$s','acf'),'<a href="'.admin_url('edit.php?post_type=acf&info=changelog').'">',$version,'</a>'); ?></p>
			
			<h3><?php _e("Resources",'acf'); ?></h3>
			<ul>
				<li><a href="http://www.advancedcustomfields.com/resources/#getting-started" target="_blank"><?php _e("Getting Started",'acf'); ?></a></li>
				<li><a href="http://www.advancedcustomfields.com/resources/#field-types" target="_blank"><?php _e("Field Types",'acf'); ?></a></li>
				<li><a href="http://www.advancedcustomfields.com/resources/#functions" target="_blank"><?php _e("Functions",'acf'); ?></a></li>
				<li><a href="http://www.advancedcustomfields.com/resources/#actions" target="_blank"><?php _e("Actions",'acf'); ?></a></li>
				<li><a href="http://www.advancedcustomfields.com/resources/#filters" target="_blank"><?php _e("Filters",'acf'); ?></a></li>
				<li><a href="http://www.advancedcustomfields.com/resources/#how-to" target="_blank"><?php _e("'How to' guides",'acf'); ?></a></li>
				<li><a href="http://www.advancedcustomfields.com/resources/#tutorials" target="_blank"><?php _e("Tutorials",'acf'); ?></a></li>
			</ul>
		</div>
		<div class="footer footer-blue">
			<ul class="hl">
				<li><?php _e("Created by",'acf'); ?> Elliot Condon</li>
			</ul>
		</div>
	</div>
</div>
</script>
<script type="text/html" id="tmpl-acf-about">
<!-- acf-about -->
<div id="acf-about" class="acf-content">
	
	<!-- acf-content-title -->
	<div class="acf-content-title">
		<h1><?php _e("Welcome to Advanced Custom Fields",'acf'); ?> <?php echo $version; ?></h1>
		<h2><?php _e("Thank you for updating to the latest version!",'acf'); ?> <br /><?php printf(__('ACF %s is more polished and enjoyable than ever before. We hope you like it.','acf'),$version); ?></h2>
	</div>
	<!-- / acf-content-title -->
	
	<!-- acf-content-body -->
	<div class="acf-content-body">
		<h2 class="nav-tab-wrapper">
			<a class="acf-tab-toggle nav-tab <?php if( $tab == 'whats-new' ){ echo 'nav-tab-active'; } ?>" href="<?php echo admin_url('edit.php?post_type=acf&info=whats-new'); ?>"><?php _e("What’s New",'acf'); ?></a>
			<a class="acf-tab-toggle nav-tab <?php if( $tab == 'changelog' ){ echo 'nav-tab-active'; } ?>" href="<?php echo admin_url('edit.php?post_type=acf&info=changelog'); ?>"><?php _e("Changelog",'acf'); ?></a>
			<?php if( $tab == 'download-add-ons' ): ?>
			<a class="acf-tab-toggle nav-tab nav-tab-active" href="<?php echo admin_url('edit.php?post_type=acf&info=download-add-ons'); ?>"><?php _e("Download Add-ons",'acf'); ?></a>
			<?php endif; ?>
		</h2>

<?php if( $tab == 'whats-new' ): 
		
		$activation_codes = array(
			'repeater' => get_option('acf_repeater_ac', ''),
			'gallery' => get_option('acf_gallery_ac', ''),
			'options_page' => get_option('acf_options_page_ac', ''),
			'flexible_content' => get_option('acf_flexible_content_ac', '')
		);
		
		$active = array(
			'repeater' => class_exists('acf_field_repeater'),
			'gallery' => class_exists('acf_field_gallery'),
			'options_page' => class_exists('acf_options_page_plugin'),
			'flexible_content' => class_exists('acf_field_flexible_content')
		);
		
		$update_required = false;
		$update_complete = true;
		
		foreach( $activation_codes as $k => $v )
		{
			if( $v )
			{
				$update_required = true;
				
				if( !$active[ $k ] )
				{
					$update_complete = false;
				}
			}
		}
		
		
		?>

		<table id="acf-add-ons-table" class="alignright">
			<tr>
				<td><img src="<?php echo $dir; ?>images/add-ons/repeater-field-thumb.jpg" /></td>
				<td><img src="<?php echo $dir; ?>images/add-ons/gallery-field-thumb.jpg" /></td>
			</tr>
			<tr>
				<td><img src="<?php echo $dir; ?>images/add-ons/options-page-thumb.jpg" /></td>
				<td><img src="<?php echo $dir; ?>images/add-ons/flexible-content-field-thumb.jpg" /></td>
			</tr>
		</table>
		
		<div style="margin-right: 300px;">
	
			<h3><?php _e("Add-ons",'acf'); ?></h3>
			
			<h4><?php _e("Activation codes have grown into plugins!",'acf'); ?></h4>
			<p><?php _e("Add-ons are now activated by downloading and installing individual plugins. Although these plugins will not be hosted on the wordpress.org repository, each Add-on will continue to receive updates in the usual way.",'acf'); ?></p>
			
			
			<?php if( $update_required ): ?>
				<?php if( $update_complete ): ?>
				<div class="acf-alert acf-alert-success">
					<p><?php _e("All previous Add-ons have been successfully installed",'acf'); ?></p>
				</div>
				<?php else: ?>
				<div class="acf-alert acf-alert-success">
					<p><?php _e("This website uses premium Add-ons which need to be downloaded",'acf'); ?> <a href="<?php echo admin_url('edit.php?post_type=acf&info=download-add-ons'); ?>" class="acf-button" style="display: inline-block;"><?php _e("Download your activated Add-ons",'acf'); ?></a></p>
				</div>
				<?php endif; ?>
			<?php else: ?>
			<div class="acf-alert acf-alert-success">
				<p><?php _e("This website does not use premium Add-ons and will not be affected by this change.",'acf'); ?></p>
			</div>
			<?php endif; ?>
			
		</div>
		
		<div class="clear"></div>
		
		<hr />
		
		<h3><?php _e("Easier Development",'acf'); ?></h3>
		
		<h4><?php _e("New Field Types",'acf'); ?></h4>
		<ul>
			<li><?php _e("Taxonomy Field",'acf'); ?></li>
			<li><?php _e("User Field",'acf'); ?></li>
			<li><?php _e("Email Field",'acf'); ?></li>
			<li><?php _e("Password Field",'acf'); ?></li>
		</ul>
		<h4><?php _e("Custom Field Types",'acf'); ?></h4>
		<p><?php _e("Creating your own field type has never been easier! Unfortunately, version 3 field types are not compatible with version 4.",'acf'); ?><br />
		<?php printf(__('Migrating your field types is easy, please %sfollow this tutorial%s to learn more.','acf'),'<a href="http://www.advancedcustomfields.com/docs/tutorials/creating-a-new-field-type/" target="_blank">','</a>'); ?></p>
		
		<h4><?php _e("Actions &amp; Filters",'acf'); ?></h4>
		<p><?php printf(__('All actions & filters have received a major facelift to make customizing ACF even easier! Please %sread this guide%s to find the updated naming convention.','acf'),'<a href="http://www.advancedcustomfields.com/resources/getting-started/migrating-from-v3-to-v4/" target="_blank">','</a>'); ?></p>
		
		<h4><?php _e("Preview draft is now working!",'acf'); ?></h4>
		<p><?php _e("This bug has been squashed along with many other little critters!",'acf'); ?> <a class="acf-tab-toggle" href="<?php echo admin_url('edit.php?post_type=acf&info=changelog'); ?>" data-tab="2"><?php _e("See the full changelog",'acf'); ?></a></p>
		
		<hr />
		
		<h3><?php _e("Important",'acf'); ?></h3>
		
		<h4><?php _e("Database Changes",'acf'); ?></h4>
		<p><?php _e("Absolutely <strong>no</strong> changes have been made to the database between versions 3 and 4. This means you can roll back to version 3 without any issues.",'acf'); ?></p>
		
		<h4><?php _e("Potential Issues",'acf'); ?></h4>
		<p><?php printf(__('Due to the sizable changes surounding Add-ons, field types and action/filters, your website may not operate correctly. It is important that you read the full %sMigrating from v3 to v4%s guide to view the full list of changes.','acf'),'<a href="http://www.advancedcustomfields.com/resources/getting-started/migrating-from-v3-to-v4/" target="_blank">','</a>'); ?></p>
		
		<div class="acf-alert acf-alert-error">
			<p><strong><?php _e("Really Important!",'acf'); ?></strong> <?php printf(__('If you updated the ACF plugin without prior knowledge of such changes, please roll back to the latest %sversion 3%s of this plugin.','acf'),'<a href="http://wordpress.org/extend/plugins/advanced-custom-fields/developers/">','</a>'); ?></p>
		</div>
		
		<hr />
		
		<h3><?php _e("Thank You",'acf'); ?></h3>
		<p><?php _e("A <strong>BIG</strong> thank you to everyone who has helped test the version 4 beta and for all the support I have received.",'acf'); ?></p>
		<p><?php _e("Without you all, this release would not have been possible!",'acf'); ?></p>

<?php elseif( $tab == 'changelog' ): ?>
		
		<h3><?php _e("Changelog for",'acf'); ?> <?php echo $version; ?></h3>
		<?php
		
		$items = file_get_contents( $path . 'readme.txt' );
		$items = explode('= ' . $version . ' =', $items);
		
		$items = end( $items );
		$items = current( explode("\n\n", $items) );
		$items = array_filter( array_map('trim', explode("*", $items)) );
		
		?>
		<ul class="acf-changelog">
		<?php foreach( $items as $item ): 
			
			$item = explode('http', $item);
				
		?>
			<li><?php echo $item[0]; ?><?php if( isset($item[1]) ): ?><a href="http<?php echo $item[1]; ?>" target="_blank"><?php _e("Learn more",'acf'); ?></a><?php endif; ?></li>
		<?php endforeach; ?>
		</ul>

<?php elseif( $tab == 'download-add-ons' ): ?>
		
		<h3><?php _e("Overview",'acf'); ?></h3>
		
		<p><?php _e("Previously, all Add-ons were unlocked via an activation code (purchased from the ACF Add-ons store). New to v4, all Add-ons act as separate plugins which need to be individually downloaded, installed and updated.",'acf'); ?></p>
		
		<p><?php _e("This page will assist you in downloading and installing each available Add-on.",'acf'); ?></p>
		
		<h3><?php _e("Available Add-ons",'acf'); ?></h3>
		
		<p><?php _e("The following Add-ons have been detected as activated on this website.",'acf'); ?></p>
		
		<?php 
		
		$ac_repeater = get_option('acf_repeater_ac', '');
		$ac_options_page = get_option('acf_options_page_ac', '');
		$ac_flexible_content = get_option('acf_flexible_content_ac', '');
		$ac_gallery = get_option('acf_gallery_ac', '');
		
		?>
		<table class="widefat" id="acf-download-add-ons-table">
			<thead>
			<tr>
				<th colspan="2"><?php _e("Name",'acf'); ?></th>
				<th><?php _e("Activation Code",'acf'); ?></th>
				<th><?php _e("Download",'acf'); ?></th>
			</tr>
			</thead>
			<tbody>
			<?php if( $ac_repeater ): ?>
			<tr>
				<td class="td-image"><img src="<?php echo $dir; ?>images/add-ons/repeater-field-thumb.jpg" style="width:50px" /></td>
				<th class="td-name"><?php _e("Repeater Field",'acf'); ?></th>
				<td class="td-code">XXXX-XXXX-XXXX-<?php echo substr($ac_repeater,-4); ?></td>
				<td class="td-download"><a class="button" href="http://download.advancedcustomfields.com/<?php echo $ac_repeater; ?>/trunk"><?php _e("Download",'acf'); ?></a></td>
			</tr>
			<?php endif; ?>
			<?php if( $ac_gallery ): ?>
			<tr>
				<td><img src="<?php echo $dir; ?>images/add-ons/gallery-field-thumb.jpg" /></td>
				<th><?php _e("Gallery Field",'acf'); ?></th>
				<td>XXXX-XXXX-XXXX-<?php echo substr($ac_gallery,-4); ?></td>
				<td><a class="button" href="http://download.advancedcustomfields.com/<?php echo $ac_gallery; ?>/trunk"><?php _e("Download",'acf'); ?></a></td>
			</tr>	
			<?php endif; ?>
			<?php if( $ac_options_page ): ?>
			<tr>
				<td><img src="<?php echo $dir; ?>images/add-ons/options-page-thumb.jpg" /></td>
				<th><?php _e("Options Page",'acf'); ?></th>
				<td>XXXX-XXXX-XXXX-<?php echo substr($ac_options_page,-4); ?></td>
				<td><a class="button" href="http://download.advancedcustomfields.com/<?php echo $ac_options_page; ?>/trunk"><?php _e("Download",'acf'); ?></a></td>
			</tr>
			<?php endif; ?>
			<?php if($ac_flexible_content): ?>
			<tr>
				<td><img src="<?php echo $dir; ?>images/add-ons/flexible-content-field-thumb.jpg" /></td>
				<th><?php _e("Flexible Content",'acf'); ?></th>
				<td>XXXX-XXXX-XXXX-<?php echo substr($ac_flexible_content,-4); ?></td>
				<td><a class="button" href="http://download.advancedcustomfields.com/<?php echo $ac_flexible_content; ?>/trunk"><?php _e("Download",'acf'); ?></a></td>
			</tr>
			<?php endif; ?>
			</tbody>
		</table>
		
		
		
		<h3><?php _e("Installation",'acf'); ?></h3>
		
		<p><?php _e("For each Add-on available, please perform the following:",'acf'); ?></p>
		<ol>
			<li><?php _e("Download the Add-on plugin (.zip file) to your desktop",'acf'); ?></li>
			<li><?php printf(__('Navigate to %sPlugins > Add New > Upload%s','acf'),'<a target="_blank" href="'.admin_url('plugin-install.php?tab=upload').'">','</a>'); ?></li>
			<li><?php _e("Use the uploader to browse, select and install your Add-on (.zip file)",'acf'); ?></li>
			<li><?php _e("Once the plugin has been uploaded and installed, click the 'Activate Plugin' link",'acf'); ?></li>
			<li><?php _e("The Add-on is now installed and activated!",'acf'); ?></li>
		</ol>
		
		
<?php endif; ?>

		
	</div>
	<!-- / acf-content-body -->
	
	
	<!-- acf-content-footer -->
	<div class="acf-content-footer">
		<ul class="hl clearfix">
			<li><a class="acf-button acf-button-big" href="<?php echo admin_url('edit.php?post_type=acf'); ?>"><?php _e("Awesome. Let's get to work",'acf'); ?></a></li>
		</ul>
	</div>
	<!-- / acf-content-footer -->
	
	
	
</div>
<!-- / acf-about -->
</script>
<script type="text/javascript">
(function($){
	
	// wrap
	$('#wpbody .wrap').attr('id', 'acf-field-group-wrap');
	
	
	// wrap column main
	$('#acf-field-group-wrap').wrapInner('<div class="acf-columns-2" />');
	
	
	// add column main
	$('#posts-filter').addClass('acf-column-1');
	
	
	// add column side
	$('#posts-filter').after( $('#tmpl-acf-column-2').html() );
	
	
	<?php if( $show_tab ): ?>
	// add about copy
	$('#wpbody-content').prepend( $('#tmpl-acf-about').html() );
	$('#acf-field-group-wrap').hide();
	$('#screen-meta-links').hide();
	<?php endif; ?>
	
})(jQuery);
</script>
		<?php
	}
478917
function html_php()
	{
		
		?>
<div class="wp-box">
	<div class="title">
		<h3><?php _e("Export Field Groups to PHP",'acf'); ?></h3>
	</div>
	<table class="acf_input widefat">
		<tr>
			<td class="label">
<h3><?php _e("Instructions",'acf'); ?></h3>
<ol>
	<li><?php _e("Copy the PHP code generated",'acf'); ?></li>
	<li><?php _e("Paste into your functions.php file",'acf'); ?></li>
	<li><?php _e("To activate any Add-ons, edit and use the code in the first few lines.",'acf'); ?></li>
</ol>

<p><br /></p>

<h3><?php _e("Notes",'acf'); ?></h3>
<p><?php _e("Registered field groups <b>will not</b> appear in the list of editable field groups. This is useful for including fields in themes.",'acf'); ?></p>
<p><?php _e("Please note that if you export and register field groups within the same WP, you will see duplicate fields on your edit screens. To fix this, please move the original field group to the trash or remove the code from your functions.php file.",'acf'); ?></p>


<p><br /></p>

<h3><?php _e("Include in theme",'acf'); ?></h3>
<p><?php _e("The Advanced Custom Fields plugin can be included within a theme. To do so, move the ACF plugin inside your theme and add the following code to your functions.php file:",'acf'); ?></p>

<pre>
include_once('advanced-custom-fields/acf.php');
</pre>

<p><?php _e("To remove all visual interfaces from the ACF plugin, you can use a constant to enable lite mode. Add the following code to your functions.php file <b>before</b> the include_once code:",'acf'); ?></p>

<pre>
define( 'ACF_LITE', true );
</pre>
 
<p><br /></p>

<p><a href="">&laquo; <?php _e("Back to export",'acf'); ?></a></p>
			</td>
			<td>
				<textarea class="pre" readonly="true"><?php
		
		$acfs = array();
		
		if( isset($_POST['acf_posts']) )
		{
			$acfs = get_posts(array(
				'numberposts' 	=> -1,
				'post_type' 	=> 'acf',
				'orderby' 		=> 'menu_order title',
				'order' 		=> 'asc',
				'include'		=>	$_POST['acf_posts'],
				'suppress_filters' => false,
			));
		}
		if( $acfs )
		{
			?>
if(function_exists("register_field_group"))
{
<?php
			foreach( $acfs as $i => $acf )
			{
				// populate acfs
				$var = array(
					'id' => $acf->post_name,
					'title' => $acf->post_title,
					'fields' => apply_filters('acf/field_group/get_fields', array(), $acf->ID),
					'location' => apply_filters('acf/field_group/get_location', array(), $acf->ID),
					'options' => apply_filters('acf/field_group/get_options', array(), $acf->ID),
					'menu_order' => $acf->menu_order,
				);
				
				
				$var['fields'] = apply_filters('acf/export/clean_fields', $var['fields']);


				// create html
				$html = var_export($var, true);
				
				// change double spaces to tabs
				$html = str_replace("  ", "\t", $html);
				
				// correctly formats "=> array("
				$html = preg_replace('/([\t\r\n]+?)array/', 'array', $html);
				
				// Remove number keys from array
				$html = preg_replace('/[0-9]+ => array/', 'array', $html);
				
				// add extra tab at start of each line
				$html = str_replace("\n", "\n\t", $html);
				
				// add the WP __() function to specific strings for translation in theme
				//$html = preg_replace("/'label'(.*?)('.*?')/", "'label'$1__($2)", $html);
				//$html = preg_replace("/'instructions'(.*?)('.*?')/", "'instructions'$1__($2)", $html);
				
								
?>	register_field_group(<?php echo $html ?>);
<?php
			}
?>
}
<?php
		}
		else
		{
			_e("No field groups were selected",'acf');
		}
				?></textarea>
			</td>
		</tr>
	</table>
</div>
<script type="text/javascript">
(function($){
	
	var i = 0;
	
	$(document).on('click', 'textarea.pre', function(){
		
		if( i == 0 )
		{
			i++;
			
			$(this).focus().select();
			
			return false;
		}
				
	});
	
	$(document).on('keyup', 'textarea.pre', function(){
	
	    $(this).height( 0 );
	    $(this).height( this.scrollHeight );
	
	});

	$(document).ready(function(){
		
		$('textarea.pre').trigger('keyup');

	});

})(jQuery);
</script>
	<?php
	}
1098360
function highlightCode(highlight, $) {
    return editHTMLElement($, 'code', function($code) {
        var classNames = ($code.attr('class') || '').split(' ');
        var lang = getLanguageForClass(classNames);
        var source = $code.text();

        return Promise(highlight(lang, source))
        .then(function(r) {
            if (is.string(r.html)) {
                $code.html(r.html);
            } else {
                $code.text(r.text);
            }
        });
    });
}
624178
function( HTMLCode ){
        var $ = cheerio.load( HTMLCode, { decodeEntities: false } );

        _.forEach(
            {
                a: "href",
                img: "src",
                link: "href",
                script: "src"
            },
            function( attr, tagName ){
                $( tagName + "[" + attr + "]" ).each( function( index, elm ){
                    var testValue = $( elm ).attr( attr );
                    if( testValue.match( /^(#|\/|http:\/\/|https:\/\/|tel:|mailto:)/ ) ){ return; }
                    $( elm ).attr( attr, "<%- __normalizePath__( \"" + this.convertResourcePathAbsolute( testValue ).replace( /\\/g, "\\\\" ) + "\" ) %>" );
                }.bind( this ) );
            },
            this
        );

        return $.html();
    }
1003489
public function activate()
    {
        $muPluginDir = WP_CONTENT_DIR . '/mu-plugins';

        if (!is_dir($muPluginDir)) {
            wp_mkdir_p($muPluginDir);
        }

        if (!is_dir($this->destination)) {
            wp_mkdir_p($this->destination);
        }

        $data = "<?php\n"
              . "/*\n"
              . "Plugin Name: StaticWP MU\n"
              . "Description: Converts your blog into a static site. This part of StaticWP"
                          . " allows StaticWP to bypass as much Wordpress as possible.\n"
              . "Author: Shane Logsdon\n"
              . 'Version: ' . STATICWP_VERSION . "\n"
              . "Author URI: http://www.slogsdon.com/\n"
              . "License: MIT\n"
              . "*/\n"
              . "\n"
              . "require_once '" . plugin_dir_path($this->file) . $this->plugin . ".php';\n";
        file_put_contents($muPluginDir . '/' . $this->plugin . '-mu.php', $data);

        // Can't use View::page :(
        $notice = 'Thanks for installing StaticWP! Might we suggest <a href="'
                . self::url('preload')
                . '">preloading your site</a>?';
        $this->addNotice($notice);
    }
478999
static function viewCatalogUrl() {

		if ( isset( $_REQUEST['user_id'] ) ) {

			if ( false === current_user_can( 'edit_user', (int) $_REQUEST['user_id'] ) ) {
				wp_die( __( 'You do not have permission to do that.' ) );
			}

			$u = get_userdata( (int) $_REQUEST['user_id'] );
			if ( false === $u ) {
				wp_die( __( 'The requested user does not exist.' ) );
			}

			$user_login = get_userdata( (int) $_REQUEST['user_id'] )->user_login;
		} else {
			$user_login = get_userdata( get_current_user_id() )->user_login;
		}

		$view_url = network_home_url( "/catalog/$user_login" );

		return $view_url;
	}
1158412
function(code) {

		var tokens = new TokenStream(code),
			hasCRLF = code.indexOf("\r") > -1,
			lines = code.split(/\r?\n/),
			line,
			token,
			tt,
			replacement,
			colAdjust = 0,
			lastLine = 0;

		while ((tt = tokens.get()) !== 0) {
			token = tokens.token();

			if (tt === Tokens.URI) { // URI

				if (lastLine !== token.startLine) {
					colAdjust = 0;
					lastLine = token.startLine;
				}

				replacement = this.replacer(token.value.replace(URL_PARENS, ""));

				// 5 is for url() characters
				line = lines[token.startLine - 1];
				lines[token.startLine - 1] = line.substring(0, token.startCol + colAdjust - 1) +
					"url(" + replacement + ")" + line.substring(token.endCol + colAdjust - 1);
				colAdjust += ((replacement.length + 5) - token.value.length);
			}
		}

		return lines.join(hasCRLF ? "\r\n" : "\n");
	}
130165
function wxappEntry() {

  const regex = /src\/pages\/([^\/]+)\/[^\.]+.js/;
  
  return {
    entry: () => {

      let pages = {}
      let core = []

      glob.sync(`./src/pages/**/*.js`).forEach(x => {
        const name = x.match(regex)[1]
        const key = `pages/${name}/${name}`
        pages[key] = x
      })

      return Object.assign({}, pages, {
        app: [
          //'webpack-dev-server/client',
          //'webpack/hot/only-dev-server',
          './src/app.js'
        ]
      })
    }
  }
}
1318922
function compile() {
		$code = $this->match_code($this->value) ;

		$id = $this->varid() ;

		if ( $this->optional ) {
			$code = PHPBuilder::build()
				->l(
				$this->save($id),
				$code->replace( array( 'FAIL' => $this->restore($id,true) ))
				);
		}

		if ( $this->zero_or_more ) {
			$code = PHPBuilder::build()
				->b( 'while (true)',
					$this->save($id),
					$code->replace( array(
						'MATCH' => NULL,
						'FAIL' =>
							$this->restore($id,true)
							->l( 'break;' )
					))
				)
				->l(
				'MATCH'
				);
		}

		if ( $this->one_or_more ) {
			$code = PHPBuilder::build()
				->l(
				'$count = 0;'
				)
				->b( 'while (true)',
					$this->save($id),
					$code->replace( array(
						'MATCH' => NULL,
						'FAIL' =>
							$this->restore($id,true)
							->l( 'break;' )
					)),
					'$count += 1;'
				)
				->b( 'if ($count > 0)', 'MATCH' )
				->b( 'else',            'FAIL' );
		}

		if ( $this->positive_lookahead ) {
			$code = PHPBuilder::build()
				->l(
				$this->save($id),
				$code->replace( array(
					'MATCH' =>
						$this->restore($id)
						->l( 'MATCH' ),
					'FAIL' =>
						$this->restore($id)
						->l( 'FAIL' )
				)));
		}

		if ( $this->negative_lookahead ) {
			$code = PHPBuilder::build()
				->l(
				$this->save($id),
				$code->replace( array(
					'MATCH' =>
						$this->restore($id)
						->l( 'FAIL' ),
					'FAIL' =>
						$this->restore($id)
						->l( 'MATCH' )
				)));
		}

		if ( $this->tag && !($this instanceof TokenRecurse ) ) {
			$code = PHPBuilder::build()
				->l(
				'$stack[] = $result; $result = $this->construct( $matchrule, "'.$this->tag.'" ); ',
				$code->replace(array(
					'MATCH' => PHPBuilder::build()
						->l(
						'$subres = $result; $result = array_pop($stack);',
						'$this->store( $result, $subres, \''.$this->tag.'\' );',
						'MATCH'
						),
					'FAIL' => PHPBuilder::build()
						->l(
						'$result = array_pop($stack);',
						'FAIL'
						)
				)));
		}

		return $code ;
	}