| Server IP : 89.39.208.18 / Your IP : 216.73.217.74 Web Server : LiteSpeed System : User : ( ) PHP Version : 7.4.33 Disable Function : eval,./,ln,passthru,dl,system,exec,popen,shell_exec,posix_getpwuid,posix_uname,ftp_exec,posix_uname,posix_getpwuid,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,get_current_user,getmyuid,getmygid,listen,chgrp,apache_note,apache_setenv,apache_child_terminate,closelog,debugger_off,debugge_on,ini_restore,netscript,escapeshellarg,cmd,backtick,virtual,show_sourc,show_source,pclose,pcntl_exec,datasec,old_offset,ctrl_dir,ini_alter,leak,listen,chgrp,apache_setenv,define_syslog_variables,root,diskfreespace,disk_free_space,disk_total_space,posix_kill,getmyuid,getmygid,apache_child_terminate,php_ini_scanned_files,ls,ps_aux,chown,getrusage,posixc,posame,chgrp,posix_setuid,posix_setsid,posix_setgid,apache_note,apache_setenv,x_getuid,e_ini_file,nfo,SQL,mysql_li,t_dbs,filegroup,highlight_file,ilegetcontents,get_dir,popen,popens,pfsockopen,dos_conv,apache_get_modules,crack_check,crack_closedict,rar_open,bzopen,bzread,bzwrite,shellcode,posix_isatty,posix_getservbyname,escapeshellarg,hypot,pg_host,pos,posix_access,inurl,posix_times,posix_mknod,pclose,ps_fill,symlink,id,escapeshellcmd,php_uname,phpinfo MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home3/././mahyarcake/./www/wp-content/plugins/powerpack-elements/classes/ |
Upload File : |
<?php
/**
* Attachment Data Extra fields
*
* @package PowerPack
*/
if ( ! class_exists( 'PP_Attachment' ) ) {
/**
* Class PP_Attachment.
*/
class PP_Attachment {
/**
* Constructor function that initializes required actions and hooks
*
* @since 1.0
*/
public function __construct() {
add_filter( 'attachment_fields_to_edit', array( $this, 'custom_attachment_field_link' ), 10, 2 );
add_filter( 'attachment_fields_to_save', array( $this, 'custom_attachment_field_link_save' ), 10, 2 );
}
/**
* Add Custom Link field to media uploader
*
* @param array $form_fields fields to include in attachment form.
* @param object $post attachment record in database.
* @return aaray $form_fields modified form fields
*/
public function custom_attachment_field_link( $form_fields, $post ) {
$form_fields['pp-custom-link'] = array(
'label' => __( 'PP - Custom Link', 'powerpack' ),
'input' => 'text',
'value' => get_post_meta( $post->ID, 'pp-custom-link', true ),
);
return $form_fields;
}
/**
* Save values of Custom Link field in media uploader
*
* @param array $post the post data for database.
* @param array $attachment attachment fields from $_POST form.
* @return array $post modified post data.
*/
public function custom_attachment_field_link_save( $post, $attachment ) {
if ( isset( $attachment['pp-custom-link'] ) ) {
update_post_meta( $post['ID'], 'pp-custom-link', $attachment['pp-custom-link'] );
}
return $post;
}
}
new PP_Attachment();
}