GetCustomFieldValues() public static method

Retrieves the value of a custom field for a specified post
public static GetCustomFieldValues ( boolean $single, integer $postId, string $customFieldName, integer $groupIndex = 1, integer $fieldIndex = 1 ) : mixed
$single boolean
$postId integer
$customFieldName string
$groupIndex integer
$fieldIndex integer
return mixed
Ejemplo n.º 1
0
function get_audio($fieldName, $groupIndex = 1, $fieldIndex = 1)
{
    require_once "RCCWP_CustomField.php";
    global $wpdb, $post, $FIELD_TYPES;
    $fieldID = RCCWP_CustomField::GetIDByName($fieldName);
    $fieldObject = GetFieldInfo($fieldID);
    $fieldType = $wpdb->get_var("SELECT type FROM " . RC_CWP_TABLE_GROUP_FIELDS . " WHERE id='" . $fieldID . "'");
    $single = true;
    switch ($fieldType) {
        case $FIELD_TYPES["checkbox_list"]:
        case $FIELD_TYPES["listbox"]:
            $single = false;
            break;
    }
    $fieldValues = (array) RCCWP_CustomField::GetCustomFieldValues($single, $post->ID, $fieldName, $groupIndex, $fieldIndex);
    if (!empty($fieldValues)) {
        $fieldValue = $fieldValues[0];
    } else {
        return "";
    }
    $path = FLUTTER_FILES_URI;
    $fieldValue = $path . $fieldValue;
    $finalString = stripslashes(trim("\\<div style=\\'padding-top:3px;\\'\\>\\<object classid=\\'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\\' codebase='\\http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\\' width=\\'95%\\' height=\\'20\\' wmode=\\'transparent\\' \\>\\<param name=\\'movie\\' value=\\'" . FLUTTER_URI . "js/singlemp3player.swf?file=" . urlencode($fieldValue) . "\\' wmode=\\'transparent\\' /\\>\\<param name=\\'quality\\' value=\\'high\\' wmode=\\'transparent\\' /\\>\\<embed src=\\'" . FLUTTER_URI . "js/singlemp3player.swf?file=" . urlencode($fieldValue) . "' width=\\'50\\%\\' height=\\'20\\' quality=\\'high\\' pluginspage=\\'http://www.macromedia.com/go/getflashplayer\\' type=\\'application/x-shockwave-flash\\' wmode=\\'transparent\\' \\>\\</embed\\>\\</object\\>\\</div\\>"));
    return $finalString;
}
Ejemplo n.º 2
0
    public static function MediaPhotoInterface($customField, $inputName, $groupCounter, $fieldCounter)
    {
        global $mf_domain, $post;
        $idField = RCCWP_WritePostPage::changeNameInput($inputName);
        if (!empty($_GET['post'])) {
            $hidValue = RCCWP_CustomField::GetCustomFieldValues(true, $_GET['post'], $customField->name, $groupCounter, $fieldCounter);
        } else {
            $hidValue = '';
        }
        $filepath = $inputName . '_filepath';
        //The Image is required?
        $requiredClass = "";
        if ($customField->required_field) {
            $requiredClass = "field_required";
        }
        $imageThumbID = "img_thumb_" . $idField;
        $value = "<img src='" . MF_URI . "images/noimage.jpg' id='{$imageThumbID}'/>";
        if (!empty($hidValue)) {
            $path = PHPTHUMB . "?src=";
            $info = wp_get_attachment_image_src($hidValue, 'original');
            $path_image_media = $info[0];
            $value = $path . $path_image_media . "&w=150&h=120&zc=1";
            $value = "<img src='{$value}' id='{$imageThumbID}'/>";
        }
        ?>
  		<p 	class="error_msg_txt" id="upload_progress_<?php 
        echo $idField;
        ?>
" style="visibility:hidden;height:0px">
  		</p>	
  		<div id="image_photo" style="width:150px; float: left">
  			<?php 
        echo $value;
        ?>
  		<div id="photo_edit_link_<?php 
        echo $idField;
        ?>
" class="photo_edit_link"> 
  			<?php 
        if ($hidValue) {
            echo "&nbsp;<strong><a href='#remove' class='remove_media' id='remove-{$idField}'>" . __("Remove Image", $mf_domain) . "</a></strong>";
        }
        ?>
  		</div>
  		</div>
  		<div id="image_input" style="padding-left: 170px;">
  	<?php 
        if (empty($requiredClass)) {
            $requiredClass = '';
        }
        ?>
		
  			<div class="mf_custom_field">
  			<input tabindex="3" 
  				id="<?php 
        echo $idField;
        ?>
" 
  				name="<?php 
        echo $inputName;
        ?>
" 
  				type="hidden" 
  				class="<?php 
        echo $requiredClass;
        ?>
"
  				size="46"
  				value="<?php 
        echo $hidValue;
        ?>
"
  				<?php 
        if ($customField->required_field) {
            echo 'validate="required:true"';
        }
        ?>
  				/>
  				<?php 
        $thumb_class = 'thickbox1';
        if (is_wp30()) {
            $thumb_class = 'thickbox';
        }
        ?>

  			<a class="<?php 
        echo $thumb_class;
        ?>
 update_field_media_upload" id="thumb_<?php 
        echo $idField;
        ?>
" href="media-upload.php?post_id=<?php 
        echo $post->ID;
        ?>
&#038;type=image&#038;TB_iframe=1" ><?php 
        _e('Set Image', $mf_domain);
        ?>
</a>
  			</div>
  			<?php 
        if (!is_wp30()) {
            ?>
  			<script>
  			jQuery(document).ready(function(){
        	tb_init('a#thumb_<?php 
            echo $idField;
            ?>
');
        	jQuery('a#thumb_<?php 
            echo $idField;
            ?>
').click( function(){
        	  window.mf_field_id = jQuery(this).attr('id');
        	});
        });
  			</script>
  			<?php 
        }
        ?>
  		</div>

  		<div style="clear: both; height: 1px;"> </div>
  			<?php 
        if ($customField->required_field) {
            ?>
  				<div class="mf_message_error"><label for="<?php 
            echo $inputName;
            ?>
" class="error_magicfields error"><?php 
            _e("This field is required", $mf_domain);
            ?>
</label></div>
  			<?php 
        }
        ?>

  		<?php 
    }
