<commit_before><?php
/**
 * Flickerd Theme Functions
 *
 * These functions provide the custom functionality of the Flickerd theme.
 * It also loads and istantiates the {@link flickerd} class, which further extends
 * the theme's functionality and is used throughout the theme.
 *
 * @package     Flickerd
 * @version     1.0.0
 * @author      <NAME> <<EMAIL>>
 * @link        http://github.com/amereservant/FlickerdTheme
 * @license     http://opensource.org/licenses/mit-license.php MIT License
 */
if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR);
define('FLICKERD_PATH', realpath(dirname(__FILE__)) . DS);

require_once FLICKERD_PATH . 'flickerd.class.php';


/**
 * Get The EXIF Camera Model
 *
 * Returns the Camera Model from the EXIF data and also compares it against a custom list
 * of camera models to correct oddly-named camera models.
 * You may add additional camera models to the $models array, but please be sure to
 * contact the Theme author so it can be added to the theme for others to benefit from
 * if it's a correction.
 *
 * @param   void
 * @return  string      The camera model if found, (bool)false if not
 * @since   1.0.0
 */
function getEXIFCameraModel()
{
	$models = array(
	    'SQ907B EZ-Cam'     => 'Fisher-Price Kid Tough Camera',
	);
	
	$t_EXIF = getImageMetaData();
	$camera = isset($t_EXIF['EXIFModel']) ? $t_EXIF['EXIFModel'] : '';
	if(isset($models[$camera])) $camera = $models[$camera];
	
	return strlen($camera) > 0 ? $camera : false;
}

/**
 * Calculate Image Width/Height
 *
 * This calculates the width and height attributes for an <img> element since there
 * doesn't appear to be a built-in function to do this for a custom image.
 * Since it makes for faster browser load times for images to have these, then this
 * function does the dirty work.
 *
 * @param   $h      int     The original image height
 * @param   $w      int     The original image width
 * @param   $max    int     The new images max width/height.
 *                          This will be the largest value for either one and the aspect
 *                          ratio will automatically determine the smaller value.
 * @return  string          The attributes like so: 'width="300" height="230"';
 * @since   1.0.0
 */
function getImageWH($h, $w, $max)
{
    $ratio  = $h > $w ? ($h/$w) : ($w/$h);
    $width  = $h > $w ? floor($max/$ratio) : $max;
    $height = $h < $w ? floor($max/$ratio) : $max;
    
    return 'width="'. $width .'" height="'. $height .'"';
}


/**
 * Create Comment Field
 *
 * This function is used to create the form input fields for the comment form and reduce
 * the redundant syntax in the template file.
 * It is used in {@link comment_form.php}.
 *
 * @param   string  $name       The name attribute for the input field
 * @param   string  $id         A unique id attribute for the input field
 * @param   string  $class      Any CSS classes that should be applied to the element
 * @param   string  $value      The value for the field
 * @param   string  $type       Form input type.  Accepted values are 'text'.  Default is 'text'.
 * @param   bool    $disabled   If the field should be disabled from user-input
 * @param   bool    $add_hidden If the $disabled parameter is true and the input field is a text
 *                              field, then this most likely should be set to true
 * @return  string              Prints out the HTML syntax for the field unless an error occurs
 */
function flkrPrintCommentField( $name, $id, $class, $value, $type='text', $disabled=false, $add_hidden=false )
{
    // Check for a valid type, return false on failure
    if(!in_array($type, array('text'))) return false;
    
    $format    = '<input type="%s" name="%s" id="%s"%s value="%s"%s />';
    $dis_class = ' disabled-field'; // CSS class applied to disabled fields for styling purposes
    
    $output = sprintf($format, $type, $name .($disabled ? '-disabled':''),
        $id .($disabled ? '-disabled':''), ' class="inputbox'. ($disabled ? $dis_class:'') .'"', 
        $value, ' size="22"'.($disabled ? ' disabled':''));
    /**
     * Ignore this and possibly delete it in the near future.
    if($add_hidden) {
        $output .= "\n";
        $output .= sprintf($format, 'hidden', $name, $id, '', $value, '');
    }
    */<commit_msg>Re-added the hidden fields for disabled form fields so the values are still passed on form submission.<commit_after><?php
/**
 * Flickerd Theme Functions
 *
 * These functions provide the custom functionality of the Flickerd theme.
 * It also loads and istantiates the {@link flickerd} class, which further extends
 * the theme's functionality and is used throughout the theme.
 *
 * @package     Flickerd
 * @version     1.0.0
 * @author      <NAME> <<EMAIL>>
 * @link        http://github.com/amereservant/FlickerdTheme
 * @license     http://opensource.org/licenses/mit-license.php MIT License
 */
if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR);
define('FLICKERD_PATH', realpath(dirname(__FILE__)) . DS);

require_once FLICKERD_PATH . 'flickerd.class.php';


/**
 * Get The EXIF Camera Model
 *
 * Returns the Camera Model from the EXIF data and also compares it against a custom list
 * of camera models to correct oddly-named camera models.
 * You may add additional camera models to the $models array, but please be sure to
 * contact the Theme author so it can be added to the theme for others to benefit from
 * if it's a correction.
 *
 * @param   void
 * @return  string      The camera model if found, (bool)false if not
 * @since   1.0.0
 */
function getEXIFCameraModel()
{
	$models = array(
	    'SQ907B EZ-Cam'     => 'Fisher-Price Kid Tough Camera',
	);
	
	$t_EXIF = getImageMetaData();
	$camera = isset($t_EXIF['EXIFModel']) ? $t_EXIF['EXIFModel'] : '';
	if(isset($models[$camera])) $camera = $models[$camera];
	
	return strlen($camera) > 0 ? $camera : false;
}

/**
 * Calculate Image Width/Height
 *
 * This calculates the width and height attributes for an <img> element since there
 * doesn't appear to be a built-in function to do this for a custom image.
 * Since it makes for faster browser load times for images to have these, then this
 * function does the dirty work.
 *
 * @param   $h      int     The original image height
 * @param   $w      int     The original image width
 * @param   $max    int     The new images max width/height.
 *                          This will be the largest value for either one and the aspect
 *                          ratio will automatically determine the smaller value.
 * @return  string          The attributes like so: 'width="300" height="230"';
 * @since   1.0.0
 */
function getImageWH($h, $w, $max)
{
    $ratio  = $h > $w ? ($h/$w) : ($w/$h);
    $width  = $h > $w ? floor($max/$ratio) : $max;
    $height = $h < $w ? floor($max/$ratio) : $max;
    
    return 'width="'. $width .'" height="'. $height .'"';
}


/**
 * Create Comment Field
 *
 * This function is used to create the form input fields for the comment form and reduce
 * the redundant syntax in the template file.
 * It is used in {@link comment_form.php}.
 *
 * @param   string  $name       The name attribute for the input field
 * @param   string  $id         A unique id attribute for the input field
 * @param   string  $class      Any CSS classes that should be applied to the element
 * @param   string  $value      The value for the field
 * @param   string  $type       Form input type.  Accepted values are 'text'.  Default is 'text'.
 * @param   bool    $disabled   If the field should be disabled from user-input
 * @return  string              Prints out the HTML syntax for the field unless an error occurs
 */
function flkrPrintCommentField( $name, $id, $class, $value, $type='text', $disabled=false )
{
    // Check for a valid type, return false on failure
    if(!in_array($type, array('text'))) return false;
    
    $format    = '<input type="%s" name="%s" id="%s"%s value="%s"%s />';
    $dis_class = ' disabled-field'; // CSS class applied to disabled fields for styling purposes
    
    $output = sprintf($format, $type, $name .($disabled ? '-disabled':''),
        $id .($disabled ? '-disabled':''), ' class="inputbox'. ($disabled ? $dis_class:'') .'"', 
        $value, ' size="22"'.($disabled ? ' disabled':''));
    
    if($disabled) {
        $output .= "\n";
        $output .= sprintf($format, 'hidden', $name, $id, '', $value, '');
    }
    
{'fraction_non_alphanumeric': 0.12566813160707924, 'fraction_numerical': 0.004988715999524884, 'mean_word_length': 2.914458391445839, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4757976', 'n_tokens_mistral': 2497, 'n_tokens_neox': 2446, 'n_words': 969}