function silverghyll_create_admin_menu() { $silverghyll_plugins = get_silverghyll_plugins(); ksort($silverghyll_plugins); $plugin_data = get_plugin_data(plugin_dir_path(__FILE__) . '../readme.txt'); // Path to this plugins readme $plugin_name = $plugin_data['Name']; if (!$plugin_name) { $plugin_name = 'Kandie Girls'; } // If not a plugin, then it is the Kandie Girls theme! silverghyll_check_foundation(true); // Check silvergyll-foundation.php is up to date and display a warning if not ?> <h3>Silverghyll Packages</h3> <p>This sub-menu is used for packages (plugins and themes) from <a href="http://www.silverghyll.com" target="_blank">Silverghyll</a></p> <table id="silverghyll-inventory" class="widefat"> <thead> <tr> <td>Package</td> <td>Type</td> <td>Installed?</td> <td>Description</td> </tr> </thead> <tbody> <?php foreach ($silverghyll_plugins as $kp) { ?> <tr> <?php if (isset($kp['PluginURI'])) { ?> <td><a href="<?php echo $kp['PluginURI']; ?> " title="<?php echo $kp['Name']; ?> "><?php echo $kp['Name']; ?> </a></td> <?php } else { ?> <td><?php echo $kp['Name']; ?> </td> <?php } ?> <td>Plugin</td> <td> <?php $item_installed = $kp['Installed'] === true ? 'Yes' : 'No'; _e($item_installed); if ($item_installed == 'Yes') { echo ' (v' . $kp['Version'] . ')'; } ?> </td> <td><?php echo $kp['Description']; ?> </td> </tr> <?php } ?> <?php if (defined('KANDIE_THEME_DIR')) { echo "<tr><td>Kandie Girls</td><td>Theme</td><td>Yes (v" . silverghyll_versioneer(trailingslashit(silverghyll_THEME_DIR) . 'style.css'); echo ")</td><td>Kandie Girls theme developed for Egyptological</td></tr>"; } ?> </tbody> </table><br style="clear:both;"> Packages © Kate Phizackerley and/or Silverghyll 2009-2012. Please refer to each package for copyright and licence details. <br/> <?php silverghyll_debug_status('echo-trace'); echo "<br/><h3>Silverghyll Library Versions and Paths</h3><style type='text/css'>.widefat thead td {font-weight:bold;font-size;120%;}</style>"; echo "<table class='widefat'><thead><b><tr><td>Library Item</td><td>Path</td><td>Version</td><td>Date</td></tr></b></thead><tbody>"; $lib_contents = silverghyll_admin_library_versions(); foreach ($lib_contents as $item => $path) { $tidy_path = dirname(str_replace($_SERVER['DOCUMENT_ROOT'], '', $path)); // Strip out the leading stuff and the item name echo "<tr><td>{$item}</td><td>{$tidy_path}</td><td>" . silverghyll_versioneer($path) . "</td><td>" . date('d/m/Y', filemtime($path)) . "</td></tr>"; } $gd_inf = gd_info(); $gd_ver = " & GD {$gd_inf['GD Version']}" . ($gd_inf['Freetype Support'] ? " with Freetype support" : ""); echo "</tbody></table><br/><p>Printed by {$plugin_name} using PHP v" . phpversion() . "{$gd_ver} with Silverghyll Foundation Library from " . SILVERGHYLL_READY . "</p>"; }
function silverghyll_include_best_library($filename = 'silverghyll-admin-menu.php', $path_type = 'dir') { $transient_name = '!SILVER-BEST!' . $filename . '-' . $path_type; global $silverghyll_transients; if ($silverghyll_transients->get($transient_name)) { return $silverghyll_transients->get($transient_name); // Avoid parsing the files if we can! } $path_type = strtolower(trim($path_type)); $silverghyll_plugins = silverghyll_plugin_library_dirs(); // Test whether we have a theme version to test as well $silverghyll_options = get_option('kandie-girls-theme'); if ($silverghyll_options['theme_name'] == get_current_theme()) { $silverghyll_plugins[$silverghyll_options['theme_uri'] . 'silverghyll-library/'] = $silverghyll_options['theme_dir'] . 'silverghyll-library/'; } $max_ver = 0; // The best version found $best_path = ''; // The path of the best version found $best_date = 0; // The date of the best version found as ymdHi format foreach ($silverghyll_plugins as $plugin => $path) { $file_path = $path . $filename; if (!file_exists($file_path)) { if (function_exists('silverghyll_debug_log') and silverghyll_debug_status()) { silverghyll_debug_log("Missing library {$filename} in {$path}<br/>"); } // If debugging, we need to know continue; // Skip any old libraries which don't contain a version of the file we want } $ver = silverghyll_versioneer($file_path); if (!$ver and function_exists('silverghyll_debug_log')) { silverghyll_debug_log('No version found in ' . $file_path . ' while finding best library'); } $num_ver = silverghyll_numver($ver); $item_date = date('ymdHi', filemtime($file_path)); // Debugging aid - aomment out for live use /* echo "<h3>File: $filename</h3>"; echo "<p>Bagged: ver=$max_ver @{$best_date} & path=$best_path</p>"; echo "<p>Testing: ver=$num_ver @{$item_date} & path=$path<br/></p>"; */ // Best is highest version or, if version is identical, the newest modified if ($max_ver < $num_ver or $max_ver == $num_ver and $item_date > $best_date) { if ($path_type[0] == 'd') { // Update best_path which may be a folder, URL or version $best_path = $path . $filename; } elseif ($path_type[0] == 'v') { $best_path = $num_ver; } else { $best_path = $plugin . $filename; } $best_date = $item_date; $max_ver = $num_ver; } } // Store in a transient to avoid iterating when not needed but only once all plugins have loaded if (defined('SILVERGHYLL_READY')) { $silverghyll_transients->set($transient_name, $best_path); } return $best_path; }
function silverghyll_error_trace_handler($errno, $errstr, $errfile, $errline, $trace = false) { if (!(error_reporting() & $errno)) { return; } // This error code is not included in error_reporting $tidy_errfile = basename(dirname($errfile)) . '/' . basename($errfile); // Just the nice trailing bit! switch ($errno) { case E_USER_ERROR: silverghyll_debug_log("<b>silverghyll PHP ERROR</b> [{$errno}] {$errstr}<br />\n"); silverghyll_debug_log(" Fatal error on line {$errline} in file {$tidy_errfile} \n"); if ($trace) { silverghyll_backtrace(silverghyll_debug_status(), 3); } silverghyll_debug_log("Aborting...<br />\n"); exit(1); break; case E_USER_WARNING: silverghyll_debug_log("<b>silverghyll PHP WARNING</b> [{$errno}] {$errstr} on line {$errline} in file {$tidy_errfile} <br />\n"); break; case E_USER_NOTICE: silverghyll_debug_log("<b>silverghyll NOTICE</b> [{$errno}] {$errstr}<br />\n"); break; default: silverghyll_debug_log("silverghyll unknown error type: [{$errno}] {$errstr} on line {$errline} in file {$tidy_errfile}<br />\n"); break; } if ($trace) { silverghyll_backtrace(silverghyll_debug_status(), 3); } /* Don't execute PHP internal error handler */ return true; }