';
// Get WPG2 Options
$wpg2_option = get_option('wpg2_options');
if ($wpg2_option['g2_embedpageid'] == $wpg2_editedpageid) {
//echo 'Debug: Inside of wpg2_template_pagechanges
';
// Grab New Page Title, Name
$wpg2_option['wpg2_pagetitle'] = $_POST['post_title'];
$wpg2_option['wpg2_pagename'] = $_POST['post_name'];
update_option('wpg2_options', $wpg2_option);
// Rebuild Everything
wpg2_template_rewritechanges(TRUE);
$ret = wpg2_g2rewritesvalidate('silent',$wpg2_option);
}
//echo 'Debug: End of wpg2_template_pagechanges
';
}
/**
* Function Hook on Wordpress Page Deletes
* Sets WPG2 Output Page to the external Gallery2 main.php as WPG2 can no longer display output via internal Wordpress Page
*
* @param NULL
* @return NULL
*/
function wpg2_template_pagedeletes($wpg2_deletepageid) {
//echo 'Debug: Start of wpg2_template_pagedeletes
';
// Get WPG2 Options
$wpg2_option = get_option('wpg2_options');
if ($wpg2_option['g2_embedpageid'] == $wpg2_deletepageid) {
//echo 'Debug: Inside of wpg2_template_pagedeletes
';
$wpg2_option['g2_embedpageid'] = "";
$wpg2_option['g2_embedpagetype'] = "gallery2";
update_option('wpg2_options', $wpg2_option);
// Rebuild Everything
wpg2_template_rewritechanges(TRUE);
$ret = wpg2_g2rewritesvalidate('silent',$wpg2_option);
}
//echo 'Debug: End of wpg2_template_pagedeletes
';
}
/**
* Creates a Wordpress Page
*
* @param array string $WPG2 Page Title, string $WPG2 Page Name
* @return integer $createdpageid
*/
function wpg2_wppagecreate($wpg2_pagetitle='WPG2',$wpg2_pagename='wpg2') {
global $user_ID;
// Create New Gallery2 Output Page
$wpg2_createdpageid = wp_insert_post(array(
'post_author' => $user_ID,
'post_title' => $wpg2_pagetitle,
'post_name' => $wpg2_pagename,
'post_status' => "publish",
'post_type' => "page",
'comment_status' => "closed",
'ping_status' => " ",
'post_content' => "WPG2 Internal Page
Your Gallery2 Content will be Displayed Here.
If you delete this page, WPG2 will revert to linking directly to your Gallery2 main page."
));
return $wpg2_createdpageid;
}
/**
* Updates a Wordpress Page
*
* @param array integer $post_ID, string $WPG2 Page Title, string $WPG2 Page Name
* @return NULL
*/
function wpg2_wppageupdate($wpg2_pageid,$wpg2_pagetitle,$wpg2_pagename) {
global $user_ID;
wp_insert_post(array(
'ID' => $wpg2_pageid,
'post_title' => $wpg2_pagetitle,
'post_name' => $wpg2_pagename,
'post_author' => $user_ID,
'post_status' => "publish",
'post_type' => "page",
'comment_status' => "closed",
'ping_status' => " ",
'post_content' => "WPG2 Internal Page
Your Gallery2 Content will be Displayed Here.
If you delete this page, WPG2 will revert to linking directly to your Gallery2 main page."
));
}
/**
* Function Hook to Update the Location of the WPG2 Output Template
* Dynamically Updates the G2URI
*
* @param NULL
* @return NULL
*/
function wpg2_template_page($wpg2safemode=null) {
// SAFE Mode = No Permalinks, No Gallery2 Rewrite Rules are Active
global $wp_rewrite;
$wpg2_option = get_option('wpg2_options');
$wpg2_g2path = get_option('wpg2_g2paths');
$wpembedpageid = $wpg2_option['g2_embedpageid'];
// Set the URI Path depending on what Page Type
//echo 'Debug: Start of wpg2_template_page
';
if ($wpg2_option['g2_embedpagetype'] == 'gallery2')
$wpg2_g2path['g2_embeduri'] = $wpg2_g2path['g2_url']."main.php";
else {
$wppagestruct = $wp_rewrite->get_page_permastruct();
if ( '' == $wppagestruct || $wpg2safemode ) {
$wpg2_g2path['g2_embeduri'] = get_option('home') . "/?page_id=$wpembedpageid";
} else {
$wpg2_g2path['g2_embeduri'] = get_permalink($wpembedpageid);
}
}
if ($wpg2safemode && $wpg2_option['g2_rewriteactive'] == 'active' ) {
//echo 'Debug: Inside #1 of wpg2_template_page. Scheduling cron job for wpg2_rebuildrewriterules
';
wp_schedule_single_event( time(), 'wpg2_cron_g2rewritehook');
}
if ($wpg2safemode) {
//echo 'Debug: Inside #2 of wpg2_template_page. Scheduling cron job for wpg2_rebuildg2rewriterules
';
wp_schedule_single_event( time(), 'wpg2_cron_wprewritehook');
}
if ($wpg2_option['g2_rewriteactive'] != '' && $wpg2safemode) {
//echo 'Debug: Inside #3 of wpg2_template_page
';
$wpg2_option['g2_rewriteactive'] = 'safe';
// Update the Options
update_option('wpg2_options', $wpg2_option);
}
update_option('wpg2_g2paths', $wpg2_g2path);
//echo 'Debug: End of wpg2_template_page
';
}
/**
* Function Hook on Wordpress Rewrite Rule Changes
* Trim Ending /'s as Gallery2 Trims URI's prior to / resulting in broken 404 URLS
*
* @param NULL
* @return NULL
*/
function wpg2_trimpermalinkrules() {
//echo 'Debug: Start of wpg2_trimpermalinkrules
';
global $wp_rewrite;
// Verify WP Permalink Rules do not have trailing slashes
$permalink_structure = get_option('permalink_structure');
$category_base = get_option('category_base');
if (!empty($permalink_structure) || !empty($category_base) ) {
//echo 'Debug: Inside #1 of wpg2_trimpermalinkrules
';
if (!empty($permalink_structure)) {
//echo 'Debug: Inside #2 of wpg2_trimpermalinkrules
';
$permalink_structure = rtrim ($permalink_structure, "/");
$wp_rewrite->set_permalink_structure($permalink_structure);
}
if (!empty($category_base)) {
//echo 'Debug: Inside #3 of wpg2_trimpermalinkrules
';
$category_base = rtrim ($category_base, "/");
$wp_rewrite->set_category_base($category_base);
}
}
//echo 'Debug: End of wpg2_trimpermalinkrules
';
}
/**
* Rebuilds Wordpress Ruleset.
*
* @param NULL
* @return NULL
*/
function wpg2_rebuildrewriterules() {
//echo 'Debug: Start of wpg2_rebuildrewriterules
';
global $wp_rewrite;
// Get WPG2 Options
$wpg2_option = get_option('wpg2_options');
wpg2_trimpermalinkrules();
// Verify Rewrite Rules
$permalink_structure = get_option('permalink_structure');
$category_base = get_option('category_base');
if (!empty($permalink_structure) || !empty($category_base) ) {
//echo 'Debug: Inside of wpg2_rebuildrewriterules
';
if (!empty($permalink_structure))
$wp_rewrite->set_permalink_structure($permalink_structure);
if (!empty($category_base))
$wp_rewrite->set_category_base($category_base);
$wp_rewrite->flush_rules();
}
// Verify WPG2 Internal g2_embeduri setting
wpg2_template_page();
//echo 'Debug: End of wpg2_rebuildrewriterules
';
}
/**
* Function Hook on WP Cron Event
* Auto Rebuilds Both Wordpress and Gallery2 Rewrite Rules
*
* @param NULL
* @return NULL
*/
function wpg2_rebuildg2rewriterules() {
//echo 'Debug: Start of wpg2_rebuildg2rewriterules
';
// Get WPG2 Options & Reforce Rewrites to Active Again
$wpg2_option = get_option('wpg2_options');
$wpg2_option['g2_rewriteactive'] = 'active';
update_option('wpg2_options', $wpg2_option);
$ret = wpg2_g2rewritesvalidate('silent',$wpg2_option);
wpg2_rebuildrewriterules();
//echo 'Debug: End of wpg2_rebuildg2rewriterules
';
}
/**
* Function Hook on any updating of Wordpress Permalink Options
* Detactivates Gallery2 Rewrite Module and Forces WPG2 Template to Generate Long Style (SAFE) URL's
*
* @param NULL
* @return NULL
*/
function wpg2_template_rewritechanges($wpg2isinternal=null) {
// Get WPG2 Options
$wpg2_option = get_option('wpg2_options');
if ( strstr( $_SERVER['PHP_SELF'], "options-permalink.php") && ($_POST) || $wpg2isinternal || strstr( $_SERVER['PHP_SELF'], "options-general.php") && ($_GET) ) {
//echo 'Debug: Start of wpg2_template_rewritechanges
';
if ($wpg2_option['g2_rewriteactive'] == 'active') {
//echo 'Debug: Inside #1 of wpg2_template_rewritechanges
';
// Reset Path to WPG2 Output back to Safe Option
wpg2_template_page('safe');
if (!defined('G2INIT')) {
$ret = g2_login();
if ($ret) {
echo '
' . __('Fatal G2 error', 'wpg2') . '
' . __("Here's the error from G2: ", 'wpg2') . $ret->getAsHtml();
exit;
}
}
// Deactivate Rewrite Module as Wordpress Permalink Array will be wrong.
list ($ret, $ignored) = GalleryCoreApi::deactivatePlugin('module', 'rewrite');
//Close Gallery Connection
GalleryEmbed::done();
} else {
if ( strstr( $_SERVER['PHP_SELF'], "options-general.php") && ($_GET) ) {
//echo 'Debug: Inside #2 of wpg2_template_rewritechanges
';
// Reset Path to WPG2 Output back to Safe Option
wpg2_template_page();
}
}
//echo 'Debug: End of wpg2_template_rewritechanges
';
}
}
/**
* Function Hook on Wordpress Rewrite Array
* Adds Gallery2 Rewrite Rules to Wordpress Rewrite Array
*
* @param array $Rules (Wordpress Rewrite Ruleset Array)
* @return NULL
*/
function wpg2_template_rules($wprules) {
//echo 'Debug: Start of wpg2_template_rules
';
$wpg2_option = get_option('wpg2_options');
if ($wpg2_option['g2_rewriteactive']) {
//echo 'Debug: Inside #1 of wpg2_template_rules
';
if (!defined('G2INIT')) {
$ret = g2_login();
if ($ret) {
echo '' . __('Fatal G2 error', 'wpg2') . '
' . __("Here's the error from G2: ", 'wpg2') . $ret->getAsHtml();
exit;
}
}
$wpg2_g2path = get_option('wpg2_g2paths');
$siteUrl = get_option('home');
list ($ret, $activeRules) = GalleryCoreApi::getPluginParameter('module', 'rewrite', 'activeRules');
if (!$ret) {
//echo 'Debug: Inside #2 of wpg2_template_rules
';
$activeRules = unserialize($activeRules);
GalleryCoreApi::requireOnce('modules/rewrite/classes/RewriteHelper.class');
$regexRules = array();
$shortUrls = array();
list ($ret, $parser) = RewriteHelper::getRewriteParser();
if (!$ret) {
if (!empty($activeRules)) {
list ($ret, $code, $regexRules, $shortUrls, $errorId) =
RewriteHelper::parseActiveRules($activeRules, $parser);
if ($ret) {
die;
}
if ($code != REWRITE_STATUS_OK) {
die;
}
}
}
//echo 'Debug: Inside #3 of wpg2_template_rules
';
/* Substitute with what the Gallery URL generator would generate */
$galleryUrlGenerator = new GalleryUrlGenerator();
$galleryUrlGenerator->init($siteUrl . '/index.php?page_id='.$wpg2_option['g2_embedpageid'], $wpg2_g2path['g2_url']);
$wpDirectory = $galleryUrlGenerator->_path[0];
foreach ($regexRules as $ruleId => $regexRule) {
/* Substitution */
$params = $regexRule['queryString'];
foreach ($regexRule['keywords'] as $reference => $name) {
if (empty($name)) {
continue;
}
/* $N are RewriteRule backreferences, %N are RewriteCond backreferences */
$params[$name] = '%' . $reference;
}
$regexRule['substitution'] = $galleryUrlGenerator->generateUrl($params, $regexRule['options']);
$regexRules[$ruleId] = $regexRule;
}
//echo 'Debug: Inside #4 of wpg2_template_rules
';
foreach ($regexRules as $rule) {
$wpg2rewriterule = $rule['pattern'];
if (strlen($wpg2rewriterule) > 0) {
if ($wpDirectory != '/') {
$newrules[$wpg2rewriterule] = preg_replace($wpDirectory,'',$rule['substitution']);
$newrules[$wpg2rewriterule] = preg_replace('/\/\//','',$newrules[$wpg2rewriterule]);
}
else {
$newrules[$wpg2rewriterule] = preg_replace('/^\//','',$rule['substitution']);
}
}
}
}
}
//echo 'Debug: End of wpg2_template_rules
';
$newrules = array_merge($newrules,$wprules);
return $newrules;
}
/**
* Function Hook on Wordpress Header
* Inserts the Lightbox CSS & Javascripts to the Wordpress Page Header
*
* @param NULL
* @return NULL
*/
function wpg2_lightboxheader() {
global $wpg2_option;
// Is Gallery2 Outputting & Lightbox G2 Support is Active?
if (defined('G2NOHEADERPAGE') && !$wpg2_option['wpg2_enableg2lightbox'])
return;
//Output Lightbox
$lightbox_opacity = $wpg2_option['wpg2_lightboxopacity'];
$lightbox_resize = $wpg2_option['wpg2_lightboxresizespeed'];
$lightbox_animate = $wpg2_option['wpg2_lightboxanimate'];
$lightbox_scriptpath = get_bloginfo('wpurl')."/wp-content/plugins/wpg2/js/";
$lightbox_csspath = get_bloginfo('wpurl')."/wp-content/plugins/wpg2/css/";
$lightbox_imgpath = get_bloginfo('wpurl')."/wp-content/plugins/wpg2/images/";
$lightboxscript.= ''."\n";
$lightboxscript.= ''."\n";
$lightboxscript.= ''."\n";
$lightboxscript.= ''."\n";
$lightboxscript.= "\n";
$lightboxscript.= "\n";
$lightboxscript.= "\n";
$lightboxscript.= "\n";
print($lightboxscript);
}
/**
* Function Hook on Wordpress Admin Header
* Inserts the Help JS into Wordpress Page Header
*
* @param NULL
* @return NULL
*/
function wpg2_adminjsheader() {
if ( strstr( $_SERVER['PHP_SELF'], "admin.php")) {
$wpg2help = get_bloginfo('wpurl').'/wp-content/plugins/wpg2/js/helpwindow.js';
echo '';
}
}
/**
* Function Hook on Wordpress Header
* WP action to add the Gallery2 image frame style sheets to the WP header
*
* @param NULL
* @return NULL
*/
function g2_addheader() {
// Get WPG2 Option Settings
global $wpg2_option, $g2data;
// Get Gallery2 Paths
$wpg2_g2path = get_option('wpg2_g2paths');
if ($wpg2_option['g2_externalheader']) {
echo ''."\n";
}
if ($wpg2_option['g2_externalcss'])
$wpg2_csspath = get_bloginfo('stylesheet_directory').'/';
else
$wpg2_csspath = get_bloginfo('wpurl')."/wp-content/plugins/wpg2/css/";
if (!defined('G2NOHEADERPAGE')) {
// Add Album Tree JS
echo ''."\n";
// Add Gallery2 CSS For Frames Into WP Header for (Pure WP Pages Only)
$site_url = trailingslashit(get_option('siteurl'));
$framenames = array('none');
$cssoutput = '\n";
} else {
// Merge Gallery2 HEAD Outputs Into WP Header
if (isset($g2data['headHtml'])) {
list($g2_title, $g2_css, $g2_javascript) = GalleryEmbed::parseHead($g2data['headHtml']);
foreach ($g2_css as $css) { echo "$css \r\n"; }
foreach ($g2_javascript as $javascript) { echo "$javascript \r\n"; }
}
}
echo ''."\n";
}
/*
********************************************************************************************************
WPG2 Validation Helpers
********************************************************************************************************
*/
/**
* Tries to Guess the Gallery2 URL Location on WPG2 Plugin Activation
*
* @param NULL
* @return $ret
*/
function wpg2_simple_find_paths() {
// See if we can guess the Gallery2 URL
$site_url = trailingslashit(get_option('siteurl'));
$g2url = $site_url.'/gallery2';
$ret = wpg2_validateg2url($g2url);
if ($ret) {
$g2url = $site_url.'/gallery';
$ret = wpg2_validateg2url($g2url);
}
if ($ret) {
$g2url = $site_url.'/photos';
$ret = wpg2_validateg2url($g2url);
}
if ($ret) {
$domain_url = rtrim($site_url, '/');
$domain_url_subset = strlen($domain_url) - strpos(strrev($domain_url), '/');
$domain_url = substr($domain_url,0,$domain_url_subset);
$g2url = $domain_url."gallery2";
$ret = wpg2_validateg2url($g2url);
}
if ($ret) {
$g2url = $domain_url."gallery";
$ret = wpg2_validateg2url($g2url);
}
if ($ret) {
$g2url = $domain_url."photos";
$ret = wpg2_validateg2url($g2url);
}
// Failed .. Default Paths
if ($ret) {
// Get Plugin Base
$wpg2base = dirname(__FILE__) . '/';
require_once($wpg2base . 'g2embeddiscoveryutilities.class');
// Set up the URL's and Paths
$site_url = trailingslashit(get_option('siteurl'));
$embedUri = G2EmbedDiscoveryUtilities::normalizeG2Uri($site_url);
// Set the WPG2 Paths
$wpg2_g2path['g2_url'] = '';
$wpg2_g2path['g2_filepath'] = '';
$wpg2_g2path['g2_embeduri'] = '';
$wpg2_g2path['g2_errorredirect'] = get_option( 'home' );
$wpg2_g2path['g2_errorredirect'] .= "/index.php";
update_option('wpg2_g2paths', $wpg2_g2path);
}
return $ret;
}
/**
* Function Hook on Wordpress Theme Change
* Revalidates what Wordpress Header / Footer is being used in the new theme.
*
* @param NULL
* @return NULL
*/
function wpg2_themeswitchvalidate() {
wpg2_validate('silent');
}
/**
* Sets up the WPG2 Plugin defaults, adds any user capabilities.
*
* @param NULL
* @return NULL
*/
function wpg2_pluginactivate() {
// Load the WPG2 translation files
load_plugin_textdomain('wpg2', 'wp-content/plugins/wpg2/locale');
global $user_ID;
// Embedded Page Defaults
$wpg2_option['g2_externalheader'] = 'No';
$wpg2_option['g2_externalfooter'] = 'No';
$wpg2_option['g2_header'] = '';
$wpg2_option['g2_footer'] = "
";
$wpg2_option['g2_embedpageid'] = '';
$wpg2_option['g2_embedpagetype'] = 'wordpress';
$wpg2_option['wpg2_pagetitle'] = 'WPG2';
$wpg2_option['wpg2_pagename'] = 'wpg2';
$wpg2_option['g2_rewriteactive'] = '';
//Sidebar Grid Block Defaults
$wpg2_option['g2_sidebargridblockshow'][1] = 'heading';
$wpg2_option['g2_sidebargridblockstodisplay'] = '';
$wpg2_option['g2_sidebargridblocksimgsize'] = '85';
$wpg2_option['g2_sidebargridblockstype'] = '';
$wpg2_option['g2_sidebargridblockinfo'][1] = '';
// Sidebar Block Defaults
$wpg2_option['g2_sidebarblock'][0] = '';
$wpg2_option['g2_sidebarblockinfo'][1] = 'heading';
$wpg2_option['g2_sidebarblockshow'][0] = '';
$wpg2_option['g2_sidebarblockimgsize'] = '150';
$wpg2_option['g2_sidebarblockimageframe'] = 'None';
$wpg2_option['g2_sidebarblockalbumframe'] = 'None';
// CSS Defaults
$wpg2_option['g2_cssheader'] = '.g2_column {width: 738px;margin: 0px 1px 0px 12px;}';
// WPG2 Tag Defaults
$wpg2_option['g2_tagimgsize'] = '150';
$wpg2_option['g2_tagblockshow'] = array(1);
$wpg2_option['g2_tagalbumframe'] = 'None';
$wpg2_option['g2_tagimageframe'] = 'None';
// Lightbox Defaults
$wpg2_option['wpg2_enablelightbox'] = '';
$wpg2_option['wpg2_enableg2lightbox'] = '';
$wpg2_option['wpg2_enablesidebarlightbox'] = '';
$wpg2_option['wpg2_enabletagslightbox'] = '';
$wpg2_option['wpg2_lightboxopacity'] = '0.7';
$wpg2_option['wpg2_lightboxresizespeed'] = '7';
$wpg2_option['wpg2_lightboxanimate'] = 'true';
$wpg2_option['g2_lightboximgsize'] = '300';
// Get WPG2 Archive IF Exists and repopulate
$wpg2_archive = get_option('wpg2_30_archive');
if (!empty($wpg2_archive)) {
foreach ($wpg2_archive as $key=>$value){
if (!empty($value)) {
$wpg2_option[$key] = $value;
}
}
delete_option('wpg2_30_archive');
}
if ($wpg2_option['g2_embedpagetype'] == 'wordpress')
$wpg2_option['g2_embedpageid'] = wpg2_wppagecreate($wpg2_option['wpg2_pagetitle'],$wpg2_option['wpg2_pagename']);
update_option('wpg2_options', $wpg2_option);
if (function_exists('g2image_plugin')) {
g2image_setdefaults();
}
// Get Gallery2 Paths Settings
$wpg2_g2path = get_option('wpg2_g2paths');
// Do We Have Paths, If So, Build Output Page Paths
if (!$wpg2_g2paths['g2_filepath']) {
wpg2_template_page();
}
// Get Gallery2 OLD Option Settings
$g2_option = get_option('g2_options');
// Upgrading from WPG2 Releases Prior to 2.2
if ($g2_option['g2_filepath']) {
// Clean Up Old Pre 2.2 Settings
delete_option('g2_options');
}
// WPG2 Versions Requirements
$wpg2_option['g2_version_low'] = '2.2';
$wpg2_option['g2_imageblock_version_low'] = '1.0.9';
$wpg2_option['g2_wpversion_low'] = "5183";
// Add Security Groups
$wp_roles = new WP_Roles();
$wp_roles->add_cap('contributor','gallery2_user');
$wp_roles->add_cap('administrator','gallery2_user');
$wp_roles->add_cap('editor','gallery2_user');
$wp_roles->add_cap('author','gallery2_user');
$wp_roles->add_cap('author','Unfiltered Html');
$wp_roles->add_cap('editor','Unfiltered Html');
$wp_roles->add_cap('contributor','Unfiltered Html');
$wp_roles->add_cap('administrator','Unfiltered Html');
$wp_roles->add_cap('administrator','gallery2_admin');
update_option('wpg2_options', $wpg2_option);
}
/**
* Removes all the WPG2 settings / Caps.
*
* @param NULL
* @return NULL
*/
function wpg2_plugindeactivate() {
// Get Gallery2 Option Settings
$wpg2_option = get_option('wpg2_options');
// Remove These Filters as WP is incorrectly firing WPG2 After Deactivation
remove_action('template_redirect', 'wpg2_template');
remove_action('rewrite_rules_array', 'wpg2_template_rules');
remove_filter('generate_rewrite_rules', 'wpg2_trimpermalinkrules');
remove_action('admin_menu', 'wpg2_template_rewritechanges');
// Filter for WP Page Changes
remove_action('edit_page_form', 'wpg2_template_pagechanges');
remove_action('delete_post', 'wpg2_template_pagedeletes');
// Check to see if this is NOT a Mass Deactivation Event (Wordpress Upgrade) thus leave WPG2 Options Intact!
if ($_GET['action'] != 'deactivate-all') {
// Restore Security Groups
$wp_roles = new WP_Roles();
$wp_roles->remove_cap('administrator','gallery2_user');
$wp_roles->remove_cap('administrator','gallery2_admin');
$wp_roles->remove_cap('contributor','gallery2_user');
$wp_roles->remove_cap('editor','gallery2_user');
$wp_roles->remove_cap('author','gallery2_user');
$wp_roles->remove_cap('author','Unfiltered Html');
$wp_roles->remove_cap('editor','Unfiltered Html');
$wp_roles->remove_cap('contributor','Unfiltered Html');
// Save Settings into an archive Array
// Embedded Page Defaults
$wpg2_archive['g2_externalheader'] = $wpg2_option['g2_externalheader'];
$wpg2_archive['g2_externalfooter'] = $wpg2_option['g2_externalfooter'];
$wpg2_archive['g2_header'] = $wpg2_option['g2_header'];
$wpg2_archive['g2_footer'] = $wpg2_option['g2_footer'];
$wpg2_archive['g2_embedpagetype'] = $wpg2_option['g2_embedpagetype'];
$wpg2_archive['wpg2_pagetitle'] = $wpg2_option['wpg2_pagetitle'];
$wpg2_archive['wpg2_pagename'] = $wpg2_option['wpg2_pagename'];
//Sidebar Grid Block Defaults
$wpg2_archive['g2_sidebargridblockshow'] = $wpg2_option['g2_sidebargridblockshow'];
$wpg2_archive['g2_sidebargridblockstodisplay'] = $wpg2_option['g2_sidebargridblockstodisplay'];
$wpg2_archive['g2_sidebargridblocksimgsize'] = $wpg2_option['g2_sidebargridblocksimgsize'];
$wpg2_archive['g2_sidebargridblockstype'] = $wpg2_option['g2_sidebargridblockstype'];
$wpg2_archive['g2_sidebargridblockinfo'] = $wpg2_option['g2_sidebargridblockinfo'];
// Sidebar Block Defaults
$wpg2_archive['g2_sidebarblock'] = $wpg2_option['g2_sidebarblock'];
$wpg2_archive['g2_sidebarblockinfo'] = $wpg2_option['g2_sidebarblockinfo'];
$wpg2_archive['g2_sidebarblockshow'] = $wpg2_option['g2_sidebarblockshow'];
$wpg2_archive['g2_sidebarblockimgsize'] = $wpg2_option['g2_sidebarblockimgsize'];
$wpg2_archive['g2_sidebarblockimageframe'] = $wpg2_option['g2_sidebarblockimageframe'];
$wpg2_archive['g2_sidebarblockalbumframe'] = $wpg2_option['g2_sidebarblockalbumframe'];
// CSS Defaults
$wpg2_archive['g2_cssheader'] = $wpg2_option['g2_cssheader'];
// WPG2 Tag Defaults
$wpg2_archive['g2_tagimgsize'] = $wpg2_option['g2_tagimgsize'];
$wpg2_archive['g2_tagblockshow'] = $wpg2_option['g2_tagblockshow'];
$wpg2_archive['g2_tagalbumframe'] = $wpg2_option['g2_tagalbumframe'];
$wpg2_archive['g2_tagimageframe'] = $wpg2_option['g2_tagimageframe'];
// Lightbox Defaults
$wpg2_archive['wpg2_enablelightbox'] = $wpg2_option['wpg2_enablelightbox'];
$wpg2_archive['wpg2_enableg2lightbox'] = $wpg2_option['wpg2_enableg2lightbox'];
$wpg2_archive['wpg2_enablesidebarlightbox'] = $wpg2_option['wpg2_enablesidebarlightbox'];
$wpg2_archive['wpg2_enabletagslightbox'] = $wpg2_option['wpg2_enabletagslightbox'];
$wpg2_archive['wpg2_lightboxopacity'] = $wpg2_option['wpg2_lightboxopacity'];
$wpg2_archive['wpg2_lightboxresizespeed'] = $wpg2_option['wpg2_lightboxresizespeed'];
$wpg2_archive['wpg2_lightboxanimate'] = $wpg2_option['wpg2_lightboxanimate'];
$wpg2_archive['g2_lightboximgsize'] = $wpg2_option['g2_lightboximgsize'];
// Save the WPG2 Options into WPG2 Archive
update_option('wpg2_30_archive', $wpg2_archive);
// Remove ALL WPG2 Options
delete_option('wpg2_g2paths');
delete_option('wpg2_options');
// Delete the WPG2 Page
if ( $wpg2_option['g2_embedpageid'] != '' )
wp_delete_post($wpg2_option['g2_embedpageid']);
if (function_exists('g2image_plugin')) {
g2image_deactivation();
}
}
}
?>