Title: eggproject's Replies | WordPress.org

---

# eggproject

  [  ](https://wordpress.org/support/users/eggproject/)

 *   [Profile](https://wordpress.org/support/users/eggproject/)
 *   [Topics Started](https://wordpress.org/support/users/eggproject/topics/)
 *   [Replies Created](https://wordpress.org/support/users/eggproject/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/eggproject/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/eggproject/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/eggproject/engagements/)
 *   [Favorites](https://wordpress.org/support/users/eggproject/favorites/)

 Search replies:

## Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[W3 Total Cache] Gravity forms and WPML gravity-forms-multilingual error bugfix](https://wordpress.org/support/topic/gravity-forms-and-wpml-gravity-forms-multilingual-error-bugfix/)
 *  Thread Starter [eggproject](https://wordpress.org/support/users/eggproject/)
 * (@eggproject)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/gravity-forms-and-wpml-gravity-forms-multilingual-error-bugfix/#post-6480634)
 * my bugfix is work, but I’m not entirely sure that good
    so still it is running
   and there were no other error ——– sry i little speak english 🙁
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Easy Video Player] do not display progress bar…](https://wordpress.org/support/topic/do-not-display-progress-bar/)
 *  Thread Starter [eggproject](https://wordpress.org/support/users/eggproject/)
 * (@eggproject)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/do-not-display-progress-bar/#post-5359052)
 * thanks
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Advanced Custom Fields: NextGEN Gallery Field add-on] No "NextGEN Gallery" option in Field Type](https://wordpress.org/support/topic/no-nextgen-gallery-option-in-field-type/)
 *  [eggproject](https://wordpress.org/support/users/eggproject/)
 * (@eggproject)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/no-nextgen-gallery-option-in-field-type/#post-3620942)
 * nggallery-field.php
    <?php /* Plugin Name: Advanced Custom Fields – NextGEN Gallery
   Field add-on with egg BugFix migrate to acf v4 api Plugin URI: [http://wordpress.org/extend/plugins/advanced-custom-fields-nextgen-gallery-field-add-on/](http://wordpress.org/extend/plugins/advanced-custom-fields-nextgen-gallery-field-add-on/)
   Description: This plugin is an add-on for Advanced Custom Fields. It provides
   a dropdown of NextGEN Gallery and the ability to map the selected NextGEN Gallery
   to the post. Version: 1.2.1 Requires at least: 3.0 Tested up to: 3.4.1 Author:
   Ales Loziak Author URI: [http://www.apollo1.cz](http://www.apollo1.cz) License:
   GPLv2 or later License URI: [http://www.gnu.org/licenses/gpl-2.0.html](http://www.gnu.org/licenses/gpl-2.0.html)****
   Copyright (c) 2012, Ales Loziak * All rights reserved. * * Redistribution and
   use in source and binary forms, with or without modification, * are permitted
   provided that the following conditions are met: * * Redistributions of source
   code must retain the above copyright notice, this * list of conditions and the
   following disclaimer. * Redistributions in binary form must reproduce the above
   copyright notice, * this list of conditions and the following disclaimer in the
   documentation * and/or other materials provided with the distribution. * Neither
   the name of Ales Loziak nor the names of its * contributors may be used to endorse
   or promote products derived from this * software without specific prior written
   permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS“
   AS IS” AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
   THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   ARE DISCLAIMED. * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
   FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
   DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
   SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
   CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ add_action(‘
   acf/register_fields’, ‘my_register_fields’);
 * function my_register_fields()
    { require_once(rtrim( dirname( realpath( __FILE__)),‘/’).”/
   v4.php”); }
 * v4.php
    <?php
 * class acf_field_ACF_NGGallery_Field extends acf_field
    { // vars var $settings,//
   will hold info such as dir / path $defaults; // will hold default field options/***
   Base directory * [@var](https://wordpress.org/support/users/var/) string */ private
   $base_dir;
 *  /**
    * Relative Uri from the WordPress ABSPATH constant * [@var](https://wordpress.org/support/users/var/)
   string */ private $base_uri_rel;
 *  /**
    * Absolute Uri * * This is used to create urls to CSS and JavaScript files.*
   [@var](https://wordpress.org/support/users/var/) string */ private $base_uri_abs;
 *  /**
    * WordPress Localization Text Domain * * The textdomain for the field is
   controlled by the helper class. * [@var](https://wordpress.org/support/users/var/)
   string */ private $l10n_domain;
 *  /*
    * __construct * * Set name / label needed for actions / filters * * [@since](https://wordpress.org/support/users/since/)
   3.6 * [@date](https://wordpress.org/support/users/date/) 23/01/13 */
 *  function __construct()
    {
 *  // settings
    $this->settings = array( ‘path’ => apply_filters(‘acf/helpers/get_path’,
   __FILE__), ‘dir’ => apply_filters(‘acf/helpers/get_dir’, __FILE__), ‘version’
   => ‘1.0.0’ );
 *  //Get the textdomain from the Helper class
    $this->l10n_domain =”acf-nggallery-
   field”;
 *  //Base directory of this field
    $this->base_dir = rtrim( dirname( realpath( 
   __FILE__ ) ), ‘/’ );
 *  //Build the base relative uri by searching backwards until we encounter the 
   wordpress ABSPATH
    $root = array_pop( explode( ‘/’, rtrim( ABSPATH, ‘/’ ) ) );
   $path_parts = explode( ‘/’, $this->base_dir ); $parts = array(); while( $part
   = array_pop( $path_parts ) ) { if( $part == $root ) break; array_unshift( $parts,
   $part ); } $this->base_uri_rel = ‘/’ . implode( ‘/’, $parts ); $this->base_uri_abs
   = get_site_url( null, $this->base_uri_rel );
 * // $this->name = ‘nggallery-field’;
 *  $post_title = ( !class_exists(‘nggdb’) ) ? ‘. ‘ . __( ‘NextGEN Gallery plugin
   is not installed or activated!’, $this->l10n_domain ) : false;
    $this->label 
   = __( ‘NextGEN Gallery’.$post_title, $this->l10n_domain );
 *  // vars
    $this->name = ‘ACF_NGGallery_Field’; // $this->label = __(‘{{field_label}}’);
   $this->category = __(“Basic”,’acf’); // Basic, Content, Choice, etc $this->defaults
   = array( // add default here to merge into your field. // This makes life easy
   when creating the field options as you don’t need to use any if( isset(”) ) logic.
   eg: //’preview_size’ => ‘thumbnail’ );
 * // add_action( ‘admin_print_scripts’, array( &$this, ‘admin_print_scripts’ ),
   12, 0 );
    // add_action( ‘admin_print_styles’, array( &$this, ‘admin_print_styles’),
   12, 0 );
 *  // do not delete!
    parent::__construct(); } /** * Populates the fields array
   with defaults for this field type * * [@param](https://wordpress.org/support/users/param/)
   array $field * [@return](https://wordpress.org/support/users/return/) array */
   private function set_field_defaults( &$field ) { //$field[ ‘nggallery’ ] = ( 
   array_key_exists( ‘nggallery’, $field ) && isset( $field[ ‘nggallery’ ] ) ) ?
   $field[ ‘nggallery’ ] : 0; $field[ ‘nggallery’ ] = 0; $field[ ‘input_type’ ] 
   = ( array_key_exists( ‘input_type’, $field ) && isset( $field[ ‘input_type’ ]))?
   $field[ ‘input_type’ ] : ‘select’; $field[ ‘input_size’ ] = ( array_key_exists(‘
   input_size’, $field ) && isset( $field[ ‘input_size’ ] ) ) ? (int) $field[ ‘input_size’]:
   5; $field[ ‘allow_null’ ] = isset($field[‘allow_null’]) ? $field[‘allow_null’]:
   false; return $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](https://wordpress.org/support/users/type/)
   action * [@since](https://wordpress.org/support/users/since/) 3.6 * [@date](https://wordpress.org/support/users/date/)
   23/01/13 * * [@param](https://wordpress.org/support/users/param/) $field – an
   array holding all the field’s data */
 *  function create_options( $field )
    { // defaults? /* $field = array_merge($this-
   >defaults, $field); */ $this->set_field_defaults( $field ); // key is needed 
   in the field names to correctly save the data $key = $field[‘name’];
 *  ?>
    <tr class=”field_option field_option_<?php echo $this->name; ?>”> <td class
   =”label”> <label><?php _e(“Allow Null?”,’acf’); ?></label> </td> <td> <?php do_action(‘
   acf/create_field’,array( ‘type’ => ‘radio’, ‘name’ => ‘fields[‘.$key.’][allow_null]’,‘
   value’ => $field[‘allow_null’], ‘choices’ => array( ‘1’ => ‘Yes’, ‘0’ => ‘No’,),‘
   layout’ => ‘horizontal’, )); ?> </td> </tr> <tr class=”field_option field_option_
   <?php echo $this->name; ?>”> <td class=”label”> <label><?php _e( ‘Input Method’,
   $this->l10n_domain ); ?></label> <p class=”description”><?php _e( ”, $this->l10n_domain);?
   ></p> </td> <td> <?php do_action(‘acf/create_field’, array( ‘type’ => ‘select’,‘
   name’ => “fields[{$key}][input_type]”, ‘value’ => $field[ ‘input_type’ ], ‘class’
   => “nggallery_input_type nggallery_input_type_{$key}”, ‘choices’ => array( ‘select’
   => ‘Select’, ‘multiselect’ => ‘Multi-Select’, //’token’ => ‘Input Tokenizer’,)));?
   > </td> </tr> <tr id=”nggallery_input_size[<?php echo $key; ?>]” class=”field_option
   field_option_<?php echo $this->name; ?> nggallery_input_size nggallery_input_size_
   <?php echo $key; ?>”> <td class=”label”> <label><?php _e( ‘Multi-Select Size’,
   $this->l10n_domain ); ?></label> <p class=”description”><?php _e( ‘The number
   of rows to show at once in a multi-select.’, $this->l10n_domain ); ?></p> </td
   > <td> <?php do_action(‘acf/create_field’, array( ‘type’ => ‘select’, ‘name’ 
   => “fields[{$key}][input_size]”, ‘value’ => $field[ ‘input_size’ ], ‘choices’
   => array_combine( range( 3, 15, 2 ), range( 3, 15, 2 ) ), ) ); ?> </td> </tr>
   <script type=’text/javascript’>
 *  jQuery(document).ready(function() {
 *  if ( jQuery(‘.nggallery_input_type_<?php echo $key; ?>’).val()==’select’ ) jQuery(‘.
   nggallery_input_size_<?php echo $key; ?>’).hide();
    else jQuery(‘.nggallery_input_size_
   <?php echo $key; ?>’).show();
 *  jQuery(‘.nggallery_input_type_<?php echo $key; ?>’).change(function() {
    if (
   jQuery(‘.nggallery_input_type_<?php echo $key; ?>’).val()==’select’ ) jQuery(‘.
   nggallery_input_size_<?php echo $key; ?>’).hide(); else jQuery(‘.nggallery_input_size_
   <?php echo $key; ?>’).show(); }); });
 *  </script>
    <?php
 *  }
 *  /*
    * create_field() * * Create the HTML interface for your field * * [@param](https://wordpress.org/support/users/param/)
   $field – an array holding all the field’s data * * [@type](https://wordpress.org/support/users/type/)
   action * [@since](https://wordpress.org/support/users/since/) 3.6 * [@date](https://wordpress.org/support/users/date/)
   23/01/13 */
 *  function create_field( $field )
    { global $ngg, $nggdb, $wp_query;
 *  $this->set_field_defaults( $field );
 *  $values = $field[ ‘value’ ];
 *  if ( !empty($values[0]) ):
 *  foreach ( $values as $form ) {
 *  if ( in_array ( ‘gallery’, $form ) )
    $values_gallery[]=$form[‘ngg_id’];
 *  if ( in_array ( ‘album’, $form ) )
    $values_album[]=$form[‘ngg_id’];
 *  }
 *  endif;
 *  if ( class_exists(‘nggdb’) ) :
 *  // Settings of NextGEN Gallery SQL query
    $limit = 0; $start = 0; $order_by 
   = ‘title’; $order_dir = ‘ASC’;
 *  // Seek to all NextGEN Galleries
    $gallerylist = $nggdb->find_all_galleries(
   $order_by, $order_dir , TRUE, $limit, $start, false); $albumlist = $nggdb->find_all_album(‘
   name’, $order_dir, $limit, $start);
 *  $haystack = array( ‘select’, ‘multiselect’ );
    if( in_array( $field[ ‘input_type’],
   $haystack ) ) : ?> <select name=”<?php echo $field[ ‘name’ ]; ?>[]” id=”<?php
   echo $field[ ‘name’ ]; ?>” class=”<?php echo $field[ ‘class’ ]; ?>” <?php echo(
   $field[ ‘input_type’ ] == ‘multiselect’ ) ? ‘multiple=”multiple” size=”‘ . $field[‘
   input_size’ ] . ‘”‘ : ”; ?>> <?php if($field[‘allow_null’] == ‘1’) echo ‘ <option
   value=”null”> – Select – </option>’; ?>
 *  <optgroup label=”<?php _e(‘Galleries’,’nggallery’); ?>”>
    <?php foreach( $gallerylist
   as $gallery ) : ?> <option value=”<?php echo $gallery->gid.’,gallery’; ?>”<?php
   if ( $values_gallery ) selected( in_array( $gallery->gid, $values_gallery ) );?
   >><?php echo $gallery->title; ?></option> <?php endforeach; ?> </optgroup> <optgroup
   label=”<?php _e(‘Albums’,’nggallery’); ?>”> <?php foreach( $albumlist as $album):?
   > <option value=”<?php echo $album->id.’,album’; ?>”<?php if ( $values_album )
   selected( in_array( $album->id, $values_album ) ); ?>><?php echo $album->name;?
   ></option> <?php endforeach; ?> </optgroup> </select> <?php endif;
 *  else:
    ?> <select name=”<?php echo $field[ ‘name’ ]; ?>[]” id=”<?php echo $field[‘
   name’ ]; ?>” class=”<?php echo $field[ ‘class’ ]; ?>”> <option value=”0″ disabled
   =”true”><?php _e( ‘NextGEN Gallery plugin is not installed or activated!’, $this-
   >l10n_domain ); ?></option> </select> <?php endif;
 *  }
 *  /*
    * 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](http://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts)*
   [@type](https://wordpress.org/support/users/type/) action * [@since](https://wordpress.org/support/users/since/)
   3.6 * [@date](https://wordpress.org/support/users/date/) 23/01/13 */
 *  function input_admin_enqueue_scripts()
    { // Note: This function can be removed
   if not used
 * //
    // // register acf scripts // wp_register_script( ‘acf-input-ACF_NGGallery_Field’,
   $this->settings[‘dir’] . ‘js/input.js’, array(‘acf-input’), $this->settings[‘
   version’] ); // wp_register_style( ‘acf-input-ACF_NGGallery_Field’, $this->settings[‘
   dir’] . ‘css/input.css’, array(‘acf-input’), $this->settings[‘version’] ); ////////
   scripts // wp_enqueue_script(array( // ‘acf-input-ACF_NGGallery_Field’, // ));//////
   styles // wp_enqueue_style(array( // ‘acf-input-ACF_NGGallery_Field’, // ));
 *  }
 *  /*
    * 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](https://wordpress.org/support/users/info/)
   [http://codex.wordpress.org/Plugin_API/Action_Reference/admin_head](http://codex.wordpress.org/Plugin_API/Action_Reference/admin_head)*
   [@type](https://wordpress.org/support/users/type/) action * [@since](https://wordpress.org/support/users/since/)
   3.6 * [@date](https://wordpress.org/support/users/date/) 23/01/13 */
 *  function input_admin_head()
    { // Note: This function can be removed if not 
   used }
 *  /*
    * 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](http://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts)*
   [@type](https://wordpress.org/support/users/type/) action * [@since](https://wordpress.org/support/users/since/)
   3.6 * [@date](https://wordpress.org/support/users/date/) 23/01/13 */
 *  function field_group_admin_enqueue_scripts()
    { // Note: This function can be
   removed if not used }
 *  /*
    * 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](https://wordpress.org/support/users/info/)
   [http://codex.wordpress.org/Plugin_API/Action_Reference/admin_head](http://codex.wordpress.org/Plugin_API/Action_Reference/admin_head)*
   [@type](https://wordpress.org/support/users/type/) action * [@since](https://wordpress.org/support/users/since/)
   3.6 * [@date](https://wordpress.org/support/users/date/) 23/01/13 */
 *  function field_group_admin_head()
    { // Note: This function can be removed if
   not used }
 *  /*
    * load_value() * * This filter is appied to the $value after it is loaded
   from the db * * [@type](https://wordpress.org/support/users/type/) filter * [@since](https://wordpress.org/support/users/since/)
   3.6 * [@date](https://wordpress.org/support/users/date/) 23/01/13 * * [@param](https://wordpress.org/support/users/param/)
   $value – the value found in the database * [@param](https://wordpress.org/support/users/param/)
   $post_id – the $post_id from which the value was loaded from * [@param](https://wordpress.org/support/users/param/)
   $field – the field array holding all the field options * * [@return](https://wordpress.org/support/users/return/)
   $value – the value to be saved in te database */
 *  function load_value( $value, $post_id, $field )
    { // Note: This function can
   be removed if not used return $value; }
 *  /*
    * update_value() * * This filter is appied to the $value before it is updated
   in the db * * [@type](https://wordpress.org/support/users/type/) filter * [@since](https://wordpress.org/support/users/since/)
   3.6 * [@date](https://wordpress.org/support/users/date/) 23/01/13 * * [@param](https://wordpress.org/support/users/param/)
   $value – the value which will be saved in the database * [@param](https://wordpress.org/support/users/param/)
   $post_id – the $post_id of which the value will be saved * [@param](https://wordpress.org/support/users/param/)
   $field – the field array holding all the field options * * [@return](https://wordpress.org/support/users/return/)
   $value – the modified value */
 *  function update_value( $value, $post_id, $field )
    { $this->set_field_defaults(
   $field );
 *  foreach( $value as $key=>$item ) {
    $items = explode( ‘,’, $item ); foreach(
   $items as $item ) { if( is_numeric( $item ) ) $values[$key][‘ngg_id’] = intval(
   $item ); else $values[$key][‘ngg_form’] = strval( $item ); } }
 * // parent::update_value( $post_id, $field, $values );
    // Note: This function
   can be removed if not used return $values; }
 *  /*
    * 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](https://wordpress.org/support/users/type/)
   filter * [@since](https://wordpress.org/support/users/since/) 3.6 * [@date](https://wordpress.org/support/users/date/)
   23/01/13 * * [@param](https://wordpress.org/support/users/param/) $value – the
   value which was loaded from the database * [@param](https://wordpress.org/support/users/param/)
   $post_id – the $post_id from which the value was loaded * [@param](https://wordpress.org/support/users/param/)
   $field – the field array holding all the field options * * [@return](https://wordpress.org/support/users/return/)
   $value – the modified value */
 *  function format_value( $value, $post_id, $field )
    { // defaults? /* $field 
   = array_merge($this->defaults, $field); */
 *  // perhaps use $field[‘preview_size’] to alter the $value?
 *  // Note: This function can be removed if not used
    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](https://wordpress.org/support/users/type/) filter * 
   [@since](https://wordpress.org/support/users/since/) 3.6 * [@date](https://wordpress.org/support/users/date/)
   23/01/13 * * [@param](https://wordpress.org/support/users/param/) $value – the
   value which was loaded from the database * [@param](https://wordpress.org/support/users/param/)
   $post_id – the $post_id from which the value was loaded * [@param](https://wordpress.org/support/users/param/)
   $field – the field array holding all the field options * * [@return](https://wordpress.org/support/users/return/)
   $value – the modified value */
 *  function format_value_for_api( $value, $post_id, $field )
    { // defaults? /*
   $field = array_merge($this->defaults, $field); */
 *  // perhaps use $field[‘preview_size’] to alter the $value?
 *  // Note: This function can be removed if not used
    return $value; }
 *  /*
    * load_field() * * This filter is appied to the $field after it is loaded
   from the database * * [@type](https://wordpress.org/support/users/type/) filter*
   [@since](https://wordpress.org/support/users/since/) 3.6 * [@date](https://wordpress.org/support/users/date/)
   23/01/13 * * [@param](https://wordpress.org/support/users/param/) $field – the
   field array holding all the field options * * [@return](https://wordpress.org/support/users/return/)
   $field – the field array holding all the field options */
 *  function load_field( $field )
    { // Note: This function can be removed if not
   used return $field; }
 *  /*
    * update_field() * * This filter is appied to the $field before it is saved
   to the database * * [@type](https://wordpress.org/support/users/type/) filter*
   [@since](https://wordpress.org/support/users/since/) 3.6 * [@date](https://wordpress.org/support/users/date/)
   23/01/13 * * [@param](https://wordpress.org/support/users/param/) $field – the
   field array holding all the field options * [@param](https://wordpress.org/support/users/param/)
   $post_id – the field group ID (post_type = acf) * * [@return](https://wordpress.org/support/users/return/)
   $field – the modified field */
 *  function update_field( $field, $post_id )
    { // Note: This function can be removed
   if not used return $field; }
 * }
 * // create field
    new acf_field_ACF_NGGallery_Field();
 * ?>
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Advanced Custom Fields: NextGEN Gallery Field add-on] No "NextGEN Gallery" option in Field Type](https://wordpress.org/support/topic/no-nextgen-gallery-option-in-field-type/)
 *  [eggproject](https://wordpress.org/support/users/eggproject/)
 * (@eggproject)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/no-nextgen-gallery-option-in-field-type/#post-3620938)
 * i create v4.php => copy my new v4 api code
 * and rewrite nggallery-field.php =>
 * /*
    ORIGINAL PLUGIN COMMENT */
 * add_action(‘acf/register_fields’, ‘my_register_fields’);
 * function my_register_fields()
    { require_once(rtrim( dirname( realpath( __FILE__)),‘/’).”/
   v4.php”); }
 * this work … wp 3.5.2 lastest acf… lastest nextgen…
 * sry i little speak english :(((
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Pricing Table] multiline feature js bugfix](https://wordpress.org/support/topic/multiline-feature-js-bugfix/)
 *  Thread Starter [eggproject](https://wordpress.org/support/users/eggproject/)
 * (@eggproject)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/multiline-feature-js-bugfix/#post-3801314)
 * Hello!
 * I little speak english
 * 1. I did not make the plugin
    2. my bugfix just insert in <head> …..wp_head()
   after ! <script type=”text/javasctipt”>MYBUGFIX</script> …….
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Advanced Custom Fields: NextGEN Gallery Field add-on] No "NextGEN Gallery" option in Field Type](https://wordpress.org/support/topic/no-nextgen-gallery-option-in-field-type/)
 *  [eggproject](https://wordpress.org/support/users/eggproject/)
 * (@eggproject)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/no-nextgen-gallery-option-in-field-type/#post-3620931)
 * Hello…
 * this with acf v4 api
    admin area show , and save this field selected value … 
   front_end the_field and get_field do not test!
 * replace code … (plugin file head comment do not remove!)
 * <?php
 * class acf_field_ACF_NGGallery_Field extends acf_field
    { // vars var $settings,//
   will hold info such as dir / path $defaults; // will hold default field options/***
   Base directory * [@var](https://wordpress.org/support/users/var/) string */ private
   $base_dir;
 *  /**
    * Relative Uri from the WordPress ABSPATH constant * [@var](https://wordpress.org/support/users/var/)
   string */ private $base_uri_rel;
 *  /**
    * Absolute Uri * * This is used to create urls to CSS and JavaScript files.*
   [@var](https://wordpress.org/support/users/var/) string */ private $base_uri_abs;
 *  /**
    * WordPress Localization Text Domain * * The textdomain for the field is
   controlled by the helper class. * [@var](https://wordpress.org/support/users/var/)
   string */ private $l10n_domain;
 *  /*
    * __construct * * Set name / label needed for actions / filters * * [@since](https://wordpress.org/support/users/since/)
   3.6 * [@date](https://wordpress.org/support/users/date/) 23/01/13 */
 *  function __construct()
    {
 *  // settings
    $this->settings = array( ‘path’ => apply_filters(‘acf/helpers/get_path’,
   __FILE__), ‘dir’ => apply_filters(‘acf/helpers/get_dir’, __FILE__), ‘version’
   => ‘1.0.0’ );
 *  //Get the textdomain from the Helper class
    $this->l10n_domain =”acf-nggallery-
   field”;
 *  //Base directory of this field
    $this->base_dir = rtrim( dirname( realpath( 
   __FILE__ ) ), ‘/’ );
 *  //Build the base relative uri by searching backwards until we encounter the 
   wordpress ABSPATH
    $root = array_pop( explode( ‘/’, rtrim( ABSPATH, ‘/’ ) ) );
   $path_parts = explode( ‘/’, $this->base_dir ); $parts = array(); while( $part
   = array_pop( $path_parts ) ) { if( $part == $root ) break; array_unshift( $parts,
   $part ); } $this->base_uri_rel = ‘/’ . implode( ‘/’, $parts ); $this->base_uri_abs
   = get_site_url( null, $this->base_uri_rel );
 * // $this->name = ‘nggallery-field’;
 *  $post_title = ( !class_exists(‘nggdb’) ) ? ‘. ‘ . __( ‘NextGEN Gallery plugin
   is not installed or activated!’, $this->l10n_domain ) : false;
    $this->label 
   = __( ‘NextGEN Gallery’.$post_title, $this->l10n_domain );
 *  // vars
    $this->name = ‘ACF_NGGallery_Field’; // $this->label = __(‘{{field_label}}’);
   $this->category = __(“Basic”,’acf’); // Basic, Content, Choice, etc $this->defaults
   = array( // add default here to merge into your field. // This makes life easy
   when creating the field options as you don’t need to use any if( isset(”) ) logic.
   eg: //’preview_size’ => ‘thumbnail’ );
 * // add_action( ‘admin_print_scripts’, array( &$this, ‘admin_print_scripts’ ),
   12, 0 );
    // add_action( ‘admin_print_styles’, array( &$this, ‘admin_print_styles’),
   12, 0 );
 *  // do not delete!
    parent::__construct(); } /** * Populates the fields array
   with defaults for this field type * * [@param](https://wordpress.org/support/users/param/)
   array $field * [@return](https://wordpress.org/support/users/return/) array */
   private function set_field_defaults( &$field ) { //$field[ ‘nggallery’ ] = ( 
   array_key_exists( ‘nggallery’, $field ) && isset( $field[ ‘nggallery’ ] ) ) ?
   $field[ ‘nggallery’ ] : 0; $field[ ‘nggallery’ ] = 0; $field[ ‘input_type’ ] 
   = ( array_key_exists( ‘input_type’, $field ) && isset( $field[ ‘input_type’ ]))?
   $field[ ‘input_type’ ] : ‘select’; $field[ ‘input_size’ ] = ( array_key_exists(‘
   input_size’, $field ) && isset( $field[ ‘input_size’ ] ) ) ? (int) $field[ ‘input_size’]:
   5; $field[ ‘allow_null’ ] = isset($field[‘allow_null’]) ? $field[‘allow_null’]:
   false; return $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](https://wordpress.org/support/users/type/)
   action * [@since](https://wordpress.org/support/users/since/) 3.6 * [@date](https://wordpress.org/support/users/date/)
   23/01/13 * * [@param](https://wordpress.org/support/users/param/) $field – an
   array holding all the field’s data */
 *  function create_options( $field )
    { // defaults? /* $field = array_merge($this-
   >defaults, $field); */ $this->set_field_defaults( $field ); // key is needed 
   in the field names to correctly save the data $key = $field[‘name’];
 *  ?>
    <tr class=”field_option field_option_<?php echo $this->name; ?>”> <td class
   =”label”> <label><?php _e(“Allow Null?”,’acf’); ?></label> </td> <td> <?php do_action(‘
   acf/create_field’,array( ‘type’ => ‘radio’, ‘name’ => ‘fields[‘.$key.’][allow_null]’,‘
   value’ => $field[‘allow_null’], ‘choices’ => array( ‘1’ => ‘Yes’, ‘0’ => ‘No’,),‘
   layout’ => ‘horizontal’, )); ?> </td> </tr> <tr class=”field_option field_option_
   <?php echo $this->name; ?>”> <td class=”label”> <label><?php _e( ‘Input Method’,
   $this->l10n_domain ); ?></label> <p class=”description”><?php _e( ”, $this->l10n_domain);?
   ></p> </td> <td> <?php do_action(‘acf/create_field’, array( ‘type’ => ‘select’,‘
   name’ => “fields[{$key}][input_type]”, ‘value’ => $field[ ‘input_type’ ], ‘class’
   => “nggallery_input_type nggallery_input_type_{$key}”, ‘choices’ => array( ‘select’
   => ‘Select’, ‘multiselect’ => ‘Multi-Select’, //’token’ => ‘Input Tokenizer’,)));?
   > </td> </tr> <tr id=”nggallery_input_size[<?php echo $key; ?>]” class=”field_option
   field_option_<?php echo $this->name; ?> nggallery_input_size nggallery_input_size_
   <?php echo $key; ?>”> <td class=”label”> <label><?php _e( ‘Multi-Select Size’,
   $this->l10n_domain ); ?></label> <p class=”description”><?php _e( ‘The number
   of rows to show at once in a multi-select.’, $this->l10n_domain ); ?></p> </td
   > <td> <?php do_action(‘acf/create_field’, array( ‘type’ => ‘select’, ‘name’ 
   => “fields[{$key}][input_size]”, ‘value’ => $field[ ‘input_size’ ], ‘choices’
   => array_combine( range( 3, 15, 2 ), range( 3, 15, 2 ) ), ) ); ?> </td> </tr>
   <script type=’text/javascript’>
 *  jQuery(document).ready(function() {
 *  if ( jQuery(‘.nggallery_input_type_<?php echo $key; ?>’).val()==’select’ ) jQuery(‘.
   nggallery_input_size_<?php echo $key; ?>’).hide();
    else jQuery(‘.nggallery_input_size_
   <?php echo $key; ?>’).show();
 *  jQuery(‘.nggallery_input_type_<?php echo $key; ?>’).change(function() {
    if (
   jQuery(‘.nggallery_input_type_<?php echo $key; ?>’).val()==’select’ ) jQuery(‘.
   nggallery_input_size_<?php echo $key; ?>’).hide(); else jQuery(‘.nggallery_input_size_
   <?php echo $key; ?>’).show(); }); });
 *  </script>
    <?php
 *  }
 *  /*
    * create_field() * * Create the HTML interface for your field * * [@param](https://wordpress.org/support/users/param/)
   $field – an array holding all the field’s data * * [@type](https://wordpress.org/support/users/type/)
   action * [@since](https://wordpress.org/support/users/since/) 3.6 * [@date](https://wordpress.org/support/users/date/)
   23/01/13 */
 *  function create_field( $field )
    { global $ngg, $nggdb, $wp_query;
 *  $this->set_field_defaults( $field );
 *  $values = $field[ ‘value’ ];
 *  if ( !empty($values[0]) ):
 *  foreach ( $values as $form ) {
 *  if ( in_array ( ‘gallery’, $form ) )
    $values_gallery[]=$form[‘ngg_id’];
 *  if ( in_array ( ‘album’, $form ) )
    $values_album[]=$form[‘ngg_id’];
 *  }
 *  endif;
 *  if ( class_exists(‘nggdb’) ) :
 *  // Settings of NextGEN Gallery SQL query
    $limit = 0; $start = 0; $order_by 
   = ‘title’; $order_dir = ‘ASC’;
 *  // Seek to all NextGEN Galleries
    $gallerylist = $nggdb->find_all_galleries(
   $order_by, $order_dir , TRUE, $limit, $start, false); $albumlist = $nggdb->find_all_album(‘
   name’, $order_dir, $limit, $start);
 *  $haystack = array( ‘select’, ‘multiselect’ );
    if( in_array( $field[ ‘input_type’],
   $haystack ) ) : ?> <select name=”<?php echo $field[ ‘name’ ]; ?>[]” id=”<?php
   echo $field[ ‘name’ ]; ?>” class=”<?php echo $field[ ‘class’ ]; ?>” <?php echo(
   $field[ ‘input_type’ ] == ‘multiselect’ ) ? ‘multiple=”multiple” size=”‘ . $field[‘
   input_size’ ] . ‘”‘ : ”; ?>> <?php if($field[‘allow_null’] == ‘1’) echo ‘ <option
   value=”null”> – Select – </option>’; ?>
 *  <optgroup label=”<?php _e(‘Galleries’,’nggallery’); ?>”>
    <?php foreach( $gallerylist
   as $gallery ) : ?> <option value=”<?php echo $gallery->gid.’,gallery’; ?>”<?php
   if ( $values_gallery ) selected( in_array( $gallery->gid, $values_gallery ) );?
   >><?php echo $gallery->title; ?></option> <?php endforeach; ?> </optgroup> <optgroup
   label=”<?php _e(‘Albums’,’nggallery’); ?>”> <?php foreach( $albumlist as $album):?
   > <option value=”<?php echo $album->id.’,album’; ?>”<?php if ( $values_album )
   selected( in_array( $album->id, $values_album ) ); ?>><?php echo $album->name;?
   ></option> <?php endforeach; ?> </optgroup> </select> <?php endif;
 *  else:
    ?> <select name=”<?php echo $field[ ‘name’ ]; ?>[]” id=”<?php echo $field[‘
   name’ ]; ?>” class=”<?php echo $field[ ‘class’ ]; ?>”> <option value=”0″ disabled
   =”true”><?php _e( ‘NextGEN Gallery plugin is not installed or activated!’, $this-
   >l10n_domain ); ?></option> </select> <?php endif;
 *  }
 *  /*
    * 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](http://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts)*
   [@type](https://wordpress.org/support/users/type/) action * [@since](https://wordpress.org/support/users/since/)
   3.6 * [@date](https://wordpress.org/support/users/date/) 23/01/13 */
 *  function input_admin_enqueue_scripts()
    { // Note: This function can be removed
   if not used
 * //
    // // register acf scripts // wp_register_script( ‘acf-input-ACF_NGGallery_Field’,
   $this->settings[‘dir’] . ‘js/input.js’, array(‘acf-input’), $this->settings[‘
   version’] ); // wp_register_style( ‘acf-input-ACF_NGGallery_Field’, $this->settings[‘
   dir’] . ‘css/input.css’, array(‘acf-input’), $this->settings[‘version’] ); ////////
   scripts // wp_enqueue_script(array( // ‘acf-input-ACF_NGGallery_Field’, // ));//////
   styles // wp_enqueue_style(array( // ‘acf-input-ACF_NGGallery_Field’, // ));
 *  }
 *  /*
    * 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](https://wordpress.org/support/users/info/)
   [http://codex.wordpress.org/Plugin_API/Action_Reference/admin_head](http://codex.wordpress.org/Plugin_API/Action_Reference/admin_head)*
   [@type](https://wordpress.org/support/users/type/) action * [@since](https://wordpress.org/support/users/since/)
   3.6 * [@date](https://wordpress.org/support/users/date/) 23/01/13 */
 *  function input_admin_head()
    { // Note: This function can be removed if not 
   used }
 *  /*
    * 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](http://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts)*
   [@type](https://wordpress.org/support/users/type/) action * [@since](https://wordpress.org/support/users/since/)
   3.6 * [@date](https://wordpress.org/support/users/date/) 23/01/13 */
 *  function field_group_admin_enqueue_scripts()
    { // Note: This function can be
   removed if not used }
 *  /*
    * 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](https://wordpress.org/support/users/info/)
   [http://codex.wordpress.org/Plugin_API/Action_Reference/admin_head](http://codex.wordpress.org/Plugin_API/Action_Reference/admin_head)*
   [@type](https://wordpress.org/support/users/type/) action * [@since](https://wordpress.org/support/users/since/)
   3.6 * [@date](https://wordpress.org/support/users/date/) 23/01/13 */
 *  function field_group_admin_head()
    { // Note: This function can be removed if
   not used }
 *  /*
    * load_value() * * This filter is appied to the $value after it is loaded
   from the db * * [@type](https://wordpress.org/support/users/type/) filter * [@since](https://wordpress.org/support/users/since/)
   3.6 * [@date](https://wordpress.org/support/users/date/) 23/01/13 * * [@param](https://wordpress.org/support/users/param/)
   $value – the value found in the database * [@param](https://wordpress.org/support/users/param/)
   $post_id – the $post_id from which the value was loaded from * [@param](https://wordpress.org/support/users/param/)
   $field – the field array holding all the field options * * [@return](https://wordpress.org/support/users/return/)
   $value – the value to be saved in te database */
 *  function load_value( $value, $post_id, $field )
    { // Note: This function can
   be removed if not used return $value; }
 *  /*
    * update_value() * * This filter is appied to the $value before it is updated
   in the db * * [@type](https://wordpress.org/support/users/type/) filter * [@since](https://wordpress.org/support/users/since/)
   3.6 * [@date](https://wordpress.org/support/users/date/) 23/01/13 * * [@param](https://wordpress.org/support/users/param/)
   $value – the value which will be saved in the database * [@param](https://wordpress.org/support/users/param/)
   $post_id – the $post_id of which the value will be saved * [@param](https://wordpress.org/support/users/param/)
   $field – the field array holding all the field options * * [@return](https://wordpress.org/support/users/return/)
   $value – the modified value */
 *  function update_value( $value, $post_id, $field )
    { $this->set_field_defaults(
   $field );
 *  foreach( $value as $key=>$item ) {
    $items = explode( ‘,’, $item ); foreach(
   $items as $item ) { if( is_numeric( $item ) ) $values[$key][‘ngg_id’] = intval(
   $item ); else $values[$key][‘ngg_form’] = strval( $item ); } }
 * // parent::update_value( $post_id, $field, $values );
    // Note: This function
   can be removed if not used return $values; }
 *  /*
    * 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](https://wordpress.org/support/users/type/)
   filter * [@since](https://wordpress.org/support/users/since/) 3.6 * [@date](https://wordpress.org/support/users/date/)
   23/01/13 * * [@param](https://wordpress.org/support/users/param/) $value – the
   value which was loaded from the database * [@param](https://wordpress.org/support/users/param/)
   $post_id – the $post_id from which the value was loaded * [@param](https://wordpress.org/support/users/param/)
   $field – the field array holding all the field options * * [@return](https://wordpress.org/support/users/return/)
   $value – the modified value */
 *  function format_value( $value, $post_id, $field )
    { // defaults? /* $field 
   = array_merge($this->defaults, $field); */
 *  // perhaps use $field[‘preview_size’] to alter the $value?
 *  // Note: This function can be removed if not used
    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](https://wordpress.org/support/users/type/) filter * 
   [@since](https://wordpress.org/support/users/since/) 3.6 * [@date](https://wordpress.org/support/users/date/)
   23/01/13 * * [@param](https://wordpress.org/support/users/param/) $value – the
   value which was loaded from the database * [@param](https://wordpress.org/support/users/param/)
   $post_id – the $post_id from which the value was loaded * [@param](https://wordpress.org/support/users/param/)
   $field – the field array holding all the field options * * [@return](https://wordpress.org/support/users/return/)
   $value – the modified value */
 *  function format_value_for_api( $value, $post_id, $field )
    { // defaults? /*
   $field = array_merge($this->defaults, $field); */
 *  // perhaps use $field[‘preview_size’] to alter the $value?
 *  // Note: This function can be removed if not used
    return $value; }
 *  /*
    * load_field() * * This filter is appied to the $field after it is loaded
   from the database * * [@type](https://wordpress.org/support/users/type/) filter*
   [@since](https://wordpress.org/support/users/since/) 3.6 * [@date](https://wordpress.org/support/users/date/)
   23/01/13 * * [@param](https://wordpress.org/support/users/param/) $field – the
   field array holding all the field options * * [@return](https://wordpress.org/support/users/return/)
   $field – the field array holding all the field options */
 *  function load_field( $field )
    { // Note: This function can be removed if not
   used return $field; }
 *  /*
    * update_field() * * This filter is appied to the $field before it is saved
   to the database * * [@type](https://wordpress.org/support/users/type/) filter*
   [@since](https://wordpress.org/support/users/since/) 3.6 * [@date](https://wordpress.org/support/users/date/)
   23/01/13 * * [@param](https://wordpress.org/support/users/param/) $field – the
   field array holding all the field options * [@param](https://wordpress.org/support/users/param/)
   $post_id – the field group ID (post_type = acf) * * [@return](https://wordpress.org/support/users/return/)
   $field – the modified field */
 *  function update_field( $field, $post_id )
    { // Note: This function can be removed
   if not used return $field; }
 * }
 * // create field
    new acf_field_ACF_NGGallery_Field();
 * ?>
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WP Social AutoConnect] ie connect bugfix](https://wordpress.org/support/topic/ie-connect-bugfix/)
 *  Thread Starter [eggproject](https://wordpress.org/support/users/eggproject/)
 * (@eggproject)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/ie-connect-bugfix/#post-3667327)
 * Hello!
 * This not hack!
 * [http://developers.facebook.com/blog/post/2011/07/21/updated-javascript-sdk-and-oauth-2-0-roadmap](http://developers.facebook.com/blog/post/2011/07/21/updated-javascript-sdk-and-oauth-2-0-roadmap)
 * describe the link … been a while since you are not always required to facebook
   Xfbml HTML5 elements or use a lot of operations! it is true that facebook has
   long been not seem to care about the error but if you look around on the net 
   advised for you everywhere! This bomb definitely work and recommended that no
   hack facebook! the codes should be modified only minimally … I like to use the
   plugin so I wrote a patch and the issue is … I could recommend that you put into
   a relationship is until the admins of Facebook will not fix the problem ….

Viewing 7 replies - 1 through 7 (of 7 total)