Ejemplo n.º 3
0
    function SliderInterface($customField, $inputName, $groupCounter, $fieldCounter, $fieldValue = NULL)
    {
        $customFieldId = $customField->id;
        if (!empty($_REQUEST['post'])) {
            $value = attribute_escape(RCCWP_CustomField::GetCustomFieldValues(true, $_REQUEST['post'], $customField->name, $groupCounter, $fieldCounter));
        } else {
            $value = 0;
        }
        if ($fieldValue) {
            $value = $fieldValue;
        } else {
            if (!empty($_REQUEST['post'])) {
                $value = attribute_escape(RCCWP_CustomField::GetCustomFieldValues(true, $_REQUEST['post'], $customField->name, $groupCounter, $fieldCounter));
            } else {
                $value = 0;
            }
        }
        if (!$customField->properties['min']) {
            $customField->properties['min'] = 0;
        }
        if (!$value) {
            $value = $customField->properties['min'];
        }
        if (!$customField->properties['max']) {
            $customField->properties['max'] = 100;
        }
        if (!$customField->properties['step']) {
            $customField->properties['step'] = 1;
        }
        ?>
			<script>
				jQuery('document').ready(function(){
					jQuery('#slider_<?php 
        echo $inputName;
        ?>
').slider({
						range: false, 
						value: <?php 
        echo $value;
        ?>
, 
						min: <?php 
        echo $customField->properties['min'];
        ?>
, 
						max: <?php 
        echo $customField->properties['max'];
        ?>
, 
						step: <?php 
        echo $customField->properties['step'];
        ?>
,
						handles: [{
							start: <?php 
        echo $value;
        ?>
, 
							step: <?php 
        echo $customField->properties['step'];
        ?>
,
							min: <?php 
        echo $customField->properties['min'];
        ?>
, 
							max: <?php 
        echo $customField->properties['max'];
        ?>
, 
							id: 'slider_<?php 
        echo $inputName;
        ?>
'
							}],
						'slide': function(e, ui) {
								jQuery('#slide_value_<?php 
        echo $inputName;
        ?>
').empty();
								jQuery('#slide_value_<?php 
        echo $inputName;
        ?>
').append(ui.value);
								jQuery('#<?php 
        echo $inputName;
        ?>
').val(ui.value);
							}
						});
				});
			</script>
			<div id='slider_<?php 
        echo $inputName;
        ?>
' class='ui-slider-2' style="margin:40px;">
				<div class='ui-slider-handle'>
					<div class="slider_numeber_show" id="slide_value_<?php 
        echo $inputName;
        ?>
">
						<?php 
        echo $value;
        ?>
					</div>
				</div>	
			</div>
			<input  type="hidden" id="<?php 
        echo $inputName;
        ?>
" name="<?php 
        echo $inputName;
        ?>
" value="<?php 
        echo $value;
        ?>
"  />		
		<?php 
    }
Ejemplo n.º 4
0
    function SliderInterface($customField, $inputName, $groupCounter, $fieldCounter, $fieldValue = NULL)
    {
        $customFieldId = $customField->id;
        $value = attribute_escape(RCCWP_CustomField::GetCustomFieldValues(true, $_REQUEST['post'], $customField->name, $groupCounter, $fieldCounter));
        if ($fieldValue) {
            $value = $fieldValue;
        } else {
            $value = attribute_escape(RCCWP_CustomField::GetCustomFieldValues(true, $_REQUEST['post'], $customField->name, $groupCounter, $fieldCounter));
        }
        if (!$customField->properties['min']) {
            $customField->properties['min'] = 0;
        }
        if (!$value) {
            $value = $customField->properties['min'];
        }
        if (!$customField->properties['max']) {
            $customField->properties['max'] = 100;
        }
        if (!$customField->properties['step']) {
            $customField->properties['step'] = 0;
        }
        ?>
		<link rel="stylesheet" href="<?php 
        echo FLUTTER_URI;
        ?>
css/flora.slider.css" type="text/css" media="screen" title="Flora (Default)">
		<script type="text/javascript" src="<?php 
        echo FLUTTER_URI;
        ?>
js/ui.slider.js"></script>

		<script type="text/javascript">
			jQuery('document').ready(function(){
				jQuery('#slider_<?php 
        echo $inputName;
        ?>
').slider({range: true, start: <?php 
        echo $value;
        ?>
 , min: <?php 
        echo $customField->properties['min'];
        ?>
, max: <?php 
        echo $customField->properties['max'];
        ?>
, stepping: <?php 
        echo $customField->properties['step'];
        ?>
,
							handles: [ {start: <?php 
        echo $value;
        ?>
, stepping: <?php 
        echo $customField->properties['step'];
        ?>
,min: <?php 
        echo $customField->properties['min'];
        ?>
, max: <?php 
        echo $customField->properties['max'];
        ?>
, id: 'slider_<?php 
        echo $inputName;
        ?>
'} ]
							//,change: function(e,ui) {
							//	jQuery('#slide_value_<?php 
        echo $inputName;
        ?>
').empty();
							//	jQuery('#slide_value_<?php 
        echo $inputName;
        ?>
').append(ui.value);
							//	jQuery('#<?php 
        echo $inputName;
        ?>
').val(ui.value);
							//	}
							,'slide': function(e, ui){ 
                    jQuery('#slide_value_<?php 
        echo $inputName;
        ?>
').empty();
								jQuery('#slide_value_<?php 
        echo $inputName;
        ?>
').append(ui.value);
								jQuery('#<?php 
        echo $inputName;
        ?>
').val(ui.value);
            }

								});
			//jQuery('#slider_<?php 
        echo $inputName;
        ?>
').slider("moveTo", "+=6")
			//jQuery('#slider_<?php 
        echo $inputName;
        ?>
').slider("value", "9")
			});
		</script>
		<style>
		.slider_numeber_show{
			margin-top: -16px;
			padding-left: 3px;
		}
		</style>
			<div id='slider_<?php 
        echo $inputName;
        ?>
' class='ui-slider-2' style="margin:40px;">
				<div class='ui-slider-handle'><div class="slider_numeber_show" id="slide_value_<?php 
        echo $inputName;
        ?>
">
				<?php 
        echo $value;
        ?>
				</div></div>	
			</div>
			<input  type="hidden" id="<?php 
        echo $inputName;
        ?>
" name="<?php 
        echo $inputName;
        ?>
" value="<?php 
        echo $value;
        ?>
"  />
			



		
		<?php 
    }