' . "\n"; $metabox_html .= ''; $metabox_html .= $can_delete ? '' : ''; $metabox_html .= '' . $titles[ 'key' ] . ''; $metabox_html .= '' . $titles[ 'value' ] . ''; $metabox_html .= '' . "\n"; $metabox_html .= '' . "\n"; ksort( $md_filtered ); $row_count = 0; foreach( $md_filtered as $meta_key => $value ) { foreach ( $exclude_keys as $key_preg ) { if ( preg_match( $key_preg, $meta_key ) ) { continue 2; } } $row_count++; $is_added_meta = isset( $metadata[ $meta_key ] ) ? false : true; // Check before sanitizing key. $meta_key = SucomUtil::sanitize_meta_key( $meta_key ); // Decode and remove html/js/css and quotes. $meta_key_esc = esc_html( $meta_key ); $value = is_string( $value ) ? $value : self::array_maybe_unserialize( $value ); $value_esc = esc_html( var_export( $value, true ) ); $table_row_id = SucomUtil::sanitize_key( $metabox_id . '_' . $obj_id . '_' . $meta_key ); $metabox_html .= $is_added_meta ? '' : ''; if ( $can_delete ) { $onclick_js = 'sucomDeleteMeta' . '( \'' . $metabox_id . // Already sanitized. '\', \'' . $obj_id . // Already sanitized. '\', \'' . $meta_key . // Already sanitized. '\', \'' . $admin_l10n . // Already sanitized. '\' );'; $metabox_html .= ''; $metabox_html .= $is_added_meta ? '' : ''; $metabox_html .= ''; } $metabox_html .= '
' . $meta_key_esc . '
'; $metabox_html .= '
' . $value_esc . '
'; $metabox_html .= '' . "\n"; } if ( ! $row_count ) { $metabox_html .= ''; $metabox_html .= $can_delete ? '' : ''; $metabox_html .= '
';
				$metabox_html .= '
';
				$metabox_html .= '' . "\n";
			}

			$metabox_html .= '' . "\n";

			return $metabox_html;
		}

		public static function get_table_metadata_css( $metabox_id ) {

			$custom_style_css = '

				div#' . $metabox_id . '.postbox table {
					width:100%;
					max-width:100%;
					text-align:left;
					table-layout:fixed;
				}

				div#' . $metabox_id . '.postbox table tr.added-meta td {
					background-color:#eee;
				}

				div#' . $metabox_id . '.postbox table tr.added-meta td.del-column {
					background-color:inherit;
				}

				div#' . $metabox_id . '.postbox table .del-column {	/* th and td */
					padding-top:15px;
					padding-left:0;
					border:none;
					width:2em;
					color:red;
				}

				div#' . $metabox_id . '.postbox table .del-column span {
					font-size:1em;
					width:1em;
					height:1em;
				}

				div#' . $metabox_id . '.postbox table .del-column span:hover {
					cursor:pointer;
				}

				div#' . $metabox_id . '.postbox table .key-column {	/* th and td */
					width:30%;
				}

				div#' . $metabox_id . '.postbox table .value-column {	/* th and td */
					width:auto;
				}

				div#' . $metabox_id . '.postbox table td {
					padding:10px;
					vertical-align:top;
					border:1px dotted #ccc;
				}

				div#' . $metabox_id . '.postbox table td div {
					overflow-x:auto;
				}

				div#' . $metabox_id . '.postbox table td div pre {
					margin:0;
					padding:0;
				}
			';

			$custom_style_css = self::minify_css( $custom_style_css, $metabox_id );

			return '';
		}
	}
}