$value){ $wpg2_option[$key] = $value; } update_option('wpg2_options', $wpg2_option); } // Initialisation $validate_err=0; $validate_warning=0; //Get Current Gallery2 Plug-in Options $wpg2_option = get_option('wpg2_options'); $wpg2_g2path = get_option('wpg2_g2paths'); // Do We Have Paths? if (empty($wpg2_g2path['g2_filepath']) || empty($wpg2_g2path['wpg2_relativepath']) ) { $ret = wpg2_simple_find_paths(); if (!$ret) { // Clean up Permalink Structure wpg2_trimpermalinkrules(); // Verify WPG2 Internal g2_embeduri setting wpg2_template_page(); $wpg2_g2path = get_option('wpg2_g2paths'); } } // Test Wordpress Version $environment_html = ''; $environment_html .= __('1. Wordpress Compatible? - [' , 'wpg2'); if ($wp_db_version >=$wpg2_option['g2_wpversion_low']) { $environment_html .= '' . __(' Success', 'wpg2') . ''; } else { define("WPVERSIONERR", "True"); $environment_html .= '' . __('Failed', 'wpg2') . ''; $validate_err=1; } $environment_html .= ']
'; // Test Gallery2 URL if (!$validate_err) { $environment_html .= __('2. URI to Gallery2 Ok? - [' , 'wpg2'); $ret = wpg2_validateuri($wpg2_g2path['g2_url'].'embed.php'); if (!$ret) { $environment_html .= '' . __('Success', 'wpg2') . ''; } else { define("G2EMBEDERR", "True"); $validate_warning=1; $reterr = $ret; $environment_html .= '' . __('Warning', 'wpg2') . ''; } $environment_html .= ']
'; } // Gallery Ok? if (!$validate_err) { $environment_html .= __('3. Gallery2 can be located in G2 File Path? - [', 'wpg2'); if (file_exists( $wpg2_g2path['g2_filepath'].'embed.php' ) ) $environment_html .= '' . __('Success', 'wpg2').''; else { $environment_html .= '' . __('Failed', 'wpg2').''; define("G2PATHERR", "True"); $validate_err=1; } $environment_html .= ']
'; } // Test Initialise G2 if (!$validate_err) { $environment_html .= __('4. Gallery2 can be initialised? - [', 'wpg2'); if (!defined('G2INIT')) { $ret = g2_init(); if (!$ret) $environment_html .= '' . __('Success', 'wpg2') . ''; else { define("G2INITERR", "True"); $environment_html .= '' . __('Failed', 'wpg2') . '->'; $validate_err=1; } } else { $environment_html .= '' . __('Success', 'wpg2') . ''; } $environment_html .= ']
'; } // Test G2 Version if (!$validate_err) { $environment_html .= __('5. Gallery2 Version Compatible? - [' , 'wpg2'); list ($ret, $core) = GalleryCoreApi::loadPlugin('module', 'core', true); $g2version = $core->getInstalledVersions(); $g2version = substr($g2version['gallery'],0,3); if ($wpg2_option['g2_version_low'] <= $g2version) $environment_html .= '' . __('Success', 'wpg2') . ''; else { $environment_html .= '' . __('Failed', 'wpg2') . ''; define("G2VERERR", "True"); $validate_err=1; } $environment_html .= ']
'; } // ImageBlock Active? if (!$validate_err) { $environment_html .= __('6. Gallery2 Module: ImageBlock Active? - [' , 'wpg2'); $g2_image_block_active = 0; $g2_moduleid = 'imageblock'; list ($ret, $g2_modulestatus ) = GalleryCoreApi::fetchPluginStatus('module'); if (!$ret) { if (isset($g2_modulestatus[$g2_moduleid]) && !empty($g2_modulestatus[$g2_moduleid]['active']) && $g2_modulestatus[$g2_moduleid]['active']) $environment_html .= '' . __('Success', 'wpg2') . ''; else { $environment_html .= '' . __('Failed', 'wpg2') . ''; define("G2IMAGEBLOCKERR", "True"); $validate_err=1; } } $environment_html .= ']
'; } // Test ImageBlock Version if (!$validate_err) { $environment_html .= __('7. Gallery2 Module: ImageBlock Version Compatible? - [', 'wpg2'); GalleryCoreApi::requireOnce('modules/imageblock/module.inc'); GalleryCoreApi::requireOnce('modules/core/classes/GalleryRepositoryUtilities.class'); $plugin = new ImageBlockModule; $version = $plugin->getVersion(); $version_comparison = GalleryRepositoryUtilities::compareRevisions($version,$wpg2_option['g2_imageblock_version_low']); if ($version_comparison != 'older') { $environment_html .= '' . __('Success', 'wpg2') . ''; } else { define("G2IMAGEBLOCKVERSIONERR", "True"); $validate_warning=1; $reterr = $ret; $environment_html .= '' . __('Warning', 'wpg2') . ''; } $environment_html .= ']
'; } // ImageFrame Active? if (!$validate_err) { $environment_html .= __('8. Gallery2 Module: ImageFrame Active? - [' , 'wpg2'); $g2_image_block_active = 0; $g2_moduleid = 'imageframe'; if (!$ret) { if (isset($g2_modulestatus[$g2_moduleid]) && !empty($g2_modulestatus[$g2_moduleid]['active']) && $g2_modulestatus[$g2_moduleid]['active']) $environment_html .= '' . __('Success', 'wpg2') . ''; else { $environment_html .= '' . __('Failed', 'wpg2') . ''; define("G2IMAGEFRAMEERR", "True"); $validate_err=1; } } $environment_html .= ']
'; } // ImageFrame can be found in Relative Path? if (!$validate_err) { $environment_html .= __('9. Gallery2 to WPG2 Relative Path Validate? - [' , 'wpg2'); if (file_exists($wpg2_g2path['g2_filepath'].$wpg2_g2path['wpg2_relativepath'].DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR.'wpg2imageblock.tpl' ) ) { $environment_html .= '' . __('Success', 'wpg2') . ''; } else { $environment_html .= '' . __('Failed', 'wpg2') . ''; define("G2RELPATHERR", "True"); $validate_err=1; } $environment_html .= ']
'; } // End Validation Checks if (!$validate_err) { $environment_html .= '' . __('WPG2 Page Generation Rules: ', 'wpg2') . ' '.'(View WPG2 Output Page »)
'; // WPG2 Page Output Type? $environment_html .= __('1. WPG2 Output Style? - [', 'wpg2'); if ( $wpg2_option['g2_embedpagetype'] == 'wordpress' ) { $environment_html .= '' . __('Look like a Wordpress Page', 'wpg2'). ''; } else { $environment_html .= '' . __('Look like a Gallery2 Page', 'wpg2'). ''; } $environment_html .= ']
'; // WPG2 / Gallery Rewrites Active? $environment_html .= __('2. WPG2 Gallery2 Rewrites Status? - [', 'wpg2'); if ($wpg2_option['g2_rewriteactive'] == 'active') { $environment_html .= '' . __('On', 'wpg2'). ''; } else { if ($wpg2_option['g2_rewriteactive'] == 'safe') $environment_html .= '' . __('Off [Safe]', 'wpg2'). ''; else $environment_html .= '' . __('Off', 'wpg2'). ''; } $environment_html .= ']
'; // Custom Header? $environment_html .= __('3. Embedded Page is using what Header type? - [', 'wpg2'); if ( file_exists( TEMPLATEPATH . '/wpg2header.php') ) { $environment_html .= '' . __('WPG2HEADER', 'wpg2'). ''; $wpg2_option['g2_externalheader'] = "Yes"; } else { if ($wpg2_option['g2_embedpagetype'] != 'gallery2' ) define('WPSIMPLEHEADER',"True"); $environment_html .= '' . __('Simple', 'wpg2'). ''; $wpg2_option['g2_externalheader'] = "No"; } $environment_html .= ']
'; // Custom Footer? $environment_html .= __('4. Embedded Page is using what Footer type? - [', 'wpg2'); if ( file_exists( TEMPLATEPATH . '/wpg2footer.php') ) { $environment_html .= '' . __('WPG2FOOTER', 'wpg2'). ''; $wpg2_option['g2_externalfooter'] = "Yes"; } else { $environment_html .= '' . __('Simple', 'wpg2'). ''; $wpg2_option['g2_externalfooter'] = "No"; } $environment_html .= ']
'; // External WPG2 CSS $environment_html .= __('5. Using Which WPG2 Stylesheet? - [', 'wpg2'); if ( file_exists( TEMPLATEPATH . '/wpg2.css') ) { $environment_html .= '' . __('External', 'wpg2'). ''; $wpg2_option['g2_externalcss'] = "Yes"; } else { $environment_html .= '' . __('Internal', 'wpg2'). ''; $wpg2_option['g2_externalcss'] = ""; } $environment_html .= ']
'; } $environment_html .= ''; if ($validate_err) $wpg2_option['g2_validated'] = "No"; else { if (!$wpg2_option['g2_rewriteactive'] == 'active') { $g2_moduleid = 'rewrite'; list ($ret, $g2_modulestatus ) = GalleryCoreApi::fetchPluginStatus('module'); if (!$ret && isset($g2_modulestatus[$g2_moduleid]) && !empty($g2_modulestatus[$g2_moduleid]['active']) && $g2_modulestatus[$g2_moduleid]['active']) { // Deactivate Rewrite Module as Wordpress Permalink Array will be wrong. list ($ret, $ignored) = GalleryCoreApi::deactivatePlugin('module', 'rewrite'); if (!$ret) define("G2REWRITEDEACTIVATED", "True"); } } $wpg2_option['g2_validated'] = "Yes"; // Close Gallery Connection GalleryEmbed::done(); } // Update the Options update_option('wpg2_options', $wpg2_option); // Add BTEV Event Message if (function_exists('btev_trigger_error')) { btev_trigger_error('WPG2 VALIDATION ('.$wpg2_option['g2_validated'].') ', E_USER_NOTICE, __FILE__); } //Output Status if ($wpg2_outputtype != "silent") { echo '
'; echo '

