diff --git a/wp-content/login-logo.png b/wp-content/login-logo.png new file mode 100644 index 0000000..ff5e4ee Binary files /dev/null and b/wp-content/login-logo.png differ diff --git a/wp-content/plugins/login-logo/login-logo.php b/wp-content/plugins/login-logo/login-logo.php new file mode 100644 index 0000000..8c6461b --- /dev/null +++ b/wp-content/plugins/login-logo/login-logo.php @@ -0,0 +1,192 @@ +login-logo.png into your wp-content directory. This simple plugin takes care of the rest, with zero configuration. Transparent backgrounds work best. Crop it tight, with a width of 312 pixels, for best results. +Version: 0.6 +License: GPL +Plugin URI: http://txfx.net/wordpress-plugins/login-logo/ +Author: Mark Jaquith +Author URI: http://coveredwebservices.com/ + +========================================================================== + +Copyright 2011-2012 Mark Jaquith + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +class CWS_Login_Logo_Plugin { + static $instance; + const cutoff = 312; + var $logo_locations; + var $logo_location; + var $width = 0; + var $height = 0; + var $original_width; + var $original_height; + var $logo_size; + var $logo_file_exists; + + public function __construct() { + self::$instance = $this; + add_action( 'login_head', array( $this, 'login_head' ) ); + } + + public function init() { + global $blog_id; + $this->logo_locations = array(); + if ( is_multisite() && function_exists( 'get_current_site' ) ) { + // First, see if there is one for this specific site (blog) + $this->logo_locations['site'] = array( + 'path' => WP_CONTENT_DIR . '/login-logo-site-' . $blog_id . '.png', + 'url' => $this->maybe_ssl( WP_CONTENT_URL . '/login-logo-site-' . $blog_id . '.png' ) + ); + + // Next, we see if there is one for this specific network + $site = get_current_site(); // Site = Network? Ugh. + if ( $site && isset( $site->id ) ) { + $this->logo_locations['network'] = array( + 'path' => WP_CONTENT_DIR . '/login-logo-network-' . $site->id . '.png', + 'url' => $this->maybe_ssl( WP_CONTENT_URL . '/login-logo-network-' . $site->id . '.png' ) + ); + } + } + // Finally, we do a global lookup + $this->logo_locations['global'] = array( + 'path' => WP_CONTENT_DIR . '/login-logo.png', + 'url' => $this->maybe_ssl( WP_CONTENT_URL . '/login-logo.png' ) + ); + } + + private function maybe_ssl( $url ) { + if ( is_ssl() ) + $url = preg_replace( '#^http://#', 'https://', $url ); + return $url; + } + + private function logo_file_exists() { + if ( ! isset( $this->logo_file_exists ) ) { + foreach ( $this->logo_locations as $location ) { + if ( file_exists( $location['path'] ) ) { + $this->logo_file_exists = true; + $this->logo_location = $location; + break; + } else { + $this->logo_file_exists = false; + } + } + } + return !! $this->logo_file_exists; + } + + private function get_location( $what = '' ) { + if ( $this->logo_file_exists() ) { + if ( 'path' == $what || 'url' == $what ) + return $this->logo_location[$what]; + else + return $this->logo_location; + } + return false; + } + + private function get_width() { + $this->get_logo_size(); + return absint( $this->width ); + } + + private function get_height() { + $this->get_logo_size(); + return absint( $this->height ); + } + + private function get_original_width() { + $this->get_logo_size(); + return absint( $this->original_width ); + } + + private function get_original_height() { + $this->get_logo_size(); + return absint( $this->original_height ); + } + + private function get_logo_size() { + if ( !$this->logo_file_exists() ) + return false; + if ( !$this->logo_size ) { + if ( $sizes = getimagesize( $this->get_location( 'path' ) ) ) { + $this->logo_size = $sizes; + $this->width = $sizes[0]; + $this->height = $sizes[1]; + $this->original_height = $this->height; + $this->original_width = $this->width; + if ( $this->width > self::cutoff ) { + // Use CSS 3 scaling + $ratio = $this->height / $this->width; + $this->height = ceil( $ratio * self::cutoff ); + $this->width = self::cutoff; + } + } else { + $this->logo_file_exists = false; + } + } + return array( $this->width, $this->height ); + } + + private function css3( $rule, $value ) { + foreach ( array( '', '-o-', '-webkit-', '-khtml-', '-moz-', '-ms-' ) as $prefix ) { + echo $prefix . $rule . ': ' . $value . '; '; + } + } + + public function login_headerurl() { + return trailingslashit( get_bloginfo( 'url' ) ); + } + + public function login_head() { + $this->init(); + if ( !$this->logo_file_exists() ) + return; + add_filter( 'login_headerurl', array( $this, 'login_headerurl' ) ); + ?> + + +get_width() ) { ?> + +, 2010. +# +msgid "" +msgstr "" +"Project-Id-Version: Private BuddyPress 1.0\n" +"Report-Msgid-Bugs-To: http://wordpress.org/tag/private-buddypress\n" +"POT-Creation-Date: 2010-09-20 09:28+0000\n" +"PO-Revision-Date: 2010-09-20 11:28+0100\n" +"Last-Translator: Dennis Morhardt \n" +"Language-Team: Dennis Morhardt \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-Language: German\n" +"X-Poedit-Country: GERMANY\n" +"X-Poedit-SourceCharset: utf-8\n" + +#: private-buddypress.php:51 +msgid "BuddyPress Protection" +msgstr "Schutz der BuddyPress-Seiten" + +#: private-buddypress.php:144 +msgid "Exclude from protection" +msgstr "Ausnahmen vom Schutz" + +#: private-buddypress.php:146 +msgid "Front page" +msgstr "Startseite" + +#: private-buddypress.php:147 +msgid "Blog pages (posts, archives and non-buddypress pages)" +msgstr "Blogseiten (Artikel, Archive und normale statische Seiten)" + +#: private-buddypress.php:148 +msgid "Registration" +msgstr "Registrierung" + +#. Plugin Name of the plugin/theme +msgid "Private BuddyPress" +msgstr "Privates BuddyPress" + +#. Plugin URI of the plugin/theme +msgid "http://bp-tutorials.de/" +msgstr "http://bp-tutorials.de/" + +#. Description of the plugin/theme +msgid "Protect your BuddyPress Installation from strangers. Only registered users will be allowed to view the installation." +msgstr "Schütze Deine BuddyPress-Installation vor Unbekannten. Nur angemeldete Benutzer können Deine Seite aufrufen." + +#. Author of the plugin/theme +msgid "Dennis Morhardt" +msgstr "Dennis Morhardt" + +#. Author URI of the plugin/theme +msgid "http://www.dennismorhardt.de/" +msgstr "http://www.dennismorhardt.de/" + +#~ msgid "Blog pages" +#~ msgstr "Blogseiten (Artikel, Archive und Nicht-BuddyPress-Seiten)" diff --git a/wp-content/plugins/private-buddypress/languages/private-buddypress-he_IL.mo b/wp-content/plugins/private-buddypress/languages/private-buddypress-he_IL.mo new file mode 100644 index 0000000..97455c6 Binary files /dev/null and b/wp-content/plugins/private-buddypress/languages/private-buddypress-he_IL.mo differ diff --git a/wp-content/plugins/private-buddypress/languages/private-buddypress-he_IL.po b/wp-content/plugins/private-buddypress/languages/private-buddypress-he_IL.po new file mode 100644 index 0000000..94c3635 --- /dev/null +++ b/wp-content/plugins/private-buddypress/languages/private-buddypress-he_IL.po @@ -0,0 +1,59 @@ +# Translation of the WordPress plugin Private BuddyPress 1.0.2 by Dennis Morhardt. +# Copyright (C) 2010 Dennis Morhardt +# This file is distributed under the same license as the Private BuddyPress package. +# FIRST AUTHOR , 2010. +# +msgid "" +msgstr "" +"Project-Id-Version: Private BuddyPress 1.0.2\n" +"Report-Msgid-Bugs-To: http://wordpress.org/tag/private-buddypress\n" +"POT-Creation-Date: 2010-09-20 09:28+0000\n" +"PO-Revision-Date: 2011-01-23 23:55+0100\n" +"Last-Translator: Dennis Morhardt \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-Language: Hebrew\n" +"X-Poedit-Country: ISRAEL\n" + +#: private-buddypress.php:51 +msgid "BuddyPress Protection" +msgstr "הגנת BuddyPress" + +#: private-buddypress.php:144 +msgid "Exclude from protection" +msgstr "השמט מהגנה" + +#: private-buddypress.php:146 +msgid "Front page" +msgstr "דף ראשי" + +#: private-buddypress.php:147 +msgid "Blog pages (posts, archives and non-buddypress pages)" +msgstr "דפי בלוג (פוסטים, ארכיבים ושאר דפים שאינם שייכים ל-BuddyPress )" + +#: private-buddypress.php:148 +msgid "Registration" +msgstr "רישום" + +#. Plugin Name of the plugin/theme +msgid "Private BuddyPress" +msgstr "Private BuddyPress" + +#. Plugin URI of the plugin/theme +msgid "http://bp-tutorials.de/" +msgstr "http://bp-tutorials.de/" + +#. Description of the plugin/theme +msgid "Protect your BuddyPress Installation from strangers. Only registered users will be allowed to view the installation." +msgstr "הגן על התקנת BuddyPress שלך מזרים. רק משתמשים רשומים יוכלו לצפות באתר." + +#. Author of the plugin/theme +msgid "Dennis Morhardt" +msgstr "Dennis Morhardt" + +#. Author URI of the plugin/theme +msgid "http://www.dennismorhardt.de/" +msgstr "http://www.dennismorhardt.de/" + diff --git a/wp-content/plugins/private-buddypress/languages/private-buddypress.pot b/wp-content/plugins/private-buddypress/languages/private-buddypress.pot new file mode 100644 index 0000000..1d1f840 --- /dev/null +++ b/wp-content/plugins/private-buddypress/languages/private-buddypress.pot @@ -0,0 +1,59 @@ +# Translation of the WordPress plugin Private BuddyPress 1.0.4 by Dennis Morhardt. +# Copyright (C) 2011 Dennis Morhardt +# This file is distributed under the same license as the Private BuddyPress package. +# FIRST AUTHOR , 2010. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Private BuddyPress 1.0.4\n" +"Report-Msgid-Bugs-To: http://wordpress.org/tag/private-buddypress\n" +"POT-Creation-Date: 2010-09-20 09:28+0000\n" +"PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: private-buddypress.php:51 +msgid "BuddyPress Protection" +msgstr "" + +#: private-buddypress.php:144 +msgid "Exclude from protection" +msgstr "" + +#: private-buddypress.php:146 +msgid "Front page" +msgstr "" + +#: private-buddypress.php:147 +msgid "Blog pages (posts, archives and non-buddypress pages)" +msgstr "" + +#: private-buddypress.php:148 +msgid "Registration" +msgstr "" + +#. Plugin Name of the plugin/theme +msgid "Private BuddyPress" +msgstr "" + +#. Plugin URI of the plugin/theme +msgid "http://bp-tutorials.de/" +msgstr "" + +#. Description of the plugin/theme +msgid "" +"Protect your BuddyPress Installation from strangers. Only registered users " +"will be allowed to view the installation." +msgstr "" + +#. Author of the plugin/theme +msgid "Dennis Morhardt" +msgstr "" + +#. Author URI of the plugin/theme +msgid "http://www.dennismorhardt.de/" +msgstr "" diff --git a/wp-content/plugins/private-buddypress/private-buddypress.php b/wp-content/plugins/private-buddypress/private-buddypress.php new file mode 100644 index 0000000..75c1dc7 --- /dev/null +++ b/wp-content/plugins/private-buddypress/private-buddypress.php @@ -0,0 +1,204 @@ +options = get_option('private_buddypress'); + $this->dbVersion = get_option('private_buddypress_version'); + + // Load textdomain + load_plugin_textdomain('private-buddypress', 'languages', dirname(plugin_basename(__FILE__)) . '/languages'); + + // Add admin options + add_action('admin_init', array($this, 'AdminInit')); + + // Add login redirect function + add_action('wp', array($this, 'LoginRedirect'), 1); + } + + function AdminInit() { + // Add settings section + add_settings_section('private-buddypress', __('BuddyPress Protection', 'private-buddypress'), array($this, 'AdminOptions'), 'privacy'); + add_action('load-options.php', array($this, 'SaveAdminOptions')); + + // Run action + do_action('pbp_admin_init'); + } + + function Install() { + // Check if a existing installation + if ( PRIVATE_BUDDYPRESS_VERSION == get_option( 'private_buddypress_version' ) ) + return; + + // Default options + $options = new stdClass(); + $options->exclude = new stdClass(); + $options->exclude->homepage = false; + $options->exclude->registration = false; + $options->exclude->blogpages = false; + + // Add or update options to database + update_option('private_buddypress', $options); + update_option('private_buddypress_version', PRIVATE_BUDDYPRESS_VERSION); + } + + function IsBuddyPressFeed() { + // Get BuddyPress + global $bp; + + // Default value + $isBuddyPressFeed = false; + + // Check if the current BuddyPress page is a feed + if ( $bp->current_action == 'feed' || $bp->action_variables[0] == 'feed' ) + $isBuddyPressFeed = true; + + // Return false if no BuddyPress feed has been called + return apply_filters('pbp_is_buddypress_feed', $isBuddyPressFeed); + } + + function ProtectBlogFeeds() { + // Default value + $protectBlogFeeds = false; + + // If blog pages should be protect, add protection to the feeds + if ( is_feed() && false == $this->options->exclude->blogpages ) + $protection = true; + + // Filter and return the value + return apply_filters('pbp_protect_blog_feeds', $protection); + } + + function LoginRedirect() { + // Get current position + $redirect_to = apply_filters('pbp_redirect_to_after_login', $_SERVER['REQUEST_URI']); + + // Check if user is logged in + if ( false == is_user_logged_in() ): + // Run action + do_action('pbp_login_redirect'); + + // Check if current page is a feed + if ( $this->ProtectBlogFeeds() || $this->IsBuddyPressFeed() ): + // Try to get saved login credentials + $credentials = array( + 'user_login' => $_SERVER['PHP_AUTH_USER'], + 'user_password' => $_SERVER['PHP_AUTH_PW'] + ); + + // Send headers for authentication + if ( is_wp_error( wp_signon( $credentials ) ) ): + header('WWW-Authenticate: Basic realm="' . get_option('blogtitle') . '"'); + header('HTTP/1.0 401 Unauthorized'); + die('

