| @@ -0,0 +1,79 @@ | ||
| # Copyright (C) 2013 Advanced Custom Fields: Options Page | ||
| # This file is distributed under the same license as the Advanced Custom Fields: Options Page package. | ||
| msgid "" | ||
| msgstr "" | ||
| "Project-Id-Version: Advanced Custom Fields: Options Page 1.1.0\n" | ||
| "Report-Msgid-Bugs-To: http://wordpress.org/tag/acf-options-page\n" | ||
| "POT-Creation-Date: 2013-07-13 06:54:05+00:00\n" | ||
| "MIME-Version: 1.0\n" | ||
| "Language: pl_PL\n" | ||
| "Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " | ||
| "|| n%100>=20) ? 1 : 2;\n" | ||
| "Content-Type: text/plain; charset=UTF-8\n" | ||
| "Content-Transfer-Encoding: 8bit\n" | ||
| "PO-Revision-Date: 2013-07-24 00:25+0100\n" | ||
| "Last-Translator: Mateusz Czardybon <mateusz@czar-net.com>\n" | ||
| "Language-Team: \n" | ||
| "X-Generator: Poedit 1.5.7\n" | ||
| "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;" | ||
| "_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;" | ||
| "esc_attr_x:1,2c\n" | ||
| "X-Poedit-Basepath: ../\n" | ||
| "X-Textdomain-Support: yes\n" | ||
| "X-Poedit-SearchPath-0: .\n" | ||
|
|
||
| #: acf-options-page-update.php:137 | ||
| msgid "What's new" | ||
| msgstr "Co nowego" | ||
|
|
||
| #: acf-options-page-update.php:148 | ||
| msgid "credits" | ||
| msgstr "uznanie dla" | ||
|
|
||
| #: acf-options-page.php:30 | ||
| msgid "Options" | ||
| msgstr "Ustawienia" | ||
|
|
||
| #: acf-options-page.php:155 | ||
| msgid "Options Page" | ||
| msgstr "Strona ustawień" | ||
|
|
||
| #: acf-options-page.php:278 | ||
| msgid "Options Updated" | ||
| msgstr "Ustawienia zapisane" | ||
|
|
||
| #: acf-options-page.php:423 | ||
| msgid "No Custom Field Group found for the options page" | ||
| msgstr "Brak pól dla tej strony z ustawieniami" | ||
|
|
||
| #: acf-options-page.php:423 | ||
| msgid "Create a Custom Field Group" | ||
| msgstr "Utwórz grupę pół" | ||
|
|
||
| #: acf-options-page.php:434 | ||
| msgid "Publish" | ||
| msgstr "Akcje" | ||
|
|
||
| #: acf-options-page.php:438 | ||
| msgid "Save Options" | ||
| msgstr "Zapisz ustawienia" | ||
|
|
||
| #. Plugin Name of the plugin/theme | ||
| msgid "Advanced Custom Fields: Options Page" | ||
| msgstr "" | ||
|
|
||
| #. Plugin URI of the plugin/theme | ||
| msgid "http://www.advancedcustomfields.com/" | ||
| msgstr "" | ||
|
|
||
| #. Description of the plugin/theme | ||
| msgid "Adds the options page" | ||
| msgstr "Dodaj stronę z ustawieniami" | ||
|
|
||
| #. Author of the plugin/theme | ||
| msgid "Elliot Condon" | ||
| msgstr "" | ||
|
|
||
| #. Author URI of the plugin/theme | ||
| msgid "http://www.elliotcondon.com/" | ||
| msgstr "" |
| @@ -0,0 +1,71 @@ | ||
| # Copyright (C) 2013 Advanced Custom Fields: Options Page | ||
| # This file is distributed under the same license as the Advanced Custom Fields: Options Page package. | ||
| msgid "" | ||
| msgstr "" | ||
| "Project-Id-Version: Advanced Custom Fields: Options Page 1.1.0\n" | ||
| "Report-Msgid-Bugs-To: http://wordpress.org/tag/acf-options-page\n" | ||
| "POT-Creation-Date: 2013-07-13 06:54:05+00:00\n" | ||
| "MIME-Version: 1.0\n" | ||
| "Content-Type: text/plain; charset=UTF-8\n" | ||
| "Content-Transfer-Encoding: 8bit\n" | ||
| "PO-Revision-Date: 2013-07-13 13:22-0300\n" | ||
| "Last-Translator: Edir Pedro <edirps@gmail.com>\n" | ||
| "Language-Team: \n" | ||
| "X-Generator: Poedit 1.5.7\n" | ||
|
|
||
| #: acf-options-page-update.php:137 | ||
| msgid "What's new" | ||
| msgstr "Novidades" | ||
|
|
||
| #: acf-options-page-update.php:148 | ||
| msgid "credits" | ||
| msgstr "créditos" | ||
|
|
||
| #: acf-options-page.php:30 | ||
| msgid "Options" | ||
| msgstr "Opções" | ||
|
|
||
| #: acf-options-page.php:155 | ||
| msgid "Options Page" | ||
| msgstr "Página de Opções" | ||
|
|
||
| #: acf-options-page.php:278 | ||
| msgid "Options Updated" | ||
| msgstr "Opções Atualizadas" | ||
|
|
||
| #: acf-options-page.php:423 | ||
| msgid "No Custom Field Group found for the options page" | ||
| msgstr "" | ||
| "Nenhum Grupo de Campos Personalizados encontrado para a página de opções" | ||
|
|
||
| #: acf-options-page.php:423 | ||
| msgid "Create a Custom Field Group" | ||
| msgstr "Criar um Grupo de Campos Personalizados" | ||
|
|
||
| #: acf-options-page.php:434 | ||
| msgid "Publish" | ||
| msgstr "Publicar" | ||
|
|
||
| #: acf-options-page.php:438 | ||
| msgid "Save Options" | ||
| msgstr "Salvar Opções" | ||
|
|
||
| #. Plugin Name of the plugin/theme | ||
| msgid "Advanced Custom Fields: Options Page" | ||
| msgstr "" | ||
|
|
||
| #. Plugin URI of the plugin/theme | ||
| msgid "http://www.advancedcustomfields.com/" | ||
| msgstr "" | ||
|
|
||
| #. Description of the plugin/theme | ||
| msgid "Adds the options page" | ||
| msgstr "Adiciona uma página de opções" | ||
|
|
||
| #. Author of the plugin/theme | ||
| msgid "Elliot Condon" | ||
| msgstr "" | ||
|
|
||
| #. Author URI of the plugin/theme | ||
| msgid "http://www.elliotcondon.com/" | ||
| msgstr "" |
| @@ -0,0 +1,68 @@ | ||
| # Copyright (C) 2013 Advanced Custom Fields: Options Page | ||
| # This file is distributed under the same license as the Advanced Custom Fields: Options Page package. | ||
| msgid "" | ||
| msgstr "" | ||
| "Project-Id-Version: Advanced Custom Fields: Options Page 1.1.0\n" | ||
| "Report-Msgid-Bugs-To: http://wordpress.org/tag/acf-options-page\n" | ||
| "POT-Creation-Date: 2013-07-13 06:54:05+00:00\n" | ||
| "MIME-Version: 1.0\n" | ||
| "Content-Type: text/plain; charset=UTF-8\n" | ||
| "Content-Transfer-Encoding: 8bit\n" | ||
| "PO-Revision-Date: 2013-MO-DA HO:MI+ZONE\n" | ||
| "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
| "Language-Team: LANGUAGE <LL@li.org>\n" | ||
|
|
||
| #: acf-options-page-update.php:137 | ||
| msgid "What's new" | ||
| msgstr "" | ||
|
|
||
| #: acf-options-page-update.php:148 | ||
| msgid "credits" | ||
| msgstr "" | ||
|
|
||
| #: acf-options-page.php:30 | ||
| msgid "Options" | ||
| msgstr "" | ||
|
|
||
| #: acf-options-page.php:155 | ||
| msgid "Options Page" | ||
| msgstr "" | ||
|
|
||
| #: acf-options-page.php:278 | ||
| msgid "Options Updated" | ||
| msgstr "" | ||
|
|
||
| #: acf-options-page.php:423 | ||
| msgid "No Custom Field Group found for the options page" | ||
| msgstr "" | ||
|
|
||
| #: acf-options-page.php:423 | ||
| msgid "Create a Custom Field Group" | ||
| msgstr "" | ||
|
|
||
| #: acf-options-page.php:434 | ||
| msgid "Publish" | ||
| msgstr "" | ||
|
|
||
| #: acf-options-page.php:438 | ||
| msgid "Save Options" | ||
| msgstr "" | ||
| #. Plugin Name of the plugin/theme | ||
| msgid "Advanced Custom Fields: Options Page" | ||
| msgstr "" | ||
|
|
||
| #. Plugin URI of the plugin/theme | ||
| msgid "http://www.advancedcustomfields.com/" | ||
| msgstr "" | ||
|
|
||
| #. Description of the plugin/theme | ||
| msgid "Adds the options page" | ||
| msgstr "" | ||
|
|
||
| #. Author of the plugin/theme | ||
| msgid "Elliot Condon" | ||
| msgstr "" | ||
|
|
||
| #. Author URI of the plugin/theme | ||
| msgid "http://www.elliotcondon.com/" | ||
| msgstr "" |
| @@ -0,0 +1,89 @@ | ||
| === Advanced Custom Fields: Options Page === | ||
| Contributors: elliotcondon | ||
| Author: Elliot Condon | ||
| Author URI: http://www.elliotcondon.com | ||
| Plugin URI: http://www.advancedcustomfields.com | ||
| Requires at least: 3.0 | ||
| Tested up to: 3.6.0 | ||
| Stable tag: trunk | ||
| Homepage: http://www.advancedcustomfields.com/add-ons/options-page/ | ||
| Version: 1.2.0 | ||
|
|
||
|
|
||
| == Copyright == | ||
| Copyright 2011 - 2013 Elliot Condon | ||
|
|
||
| This software is NOT to be distributed, but can be INCLUDED in WP themes and Plugins: Premium or Contracted. | ||
| If you include this software within a premium theme or premium plugin, you MUST remove the acf-options-page-update.php file from the folder. | ||
|
|
||
| This software 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. | ||
|
|
||
|
|
||
| == Description == | ||
|
|
||
| = Global Options have never been so easy = | ||
|
|
||
| The “options page” add-on creates a new menu item called “Options” which can hold advanced custom field groups (just like any other edit page). You can also register multiple options pages | ||
|
|
||
| http://www.advancedcustomfields.com/add-ons/options-page/ | ||
|
|
||
|
|
||
| == Installation == | ||
|
|
||
| This software can be treated as both a WP plugin and a theme include. | ||
| However, only when activated as a plugin will updates be available/ | ||
|
|
||
| = Plugin = | ||
| 1. Copy the 'acf-options-page' folder into your plugins folder | ||
| 2. Activate the plugin via the Plugins admin page | ||
|
|
||
| = Include = | ||
| 1. Copy the 'acf-options-page' folder into your theme folder (can use sub folders) | ||
| * You can place the folder anywhere inside the 'wp-content' directory | ||
| 2. Edit your functions.php file and add the following code to include the field: | ||
|
|
||
| ` | ||
| include_once('acf-options-page/acf-options-page.php'); | ||
|
|
||
| ` | ||
|
|
||
| 3. Make sure the path is correct to include the acf-options-page.php file | ||
| 4. Remove the acf-options-page-update.php file from the folder. | ||
|
|
||
|
|
||
| == Changelog == | ||
|
|
||
| = 1.2.0 = | ||
| * Added Polish translation - Thanks to matczar (http://support.advancedcustomfields.com/forums/users/matczar/) | ||
| * Added function acf_set_options_page_menu() | ||
| * Added new param 'menu' to the acf_add_options_sub_page function | ||
|
|
||
| = 1.1.0 = | ||
| * Big thank you to Edir Pedro (http://edirpedro.com.br) for his contribution to this version! | ||
| * Added function acf_add_options_sub_page() | ||
| * Added function acf_set_options_page_title() | ||
| * Added function acf_set_options_page_capability() | ||
| * Improved sub page functionality to allow for individual title, capability, parent and slug. This allows you to place the sub page onto any parent page in the wp-admin menu! | ||
| * Added lang folder including .pot file | ||
| * Added Portuguese translation - Thanks to Edir Pedro (http://edirpedro.com.br) | ||
|
|
||
| = 1.0.1 = | ||
| * wrapped the register_options_page function in an if statement to prevent error when activation this add-on with ACF v3 | ||
|
|
||
| = 1.0.0 = | ||
| * [Updated] Updated update_field parameters | ||
| * Official Release | ||
|
|
||
| = 0.0.4 = | ||
| * [Updated] Update nonce name to 'acf_nonce' => 'input' to match naming convention | ||
|
|
||
| = 0.0.3 = | ||
| * [Updated] Drop support of old filters / actions | ||
|
|
||
| = 0.0.2 = | ||
| * Fixed errors caused by an update to the core functions. | ||
|
|
||
| = 0.0.1 = | ||
| * Initial Release. |
| @@ -0,0 +1,11 @@ | ||
| # Advanced Custom Fields | ||
|
|
||
| Welcome to the official repository for Advanced Custom Fields WordPress plugin. | ||
|
|
||
| ----------------------- | ||
|
|
||
| * Readme : https://github.com/elliotcondon/acf/blob/master/readme.txt | ||
| * WordPress repository: https://wordpress.org/plugins/advanced-custom-fields/ | ||
| * Website : http://www.advancedcustomfields.com/ | ||
| * Documentation: http://www.advancedcustomfields.com/resources/ | ||
| * Support: http://support.advancedcustomfields.com/ |
| @@ -0,0 +1,275 @@ | ||
| <?php | ||
|
|
||
| /* | ||
| * Export | ||
| * | ||
| * @description: | ||
| * @since: 3.6 | ||
| * @created: 25/01/13 | ||
| */ | ||
|
|
||
| // Exit if accessed directly | ||
| if ( !defined( 'ABSPATH' ) ) exit; | ||
|
|
||
|
|
||
| // vars | ||
| $defaults = array( | ||
| 'acf_posts' => array(), | ||
| 'nonce' => '' | ||
| ); | ||
| $my_options = array_merge( $defaults, $_POST ); | ||
|
|
||
|
|
||
| // validate nonce | ||
| if( !wp_verify_nonce($my_options['nonce'], 'export') ) | ||
| { | ||
| wp_die(__("Error",'acf')); | ||
| } | ||
|
|
||
|
|
||
| // check for posts | ||
| if( empty($my_options['acf_posts']) ) | ||
| { | ||
| wp_die(__("No ACF groups selected",'acf')); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * Version number for the export format. | ||
| * | ||
| * Bump this when something changes that might affect compatibility. | ||
| * | ||
| * @since 2.5.0 | ||
| */ | ||
| define( 'WXR_VERSION', '1.1' ); | ||
|
|
||
|
|
||
| /* | ||
| * fix_line_breaks | ||
| * | ||
| * This function will loop through all array pieces and correct double line breaks from DB to XML | ||
| * | ||
| * @type function | ||
| * @date 2/12/2013 | ||
| * @since 5.0.0 | ||
| * | ||
| * @param $v (mixed) | ||
| * @return $v (mixed) | ||
| */ | ||
|
|
||
| function fix_line_breaks( $v ) | ||
| { | ||
| if( is_array($v) ) | ||
| { | ||
| foreach( array_keys($v) as $k ) | ||
| { | ||
| $v[ $k ] = fix_line_breaks( $v[ $k ] ); | ||
| } | ||
| } | ||
| elseif( is_string($v) ) | ||
| { | ||
| $v = str_replace("\r\n", "\r", $v); | ||
| } | ||
|
|
||
| return $v; | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * Wrap given string in XML CDATA tag. | ||
| * | ||
| * @since 2.1.0 | ||
| * | ||
| * @param string $str String to wrap in XML CDATA tag. | ||
| */ | ||
| function wxr_cdata( $str ) { | ||
| if ( seems_utf8( $str ) == false ) | ||
| $str = utf8_encode( $str ); | ||
|
|
||
| // $str = ent2ncr(esc_html($str)); | ||
| $str = "<![CDATA[$str" . ( ( substr( $str, -1 ) == ']' ) ? ' ' : '' ) . ']]>'; | ||
|
|
||
| return $str; | ||
| } | ||
|
|
||
| /** | ||
| * Return the URL of the site | ||
| * | ||
| * @since 2.5.0 | ||
| * | ||
| * @return string Site URL. | ||
| */ | ||
| function wxr_site_url() { | ||
| // ms: the base url | ||
| if ( is_multisite() ) | ||
| return network_home_url(); | ||
| // wp: the blog url | ||
| else | ||
| return get_site_url(); | ||
| } | ||
|
|
||
| /** | ||
| * Output a tag_description XML tag from a given tag object | ||
| * | ||
| * @since 2.3.0 | ||
| * | ||
| * @param object $tag Tag Object | ||
| */ | ||
| function wxr_tag_description( $tag ) { | ||
| if ( empty( $tag->description ) ) | ||
| return; | ||
|
|
||
| echo '<wp:tag_description>' . wxr_cdata( $tag->description ) . '</wp:tag_description>'; | ||
| } | ||
|
|
||
| /** | ||
| * Output a term_name XML tag from a given term object | ||
| * | ||
| * @since 2.9.0 | ||
| * | ||
| * @param object $term Term Object | ||
| */ | ||
| function wxr_term_name( $term ) { | ||
| if ( empty( $term->name ) ) | ||
| return; | ||
|
|
||
| echo '<wp:term_name>' . wxr_cdata( $term->name ) . '</wp:term_name>'; | ||
| } | ||
|
|
||
| /** | ||
| * Output a term_description XML tag from a given term object | ||
| * | ||
| * @since 2.9.0 | ||
| * | ||
| * @param object $term Term Object | ||
| */ | ||
| function wxr_term_description( $term ) { | ||
| if ( empty( $term->description ) ) | ||
| return; | ||
|
|
||
| echo '<wp:term_description>' . wxr_cdata( $term->description ) . '</wp:term_description>'; | ||
| } | ||
|
|
||
| /** | ||
| * Output list of authors with posts | ||
| * | ||
| * @since 3.1.0 | ||
| */ | ||
| function wxr_authors_list() { | ||
| global $wpdb; | ||
|
|
||
| $authors = array(); | ||
| $results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts" ); | ||
| foreach ( (array) $results as $result ) | ||
| $authors[] = get_userdata( $result->post_author ); | ||
|
|
||
| $authors = array_filter( $authors ); | ||
|
|
||
| foreach( $authors as $author ) { | ||
| echo "\t<wp:author>"; | ||
| echo '<wp:author_id>' . $author->ID . '</wp:author_id>'; | ||
| echo '<wp:author_login>' . $author->user_login . '</wp:author_login>'; | ||
| echo '<wp:author_email>' . $author->user_email . '</wp:author_email>'; | ||
| echo '<wp:author_display_name>' . wxr_cdata( $author->display_name ) . '</wp:author_display_name>'; | ||
| echo '<wp:author_first_name>' . wxr_cdata( $author->user_firstname ) . '</wp:author_first_name>'; | ||
| echo '<wp:author_last_name>' . wxr_cdata( $author->user_lastname ) . '</wp:author_last_name>'; | ||
| echo "</wp:author>\n"; | ||
| } | ||
| } | ||
|
|
||
| header( 'Content-Description: File Transfer' ); | ||
| header( 'Content-Disposition: attachment; filename=advanced-custom-field-export.xml' ); | ||
| header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true ); | ||
|
|
||
|
|
||
| echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . "\" ?>\n"; | ||
|
|
||
| ?> | ||
| <!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. --> | ||
| <!-- It contains information about your site's posts, pages, comments, categories, and other content. --> | ||
| <!-- You may use this file to transfer that content from one site to another. --> | ||
| <!-- This file is not intended to serve as a complete backup of your site. --> | ||
|
|
||
| <!-- To import this information into a WordPress site follow these steps: --> | ||
| <!-- 1. Log in to that site as an administrator. --> | ||
| <!-- 2. Go to Tools: Import in the WordPress admin panel. --> | ||
| <!-- 3. Install the "WordPress" importer from the list. --> | ||
| <!-- 4. Activate & Run Importer. --> | ||
| <!-- 5. Upload this file using the form provided on that page. --> | ||
| <!-- 6. You will first be asked to map the authors in this export file to users --> | ||
| <!-- on the site. For each author, you may choose to map to an --> | ||
| <!-- existing user on the site or to create a new user. --> | ||
| <!-- 7. WordPress will then import each of the posts, pages, comments, categories, etc. --> | ||
| <!-- contained in this file into your site. --> | ||
|
|
||
| <?php the_generator( 'export' ); ?> | ||
| <rss version="2.0" | ||
| xmlns:excerpt="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/excerpt/" | ||
| xmlns:content="http://purl.org/rss/1.0/modules/content/" | ||
| xmlns:wfw="http://wellformedweb.org/CommentAPI/" | ||
| xmlns:dc="http://purl.org/dc/elements/1.1/" | ||
| xmlns:wp="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/" | ||
| > | ||
|
|
||
| <channel> | ||
| <title><?php bloginfo_rss( 'name' ); ?></title> | ||
| <link><?php bloginfo_rss( 'url' ); ?></link> | ||
| <description><?php bloginfo_rss( 'description' ); ?></description> | ||
| <pubDate><?php echo date( 'D, d M Y H:i:s +0000' ); ?></pubDate> | ||
| <language><?php echo get_option( 'rss_language' ); ?></language> | ||
| <wp:wxr_version><?php echo WXR_VERSION; ?></wp:wxr_version> | ||
| <wp:base_site_url><?php echo wxr_site_url(); ?></wp:base_site_url> | ||
| <wp:base_blog_url><?php bloginfo_rss( 'url' ); ?></wp:base_blog_url> | ||
| <?php wxr_authors_list(); ?> | ||
| <?php if ( $my_options['acf_posts'] ) { | ||
|
|
||
| global $wp_query, $wpdb, $post; | ||
| $wp_query->in_the_loop = true; // Fake being in the loop. | ||
|
|
||
| // create SQL with %d placeholders | ||
| $where = 'WHERE ID IN (' . substr(str_repeat('%d,', count($my_options['acf_posts'])), 0, -1) . ')'; | ||
|
|
||
| // now prepare the SQL based on the %d + $_POST data | ||
| $posts = $wpdb->get_results( $wpdb->prepare("SELECT * FROM {$wpdb->posts} $where", $my_options['acf_posts'])); | ||
|
|
||
| // Begin Loop | ||
| foreach ( $posts as $post ) { | ||
| setup_postdata( $post ); | ||
| ?> | ||
| <item> | ||
| <title><?php echo apply_filters( 'the_title_rss', $post->post_title ); ?></title> | ||
| <link><?php the_permalink_rss() ?></link> | ||
| <pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ); ?></pubDate> | ||
| <dc:creator><?php echo get_the_author_meta( 'login' ); ?></dc:creator> | ||
| <guid isPermaLink="false"><?php esc_url( the_guid() ); ?></guid> | ||
| <wp:post_id><?php echo $post->ID; ?></wp:post_id> | ||
| <wp:post_date><?php echo $post->post_date; ?></wp:post_date> | ||
| <wp:post_date_gmt><?php echo $post->post_date_gmt; ?></wp:post_date_gmt> | ||
| <wp:comment_status><?php echo $post->comment_status; ?></wp:comment_status> | ||
| <wp:ping_status><?php echo $post->ping_status; ?></wp:ping_status> | ||
| <wp:post_name><?php echo $post->post_name; ?></wp:post_name> | ||
| <wp:status><?php echo $post->post_status; ?></wp:status> | ||
| <wp:post_parent><?php echo $post->post_parent; ?></wp:post_parent> | ||
| <wp:menu_order><?php echo $post->menu_order; ?></wp:menu_order> | ||
| <wp:post_type><?php echo $post->post_type; ?></wp:post_type> | ||
| <wp:post_password><?php echo $post->post_password; ?></wp:post_password> | ||
| <?php $postmeta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID ) ); | ||
| foreach( $postmeta as $meta ) : if ( $meta->meta_key != '_edit_lock' ) : | ||
|
|
||
| $meta->meta_value = maybe_unserialize( $meta->meta_value ); | ||
| $meta->meta_value = fix_line_breaks( $meta->meta_value ); | ||
| $meta->meta_value = maybe_serialize( $meta->meta_value ); | ||
|
|
||
| ?> | ||
| <wp:postmeta> | ||
| <wp:meta_key><?php echo $meta->meta_key; ?></wp:meta_key> | ||
| <wp:meta_value><?php echo wxr_cdata( $meta->meta_value ); ?></wp:meta_value> | ||
| </wp:postmeta> | ||
| <?php endif; endforeach; ?> | ||
| </item> | ||
| <?php | ||
| } | ||
| } | ||
| ?> | ||
| </channel> | ||
| </rss> |
| @@ -0,0 +1,287 @@ | ||
| <?php | ||
|
|
||
| /* | ||
| * acf_addons | ||
| * | ||
| * @description: controller for add-ons sub menu page | ||
| * @since: 3.6 | ||
| * @created: 25/01/13 | ||
| */ | ||
|
|
||
| class acf_addons | ||
| { | ||
|
|
||
| var $action; | ||
|
|
||
|
|
||
| /* | ||
| * __construct | ||
| * | ||
| * @description: | ||
| * @since 3.1.8 | ||
| * @created: 23/06/12 | ||
| */ | ||
|
|
||
| function __construct() | ||
| { | ||
| // actions | ||
| add_action('admin_menu', array($this,'admin_menu'), 11, 0); | ||
| } | ||
|
|
||
|
|
||
| /* | ||
| * admin_menu | ||
| * | ||
| * @description: | ||
| * @created: 2/08/12 | ||
| */ | ||
|
|
||
| function admin_menu() | ||
| { | ||
| // add page | ||
| $page = add_submenu_page('edit.php?post_type=acf', __('Add-ons','acf'), __('Add-ons','acf'), 'manage_options', 'acf-addons', array($this,'html')); | ||
|
|
||
|
|
||
| // actions | ||
| add_action('load-' . $page, array($this,'load')); | ||
| add_action('admin_print_scripts-' . $page, array($this, 'admin_print_scripts')); | ||
| add_action('admin_print_styles-' . $page, array($this, 'admin_print_styles')); | ||
| add_action('admin_head-' . $page, array($this,'admin_head')); | ||
| } | ||
|
|
||
|
|
||
| /* | ||
| * load | ||
| * | ||
| * @description: | ||
| * @since 3.5.2 | ||
| * @created: 16/11/12 | ||
| * @thanks: Kevin Biloski and Charlie Eriksen via Secunia SVCRP | ||
| */ | ||
|
|
||
| function load() | ||
| { | ||
|
|
||
| } | ||
|
|
||
|
|
||
| /* | ||
| * admin_print_scripts | ||
| * | ||
| * @description: | ||
| * @since 3.1.8 | ||
| * @created: 23/06/12 | ||
| */ | ||
|
|
||
| function admin_print_scripts() | ||
| { | ||
|
|
||
| } | ||
|
|
||
|
|
||
| /* | ||
| * admin_print_styles | ||
| * | ||
| * @description: | ||
| * @since 3.1.8 | ||
| * @created: 23/06/12 | ||
| */ | ||
|
|
||
| function admin_print_styles() | ||
| { | ||
| wp_enqueue_style(array( | ||
| 'wp-pointer', | ||
| 'acf-global', | ||
| 'acf', | ||
| )); | ||
| } | ||
|
|
||
|
|
||
| /* | ||
| * admin_head | ||
| * | ||
| * @description: | ||
| * @since 3.1.8 | ||
| * @created: 23/06/12 | ||
| */ | ||
|
|
||
| function admin_head() | ||
| { | ||
|
|
||
| } | ||
|
|
||
|
|
||
| /* | ||
| * html | ||
| * | ||
| * @description: | ||
| * @since 3.1.8 | ||
| * @created: 23/06/12 | ||
| */ | ||
|
|
||
| function html() | ||
| { | ||
| // vars | ||
| $dir = apply_filters('acf/get_info', 'dir'); | ||
|
|
||
|
|
||
| $premium = array(); | ||
| $premium[] = array( | ||
| 'title' => __("Repeater Field",'acf'), | ||
| 'description' => __("Create infinite rows of repeatable data with this versatile interface!",'acf'), | ||
| 'thumbnail' => $dir . 'images/add-ons/repeater-field-thumb.jpg', | ||
| 'active' => class_exists('acf_field_repeater'), | ||
| 'url' => 'http://www.advancedcustomfields.com/add-ons/repeater-field/' | ||
| ); | ||
| $premium[] = array( | ||
| 'title' => __("Gallery Field",'acf'), | ||
| 'description' => __("Create image galleries in a simple and intuitive interface!",'acf'), | ||
| 'thumbnail' => $dir . 'images/add-ons/gallery-field-thumb.jpg', | ||
| 'active' => class_exists('acf_field_gallery'), | ||
| 'url' => 'http://www.advancedcustomfields.com/add-ons/gallery-field/' | ||
| ); | ||
| $premium[] = array( | ||
| 'title' => __("Options Page",'acf'), | ||
| 'description' => __("Create global data to use throughout your website!",'acf'), | ||
| 'thumbnail' => $dir . 'images/add-ons/options-page-thumb.jpg', | ||
| 'active' => class_exists('acf_options_page_plugin'), | ||
| 'url' => 'http://www.advancedcustomfields.com/add-ons/options-page/' | ||
| ); | ||
| $premium[] = array( | ||
| 'title' => __("Flexible Content Field",'acf'), | ||
| 'description' => __("Create unique designs with a flexible content layout manager!",'acf'), | ||
| 'thumbnail' => $dir . 'images/add-ons/flexible-content-field-thumb.jpg', | ||
| 'active' => class_exists('acf_field_flexible_content'), | ||
| 'url' => 'http://www.advancedcustomfields.com/add-ons/flexible-content-field/' | ||
| ); | ||
|
|
||
|
|
||
| $free = array(); | ||
| $free[] = array( | ||
| 'title' => __("Gravity Forms Field",'acf'), | ||
| 'description' => __("Creates a select field populated with Gravity Forms!",'acf'), | ||
| 'thumbnail' => $dir . 'images/add-ons/gravity-forms-field-thumb.jpg', | ||
| 'active' => class_exists('gravity_forms_field'), | ||
| 'url' => 'https://github.com/stormuk/Gravity-Forms-ACF-Field/' | ||
| ); | ||
| $free[] = array( | ||
| 'title' => __("Date & Time Picker",'acf'), | ||
| 'description' => __("jQuery date & time picker",'acf'), | ||
| 'thumbnail' => $dir . 'images/add-ons/date-time-field-thumb.jpg', | ||
| 'active' => class_exists('acf_field_date_time_picker'), | ||
| 'url' => 'http://wordpress.org/extend/plugins/acf-field-date-time-picker/' | ||
| ); | ||
| $free[] = array( | ||
| 'title' => __("Location Field",'acf'), | ||
| 'description' => __("Find addresses and coordinates of a desired location",'acf'), | ||
| 'thumbnail' => $dir . 'images/add-ons/google-maps-field-thumb.jpg', | ||
| 'active' => class_exists('acf_field_location'), | ||
| 'url' => 'https://github.com/elliotcondon/acf-location-field/' | ||
| ); | ||
| $free[] = array( | ||
| 'title' => __("Contact Form 7 Field",'acf'), | ||
| 'description' => __("Assign one or more contact form 7 forms to a post",'acf'), | ||
| 'thumbnail' => $dir . 'images/add-ons/cf7-field-thumb.jpg', | ||
| 'active' => class_exists('acf_field_cf7'), | ||
| 'url' => 'https://github.com/taylormsj/acf-cf7-field/' | ||
| ); | ||
|
|
||
| ?> | ||
| <div class="wrap" style="max-width:970px;"> | ||
|
|
||
| <div class="icon32" id="icon-acf"><br></div> | ||
| <h2 style="margin: 4px 0 15px;"><?php _e("Advanced Custom Fields Add-Ons",'acf'); ?></h2> | ||
|
|
||
| <div class="acf-alert"> | ||
| <p style=""><?php _e("The following Add-ons are available to increase the functionality of the Advanced Custom Fields plugin.",'acf'); ?><br /> | ||
| <?php _e("Each Add-on can be installed as a separate plugin (receives updates) or included in your theme (does not receive updates).",'acf'); ?></p> | ||
| </div> | ||
| <?php /* | ||
| <div class="acf-alert"> | ||
| <p><strong><?php _e("Just updated to version 4?",'acf'); ?></strong> <?php _e("Activation codes have changed to plugins! Download your purchased add-ons",'acf'); ?> <a href="http://www.advancedcustomfields.com/add-ons-download/" target="_blank"><?php _e("here",'acf'); ?></a></p> | ||
| </div> | ||
| */ ?> | ||
|
|
||
| <div id="add-ons" class="clearfix"> | ||
|
|
||
| <div class="add-on-group clearfix"> | ||
| <?php foreach( $premium as $addon ): ?> | ||
| <div class="add-on wp-box <?php if( $addon['active'] ): ?>add-on-active<?php endif; ?>"> | ||
| <a target="_blank" href="<?php echo $addon['url']; ?>"> | ||
| <img src="<?php echo $addon['thumbnail']; ?>" /> | ||
| </a> | ||
| <div class="inner"> | ||
| <h3><a target="_blank" href="<?php echo $addon['url']; ?>"><?php echo $addon['title']; ?></a></h3> | ||
| <p><?php echo $addon['description']; ?></p> | ||
| </div> | ||
| <div class="footer"> | ||
| <?php if( $addon['active'] ): ?> | ||
| <a class="button button-disabled"><span class="acf-sprite-tick"></span><?php _e("Installed",'acf'); ?></a> | ||
| <?php else: ?> | ||
| <a target="_blank" href="<?php echo $addon['url']; ?>" class="button"><?php _e("Purchase & Install",'acf'); ?></a> | ||
| <?php endif; ?> | ||
| </div> | ||
| </div> | ||
| <?php endforeach; ?> | ||
| </div> | ||
|
|
||
| <div class="add-on-group clearfix"> | ||
| <?php foreach( $free as $addon ): ?> | ||
| <div class="add-on wp-box <?php if( $addon['active'] ): ?>add-on-active<?php endif; ?>"> | ||
| <a target="_blank" href="<?php echo $addon['url']; ?>"> | ||
| <img src="<?php echo $addon['thumbnail']; ?>" /> | ||
| </a> | ||
| <div class="inner"> | ||
| <h3><a target="_blank" href="<?php echo $addon['url']; ?>"><?php echo $addon['title']; ?></a></h3> | ||
| <p><?php echo $addon['description']; ?></p> | ||
| </div> | ||
| <div class="footer"> | ||
| <?php if( $addon['active'] ): ?> | ||
| <a class="button button-disabled"><span class="acf-sprite-tick"></span><?php _e("Installed",'acf'); ?></a> | ||
| <?php else: ?> | ||
| <a target="_blank" href="<?php echo $addon['url']; ?>" class="button"><?php _e("Download",'acf'); ?></a> | ||
| <?php endif; ?> | ||
| </div> | ||
| </div> | ||
| <?php endforeach; ?> | ||
| </div> | ||
|
|
||
|
|
||
| </div> | ||
|
|
||
| </div> | ||
| <script type="text/javascript"> | ||
| (function($) { | ||
|
|
||
| $(window).load(function(){ | ||
|
|
||
| $('#add-ons .add-on-group').each(function(){ | ||
|
|
||
| var $el = $(this), | ||
| h = 0; | ||
|
|
||
|
|
||
| $el.find('.add-on').each(function(){ | ||
|
|
||
| h = Math.max( $(this).height(), h ); | ||
|
|
||
| }); | ||
|
|
||
| $el.find('.add-on').height( h ); | ||
|
|
||
| }); | ||
|
|
||
| }); | ||
|
|
||
| })(jQuery); | ||
| </script> | ||
| <?php | ||
|
|
||
| return; | ||
|
|
||
| } | ||
| } | ||
|
|
||
| new acf_addons(); | ||
|
|
||
| ?> |
| @@ -0,0 +1,170 @@ | ||
| <?php | ||
|
|
||
| /* | ||
| * acf_controller_input | ||
| * | ||
| * This class contains the functionality for input actions used throughout ACF | ||
| * | ||
| * @type class | ||
| * @date 5/09/13 | ||
| * @since 3.1.8 | ||
| * | ||
| */ | ||
|
|
||
| class acf_controller_input | ||
| { | ||
|
|
||
| /* | ||
| * __construct | ||
| * | ||
| * @description: | ||
| * @since 3.1.8 | ||
| * @created: 23/06/12 | ||
| */ | ||
|
|
||
| function __construct() | ||
| { | ||
| // actions | ||
| add_action('acf/input/admin_head', array($this, 'input_admin_head')); | ||
| add_action('acf/input/admin_enqueue_scripts', array($this, 'input_admin_enqueue_scripts')); | ||
| } | ||
|
|
||
|
|
||
| /* | ||
| * input_admin_head | ||
| * | ||
| * action called when rendering the head of an admin screen. Used primarily for passing PHP to JS | ||
| * | ||
| * @type action | ||
| * @date 27/05/13 | ||
| * | ||
| * @param N/A | ||
| * @return N/A | ||
| */ | ||
|
|
||
| function input_admin_head() | ||
| { | ||
| // global | ||
| global $wp_version, $post; | ||
|
|
||
|
|
||
| // vars | ||
| $toolbars = apply_filters( 'acf/fields/wysiwyg/toolbars', array() ); | ||
| $post_id = 0; | ||
| if( $post ) | ||
| { | ||
| $post_id = intval( $post->ID ); | ||
| } | ||
|
|
||
|
|
||
| // l10n | ||
| $l10n = apply_filters( 'acf/input/admin_l10n', array( | ||
| 'core' => array( | ||
| 'expand_details' => __("Expand Details",'acf'), | ||
| 'collapse_details' => __("Collapse Details",'acf') | ||
| ), | ||
| 'validation' => array( | ||
| 'error' => __("Validation Failed. One or more fields below are required.",'acf') | ||
| ) | ||
| )); | ||
|
|
||
|
|
||
| // options | ||
| $o = array( | ||
| 'post_id' => $post_id, | ||
| 'nonce' => wp_create_nonce( 'acf_nonce' ), | ||
| 'admin_url' => admin_url(), | ||
| 'ajaxurl' => admin_url( 'admin-ajax.php' ), | ||
| 'wp_version' => $wp_version | ||
| ); | ||
|
|
||
|
|
||
| // toolbars | ||
| $t = array(); | ||
|
|
||
| if( is_array($toolbars) ){ foreach( $toolbars as $label => $rows ){ | ||
|
|
||
| $label = sanitize_title( $label ); | ||
| $label = str_replace('-', '_', $label); | ||
|
|
||
| $t[ $label ] = array(); | ||
|
|
||
| if( is_array($rows) ){ foreach( $rows as $k => $v ){ | ||
|
|
||
| $t[ $label ][ 'theme_advanced_buttons' . $k ] = implode(',', $v); | ||
|
|
||
| }} | ||
| }} | ||
|
|
||
|
|
||
| ?> | ||
| <script type="text/javascript"> | ||
| (function($) { | ||
|
|
||
| // vars | ||
| acf.post_id = <?php echo is_numeric($post_id) ? $post_id : '"' . $post_id . '"'; ?>; | ||
| acf.nonce = "<?php echo wp_create_nonce( 'acf_nonce' ); ?>"; | ||
| acf.admin_url = "<?php echo admin_url(); ?>"; | ||
| acf.ajaxurl = "<?php echo admin_url( 'admin-ajax.php' ); ?>"; | ||
| acf.wp_version = "<?php echo $wp_version; ?>"; | ||
|
|
||
|
|
||
| // new vars | ||
| acf.o = <?php echo json_encode( $o ); ?>; | ||
| acf.l10n = <?php echo json_encode( $l10n ); ?>; | ||
| acf.fields.wysiwyg.toolbars = <?php echo json_encode( $t ); ?>; | ||
|
|
||
| })(jQuery); | ||
| </script> | ||
| <?php | ||
| } | ||
|
|
||
|
|
||
|
|
||
| /* | ||
| * input_admin_enqueue_scripts | ||
| * | ||
| * @description: | ||
| * @since: 3.6 | ||
| * @created: 30/01/13 | ||
| */ | ||
|
|
||
| function input_admin_enqueue_scripts() | ||
| { | ||
|
|
||
| // scripts | ||
| wp_enqueue_script(array( | ||
| 'jquery', | ||
| 'jquery-ui-core', | ||
| 'jquery-ui-tabs', | ||
| 'jquery-ui-sortable', | ||
| 'wp-color-picker', | ||
| 'thickbox', | ||
| 'media-upload', | ||
| 'acf-input', | ||
| 'acf-datepicker', | ||
| )); | ||
|
|
||
|
|
||
| // 3.5 media gallery | ||
| if( function_exists('wp_enqueue_media') && !did_action( 'wp_enqueue_media' )) | ||
| { | ||
| wp_enqueue_media(); | ||
| } | ||
|
|
||
|
|
||
| // styles | ||
| wp_enqueue_style(array( | ||
| 'thickbox', | ||
| 'wp-color-picker', | ||
| 'acf-global', | ||
| 'acf-input', | ||
| 'acf-datepicker', | ||
| )); | ||
| } | ||
|
|
||
| } | ||
|
|
||
| new acf_controller_input(); | ||
|
|
||
| ?> |
| @@ -0,0 +1,317 @@ | ||
| <?php | ||
|
|
||
| /* | ||
| * Revisions | ||
| * | ||
| * This Class contains all the functionality for adding ACF fields to the WP revisions interface | ||
| * | ||
| * @type class | ||
| * @date 11/08/13 | ||
| */ | ||
|
|
||
| class acf_revisions | ||
| { | ||
|
|
||
| /* | ||
| * __construct | ||
| * | ||
| * A good place to add actions / filters | ||
| * | ||
| * @type function | ||
| * @date 11/08/13 | ||
| * | ||
| * @param N/A | ||
| * @return N/A | ||
| */ | ||
|
|
||
| function __construct() | ||
| { | ||
| // actions | ||
| add_action('wp_restore_post_revision', array($this, 'wp_restore_post_revision'), 10, 2 ); | ||
|
|
||
|
|
||
| // filters | ||
| add_filter('_wp_post_revision_fields', array($this, 'wp_post_revision_fields') ); | ||
| add_filter('wp_save_post_revision_check_for_changes', array($this, 'force_save_revision'), 10, 3); | ||
| } | ||
|
|
||
|
|
||
| /* | ||
| * force_save_revision | ||
| * | ||
| * This filter will return false and force WP to save a revision. This is required due to | ||
| * WP checking only post_title, post_excerpt and post_content values, not custom fields. | ||
| * | ||
| * @type filter | ||
| * @date 19/09/13 | ||
| * | ||
| * @param $return (boolean) defaults to true | ||
| * @param $last_revision (object) the last revision that WP will compare against | ||
| * @param $post (object) the $post that WP will compare against | ||
| * @return $return (boolean) | ||
| */ | ||
|
|
||
| function force_save_revision( $return, $last_revision, $post ) | ||
| { | ||
| // preview hack | ||
| if( isset($_POST['acf_has_changed']) && $_POST['acf_has_changed'] == '1' ) | ||
| { | ||
| $return = false; | ||
| } | ||
|
|
||
|
|
||
| // return | ||
| return $return; | ||
| } | ||
|
|
||
|
|
||
| /* | ||
| * wp_post_revision_fields | ||
| * | ||
| * This filter will add the ACF fields to the returned array | ||
| * Versions 3.5 and 3.6 of WP feature different uses of the revisions filters, so there are | ||
| * some hacks to allow both versions to work correctly | ||
| * | ||
| * @type filter | ||
| * @date 11/08/13 | ||
| * | ||
| * @param $post_id (int) | ||
| * @return $post_id (int) | ||
| */ | ||
|
|
||
| function wp_post_revision_fields( $return ) { | ||
|
|
||
|
|
||
| //globals | ||
| global $post, $pagenow; | ||
|
|
||
|
|
||
| // validate | ||
| $allowed = false; | ||
|
|
||
|
|
||
| // Normal revisions page | ||
| if( $pagenow == 'revision.php' ) | ||
| { | ||
| $allowed = true; | ||
| } | ||
|
|
||
|
|
||
| // WP 3.6 AJAX revision | ||
| if( $pagenow == 'admin-ajax.php' && isset($_POST['action']) && $_POST['action'] == 'get-revision-diffs' ) | ||
| { | ||
| $allowed = true; | ||
| } | ||
|
|
||
|
|
||
| // bail | ||
| if( !$allowed ) | ||
| { | ||
| return $return; | ||
| } | ||
|
|
||
|
|
||
| // vars | ||
| $post_id = 0; | ||
|
|
||
|
|
||
| // determin $post_id | ||
| if( isset($_POST['post_id']) ) | ||
| { | ||
| $post_id = $_POST['post_id']; | ||
| } | ||
| elseif( isset($post->ID) ) | ||
| { | ||
| $post_id = $post->ID; | ||
| } | ||
| else | ||
| { | ||
| return $return; | ||
| } | ||
|
|
||
|
|
||
| // get field objects | ||
| $fields = get_field_objects( $post_id, array('format_value' => false ) ); | ||
|
|
||
|
|
||
| if( $fields ) | ||
| { | ||
| foreach( $fields as $field ) | ||
| { | ||
| // dud field? | ||
| if( !$field || !isset($field['name']) || !$field['name'] ) | ||
| { | ||
| continue; | ||
| } | ||
|
|
||
|
|
||
| // Add field key / label | ||
| $return[ $field['name'] ] = $field['label']; | ||
|
|
||
|
|
||
| // load value | ||
| add_filter('_wp_post_revision_field_' . $field['name'], array($this, 'wp_post_revision_field'), 10, 4); | ||
|
|
||
|
|
||
| // WP 3.5: left vs right | ||
| // Add a value of the revision ID (as there is no way to determin this within the '_wp_post_revision_field_' filter!) | ||
| if( isset($_GET['action'], $_GET['left'], $_GET['right']) && $_GET['action'] == 'diff' ) | ||
| { | ||
| global $left_revision, $right_revision; | ||
|
|
||
| $left_revision->$field['name'] = 'revision_id=' . $_GET['left']; | ||
| $right_revision->$field['name'] = 'revision_id=' . $_GET['right']; | ||
| } | ||
|
|
||
| } | ||
| } | ||
|
|
||
|
|
||
| return $return; | ||
|
|
||
| } | ||
|
|
||
|
|
||
| /* | ||
| * wp_post_revision_field | ||
| * | ||
| * This filter will load the value for the given field and return it for rendering | ||
| * | ||
| * @type filter | ||
| * @date 11/08/13 | ||
| * | ||
| * @param $value (mixed) should be false as it has not yet been loaded | ||
| * @param $field_name (string) The name of the field | ||
| * @param $post (mixed) Holds the $post object to load from - in WP 3.5, this is not passed! | ||
| * @param $direction (string) to / from - not used | ||
| * @return $value (string) | ||
| */ | ||
|
|
||
| function wp_post_revision_field( $value, $field_name, $post = null, $direction = false) | ||
| { | ||
| // vars | ||
| $post_id = 0; | ||
|
|
||
|
|
||
| // determin $post_id | ||
| if( isset($post->ID) ) | ||
| { | ||
| // WP 3.6 | ||
| $post_id = $post->ID; | ||
| } | ||
| elseif( isset($_GET['revision']) ) | ||
| { | ||
| // WP 3.5 | ||
| $post_id = (int) $_GET['revision']; | ||
| } | ||
| elseif( strpos($value, 'revision_id=') !== false ) | ||
| { | ||
| // WP 3.5 (left vs right) | ||
| $post_id = (int) str_replace('revision_id=', '', $value); | ||
| } | ||
|
|
||
|
|
||
| // load field | ||
| $field = get_field_object($field_name, $post_id, array('format_value' => false )); | ||
| $value = $field['value']; | ||
|
|
||
|
|
||
| // default formatting | ||
| if( is_array($value) ) | ||
| { | ||
| $value = implode(', ', $value); | ||
| } | ||
|
|
||
|
|
||
| // format | ||
| if( $value ) | ||
| { | ||
| // image? | ||
| if( $field['type'] == 'image' || $field['type'] == 'file' ) | ||
| { | ||
| $url = wp_get_attachment_url($value); | ||
| $value = $value . ' (' . $url . ')'; | ||
| } | ||
| } | ||
|
|
||
|
|
||
| // return | ||
| return $value; | ||
| } | ||
|
|
||
|
|
||
| /* | ||
| * wp_restore_post_revision | ||
| * | ||
| * This action will copy and paste the metadata from a revision to the post | ||
| * | ||
| * @type action | ||
| * @date 11/08/13 | ||
| * | ||
| * @param $parent_id (int) the destination post | ||
| * @return $revision_id (int) the source post | ||
| */ | ||
|
|
||
| function wp_restore_post_revision( $post_id, $revision_id ) { | ||
|
|
||
| // global | ||
| global $wpdb; | ||
|
|
||
|
|
||
| // vars | ||
| $fields = array(); | ||
|
|
||
|
|
||
| // get field from postmeta | ||
| $rows = $wpdb->get_results( $wpdb->prepare( | ||
| "SELECT * FROM $wpdb->postmeta WHERE post_id=%d", | ||
| $revision_id | ||
| ), ARRAY_A); | ||
|
|
||
|
|
||
| // populate $fields | ||
| if( $rows ) | ||
| { | ||
| foreach( $rows as $row ) | ||
| { | ||
| // meta_key must start with '_' | ||
| if( substr($row['meta_key'], 0, 1) !== '_' ) | ||
| { | ||
| continue; | ||
| } | ||
|
|
||
|
|
||
| // meta_value must start with 'field_' | ||
| if( substr($row['meta_value'], 0, 6) !== 'field_' ) | ||
| { | ||
| continue; | ||
| } | ||
|
|
||
|
|
||
| // this is an ACF field, append to $fields | ||
| $fields[] = substr($row['meta_key'], 1); | ||
|
|
||
| } | ||
| } | ||
|
|
||
|
|
||
| // save data | ||
| if( $rows ) | ||
| { | ||
| foreach( $rows as $row ) | ||
| { | ||
| if( in_array($row['meta_key'], $fields) ) | ||
| { | ||
| update_post_meta( $post_id, $row['meta_key'], $row['meta_value'] ); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| } | ||
|
|
||
|
|
||
| } | ||
|
|
||
| new acf_revisions(); | ||
|
|
||
| ?> |
| @@ -0,0 +1,234 @@ | ||
| <?php | ||
|
|
||
| /* | ||
| * acf_third_party | ||
| * | ||
| * @description: controller for add-ons sub menu page | ||
| * @since: 3.6 | ||
| * @created: 25/01/13 | ||
| */ | ||
|
|
||
| class acf_third_party | ||
| { | ||
| /* | ||
| * __construct | ||
| * | ||
| * @description: | ||
| * @since 3.1.8 | ||
| * @created: 23/06/12 | ||
| */ | ||
|
|
||
| function __construct() | ||
| { | ||
| // Tabify Edit Screen - http://wordpress.org/extend/plugins/tabify-edit-screen/ | ||
| add_action('admin_head-settings_page_tabify-edit-screen', array($this,'admin_head_tabify')); | ||
|
|
||
|
|
||
| // Duplicate Post - http://wordpress.org/extend/plugins/duplicate-post/ | ||
| add_action('dp_duplicate_page', array($this, 'dp_duplicate_page'), 11, 2); | ||
|
|
||
|
|
||
| // Post Type Switcher - http://wordpress.org/extend/plugins/post-type-switcher/ | ||
| add_filter('pts_post_type_filter', array($this, 'pts_post_type_filter')); | ||
| } | ||
|
|
||
|
|
||
|
|
||
| /* | ||
| * pts_allowed_pages | ||
| * | ||
| * @description: | ||
| * @since 3.5.3 | ||
| * @created: 19/11/12 | ||
| */ | ||
|
|
||
| function pts_post_type_filter( $args ) | ||
| { | ||
|
|
||
| // global | ||
| global $typenow; | ||
|
|
||
| if( $typenow == "acf" ) | ||
| { | ||
| $args = array( | ||
| 'public' => false, | ||
| 'show_ui' => true | ||
| ); | ||
| } | ||
|
|
||
|
|
||
| // return | ||
| return $args; | ||
| } | ||
|
|
||
|
|
||
| /* | ||
| * admin_head_tabify | ||
| * | ||
| * @description: | ||
| * @since 3.5.1 | ||
| * @created: 9/10/12 | ||
| */ | ||
|
|
||
| function admin_head_tabify() | ||
| { | ||
| // remove ACF from the tabs | ||
| add_filter('tabify_posttypes', array($this, 'tabify_posttypes')); | ||
|
|
||
|
|
||
| // add acf metaboxes to list | ||
| add_action('tabify_add_meta_boxes' , array($this,'tabify_add_meta_boxes')); | ||
|
|
||
| } | ||
|
|
||
|
|
||
| /* | ||
| * tabify_posttypes | ||
| * | ||
| * @description: | ||
| * @since 3.5.1 | ||
| * @created: 9/10/12 | ||
| */ | ||
|
|
||
| function tabify_posttypes( $posttypes ) | ||
| { | ||
| if( isset($posttypes['acf']) ) | ||
| { | ||
| unset( $posttypes['acf'] ); | ||
| } | ||
|
|
||
| return $posttypes; | ||
| } | ||
|
|
||
|
|
||
| /* | ||
| * tabify_add_meta_boxes | ||
| * | ||
| * @description: | ||
| * @since 3.5.1 | ||
| * @created: 9/10/12 | ||
| */ | ||
|
|
||
| function tabify_add_meta_boxes( $post_type ) | ||
| { | ||
| // get acf's | ||
| $acfs = apply_filters('acf/get_field_groups', array()); | ||
|
|
||
| if($acfs) | ||
| { | ||
| foreach($acfs as $acf) | ||
| { | ||
| // add meta box | ||
| add_meta_box( | ||
| 'acf_' . $acf['id'], | ||
| $acf['title'], | ||
| array($this, 'dummy'), | ||
| $post_type | ||
| ); | ||
|
|
||
| } | ||
| // foreach($acfs as $acf) | ||
| } | ||
| // if($acfs) | ||
| } | ||
|
|
||
| function dummy(){ /* Do Nothing */ } | ||
|
|
||
|
|
||
|
|
||
| /* | ||
| * dp_duplicate_page | ||
| * | ||
| * @description: | ||
| * @since 3.5.1 | ||
| * @created: 9/10/12 | ||
| */ | ||
|
|
||
| function dp_duplicate_page( $new_post_id, $old_post_object ) | ||
| { | ||
| // only for acf | ||
| if( $old_post_object->post_type != "acf" ) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
|
|
||
| // update keys | ||
| $metas = get_post_custom( $new_post_id ); | ||
|
|
||
|
|
||
| if( $metas ) | ||
| { | ||
| foreach( $metas as $field_key => $field ) | ||
| { | ||
| if( strpos($field_key, 'field_') !== false ) | ||
| { | ||
| $field = $field[0]; | ||
| $field = maybe_unserialize( $field ); | ||
| $field = maybe_unserialize( $field ); // just to be sure! | ||
|
|
||
| // delete old field | ||
| delete_post_meta($new_post_id, $field_key); | ||
|
|
||
|
|
||
| // set new keys (recursive for sub fields) | ||
| $this->create_new_field_keys( $field ); | ||
|
|
||
|
|
||
| // save it! | ||
| update_post_meta($new_post_id, $field['key'], $field); | ||
|
|
||
| } | ||
| // if( strpos($field_key, 'field_') !== false ) | ||
| } | ||
| // foreach( $metas as $field_key => $field ) | ||
| } | ||
| // if( $metas ) | ||
|
|
||
| } | ||
|
|
||
|
|
||
| /* | ||
| * create_new_field_keys | ||
| * | ||
| * @description: | ||
| * @since 3.5.1 | ||
| * @created: 9/10/12 | ||
| */ | ||
|
|
||
| function create_new_field_keys( &$field ) | ||
| { | ||
| // update key | ||
| $field['key'] = 'field_' . uniqid(); | ||
|
|
||
|
|
||
| if( isset($field['sub_fields']) && is_array($field['sub_fields']) ) | ||
| { | ||
| foreach( $field['sub_fields'] as $f ) | ||
| { | ||
| $this->create_new_field_keys( $f ); | ||
| } | ||
| } | ||
| elseif( isset($field['layouts']) && is_array($field['layouts']) ) | ||
| { | ||
| foreach( $field['layouts'] as $layout ) | ||
| { | ||
| if( isset($layout['sub_fields']) && is_array($layout['sub_fields']) ) | ||
| { | ||
| foreach( $layout['sub_fields'] as $f ) | ||
| { | ||
| $this->create_new_field_keys( $f ); | ||
| } | ||
| } | ||
|
|
||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
|
|
||
| } | ||
|
|
||
| new acf_third_party(); | ||
|
|
||
| ?> |
| @@ -0,0 +1,191 @@ | ||
| <?php | ||
|
|
||
| /* | ||
| * acf_field | ||
| * | ||
| * @description: This is the base class for all fields. | ||
| * @since: 3.6 | ||
| * @created: 30/01/13 | ||
| */ | ||
|
|
||
| class acf_field | ||
| { | ||
| /* | ||
| * Vars | ||
| * | ||
| * @description: | ||
| * @since: 3.6 | ||
| * @created: 30/01/13 | ||
| */ | ||
|
|
||
| var $name, | ||
| $title, | ||
| $category, | ||
| $defaults, | ||
| $l10n; | ||
|
|
||
|
|
||
| /* | ||
| * __construct() | ||
| * | ||
| * Adds neccessary Actions / Filters | ||
| * | ||
| * @since 3.6 | ||
| * @date 30/01/13 | ||
| */ | ||
|
|
||
| function __construct() | ||
| { | ||
| // register field | ||
| add_filter('acf/registered_fields', array($this, 'registered_fields'), 10, 1); | ||
| add_filter('acf/load_field_defaults/type=' . $this->name, array($this, 'load_field_defaults'), 10, 1); | ||
|
|
||
|
|
||
| // value | ||
| $this->add_filter('acf/load_value/type=' . $this->name, array($this, 'load_value'), 10, 3); | ||
| $this->add_filter('acf/update_value/type=' . $this->name, array($this, 'update_value'), 10, 3); | ||
| $this->add_filter('acf/format_value/type=' . $this->name, array($this, 'format_value'), 10, 3); | ||
| $this->add_filter('acf/format_value_for_api/type=' . $this->name, array($this, 'format_value_for_api'), 10, 3); | ||
|
|
||
|
|
||
| // field | ||
| $this->add_filter('acf/load_field/type=' . $this->name, array($this, 'load_field'), 10, 3); | ||
| $this->add_filter('acf/update_field/type=' . $this->name, array($this, 'update_field'), 10, 2); | ||
| $this->add_action('acf/create_field/type=' . $this->name, array($this, 'create_field'), 10, 1); | ||
| $this->add_action('acf/create_field_options/type=' . $this->name, array($this, 'create_options'), 10, 1); | ||
|
|
||
|
|
||
| // input actions | ||
| $this->add_action('acf/input/admin_enqueue_scripts', array($this, 'input_admin_enqueue_scripts'), 10, 0); | ||
| $this->add_action('acf/input/admin_head', array($this, 'input_admin_head'), 10, 0); | ||
| $this->add_filter('acf/input/admin_l10n', array($this, 'input_admin_l10n'), 10, 1); | ||
|
|
||
|
|
||
| // field group actions | ||
| $this->add_action('acf/field_group/admin_enqueue_scripts', array($this, 'field_group_admin_enqueue_scripts'), 10, 0); | ||
| $this->add_action('acf/field_group/admin_head', array($this, 'field_group_admin_head'), 10, 0); | ||
|
|
||
| } | ||
|
|
||
|
|
||
| /* | ||
| * add_filter | ||
| * | ||
| * @description: checks if the function is_callable before adding the filter | ||
| * @since: 3.6 | ||
| * @created: 30/01/13 | ||
| */ | ||
|
|
||
| function add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1) | ||
| { | ||
| if( is_callable($function_to_add) ) | ||
| { | ||
| add_filter($tag, $function_to_add, $priority, $accepted_args); | ||
| } | ||
| } | ||
|
|
||
|
|
||
| /* | ||
| * add_action | ||
| * | ||
| * @description: checks if the function is_callable before adding the action | ||
| * @since: 3.6 | ||
| * @created: 30/01/13 | ||
| */ | ||
|
|
||
| function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1) | ||
| { | ||
| if( is_callable($function_to_add) ) | ||
| { | ||
| add_action($tag, $function_to_add, $priority, $accepted_args); | ||
| } | ||
| } | ||
|
|
||
|
|
||
| /* | ||
| * registered_fields() | ||
| * | ||
| * Adds this field to the select list when creating a new field | ||
| * | ||
| * @type filter | ||
| * @since 3.6 | ||
| * @date 23/01/13 | ||
| * | ||
| * @param $fields - the array of all registered fields | ||
| * | ||
| * @return $fields - the array of all registered fields | ||
| */ | ||
|
|
||
| function registered_fields( $fields ) | ||
| { | ||
| // defaults | ||
| if( !$this->category ) | ||
| { | ||
| $this->category = __('Basic', 'acf'); | ||
| } | ||
|
|
||
|
|
||
| // add to array | ||
| $fields[ $this->category ][ $this->name ] = $this->label; | ||
|
|
||
|
|
||
| // return array | ||
| return $fields; | ||
| } | ||
|
|
||
|
|
||
| /* | ||
| * load_field_defaults | ||
| * | ||
| * action called when rendering the head of an admin screen. Used primarily for passing PHP to JS | ||
| * | ||
| * @type filer | ||
| * @date 1/06/13 | ||
| * | ||
| * @param $field {array} | ||
| * @return $field {array} | ||
| */ | ||
|
|
||
| function load_field_defaults( $field ) | ||
| { | ||
| if( !empty($this->defaults) ) | ||
| { | ||
| foreach( $this->defaults as $k => $v ) | ||
| { | ||
| if( !isset($field[ $k ]) ) | ||
| { | ||
| $field[ $k ] = $v; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| return $field; | ||
| } | ||
|
|
||
|
|
||
| /* | ||
| * admin_l10n | ||
| * | ||
| * filter is called to load all l10n text translations into the admin head script tag | ||
| * | ||
| * @type filer | ||
| * @date 1/06/13 | ||
| * | ||
| * @param $field {array} | ||
| * @return $field {array} | ||
| */ | ||
|
|
||
| function input_admin_l10n( $l10n ) | ||
| { | ||
| if( !empty($this->l10n) ) | ||
| { | ||
| $l10n[ $this->name ] = $this->l10n; | ||
| } | ||
|
|
||
| return $l10n; | ||
| } | ||
|
|
||
|
|
||
| } | ||
|
|
||
| ?> |
| @@ -0,0 +1,210 @@ | ||
| <?php | ||
|
|
||
| class acf_field_checkbox extends acf_field | ||
| { | ||
|
|
||
| /* | ||
| * __construct | ||
| * | ||
| * Set name / label needed for actions / filters | ||
| * | ||
| * @since 3.6 | ||
| * @date 23/01/13 | ||
| */ | ||
|
|
||
| function __construct() | ||
| { | ||
| // vars | ||
| $this->name = 'checkbox'; | ||
| $this->label = __("Checkbox",'acf'); | ||
| $this->category = __("Choice",'acf'); | ||
| $this->defaults = array( | ||
| 'layout' => 'vertical', | ||
| 'choices' => array(), | ||
| 'default_value' => '', | ||
| ); | ||
|
|
||
|
|
||
| // do not delete! | ||
| parent::__construct(); | ||
| } | ||
|
|
||
|
|
||
| /* | ||
| * create_field() | ||
| * | ||
| * Create the HTML interface for your field | ||
| * | ||
| * @param $field - an array holding all the field's data | ||
| * | ||
| * @type action | ||
| * @since 3.6 | ||
| * @date 23/01/13 | ||
| */ | ||
|
|
||
| function create_field( $field ) | ||
| { | ||
| // value must be array | ||
| if( !is_array($field['value']) ) | ||
| { | ||
| // perhaps this is a default value with new lines in it? | ||
| if( strpos($field['value'], "\n") !== false ) | ||
| { | ||
| // found multiple lines, explode it | ||
| $field['value'] = explode("\n", $field['value']); | ||
| } | ||
| else | ||
| { | ||
| $field['value'] = array( $field['value'] ); | ||
| } | ||
| } | ||
|
|
||
|
|
||
| // trim value | ||
| $field['value'] = array_map('trim', $field['value']); | ||
|
|
||
|
|
||
| // vars | ||
| $i = 0; | ||
| $e = '<input type="hidden" name="' . esc_attr($field['name']) . '" value="" />'; | ||
| $e .= '<ul class="acf-checkbox-list ' . esc_attr($field['class']) . ' ' . esc_attr($field['layout']) . '">'; | ||
|
|
||
|
|
||
| // checkbox saves an array | ||
| $field['name'] .= '[]'; | ||
|
|
||
|
|
||
| // foreach choices | ||
| foreach( $field['choices'] as $key => $value ) | ||
| { | ||
| // vars | ||
| $i++; | ||
| $atts = ''; | ||
|
|
||
|
|
||
| if( in_array($key, $field['value']) ) | ||
| { | ||
| $atts = 'checked="yes"'; | ||
| } | ||
| if( isset($field['disabled']) && in_array($key, $field['disabled']) ) | ||
| { | ||
| $atts .= ' disabled="true"'; | ||
| } | ||
|
|
||
|
|
||
| // each checkbox ID is generated with the $key, however, the first checkbox must not use $key so that it matches the field's label for attribute | ||
| $id = $field['id']; | ||
|
|
||
| if( $i > 1 ) | ||
| { | ||
| $id .= '-' . $key; | ||
| } | ||
|
|
||
| $e .= '<li><label><input id="' . esc_attr($id) . '" type="checkbox" class="' . esc_attr($field['class']) . '" name="' . esc_attr($field['name']) . '" value="' . esc_attr($key) . '" ' . $atts . ' />' . $value . '</label></li>'; | ||
| } | ||
|
|
||
| $e .= '</ul>'; | ||
|
|
||
|
|
||
| // return | ||
| echo $e; | ||
| } | ||
|
|
||
|
|
||
| /* | ||
| * create_options() | ||
| * | ||
| * Create extra options for your field. This is rendered when editing a field. | ||
| * The value of $field['name'] can be used (like bellow) to save extra data to the $field | ||
| * | ||
| * @type action | ||
| * @since 3.6 | ||
| * @date 23/01/13 | ||
| * | ||
| * @param $field - an array holding all the field's data | ||
| */ | ||
|
|
||
| function create_options( $field ) | ||
| { | ||
| // vars | ||
| $key = $field['name']; | ||
|
|
||
|
|
||
| // implode checkboxes so they work in a textarea | ||
| if( is_array($field['choices']) ) | ||
| { | ||
| foreach( $field['choices'] as $k => $v ) | ||
| { | ||
| $field['choices'][ $k ] = $k . ' : ' . $v; | ||
| } | ||
| $field['choices'] = implode("\n", $field['choices']); | ||
| } | ||
|
|
||
| ?> | ||
| <tr class="field_option field_option_<?php echo $this->name; ?>"> | ||
| <td class="label"> | ||
| <label for=""><?php _e("Choices",'acf'); ?></label> | ||
| <p><?php _e("Enter each choice on a new line.",'acf'); ?></p> | ||
| <p><?php _e("For more control, you may specify both a value and label like this:",'acf'); ?></p> | ||
| <p><?php _e("red : Red",'acf'); ?><br /><?php _e("blue : Blue",'acf'); ?></p> | ||
| </td> | ||
| <td> | ||
| <?php | ||
|
|
||
| do_action('acf/create_field', array( | ||
| 'type' => 'textarea', | ||
| 'class' => 'textarea field_option-choices', | ||
| 'name' => 'fields['.$key.'][choices]', | ||
| 'value' => $field['choices'], | ||
| )); | ||
|
|
||
| ?> | ||
| </td> | ||
| </tr> | ||
| <tr class="field_option field_option_<?php echo $this->name; ?>"> | ||
| <td class="label"> | ||
| <label><?php _e("Default Value",'acf'); ?></label> | ||
| <p class="description"><?php _e("Enter each default value on a new line",'acf'); ?></p> | ||
| </td> | ||
| <td> | ||
| <?php | ||
|
|
||
| do_action('acf/create_field', array( | ||
| 'type' => 'textarea', | ||
| 'name' => 'fields['.$key.'][default_value]', | ||
| 'value' => $field['default_value'], | ||
| )); | ||
|
|
||
| ?> | ||
| </td> | ||
| </tr> | ||
| <tr class="field_option field_option_<?php echo $this->name; ?>"> | ||
| <td class="label"> | ||
| <label for=""><?php _e("Layout",'acf'); ?></label> | ||
| </td> | ||
| <td> | ||
| <?php | ||
|
|
||
| do_action('acf/create_field', array( | ||
| 'type' => 'radio', | ||
| 'name' => 'fields['.$key.'][layout]', | ||
| 'value' => $field['layout'], | ||
| 'layout' => 'horizontal', | ||
| 'choices' => array( | ||
| 'vertical' => __("Vertical",'acf'), | ||
| 'horizontal' => __("Horizontal",'acf') | ||
| ) | ||
| )); | ||
|
|
||
| ?> | ||
| </td> | ||
| </tr> | ||
| <?php | ||
|
|
||
| } | ||
|
|
||
| } | ||
|
|
||
| new acf_field_checkbox(); | ||
|
|
||
| ?> |
| @@ -0,0 +1,110 @@ | ||
| <?php | ||
|
|
||
| class acf_field_color_picker extends acf_field | ||
| { | ||
|
|
||
| /* | ||
| * __construct | ||
| * | ||
| * Set name / label needed for actions / filters | ||
| * | ||
| * @since 3.6 | ||
| * @date 23/01/13 | ||
| */ | ||
|
|
||
| function __construct() | ||
| { | ||
| // vars | ||
| $this->name = 'color_picker'; | ||
| $this->label = __("Color Picker",'acf'); | ||
| $this->category = __("jQuery",'acf'); | ||
| $this->defaults = array( | ||
| 'default_value' => '', | ||
| ); | ||
|
|
||
|
|
||
| // do not delete! | ||
| parent::__construct(); | ||
|
|
||
| } | ||
|
|
||
|
|
||
| /* | ||
| * create_field() | ||
| * | ||
| * Create the HTML interface for your field | ||
| * | ||
| * @param $field - an array holding all the field's data | ||
| * | ||
| * @type action | ||
| * @since 3.6 | ||
| * @date 23/01/13 | ||
| */ | ||
|
|
||
| function create_field( $field ) | ||
| { | ||
| // vars | ||
| $o = array( 'id', 'class', 'name', 'value' ); | ||
| $e = ''; | ||
|
|
||
|
|
||
| $e .= '<div class="acf-color_picker">'; | ||
| $e .= '<input type="text"'; | ||
|
|
||
| foreach( $o as $k ) | ||
| { | ||
| $e .= ' ' . $k . '="' . esc_attr( $field[ $k ] ) . '"'; | ||
| } | ||
|
|
||
| $e .= ' />'; | ||
| $e .= '</div>'; | ||
|
|
||
|
|
||
| // return | ||
| echo $e; | ||
| } | ||
|
|
||
|
|
||
| /* | ||
| * create_options() | ||
| * | ||
| * Create extra options for your field. This is rendered when editing a field. | ||
| * The value of $field['name'] can be used (like bellow) to save extra data to the $field | ||
| * | ||
| * @type action | ||
| * @since 3.6 | ||
| * @date 23/01/13 | ||
| * | ||
| * @param $field - an array holding all the field's data | ||
| */ | ||
|
|
||
| function create_options( $field ) | ||
| { | ||
| // vars | ||
| $key = $field['name']; | ||
|
|
||
| ?> | ||
| <tr class="field_option field_option_<?php echo $this->name; ?>"> | ||
| <td class="label"> | ||
| <label><?php _e("Default Value",'acf'); ?></label> | ||
| </td> | ||
| <td> | ||
| <?php | ||
| do_action('acf/create_field', array( | ||
| 'type' => 'text', | ||
| 'name' => 'fields[' .$key.'][default_value]', | ||
| 'value' => $field['default_value'], | ||
| 'placeholder' => '#ffffff' | ||
| )); | ||
| ?> | ||
| </td> | ||
| </tr> | ||
| <?php | ||
|
|
||
| } | ||
|
|
||
| } | ||
|
|
||
| new acf_field_color_picker(); | ||
|
|
||
| ?> |
| @@ -0,0 +1,183 @@ | ||
| <?php | ||
|
|
||
| class acf_field_date_picker extends acf_field | ||
| { | ||
|
|
||
| /* | ||
| * __construct | ||
| * | ||
| * Set name / label needed for actions / filters | ||
| * | ||
| * @since 3.6 | ||
| * @date 23/01/13 | ||
| */ | ||
|
|
||
| function __construct() | ||
| { | ||
| // vars | ||
| $this->name = 'date_picker'; | ||
| $this->label = __("Date Picker",'acf'); | ||
| $this->category = __("jQuery",'acf'); | ||
| $this->defaults = array( | ||
| 'date_format' => 'yymmdd', | ||
| 'display_format' => 'dd/mm/yy', | ||
| 'first_day' => 1, // monday | ||
| ); | ||
|
|
||
|
|
||
| // actions | ||
| add_action('init', array($this, 'init')); | ||
|
|
||
|
|
||
| // do not delete! | ||
| parent::__construct(); | ||
| } | ||
|
|
||
|
|
||
| /* | ||
| * init | ||
| * | ||
| * This function is run on the 'init' action to set the field's $l10n data. Before the init action, | ||
| * access to the $wp_locale variable is not possible. | ||
| * | ||
| * @type action (init) | ||
| * @date 3/09/13 | ||
| * | ||
| * @param N/A | ||
| * @return N/A | ||
| */ | ||
|
|
||
| function init() | ||
| { | ||
| global $wp_locale; | ||
|
|
||
| $this->l10n = array( | ||
| 'closeText' => __( 'Done', 'acf' ), | ||
| 'currentText' => __( 'Today', 'acf' ), | ||
| 'monthNames' => array_values( $wp_locale->month ), | ||
| 'monthNamesShort' => array_values( $wp_locale->month_abbrev ), | ||
| 'monthStatus' => __( 'Show a different month', 'acf' ), | ||
| 'dayNames' => array_values( $wp_locale->weekday ), | ||
| 'dayNamesShort' => array_values( $wp_locale->weekday_abbrev ), | ||
| 'dayNamesMin' => array_values( $wp_locale->weekday_initial ), | ||
| 'isRTL' => isset($wp_locale->is_rtl) ? $wp_locale->is_rtl : false, | ||
| ); | ||
| } | ||
|
|
||
|
|
||
| /* | ||
| * create_field() | ||
| * | ||
| * Create the HTML interface for your field | ||
| * | ||
| * @param $field - an array holding all the field's data | ||
| * | ||
| * @type action | ||
| * @since 3.6 | ||
| * @date 23/01/13 | ||
| */ | ||
|
|
||
| function create_field( $field ) | ||
| { | ||
| // make sure it's not blank | ||
| if( !$field['date_format'] ) | ||
| { | ||
| $field['date_format'] = 'yymmdd'; | ||
| } | ||
| if( !$field['display_format'] ) | ||
| { | ||
| $field['display_format'] = 'dd/mm/yy'; | ||
| } | ||
|
|
||
|
|
||
| // html | ||
| echo '<div class="acf-date_picker" data-save_format="' . $field['date_format'] . '" data-display_format="' . $field['display_format'] . '" data-first_day="' . $field['first_day'] . '">'; | ||
| echo '<input type="hidden" value="' . $field['value'] . '" name="' . $field['name'] . '" class="input-alt" />'; | ||
| echo '<input type="text" value="" class="input" />'; | ||
| echo '</div>'; | ||
| } | ||
|
|
||
|
|
||
| /* | ||
| * create_options() | ||
| * | ||
| * Create extra options for your field. This is rendered when editing a field. | ||
| * The value of $field['name'] can be used (like bellow) to save extra data to the $field | ||
| * | ||
| * @type action | ||
| * @since 3.6 | ||
| * @date 23/01/13 | ||
| * | ||
| * @param $field - an array holding all the field's data | ||
| */ | ||
|
|
||
| function create_options( $field ) | ||
| { | ||
| // global | ||
| global $wp_locale; | ||
|
|
||
|
|
||
| // vars | ||
| $key = $field['name']; | ||
|
|
||
| ?> | ||
| <tr class="field_option field_option_<?php echo $this->name; ?>"> | ||
| <td class="label"> | ||
| <label><?php _e("Save format",'acf'); ?></label> | ||
| <p class="description"><?php _e("This format will determine the value saved to the database and returned via the API",'acf'); ?></p> | ||
| <p><?php _e("\"yymmdd\" is the most versatile save format. Read more about",'acf'); ?> <a href="http://docs.jquery.com/UI/Datepicker/formatDate"><?php _e("jQuery date formats",'acf'); ?></a></p> | ||
| </td> | ||
| <td> | ||
| <?php | ||
| do_action('acf/create_field', array( | ||
| 'type' => 'text', | ||
| 'name' => 'fields[' .$key.'][date_format]', | ||
| 'value' => $field['date_format'], | ||
| )); | ||
| ?> | ||
| </td> | ||
| </tr> | ||
| <tr class="field_option field_option_<?php echo $this->name; ?>"> | ||
| <td class="label"> | ||
| <label><?php _e("Display format",'acf'); ?></label> | ||
| <p class="description"><?php _e("This format will be seen by the user when entering a value",'acf'); ?></p> | ||
| <p><?php _e("\"dd/mm/yy\" or \"mm/dd/yy\" are the most used display formats. Read more about",'acf'); ?> <a href="http://docs.jquery.com/UI/Datepicker/formatDate" target="_blank"><?php _e("jQuery date formats",'acf'); ?></a></p> | ||
| </td> | ||
| <td> | ||
| <?php | ||
| do_action('acf/create_field', array( | ||
| 'type' => 'text', | ||
| 'name' => 'fields[' .$key.'][display_format]', | ||
| 'value' => $field['display_format'], | ||
| )); | ||
| ?> | ||
| </td> | ||
| </tr> | ||
| <tr class="field_option field_option_<?php echo $this->name; ?>"> | ||
| <td class="label"> | ||
| <label for=""><?php _e("Week Starts On",'acf'); ?></label> | ||
| </td> | ||
| <td> | ||
| <?php | ||
|
|
||
| $choices = array_values( $wp_locale->weekday ); | ||
|
|
||
| do_action('acf/create_field', array( | ||
| 'type' => 'select', | ||
| 'name' => 'fields['.$key.'][first_day]', | ||
| 'value' => $field['first_day'], | ||
| 'choices' => $choices, | ||
| )); | ||
|
|
||
| ?> | ||
| </td> | ||
| </tr> | ||
| <?php | ||
|
|
||
| } | ||
|
|
||
| } | ||
|
|
||
| new acf_field_date_picker(); | ||
|
|
||
| ?> |
| @@ -0,0 +1,279 @@ | ||
| <?php | ||
|
|
||
| class acf_field_dummy extends acf_field | ||
| { | ||
|
|
||
| /* | ||
| * __construct | ||
| * | ||
| * Set name / label needed for actions / filters | ||
| * | ||
| * @since 3.6 | ||
| * @date 23/01/13 | ||
| */ | ||
|
|
||
| function __construct() | ||
| { | ||
| // vars | ||
| $this->name = 'dummy'; | ||
| $this->label = __('Dummy'); | ||
|
|
||
|
|
||
| // do not delete! | ||
| parent::__construct(); | ||
| } | ||
|
|
||
|
|
||
| /* | ||
| * load_value() | ||
| * | ||
| * This filter is appied to the $value after it is loaded from the db | ||
| * | ||
| * @type filter | ||
| * @since 3.6 | ||
| * @date 23/01/13 | ||
| * | ||
| * @param $value - the value found in the database | ||
| * @param $post_id - the $post_id from which the value was loaded from | ||
| * @param $field - the field array holding all the field options | ||
| * | ||
| * @return $value - the value to be saved in te database | ||
| */ | ||
|
|
||
| function load_value( $value, $post_id, $field ) | ||
| { | ||
| return $value; | ||
| } | ||
|
|
||
|
|
||
| /* | ||
| * format_value() | ||
| * | ||
| * This filter is appied to the $value after it is loaded from the db and before it is passed to the create_field action | ||
| * | ||
| * @type filter | ||
| * @since 3.6 | ||
| * @date 23/01/13 | ||
| * | ||
| * @param $value - the value which was loaded from the database | ||
| * @param $post_id - the $post_id from which the value was loaded | ||
| * @param $field - the field array holding all the field options | ||
| * | ||
| * @return $value - the modified value | ||
| */ | ||
|
|
||
| function format_value( $value, $post_id, $field ) | ||
| { | ||
| return $value; | ||
| } | ||
|
|
||
|
|
||
| /* | ||
| * format_value_for_api() | ||
| * | ||
| * This filter is appied to the $value after it is loaded from the db and before it is passed back to the api functions such as the_field | ||
| * | ||
| * @type filter | ||
| * @since 3.6 | ||
| * @date 23/01/13 | ||
| * | ||
| * @param $value - the value which was loaded from the database | ||
| * @param $post_id - the $post_id from which the value was loaded | ||
| * @param $field - the field array holding all the field options | ||
| * | ||
| * @return $value - the modified value | ||
| */ | ||
|
|
||
| function format_value_for_api( $value, $post_id, $field ) | ||
| { | ||
| return $value; | ||
| } | ||
|
|
||
|
|
||
| /* | ||
| * update_value() | ||
| * | ||
| * This filter is appied to the $value before it is updated in the db | ||
| * | ||
| * @type filter | ||
| * @since 3.6 | ||
| * @date 23/01/13 | ||
| * | ||
| * @param $value - the value which will be saved in the database | ||
| * @param $field - the field array holding all the field options | ||
| * @param $post_id - the $post_id of which the value will be saved | ||
| * | ||
| * @return $value - the modified value | ||
| */ | ||
|
|
||
| function update_value( $value, $post_id, $field ) | ||
| { | ||
| return $value; | ||
| } | ||
|
|
||
|
|
||
| /* | ||
| * load_field() | ||
| * | ||
| * This filter is appied to the $field after it is loaded from the database | ||
| * | ||
| * @type filter | ||
| * @since 3.6 | ||
| * @date 23/01/13 | ||
| * | ||
| * @param $field - the field array holding all the field options | ||
| * | ||
| * @return $field - the field array holding all the field options | ||
| */ | ||
|
|
||
| function load_field( $field ) | ||
| { | ||
| return $field; | ||
| } | ||
|
|
||
|
|
||
| /* | ||
| * update_field() | ||
| * | ||
| * This filter is appied to the $field before it is saved to the database | ||
| * | ||
| * @type filter | ||
| * @since 3.6 | ||
| * @date 23/01/13 | ||
| * | ||
| * @param $field - the field array holding all the field options | ||
| * @param $post_id - the field group ID (post_type = acf) | ||
| * | ||
| * @return $field - the modified field | ||
| */ | ||
|
|
||
| function update_field( $field, $post_id ) | ||
| { | ||
| return $field; | ||
| } | ||
|
|
||
|
|
||
| /* | ||
| * create_field() | ||
| * | ||
| * Create the HTML interface for your field | ||
| * | ||
| * @type action | ||
| * @since 3.6 | ||
| * @date 23/01/13 | ||
| * | ||
| * @param $field - an array holding all the field's data | ||
| */ | ||
|
|
||
| function create_field( $field ) | ||
| { | ||
|
|
||
| } | ||
|
|
||
|
|
||
| /* | ||
| * create_options() | ||
| * | ||
| * Create extra options for your field. This is rendered when editing a field. | ||
| * The value of $field['name'] can be used (like bellow) to save extra data to the $field | ||
| * | ||
| * @type action | ||
| * @since 3.6 | ||
| * @date 23/01/13 | ||
| * | ||
| * @param $field - an array holding all the field's data | ||
| */ | ||
|
|
||
| function create_options( $field ) | ||
| { | ||
|
|
||
| } | ||
|
|
||
|
|
||
| /* | ||
| * input_admin_enqueue_scripts() | ||
| * | ||
| * This action is called in the admin_enqueue_scripts action on the edit screen where your field is created. | ||
| * Use this action to add css + javascript to assist your create_field() action. | ||
| * | ||
| * $info http://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts | ||
| * @type action | ||
| * @since 3.6 | ||
| * @date 23/01/13 | ||
| */ | ||
|
|
||
| function input_admin_enqueue_scripts() | ||
| { | ||
|
|
||
| } | ||
|
|
||
|
|
||
| /* | ||
| * input_admin_head() | ||
| * | ||
| * This action is called in the admin_head action on the edit screen where your field is created. | ||
| * Use this action to add css and javascript to assist your create_field() action. | ||
| * | ||
| * @info http://codex.wordpress.org/Plugin_API/Action_Reference/admin_head | ||
| * @type action | ||
| * @since 3.6 | ||
| * @date 23/01/13 | ||
| */ | ||
|
|
||
| function input_admin_head() | ||
| { | ||
|
|
||
| } | ||
|
|
||
|
|
||
| /* | ||
| * field_group_admin_enqueue_scripts() | ||
| * | ||
| * This action is called in the admin_enqueue_scripts action on the edit screen where your field is edited. | ||
| * Use this action to add css + javascript to assist your create_field_options() action. | ||
| * | ||
| * $info http://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts | ||
| * @type action | ||
| * @since 3.6 | ||
| * @date 23/01/13 | ||
| */ | ||
|
|
||
| function field_group_admin_enqueue_scripts() | ||
| { | ||
|
|
||
| } | ||
|
|
||
|
|
||
| /* | ||
| * field_group_admin_head() | ||
| * | ||
| * This action is called in the admin_head action on the edit screen where your field is edited. | ||
| * Use this action to add css and javascript to assist your create_field_options() action. | ||
| * | ||
| * @info http://codex.wordpress.org/Plugin_API/Action_Reference/admin_head | ||
| * @type action | ||
| * @since 3.6 | ||
| * @date 23/01/13 | ||
| */ | ||
|
|
||
| function field_group_admin_head() | ||
| { | ||
|
|
||
| } | ||
| } | ||
|
|
||
|
|
||
| // create field | ||
| new acf_field_dummy(); | ||
|
|
||
|
|
||
| /*--------------------------------------- fuctions.php ----------------------------------------------------*/ | ||
|
|
||
| add_action('acf/register_fields', 'my_register_fields'); | ||
|
|
||
| function my_register_fields() | ||
| { | ||
| include_once('fields/dummy.php'); | ||
| } | ||
|
|
||
| ?> |
| @@ -0,0 +1,173 @@ | ||
| <?php | ||
|
|
||
| class acf_field_email extends acf_field | ||
| { | ||
|
|
||
| /* | ||
| * __construct | ||
| * | ||
| * Set name / label needed for actions / filters | ||
| * | ||
| * @since 3.6 | ||
| * @date 23/01/13 | ||
| */ | ||
|
|
||
| function __construct() | ||
| { | ||
| // vars | ||
| $this->name = 'email'; | ||
| $this->label = __("Email",'acf'); | ||
| $this->defaults = array( | ||
| 'default_value' => '', | ||
| 'placeholder' => '', | ||
| 'prepend' => '', | ||
| 'append' => '' | ||
| ); | ||
|
|
||
|
|
||
| // do not delete! | ||
| parent::__construct(); | ||
| } | ||
|
|
||
|
|
||
| /* | ||
| * create_field() | ||
| * | ||
| * Create the HTML interface for your field | ||
| * | ||
| * @param $field - an array holding all the field's data | ||
| * | ||
| * @type action | ||
| * @since 3.6 | ||
| * @date 23/01/13 | ||
| */ | ||
|
|
||
| function create_field( $field ) | ||
| { | ||
| // vars | ||
| $o = array( 'id', 'class', 'name', 'value', 'placeholder' ); | ||
| $e = ''; | ||
|
|
||
|
|
||
| // prepend | ||
| if( $field['prepend'] !== "" ) | ||
| { | ||
| $field['class'] .= ' acf-is-prepended'; | ||
| $e .= '<div class="acf-input-prepend">' . $field['prepend'] . '</div>'; | ||
| } | ||
|
|
||
|
|
||
| // append | ||
| if( $field['append'] !== "" ) | ||
| { | ||
| $field['class'] .= ' acf-is-appended'; | ||
| $e .= '<div class="acf-input-append">' . $field['append'] . '</div>'; | ||
| } | ||
|
|
||
|
|
||
| $e .= '<div class="acf-input-wrap">'; | ||
| $e .= '<input type="email"'; | ||
|
|
||
| foreach( $o as $k ) | ||
| { | ||
| $e .= ' ' . $k . '="' . esc_attr( $field[ $k ] ) . '"'; | ||
| } | ||
|
|
||
| $e .= ' />'; | ||
| $e .= '</div>'; | ||
|
|
||
|
|
||
| // return | ||
| echo $e; | ||
| } | ||
|
|
||
|
|
||
| /* | ||
| * create_options() | ||
| * | ||
| * Create extra options for your field. This is rendered when editing a field. | ||
| * The value of $field['name'] can be used (like bellow) to save extra data to the $field | ||
| * | ||
| * @type action | ||
| * @since 3.6 | ||
| * @date 23/01/13 | ||
| * | ||
| * @param $field - an array holding all the field's data | ||
| */ | ||
|
|
||
| function create_options( $field ) | ||
| { | ||
| // vars | ||
| $key = $field['name']; | ||
|
|
||
| ?> | ||
| <tr class="field_option field_option_<?php echo $this->name; ?>"> | ||
| <td class="label"> | ||
| <label><?php _e("Default Value",'acf'); ?></label> | ||
| <p><?php _e("Appears when creating a new post",'acf') ?></p> | ||
| </td> | ||
| <td> | ||
| <?php | ||
|
|
||
| do_action('acf/create_field', array( | ||
| 'type' => 'text', | ||
| 'name' => 'fields['.$key.'][default_value]', | ||
| 'value' => $field['default_value'], | ||
| )); | ||
|
|
||
| ?> | ||
| </td> | ||
| </tr> | ||
| <tr class="field_option field_option_<?php echo $this->name; ?>"> | ||
| <td class="label"> | ||
| <label><?php _e("Placeholder Text",'acf'); ?></label> | ||
| <p><?php _e("Appears within the input",'acf') ?></p> | ||
| </td> | ||
| <td> | ||
| <?php | ||
| do_action('acf/create_field', array( | ||
| 'type' => 'text', | ||
| 'name' => 'fields[' .$key.'][placeholder]', | ||
| 'value' => $field['placeholder'], | ||
| )); | ||
| ?> | ||
| </td> | ||
| </tr> | ||
| <tr class="field_option field_option_<?php echo $this->name; ?>"> | ||
| <td class="label"> | ||
| <label><?php _e("Prepend",'acf'); ?></label> | ||
| <p><?php _e("Appears before the input",'acf') ?></p> | ||
| </td> | ||
| <td> | ||
| <?php | ||
| do_action('acf/create_field', array( | ||
| 'type' => 'text', | ||
| 'name' => 'fields[' .$key.'][prepend]', | ||
| 'value' => $field['prepend'], | ||
| )); | ||
| ?> | ||
| </td> | ||
| </tr> | ||
| <tr class="field_option field_option_<?php echo $this->name; ?>"> | ||
| <td class="label"> | ||
| <label><?php _e("Append",'acf'); ?></label> | ||
| <p><?php _e("Appears after the input",'acf') ?></p> | ||
| </td> | ||
| <td> | ||
| <?php | ||
| do_action('acf/create_field', array( | ||
| 'type' => 'text', | ||
| 'name' => 'fields[' .$key.'][append]', | ||
| 'value' => $field['append'], | ||
| )); | ||
| ?> | ||
| </td> | ||
| </tr> | ||
| <?php | ||
| } | ||
|
|
||
| } | ||
|
|
||
| new acf_field_email(); | ||
|
|
||
| ?> |