'. __('WPG2 Dashboard').' '. __('(Help)', 'wpg2').'

'; ?>
  /> />   
"; if ($validate_err){ echo '' . __('WPG2 Validation Check: ', 'wpg2') . '' . __('Failed', 'wpg2') . ' '. __('(Help)', 'wpg2').'
'; echo $environment_html; } else { echo '' . __('WPG2 Validation Check: ', 'wpg2') . '' . __('Valid', 'wpg2') . ' '. __('(Help)', 'wpg2').'
'; echo $environment_html; } if (defined('WPVERSIONERR')) { echo '
'; echo '

' . __('Error: Wordpress Build is NOT Compatible', 'wpg2').'

'. __(' WPG2 ','wpg2').$wpg2_option['g2_wpg2version']; _e(' requires a minimum Wordpress build of ', 'wpg2'); echo $wpg2_option['g2_wpversion_low']; _e (' and has detected your Wordpress build ', 'wpg2'); echo $wp_db_version; _e (' does not meet the minimum build requirement.', 'wpg2'); echo '

'; } if (defined('G2EMBEDERR')) { echo '
'; echo '

'. __('Warning: Possible invalid URL to Gallery2', 'wpg2').'

'. __('Possible Validation Problem of Gallery2 URL. The error returned reads: "', 'wpg2').$reterr.'"

'; echo '
'; } if (defined('G2PATHERR')) { echo '
'; echo '

'. __('Error: embed.php cannot be located in the specified File Path.', 'wpg2').'

'; _e('WPG2 plugin cannot locate the Gallery2 installation.

Upon activation, WPG2 automatically looks for your Gallery2 installation in (Domain URL)/gallery2/, (Domain URL)/gallery/, (Domain URL)/photos/, (WordPress URL)/gallery2/, (WordPress URL)/gallery/, and (WordPress URL)/photos/. If your Gallery2 installation is in another directory, please go to the "WPG2 Paths" tab and enter your Gallery2 URL. ', 'wpg2'); echo ($wpg2_g2path['g2_filepath']). __('embed.php', 'wpg2').'

'; echo '
'; } if (defined('G2INITERR')) { echo '
'; echo '

'. __('Error: Gallery2 cannot be initialised', 'wpg2').'

'. __('Check to ensure Gallery2 is correctly working and revalidate.', 'wpg2').'
'; echo $ret.'

'; echo '
'; } if (defined('G2VERERR')) { echo '
'; echo '

'. __('Error: Gallery2 version is incompatible','wpg2').'

'. __('WPG2 plugin requires at least Gallery2 version ', 'wpg2'); echo $wpg2_option['g2_version_low']. __(', Gallery2 reports you are running version ','wpg2'); echo $g2version.'

'; echo '
'; } if (defined('G2IMAGEBLOCKERR')) { echo '
'; echo '

'. __('Error: Gallery2 Imageblock plugin is not activated','wpg2').'

'. __('Ensure the Gallery2 ImageBlock is installed / activated via the Gallery2 Site Admin -> Plugin Panel.', 'wpg2').'

'; echo $ret; echo '
'; } if (defined('G2IMAGEBLOCKVERSIONERR')) { echo '
'; echo '

'. __('Warning: Gallery2 Imageblock plugin is an old version.','wpg2').'

'. __('Please update to the most recent version from your Gallery2 page: Site Admin -> Plugins.
If you do not upgrade the ImageBlock plugin, you will not be able to use the size option with WPG2 tags.', 'wpg2').'

'; echo $ret; echo '
'; } if (defined('G2IMAGEFRAMEERR')) { echo '
'; echo '

'. __('Error: Gallery2 Imageframe plugin is not activated','wpg2').'

'. __('Ensure the Gallery2 ImageFrame is installed / activated via the Gallery2 Site Admin -> Plugin Panel.', 'wpg2').'

'; echo $ret; echo '
'; } if (defined('G2RELPATHERR')) { echo '
'; echo '

'. __('Error: Gallery2 to WPG2 relative Path cannot be validated','wpg2').'

'. __('The file wpg2imageblock.tpl must be within this path ', 'wpg2'); echo $wpg2_g2path['g2_filepath'].$wpg2_g2path['wpg2_relativepath'].DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR.'wpg2imageblock.tpl'.__(' as specified in the Gallery2 to WPG2 Relative Path in WPG2 Paths Tab','wpg2').'

'; echo '
'; } if (defined('G2REWRITEDEACTIVATED')) { echo '
'; echo '

'. __('Warning: Gallery2 Rewrite Plugin was deactived','wpg2').'

'. __('WPG2 has automatically deactivated the Gallery2 Rewrite Plugin, to reactive, enable Gallery2 Rewrites in the WPG2 Gallery2 Rewrites Tab.','wpg2').'

'; echo '
'; } if (defined('WPSIMPLEHEADER')) { echo '
'; echo '

'. __('Warning: Using the Simple Header','wpg2').'

'. __('WPG2 will generate your Wordpress header using the CSS Elements specified in the WPG2 Output options. For some Wordpress themes this will incorrectly distort the output from Gallery2 and instead you may need to create your own WPG2 Header.','wpg2').'

'; echo '
'; } echo '
'; } } ?>