function pagelines_option($key, $post_id = '', $setting = null) { if ($post_id && get_post_meta($post_id, $key, true) && !is_home()) { //if option is set for a page/post return get_post_meta($post_id, $key, true); } elseif (get_pagelines_option($key, $setting)) { return get_pagelines_option($key, $setting); } else { return false; } }
function pagelines_check_version() { if ( is_multisite() && ! is_super_admin() ) return; add_filter( 'pagelines_options_array', array(&$this,'pagelines_update_tab') ); if ( get_pagelines_option('disable_updates') == true ) return; add_action('admin_notices', array(&$this,'pagelines_update_nag') ); add_filter('site_transient_update_themes', array(&$this,'pagelines_update_push') ); add_filter('transient_update_themes', array(&$this,'pagelines_update_push') ); add_action('load-update.php', array(&$this,'pagelines_clear_update_transient') ); add_action('load-themes.php', array(&$this,'pagelines_clear_update_transient') ); }
/** * TODO Document! */ function pagelines_theme_check_version() { if (get_pagelines_option('disable_updates') == true) { return; } if (!VPRO) { $this->pagelines_theme_update_check(); } else { add_action('admin_notices', array(&$this, 'pagelines_theme_update_nag')); add_filter('site_transient_update_themes', array(&$this, 'pagelines_theme_update_push')); add_filter('transient_update_themes', array(&$this, 'pagelines_theme_update_push')); add_action('load-update.php', array(&$this, 'pagelines_theme_clear_update_transient')); add_action('load-themes.php', array(&$this, 'pagelines_theme_clear_update_transient')); } }
/** * * @TODO do * */ function pagelines_option($key, $post_id = null, $setting = null) { if (isset($post_id) && get_post_meta($post_id, $key, true)) { return get_post_meta($post_id, $key, true); } elseif (get_pagelines_option($key, $setting)) { return get_pagelines_option($key, $setting); } else { return false; } }
pagelines_current_page_content_width(); /** * Setup Framework Versions */ if(VPRO) require_once(PAGELINES_PRO . '/init_pro.php'); if(VDEV) require_once(PAGELINES_DEV . '/init_dev.php'); require_once( PL_INCLUDES . '/version.php' ); /** * Enable debug if required. * * @since 1.4.0 */ if ( get_pagelines_option( 'enable_debug' ) ) { require_once ( PL_ADMIN . '/class.debug.php'); add_filter( 'pagelines_options_array', 'pagelines_enable_debug' ); } /** * Load updater class */ require_once (PL_ADMIN.'/class.updates.php'); /** * Load admin actions */ require_once (PL_ADMIN.'/actions.admin.php'); /**
function wp_debug_info(){ global $wpdb, $wp_version, $platform_build; // Set data & variables first $uploads = wp_upload_dir(); // Get user role $current_user = wp_get_current_user(); $user_roles = $current_user->roles; $user_role = array_shift($user_roles); // Format data for processing by a template $this->debug_info[] = array( 'title' => "WordPress Version", 'value' => $wp_version, 'level' => false, ); $this->debug_info[] = array( 'title' => "Multisite Enabled", 'value' => ( is_multisite() ) ? 'Yes' : 'No', 'level' => false ); $this->debug_info[] = array( 'title' => "Current Role", 'value' => $user_role, 'level' => false ); $this->debug_info[] = array( 'title' => "Theme Path", 'value' => '<code>' . TEMPLATEPATH . '</code>', 'level' => false ); $this->debug_info[] = array( 'title' => "Theme URI", 'value' => '<code>' . get_template_directory_uri() . '</code>', 'level' => false ); $this->debug_info[] = array( 'title' => "Platform Version", 'value' => CORE_VERSION, 'level' => false ); $this->debug_info[] = array( 'title' => "Platform Build", 'value' => $platform_build , 'level' => false ); $this->debug_info[] = array( 'title' => "PHP Version", 'value' => floatval( phpversion() ), 'level' => false ); $this->debug_info[] = array( 'title' => "Child theme", 'value' => ( TEMPLATEPATH != STYLESHEETPATH ) ? 'Yes' : '', 'level' => false, 'extra' => STYLESHEETPATH . '<br />' . get_stylesheet_directory_uri() ); $this->debug_info[] = array( 'title' => "Ajax disbled", 'value' => ( get_pagelines_option( 'disable_ajax_save' ) ) ? 'Yes':'', 'level' => false ); $this->debug_info[] = array( 'title' => "CSS Inline", 'value' => ( get_pagelines_option( 'inline_dynamic_css' ) ) ? 'Yes':'', 'level' => false ); $this->debug_info[] = array( 'title' => "CSS Error", 'value' => ( !get_pagelines_option( 'inline_dynamic_css' ) && !is_multisite() && !is_writable( PAGELINES_DCSS ) ) ? 'File is not writable!':'', 'level' => false ); $this->debug_info[] = array( 'title' => "PHP Safe Mode", 'value' => ( (bool) ini_get('safe_mode') ) ? 'Yes!':'', 'level' => false ); $this->debug_info[] = array( 'title' => "PHP Open basedir restriction", 'value' => ( (bool) ini_get('open_basedir') ) ? 'Yes!':'', 'level' => false ); $this->debug_info[] = array( 'title' => "PHP Register Globals", 'value' => ( (bool) ini_get('register_globals') ) ? 'Yes!':'', 'level' => false ); $this->debug_info[] = array( 'title' => "PHP Magic Quotes gpc", 'value' => ( (bool) ini_get('magic_quotes_gpc') ) ? 'Yes!':'', 'level' => false ); $this->debug_info[] = array( 'title' => "PHP low memory", 'value' => ( !ini_get('memory_limit') || ( intval(ini_get('memory_limit')) <= 32 ) ) ? intval(ini_get('memory_limit') ):'', 'level' => false ); $this->debug_info[] = array( 'title' => "Mysql version", 'value' => ( version_compare( $wpdb->get_var("SELECT VERSION() AS version"), '5' ) < 0 ) ? $wpdb->get_var("SELECT VERSION() AS version"):'', 'level' => false ); $this->debug_info[] = array( 'title' => "Upload DIR", 'value' => ( !is_writable( $uploads['path'] ) ) ? "Unable to write to <code>{$uploads['subdir']}</code>":'', 'level' => true, 'extra' => $uploads['path'] ); $this->debug_info[] = array( 'title' => "PHP type", 'value' => php_sapi_name(), 'level' => false ); $this->debug_info[] = array( 'title' => "OS", 'value' => PHP_OS, 'level' => false ); if ( get_pagelines_option('disable_updates') == true || ( is_multisite() && ! is_super_admin() ) ) { $this->debug_info[] = array( 'title' => "Automatic Updates", 'value' => 'Disabled', 'level' => false ); } else { $this->debug_info[] = array( 'title' => "Updates Credentials", 'value' => ( !pagelines_option( 'lp_username' ) || !pagelines_option( 'lp_password' ) ) ? 'Username/Password is required for automatic upgrades to function.' : '', 'level' => false ); if ( is_array( $a = get_transient('pagelines-update-PlatformPro') ) ) { $this->debug_info[] = array( 'title' => "Automatic Updates", 'value' => ( $a['package'] !== 'bad' ) ? 'Working.' : 'Not working', 'extra' => ( $a['package'] !== 'bad' ) ? 'Latest available: ' . array_shift( array_splice( $a, 0, count( $a ) ) ) : '', 'level' => false ); } } $this->debug_info[] = array( 'title' => "Plugins", 'value' => $this->debug_get_plugins(), 'level' => false ); }
function pagelines_register_settings() { register_setting(PAGELINES_SETTINGS, PAGELINES_SETTINGS, 'pagelines_settings_callback'); /* Set default settings */ add_option(PAGELINES_SETTINGS, pagelines_settings_defaults()); // only fires first time pagelines_wp_option_defaults(); // Add stand alone wp options, only fires first time if (!isset($_REQUEST['page']) || $_REQUEST['page'] != 'pagelines') { return; } /* Typography Options */ $GLOBALS['pl_foundry'] = new PageLinesFoundry(); /* Import/Exporting */ pagelines_import_export(); pagelines_process_reset_options(); /* Regenerate Dynamic CSS ? */ $new_version_regen = !get_option("pl_dynamic_version") || get_option("pl_dynamic_version") != CORE_VERSION ? true : false; if (isset($_GET['activated']) || isset($_GET['updated']) || isset($_GET['reset']) || isset($_GET['settings-updated']) || $new_version_regen) { pagelines_build_dynamic_css('Page Load'); if (get_pagelines_option('lp_username') && get_pagelines_option('lp_password')) { if ($update = get_transient('pagelines-update-' . THEMENAME)) { $update = maybe_unserialize($update); if ($update['package'] == 'bad') { delete_transient('pagelines-update-' . THEMENAME); } delete_transient('pagelines-update-' . CHILDTHEMENAME); } } if ($new_version_regen) { update_option("pl_dynamic_version", CORE_VERSION); } } if (pagelines_option('reset')) { update_option(PAGELINES_SETTINGS, pagelines_settings_defaults()); pagelines_wp_option_defaults(true); pagelines_build_dynamic_css('Reset'); wp_redirect(admin_url('admin.php?page=pagelines&reset=true')); exit; } }
/** * Debug tests. * @return array Test results. */ function wp_debug_info() { global $wpdb, $wp_version, $platform_build; // Set data & variables first $uploads = wp_upload_dir(); // Get user role $current_user = wp_get_current_user(); $user_roles = $current_user->roles; $user_role = array_shift($user_roles); // Format data for processing by a template $this->debug_info[] = array('title' => 'WordPress Version', 'value' => $wp_version, 'level' => false); $this->debug_info[] = array('title' => 'Multisite Enabled', 'value' => is_multisite() ? 'Yes' : 'No', 'level' => false); $this->debug_info[] = array('title' => 'Current Role', 'value' => $user_role, 'level' => false); $this->debug_info[] = array('title' => 'Framework Path', 'value' => '<code>' . get_template_directory() . '</code>', 'level' => false); $this->debug_info[] = array('title' => 'Framework URI', 'value' => '<code>' . get_template_directory_uri() . '</code>', 'level' => false); $this->debug_info[] = array('title' => 'Framework Version', 'value' => PL_CORE_VERSION, 'level' => false); $this->debug_info[] = array('title' => 'Framework Build', 'value' => $platform_build, 'level' => false); $this->debug_info[] = array('title' => 'PHP Version', 'value' => floatval(phpversion()), 'level' => false); $this->debug_info[] = array('title' => 'Child theme', 'value' => get_template_directory() != get_stylesheet_directory() ? 'Yes' : '', 'level' => false, 'extra' => get_stylesheet_directory() . '<br />' . get_stylesheet_directory_uri()); $this->debug_info[] = array('title' => 'Ajax disbled', 'value' => get_pagelines_option('disable_ajax_save') ? 'Yes' : '', 'level' => false); $this->debug_info[] = array('title' => 'PHP Safe Mode', 'value' => (bool) ini_get('safe_mode') ? 'Yes!' : '', 'level' => false); $this->debug_info[] = array('title' => 'PHP Open basedir restriction', 'value' => (bool) ini_get('open_basedir') ? 'Yes!' : '', 'level' => false); $this->debug_info[] = array('title' => 'PHP Register Globals', 'value' => (bool) ini_get('register_globals') ? 'Yes (bad)' : '', 'level' => false); $this->debug_info[] = array('title' => 'PHP Magic Quotes gpc', 'value' => (bool) ini_get('magic_quotes_gpc') ? 'Yes (bad)' : '', 'level' => false); $this->debug_info[] = array('title' => 'PHP memory', 'value' => intval(ini_get('memory_limit')), 'level' => false); $this->debug_info[] = array('title' => 'Mysql version', 'value' => version_compare($wpdb->get_var("SELECT VERSION() AS version"), '6') < 0 ? $wpdb->get_var("SELECT VERSION() AS version") : '', 'level' => false); $ex_dir = PL_EXTEND_DIR; if (!is_dir($ex_dir)) { $this->debug_info[] = array('title' => 'Sections Plugin', 'value' => 'Not Installed!', 'level' => true); } if (is_dir($ex_dir)) { $this->debug_info[] = array('title' => 'Sections DIR', 'value' => !is_writable(PL_EXTEND_DIR) ? "Not Writable!" : 'Writable.', 'level' => true, 'extra' => PL_EXTEND_DIR); } include_once ABSPATH . 'wp-admin/includes/plugin.php'; if (is_dir($ex_dir) && !is_plugin_active('pagelines-sections/pagelines-sections.php')) { $this->debug_info[] = array('title' => 'Sections Plugin', 'value' => 'Not Active!', 'level' => true); } $this->debug_info[] = array('title' => 'PHP type', 'value' => php_sapi_name(), 'level' => false); $processUser = !function_exists('posix_geteuid') || !function_exists('posix_getpwuid') ? 'posix functions are disabled on this host!' : posix_getpwuid(posix_geteuid()); if (is_array($processUser)) { $processUser = $processUser['name']; } $this->debug_info[] = array('title' => 'PHP User', 'value' => $processUser, 'level' => false); $this->debug_info[] = array('title' => 'OS', 'value' => PHP_OS, 'level' => false); if (get_pagelines_option('disable_updates') == true || is_multisite() && !is_super_admin()) { $this->debug_info[] = array('title' => 'Automatic Updates', 'value' => 'Disabled', 'level' => false); } else { $this->debug_info[] = array('title' => 'Launchpad', 'value' => !pagelines_check_credentials() ? 'Not logged in.' : sprintf('Logged in ( %s ) ', get_pagelines_credentials('user')), 'level' => false); if (pagelines_check_credentials()) { $this->debug_info[] = array('title' => 'Licence', 'value' => get_pagelines_credentials('licence'), 'extra' => get_pagelines_credentials('error'), 'level' => false); } } $this->debug_info[] = array('title' => 'Plugins', 'value' => $this->debug_get_plugins(), 'level' => false); }