You need to be logged in to view this feed!

'); + endif; + // Redirect to login page if for current page a is required + elseif ( $this->LoginRequired() ): + $loginPage = apply_filters('pbp_redirect_login_page', get_option('siteurl') . '/wp-login.php?redirect_to=' . $redirect_to, $redirect_to); + wp_redirect($loginPage); + exit; + endif; + endif; + } + + function LoginRequired() { + // No login required if homepage is excluded + if ( true == $this->options->exclude->homepage && is_front_page() ) + return false; + + // No login required if registration is excluded + if ( true == $this->options->exclude->registration && ( bp_is_register_page() || bp_is_activation_page() ) ) + return false; + + // No login required if blog pages are excluded + if ( true == $this->options->exclude->blogpages && bp_is_blog_page() ) + return false; + + // Login required + return apply_filters('pbp_login_required_check', true); + } + + function SaveAdminOptions() { + // Check for plausibility + if ( 'yes' != $_POST["bp_protection_options"] ) + return; + + // Exclude homepage from protection + if ( '1' == $_POST["bp_protection_exclude_home"] ) + $this->options->exclude->homepage = true; + else + $this->options->exclude->homepage = false; + + // Exclude registration from protection + if ( '1' == $_POST["bp_protection_exclude_registration"] ) + $this->options->exclude->registration = true; + else + $this->options->exclude->registration = false; + + // Exclude blog pages from protection + if ( '1' == $_POST["bp_protection_exclude_blogpages"] ) + $this->options->exclude->blogpages = true; + else + $this->options->exclude->blogpages = false; + + // Save options + update_option('private_buddypress', apply_filters('pbp_pre_options', $this->options)); + + // Run action + do_action('pbp_save_options'); + } + + function AdminOptions() { ?> + + + + + +
+
+
+ + + +
+ Privacy`. + += Can I change the URL where non-loggedin users are being redirected? = + +Yes, currently you need to write a filter function in your functions.php. + +`function redirect_nonloggedin_users($current_uri, $redirect_to) { + // Redirect users to the homepage + // Caution! Exclude the homepage from 'Private BuddyPress' options + // to avoid redirection loops! + return get_option('siteurl') . '/?from=' . $redirect_to; +} + +add_filter('pbp_redirect_login_page', 'redirect_nonloggedin_users', 10, 2);` + += Can I exclude e.g. the blog directory from protection? = + +Yes, you need to write a filter: + +`function make_blog_directory_visible($visibility) { + global $bp; + + if ( bp_is_directory() && $bp->current_component == $bp->blogs->slug ) + return false; + + return $visibility; +} + +add_filter('pbp_login_required_check', 'make_blog_directory_visible');` + += Are there other actions or filters? = + +Yes, currently in Private Buddypress are existing 5 actions: + +* **pbp_init**: Fired when Private BuddyPress is initialised +* **pbp_admin_init**: Fired when Private BuddyPress in the admin area is initialised +* **pbp_login_redirect**: Fired when the users is not logged in and is being redirected to the login page or when it is a feed asked for a password +* **pbp_save_options**: Fired when the options of Private BuddyPress has been changed +* **pbp_options_page**: Fired on the options page to added more fields for custom options + +Also in Private BuddyPress are existing 6 filters: + +* **pbp_is_buddypress_feed**: Boolean value if the current page is a BuddyPress feed +* **pbp_redirect_to_after_login**: Called URI from where the users came from +* **pbp_redirect_login_page**: URI where nonloggedin users are being redirected +* **pbp_login_required_check**: Boolean value if for the current page a login is needed +* **pbp_pre_options**: Object with the new options before they saved +* **pbp_protect_blog_feeds**: Boolean value if blog feeds should be protected + +== Screenshots == + +1. Settings page, you can find it under `Settings -> Privacy` + +== Changelog == + += 1.0.4 = +* Fixed: If blog pages excluded from protection, don't protect the feeds +* Added: New filter: 'pbp_protect_blog_feeds' +* Added: Hebrew translation, thanks to gstupp + += 1.0.3 = +* Fixed: Options no longer disappear suddenly +* Fixed: BuddyPress feeds are now protected +* Added: Filters and actions, see FAQ for more information + += 1.0.2 = +* Fixed: Saving optings haven't worked correctly +* Added: Blog pages (e.g. posts, archives, non-buddypress pages) can now be excluded from protection + += 1.0.1 = +* Notification update for users who downloaded the plugin before it was finished +* Fixed: Some fatal PHP errors +* Added: Plugin is now translatable +* Added: German translation + += 1.0 = +* First release + +== Upgrade Notice == + += 1.0.4 = +Blog feeds are no longer protected if blog pages are excluded from the protection. Added also a Hebrew translation. + += 1.0.3 = +Options no longer disappear suddenly and BuddyPress feeds are now protected. Update is recommended. + += 1.0.2 = +Saving options now work correctly and added an option to exclude normal blog pages (e.g. posts, archives, non-buddypress pages) from protection. + += 1.0.1 = +Notification update for users who downloaded the plugin before it was finished. Fixed the fatal PHP error and added translations. + += 1.0 = +First release \ No newline at end of file diff --git a/wp-content/plugins/private-buddypress/screenshot-1.png b/wp-content/plugins/private-buddypress/screenshot-1.png new file mode 100644 index 0000000..fb8437a Binary files /dev/null and b/wp-content/plugins/private-buddypress/screenshot-1.png differ diff --git a/wp-content/plugins/wp-types/admin.php b/wp-content/plugins/wp-types/admin.php deleted file mode 100644 index 767c124..0000000 --- a/wp-content/plugins/wp-types/admin.php +++ /dev/null @@ -1,818 +0,0 @@ -
'; - echo $form->renderForm(); - echo '
'; - echo wpcf_add_admin_footer(); -} - -/** - * Menu page hook. - */ -function wpcf_admin_menu_summary_ctt_hook() { - do_action('wpcf_admin_page_init'); - wp_enqueue_script('wpcf-ctt', WPCF_RES_RELPATH . '/js/basic.js', - array('jquery', 'jquery-ui-sortable', 'jquery-ui-draggable'), - WPCF_VERSION); - wp_enqueue_style('wpcf-ctt', WPCF_RES_RELPATH . '/css/basic.css', array(), - WPCF_VERSION); - wpcf_admin_load_collapsible(); - require_once WPCF_INC_ABSPATH . '/custom-types.php'; - require_once WPCF_INC_ABSPATH . '/custom-taxonomies.php'; - require_once WPCF_INC_ABSPATH . '/custom-types-taxonomies-list.php'; -} - -/** - * Menu page display. - */ -function wpcf_admin_menu_summary_ctt() { - echo wpcf_add_admin_header(__('Custom Post Types and Taxonomies', 'wpcf')); - $to_display_posts = get_option('wpcf-custom-types', array()); - $to_display_tax = get_option('wpcf-custom-taxonomies', array()); - if (!empty($to_display_posts) || !empty($to_display_tax)) { - add_action('wpcf_types_tax_list_table_after', - 'wpcf_admin_promotional_text'); - } - wpcf_admin_ctt_list(); - echo wpcf_add_admin_footer(); -} - -/** - * Menu page hook. - */ -function wpcf_admin_menu_edit_type_hook() { - do_action('wpcf_admin_page_init'); - require_once WPCF_EMBEDDED_INC_ABSPATH . '/custom-types.php'; - require_once WPCF_INC_ABSPATH . '/custom-types-form.php'; - require_once WPCF_INC_ABSPATH . '/post-relationship.php'; - wp_enqueue_script('wpcf-fields-edit', WPCF_RES_RELPATH . '/js/basic.js', - array('jquery', 'jquery-ui-sortable', 'jquery-ui-draggable'), - WPCF_VERSION); - wp_enqueue_style('wpcf-type-edit', WPCF_RES_RELPATH . '/css/basic.css', - array(), WPCF_VERSION); - wp_enqueue_script('wpcf-form-validation', - WPCF_RES_RELPATH . '/js/' - . 'jquery-form-validation/jquery.validate.min.js', array('jquery'), - WPCF_VERSION); - wp_enqueue_script('wpcf-form-validation-additional', - WPCF_RES_RELPATH . '/js/' - . 'jquery-form-validation/additional-methods.min.js', - array('jquery'), WPCF_VERSION); - add_action('admin_footer', 'wpcf_admin_types_form_js_validation'); - wpcf_post_relationship_init(); - $form = wpcf_admin_custom_types_form(); - wpcf_form('wpcf_form_types', $form); -} - -/** - * Menu page display. - */ -function wpcf_admin_menu_edit_type() { - if (isset($_GET['wpcf-post-type'])) { - $title = __('Edit Custom Post Type', 'wpcf'); - } else { - $title = __('Add New Custom Post Type', 'wpcf'); - } - echo wpcf_add_admin_header($title); - $form = wpcf_form('wpcf_form_types'); - echo '
'; - echo $form->renderForm(); - echo '
'; - echo wpcf_add_admin_footer(); -} - -/** - * Menu page hook. - */ -function wpcf_admin_menu_edit_tax_hook() { - do_action('wpcf_admin_page_init'); - wp_enqueue_script('wpcf-tax-edit', WPCF_RES_RELPATH . '/js/basic.js', - array('jquery', 'jquery-ui-sortable', 'jquery-ui-draggable'), - WPCF_VERSION); - wp_enqueue_style('wpcf-tax-edit', WPCF_RES_RELPATH . '/css/basic.css', - array(), WPCF_VERSION); - wp_enqueue_script('wpcf-form-validation', - WPCF_RES_RELPATH . '/js/' - . 'jquery-form-validation/jquery.validate.min.js', array('jquery'), - WPCF_VERSION); - wp_enqueue_script('wpcf-form-validation-additional', - WPCF_RES_RELPATH . '/js/' - . 'jquery-form-validation/additional-methods.min.js', - array('jquery'), WPCF_VERSION); - add_action('admin_footer', 'wpcf_admin_tax_form_js_validation'); - require_once WPCF_EMBEDDED_INC_ABSPATH . '/custom-taxonomies.php'; - require_once WPCF_INC_ABSPATH . '/custom-taxonomies-form.php'; - $form = wpcf_admin_custom_taxonomies_form(); - wpcf_form('wpcf_form_tax', $form); -} - -/** - * Menu page display. - */ -function wpcf_admin_menu_edit_tax() { - if (isset($_GET['wpcf-tax'])) { - $title = __('Edit Taxonomy', 'wpcf'); - } else { - $title = __('Add New Taxonomy', 'wpcf'); - } - echo wpcf_add_admin_header($title); - $form = wpcf_form('wpcf_form_tax'); - echo '
'; - echo $form->renderForm(); - echo '
'; - echo wpcf_add_admin_footer(); -} - -/** - * Menu page hook. - */ -function wpcf_admin_menu_import_export_hook() { - do_action('wpcf_admin_page_init'); - wp_enqueue_style('wpcf-import-export', WPCF_RES_RELPATH . '/css/basic.css', - array(), WPCF_VERSION); - require_once WPCF_INC_ABSPATH . '/fields.php'; - require_once WPCF_INC_ABSPATH . '/import-export.php'; - if (extension_loaded('simplexml') && isset($_POST['export']) - && wp_verify_nonce($_POST['_wpnonce'], 'wpcf_import')) { - wpcf_admin_export_data(); - die(); - } -} - -/** - * Menu page display. - */ -function wpcf_admin_menu_import_export() { - echo wpcf_add_admin_header(__('Import/Export', 'wpcf')); - echo '
'; - echo wpcf_form_simple(wpcf_admin_import_export_form()); - echo '
'; - echo wpcf_add_admin_footer(); -} - -/** - * Menu page hook. - */ -function wpcf_admin_menu_custom_fields_control_hook() { - do_action('wpcf_admin_page_init'); - add_action('admin_head', 'wpcf_admin_custom_fields_control_js'); - add_thickbox(); - wp_enqueue_script('wpcf-fields-edit', WPCF_RES_RELPATH . '/js/basic.js', - array('jquery', 'jquery-ui-sortable', 'jquery-ui-draggable'), - WPCF_VERSION); - wp_enqueue_style('wpcf-custom-fields-control', - WPCF_RES_RELPATH . '/css/basic.css', array(), WPCF_VERSION); - require_once WPCF_INC_ABSPATH . '/fields.php'; - require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields.php'; - require_once WPCF_INC_ABSPATH . '/fields-control.php'; - - if (isset($_REQUEST['_wpnonce']) - && wp_verify_nonce($_REQUEST['_wpnonce'], - 'custom_fields_control_bulk') - && (isset($_POST['action']) || isset($_POST['action2'])) && !empty($_POST['fields'])) { - $action = $_POST['action'] == '-1' ? $_POST['action2'] : $_POST['action']; - wpcf_admin_custom_fields_control_bulk_actions($action); - } - - global $wpcf_control_table; - $wpcf_control_table = new WPCF_Custom_Fields_Control_Table(array( - 'ajax' => true, - 'singular' => __('Custom Field', 'wpcf'), - 'plural' => __('Custom Fields', 'wpcf'), - )); - $wpcf_control_table->prepare_items(); -} - -/** - * Menu page display. - */ -function wpcf_admin_menu_custom_fields_control() { - global $wpcf_control_table; - echo wpcf_add_admin_header(__('Custom Fields Control', 'wpcf')); - echo '
'; - echo wpcf_admin_custom_fields_control_form($wpcf_control_table); - wp_nonce_field('custom_fields_control_bulk'); - echo '
'; - echo wpcf_add_admin_footer(); -} - -/** - * Menu page hook. - */ -function wpcf_admin_menu_migration_hook() { - do_action('wpcf_admin_page_init'); - wp_enqueue_style('wpcf-migration', WPCF_RES_RELPATH . '/css/basic.css', - array(), WPCF_VERSION); - wp_enqueue_script('wpcf-migration', WPCF_RES_RELPATH . '/js/basic.js', - array('jquery', 'jquery-ui-sortable', 'jquery-ui-draggable'), - WPCF_VERSION); - require_once WPCF_INC_ABSPATH . '/fields.php'; - require_once WPCF_INC_ABSPATH . '/custom-types.php'; - require_once WPCF_INC_ABSPATH . '/custom-taxonomies.php'; - require_once WPCF_INC_ABSPATH . '/migration.php'; - $form = wpcf_admin_migration_form(); - wpcf_form('wpcf_form_migration', $form); -} - -/** - * Menu page display. - */ -function wpcf_admin_menu_migration() { - echo wpcf_add_admin_header(__('Migration', 'wpcf')); - echo '
'; - $form = wpcf_form('wpcf_form_migration'); - echo $form->renderForm(); - echo '
'; - echo wpcf_add_admin_footer(); -} - -/** - * Menu page hook. - */ -function wpcf_admin_menu_settings_hook() { - do_action('wpcf_admin_page_init'); - wp_enqueue_style('wpcf-migration', WPCF_RES_RELPATH . '/css/basic.css', - array(), WPCF_VERSION); - require_once WPCF_INC_ABSPATH . '/settings.php'; - $form = wpcf_admin_settings_form(); - wpcf_form('wpcf_form_settings', $form); -} - -/** - * Menu page display. - */ -function wpcf_admin_menu_settings() { - echo wpcf_add_admin_header(__('Settings', 'wpcf')); - echo '
'; - $form = wpcf_form('wpcf_form_settings'); - echo $form->renderForm(); - echo '
'; - echo wpcf_add_admin_footer(); -} - -/** - * Adds typical header on admin pages. - * - * @param string $title - * @param string $icon_id Custom icon - * @return string - */ -function wpcf_add_admin_header($title, $icon_id = 'icon-wpcf') { - echo "\r\n" . '
-

-

' . $title . '

' . "\r\n"; - do_action('wpcf_admin_header'); - do_action('wpcf_admin_header_' . $_GET['page']); -} - -/** - * Adds footer on admin pages. - * - * Strongly recomended if wpcf_add_admin_header() is called before. - * Otherwise invalid HTML formatting will occur. - */ -function wpcf_add_admin_footer() { - do_action('wpcf_admin_footer_' . $_GET['page']); - do_action('wpcf_admin_footer'); - echo "\r\n" . '
' . "\r\n"; -} - -/** - * Returns HTML formatted 'widefat' table. - * - * @param type $ID - * @param type $header - * @param type $rows - * @param type $empty_message - */ -function wpcf_admin_widefat_table($ID, $header, $rows = array(), - $empty_message = 'No results') { - $head = ''; - $footer = ''; - foreach ($header as $key => $value) { - $head .= '' . $value . '' . "\r\n"; - $footer .= '' . $value . '' . "\r\n"; - } - echo ' - - - ' . $head . ' - - - - - ' . $footer . ' - - - - '; - $row = ''; - if (empty($rows)) { - echo ''; - } else { - foreach ($rows as $row) { - echo ''; - foreach ($row as $column_name => $column_value) { - echo '' . "\r\n"; - } - echo '' . "\r\n"; - } - } - echo ' - -
' . $empty_message - . '
'; - echo $column_value; - echo '
' . "\r\n"; -} - -/** - * Saves open fieldsets. - * - * @param type $action - * @param type $fieldset - */ -function wpcf_admin_form_fieldset_save_toggle($action, $fieldset) { - $data = get_user_meta(get_current_user_id(), 'wpcf-form-fieldsets-toggle', - true); - if ($action == 'open') { - $data[$fieldset] = 1; - } else if ($action == 'close') { - unset($data[$fieldset]); - } - update_user_meta(get_current_user_id(), 'wpcf-form-fieldsets-toggle', $data); -} - -/** - * Check if fieldset is saved as open. - * - * @param type $fieldset - */ -function wpcf_admin_form_fieldset_is_collapsed($fieldset) { - $data = get_user_meta(get_current_user_id(), 'wpcf-form-fieldsets-toggle', - true); - if (empty($data)) { - return true; - } - return array_key_exists($fieldset, $data) ? false : true; -} - -/** - * Adds help on admin pages. - * - * @param type $contextual_help - * @param type $screen_id - * @param type $screen - * @return type - */ -function wpcf_admin_plugin_help($hook, $page) { - global $wp_version; - $call = false; - $contextual_help = ''; - $page = $page; - if (isset($page) && isset($_GET['page']) && $_GET['page'] == $page) { - switch ($page) { - case 'wpcf-cf': - $call = 'custom_fields'; - break; - - case 'wpcf-ctt': - $call = 'custom_types_and_taxonomies'; - break; - - case 'wpcf-import-export': - $call = 'import_export'; - break; - - case 'wpcf-edit': - $call = 'edit_group'; - break; - - case 'wpcf-edit-type': - $call = 'edit_type'; - break; - - case 'wpcf-edit-tax': - $call = 'edit_tax'; - break; - case 'wpcf': - $call = 'wpcf'; - break; - } - } - if ($call) { - require_once WPCF_ABSPATH . '/help.php'; - $contextual_help = wpcf_admin_help($call, $contextual_help); - // WP 3.3 changes - if (version_compare($wp_version, '3.2.1', '>')) { - set_current_screen($hook); - $screen = get_current_screen(); - if (!is_null($screen)) { - $args = array( - 'title' => __('Types', 'wpcf'), - 'id' => 'wpcf', - 'content' => $contextual_help, - 'callback' => false, - ); - $screen->add_help_tab($args); - } - } else { - add_contextual_help($hook, $contextual_help); - } - } -} - -function wpcf_admin_promotional_text() { - $promotional_text = '
'; - if (defined('WPV_VERSION')) { // Views active - $promotional_text .= wpcf_admin_toggle_button('wpcf-promotional-noviews'); - $promotional_text .= '

' . __('Want to display custom content easily?', - 'wpcf') . '

'; - $promotional_text .= '

' . sprintf(__("%sViews%s plugin let's you create dynamic templates for single pages and complex content lists. It queries content from the database, filters it and displays in any way you choose.", - 'wpcf'), - '', - '') . '

'; - $promotional_text .= '

' . __("Views is already installed in your site!", - 'wpcf') . '

'; - $promotional_text .= '

' . __("Next:", 'wpcf') . '

'; - $promotional_text .= ''; - $promotional_text .= sprintf(__('For tutorials and manuals, go to %shttp://wp-types.com%s', - 'wpcf'), '', - ' »'); - } else { - $post_types = get_post_types(array('_builtin' => false), 'objects'); - unset($post_types['wp-types-group'], $post_types['view'], - $post_types['view-template']); - if (count($post_types) < 1) { - $list_post_types = __("posts, pages and custom content types", - 'wpcf'); - } else if (count($post_types) < 2) { - $add = array_shift($post_types); - $list_post_types = $add->label; - } else { - $add = array(); - foreach ($post_types as $p => $post_type) { - $add[] = $post_type->label; - } - $last = array_pop($add); - $list_post_types = sprintf(__('%s and %s', 'wpcf'), - implode(', ', $add), $last); - } - $promotional_text .= wpcf_admin_toggle_button('wpcf-promotional-views'); - $promotional_text .= '

' . __('Want to Build Sites Faster?', 'wpcf') . '

' - . '

' . sprintf(__("%sViews%s, lets you create complex WordPress sites, quickly and easily. Instead of coding and debugging everything, let Views do the heavy lifting for you.", - 'wpcf'), - '', - '') . '

' - . '

' . __("With Views, you can:", - 'wpcf') . '

' - . '

' . '

    ' - . '
  • ' . __("Create single-page templates and insert custom fields.", - 'wpcf') . '
  • ' - . '
  • ' . __("Load content and display it as lists, grids, tables, sliders and more.", - 'wpcf') . '
  • ' - . '
  • ' . __("Create your own widgets and place them anywhere in the theme.", - 'wpcf') . '
  • ' - . '

' - . '

' . sprintf(__("%sLearn more about Views%s", 'wpcf'), - '', - ' »') . '

' - . '


' . __("Check out these Views tutorials:", - 'wpcf') . '

' - . '

' . '


' - . '
' - . '


' . __("Prefer to use PHP and code everything from scratch?", - 'wpcf') . '

' - . '

' . sprintf(__("%sLearn the Types PHP API%s", 'wpcf'), - '', - ' »') . '

'; - } - $promotional_text .= '
'; - echo $promotional_text; -} - -/** - * Collapsible scripts. - */ -function wpcf_admin_load_collapsible() { - wp_enqueue_script('wpcf-collapsible', - WPCF_RES_RELPATH . '/js/collapsible.js', array('jquery'), - WPCF_VERSION); - wp_enqueue_style('wpcf-collapsible', - WPCF_RES_RELPATH . '/css/collapsible.css', array(), WPCF_VERSION); - $option = get_option('wpcf_toggle', array()); - if (!empty($option)) { - $setting = 'new Array("' . implode('", "', array_keys($option)) . '")'; - wpcf_admin_add_js_settings('wpcf_collapsed', $setting); - } -} - -/** - * Toggle button. - * - * @param type $div_id - * @return type - */ -function wpcf_admin_toggle_button($div_id) { - return ''; -} - -/** - * Various delete/deactivate content actions. - * - * @param type $type - * @param type $arg - * @param type $action - */ -function wpcf_admin_deactivate_content($type, $arg, $action = 'delete') { - switch ($type) { - case 'post_type': - // Clean tax relations - if ($action == 'delete') { - $custom = get_option('wpcf-custom-taxonomies', array()); - foreach ($custom as $post_type => $data) { - if (empty($data['supports'])) { - continue; - } - if (array_key_exists($arg, $data['supports'])) { - unset($custom[$post_type]['supports'][$arg]); - } - } - update_option('wpcf-custom-taxonomies', $custom); - } - break; - - case 'taxonomy': - // Clean post relations - if ($action == 'delete') { - $custom = get_option('wpcf-custom-types', array()); - foreach ($custom as $post_type => $data) { - if (empty($data['taxonomies'])) { - continue; - } - if (array_key_exists($arg, $data['taxonomies'])) { - unset($custom[$post_type]['taxonomies'][$arg]); - } - } - update_option('wpcf-custom-types', $custom); - } - break; - - default: - break; - } -} diff --git a/wp-content/plugins/wp-types/embedded/admin.php b/wp-content/plugins/wp-types/embedded/admin.php deleted file mode 100644 index 8cf1fcb..0000000 --- a/wp-content/plugins/wp-types/embedded/admin.php +++ /dev/null @@ -1,743 +0,0 @@ - false, - 'label' => 'Types Groups', - 'can_export' => false, - ) - ); - - add_filter('icl_custom_fields_to_be_copied', - 'wpcf_custom_fields_to_be_copied', 10, 2); - - // WPML editor filters - add_filter('icl_editor_cf_name', 'wpcf_icl_editor_cf_name_filter'); - add_filter('icl_editor_cf_description', - 'wpcf_icl_editor_cf_description_filter', 10, 2); - add_filter('icl_editor_cf_style', 'wpcf_icl_editor_cf_style_filter', 10, 2); - // Initialize translations - if (function_exists('icl_register_string') - && defined('WPML_ST_VERSION') - && !get_option('wpcf_strings_translation_initialized', false)) { - wpcf_admin_bulk_string_translation(); - update_option('wpcf_strings_translation_initialized', 1); - } -} - -/** - * save_post hook. - * - * @param type $post_ID - * @param type $post - */ -function wpcf_admin_save_post_hook($post_ID, $post) { - require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields.php'; - require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields-post.php'; - wpcf_admin_post_save_post_hook($post_ID, $post); -} - -/** - * Triggers post procceses. - */ -function wpcf_admin_post_page_load_hook() { - require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields.php'; - require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields-post.php'; - - // Get post - if (isset($_GET['post'])) { - $post_id = (int) $_GET['post']; - } else if (isset($_POST['post_ID'])) { - $post_id = (int) $_POST['post_ID']; - } else { - $post_id = 0; - } - - // Init processes - if ($post_id) { - $post = get_post($post_id); - if (!empty($post)) { - wpcf_admin_post_init($post); - } - } else { - wpcf_admin_post_init(); - } -} - -/** - * Initiates/returns specific form. - * - * @staticvar array $wpcf_forms - * @param type $id - * @param type $form - * @return array - */ -function wpcf_form($id, $form = array()) { - static $wpcf_forms = array(); - if (isset($wpcf_forms[$id])) { - return $wpcf_forms[$id]; - } - require_once WPCF_EMBEDDED_ABSPATH . '/classes/forms.php'; - $new_form = new Enlimbo_Forms_Wpcf(); - $new_form->autoHandle($id, $form); - $wpcf_forms[$id] = $new_form; - return $wpcf_forms[$id]; -} - -/** - * Renders form elements. - * - * @staticvar string $form - * @param type $elements - * @return type - */ -function wpcf_form_simple($elements) { - static $form = NULL; - require_once WPCF_EMBEDDED_ABSPATH . '/classes/forms.php'; - if (is_null($form)) { - $form = new Enlimbo_Forms_Wpcf(); - } - return $form->renderElements($elements); -} - -/** - * Validates form elements (simple). - * - * @staticvar string $form - * @param type $elements - * @return type - */ -function wpcf_form_simple_validate(&$elements) { - static $form = NULL; - require_once WPCF_EMBEDDED_ABSPATH . '/classes/forms.php'; - if (is_null($form)) { - $form = new Enlimbo_Forms_Wpcf(); - } - $form->validate($elements); - return $form; -} - -/** - * Stores JS validation rules. - * - * @staticvar array $validation - * @param type $element - * @return array - */ -function wpcf_form_add_js_validation($element) { - static $validation = array(); - if ($element == 'get') { - $temp = $validation; - $validation = array(); - return $temp; - } - $validation[$element['#id']] = $element; -} - -/** - * Renders JS validation rules. - * - * @return type - */ -function wpcf_form_render_js_validation($form = '.wpcf-form-validate', - $echo = true) { -// static $cache; -// if (($echo && isset($cache[$form]['echo'])) || (!$echo && isset($cache[$form]['return']))) { -// return ''; -// } - $elements = wpcf_form_add_js_validation('get'); - if (empty($elements)) { - return ''; - } - $output = ''; - $output .= "\r\n" . '' . "\r\n"; - - if ($echo) { -// $cache[$form]['echo'] = 1; - echo $output; - } else { -// $cache[$form]['return'] = 1; - return $output; - } -} - -/** - * wpcf_custom_fields_to_be_copied - * - * Hook the copy custom fields from WPML and remove any of the fields - * that wpcf will copy. - */ -function wpcf_custom_fields_to_be_copied($copied_fields, $original_post_id) { - - // see if this is one of our fields. - $groups = wpcf_admin_post_get_post_groups_fields(get_post($original_post_id)); - - foreach ($copied_fields as $id => $copied_field) { - foreach ($groups as $group) { - foreach ($group['fields'] as $field) { - if ($copied_field == wpcf_types_get_meta_prefix($field) . $field['slug']) { - unset($copied_fields[$id]); - } - } - } - } - return $copied_fields; -} - -/** - * Holds validation messages. - * - * @param type $method - * @return type - */ -function wpcf_admin_validation_messages($method = false) { - $messages = array( - 'required' => __('This Field is required', 'wpcf'), - 'email' => __('Please enter a valid email address', 'wpcf'), - 'url' => __('Please enter a valid URL address', 'wpcf'), - 'date' => __('Please enter a valid date', 'wpcf'), - 'digits' => __('Please enter numeric data', 'wpcf'), - 'number' => __('Please enter numeric data', 'wpcf'), - 'alphanumeric' => __('Letters, numbers, spaces or underscores only please', - 'wpcf'), - 'nospecialchars' => __('Letters, numbers, spaces, underscores and dashes only please', - 'wpcf'), - 'rewriteslug' => __('Letters, numbers, slashes, underscores and dashes only please', - 'wpcf') - ); - if ($method) { - return isset($messages[$method]) ? $messages[$method] : ''; - } - return $messages; -} - -/** - * Adds admin notice. - * - * @param type $message - * @param type $class - */ -function wpcf_admin_message($message, $class = 'updated') { - add_action('admin_notices', - create_function('$a=1, $class=\'' . $class . '\', $message=\'' - . htmlentities($message, ENT_QUOTES) . '\'', - '$screen = get_current_screen(); if (!$screen->is_network) echo "

" . html_entity_decode($message, ENT_QUOTES) . "

";')); -} - -/** - * Shows stored messages. - */ -function wpcf_show_admin_messages() { - $messages = get_option('wpcf-messages', array()); - $messages_for_user = isset($messages[get_current_user_id()]) ? $messages[get_current_user_id()] : array(); - if (!empty($messages_for_user)) { - foreach ($messages_for_user as $message) { - wpcf_admin_message($message['message'], $message['class']); - } - unset($messages[get_current_user_id()]); - } - update_option('wpcf-messages', $messages); -} - -/** - * Stores admin notices if redirection is performed. - * - * @param type $message - * @param type $class - * @return type - */ -function wpcf_admin_message_store($message, $class = 'updated') { - $messages = get_option('wpcf-messages', array()); - $messages[get_current_user_id()][md5($message)] = array( - 'message' => $message, - 'class' => $class - ); - update_option('wpcf-messages', $messages); -} - -/** - * Saves cookie. - * - * @param type $data - */ -function wpcf_cookies_add($data) { - if (isset($_COOKIE['wpcf'])) { - $data = array_merge((array) $_COOKIE['wpcf'], $data); - } - setcookie('wpcf', $data, time() + $lifetime, COOKIEPATH, COOKIE_DOMAIN); -} - -/** - * WPML editor filter - * - * @param type $cf_name - * @return type - */ -function wpcf_icl_editor_cf_name_filter($cf_name) { - require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields.php'; - $fields = wpcf_admin_fields_get_fields(); - if (empty($fields)) { - return $cf_name; - } - $cf_name = substr($cf_name, 6); - if (strpos($cf_name, WPCF_META_PREFIX) == 0) { - $cf_name = str_replace(WPCF_META_PREFIX, '', $cf_name); - } - if (isset($fields[$cf_name]['name'])) { - $cf_name = wpcf_translate('field ' . $fields[$cf_name]['id'] . ' name', - $fields[$cf_name]['name']); - } - return $cf_name; -} - -/** - * WPML editor filter - * - * @param type $cf_name - * @param type $description - * @return type - */ -function wpcf_icl_editor_cf_description_filter($description, $cf_name) { - require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields.php'; - $fields = wpcf_admin_fields_get_fields(); - if (empty($fields)) { - return $description; - } - $cf_name = substr($cf_name, 6); - if (strpos($cf_name, WPCF_META_PREFIX) == 0) { - $cf_name = str_replace(WPCF_META_PREFIX, '', $cf_name); - } - if (isset($fields[$cf_name]['description'])) { - $description = wpcf_translate('field ' . $fields[$cf_name]['id'] . ' description', - $fields[$cf_name]['description']); - } - - return $description; -} - -/** - * WPML editor filter - * - * @param type $cf_name - * @param type $style - * @return type - */ -function wpcf_icl_editor_cf_style_filter($style, $cf_name) { - require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields.php'; - $fields = wpcf_admin_fields_get_fields(); - - if (empty($fields)) { - return $style; - } - - $cf_name = substr($cf_name, 6); - - if (strpos($cf_name, WPCF_META_PREFIX) == 0) { - $cf_name = str_replace(WPCF_META_PREFIX, '', $cf_name); - } - if (isset($fields[$cf_name]['type']) && $fields[$cf_name]['type'] == 'textarea') { - $style = 1; - } - if (isset($fields[$cf_name]['type']) && $fields[$cf_name]['type'] == 'wysiwyg') { - $style = 2; - } - return $style; -} - -/** - * Renders page head. - * - * @global type $pagenow - * @param type $title - */ -function wpcf_admin_ajax_head($title) { - global $pagenow; - $hook_suffix = $pagenow; - ?> - - > - - - <?php echo $title; ?> - - - - - - - - - - - true)))) { - $post_type = $_GET['post_type']; - } else { - $post_type = 'post'; - } - } - return $post_type; -} - -/** - * Bulk translation. - */ -function wpcf_admin_bulk_string_translation() { - if (!function_exists('icl_register_string')) { - return false; - } - require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields.php'; - require_once WPCF_EMBEDDED_INC_ABSPATH . '/custom-types.php'; - require_once WPCF_INC_ABSPATH . '/custom-types-form.php'; - require_once WPCF_EMBEDDED_INC_ABSPATH . '/custom-taxonomies.php'; - require_once WPCF_INC_ABSPATH . '/custom-taxonomies-form.php'; - - // Register groups - $groups = wpcf_admin_fields_get_groups(); - foreach ($groups as $group_id => $group) { - wpcf_translate_register_string('plugin Types', - 'group ' . $group_id . ' name', $group['name']); - if (isset($group['description'])) { - wpcf_translate_register_string('plugin Types', - 'group ' . $group_id . ' description', $group['description']); - } - } - - // Register fields - $fields = wpcf_admin_fields_get_fields(); - foreach ($fields as $field_id => $field) { - wpcf_translate_register_string('plugin Types', - 'field ' . $field_id . ' name', $field['name']); - if (isset($field['description'])) { - wpcf_translate_register_string('plugin Types', - 'field ' . $field_id . ' description', $field['description']); - } - - // For radios or select - if (!empty($field['data']['options'])) { - foreach ($field['data']['options'] as $name => $option) { - if ($name == 'default') { - continue; - } - if (isset($option['title'])) { - wpcf_translate_register_string('plugin Types', - 'field ' . $field_id . ' option ' . $name . ' title', - $option['title']); - } - if (isset($option['value'])) { - wpcf_translate_register_string('plugin Types', - 'field ' . $field_id . ' option ' . $name . ' value', - $option['value']); - } - if (isset($option['display_value'])) { - wpcf_translate_register_string('plugin Types', - 'field ' . $field_id . ' option ' . $name . ' display value', - $option['display_value']); - } - } - } - - if ($field['type'] == 'checkbox' && (isset($field['set_value']) && $field['set_value'] != '1')) { - // we need to translate the check box value to store - wpcf_translate_register_string('plugin Types', - 'field ' . $field_id . ' checkbox value', - $field['set_value']); - } - - if ($field['type'] == 'checkbox' && !empty($field['display_value_selected'])) { - // we need to translate the check box value to store - wpcf_translate_register_string('plugin Types', - 'field ' . $field_id . ' checkbox value selected', - $field['display_value_selected']); - } - - if ($field['type'] == 'checkbox' && !empty($field['display_value_not_selected'])) { - // we need to translate the check box value to store - wpcf_translate_register_string('plugin Types', - 'field ' . $field_id . ' checkbox value not selected', - $field['display_value_not_selected']); - } - - // Validation message - if (!empty($field['data']['validate'])) { - foreach ($field['data']['validate'] as $method => $validation) { - if (!empty($validation['message'])) { - // Skip if it's same as default - $default_message = wpcf_admin_validation_messages($method); - if ($validation['message'] != $default_message) { - wpcf_translate_register_string('plugin Types', - 'field ' . $field_id . ' validation message ' . $method, - $validation['message']); - } - } - } - } - } - - // Register types - $custom_types = get_option('wpcf-custom-types', array()); - foreach ($custom_types as $post_type => $data) { - wpcf_custom_types_register_translation($post_type, $data); - } - - // Register taxonomies - $custom_taxonomies = get_option('wpcf-custom-taxonomies', array()); - foreach ($custom_taxonomies as $taxonomy => $data) { - wpcf_custom_taxonimies_register_translation($taxonomy, $data); - } -} \ No newline at end of file diff --git a/wp-content/plugins/wp-types/embedded/classes/forms.php b/wp-content/plugins/wp-types/embedded/classes/forms.php deleted file mode 100644 index 0b4f5db..0000000 --- a/wp-content/plugins/wp-types/embedded/classes/forms.php +++ /dev/null @@ -1,918 +0,0 @@ - 'markup', - '#markup' => wp_nonce_field($id, '_wpnonce_wpcf', true, false) - ); - - $this->_id = $id; - $this->_elements = $form; - - do_action('wpcf_form_autohandle', $id, $form, $this); - do_action('wpcf_form_autohandle_' . $id, $form, $this); - - // get submitted data - if ($this->isSubmitted()) { - - do_action('wpcf_form_autohandle_submit', $id, $form, $this); - do_action('wpcf_form_autohandle_submit_' . $id, $form, $this); - - // check if errors (validation) - $this->validate($this->_elements); - - do_action('wpcf_form_autohandle_validate', $id, $form, $this); - do_action('wpcf_form_autohandle_validate_' . $id, $form, $this); - - // callback - if (empty($this->_errors)) { - - if (isset($form['#form']['callback'])) { - if (is_array($form['#form']['callback'])) { - foreach ($form['#form']['callback'] as $callback) { - if (is_callable($callback)) { - call_user_func($callback, $this); - } - } - } else { - if (is_callable($form['#form']['callback'])) { - call_user_func($form['#form']['callback'], $this); - } - } - } - // Maybe triggered by callback function - if (empty($this->_errors)) { - // redirect - do_action('wpcf_form_autohandle_redirection', $id, $form, - $this); - do_action('wpcf_form_autohandle_redirection_' . $id, $form, - $this); - if (!isset($form['#form']['redirection'])) { - header('Location: ' . $_SERVER['REQUEST_URI']); - } else if ($form['#form']['redirection'] != false) { - header('Location: ' . $form['#form']['redirection']); - } - } - } - } - } - - /** - * Checks if form is submitted. - * - * @param type $id - * @return type - */ - public function isSubmitted($id = '') - { - if (empty($id)) { - $id = $this->_id; - } - return (isset($_REQUEST['_wpnonce_wpcf']) - && wp_verify_nonce($_REQUEST['_wpnonce_wpcf'], $id)); - } - - /** - * Loops over elements and validates them. - * - * @param type $elements - */ - public function validate(&$elements) - { - require_once WPCF_EMBEDDED_ABSPATH . '/classes/validate.php'; - foreach ($elements as $key => &$element) { - if (!isset($element['#type']) - || !$this->_isValidType($element['#type'])) { - continue; - } - if ($element['#type'] != 'fieldset') { - if (isset($element['#name']) - && !in_array($element['#type'], array('submit', 'reset'))) { - // Set submitted data - if (!in_array($element['#type'], array('checkboxes')) - && empty($element['#forced_value'])) { - $element['#value'] = $this->getSubmittedData($element); - } else if (!empty($element['#options']) - && empty($element['#forced_value'])) { - foreach ($element['#options'] as $option_key => $option) { - $option['#type'] = 'checkbox'; - $element['#options'][$option_key]['#value'] = $this->getSubmittedData($option); - } - } - } - // Validate - if (isset($element['#validate'])) { - $this->validateElement($element); - } - } else if (isset($element['#type']) - && $element['#type'] == 'fieldset') { - $this->validate($element); - } else if (is_array($element)) { - $this->validate($element); - } - } - } - - /** - * Validates element. - * - * @param type $element - */ - public function validateElement(&$element) - { - $check = Wpcf_Validate::check($element['#validate'], $element['#value']); - if (isset($check['error'])) { - $this->_errors = true; - $element['#error'] = $check['message']; - } - } - - /** - * Checks if there are errors. - * - * @return type - */ - public function isError() - { - return $this->_errors; - } - - /** - * Sets errors to true. - */ - public function triggerError() - { - $this->_errors = true; - } - - /** - * Renders form. - * - * @return type - */ - public function renderForm() - { - // loop over elements and render them - return $this->renderElements($this->_elements); - } - - /** - * Counts element types. - * - * @param type $type - * @return type - */ - private function _count($type) { - if (!isset($this->_count[$type])) { - $this->_count[$type] = 0; - } - $this->_count[$type] += 1; - return $this->_count[$type]; - } - - /** - * Check if element is of valid type - * - * @param string $type - * @return boolean - */ - private function _isValidType($type) - { - return in_array($type, - array('select', 'checkboxes', 'checkbox', 'radios', - 'radio', 'textfield', 'textarea', 'file', 'submit', 'reset', - 'hidden', 'fieldset', 'markup', 'button')); - } - - /** - * Renders elements. - * - * @param type $elements - * @return type - */ - public function renderElements($elements) - { - $output = ''; - foreach ($elements as $key => $element) { - if (!isset($element['#type']) - || !$this->_isValidType($element['#type'])) { - continue; - } - if ($element['#type'] != 'fieldset') { - $output .= $this->renderElement($element); - } else if (isset($element['#type']) - && $element['#type'] == 'fieldset') { - $buffer = $this->renderElements($element); - $output .= $this->fieldset($element, 'wrap', $buffer); - } else if (is_array($element)) { - $output .= $this->renderElements($element); - } - } - return $output; - } - - /** - * Renders element. - * - * Depending on element type, it calls class methods. - * - * @param array $element - * @return HTML formatted output - */ - public function renderElement($element) - { - $method = $element['#type']; - if (!isset($element['#name']) && $element['#type'] != 'markup') { - if (!isset($element['#attributes']['name'])) { - return '#name or #attributes[\'name\'] required!'; - } else { - $element['#name'] = $element['#attributes']['name']; - } - } - if (is_callable(array($this, $method))) { - if (!isset($element['#id'])) { - if (isset($element['#attributes']['id'])) { - $element['#id'] = $element['#attributes']['id']; - } else { - $element['#id'] = $element['#type'] . '-' - . $this->_count($element['#type']); - } - } - if (isset($this->_errors[$element['#id']])) { - $element['#error'] = $this->_errors[$element['#id']]; - } - // Add JS validation - if (!empty($element['#validate'])) { - wpcf_form_add_js_validation($element); - } - return $this->{$method}($element); - } - } - - /** - * Sets other element attributes. - * - * @param array $element - * @return string - */ - private function _setElementAttributes($element) - { - $attributes = ''; - $error_class = isset($element['#error']) ? ' ' . $this->css_class . '-error ' . $this->css_class . '-' . $element['#type'] . '-error ' . ' form-' . $element['#type'] . '-error ' . $element['#type'] . '-error form-error ' : ''; - $class = $this->css_class . '-' . $element['#type'] - . ' form-' . $element['#type'] . ' ' . $element['#type']; - if (isset($element['#attributes'])) { - foreach ($element['#attributes'] as $attribute => $value) { - // Prevent undesired elements - if (in_array($attribute, array('id', 'name'))) { - continue; - } - // Don't set disabled for checkbox - if ($attribute == 'disabled' && $element['#type'] == 'checkbox') { - continue; - } - // Append class values - if ($attribute == 'class') { - $value = $value . ' ' . $class . $error_class; - } - // Set return string - $attributes .= ' ' . $attribute . '="' . $value . '"'; - } - } - if (!isset($element['#attributes']['class'])) { - $attributes .= ' class="' . $class . $error_class . '"'; - } - return $attributes; - } - - /** - * Sets render elements. - * - * @param array $element - */ - private function _setRender($element) - { - if (!isset($element['#id'])) { - if (isset($element['#attributes']['id'])) { - $element['#id'] = $element['#attributes']['id']; - } else { - $element['#id'] = 'form-' . mt_rand(); - } - } - $element['_attributes_string'] = $this->_setElementAttributes($element); - $element['_render'] = array(); - $element['_render']['prefix'] = isset($element['#prefix']) ? $element['#prefix'] . "\r\n" : ''; - $element['_render']['suffix'] = isset($element['#suffix']) ? $element['#suffix'] . "\r\n" : ''; - $element['_render']['before'] = isset($element['#before']) ? $element['#before'] . "\r\n" : ''; - $element['_render']['after'] = isset($element['#after']) ? $element['#after'] . "\r\n" : ''; - $element['_render']['label'] = isset($element['#title']) ? '' . "\r\n" : ''; - $element['_render']['title'] = $this->_setElementTitle($element); - $element['_render']['description'] = isset($element['#description']) ? $this->_setElementDescription($element) : ''; - $element['_render']['error'] = $this->renderError($element) . "\r\n"; - - return $element; - } - - /** - * Applies pattern to output. - * - * Pass element property #pattern to get custom renedered element. - * - * @param array $pattern - * Accepts: