/** * * @TODO document * */ function website_setup() { $a = array('icon' => PL_ADMIN_ICONS . '/compass.png', 'account_signup' => array('default' => '', 'type' => 'account_signup', 'inputlabel' => __('Account Login', 'pagelines'), 'title' => __('PageLines Account Sign In', 'pagelines'), 'shortexp' => __('Login or Register for a Free PageLines Account', 'pagelines'), 'exp' => __('Logging in with your PageLines account will allow you to purchase items from the PageLines Store, and more.', 'pagelines')), 'pl_logo' => array('type' => 'multi_option', 'selectvalues' => array('pagelines_custom_logo' => array('default' => PL_IMAGES . '/logo.png', 'type' => 'image_upload', 'imagepreview' => '270', 'inputlabel' => __('Upload custom logo', 'pagelines'))), 'title' => __('Custom Logo', 'pagelines'), 'shortexp' => __('Input full URL to your custom header or logo image', 'pagelines'), 'exp' => ''), 'pagelines_favicon' => array('version' => 'pro', 'default' => PL_ADMIN_IMAGES . "/favicon-pagelines.ico", 'inputlabel' => 'Upload Favicon (16px by 16px)', 'type' => 'image_upload', 'imagepreview' => '16', 'title' => __('Favicon Image', 'pagelines'), 'shortexp' => __('Input full URL to favicon image (<strong>favicon.ico</strong> image file)', 'pagelines'), 'exp' => __('Enter the full URL location of your custom <strong>favicon</strong> which is visible in browser favorites and tabs.<br/> <strong>Must be .png or .ico file - 16px by 16px</strong>.', 'pagelines')), 'twittername' => array('default' => '', 'type' => 'text', 'inputlabel' => __('Your Twitter Username', 'pagelines'), 'title' => __('Twitter Integration', 'pagelines'), 'shortexp' => __('Places your Twitter feed in your site', 'pagelines'), 'exp' => __('This places your Twitter feed on the site. Leave blank if you want to hide or not use.', 'pagelines')), 'site-hashtag' => array('default' => '', 'type' => 'text', 'inputlabel' => __('Your Website Hashtag', 'pagelines'), 'title' => __('Website Hashtag', 'pagelines'), 'shortexp' => __('This hashtag will be used in social media (e.g. Twitter) and elsewhere to create feeds.', 'pagelines'), 'exp' => __('Having a hashtag can be useful in creating a common thread or feed in your social media efforts.', 'pagelines')), 'pl_login_image' => array('version' => 'pro', 'default' => PL_ADMIN_IMAGES . "/login-pl.png", 'type' => 'image_upload', 'inputlabel' => 'Upload Icon (80px Height)', 'imagepreview' => '60', 'title' => __('Login Page Image', 'pagelines'), 'shortexp' => __("The image to use on your site's login page", 'pagelines'), 'exp' => __('This image will be used on the login page to your admin. Use an image that is approximately <strong>80px</strong> in height.', 'pagelines')), 'pagelines_touchicon' => array('version' => 'pro', 'default' => '', 'inputlabel' => 'Upload Icon (57px by 57px)', 'type' => 'image_upload', 'imagepreview' => '60', 'title' => __('Mobile Touch Image', 'pagelines'), 'shortexp' => __('Input full URL to Apple touch image (.jpg, .gif, .png)', 'pagelines'), 'exp' => __('Enter the full URL location of your Apple Touch Icon which is visible when your users set your site as a <strong>webclip</strong> in Apple Iphone and Touch Products. It is an image approximately 57px by 57px in either .jpg, .gif or .png format.', 'pagelines')), 'pl_watermark' => array('version' => 'pro', 'type' => 'multi_option', 'selectvalues' => array('watermark_image' => array('type' => 'image_upload', 'inputlabel' => 'Watermark Image', 'default' => PL_IMAGES . '/pagelines.png'), 'watermark_link' => array('type' => 'text', 'inputlabel' => 'Watermark Link (Blank for None)', 'default' => 'http://www.pagelines.com'), 'watermark_alt' => array('type' => 'text', 'inputlabel' => 'Watermark Link alt text', 'default' => 'Build a website with PageLines'), 'watermark_hide' => array('type' => 'check', 'inputlabel' => "Hide Watermark")), 'title' => __('Website Watermark', 'pagelines'), 'shortexp' => __('Configure your website watermark (in footer)', 'pagelines'), 'exp' => ''), 'pagetitles' => array('default' => true, 'type' => 'check', 'inputlabel' => __('Automatically show Page titles?', 'pagelines'), 'title' => __('Page Titles', 'pagelines'), 'shortexp' => __('Show the title of pages above the page content', 'pagelines'), 'exp' => __('This option will automatically place page titles on all pages.', 'pagelines')), 'sidebar_no_default' => array('default' => '', 'type' => 'check', 'inputlabel' => __('Hide Sidebars When Empty (no widgets)', 'pagelines'), 'title' => __('Remove Default Sidebars When Empty', 'pagelines'), 'shortexp' => __('Hide default sidebars when sidebars have no widgets in them', 'pagelines'), 'exp' => __('This allows you to remove sidebars completely when they have no widgets in them.', 'pagelines')), 'sidebar_wrap_widgets' => array('default' => 'top', 'version' => 'pro', 'type' => 'select', 'selectvalues' => array('top' => array('name' => __('On Top of Sidebar', 'pagelines')), 'bottom' => array('name' => __('On Bottom of Sidebar', 'pagelines'))), 'inputlabel' => __('Sidebar Wrap Widgets Position', 'pagelines'), 'title' => __('Sidebar Wrap Widgets', 'pagelines'), 'shortexp' => __('Choose whether to show the sidebar wrap widgets on the top or bottom of the sidebar', 'pagelines'), 'exp' => __('You can select whether to show the widgets that you place in the sidebar wrap template in either the top or the bottom of the sidebar.', 'pagelines'))); if (get_option('pagelines_email_sent')) { unset($a['email_capture']); } if (pagelines_check_credentials()) { unset($a['account_signup']); } return apply_filters('pagelines_options_website_setup', $a); }
function featured_image() { if ($this->settings['featured_image']) { add_filter('pl_support_featured_image', array($this, 'add_featured_image')); } } /** * * @TODO document * */ function add_featured_image($support_array) { $support_array[] = $this->id; return $support_array; } } } /* * Set runtime licence types * */ if (!defined('VDEV')) { define('VDEV', get_pagelines_credentials('licence') === 'dev' ? true : false); } if (!defined('VPRO')) { define('VPRO', true); } if (!defined('VPLUS')) { define('VPLUS', pagelines_check_credentials('plus') ? true : false); }
/** * * @TODO document * */ function updates_setup($oid, $o) { if (pagelines_check_credentials()) { $updates_exp = sprintf(__('Successfully logged in as "%s" to PageLines%s.', 'pagelines'), get_pagelines_credentials('user'), pagelines_check_credentials('ssl') ? ' with a secured connection' : ''); } else { $updates_exp = sprintf(__('Could not connect to PageLines as user "%s".', 'pagelines'), get_pagelines_credentials('user')); } if (pagelines_check_credentials('error') === 'creds') { $updates_exp = sprintf(__('ERROR: %1$s<br />There was a problem logging in to PageLines.', 'pagelines'), pagelines_check_credentials('message')); } if (pagelines_check_credentials('licence') === 'dev') { $updates_exp .= __('<br />Developer edition enabled.', 'pagelines'); } if (get_pagelines_credentials('user') === '' || get_pagelines_credentials('pass') === '') { $updates_exp = sprintf(__("Please set your PageLines login credentials.<br />No account yet? <a href='%s'>Get one now</a>.", 'pagelines'), PL_SIGNUP); } if (pagelines_check_credentials('error') === 'licence') { $updates_exp .= sprintf('<br /><br />%s', pagelines_check_credentials('message')); } if ('true' === pagelines_check_credentials('plus')) { $updates_exp .= sprintf('<br /><br />%s', __('Active Plus account.', 'pagelines')); } ?> <div class="pl_form"> <div class="pl_form_feedback"> <?php echo $updates_exp; ?> </div> <form method="post" class="pl_account_info fix"> <div class="pl_account_info_pad"> <div class="pl_account_form"> <?php if (!pagelines_check_credentials()) { ?> <div class="plform_title"> <h2>PageLines Account Info</h2> </div> <?php } ?> <input type="hidden" name="form_submitted" value="plinfo" /> <?php if (pagelines_check_credentials()) { echo '<input type="hidden" name="creds_reset" value="yes" />'; echo $this->superlink(__('Reset Account Credentials →', 'pagelines'), 'blue', 'updates-setup', 'submit'); } else { echo $this->input_label('lp_username', __('PageLines Username', 'pagelines')); echo $this->input_text('lp_username', 'lp_username', get_pagelines_credentials('user'), 'bigtext pluser'); echo $this->input_label('lp_password', __('PageLines Password', 'pagelines')); echo $this->input_text('lp_password', 'lp_password', '', 'bigtext pluser', 'password'); echo $this->superlink(__('Submit Credentials', 'pagelines'), 'blue', 'updates-setup', 'submit'); } ?> </form> </div> <div class="clear"></div> </div> </div> <?php }
/** * * Helper function * Returns array of section files. * @return array of php files * @author Simon Prosser **/ function pagelines_getsections($dir, $type) { if ('parent' != $type && !is_dir($dir)) { return; } if (is_multisite()) { $store_sections = $this->get_latest_cached('sections'); } $default_headers = array('External' => 'External', 'Demo' => 'Demo', 'tags' => 'Tags', 'version' => 'Version', 'author' => 'Author', 'authoruri' => 'Author URI', 'section' => 'Section', 'description' => 'Description', 'classname' => 'Class Name', 'depends' => 'Depends', 'workswith' => 'workswith', 'edition' => 'edition', 'cloning' => 'cloning', 'failswith' => 'failswith', 'tax' => 'tax', 'persistant' => 'Persistant', 'format' => 'Format', 'classes' => 'Classes'); $sections = array(); // setup out directory iterator. // symlinks were only supported after 5.3.1 // so we need to check first ;) $it = strnatcmp(phpversion(), '5.3.1') >= 0 ? new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir, FilesystemIterator::FOLLOW_SYMLINKS), RecursiveIteratorIterator::SELF_FIRST) : new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir, RecursiveIteratorIterator::CHILD_FIRST)); foreach ($it as $fullFileName => $fileSPLObject) { if (basename($fullFileName) == PL_EXTEND_SECTIONS_PLUGIN) { continue; } if (pathinfo($fileSPLObject->getFilename(), PATHINFO_EXTENSION) == 'php') { $base_url = null; $base_dir = null; $load = true; $price = ''; $uid = ''; $headers = get_file_data($fullFileName, $default_headers); // If no pagelines class headers ignore this file. if (!$headers['classname']) { continue; } preg_match('#[\\/|\\-]sections[\\/|\\\\]([^\\/|\\\\]+)#', $fullFileName, $out); $version = '' != $headers['version'] ? $headers['version'] : PL_CORE_VERSION; $folder = sprintf('/%s', $out[1]); $base_dir = get_template_directory() . '/sections' . $folder; if ('child' == $type) { $base_url = PL_EXTEND_URL . $folder; $base_dir = PL_EXTEND_DIR . $folder; } if ('custom' == $type) { $base_url = get_stylesheet_directory_uri() . '/sections' . $folder; $base_dir = get_stylesheet_directory() . '/sections' . $folder; } /* * Look for custom dirs. */ if ('custom' != $type && 'child' != $type && 'parent' != $type) { // prepare url $file = basename($dir); $path = plugin_dir_path($file); $url = plugins_url($file); $base_url = sprintf('%s/sections%s', $url, $folder); $base_dir = sprintf('%ssections%s', $dir, $folder); } $base_dir = isset($base_dir) ? $base_dir : PL_SECTIONS . $folder; $base_url = isset($base_url) ? $base_url : PL_SECTION_ROOT . $folder; $slug = basename($folder); $purchased = isset($store_sections->{$slug}->purchased) ? $store_sections->{$slug}->purchased : ''; $plus = isset($store_sections->{$slug}->plus_product) ? $store_sections->{$slug}->plus_product : ''; if ($plus && pagelines_check_credentials('plus')) { $purchased = 'purchased'; } $sections[$headers['classname']] = array('class' => $headers['classname'], 'depends' => $headers['depends'], 'type' => $type, 'tags' => $headers['tags'], 'author' => $headers['author'], 'version' => $version, 'authoruri' => isset($headers['authoruri']) ? $headers['authoruri'] : '', 'description' => $headers['description'], 'name' => $headers['section'], 'base_url' => $base_url, 'base_dir' => $base_dir, 'base_file' => $fullFileName, 'workswith' => $headers['workswith'] ? array_map('trim', explode(',', $headers['workswith'])) : '', 'edition' => $headers['edition'], 'cloning' => 'true' === $headers['cloning'] ? true : '', 'failswith' => $headers['failswith'] ? array_map('trim', explode(',', $headers['failswith'])) : '', 'tax' => $headers['tax'], 'demo' => $headers['Demo'], 'external' => $headers['External'], 'persistant' => $headers['persistant'], 'format' => $headers['format'], 'classes' => $headers['classes'], 'screenshot' => is_file($base_dir . '/thumb.png') ? $base_url . '/thumb.png' : '', 'less' => is_file($base_dir . '/color.less') || is_file($base_dir . '/style.less') ? true : false, 'loadme' => $load, 'price' => $price, 'purchased' => $purchased, 'uid' => $uid); } } return $sections; }
function get_live_bill() { $url = pagelines_check_credentials('vchat'); $iframe = $url ? sprintf('<iframe class="live_chat_iframe" src="%s"></iframe>', $url) : false; $rand = ob_start(); ?> <div class="admin_billboard"> <div class="admin_billboard_pad fix"> <h3 class="admin_header_main"> <?php _e('PageLines Live Chat (Beta)', 'pagelines'); ?> </h3> <div class='admin_billboard_text'> <?php _e('A moderated live community chat room for discussing technical issues. (Plus Only)', 'pagelines'); ?> </div> <?php if (pagelines_check_credentials('plus')) { printf('<div class="plus_chat_header">%s</div>', $this->pagelines_livechat_rules()); } ?> </div> </div> <div class="live_chat_wrap fix"> <?php if ($iframe) { echo $iframe; } else { ?> <div class="live_chat_up_bill"> <h3><?php _e('Live Chat Requires an active PageLines Plus account', 'pagelines'); ?> </h3> <?php if (!pagelines_check_credentials()) { printf('<a class="button" href="%s">Login</a>', admin_url(PL_ACCOUNT_URL)); } else { if (!VPLUS) { printf('<a class="button" href="%s">%s</a>', pl_get_plus_link(), __('Upgrade to PageLines Plus', 'pagelines')); } } ?> </div> <?php } ?> </div> <?php $bill = ob_get_clean(); return apply_filters('pagelines_welcome_billboard', $bill); }
function get_updates() { $default['story0'] = array('title' => __("No new updates available.", 'pagelines'), 'text' => false); if (EXTEND_NETWORK || !pagelines_check_credentials()) { return $default; } $updates = json_decode(get_theme_mod('pending_updates')); if (!is_object($updates)) { return $default; } $data = array(); $a = 0; foreach ($updates as $key => $update) { $data["story{$a}"] = array('title' => $update->name, 'text' => $update->changelog, 'tag' => $update->type, 'data' => $update); $a++; } if (empty($data)) { return $default; } return $data; }
/** * 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); }
/** * * @TODO document * */ function updates_configured() { return pagelines_check_credentials() ? true : false; }