diff --git a/zp-branding.php b/zp-branding.php index 0725316..1160b98 100644 --- a/zp-branding.php +++ b/zp-branding.php @@ -14,11 +14,14 @@ $plugin_author = "Fred Sondaar (fretzl)"; $plugin_version = '1.3'; $plugin_category = gettext('Admin'); -$option_interface = 'zpBranding'; +$option_interface = 'zpBrandingOptions'; zp_register_filter('admin_head', 'zpBranding::printCustomZpLogo'); -class zpBranding { +global $zp_branding_logo; +$zp_branding_logo = SERVERPATH . '/' . USER_PLUGIN_FOLDER . '/zp-branding/zp-admin-logo.png'; + +class zpBrandingOptions { function __construct() { purgeOption('width');// older version option name @@ -27,32 +30,51 @@ function __construct() { setThemeOptionDefault('zpbranding_customcss', ''); } - function getOptionsSupported() { - $logo = FULLWEBPATH . '/' . USER_PLUGIN_FOLDER . '/zp-branding/zp-admin-logo.png'; - $width = getimagesize($logo)[0]; - $options = array( - gettext_pl('Width', 'zp-branding') => array('key' => 'zpbranding-width', 'type' => OPTION_TYPE_TEXTBOX, - 'order'=> 1, - 'desc' => gettext_pl('The width of the image (px). The height is proportional.', 'zp-branding')), - gettext_pl('Custom CSS', 'zp-branding') => array('key' => 'zpbranding_customcss', 'type' => OPTION_TYPE_TEXTAREA, - 'order' => 3, - 'multilingual' => 0, - 'desc' => gettext_pl('Enter custom CSS to alter the appearance of the admin area.
It is printed between <style> tags in the <head> section.', 'zp-branding')) - ); - if ( getOption('zpbranding-width') != $width ) { - $options[gettext_pl('Reset', 'zp-branding')] = array('key' => 'zpbranding-restore', 'type' => OPTION_TYPE_CHECKBOX, - 'order' => 2, - 'desc' => gettext_pl('Reset to the original width.', 'zp-branding')); - } + static function getOptionsSupported() { + global $zp_branding_logo; + if ( $zp_branding_logo ) { + $width = getimagesize($zp_branding_logo)[0]; + $options = array( + gettext_pl('Width', 'zp-branding') => array('key' => 'zpbranding-width', 'type' => OPTION_TYPE_TEXTBOX, + 'order'=> 1, + 'desc' => gettext_pl('The width of the image (px). The height is proportional.', 'zp-branding')), + gettext_pl('Custom CSS', 'zp-branding') => array('key' => 'zpbranding_customcss', 'type' => OPTION_TYPE_TEXTAREA, + 'order' => 3, + 'multilingual' => 0, + 'desc' => gettext_pl('Enter custom CSS to alter the appearance of the admin area.
It is printed between <style> tags in the <head> section.', 'zp-branding')) + ); + if ( getOption('zpbranding-width') != $width ) { + $options[gettext_pl('Reset', 'zp-branding')] = array('key' => 'zpbranding-restore', 'type' => OPTION_TYPE_CHECKBOX, + 'order' => 2, + 'desc' => gettext_pl('Reset to the original width.', 'zp-branding')); + } return $options; + } else { ?> +
+ %s does not exist.", 'zp-branding'), substr($zp_branding_logo, strrpos($zp_branding_logo, '/') + 1)); ?> +
+
- %s does not exist.", 'zp-branding'), substr($logo, strrpos($logo, '/') + 1)); ?> + %s does not exist.", 'zp-branding'), substr($zp_branding_logo, strrpos($zp_branding_logo, '/') + 1)); ?>
\ No newline at end of file